[PATCH 3 of 5 V2] cmdutil: allow bailifchanged to ignore merging in progress

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Tue Mar 24 23:59:07 CDT 2015


# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1427259335 -32400
#      Wed Mar 25 13:55:35 2015 +0900
# Node ID d294ac09229af96b4f8fe5fd0198d83912672962
# Parent  274ee329b961805b3c3706c44f0f27c8aba33d92
cmdutil: allow bailifchanged to ignore merging in progress

In "commands.update()", "cmdutil.bailifchanged()" isn't used for
"abort if the working directory is dirty", because it forcibly
examines about merging in progress.

"workingctx.dirty()" used in "commands.update()" can't detect changes
of largefiles in the working directory without "repo.lfstatus = True"
wrapping. This is only reason of "commands.update()" wrapping by
largefiles extension.

On the other hand, "cmdutil.bailifchanged()" already wrapped by
largefiles extension can detect changes of largefiles.

This patch is a preparations for replacing "workingctx.dirty()" and
raising Abort in "commands.update()" by "cmdutil.bailifchanged()". It
can remove redundant "commands.update()" wrapping.

diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -1029,8 +1029,8 @@
 # standin until a commit. cmdutil.bailifchanged() raises an exception
 # if the repo has uncommitted changes. Wrap it to also check if
 # largefiles were changed. This is used by bisect, backout and fetch.
-def overridebailifchanged(orig, repo):
-    orig(repo)
+def overridebailifchanged(orig, repo, *args, **kwargs):
+    orig(repo, *args, **kwargs)
     repo.lfstatus = True
     s = repo.status()
     repo.lfstatus = False
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -274,8 +274,8 @@
 
     return p
 
-def bailifchanged(repo):
-    if repo.dirstate.p2() != nullid:
+def bailifchanged(repo, merge=True):
+    if merge and repo.dirstate.p2() != nullid:
         raise util.Abort(_('outstanding uncommitted merge'))
     modified, added, removed, deleted = repo.status()[:4]
     if modified or added or removed or deleted:


More information about the Mercurial-devel mailing list