OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Performs all git-svn setup steps necessary for 'git svn dcommit' to work. | 6 """Performs all git-svn setup steps necessary for 'git svn dcommit' to work. |
7 | 7 |
8 Assumes that trunk of the svn remote maps to master of the git remote. | 8 Assumes that trunk of the svn remote maps to master of the git remote. |
9 | 9 |
10 Example: | 10 Example: |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 svn_path = None | 71 svn_path = None |
72 for i in xrange(len(path_components)): | 72 for i in xrange(len(path_components)): |
73 try: | 73 try: |
74 maybe_repo = '%s://%s%s' % ( | 74 maybe_repo = '%s://%s%s' % ( |
75 parsed_svn.scheme, parsed_svn.netloc, '/'.join(path_components[:i+1])) | 75 parsed_svn.scheme, parsed_svn.netloc, '/'.join(path_components[:i+1])) |
76 print 'Checking ', maybe_repo | 76 print 'Checking ', maybe_repo |
77 run_svn('info', maybe_repo) | 77 run_svn('info', maybe_repo) |
78 svn_repo = maybe_repo | 78 svn_repo = maybe_repo |
79 svn_path = '/'.join(path_components[i+1:]) | 79 svn_path = '/'.join(path_components[i+1:]) |
80 break | 80 break |
81 except subprocess2.CalledProcessError: | 81 except subprocess2.CalledProcessError, e: |
| 82 if 'E170001' in str(e): |
| 83 print 'Authentication failed:' |
| 84 print e |
| 85 print ('Try running "svn ls %s" with the password' |
| 86 ' from https://chromium-access.appspot.com' % maybe_repo) |
| 87 print |
82 continue | 88 continue |
83 assert svn_repo is not None, 'Unable to find svn repo for %s' % match.group(1) | 89 assert svn_repo is not None, 'Unable to find svn repo for %s' % match.group(1) |
84 print 'Found upstream svn repo %s and path %s' % (svn_repo, svn_path) | 90 print 'Found upstream svn repo %s and path %s' % (svn_repo, svn_path) |
85 | 91 |
86 set_config('svn-remote.svn.url', svn_repo) | 92 set_config('svn-remote.svn.url', svn_repo) |
87 set_config('svn-remote.svn.fetch', | 93 set_config('svn-remote.svn.fetch', |
88 '%s:refs/remotes/%s' % (svn_path, upstream)) | 94 '%s:refs/remotes/%s' % (svn_path, upstream)) |
89 print 'Configured metadata, running "git svn fetch". This may take some time.' | 95 print 'Configured metadata, running "git svn fetch". This may take some time.' |
90 for line in run_git_stream('svn', 'fetch').xreadlines(): | 96 for line in run_git_stream('svn', 'fetch').xreadlines(): |
91 print line.strip() | 97 print line.strip() |
92 | 98 |
93 | 99 |
94 if __name__ == '__main__': | 100 if __name__ == '__main__': |
95 sys.exit(main(sys.argv)) | 101 sys.exit(main(sys.argv)) |
OLD | NEW |