[PATCH 5 of 8] largefiles: wrap "autoupdate" to suppress messages at automated updating
FUJIWARA Katsunori
foozy at lares.dti.ne.jp
Tue Sep 9 13:18:49 CDT 2014
# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1410286453 -32400
# Wed Sep 10 03:14:13 2014 +0900
# Node ID 99a716366e69fccab7d1f6909d6c737a24385d90
# Parent 6ae359a9f2d2625b001fcec58ee04a3a250de679
largefiles: wrap "autoupdate" to suppress messages at automated updating
This patch wraps "autoupdate" to suppress displaying some status
messages at automated updating ("NNNN largefiles updated...", for
example).
diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -1348,3 +1348,18 @@
repo._lfautocommit = False
return orig(commandname, repo, wrapper, **props)
+
+def cmdutilautoupdate(orig, commandname, repo, updatefunc):
+ # "_lfautocommit" attribute must be created at automated updating
+ # to suppress displaying some status messages
+ def wrapper(*args, **kwargs):
+ # to detect unexpected nesting
+ assert not getattr(repo, '_lfautocommit', False)
+
+ repo._lfautocommit = commandname
+ try:
+ return updatefunc(*args, **kwargs)
+ finally:
+ repo._lfautocommit = False
+
+ return orig(commandname, repo, wrapper)
diff --git a/hgext/largefiles/uisetup.py b/hgext/largefiles/uisetup.py
--- a/hgext/largefiles/uisetup.py
+++ b/hgext/largefiles/uisetup.py
@@ -126,6 +126,8 @@
overrides.overridebailifchanged)
extensions.wrapfunction(cmdutil, 'autocommit',
overrides.cmdutilautocommit)
+ extensions.wrapfunction(cmdutil, 'autoupdate',
+ overrides.cmdutilautoupdate)
extensions.wrapfunction(scmutil, 'marktouched',
overrides.scmutilmarktouched)
More information about the Mercurial-devel
mailing list