changeset 5373:6aba1835a7b3

convert: pass the order of the revmapfile to the converter_source The entries in this file are supposed to be topologically sorted and this may be useful for a converter_source.
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Thu, 04 Oct 2007 23:21:37 -0300
parents 6f6aa7f3bc1c
children e710874247d1
files hgext/convert/__init__.py hgext/convert/common.py hgext/convert/subversion.py
diffstat 3 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/convert/__init__.py	Thu Oct 04 19:47:22 2007 -0500
+++ b/hgext/convert/__init__.py	Thu Oct 04 23:21:37 2007 -0300
@@ -53,11 +53,14 @@
         self.authorfile = None
         self.mapfile = filemapper
 
+        self.maporder = []
         self.map = {}
         try:
             origrevmapfile = open(self.revmapfile, 'r')
             for l in origrevmapfile:
                 sv, dv = l[:-1].split()
+                if sv not in self.map:
+                    self.maporder.append(sv)
                 self.map[sv] = dv
             origrevmapfile.close()
         except IOError:
@@ -238,7 +241,7 @@
         try:
             self.source.before()
             self.dest.before()
-            self.source.setrevmap(self.map)
+            self.source.setrevmap(self.map, self.maporder)
             self.ui.status("scanning source...\n")
             heads = self.source.getheads()
             parents = self.walktree(heads)
--- a/hgext/convert/common.py	Thu Oct 04 19:47:22 2007 -0500
+++ b/hgext/convert/common.py	Thu Oct 04 23:21:37 2007 -0300
@@ -44,8 +44,11 @@
     def after(self):
         pass
 
-    def setrevmap(self, revmap):
-        """set the map of already-converted revisions"""
+    def setrevmap(self, revmap, order):
+        """set the map of already-converted revisions
+        
+        order is a list with the keys from revmap in the order they
+        appear in the revision map file."""
         pass
 
     def getheads(self):
--- a/hgext/convert/subversion.py	Thu Oct 04 19:47:22 2007 -0500
+++ b/hgext/convert/subversion.py	Thu Oct 04 23:21:37 2007 -0300
@@ -147,7 +147,7 @@
 
         self.head = self.revid(self.last_changed)
 
-    def setrevmap(self, revmap):
+    def setrevmap(self, revmap, order):
         lastrevs = {}
         for revid in revmap.keys():
             uuid, module, revnum = self.revsplit(revid)