mirror of
https://github.com/golang/go
synced 2024-11-24 06:10:05 -07:00
codereview: avoid exception in match
R=rsc CC=golang-dev https://golang.org/cl/1585041
This commit is contained in:
parent
19783ef482
commit
3ca72458ec
@ -659,6 +659,7 @@ original_match = None
|
|||||||
def ReplacementForCmdutilMatch(repo, pats=[], opts={}, globbed=False, default='relpath'):
|
def ReplacementForCmdutilMatch(repo, pats=[], opts={}, globbed=False, default='relpath'):
|
||||||
taken = []
|
taken = []
|
||||||
files = []
|
files = []
|
||||||
|
pats = pats or []
|
||||||
for p in pats:
|
for p in pats:
|
||||||
if p.startswith('@'):
|
if p.startswith('@'):
|
||||||
taken.append(p)
|
taken.append(p)
|
||||||
@ -671,7 +672,7 @@ def ReplacementForCmdutilMatch(repo, pats=[], opts={}, globbed=False, default='r
|
|||||||
if cl.files == None:
|
if cl.files == None:
|
||||||
raise util.Abort("no files in CL " + clname)
|
raise util.Abort("no files in CL " + clname)
|
||||||
files = Add(files, cl.files)
|
files = Add(files, cl.files)
|
||||||
pats = Sub(pats, taken) + ['path:'+f for f in files]
|
pats = Sub(pats, taken) + ['path:'+f for f in files]
|
||||||
return original_match(repo, pats=pats, opts=opts, globbed=globbed, default=default)
|
return original_match(repo, pats=pats, opts=opts, globbed=globbed, default=default)
|
||||||
|
|
||||||
def RelativePath(path, cwd):
|
def RelativePath(path, cwd):
|
||||||
|
Loading…
Reference in New Issue
Block a user