mq: stabilize update after strip of parent revision
authorMads Kiilerich <mads@kiilerich.com>
Tue, 15 Jan 2013 02:59:13 +0100
changeset 18371 ff2c89ebf5d4
parent 18370 c605e12dd622
child 18372 5965997b7023
mq: stabilize update after strip of parent revision Strip will (if it updates) update to the parent of revs[0], where revs are the roots of the tree that is stripped. When revs was list(set) it was thus undefined which root parent it would update to. With sorted(set) it is at least stable what it updates to. (But it is very possible that another more useful and predictable behaviour could be defined ... such as updating to the tip-most surviving wd ancestor.)
hgext/mq.py
tests/test-mq-strip.t
--- a/hgext/mq.py	Wed Dec 12 02:38:14 2012 +0100
+++ b/hgext/mq.py	Tue Jan 15 02:59:13 2013 +0100
@@ -3032,7 +3032,7 @@
             del q.applied[start:end]
             q.savedirty()
 
-    revs = list(rootnodes)
+    revs = sorted(rootnodes)
     if update and opts.get('keep'):
         wlock = repo.wlock()
         try:
--- a/tests/test-mq-strip.t	Wed Dec 12 02:38:14 2012 +0100
+++ b/tests/test-mq-strip.t	Tue Jan 15 02:59:13 2013 +0100
@@ -309,16 +309,16 @@
 2 different branches: 2 strips
 
   $ hg strip 2 4
-  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
   $ hg glog
-  @  changeset:   2:65bd5f99a4a3
+  o  changeset:   2:65bd5f99a4a3
   |  tag:         tip
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     d
   |
-  o  changeset:   1:ef3a871183d7
+  @  changeset:   1:ef3a871183d7
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     b