rebase: fix wrong 'no changes to commit' when using --collapse
authorMads Kiilerich <madski@unity3d.com>
Mon, 19 Oct 2015 16:29:35 +0200
changeset 26811 d1561a422748
parent 26810 382050000412
child 26812 58a309e9cf80
rebase: fix wrong 'no changes to commit' when using --collapse --collapse will do that rebase doesn't commit until the final commit. The lack of a new commit would make it look like the rebase didn't contribute any changes. Instead, only warn about no commits when not using --collapse.
hgext/rebase.py
tests/test-rebase-collapse.t
tests/test-rebase-detach.t
tests/test-rebase-obsolete.t
tests/test-rebase-rename.t
--- a/hgext/rebase.py	Mon Oct 19 15:47:40 2015 -0700
+++ b/hgext/rebase.py	Mon Oct 19 16:29:35 2015 +0200
@@ -466,9 +466,9 @@
                     state[rev] = repo[newnode].rev()
                     ui.debug('rebased as %s\n' % short(newnode))
                 else:
-                    ui.warn(_('note: rebase of %d:%s created no changes '
-                              'to commit\n') % (rev, ctx))
                     if not collapsef:
+                        ui.warn(_('note: rebase of %d:%s created no changes '
+                                  'to commit\n') % (rev, ctx))
                         skipped.add(rev)
                     state[rev] = p1
                     ui.debug('next revision set to %s\n' % p1)
--- a/tests/test-rebase-collapse.t	Mon Oct 19 15:47:40 2015 -0700
+++ b/tests/test-rebase-collapse.t	Mon Oct 19 16:29:35 2015 +0200
@@ -60,11 +60,8 @@
   > EOF
   $ HGEDITOR="sh $TESTTMP/editor.sh" hg rebase --collapse --keepbranches -e
   rebasing 1:42ccdea3bb16 "B"
-  note: rebase of 1:42ccdea3bb16 created no changes to commit
   rebasing 2:5fddd98957c8 "C"
-  note: rebase of 2:5fddd98957c8 created no changes to commit
   rebasing 3:32af7686d403 "D"
-  note: rebase of 3:32af7686d403 created no changes to commit
   ==== before editing
   Collapsed revision
   * B
@@ -120,9 +117,7 @@
   $ hg phase --force --secret 6
   $ hg rebase --source 4 --collapse
   rebasing 4:9520eea781bc "E"
-  note: rebase of 4:9520eea781bc created no changes to commit
   rebasing 6:eea13746799a "G"
-  note: rebase of 6:eea13746799a created no changes to commit
   saved backup bundle to $TESTTMP/a2/.hg/strip-backup/9520eea781bc-fcd8edd4-backup.hg (glob)
 
   $ hg tglog
@@ -164,9 +159,7 @@
   > EOF
   $ HGEDITOR="sh $TESTTMP/checkeditform.sh" hg rebase --source 4 --collapse -m 'custom message' -e
   rebasing 4:9520eea781bc "E"
-  note: rebase of 4:9520eea781bc created no changes to commit
   rebasing 6:eea13746799a "G"
-  note: rebase of 6:eea13746799a created no changes to commit
   HGEDITFORM=rebase.collapse
   saved backup bundle to $TESTTMP/a3/.hg/strip-backup/9520eea781bc-fcd8edd4-backup.hg (glob)
 
@@ -276,11 +269,8 @@
 
   $ hg rebase -s 4 --collapse # root (4) is not a merge
   rebasing 4:8a5212ebc852 "E"
-  note: rebase of 4:8a5212ebc852 created no changes to commit
   rebasing 5:7f219660301f "F"
-  note: rebase of 5:7f219660301f created no changes to commit
   rebasing 6:c772a8b2dc17 "G"
-  note: rebase of 6:c772a8b2dc17 created no changes to commit
   saved backup bundle to $TESTTMP/b1/.hg/strip-backup/8a5212ebc852-75046b61-backup.hg (glob)
 
   $ hg tglog
@@ -430,14 +420,10 @@
 
   $ hg rebase -s 4 --collapse # root (4) is not a merge
   rebasing 4:8a5212ebc852 "E"
-  note: rebase of 4:8a5212ebc852 created no changes to commit
   rebasing 5:dca5924bb570 "F"
   merging E
-  note: rebase of 5:dca5924bb570 created no changes to commit
   rebasing 6:55a44ad28289 "G"
-  note: rebase of 6:55a44ad28289 created no changes to commit
   rebasing 7:417d3b648079 "H"
-  note: rebase of 7:417d3b648079 created no changes to commit
   saved backup bundle to $TESTTMP/c1/.hg/strip-backup/8a5212ebc852-f95d0879-backup.hg (glob)
 
   $ hg tglog
@@ -528,13 +514,9 @@
 
   $ hg rebase -s 1 --collapse
   rebasing 1:27547f69f254 "B"
-  note: rebase of 1:27547f69f254 created no changes to commit
   rebasing 2:f838bfaca5c7 "C"
-  note: rebase of 2:f838bfaca5c7 created no changes to commit
   rebasing 3:7bbcd6078bcc "D"
-  note: rebase of 3:7bbcd6078bcc created no changes to commit
   rebasing 4:0a42590ed746 "E"
