convert: introduce hascommitfrommap sink method
authorMads Kiilerich <madski@unity3d.com>
Mon, 19 May 2014 22:12:30 +0200
changeset 21635 5f2cc464e502
parent 21634 23b24d6a70c8
child 21636 3de9f2c4900c
convert: introduce hascommitfrommap sink method Mercurial has stable revision identifiers and rollback and strip. Revisions referenced in the shamap are thus not necessarily still present but we can easily check for it. Subversion do not have stable identifiers and no rollback or strip(?). We must thus assume that all revisions referenced from a shamap still must be present. This method is similar to hascommitforsplicemap but different ...
hgext/convert/common.py
hgext/convert/hg.py
hgext/convert/subversion.py
--- a/hgext/convert/common.py	Mon May 19 22:11:14 2014 +0200
+++ b/hgext/convert/common.py	Mon May 19 22:12:30 2014 +0200
@@ -260,6 +260,11 @@
         """
         pass
 
+    def hascommitfrommap(self, rev):
+        """Return False if a rev mentioned in a filemap is known to not be
+        present."""
+        raise NotImplementedError
+
     def hascommitforsplicemap(self, rev):
         """This method is for the special needs for splicemap handling and not
         for general use. Returns True if the sink contains rev, aborts on some
--- a/hgext/convert/hg.py	Mon May 19 22:11:14 2014 +0200
+++ b/hgext/convert/hg.py	Mon May 19 22:12:30 2014 +0200
@@ -253,6 +253,10 @@
             destmarks[bookmark] = bin(updatedbookmark[bookmark])
         destmarks.write()
 
+    def hascommitfrommap(self, rev):
+        # the exact semantics of clonebranches is unclear so we can't say no
+        return rev in self.repo or self.clonebranches
+
     def hascommitforsplicemap(self, rev):
         if rev not in self.repo and self.clonebranches:
             raise util.Abort(_('revision %s not found in destination '
--- a/hgext/convert/subversion.py	Mon May 19 22:11:14 2014 +0200
+++ b/hgext/convert/subversion.py	Mon May 19 22:12:30 2014 +0200
@@ -1300,6 +1300,11 @@
         self.ui.warn(_('writing Subversion tags is not yet implemented\n'))
         return None, None
 
+    def hascommitfrommap(self, rev):
+        # We trust that revisions referenced in a map still is present
+        # TODO: implement something better if necessary and feasible
+        return True
+
     def hascommitforsplicemap(self, rev):
         # This is not correct as one can convert to an existing subversion
         # repository and childmap would not list all revisions. Too bad.