# HG changeset patch # User Patrick Mezard # Date 2007-12-17 22:06:04 # Node ID e11940d84606541475e9722e9b2ac86f4fe3768f # Parent 5d3e2f918d6501153536172509542d53e2dfc960 patch: avoid file existence tests when possible in selectfile() diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -796,12 +796,12 @@ def selectfile(afile_orig, bfile_orig, h 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