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>
diff --git a/project.py b/project.py
index b979252..8ed6155 100644
--- a/project.py
+++ b/project.py
@@ -178,13 +178,15 @@
 
 
 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 @@
     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.