[PATCH remotenames] push: improve hgsvn compatibility

Augie Fackler raf at durin42.com
Wed Sep 14 10:49:45 EDT 2016


> On Sep 14, 2016, at 08:53, Jun Wu <quark at fb.com> wrote:
> 
> # HG changeset patch
> # User Jun Wu <quark at fb.com>
> # Date 1473854964 -3600
> #      Wed Sep 14 13:09:24 2016 +0100
> # Node ID 495a2dc683e529b8744f422509fbca37b232263e
> # Parent  7a6c5ff76f225c8ebe9baef9d5ef753da915aa8b
> push: improve hgsvn compatibility
> 
> This patch improves the hgsubversion compatibility handling to resolve an
> issue that "hg push" does not work with both hgsvn and remotenames enabled:
> 
>  File "remotenames.py", line 835, in expushcmd
>    return orig(ui, repo, dest, opargs=opargs, **opts)
>  ....
>  File "hgsubversion/wrappers.py", line 383, in exchangepush
>    pushop.cgresult = push(repo, remote, force, revs)
>  File "hgsubversion/wrappers.py", line 185, in push
>    assert not revs, 'designated revisions for push remains unimplemented.'
>  AssertionError: designated revisions for push remains unimplemented.
> 
> and avoids some potential unwanted KeyError handling by removing the try
> block.
> 
> diff --git a/remotenames.py b/remotenames.py
> --- a/remotenames.py
> +++ b/remotenames.py
> @@ -815,12 +815,9 @@ def expushcmd(orig, ui, repo, dest=None,
>         dest = 'default-push'
> 
> -    try:
> -        # hgsubversion and hggit do funcky things on push. Just call it
> -        # directly
> -        path = paths[dest]
> -        if path.startswith('svn+') or path.startswith('git+'):
> -            return orig(ui, repo, dest, opargs=opargs, **opts)

I can't remember what dest is here, but if it's a peer you might be able to get away with some capability checks for 'svn' instead of url-format-sniffing (which would help in the bare-https-url case). Also, you should also sniff for svn:// if you want to do url sniffing.

> -    except KeyError:
> -        pass
> +    # hgsubversion and hggit do funcky things on push. Just call it
> +    # directly
> +    path = paths.get(dest or 'default')
> +    if path and (path.startswith('svn+') or path.startswith('git+')):
> +        return orig(ui, repo, origdest, opargs=opargs, **opts)
> 
>     if not opargs['to']:
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel



More information about the Mercurial-devel mailing list