changeset 19473:10a0ae668fe6 stable

histedit: refuse to edit history that contains merges (issue3962)
author Augie Fackler <raf@durin42.com>
date Wed, 24 Jul 2013 17:39:29 -0400
parents 32e502b26983
children 894fd1a7c533
files hgext/histedit.py tests/test-histedit-obsolete.t
diffstat 2 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/histedit.py	Wed Jul 24 13:20:44 2013 +0800
+++ b/hgext/histedit.py	Wed Jul 24 17:39:29 2013 -0400
@@ -679,6 +679,8 @@
         if (not obsolete._enabled and
             repo.revs('(%ld::) - (%ld)', ctxs, ctxs)):
             raise util.Abort(_('cannot edit history that would orphan nodes'))
+        if repo.revs('(%ld) and merge()', ctxs):
+            raise util.Abort(_('cannot edit history that contains merges'))
         root = ctxs[0] # list is already sorted by repo.set
         if not root.phase():
             raise util.Abort(_('cannot edit immutable changeset: %s') % root)
--- a/tests/test-histedit-obsolete.t	Wed Jul 24 13:20:44 2013 +0800
+++ b/tests/test-histedit-obsolete.t	Wed Jul 24 17:39:29 2013 -0400
@@ -441,4 +441,19 @@
   |
   o  0:cb9a9f314b8b (public) a
   
+  $ hg co 18
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ echo wat >> wat
+  $ hg add wat
+  $ hg ci -m 'add wat'
+  created new head
+  $ hg merge 19
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg ci -m 'merge'
+  $ echo not wat > wat
+  $ hg ci -m 'modify wat'
+  $ hg histedit 17
+  abort: cannot edit history that contains merges
+  [255]
   $ cd ..