# HG changeset patch
# User Taapas Agrawal <taapas2897@gmail.com>
# Date 1560516914 -19800
#      Fri Jun 14 18:25:14 2019 +0530
# Node ID 1acaa9f37377b6222f11625af3338fcb55d8dbfa
# Parent  4a3abb33380a6493bb8957dfad98018a9d8f4792
strip: during merge allow strip only when -f is used

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.

Differential Revision: https://phab.mercurial-scm.org/D6529

diff --git a/hgext/strip.py b/hgext/strip.py
--- a/hgext/strip.py
+++ b/hgext/strip.py
@@ -50,6 +50,9 @@
     cmdutil.checkunfinished(repo)
     s = repo.status()
     if not force:
+        if len(repo[None].parents()) > 1:
+            _("outstanding uncommitted merge") #i18 tool detection
+            raise error.Abort(_("outstanding uncommitted merge"+ excsuffix))
         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))
diff --git a/tests/test-strip.t b/tests/test-strip.t
--- a/tests/test-strip.t
+++ b/tests/test-strip.t
@@ -272,7 +272,12 @@
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     c
   
+##strip not allowed with merge in progress
   $ hg strip 4
+  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/*-backup.hg (glob)