changeset 5706:89fe5b36c21e

patch: use util.set_flags
author Matt Mackall <mpm@selenic.com>
date Thu, 27 Dec 2007 22:29:21 -0600
parents 4e400863c5ac
children 76dd039c2bad
files mercurial/patch.py
diffstat 1 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/patch.py	Thu Dec 27 22:29:17 2007 -0600
+++ b/mercurial/patch.py	Thu Dec 27 22:29:21 2007 -0600
@@ -1082,16 +1082,17 @@
     for f in patches:
         ctype, gp = patches[f]
         if gp and gp.mode:
-            x = gp.mode & 0100 != 0
-            l = gp.mode & 020000 != 0
+            flags = ''
+            if gp.mode & 0100:
+                flags = 'x'
+            elif gp.mode & 020000:
+                flags = 'l'
             dst = os.path.join(repo.root, gp.path)
             # patch won't create empty files
             if ctype == 'ADD' and not os.path.exists(dst):
-                repo.wwrite(gp.path, '', x and 'x' or '')
+                repo.wwrite(gp.path, '', flags)
             else:
-                util.set_link(dst, l)
-                if not l:
-                    util.set_exec(dst, x)
+                util.set_flags(dst, flags)
     cmdutil.addremove(repo, cfiles)
     files = patches.keys()
     files.extend([r for r in removes if r not in files])