Patchwork [5,of,8] largefiles: wrap "autoupdate" to suppress messages at automated updating

login
register
mail settings
Submitter Katsunori FUJIWARA
Date Sept. 9, 2014, 6:18 p.m.
Message ID <99a716366e69fccab7d1.1410286729@feefifofum>
Download mbox | patch
Permalink /patch/5749/
State Changes Requested
Headers show

Comments

Katsunori FUJIWARA - Sept. 9, 2014, 6:18 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@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).

Patch

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)