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