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

login
register
mail settings
Submitter Gregory Szorc
Date April 28, 2015, 5:20 p.m.
Message ID <394b5ffb1ea8ea87bbf8.1430241627@gps-mbp.local>
Download mbox | patch
Permalink /patch/8813/
State Accepted
Headers show

Comments

Gregory Szorc - April 28, 2015, 5:20 p.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@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.
Matt Mackall - April 28, 2015, 7:29 p.m.
On Tue, 2015-04-28 at 10:20 -0700, Gregory Szorc wrote:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc@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)

Queued for stable, thanks.

Patch

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():