changeset 5381:6874368120dc

convert_cvs: add --filemap support
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Thu, 04 Oct 2007 23:21:37 -0300
parents a5a7f7fd5554
children d7d395fb7cd5
files hgext/convert/cvs.py tests/test-convert-cvs tests/test-convert-cvs.out
diffstat 3 files changed, 60 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/convert/cvs.py
+++ b/hgext/convert/cvs.py
@@ -266,3 +266,9 @@ class convert_cvs(converter_source):
 
     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
+++ b/tests/test-convert-cvs
@@ -29,11 +29,24 @@ cd ..
 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 @@ hg convert src src-hg | sed -e 's/connec
 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
+++ b/tests/test-convert-cvs.out
@@ -9,17 +9,37 @@ No conflicts created by this import
 % 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 @@ scanning source...
 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