Bug 3142 - hgconvert extension doesn't work with svn+ssh destination
Summary: hgconvert extension doesn't work with svn+ssh destination
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: convert (show other bugs)
Version: unspecified
Hardware: All All
: normal bug
Assignee: Bugzilla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-08 21:07 UTC by Sunny Chan
Modified: 2012-09-30 16:19 UTC (History)
3 users (show)

See Also:
Python Version: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sunny Chan 2011-12-08 21:07 UTC
hgconvert extension's subversion sink doesn't work with svn+ssh URLs

I am trying to convert hg into a subversion repository hosting on a remote 
host and access through svn+ssh protocol.

To reproduce the issue:

1) Setup a destination svn reposiotry and enable svn+ssh access
2) Check out the source hg repository into directory (say hgrepo)
3) Run this:

hg convert --debug --traceback --dest-type svn hgrepo 
svn:ssh://somehost/svnroot/whatever/trunk

This is the error you will get:

initializing svn working copy 'lambda-wc'
running: 'svn' 'checkout' '/local/scratch/chasun/hgsubversion/hgconvert-
wc/svn+ssh:/somehost/svnroot/whatever/trunk/lambda' 
'/local/scratch/chasun/hgsubversion/hgconvert-wc/lambda-wc' < /dev/null
svn: '/local/scratch/chasun/hgsubversion/hgconvert-
wc/svn+ssh:/somehost/svnroot/whatever/trunk/lambda' does not appear to be a 
URL
Traceback (most recent call last):
  File "/home/chasun/lib64/python/mercurial/dispatch.py", line 87, in 
_runcatch
    return _dispatch(req)
  File "/home/chasun/lib64/python/mercurial/dispatch.py", line 684, in 
_dispatch
    cmdpats, cmdoptions)
  File "/home/chasun/lib64/python/mercurial/dispatch.py", line 466, in 
runcommand
    ret = _runcommand(ui, options, cmd, d)
  File "/home/chasun/lib64/python/mercurial/dispatch.py", line 738, in 
_runcommand
    return checkargs()
  File "/home/chasun/lib64/python/mercurial/dispatch.py", line 692, in 
checkargs
    return cmdfunc()
  File "/home/chasun/lib64/python/mercurial/dispatch.py", line 681, in 
<lambda>
    d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
  File "/home/chasun/lib64/python/mercurial/util.py", line 454, in check
    return func(*args, **kwargs)
  File "/home/chasun/lib64/python/hgext/convert/__init__.py", line 269, in 
convert
    return convcmd.convert(ui, src, dest, revmapfile, **opts)
  File "/home/chasun/lib64/python/hgext/convert/convcmd.py", line 415, in 
convert
    destc = convertsink(ui, dest, opts.get('dest_type'))
  File "/home/chasun/lib64/python/hgext/convert/convcmd.py", line 70, in 
convertsink
    return sink(ui, path)
  File "/home/chasun/lib64/python/hgext/convert/subversion.py", line 1001, 
in __init__
    self.run0('checkout', path, wcpath)
  File "/home/chasun/lib64/python/hgext/convert/common.py", line 316, in 
run0
    self.checkexit(status, output)
  File "/home/chasun/lib64/python/hgext/convert/common.py", line 312, in 
checkexit
    raise util.Abort('%s %s' % (self.command, msg))
Abort: svn exited with status 256
abort: svn exited with status 256


The problem is that in hgext/convert/subversion.py, class svn_sink's 
__init__ method:


        self.wc = None
        self.cwd = os.getcwd()

        path = os.path.realpath(path)

What happens is that the svn_sink will treat everything as a local file and 
appended local directory to it - hence the checkout it attempts to run has 
the path appended to it.

If we put something that checks for svn+ssh (or other valid remote protocol) 
and skip the realpath, then it works fine with svn+ssh.
Comment 1 Bugzilla 2012-05-12 09:25 UTC

--- Bug imported by bugzilla@serpentine.com 2012-05-12 09:25 EDT  ---

This bug was previously known as _bug_ 3142 at http://mercurial.selenic.com/bts/issue3142

Bug Status was UNCONFIRMED but everconfirmed was true
   Setting status to CONFIRMED

Comment 2 Patrick Mézard 2012-07-26 06:41 UTC
Fix pushed in crew-stable:

  http://hg.intevation.org/mercurial/crew/rev/6d51a0c71d4e

Thanks for the report.
Comment 3 Matt Mackall 2012-09-30 16:19 UTC
Mass close old bugs in testing.