convert_cvs: add --filemap support
authorAlexis S. L. Carvalho <alexis@cecm.usp.br>
Thu, 04 Oct 2007 23:21:37 -0300
changeset 5381 6874368120dc
parent 5380 a5a7f7fd5554
child 5382 d7d395fb7cd5
convert_cvs: add --filemap support
hgext/convert/cvs.py
tests/test-convert-cvs
tests/test-convert-cvs.out
--- a/hgext/convert/cvs.py	Thu Oct 04 23:21:37 2007 -0300
+++ b/hgext/convert/cvs.py	Thu Oct 04 23:21:37 2007 -0300
@@ -266,3 +266,9 @@
 
     def gettags(self):
         return self.tags
+
+    def getchangedfiles(self, rev, i):
+        files = self.files[rev].keys()
+        files.sort()
+        return files
+
--- a/tests/test-convert-cvs	Thu Oct 04 23:21:37 2007 -0300
+++ b/tests/test-convert-cvs	Thu Oct 04 23:21:37 2007 -0300
@@ -29,11 +29,24 @@
 echo % checkout source directory
 cvs -q checkout src
 
+echo % commit a new revision changing b/c
+cd src
+echo c >> b/c
+cvs -q commit -mci0 . | grep '<--' |\
+    sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
+cd ..
+
 echo % convert fresh repo
 hg convert src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
 cat src-hg/a
 cat src-hg/b/c
 
+echo % convert fresh repo with --filemap
+echo include b/c > filemap
+hg convert --filemap filemap src src-filemap | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
+cat src-hg/b/c
+hg -R src-filemap log --template '#rev# #desc# files: #files#\n'
+
 echo % commit new file revisions
 cd src
 echo a >> a
@@ -47,5 +60,8 @@
 cat src-hg/a
 cat src-hg/b/c
 
+echo % convert again with --filemap
+hg convert --filemap filemap src src-filemap | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
+cat src-hg/b/c
+hg -R src-filemap log --template '#rev# #desc# files: #files#\n'
 
-
--- a/tests/test-convert-cvs.out	Thu Oct 04 23:21:37 2007 -0300
+++ b/tests/test-convert-cvs.out	Thu Oct 04 23:21:37 2007 -0300
@@ -9,17 +9,37 @@
 % checkout source directory
 U src/a
 U src/b/c
+% commit a new revision changing b/c
+checking in src/b/c,v
 % convert fresh repo
 initializing destination src-hg repository
 connecting to cvsrepo
 scanning source...
 sorting...
 converting...
-1 Initial revision
-0 import
+2 Initial revision
+1 import
+0 ci0
 updating tags
 a
 c
+c
+% convert fresh repo with --filemap
+initializing destination src-filemap repository
+connecting to cvsrepo
+scanning source...
+sorting...
+converting...
+2 Initial revision
+1 import
+rolling back last transaction
+0 ci0
+updating tags
+c
+c
+2 update tags files: .hgtags
+1 ci0 files: b/c
+0 Initial revision files: b/c
 % commit new file revisions
 checking in src/a,v
 checking in src/b/c,v
@@ -30,8 +50,22 @@
 sorting...
 converting...
 0 ci1
-updating tags
 a
 a
 c
 c
+c
+% convert again with --filemap
+destination src-filemap is a Mercurial repository
+connecting to cvsrepo
+scanning source...
+sorting...
+converting...
+0 ci1
+c
+c
+c
+3 ci1 files: b/c
+2 update tags files: .hgtags
+1 ci0 files: b/c
+0 Initial revision files: b/c