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

navaneeth.suresh (Navaneeth Suresh) phabricator at mercurial-scm.org
Fri Jul 26 12:52:05 UTC 2019


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

REVISION SUMMARY
  `cmdutil.dorecord()` has a `checkunfinished()` function call. We might not
  want to do that on certain occasions. For example, `unshelve --continue`
  on interactive mode is trying to create a commit during an existing
  unfinished state.
  
  We are now allowing that case using an option `interactive-unshelve`.
  However, there should be a general way to do that. This patch adds
  a `allowunfinished` optional argument to the `cmdutil.dorecord()`
  function. In the next patch, I will make unshelve to migrate to
  this argument by removing `interactive-unshelve` option.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/cmdutil.py

CHANGE DETAILS

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 or opts.get('interactive-unshelve')):
             checkunfinished(repo, commit=True)
         wctx = repo[None]
         merge = len(wctx.parents()) > 1



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


More information about the Mercurial-devel mailing list