convert: improve subversion branch filtering
authorPatrick Mezard <pmezard@gmail.com>
Mon, 14 Apr 2008 22:31:33 +0200
changeset 6540 55bd855fc0af
parent 6539 7814d7bb77bc
child 6541 009f69a5e251
convert: improve subversion branch filtering
hgext/convert/subversion.py
tests/test-convert-svn-branches
tests/test-convert-svn-branches.out
--- a/hgext/convert/subversion.py	Mon Apr 14 22:31:33 2008 +0200
+++ b/hgext/convert/subversion.py	Mon Apr 14 22:31:33 2008 +0200
@@ -744,8 +744,7 @@
             paths = []
             # filter out unrelated paths
             for path, ent in orig_paths:
-                if not path.startswith(self.module):
-                    self.ui.debug("boring@%s: %s\n" % (revnum, path))
+                if self.getrelpath(path) is None:
                     continue
                 paths.append((path, ent))
 
--- a/tests/test-convert-svn-branches	Mon Apr 14 22:31:33 2008 +0200
+++ b/tests/test-convert-svn-branches	Mon Apr 14 22:31:33 2008 +0200
@@ -66,6 +66,14 @@
 "$TESTDIR/svn-safe-append.py" b branches/old/b
 svn ci -m "change b again"
 
+echo % move back and forth between branch of similar names
+# This used to generate fake copy records
+svn up
+svn move branches/old branches/old2
+svn ci -m "move to old2"
+svn move branches/old2 branches/old
+svn ci -m "move back to old"
+
 echo % update trunk again
 "$TESTDIR/svn-safe-append.py" a trunk/a
 svn ci -m "last change to a"
@@ -76,15 +84,15 @@
 
 echo % branch again from a converted revision
 cd A
-svn copy -r 1 $svnurl/trunk branches/old2
-svn ci -m "branch trunk@1 into old2"
+svn copy -r 1 $svnurl/trunk branches/old3
+svn ci -m "branch trunk@1 into old3"
 cd ..
 
 echo % convert again
 hg convert --datesort $svnurl A-hg
 
 cd A-hg
-hg glog --template '#rev# #desc|firstline# files: #files#\n'
+hg glog --template 'branch=#branches# #rev# #desc|firstline# files: #files#\n'
 hg branches | sed 's/:.*/:/'
 hg tags -q
 cd ..
--- a/tests/test-convert-svn-branches.out	Mon Apr 14 22:31:33 2008 +0200
+++ b/tests/test-convert-svn-branches.out	Mon Apr 14 22:31:33 2008 +0200
@@ -48,56 +48,83 @@
 Sending        branches/old/b
 Transmitting file data .
 Committed revision 7.
+% move back and forth between branch of similar names
+At revision 7.
+A         branches/old2
+D         branches/old/a
+D         branches/old/b
+D         branches/old/c
+D         branches/old
+Deleting       branches/old
+Adding         branches/old2
+
+Committed revision 8.
+A         branches/old
+D         branches/old2/a
+D         branches/old2/b
+D         branches/old2/c
+D         branches/old2
+Adding         branches/old
+Deleting       branches/old2
+
+Committed revision 9.
 % update trunk again
 Sending        trunk/a
 Transmitting file data .
-Committed revision 8.
+Committed revision 10.
 % convert trunk and branches
 initializing destination A-hg repository
 scanning source...
 sorting...
 converting...
-8 init projA
-7 hello
-6 branch trunk, remove c
-5 change a
-4 change b
-3 move and update c
-2 move and update c
-1 change b again
+10 init projA
+9 hello
+8 branch trunk, remove c
+7 change a
+6 change b
+5 move and update c
+4 move and update c
+3 change b again
+2 move to old2
+1 move back to old
 0 last change to a
 % branch again from a converted revision
 Checked out revision 1.
-A         branches/old2
-Adding         branches/old2
+A         branches/old3
+Adding         branches/old3
 
-Committed revision 9.
+Committed revision 11.
 % convert again
 scanning source...
 sorting...
 converting...
-0 branch trunk@1 into old2
-o  9 branch trunk@1 into old2 files:
+0 branch trunk@1 into old3
+o  branch=old3 11 branch trunk@1 into old3 files:
 |
-| o  8 last change to a files: a
+| o  branch= 10 last change to a files: a
 | |
-| | o  7 change b again files: b
+| | o  branch=old 9 move back to old files:
 | | |
-| o |  6 move and update c files: b
+| | o  branch=old2 8 move to old2 files:
 | | |
-| | o  5 move and update c files: c
+| | o  branch=old 7 change b again files: b
 | | |
-| | o  4 change b files: b
+| o |  branch= 6 move and update c files: b
+| | |
+| | o  branch=old 5 move and update c files: c
 | | |
-| o |  3 change a files: a
+| | o  branch=old 4 change b files: b
+| | |
+| o |  branch= 3 change a files: a
 | | |
-+---o  2 branch trunk, remove c files: a b
++---o  branch=old 2 branch trunk, remove c files: a b
 | |
-| o  1 hello files: a b c
+| o  branch= 1 hello files: a b c
 |/
-o  0 init projA files:
+o  branch= 0 init projA files:
 
-old2                           9:
-default                        8:
-old                            7:
+old3                           11:
+default                        10:
+old                            9:
+old2                           8:
 tip