[issue3142] hgconvert extension doesn't work with svn+ssh destination

Sunny Chan bugs at mercurial.selenic.com
Thu Dec 8 21:07:37 CST 2011


New submission from Sunny Chan <sunny.chan at gs.com>:

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.

----------
messages: 18262
nosy: sunnychangs
priority: bug
status: unread
title: hgconvert extension doesn't work with svn+ssh destination

____________________________________________________
Mercurial issue tracker <bugs at mercurial.selenic.com>
<http://mercurial.selenic.com/bts/issue3142>
____________________________________________________


More information about the Mercurial-devel mailing list