convert_svn: add --filemap support
authorAlexis S. L. Carvalho <alexis@cecm.usp.br>
Thu, 04 Oct 2007 23:21:37 -0300
changeset 5382 d7d395fb7cd5
parent 5381 6874368120dc
child 5385 caadfbc439c6
convert_svn: add --filemap support
hgext/convert/subversion.py
tests/test-convert-svn
tests/test-convert-svn.out
--- a/hgext/convert/subversion.py	Thu Oct 04 23:21:37 2007 -0300
+++ b/hgext/convert/subversion.py	Thu Oct 04 23:21:37 2007 -0300
@@ -146,6 +146,7 @@
         self.last_changed = self.latest(self.module, latest)
 
         self.head = self.revid(self.last_changed)
+        self._changescache = None
 
     def setrevmap(self, revmap, order):
         lastrevs = {}
@@ -206,6 +207,9 @@
         return self.modecache[(file, rev)]
 
     def getchanges(self, rev):
+        if self._changescache and self._changescache[0] == rev:
+            return self._changescache[1]
+        self._changescache = None
         self.modecache = {}
         (paths, parents) = self.paths[rev]
         files, copies = self.expandpaths(rev, paths, parents)
@@ -216,6 +220,11 @@
         del self.paths[rev]
         return (files, copies)
 
+    def getchangedfiles(self, rev, i):
+        changes = self.getchanges(rev)
+        self._changescache = (rev, changes)
+        return [f[0] for f in changes[0]]
+
     def getcommit(self, rev):
         if rev not in self.commits:
             uuid, module, revnum = self.revsplit(rev)
--- a/tests/test-convert-svn	Thu Oct 04 23:21:37 2007 -0300
+++ b/tests/test-convert-svn	Thu Oct 04 23:21:37 2007 -0300
@@ -51,3 +51,10 @@
 echo % test incremental conversion
 hg convert $svnurl
 
+echo % test filemap
+echo 'include b' > filemap
+hg convert --filemap filemap $svnurl fmap
+echo '[extensions]' >> $HGRCPATH
+echo 'hgext.graphlog =' >> $HGRCPATH
+hg glog -R fmap --template '#rev# #desc|firstline# files: #files#\n'
+
--- a/tests/test-convert-svn.out	Thu Oct 04 23:21:37 2007 -0300
+++ b/tests/test-convert-svn.out	Thu Oct 04 23:21:37 2007 -0300
@@ -30,3 +30,15 @@
 sorting...
 converting...
 0 changeb
+% test filemap
+initializing destination fmap repository
+scanning source...
+sorting...
+converting...
+2 init
+1 changea
+0 changeb
+o  1 changeb files: b
+|
+o  0 changea files: b
+