[PATCH STABLE] rebase: fix pull --rev options clashing with --rebase (issue3619)

Kevin Bullock kbullock+mercurial at ringworld.org
Wed Nov 28 16:14:07 CST 2012


On Nov 26, 2012, at 8:49 PM, Pierre-Yves David wrote:

> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at logilab.fr>
> # Date 1353983968 -3600
> # Branch stable
> # Node ID d9b69d58c701a91d60bacc5af2449517c8433920
> # Parent  54cedee86e5126188b0dcfbd7015bcdca7f6c2e2
> rebase: fix pull --rev options clashing with --rebase (issue3619)
> 
> Rebase also have a plain `--rev` option used to select the rebase set (as
> `--base` or `--source` would). But the content of the --rev option was intended
> for the remote repo and is irrelevant for the local rebase operation. We expect
> `hg pull --rebase` to stick with the default behavior here:
> 
>    hg rebase --base . --dest tip(branch5(.))
> 
> The `rev` option is dropped from the option passed to rebase.
> 
> diff --git a/hgext/rebase.py b/hgext/rebase.py
> --- a/hgext/rebase.py
> +++ b/hgext/rebase.py
> @@ -704,10 +704,13 @@ def pullrebase(orig, ui, repo, *args, **
>             orig(ui, repo, *args, **opts)
>         finally:
>             commands.postincoming = origpostincoming
>         revspostpull = len(repo)
>         if revspostpull > revsprepull:
> +            # --rev option from pull conflict with rebase own --rev
> +            # dropping it
> +            opts.pop('rev',  None)

The usual (and clearer, IMO) idiom here would be

    if 'rev' in opts:
        del opts['rev']

>             rebase(ui, repo, **opts)
>             branch = repo[None].branch()
>             dest = repo[branch].rev()
>             if dest != repo['.'].rev():
>                 # there was nothing to rebase we force an update
> diff --git a/tests/test-rebase-pull.t b/tests/test-rebase-pull.t
> --- a/tests/test-rebase-pull.t
> +++ b/tests/test-rebase-pull.t
> @@ -112,5 +112,57 @@ pull --rebase doesn't update if nothing 
>   $ hg tglog -l 1
>   o  2: 'R1'
>   |
> 
>   $ cd ..
> +
> +pull rebase works with a specidig revision is pulled

   pull --rebase     when   specific

LGTM otherwise.

pacem in terris / мир / शान्ति / ‎‫سَلاَم‬ / 平和
Kevin R. Bullock



More information about the Mercurial-devel mailing list