taapas1128 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This ensures to abort strip to `hg strip` when we have a merge
  in progress and allow it only when a `--force` flag is used.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/strip.py
  tests/test-strip.t

CHANGE DETAILS

diff --git a/tests/test-strip.t b/tests/test-strip.t
--- a/tests/test-strip.t
+++ b/tests/test-strip.t
@@ -272,9 +272,14 @@
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     c
   
+##strip not allowed with merge in progress
   $ hg strip 4
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
+  abort: outstanding uncommitted merge
+  [255]
+##strip allowed --force with merge in progress
+  $ hg strip 4 --force
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  saved backup bundle to 
$TESTTMP/test/.hg/strip-backup/264128213d29-0b39d6bf-backup.hg
 
 after strip of merge parent
 
@@ -322,7 +327,7 @@
 2 is parent of 3, only one strip should happen
 
   $ hg strip "roots(2)" 3
-  saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
+  saved backup bundle to 
$TESTTMP/test/.hg/strip-backup/65bd5f99a4a3-0eb9aae0-backup.hg
   $ hg log -G
   @  changeset:   2:264128213d29
   |  tag:         tip
@@ -373,12 +378,12 @@
 
   $ hg strip 2 --config hooks.pretxnchangegroup.bad=false
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
+  saved backup bundle to 
$TESTTMP/test/.hg/strip-backup/264128213d29-0b39d6bf-backup.hg
   transaction abort!
   rollback completed
-  strip failed, backup bundle stored in 
'$TESTTMP/test/.hg/strip-backup/*-backup.hg' (glob)
-  strip failed, unrecovered changes stored in 
'$TESTTMP/test/.hg/strip-backup/*-temp.hg' (glob)
-  (fix the problem, then recover the changesets with "hg unbundle 
'$TESTTMP/test/.hg/strip-backup/*-temp.hg'") (glob)
+  strip failed, backup bundle stored in 
'$TESTTMP/test/.hg/strip-backup/264128213d29-0b39d6bf-backup.hg'
+  strip failed, unrecovered changes stored in 
'$TESTTMP/test/.hg/strip-backup/264128213d29-0eb9aae0-temp.hg'
+  (fix the problem, then recover the changesets with "hg unbundle 
'$TESTTMP/test/.hg/strip-backup/264128213d29-0eb9aae0-temp.hg'")
   abort: pretxnchangegroup.bad hook exited with status 1
   [255]
   $ restore
@@ -414,7 +419,7 @@
 2 different branches: 2 strips
 
   $ hg strip 2 4
-  saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
+  saved backup bundle to 
$TESTTMP/test/.hg/strip-backup/443431ffac4f-21215376-backup.hg
   $ hg log -G
   o  changeset:   2:65bd5f99a4a3
   |  tag:         tip
@@ -438,7 +443,7 @@
 
   $ hg strip 1 "2|4"
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
+  saved backup bundle to 
$TESTTMP/test/.hg/strip-backup/ef3a871183d7-7c4e7e70-backup.hg
   $ restore
 
 verify fncache is kept up-to-date
diff --git a/hgext/strip.py b/hgext/strip.py
--- a/hgext/strip.py
+++ b/hgext/strip.py
@@ -50,6 +50,8 @@
     cmdutil.checkunfinished(repo)
     s = repo.status()
     if not force:
+        if len(repo[None].parents()) > 1:
+            raise error.Abort(_('outstanding uncommitted merge'))
         if s.modified or s.added or s.removed or s.deleted:
             _("local changes found") # i18n tool detection
             raise error.Abort(_("local changes found" + excsuffix))



To: taapas1128, #hg-reviewers
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to