changeset 548:bebc6753e7b9 stable

fix hg pull --rebase There is more user of rebase than just the rebase command
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Mon, 10 Sep 2012 18:22:45 +0200
parents c4abb0218e84
children b047e9417d96
files hgext/evolve.py tests/test-obsolete-rebase.t
diffstat 2 files changed, 89 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/evolve.py	Mon Sep 10 16:54:58 2012 +0200
+++ b/hgext/evolve.py	Mon Sep 10 18:22:45 2012 +0200
@@ -1009,7 +1009,8 @@
         repo.ui.warn(_('whole rebase set is extinct and ignored.\n'))
         return {}
     root = min(rebaseset)
-    if not repo._rebasekeep and not repo[root].mutable():
+    if (not getattr(repo, '_rebasekeep', False)
+        and not repo[root].mutable()):
         raise util.Abort(_("can't rebase immutable changeset %s") % repo[root],
                          hint=_('see hg help phases for details'))
     return orig(repo, dest, rebaseset, *ags, **kws)
--- a/tests/test-obsolete-rebase.t	Mon Sep 10 16:54:58 2012 +0200
+++ b/tests/test-obsolete-rebase.t	Mon Sep 10 18:22:45 2012 +0200
@@ -224,3 +224,90 @@
   +a31943eabc4327df16f9eca71bf7779c32f815f7 03f165c84ea8889fc35a64a392caa7a0084dd212 0 {'date': '* *', 'user': 'test'} (glob)
   +4b9d80f48523e296f4402cc8e37236b768dfb981 1951ead9710803dbf117e95901954d5ed717f80b 0 {'date': '* *', 'user': 'test'} (glob)
   [1]
+
+Test hg pull --rebase
+
+  $ hg glog
+  @  changeset:   12:1951ead97108
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     appendab
+  |
+  o  changeset:   11:03f165c84ea8
+  |  parent:      1:540395c44225
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     addd
+  |
+  | o  changeset:   8:a7773ffa7edc
+  |/   parent:      1:540395c44225
+  |    user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    summary:     Collapsed revision
+  |
+  | o  changeset:   4:9c5494949763
+  |/   parent:      1:540395c44225
+  |    user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    summary:     adde
+  |
+  | o  changeset:   2:102a90ea7b4a
+  | |  parent:      0:07f494440405
+  | |  user:        test
+  | |  date:        Thu Jan 01 00:00:00 1970 +0000
+  | |  summary:     addb
+  | |
+  o |  changeset:   1:540395c44225
+  |/   user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    summary:     changea
+  |
+  o  changeset:   0:07f494440405
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     adda
+  
+  $ echo '[phases]' >> .hg/hgrc
+  $ echo 'publish=False' >> .hg/hgrc
+  $ hg clone . -r 540395c44225 ../other
+  adding changesets
+  adding manifests
+  adding file changes
+  added 2 changesets with 2 changes to 1 files
+  updating to branch default
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg ph -vfd 'all()'
+  no phases changed
+  [1]
+  $ cd ../other
+  $ echo 'babar' > toto
+  $ hg add toto
+  $ hg ci -m 'babar is not dead'
+  $ echo '[ui]' >> .hg/hgrc
+  $ echo 'logtemplate={rev} {node|short} {desc|firstline}\n' >> .hg/hgrc
+  $ hg pull --rebase --traceback
+  pulling from $TESTTMP/repo
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 5 changesets with 5 changes to 5 files (+4 heads)
+  saved backup bundle to $TESTTMP/other/.hg/strip-backup/2a6c62a1b55d-backup.hg
+  $ hg glog
+  @  7 d5567dbec794 babar is not dead
+  |
+  o  6 1951ead97108 appendab
+  |
+  o  5 03f165c84ea8 addd
+  |
+  | o  4 a7773ffa7edc Collapsed revision
+  |/
+  | o  3 9c5494949763 adde
+  |/
+  | o  2 102a90ea7b4a addb
+  | |
+  o |  1 540395c44225 changea
+  |/
+  o  0 07f494440405 adda
+