1. Augie Fackler
  2. hgsubversion
  3. Issues
Issue #123 resolved

svn:externals and relative URLs

Anonymous created an issue

Hi folks, plugin in present doesn't support 'relative' URL for svn:externals properties.

My auto-generated .hgsvnexternals looks like: {{{ lubo@alice project]$ cat .hgsvnexternals [src] /project_group/project1/trunk/src/common common }}}

I try this also with TIP version. If something missing in this report, you are welcome to contact me on my jabber account: lubomir.carik@jabbim.sk

I can help with python code, but I don't have knowledge about hg-internals.

Thanks for good job.

Comments (4)

  1. Augie Fackler repo owner

    Relative externals are a fairly new feature. For now, hgsubversion doesn't support them.

    Patches are most welcome to fix this, but I'm afraid I don't personally have the cycles for this.

  2. Steve Barnes

    I have been having a lot of problems with externals that contain .. in the URL as we have a number of projects with external URLs of the form ^/.. and finally got to the point of taking a look - I found that I could get at least update working correctly, (not yet devised and run a full set of tests), with the following patch:

    diff -r 7bbe120be193 hgsubversion/svnexternals.py
    --- a/hgsubversion/svnexternals.py  Mon Mar 24 11:20:53 2014 -0500
    +++ b/hgsubversion/svnexternals.py  Tue Dec 16 14:01:57 2014 +0000
    @@ -120,13 +120,24 @@
     class RelativeSourceError(Exception):
    +def resolvedots(url):
    +    """ Fix references that include .. entries."""
    +    orig = url.split('/')
    +    fixed = []
    +    for item in orig:
    +        if item != '..':
    +            fixed.append(item)
    +        else:
    +            fixed.pop()
    +    return '/'.join(fixed)
     def resolvesource(ui, svnroot, source):
         if re_scheme.search(source):
             return source
         if source.startswith('^/'):
             if svnroot is None:
                 raise RelativeSourceError()
    -        return svnroot + source[1:]
    +        return resolvedots(svnroot + source[1:])
         ui.warn(_('ignoring unsupported non-fully qualified external: %r\n'
                   % source))
         return None
  3. Log in to comment