Patchwork [1,of,3,stable] convert: fix crash when filemap filtering is changed

login
register
mail settings
Submitter Mads Kiilerich
Date Oct. 2, 2013, 5:50 p.m.
Message ID <2cf9645bb2a21f470c2a.1380736248@mk-desktop>
Download mbox | patch
Permalink /patch/2706/
State Accepted
Commit 42455ebbab9f5afd29e2d89c0cc1cd5b540ec337
Headers show

Comments

Mads Kiilerich - Oct. 2, 2013, 5:50 p.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1380736007 -7200
#      Wed Oct 02 19:46:47 2013 +0200
# Branch stable
# Node ID 2cf9645bb2a21f470c2a134a05b521dff0f91905
# Parent  4d513f96a565639c0879086b68cf72a1e01e596c
convert: fix crash when filemap filtering is changed

Patch

diff --git a/hgext/convert/filemap.py b/hgext/convert/filemap.py
--- a/hgext/convert/filemap.py
+++ b/hgext/convert/filemap.py
@@ -231,8 +231,8 @@ 
                 continue
             self.seenchildren[r] = self.seenchildren.get(r, 0) + 1
             if self.seenchildren[r] == self.children[r]:
-                del self.wantedancestors[r]
-                del self.parentmap[r]
+                self.wantedancestors.pop(r, None)
+                self.parentmap.pop(r, None)
                 del self.seenchildren[r]
                 if self._rebuilt:
                     del self.children[r]
@@ -281,7 +281,11 @@ 
         # of wanted ancestors of its parents. Plus rev itself.
         wrev = set()
         for p in parents:
-            wrev.update(self.wantedancestors[p])
+            if p in self.wantedancestors:
+                wrev.update(self.wantedancestors[p])
+            else:
+                self.ui.warn(_('warning: %s parent %s is missing\n') %
+                             (rev, p))
         wrev.add(rev)
         self.wantedancestors[rev] = wrev
 
diff --git a/tests/test-convert-filemap.t b/tests/test-convert-filemap.t
--- a/tests/test-convert-filemap.t
+++ b/tests/test-convert-filemap.t
@@ -88,6 +88,32 @@ 
   copied renamed from foo:2ed2a3912a0b24502043eae84ee4b279c18b90dd
 
   $ cd ..
+
+
+Test interaction with startrev and verify that changing it is handled properly:
+
+  $ > empty
+  $ hg convert --filemap empty source movingstart --config convert.hg.startrev=3 -r4
+  initializing destination movingstart repository
+  scanning source...
+  sorting...
+  converting...
+  1 3: change bar quux
+  0 4: first merge; change bar baz
+  $ hg convert --filemap empty source movingstart
+  scanning source...
+  sorting...
+  converting...
+  3 5: change bar baz quux
+  2 6: change foo baz
+  1 7: second merge; change bar
+  warning: af455ce4166b3c9c88e6309c2b9332171dcea595 parent 61e22ca76c3b3e93df20338c4e02ce286898e825 is missing
+  warning: cf908b3eeedc301c9272ebae931da966d5b326c7 parent 59e1ab45c888289513b7354484dac8a88217beab is missing
+  0 8: change foo
+
+
+splitrepo tests
+
   $ splitrepo()
   > {
   >     msg="$1"