changeset 5651:e11940d84606

patch: avoid file existence tests when possible in selectfile()
author Patrick Mezard <pmezard@gmail.com>
date Mon, 17 Dec 2007 23:06:04 +0100
parents 5d3e2f918d65
children e90e72c6b4c7
files mercurial/patch.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/patch.py	Mon Dec 17 23:06:01 2007 +0100
+++ b/mercurial/patch.py	Mon Dec 17 23:06:04 2007 +0100
@@ -796,12 +796,12 @@
     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