Mercurial > public > mercurial-scm > hg
comparison mercurial/hook.py @ 27228:10695f8f3323 stable
dirstate: don't write repo.currenttransaction to repo.dirstate if repo
is None (issue4983)
Some hooks, such as post-init and post-clone, do not get a repo parameter in
their environment. If there is no repo, there is no repo.currenttransaction();
attempting to retrieve it anyway was causing crashes. Now currenttransaction is
only retrieved and written if the repo is not None.
author | Sietse Brouwer <sbbrouwer@gmail.com> |
---|---|
date | Thu, 03 Dec 2015 01:38:21 +0100 |
parents | 10a1a4b3e775 |
children | 2058e1a894f2 |
comparison
equal
deleted
inserted
replaced
27227:f20533623833 | 27228:10695f8f3323 |
---|---|
118 | 118 |
119 starttime = time.time() | 119 starttime = time.time() |
120 env = {} | 120 env = {} |
121 | 121 |
122 # make in-memory changes visible to external process | 122 # make in-memory changes visible to external process |
123 tr = repo.currenttransaction() | 123 if repo is not None: |
124 repo.dirstate.write(tr) | 124 tr = repo.currenttransaction() |
125 if tr and tr.writepending(): | 125 repo.dirstate.write(tr) |
126 env['HG_PENDING'] = repo.root | 126 if tr and tr.writepending(): |
127 env['HG_PENDING'] = repo.root | |
127 | 128 |
128 for k, v in args.iteritems(): | 129 for k, v in args.iteritems(): |
129 if callable(v): | 130 if callable(v): |
130 v = v() | 131 v = v() |
131 if isinstance(v, dict): | 132 if isinstance(v, dict): |