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

navaneeth.suresh (Navaneeth Suresh) phabricator at mercurial-scm.org
Fri Jul 26 09:05:57 EDT 2019


navaneeth.suresh edited the summary of this revision.
navaneeth.suresh updated this revision to Diff 16073.

REPOSITORY
  rHG Mercurial

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

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
@@ -827,7 +827,6 @@
         # message.
         opts['message'] = ('changes to: %s' %
                            shelvectx.p1().description().split('\n', 1)[0])
-    opts['interactive-unshelve'] = True
     pats = []
     if not interactive:
         newnode = repo.commit(text=shelvectx.description(),
@@ -839,7 +838,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
Cc: pulkit, mercurial-devel


More information about the Mercurial-devel mailing list