[PATCH] convert.svn: branch name which equals trunk means `default' branch (issue2653)
boldin.pavel at gmail.com
boldin.pavel at gmail.com
Thu Feb 24 12:01:23 CST 2011
# HG changeset patch
# User Pavel Boldin <boldin.pavel at gmail.com>
# Date 1298570422 -10800
# Node ID 98fb11886cb5cef14e0259acab1732c51355c6db
# Parent 643b8212813e631b5525049fc4321a34a4def105
convert.svn: branch name which equals trunk means `default' branch (issue2653)
Converting from subversion specifying config.svn.trunk results
in storing trunk under branch named as config.svn.trunk, where `default'
brunch is expected. Submission contains patch and test.
diff -r 643b8212813e -r 98fb11886cb5 hgext/convert/subversion.py
--- a/hgext/convert/subversion.py Wed Feb 16 15:02:30 2011 +0100
+++ b/hgext/convert/subversion.py Thu Feb 24 21:00:22 2011 +0300
@@ -761,7 +761,9 @@
author = author and self.recode(author) or ''
try:
branch = self.module.split("/")[-1]
- if branch == 'trunk':
+ trunkname = self.ui.config('convert', 'svn.trunk') or 'trunk'
+ trunkname = trunkname.strip('/')
+ if branch == trunkname:
branch = ''
except IndexError:
branch = None
diff -r 643b8212813e -r 98fb11886cb5 tests/test-convert-svn-mytrunk.t
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-convert-svn-mytrunk.t Thu Feb 24 21:00:22 2011 +0300
@@ -0,0 +1,53 @@
+
+ $ "$TESTDIR/hghave" svn svn-bindings || exit 80
+
+ $ fixpath()
+ > {
+ > tr '\\' /
+ > }
+ $ cat > $HGRCPATH <<EOF
+ > [extensions]
+ > convert =
+ > graphlog =
+ > EOF
+
+ $ svnadmin create svn-repo
+ $ svnpath=`pwd | fixpath`
+
+
+ $ expr "$svnpath" : "\/" > /dev/null
+ > if [ $? -ne 0 ]; then
+ > svnpath="/$svnpath"
+ > fi
+ > svnurl="file://$svnpath/svn-repo"
+
+Now test that it works with trunk/tags layout, but no branches yet.
+
+Initial svn import
+
+ $ mkdir projB
+ $ cd projB
+ $ mkdir mytrunk
+ $ echo "fileconent" > mytrunk/file
+ $ cd ..
+
+ $ svnurl="file://$svnpath/svn-repo/proj%20B"
+ $ svn import -m "init projB" projB "$svnurl" | fixpath
+ Adding projB/mytrunk
+ Adding projB/mytrunk/file
+
+ Committed revision 1.
+
+Convert trunk and branches
+
+ $ hg convert --config convert.svn.trunk=mytrunk --datesort "$svnurl" B-hg
+ initializing destination B-hg repository
+ scanning source...
+ sorting...
+ converting...
+ 0 init projB
+
+Check current branch
+ $ cd B-hg
+ $ hg branches -q
+ default
More information about the Mercurial-devel
mailing list