[PATCH remotenames] push: improve hgsvn compatibility

Jun Wu quark at fb.com
Wed Sep 14 08:53:33 EDT 2016


# 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']:


More information about the Mercurial-devel mailing list