##// END OF EJS Templates
hooks: for python hooks, consistently use __name__ etc as name, not the repr...
Mads Kiilerich -
r20548:5bd6a9fe default
parent child Browse files
Show More
@@ -6,7 +6,7 b''
6 6 # GNU General Public License version 2 or any later version.
7 7
8 8 from i18n import _
9 import os, sys, time, types
9 import os, sys, time
10 10 import extensions, util, demandimport
11 11
12 12 def _pythonhook(ui, repo, name, hname, funcname, args, throw):
@@ -19,8 +19,10 b' def _pythonhook(ui, repo, name, hname, f'
19 19 unmodified commands (e.g. mercurial.commands.update) can
20 20 be run as hooks without wrappers to convert return values.'''
21 21
22 if util.safehasattr(funcname, '__call__'):
22 23 obj = funcname
23 if not util.safehasattr(obj, '__call__'):
24 funcname = obj.__module__ + "." + obj.__name__
25 else:
24 26 d = funcname.rfind('.')
25 27 if d == -1:
26 28 raise util.Abort(_('%s hook is invalid ("%s" not in '
@@ -101,11 +103,8 b' def _pythonhook(ui, repo, name, hname, f'
101 103 finally:
102 104 sys.stdout, sys.stderr, sys.stdin = old
103 105 duration = time.time() - starttime
104 readablefunc = funcname
105 if isinstance(funcname, types.FunctionType):
106 readablefunc = funcname.__module__ + "." + funcname.__name__
107 106 ui.log('pythonhook', 'pythonhook-%s: %s finished in %0.2f seconds\n',
108 name, readablefunc, duration)
107 name, funcname, duration)
109 108 if r:
110 109 if throw:
111 110 raise util.Abort(_('%s hook failed') % hname)
@@ -499,7 +499,7 b' make sure --traceback works'
499 499 $ echo >> foo
500 500 $ hg ci --debug -d '0 0' -m 'change foo'
501 501 foo
502 calling hook commit.auto: <function autohook at *> (glob)
502 calling hook commit.auto: hgext_hookext.autohook
503 503 Automatically installed hook
504 504 committed changeset 1:52998019f6252a2b893452765fcb0a47351a5708
505 505
@@ -900,7 +900,7 b' redo pull with --lfrev and check it pull'
900 900 adding manifests
901 901 adding file changes
902 902 added 6 changesets with 16 changes to 8 files
903 calling hook changegroup.lfiles: <function checkrequireslfiles at *> (glob)
903 calling hook changegroup.lfiles: hgext.largefiles.reposetup.checkrequireslfiles
904 904 (run 'hg update' to get a working copy)
905 905 pulling largefiles for revision 7
906 906 found 971fb41e78fea4f8e0ba5244784239371cb00591 in store
General Comments 0
You need to be logged in to leave comments. Login now