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

pierre-yves.david at logilab.fr pierre-yves.david at logilab.fr
Thu Nov 29 11:35:18 CST 2012


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1354203435 -3600
# Branch stable
# Node ID f0a88fe072222fe9e458203c4cd4f3d6ece5527e
# Parent  f94ead93406764ffd0c3febfc2ea70d36a2a28bb
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,14 @@ 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
+            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 when a specific revision is pulled (issue3619)
+
+  $ cd a
+  $ hg tglog
+  @  2: 'R1'
+  |
+  o  1: 'C2'
+  |
+  o  0: 'C1'
+  
+  $ echo R2 > R2
+  $ hg ci -Am R2
+  adding R2
+  $ echo R3 > R3
+  $ hg ci -Am R3
+  adding R3
+  $ cd ../c
+  $ hg tglog
+  o  2: 'R1'
+  |
+  @  1: 'C2'
+  |
+  o  0: 'C1'
+  
+  $ echo L1 > L1
+  $ hg ci -Am L1
+  adding L1
+  created new head
+  $ hg pull --rev tip --rebase
+  pulling from $TESTTMP/a
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 2 changesets with 2 changes to 2 files
+  saved backup bundle to $TESTTMP/c/.hg/strip-backup/ff8d69a621f9-backup.hg (glob)
+  $ hg tglog
+  @  5: 'L1'
+  |
+  o  4: 'R3'
+  |
+  o  3: 'R2'
+  |
+  o  2: 'R1'
+  |
+  o  1: 'C2'
+  |
+  o  0: 'C1'
+  
+
+


More information about the Mercurial-devel mailing list