changeset 11843:00f8e7837668 stable

rebase: recompute the set of skipped rev when using --continue (issue2330)
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Fri, 13 Aug 2010 18:02:02 +0200
parents 71dab6955be0
children 6c51a5056020
files hgext/rebase.py tests/test-rebase-mq-skip tests/test-rebase-mq-skip.out
diffstat 3 files changed, 82 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/rebase.py	Sun Jul 25 08:22:03 2010 -0700
+++ b/hgext/rebase.py	Fri Aug 13 18:02:02 2010 +0200
@@ -110,7 +110,7 @@
                 raise util.Abort(
                     _('abort and continue do not allow specifying revisions'))
 
-            (originalwd, target, state, collapsef, keepf,
+            (originalwd, target, state, skipped, collapsef, keepf,
                                 keepbranchesf, external) = restorestatus(repo)
             if abortf:
                 return abort(repo, originalwd, target, state)
@@ -413,8 +413,18 @@
             else:
                 oldrev, newrev = l.split(':')
                 state[repo[oldrev].rev()] = repo[newrev].rev()
+        skipped = set()
+        # recompute the set of skipped revs
+        if not collapse:
+            seen = set([target])
+            for old, new in sorted(state.items()):
+                if new != nullrev and new in seen:
+                    skipped.add(old)
+                seen.add(new)
+        repo.ui.debug('computed skipped revs: %s\n' % skipped)
         repo.ui.debug('rebase status resumed\n')
-        return originalwd, target, state, collapse, keep, keepbranches, external
+        return (originalwd, target, state, skipped,
+                collapse, keep, keepbranches, external)
     except IOError, err:
         if err.errno != errno.ENOENT:
             raise
--- a/tests/test-rebase-mq-skip	Sun Jul 25 08:22:03 2010 -0700
+++ b/tests/test-rebase-mq-skip	Fri Aug 13 18:02:02 2010 +0200
@@ -44,3 +44,33 @@
 hg up -C qtip
 hg rebase | hidebackup
 hg glog  --template '{rev} {desc} tags: {tags}\n'
+
+echo
+echo '% Now with --continue'
+cd ..
+hg init b
+cd b
+hg qinit -c # This must work even with a managed mq queue
+
+for i in r0 r1 r2 r3 r4 r5 r6;
+do
+	echo $i > $i
+	hg ci -Am $i
+done
+hg qimport -r 1:tip
+hg up 0
+for i in r1 r3 r7 r8;
+do
+	echo $i > $i
+	hg ci -Am branch2-$i
+done
+echo somethingelse > r4
+hg ci -Am branch2-r4
+echo r6 > r6
+hg ci -Am branch2-r6
+
+hg up qtip
+HGMERGE=internal:fail hg rebase | hidebackup
+HGMERGE=internal:local hg resolve --all
+hg rebase --continue | hidebackup
+hg glog  --template '{rev} {desc} tags: {tags}\n'
--- a/tests/test-rebase-mq-skip.out	Sun Jul 25 08:22:03 2010 -0700
+++ b/tests/test-rebase-mq-skip.out	Fri Aug 13 18:02:02 2010 +0200
@@ -15,3 +15,43 @@
 |
 o  0 C1 tags:
 
+
+% Now with --continue
+adding r0
+adding r1
+adding r2
+adding r3
+adding r4
+adding r5
+adding r6
+0 files updated, 0 files merged, 6 files removed, 0 files unresolved
+adding r1
+created new head
+adding r3
+adding r7
+adding r8
+adding r4
+adding r6
+3 files updated, 0 files merged, 2 files removed, 0 files unresolved
+abort: fix unresolved conflicts with hg resolve then run hg rebase --continue
+saved backup bundle to 
+@  9 r5 tags: 5.diff qtip tip
+|
+o  8 r4 tags: 4.diff
+|
+o  7 r2 tags: 2.diff qbase
+|
+o  6 branch2-r6 tags: qparent
+|
+o  5 branch2-r4 tags:
+|
+o  4 branch2-r8 tags:
+|
+o  3 branch2-r7 tags:
+|
+o  2 branch2-r3 tags:
+|
+o  1 branch2-r1 tags:
+|
+o  0 r0 tags:
+