mercurial/hook.py
branchstable
changeset 27228 10695f8f3323
parent 26861 10a1a4b3e775
child 28078 2058e1a894f2
--- 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):