D10269: rebase: when using --keep, don't care about pruned commits or divergence

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

D10269: rebase: when using --keep, don't care about pruned commits or divergence

marmoute (Pierre-Yves David)
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  `hg rebase --keep` creates duplicate commits (not successors), so I
  was surprised that it still skips pruned commits and errors out if it
  "would cause divergence" (it wouldn't). I guess this was just an
  oversight. We didn't have any tests for it, so I also included that.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D10269

AFFECTED FILES
  hgext/rebase.py
  tests/test-rebase-obsolete2.t

CHANGE DETAILS

diff --git a/tests/test-rebase-obsolete2.t b/tests/test-rebase-obsolete2.t
--- a/tests/test-rebase-obsolete2.t
+++ b/tests/test-rebase-obsolete2.t
@@ -317,3 +317,25 @@
   note: not rebasing 20:8b31da3c4919 "dummy change", already in destination as 18:601db7a18f51 "dummy change successor"
   rebasing 21:7bdc8a87673d tip "dummy change"
   $ cd ..
+
+Can rebase pruned and rewritten commits with --keep
+
+  $ hg init keep
+  $ cd keep
+  $ hg debugdrawdag <<'EOS'
+  >   D
+  >   |
+  >   C
+  >   |
+  > F B E  # prune: B
+  >  \|/   # rebase: C -> E
+  >   A
+  > EOS
+  1 new orphan changesets
+
+  $ hg rebase -b D -d F --keep
+  rebasing 1:112478962961 B "B"
+  rebasing 4:26805aba1e60 C "C"
+  rebasing 5:f585351a92f8 D tip "D"
+
+  $ cd ..
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -350,6 +350,8 @@
 
     def _handleskippingobsolete(self):
         """Compute structures necessary for skipping obsolete revisions"""
+        if self.keepf:
+            return
         if not self.ui.configbool(b'experimental', b'rebaseskipobsolete'):
             return
         obsoleteset = {r for r in self.state if self.repo[r].obsolete()}



To: martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel