Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(333)

Side by Side Diff: gclient.py

Issue 8382030: depot_tools: Add git svn find-rev for safesync_url parsing (commonly LKGR link). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: changing more occurrences of SVN to Svn Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | gclient_scm.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2011 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 """Meta checkout manager supporting both Subversion and GIT. 6 """Meta checkout manager supporting both Subversion and GIT.
7 7
8 Files 8 Files
9 .gclient : Current client configuration, written by 'config' command. 9 .gclient : Current client configuration, written by 'config' command.
10 Format is a Python script defining 'solutions', a list whose 10 Format is a Python script defining 'solutions', a list whose
(...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 return revision_overrides 916 return revision_overrides
917 # Do not check safesync_url if one or more --revision flag is specified. 917 # Do not check safesync_url if one or more --revision flag is specified.
918 if not self._options.revisions: 918 if not self._options.revisions:
919 for s in self.dependencies: 919 for s in self.dependencies:
920 if not s.managed: 920 if not s.managed:
921 self._options.revisions.append('%s@unmanaged' % s.name) 921 self._options.revisions.append('%s@unmanaged' % s.name)
922 elif s.safesync_url: 922 elif s.safesync_url:
923 handle = urllib.urlopen(s.safesync_url) 923 handle = urllib.urlopen(s.safesync_url)
924 rev = handle.read().strip() 924 rev = handle.read().strip()
925 handle.close() 925 handle.close()
926 if len(rev): 926 scm = gclient_scm.CreateSCM(s.url, s.root.root_dir, s.name)
927 self._options.revisions.append('%s@%s' % (s.name, rev)) 927 safe_rev = scm.GetUsableRev(rev=rev, options=self._options)
928 if not safe_rev:
929 raise gclient_utils.Error(
930 'Despite our best attempts, we couldn\'t find a useful\n'
931 'safesync_url revision for you.')
932 if self._options.verbose:
933 print('Using safesync_url revision: %s.\n' % safe_rev)
934 self._options.revisions.append('%s@%s' % (s.name, safe_rev))
928 if not self._options.revisions: 935 if not self._options.revisions:
929 return revision_overrides 936 return revision_overrides
930 solutions_names = [s.name for s in self.dependencies] 937 solutions_names = [s.name for s in self.dependencies]
931 index = 0 938 index = 0
932 for revision in self._options.revisions: 939 for revision in self._options.revisions:
933 if not '@' in revision: 940 if not '@' in revision:
934 # Support for --revision 123 941 # Support for --revision 123
935 revision = '%s@%s' % (solutions_names[index], revision) 942 revision = '%s@%s' % (solutions_names[index], revision)
936 sol, rev = revision.split('@', 1) 943 sol, rev = revision.split('@', 1)
937 if not sol in solutions_names: 944 if not sol in solutions_names:
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
1517 except (gclient_utils.Error, subprocess2.CalledProcessError), e: 1524 except (gclient_utils.Error, subprocess2.CalledProcessError), e:
1518 print >> sys.stderr, 'Error: %s' % str(e) 1525 print >> sys.stderr, 'Error: %s' % str(e)
1519 return 1 1526 return 1
1520 1527
1521 1528
1522 if '__main__' == __name__: 1529 if '__main__' == __name__:
1523 fix_encoding.fix_encoding() 1530 fix_encoding.fix_encoding()
1524 sys.exit(Main(sys.argv[1:])) 1531 sys.exit(Main(sys.argv[1:]))
1525 1532
1526 # vim: ts=2:sw=2:tw=80:et: 1533 # vim: ts=2:sw=2:tw=80:et:
OLDNEW
« no previous file with comments | « no previous file | gclient_scm.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698