--- a/mercurial/context.py Fri Dec 29 20:04:30 2006 -0600
+++ b/mercurial/context.py Fri Dec 29 20:04:30 2006 -0600
@@ -378,13 +378,14 @@
"""generate a manifest corresponding to the working directory"""
man = self._parents[0].manifest().copy()
+ is_exec = util.execfunc(self._repo.root, man.execf)
copied = self._repo.dirstate.copies()
modified, added, removed, deleted, unknown = self._status[:5]
for i, l in (("a", added), ("m", modified), ("u", unknown)):
for f in l:
man[f] = man.get(copied.get(f, f), nullid) + i
try:
- man.set(f, util.is_exec(self._repo.wjoin(f), man.execf(f)))
+ man.set(f, is_exec(f))
except OSError:
pass
--- a/mercurial/localrepo.py Fri Dec 29 20:04:30 2006 -0600
+++ b/mercurial/localrepo.py Fri Dec 29 20:04:30 2006 -0600
@@ -712,11 +712,12 @@
new = {}
linkrev = self.changelog.count()
commit.sort()
+ is_exec = util.execfunc(self.root, m1.execf)
for f in commit:
self.ui.note(f + "\n")
try:
new[f] = self.filecommit(f, m1, m2, linkrev, tr, changed)
- m1.set(f, util.is_exec(self.wjoin(f), m1.execf(f)))
+ m1.set(f, is_exec(f))
except IOError:
if use_dirstate:
self.ui.warn(_("trouble committing %s!\n") % f)
@@ -877,9 +878,10 @@
# generate a pseudo-manifest for the working dir
# XXX: create it in dirstate.py ?
mf2 = mfmatches(self.dirstate.parents()[0])
+ is_exec = util.execfunc(self.root, mf2.execf)
for f in lookup + modified + added:
mf2[f] = ""
- mf2.set(f, execf=util.is_exec(self.wjoin(f), mf2.execf(f)))
+ mf2.set(f, is_exec(f))
for f in removed:
if f in mf2:
del mf2[f]
--- a/mercurial/patch.py Fri Dec 29 20:04:30 2006 -0600
+++ b/mercurial/patch.py Fri Dec 29 20:04:30 2006 -0600
@@ -524,6 +524,7 @@
all = modified + added + removed
all.sort()
gone = {}
+
for f in all:
to = None
tn = None
--- a/mercurial/util.py Fri Dec 29 20:04:30 2006 -0600
+++ b/mercurial/util.py Fri Dec 29 20:04:30 2006 -0600
@@ -707,6 +707,12 @@
os.unlink(fn)
return r
+def execfunc(path, fallback):
+ '''return an is_exec() function with default to fallback'''
+ if checkexec(path):
+ return lambda x: is_exec(os.path.join(path, x), False)
+ return fallback
+
# Platform specific variants
if os.name == 'nt':
import msvcrt