changeset 26035:86598f4fe1cf

convert: add function to test if file is from source This adds a base implementation of a function that tests if a given file from a target repo came from the source repo. This will be used later to detect which files did not come from the source repo during a merge, so we can merge those files correctly instead of dropping them.
author Durham Goode <durham@fb.com>
date Sat, 15 Aug 2015 13:44:55 -0700
parents 1d829f802fab
children db677b70a298
files hgext/convert/common.py hgext/convert/convcmd.py
diffstat 2 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/convert/common.py	Sat Aug 15 17:50:59 2015 +0900
+++ b/hgext/convert/common.py	Sat Aug 15 13:44:55 2015 -0700
@@ -82,6 +82,13 @@
     def after(self):
         pass
 
+    def targetfilebelongstosource(self, targetfilename):
+        """Returns true if the given targetfile belongs to the source repo. This
+        is useful when only a subdirectory of the target belongs to the source
+        repo."""
+        # For normal full repo converts, this is always True.
+        return True
+
     def setrevmap(self, revmap):
         """set the map of already-converted revisions"""
         pass
--- a/hgext/convert/convcmd.py	Sat Aug 15 17:50:59 2015 +0900
+++ b/hgext/convert/convcmd.py	Sat Aug 15 13:44:55 2015 -0700
@@ -120,6 +120,9 @@
                          item=file, total=self.filecount)
         return self.source.getfile(file, rev)
 
+    def targetfilebelongstosource(self, targetfilename):
+        return self.source.targetfilebelongstosource(targetfilename)
+
     def lookuprev(self, rev):
         return self.source.lookuprev(rev)