D6697: cmdutil: add allowunfinished to prevent checkunfinished() on docommit()

navaneeth.suresh (Navaneeth Suresh) phabricator at mercurial-scm.org
Fri Aug 2 04:17:14 EDT 2019


navaneeth.suresh updated this revision to Diff 16110.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6697?vs=16073&id=16110

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6697/new/

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

AFFECTED FILES
  mercurial/cmdutil.py
  mercurial/shelve.py

CHANGE DETAILS

diff --git a/mercurial/shelve.py b/mercurial/shelve.py
--- a/mercurial/shelve.py
+++ b/mercurial/shelve.py
@@ -824,7 +824,6 @@
     bool to know whether the shelve is partly done or completely done.
     """
     opts['message'] = shelvectx.description()
-    opts['interactive-unshelve'] = True
     pats = []
     if not interactive:
         newnode = repo.commit(text=shelvectx.description(),
@@ -836,7 +835,7 @@
     commitfunc = getcommitfunc(shelvectx.extra(), interactive=True,
                                editor=True)
     newnode = cmdutil.dorecord(ui, repo, commitfunc, None, False,
-                               cmdutil.recordfilter, *pats,
+                               cmdutil.recordfilter, True, *pats,
                                **pycompat.strkwargs(opts))
     snode = repo.commit(text=shelvectx.description(),
                         extra=shelvectx.extra(),
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -239,7 +239,7 @@
     return newchunks, newopts
 
 def dorecord(ui, repo, commitfunc, cmdsuggest, backupall,
-            filterfn, *pats, **opts):
+            filterfn, allowunfinished=False, *pats, **opts):
     opts = pycompat.byteskwargs(opts)
     if not ui.interactive():
         if cmdsuggest:
@@ -265,8 +265,13 @@
 
         In the end we'll record interesting changes, and everything else
         will be left in place, so the user can continue working.
+
+        We will prevent committing changesets on unfinished states if and only
+        if `allowunfinished` is not set `True`. For example, `unshelve` on
+        interactive mode does a commit during an unfinished state and we don't
+        want to prevent that.
         """
-        if not opts.get('interactive-unshelve'):
+        if not allowunfinished:
             checkunfinished(repo, commit=True)
         wctx = repo[None]
         merge = len(wctx.parents()) > 1



To: navaneeth.suresh, #hg-reviewers, pulkit
Cc: pulkit, mercurial-devel


More information about the Mercurial-devel mailing list