mercurial/dispatch.py
changeset 13382 d747774ca9da
parent 13328 a939f08fae9c
child 13392 777cef34a890
--- a/mercurial/dispatch.py	Fri Feb 11 19:32:49 2011 +0100
+++ b/mercurial/dispatch.py	Sat Feb 12 10:58:11 2011 +0100
@@ -589,8 +589,12 @@
     msg = ' '.join(' ' in a and repr(a) or a for a in fullargs)
     ui.log("command", msg + "\n")
     d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
-    return runcommand(lui, repo, cmd, fullargs, ui, options, d,
-                      cmdpats, cmdoptions)
+    try:
+        return runcommand(lui, repo, cmd, fullargs, ui, options, d,
+                          cmdpats, cmdoptions)
+    finally:
+        if repo:
+            repo.close()
 
 def _runcommand(ui, options, cmd, cmdfunc):
     def checkargs():