changeset 20285:189fe1b3d16a

revset: narrow scope of the variable referred only in specific code path This patch narrows scope of the variable "m" in the function for revset predicate "contains()", because it is referred only in "else" code path of "if not matchmod.patkind(pat)" examination.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Fri, 17 Jan 2014 23:42:12 +0900
parents e1e6ddaef299
children 760151697a4f
files mercurial/revset.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revset.py	Fri Jan 17 12:46:29 2014 +0100
+++ b/mercurial/revset.py	Fri Jan 17 23:42:12 2014 +0900
@@ -528,13 +528,13 @@
     """
     # i18n: "contains" is a keyword
     pat = getstring(x, _("contains requires a pattern"))
-    m = None
     s = []
     if not matchmod.patkind(pat):
         for r in subset:
             if pat in repo[r]:
                 s.append(r)
     else:
+        m = None
         for r in subset:
             c = repo[r]
             if not m or matchmod.patkind(pat) == 'set':