localrepo: debug log of filter name when filtering through a function
authorMads Kiilerich <mads@kiilerich.com>
Sun, 13 Oct 2019 14:40:00 +0200
changeset 43201 6ceb3721e203
parent 43200 a819b5777727
child 43202 8864aa96f1f6
localrepo: debug log of filter name when filtering through a function
mercurial/localrepo.py
tests/test-eol-update.t
--- a/mercurial/localrepo.py	Mon Oct 14 00:09:25 2019 +0200
+++ b/mercurial/localrepo.py	Sun Oct 13 14:40:00 2019 +0200
@@ -1903,10 +1903,12 @@
                         break
                 if not fn:
                     fn = lambda s, c, **kwargs: procutil.filter(s, c)
+                    fn.__name__ = 'commandfilter'
                 # Wrap old filters not supporting keyword arguments
                 if not pycompat.getargspec(fn)[2]:
                     oldfn = fn
                     fn = lambda s, c, **kwargs: oldfn(s, c)
+                    fn.__name__ = 'compat-' + oldfn.__name__
                 l.append((mf, fn, params))
             self._filterpats[filter] = l
         return self._filterpats[filter]
@@ -1914,7 +1916,10 @@
     def _filter(self, filterpats, filename, data):
         for mf, fn, cmd in filterpats:
             if mf(filename):
-                self.ui.debug(b"filtering %s through %s\n" % (filename, cmd))
+                self.ui.debug(
+                    b"filtering %s through %s\n"
+                    % (filename, cmd or pycompat.sysbytes(fn.__name__))
+                )
                 data = fn(data, cmd, ui=self.ui, repo=self, filename=filename)
                 break
 
--- a/tests/test-eol-update.t	Mon Oct 14 00:09:25 2019 +0200
+++ b/tests/test-eol-update.t	Sun Oct 13 14:40:00 2019 +0200
@@ -187,21 +187,21 @@
   calling hook preupdate.eol: hgext.eol.preupdate
    .hgeol: remote created -> g
   getting .hgeol
-  filtering .hgeol through 
+  filtering .hgeol through compat-isbinary
    a.txt: remote created -> g
   getting a.txt
-  filtering a.txt through 
+  filtering a.txt through tolf
    f: remote created -> g
   getting f
-  filtering f through 
+  filtering f through tolf
   3 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg st
   M f
   $ touch .hgeol *  # ensure consistent dirtyness checks ignoring dirstate
   $ hg up -C -r 0 -v --debug
   eol: detected change in .hgeol
-  filtering .hgeol through 
-  filtering a.txt through 
+  filtering .hgeol through compat-isbinary
+  filtering a.txt through tolf
   resolving manifests
    branchmerge: False, force: True, partial: False
    ancestor: 15cbdf8ca3db+, local: 15cbdf8ca3db+, remote: 15cbdf8ca3db
@@ -263,20 +263,20 @@
   calling hook preupdate.eol: hgext.eol.preupdate
    .hgeol: remote is newer -> g
   getting .hgeol
-  filtering .hgeol through 
+  filtering .hgeol through compat-isbinary
    a.txt: remote is newer -> g
   getting a.txt
-  filtering a.txt through 
+  filtering a.txt through tolf
    f: remote is newer -> g
   getting f
-  filtering f through 
+  filtering f through tolf
   3 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
   $ touch .hgeol *
   $ hg st --debug
   eol: detected change in .hgeol
-  filtering .hgeol through 
-  filtering a.txt through 
+  filtering .hgeol through compat-isbinary
+  filtering a.txt through tolf
   M f
   $ hg diff
   diff --git a/f b/f
@@ -291,8 +291,8 @@
   $ touch .hgeol *
   $ hg up -C -r 0 -v --debug
   eol: detected change in .hgeol
-  filtering .hgeol through 
-  filtering a.txt through 
+  filtering .hgeol through compat-isbinary
+  filtering a.txt through tolf
   resolving manifests
    branchmerge: False, force: True, partial: False
    ancestor: 15cbdf8ca3db+, local: 15cbdf8ca3db+, remote: 15cbdf8ca3db
@@ -304,8 +304,8 @@
   $ touch .hgeol *
   $ hg st --debug
   eol: detected change in .hgeol
-  filtering .hgeol through 
-  filtering a.txt through 
+  filtering .hgeol through compat-isbinary
+  filtering a.txt through tolf
 
   $ cd ..