Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/hook.py @ 44894:09da5cf44772
hooks: provide access to transaction changes for internal hooks
External hooks are skipped here as the environment often has a size
limit in the low MBs and that can easily be reached by larger
transactions.
Differential Revision: https://phab.mercurial-scm.org/D8490
author | Joerg Sonnenberger <joerg@bec.de> |
---|---|
date | Fri, 01 May 2020 01:32:08 +0200 |
parents | 3cbbfd0bfc17 |
children | fd3b94f1712d |
comparison
equal
deleted
inserted
replaced
44893:be6401a25726 | 44894:09da5cf44772 |
---|---|
156 env[b'HG_PENDING'] = repo.root | 156 env[b'HG_PENDING'] = repo.root |
157 env[b'HG_HOOKTYPE'] = htype | 157 env[b'HG_HOOKTYPE'] = htype |
158 env[b'HG_HOOKNAME'] = name | 158 env[b'HG_HOOKNAME'] = name |
159 | 159 |
160 for k, v in pycompat.iteritems(args): | 160 for k, v in pycompat.iteritems(args): |
161 # transaction changes can accumulate MBs of data, so skip it | |
162 # for external hooks | |
163 if k == b'changes': | |
164 continue | |
161 if callable(v): | 165 if callable(v): |
162 v = v() | 166 v = v() |
163 if isinstance(v, (dict, list)): | 167 if isinstance(v, (dict, list)): |
164 v = stringutil.pprint(v) | 168 v = stringutil.pprint(v) |
165 env[b'HG_' + k.upper()] = v | 169 env[b'HG_' + k.upper()] = v |