mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 23:38:50 +03:00
patch: avoid file existence tests when possible in selectfile()
This commit is contained in:
parent
c43b58242b
commit
29045b226b
@ -796,12 +796,12 @@ def selectfile(afile_orig, bfile_orig, hunk, strip, reverse):
|
||||
nulla = afile_orig == "/dev/null"
|
||||
nullb = bfile_orig == "/dev/null"
|
||||
afile = pathstrip(afile_orig, strip)
|
||||
gooda = os.path.exists(afile) and not nulla
|
||||
gooda = not nulla and os.path.exists(afile)
|
||||
bfile = pathstrip(bfile_orig, strip)
|
||||
if afile == bfile:
|
||||
goodb = gooda
|
||||
else:
|
||||
goodb = os.path.exists(bfile) and not nullb
|
||||
goodb = not nullb and os.path.exists(bfile)
|
||||
createfunc = hunk.createfile
|
||||
if reverse:
|
||||
createfunc = hunk.rmfile
|
||||
|
Loading…
Reference in New Issue
Block a user