diff hgext/rebase.py @ 21826:2ba6c9b4e0eb stable

rebase: fix bug that caused transitive copy records to disappear (issue4192) The defect was that copies were always duplicated against the target revision, rather than the first parent of the revision being rebased. This produced nominally correct results if changes were rebased one at a time (or with --collapse), but was wrong if we rebased a sequence of changesets which contained a sequence of copies.
author Augie Fackler <raf@durin42.com>
date Sat, 07 Jun 2014 15:23:12 -0400
parents 799c494189a9
children 4b93e19cd6e6
line wrap: on
line diff
--- a/hgext/rebase.py	Sat Jun 07 15:14:36 2014 -0400
+++ b/hgext/rebase.py	Sat Jun 07 15:23:12 2014 -0400
@@ -345,7 +345,16 @@
                                   'resolve, then hg rebase --continue)'))
                     finally:
                         ui.setconfig('ui', 'forcemerge', '', 'rebase')
-                cmdutil.duplicatecopies(repo, rev, target)
+                if collapsef:
+                    cmdutil.duplicatecopies(repo, rev, target)
+                else:
+                    # If we're not using --collapse, we need to
+                    # duplicate copies between the revision we're
+                    # rebasing and its first parent, but *not*
+                    # duplicate any copies that have already been
+                    # performed in the destination.
+                    p1rev = repo[rev].p1().rev()
+                    cmdutil.duplicatecopies(repo, rev, p1rev, skiprev=target)
                 if not collapsef:
                     newrev = concludenode(repo, rev, p1, p2, extrafn=extrafn,
                                           editor=editor)