[PATCH remotenames] push: improve hgsvn compatibility

Ryan McElroy rm at fb.com
Wed Sep 14 14:46:55 UTC 2016


On 9/14/2016 1:53 PM, Jun Wu 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)
> -    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']:

This patch leaves me unconvinced. The failure is because revs are being 
passed in, but this patch only changes the destination, which is not 
related to revs passed in.

Furthermore, there is no test here that failed previously. How do I know 
this fixes anything?

Just a minute ago, I pushed from a repo with hgsubversion and 
remotenames both enabled and it worked with no errors.

It seems that something else is going on here.



More information about the Mercurial-devel mailing list