[Bug 5300] New: rebase is overzealous about preventing divergence in subtle case

mercurial-bugs at selenic.com mercurial-bugs at selenic.com
Fri Jul 15 17:38:12 UTC 2016


https://bz.mercurial-scm.org/show_bug.cgi?id=5300

            Bug ID: 5300
           Summary: rebase is overzealous about preventing divergence in
                    subtle case
           Product: Mercurial
           Version: default branch
          Hardware: PC
                OS: Linux
            Status: UNCONFIRMED
          Severity: feature
          Priority: wish
         Component: rebase
          Assignee: bugzilla at selenic.com
          Reporter: durin42 at gmail.com
                CC: mercurial-devel at selenic.com

Our workflow for code reviews uses local tags to show you what you've already
exported for review, so it's easy to tell what is already pushed but
potentially out of date. This can sort of confuse the divergence-detection
algorithm in rebase, because it may try to rebase both the currently checked
out revision, but potentially also a locally-tagged successor. I've included a
patch below that adds a test that demonstrates the problem. I think what should
happen in this case is we should not rebase the already obsoleted revision
which is only kept alive by a local tag.

# HG changeset patch
# User Augie Fackler <augie at google.com>
# Date 1468618463 14400
#      Fri Jul 15 17:34:23 2016 -0400
# Node ID 8025e66fb9637a2f9a7bbb49d3d607f2c827303d
# Parent  e2709b197f256e766f9d326831b8a195c5fb1cc8
rebase: demonstrate bug in divergence prevention

diff --git a/tests/test-rebase-obsolete.t b/tests/test-rebase-obsolete.t
--- a/tests/test-rebase-obsolete.t
+++ b/tests/test-rebase-obsolete.t
@@ -949,3 +949,51 @@ Check that bookmark was moved to rev 3 a
 during the rebase operation
   $ hg bookmarks
      mybook                    3:be1832deae9a
+
+  $ cd ..
+  $ hg init divergence-test
+  $ cd divergence-test
+  $ echo this is alpha >> alpha
+  $ hg addr
+  adding alpha
+  $ hg ci -m alpha
+  $ echo this is beta >> beta
+  $ hg addr
+  adding beta
+  $ hg ci -m beta
+  $ echo this is gamma >> gamma
+  $ hg addr
+  adding gamma
+  $ hg ci -m gamma
+  $ hg tag --local orig-gamma
+  $ echo narf >> gamma
+  $ hg ci --amend -m narfed
+  $ hg co 0
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ echo this is delta >> delta
+  $ hg addr
+  adding delta
+  $ hg ci -m delta
+  created new head
+  $ hg co -r 'grep(narfed)'
+  2 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg log -G --style compact
+  o  5[tip]:0   548ea510abf2   1970-01-01 00:00 +0000   test
+  |    delta
+  |
+  | @  4:1   81c57aa70614   1970-01-01 00:00 +0000   test
+  | |    narfed
+  | |
+  | | x  2[orig-gamma]   0d06e1c65cf7   1970-01-01 00:00 +0000   test
+  | |/     gamma
+  | |
+  | o  1   1444e26bd91c   1970-01-01 00:00 +0000   test
+  |/     beta
+  |
+  o  0   26777fe7b819   1970-01-01 00:00 +0000   test
+       alpha
+  
+This shouldn't cause divergence, because we're not interested in
+rebasing the obsolete-but-not-hidden revision locally tagged by
+'orig-gamma'.
+  $ hg rebase -d tip

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Mercurial-devel mailing list