[PATCH] dispatch: check for None before closing repo

Idan Kamara idankk86 at gmail.com
Fri Jun 24 08:31:14 CDT 2011


# HG changeset patch
# User Idan Kamara <idankk86 at gmail.com>
# Date 1308922243 -10800
# Branch stable
# Node ID 38bdf67526380662b89305253f41fe8a669d6a4e
# Parent  5769e2cecea7c959308c3d0b6fad256f1ce67d10
dispatch: check for None before closing repo

We were trying to call close() if repo == None and req.repo != None.
This can happen when running commands that don't take a repo.

diff -r 5769e2cecea7 -r 38bdf6752638 mercurial/dispatch.py
--- a/mercurial/dispatch.py	Fri Jun 24 16:30:37 2011 +0300
+++ b/mercurial/dispatch.py	Fri Jun 24 16:30:43 2011 +0300
@@ -654,7 +654,7 @@
         return runcommand(lui, repo, cmd, fullargs, ui, options, d,
                           cmdpats, cmdoptions)
     finally:
-        if repo != req.repo:
+        if repo and repo != req.repo:
             repo.close()
 
 def _runcommand(ui, options, cmd, cmdfunc):


More information about the Mercurial-devel mailing list