patch: avoid file existence tests when possible in selectfile()
authorPatrick Mezard <pmezard@gmail.com>
Mon, 17 Dec 2007 23:06:04 +0100
changeset 5651 e11940d84606
parent 5650 5d3e2f918d65
child 5652 e90e72c6b4c7
patch: avoid file existence tests when possible in selectfile()
mercurial/patch.py
--- 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