--- a/mercurial/hook.py Wed Dec 02 14:20:13 2015 -0800
+++ b/mercurial/hook.py Thu Dec 03 01:38:21 2015 +0100
@@ -120,10 +120,11 @@
env = {}
# make in-memory changes visible to external process
- tr = repo.currenttransaction()
- repo.dirstate.write(tr)
- if tr and tr.writepending():
- env['HG_PENDING'] = repo.root
+ if repo is not None:
+ tr = repo.currenttransaction()
+ repo.dirstate.write(tr)
+ if tr and tr.writepending():
+ env['HG_PENDING'] = repo.root
for k, v in args.iteritems():
if callable(v):