Add repo manifest -o to save a manifest

This can be useful to create a new manifest from an existing client,
especially if the client wants to use the "-r" option to set each
project's revision to the current commit SHA-1, making a sort of a
tag file that can be used to recreate this exact state elsewhere.

Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
Shawn O. Pearce
2009-03-05 10:32:38 -08:00
parent 43c3d9ea17
commit c7a4eefa7e
3 changed files with 118 additions and 13 deletions

View File

@ -178,13 +178,15 @@ class DiffColoring(Coloring):
class _CopyFile:
def __init__(self, src, dest):
def __init__(self, src, dest, abssrc, absdest):
self.src = src
self.dest = dest
self.abs_src = abssrc
self.abs_dest = absdest
def _Copy(self):
src = self.src
dest = self.dest
src = self.abs_src
dest = self.abs_dest
# copy file if it does not exist or is out of date
if not os.path.exists(dest) or not filecmp.cmp(src, dest):
try:
@ -691,11 +693,11 @@ class Project(object):
self._CopyFiles()
return True
def AddCopyFile(self, src, dest):
def AddCopyFile(self, src, dest, absdest):
# dest should already be an absolute path, but src is project relative
# make src an absolute path
src = os.path.join(self.worktree, src)
self.copyfiles.append(_CopyFile(src, dest))
abssrc = os.path.join(self.worktree, src)
self.copyfiles.append(_CopyFile(src, dest, abssrc, absdest))
def DownloadPatchSet(self, change_id, patch_id):
"""Download a single patch set of a single change to FETCH_HEAD.