Patchwork [1,of,4] cmdutil: allow bailifchanged to ignore merging in progress

mail settings
Submitter Katsunori FUJIWARA
Date March 13, 2015, 3:35 p.m.
Message ID <06060b1642b66ec9d123.1426260900@feefifofum>
Download mbox | patch
Permalink /patch/8051/
State Superseded
Commit 1bf71faf042e87eb58d34a112a625daddd9db63e
Headers show


Katsunori FUJIWARA - March 13, 2015, 3:35 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <>
# Date 1426260651 -32400
#      Sat Mar 14 00:30:51 2015 +0900
# Node ID 06060b1642b66ec9d123e265182dce0a5f0d7c7c
# Parent  2b7ab29627fd93ca7f5cb838403c2f6c728469bd
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/ b/hgext/largefiles/
--- a/hgext/largefiles/
+++ b/hgext/largefiles/
@@ -1027,8 +1027,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/ b/mercurial/
--- a/mercurial/
+++ b/mercurial/
@@ -253,8 +253,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: