[PATCH STABLE] rebase: don't forward "source" argument to rebase (issue4633)

Gregory Szorc gregory.szorc at gmail.com
Tue Apr 28 17:20:27 UTC 2015


# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1430241586 25200
#      Tue Apr 28 10:19:46 2015 -0700
# Branch stable
# Node ID 394b5ffb1ea8ea87bbf8f3cd1ebbefc9e2ef95b1
# Parent  bff42a92012e49aabd925caa3cb243116285e243
rebase: don't forward "source" argument to rebase (issue4633)

`hg pull` takes an optional "source" argument to define the path/url to
pull from. Under some circumstances, this option could get proxied to
rebase and interpretted as the --source argument to rebase, leading to
unexpected behavior.

In my local environment, "source" always appears in "opts" in
pullrebase. However, when attempting to write a test, I couldn't reproduce
this. Instead, the source is being captured as a positional argument in
"args." I suspect an interaction between **kwargs and an extension is to
blame for the differences in behavior. This is why no test has been
written.

I have tested behavior locally and the patch has the intended
side-effect of making `hg pull --rebase` work again.

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -1039,8 +1039,12 @@ def pullrebase(orig, ui, repo, *args, **
             # --rev option from pull conflict with rebase own --rev
             # dropping it
             if 'rev' in opts:
                 del opts['rev']
+            # positional argument from pull conflicts with rebase's own
+            # --source.
+            if 'source' in opts:
+                del opts['source']
             rebase(ui, repo, **opts)
             branch = repo[None].branch()
             dest = repo[branch].rev()
             if dest != repo['.'].rev():


More information about the Mercurial-devel mailing list