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

Side by Side Diff: gclient.py

Issue 2105493002: Restore --head/-H to gclient (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Fix accidental deletion Created 4 years, 5 months 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
« no previous file with comments | « no previous file | no next file » | 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) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 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 # Files 7 # Files
8 # .gclient : Current client configuration, written by 'config' command. 8 # .gclient : Current client configuration, written by 'config' command.
9 # Format is a Python script defining 'solutions', a list whose 9 # Format is a Python script defining 'solutions', a list whose
10 # entries each are maps binding the strings "name" and "url" 10 # entries each are maps binding the strings "name" and "url"
(...skipping 1457 matching lines...) Expand 10 before | Expand all | Expand 10 after
1468 exec(gclient_utils.FileRead(filename), scope) 1468 exec(gclient_utils.FileRead(filename), scope)
1469 except SyntaxError as e: 1469 except SyntaxError as e:
1470 gclient_utils.SyntaxErrorToError(filename, e) 1470 gclient_utils.SyntaxErrorToError(filename, e)
1471 return scope['entries'] 1471 return scope['entries']
1472 1472
1473 def _EnforceRevisions(self): 1473 def _EnforceRevisions(self):
1474 """Checks for revision overrides.""" 1474 """Checks for revision overrides."""
1475 revision_overrides = {} 1475 revision_overrides = {}
1476 if not self._options.revisions: 1476 if not self._options.revisions:
1477 for s in self.dependencies: 1477 for s in self.dependencies:
1478 if not s.managed: 1478 if not s.managed and not self._options.head:
1479 self._options.revisions.append('%s@unmanaged' % s.name) 1479 self._options.revisions.append('%s@unmanaged' % s.name)
1480 if not self._options.revisions: 1480 if not self._options.revisions:
1481 return revision_overrides 1481 return revision_overrides
1482 solutions_names = [s.name for s in self.dependencies] 1482 solutions_names = [s.name for s in self.dependencies]
1483 index = 0 1483 for i, revision in enumerate(self._options.revisions):
1484 for revision in self._options.revisions:
1485 if not '@' in revision: 1484 if not '@' in revision:
1486 # Support for --revision 123 1485 # Support for --revision 123
1487 revision = '%s@%s' % (solutions_names[index], revision) 1486 name, rev = solutions_names[i], revision
1488 name, rev = revision.split('@', 1) 1487 else:
1488 name, rev = revision.split('@', 1)
1489 revision_overrides[name] = rev 1489 revision_overrides[name] = rev
1490 index += 1
1491 return revision_overrides 1490 return revision_overrides
1492 1491
1493 def RunOnDeps(self, command, args, ignore_requirements=False, progress=True): 1492 def RunOnDeps(self, command, args, ignore_requirements=False, progress=True):
1494 """Runs a command on each dependency in a client and its dependencies. 1493 """Runs a command on each dependency in a client and its dependencies.
1495 1494
1496 Args: 1495 Args:
1497 command: The command to use (e.g., 'status' or 'diff') 1496 command: The command to use (e.g., 'status' or 'diff')
1498 args: list of str - extra arguments to add to the command line. 1497 args: list of str - extra arguments to add to the command line.
1499 """ 1498 """
1500 if not self.dependencies: 1499 if not self.dependencies:
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
1992 help='Clone git "branch_heads" refspecs in addition to ' 1991 help='Clone git "branch_heads" refspecs in addition to '
1993 'the default refspecs. This adds about 1/2GB to a ' 1992 'the default refspecs. This adds about 1/2GB to a '
1994 'full checkout. (git only)') 1993 'full checkout. (git only)')
1995 parser.add_option('--with_tags', action='store_true', 1994 parser.add_option('--with_tags', action='store_true',
1996 help='Clone git tags in addition to the default refspecs.') 1995 help='Clone git tags in addition to the default refspecs.')
1997 parser.add_option('-t', '--transitive', action='store_true', 1996 parser.add_option('-t', '--transitive', action='store_true',
1998 help='When a revision is specified (in the DEPS file or ' 1997 help='When a revision is specified (in the DEPS file or '
1999 'with the command-line flag), transitively update ' 1998 'with the command-line flag), transitively update '
2000 'the dependencies to the date of the given revision. ' 1999 'the dependencies to the date of the given revision. '
2001 'Only supported for SVN repositories.') 2000 'Only supported for SVN repositories.')
2001 parser.add_option('-H', '--head', action='store_true',
2002 help='Begin by automatically syncing the root gclient '
2003 'solutions to HEAD of the remote repository. Similar '
2004 'to making the solution temporarily "managed".')
2002 parser.add_option('-D', '--delete_unversioned_trees', action='store_true', 2005 parser.add_option('-D', '--delete_unversioned_trees', action='store_true',
2003 help='Deletes from the working copy any dependencies that ' 2006 help='Deletes from the working copy any dependencies that '
2004 'have been removed since the last sync, as long as ' 2007 'have been removed since the last sync, as long as '
2005 'there are no local modifications. When used with ' 2008 'there are no local modifications. When used with '
2006 '--force, such dependencies are removed even if they ' 2009 '--force, such dependencies are removed even if they '
2007 'have local modifications. When used with --reset, ' 2010 'have local modifications. When used with --reset, '
2008 'all untracked directories are removed from the ' 2011 'all untracked directories are removed from the '
2009 'working copy, excluding those which are explicitly ' 2012 'working copy, excluding those which are explicitly '
2010 'ignored in the repository.') 2013 'ignored in the repository.')
2011 parser.add_option('-R', '--reset', action='store_true', 2014 parser.add_option('-R', '--reset', action='store_true',
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
2312 2315
2313 2316
2314 if '__main__' == __name__: 2317 if '__main__' == __name__:
2315 try: 2318 try:
2316 sys.exit(main(sys.argv[1:])) 2319 sys.exit(main(sys.argv[1:]))
2317 except KeyboardInterrupt: 2320 except KeyboardInterrupt:
2318 sys.stderr.write('interrupted\n') 2321 sys.stderr.write('interrupted\n')
2319 sys.exit(1) 2322 sys.exit(1)
2320 2323
2321 # vim: ts=2:sw=2:tw=80:et: 2324 # vim: ts=2:sw=2:tw=80:et:
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698