-  note: rebase of 4:0a42590ed746 created no changes to commit
   saved backup bundle to $TESTTMP/d1/.hg/strip-backup/27547f69f254-9a3f7d92-backup.hg (glob)
 
   $ hg tglog
@@ -675,11 +657,9 @@
   merging a and d to d
   merging b and e to e
   merging c and f to f
-  note: rebase of 2:6e7340ee38c0 created no changes to commit
   rebasing 3:338e84e2e558 "move2" (tip)
   merging f and c to c
   merging e and g to g
-  note: rebase of 3:338e84e2e558 created no changes to commit
   saved backup bundle to $TESTTMP/copies/.hg/strip-backup/6e7340ee38c0-ef8ef003-backup.hg (glob)
   $ hg st
   $ hg st --copies --change tip
@@ -720,9 +700,7 @@
 
   $ hg rebase --collapse -b . -d 0
   rebasing 1:1352765a01d4 "change"
-  note: rebase of 1:1352765a01d4 created no changes to commit
   rebasing 2:64b456429f67 "Collapsed revision" (tip)
-  note: rebase of 2:64b456429f67 created no changes to commit
   saved backup bundle to $TESTTMP/copies/.hg/strip-backup/1352765a01d4-45a352ea-backup.hg (glob)
   $ hg st --change tip --copies
   M a
@@ -814,9 +792,7 @@
   $ hg book foo
   $ hg rebase -d 0 -r "1::2" --collapse -m collapsed
   rebasing 1:6d8d9f24eec3 "a"
-  note: rebase of 1:6d8d9f24eec3 created no changes to commit
   rebasing 2:1cc73eca5ecc "b" (tip foo)
-  note: rebase of 2:1cc73eca5ecc created no changes to commit
   saved backup bundle to $TESTTMP/collapseaddremove/.hg/strip-backup/6d8d9f24eec3-77d3b6e2-backup.hg (glob)
   $ hg log -G --template "{rev}: '{desc}' {bookmarks}"
   @  1: 'collapsed' foo
--- a/tests/test-rebase-detach.t	Mon Oct 19 15:47:40 2015 -0700
+++ b/tests/test-rebase-detach.t	Mon Oct 19 16:29:35 2015 +0200
@@ -212,9 +212,7 @@
   
   $ hg rebase --collapse -s 2 -d 7
   rebasing 2:5fddd98957c8 "C"
-  note: rebase of 2:5fddd98957c8 created no changes to commit
   rebasing 3:32af7686d403 "D"
-  note: rebase of 3:32af7686d403 created no changes to commit
   saved backup bundle to $TESTTMP/a4/.hg/strip-backup/5fddd98957c8-f9244fa1-backup.hg (glob)
 
   $ hg  log -G --template "{rev}:{phase} '{desc}' {branches}\n"
@@ -341,11 +339,8 @@
 
   $ hg rebase -s 8 -d 7 --collapse --config ui.merge=internal:other
   rebasing 8:9790e768172d "I"
-  note: rebase of 8:9790e768172d created no changes to commit
   rebasing 9:5d7b11f5fb97 "Merge"
-  note: rebase of 9:5d7b11f5fb97 created no changes to commit
   rebasing 10:9427d4d5af81 "J" (tip)
-  note: rebase of 10:9427d4d5af81 created no changes to commit
   saved backup bundle to $TESTTMP/a6/.hg/strip-backup/9790e768172d-c2111e9d-backup.hg (glob)
 
   $ hg tglog
--- a/tests/test-rebase-obsolete.t	Mon Oct 19 15:47:40 2015 -0700
+++ b/tests/test-rebase-obsolete.t	Mon Oct 19 16:29:35 2015 +0200
@@ -259,11 +259,8 @@
   $ cd collapse
   $ hg rebase  -s 42ccdea3bb16 -d eea13746799a --collapse
   rebasing 1:42ccdea3bb16 "B"
-  note: rebase of 1:42ccdea3bb16 created no changes to commit
   rebasing 2:5fddd98957c8 "C"
-  note: rebase of 2:5fddd98957c8 created no changes to commit
   rebasing 3:32af7686d403 "D"
-  note: rebase of 3:32af7686d403 created no changes to commit
   $ hg log -G
   o  8:4dc2197e807b Collapsed revision
   |
--- a/tests/test-rebase-rename.t	Mon Oct 19 15:47:40 2015 -0700
+++ b/tests/test-rebase-rename.t	Mon Oct 19 16:29:35 2015 +0200
@@ -310,13 +310,10 @@
   created new head
   $ hg rebase -s 2 --dest 5 --collapse
   rebasing 2:68bf06433839 "File b created as copy of a and modified"
-  note: rebase of 2:68bf06433839 created no changes to commit
   rebasing 3:af74b229bc02 "File c created as copy of b and modified"
   merging b and c to c
-  note: rebase of 3:af74b229bc02 created no changes to commit
   rebasing 4:dbb9ba033561 "File d created as copy of c and modified"
   merging c and d to d
-  note: rebase of 4:dbb9ba033561 created no changes to commit
   saved backup bundle to $TESTTMP/copy-gets-preserved/.hg/strip-backup/68bf06433839-dde37595-backup.hg (glob)
   $ hg co tip
   3 files updated, 0 files merged, 0 files removed, 0 files unresolved