Add 'repo sync -d' to detach projects from their current topic

The -d flag moves the project back to a detached HEAD state,
matching what is listed in the manifest.  This can be useful to
set a client to something stable (or at least well-known), such as
before a sequence of 'repo download' commands are used to get some
changes for testing.

Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
Shawn O. Pearce
2009-04-10 16:59:36 -07:00
parent 96fdcef9e3
commit 3e768c9dc7
2 changed files with 17 additions and 3 deletions

View File

@ -573,7 +573,7 @@ class Project(object):
for file in self.copyfiles:
file._Copy()
def Sync_LocalHalf(self):
def Sync_LocalHalf(self, detach_head=False):
"""Perform only the local IO portion of the sync process.
Network access is not required.
@ -594,7 +594,7 @@ class Project(object):
branch = self.CurrentBranch
if branch is None:
if branch is None or detach_head:
# Currently on a detached HEAD. The user is assumed to
# not have any local modifications worth worrying about.
#