hgext/convert/filemap.py
branchstable
changeset 13968 82845434e974
parent 11680 7fefef3ce791
child 15107 2433525a9e1e
--- a/hgext/convert/filemap.py	Tue Apr 19 13:33:43 2011 -0500
+++ b/hgext/convert/filemap.py	Wed Apr 20 23:15:18 2011 +0200
@@ -209,6 +209,11 @@
             self.children[p] = self.children.get(p, 0) + 1
         return c
 
+    def _cachedcommit(self, rev):
+        if rev in self.commits:
+            return self.commits[rev]
+        return self.base.getcommit(rev)
+
     def _discard(self, *revs):
         for r in revs:
             if r is None:
@@ -308,7 +313,14 @@
 
         self.origparents[rev] = parents
 
-        closed = 'close' in self.commits[rev].extra
+        closed = False
+        if 'close' in self.commits[rev].extra:
+            # A branch closing revision is only useful if one of its
+            # parents belong to the branch being closed
+            branch = self.commits[rev].branch
+            pbranches = [self._cachedcommit(p).branch for p in mparents]
+            if branch in pbranches:
+                closed = True
 
         if len(mparents) < 2 and not closed and not self.wanted(rev, wp):
             # We don't want this revision.