diff hgext/convert/hg.py @ 26078:5ca587348875

convert: fix syncing deletes from p2 merge commit Recently we fixed converting merges to correctly sync changes from p2. We missed the case of deletes though (so p2 deleted a file that p1 had not yet deleted, and the file does not belong to the source). The fix is to detect when p2 doesn't have the file, so we just sync it as a delete to p1 in the merge. Updated the test, and verified it failed before the fix.
author Durham Goode <durham@fb.com>
date Tue, 25 Aug 2015 15:54:33 -0700
parents a75d24539aba
children 242853e14804
line wrap: on
line diff
--- a/hgext/convert/hg.py	Mon Aug 24 22:16:01 2015 -0700
+++ b/hgext/convert/hg.py	Tue Aug 25 15:54:33 2015 -0700
@@ -223,7 +223,12 @@
         def getfilectx(repo, memctx, f):
             if p2ctx and f in p2files and f not in copies:
                 self.ui.debug('reusing %s from p2\n' % f)
-                return p2ctx[f]
+                try:
+                    return p2ctx[f]
+                except error.ManifestLookupError:
+                    # If the file doesn't exist in p2, then we're syncing a
+                    # delete, so just return None.
+                    return None
             try:
                 v = files[f]
             except KeyError: