comparison mercurial/revset.py @ 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 61a47fd64f30
children 760151697a4f
comparison
equal deleted inserted replaced
20284:e1e6ddaef299 20285:189fe1b3d16a
526 Revision contains a file matching pattern. See :hg:`help patterns` 526 Revision contains a file matching pattern. See :hg:`help patterns`
527 for information about file patterns. 527 for information about file patterns.
528 """ 528 """
529 # i18n: "contains" is a keyword 529 # i18n: "contains" is a keyword
530 pat = getstring(x, _("contains requires a pattern")) 530 pat = getstring(x, _("contains requires a pattern"))
531 m = None
532 s = [] 531 s = []
533 if not matchmod.patkind(pat): 532 if not matchmod.patkind(pat):
534 for r in subset: 533 for r in subset:
535 if pat in repo[r]: 534 if pat in repo[r]:
536 s.append(r) 535 s.append(r)
537 else: 536 else:
537 m = None
538 for r in subset: 538 for r in subset:
539 c = repo[r] 539 c = repo[r]
540 if not m or matchmod.patkind(pat) == 'set': 540 if not m or matchmod.patkind(pat) == 'set':
541 m = matchmod.match(repo.root, repo.getcwd(), [pat], ctx=c) 541 m = matchmod.match(repo.root, repo.getcwd(), [pat], ctx=c)
542 for f in c.manifest(): 542 for f in c.manifest():