diff --git a/hgext/convert/__init__.py b/hgext/convert/__init__.py --- a/hgext/convert/__init__.py +++ b/hgext/convert/__init__.py @@ -221,13 +221,13 @@ def convert(ui, src, dest=None, revmapfi The following options can be set with ``--config``: :convert.svn.branches: specify the directory containing branches. - The defaults is ``branches``. + The default is ``branches``. :convert.svn.tags: specify the directory containing tags. The default is ``tags``. - :convert.svn.trunk: specify the name of the trunk branch The - defauls is ``trunk``. + :convert.svn.trunk: specify the name of the trunk branch. The + default is ``trunk``. Source history can be retrieved starting at a specific revision, instead of being integrally converted. Only single branch diff --git a/hgext/convert/subversion.py b/hgext/convert/subversion.py --- a/hgext/convert/subversion.py +++ b/hgext/convert/subversion.py @@ -311,6 +311,9 @@ class svn_source(converter_source): return None path = (cfgpath or name).strip('/') if not self.exists(path, rev): + if self.module.endswith(path) and name == 'trunk': + # we are converting from inside this directory + return None if cfgpath: raise util.Abort(_('expected %s to be at %r, but not found') % (name, path)) @@ -758,7 +761,8 @@ class svn_source(converter_source): author = author and self.recode(author) or '' try: branch = self.module.split("/")[-1] - if branch == 'trunk': + trunkname = self.ui.config('convert', 'svn.trunk', 'trunk') + if branch == trunkname.strip('/'): branch = '' except IndexError: branch = None diff --git a/tests/test-convert-svn-source.t b/tests/test-convert-svn-source.t --- a/tests/test-convert-svn-source.t +++ b/tests/test-convert-svn-source.t @@ -9,6 +9,8 @@ > [extensions] > convert = > graphlog = + > [convert] + > svn.trunk = mytrunk > EOF $ svnadmin create svn-repo @@ -27,20 +29,20 @@ Initial svn import $ mkdir projB $ cd projB - $ mkdir trunk + $ mkdir mytrunk $ mkdir tags $ cd .. $ svnurl="file://$svnpath/svn-repo/proj%20B" $ svn import -m "init projB" projB "$svnurl" | fixpath - Adding projB/trunk + Adding projB/mytrunk Adding projB/tags Committed revision 1. Update svn repository - $ svn co "$svnurl"/trunk B | fixpath + $ svn co "$svnurl"/mytrunk B | fixpath Checked out revision 1. $ cd B $ echo hello > 'letter .txt' @@ -57,7 +59,7 @@ Update svn repository Transmitting file data . Committed revision 3. - $ svn copy -m "tag v0.1" "$svnurl"/trunk "$svnurl"/tags/v0.1 + $ svn copy -m "tag v0.1" "$svnurl"/mytrunk "$svnurl"/tags/v0.1 Committed revision 4. @@ -94,7 +96,7 @@ Update svn repository again Transmitting file data .. Committed revision 6. - $ svn copy -m "tag v0.2" "$svnurl"/trunk "$svnurl"/tags/v0.2 + $ svn copy -m "tag v0.2" "$svnurl"/mytrunk "$svnurl"/tags/v0.2 Committed revision 7. @@ -143,7 +145,7 @@ Test incremental conversion Test filemap $ echo 'include letter2.txt' > filemap - $ hg convert --filemap filemap "$svnurl"/trunk fmap + $ hg convert --filemap filemap "$svnurl"/mytrunk fmap initializing destination fmap repository scanning source... sorting... @@ -154,6 +156,8 @@ Test filemap 2 nice day 1 second letter 0 work in progress + $ hg -R fmap branch -q + default $ hg glog -R fmap --template '{rev} {desc|firstline} files: {files}\n' o 1 work in progress files: letter2.txt | @@ -161,12 +165,14 @@ Test filemap Test stop revision - $ hg convert --rev 1 "$svnurl"/trunk stoprev + $ hg convert --rev 1 "$svnurl"/mytrunk stoprev initializing destination stoprev repository scanning source... sorting... converting... 0 init projB + $ hg -R stoprev branch -q + default Check convert_revision extra-records. This is also the only place testing more than one extra field in a revision. @@ -174,5 +180,5 @@ This is also the only place testing more $ cd stoprev $ hg tip --debug | grep extra extra: branch=default - extra: convert_revision=svn:........-....-....-....-............/proj B/trunk@1 (re) + extra: convert_revision=svn:........-....-....-....-............/proj B/mytrunk@1 (re) $ cd .. diff --git a/tests/test-convert.t b/tests/test-convert.t --- a/tests/test-convert.t +++ b/tests/test-convert.t @@ -204,12 +204,12 @@ The following options can be set with "--config": convert.svn.branches - specify the directory containing branches. The defaults is + specify the directory containing branches. The default is "branches". convert.svn.tags specify the directory containing tags. The default is "tags". convert.svn.trunk - specify the name of the trunk branch The defauls is "trunk". + specify the name of the trunk branch. The default is "trunk". Source history can be retrieved starting at a specific revision, instead of being integrally converted. Only single branch conversions are