Show More
@@ -12,22 +12,6 b' from demandload import *' | |||||
12 | demandload(globals(), "re lock urllib urllib2 transaction time socket") |
|
12 | demandload(globals(), "re lock urllib urllib2 transaction time socket") | |
13 | demandload(globals(), "tempfile httprangereader bdiff") |
|
13 | demandload(globals(), "tempfile httprangereader bdiff") | |
14 |
|
14 | |||
15 | def is_exec(f): |
|
|||
16 | return (os.stat(f).st_mode & 0100 != 0) |
|
|||
17 |
|
||||
18 | def set_exec(f, mode): |
|
|||
19 | s = os.stat(f).st_mode |
|
|||
20 | if (s & 0100 != 0) == mode: |
|
|||
21 | return |
|
|||
22 | if mode: |
|
|||
23 | # Turn on +x for every +r bit when making a file executable |
|
|||
24 | # and obey umask. |
|
|||
25 | umask = os.umask(0) |
|
|||
26 | os.umask(umask) |
|
|||
27 | os.chmod(f, s | (s & 0444) >> 2 & ~umask) |
|
|||
28 | else: |
|
|||
29 | os.chmod(f, s & 0666) |
|
|||
30 |
|
||||
31 | class filelog(revlog): |
|
15 | class filelog(revlog): | |
32 | def __init__(self, opener, path): |
|
16 | def __init__(self, opener, path): | |
33 | revlog.__init__(self, opener, |
|
17 | revlog.__init__(self, opener, | |
@@ -509,7 +493,7 b' class localrepository:' | |||||
509 | for f in files: |
|
493 | for f in files: | |
510 | try: |
|
494 | try: | |
511 | t = self.wfile(f).read() |
|
495 | t = self.wfile(f).read() | |
512 | tm = is_exec(self.wjoin(f)) |
|
496 | tm = util.is_exec(self.wjoin(f), mfm.get(f, False)) | |
513 | r = self.file(f) |
|
497 | r = self.file(f) | |
514 | mfm[f] = tm |
|
498 | mfm[f] = tm | |
515 | mm[f] = r.add(t, {}, tr, linkrev, |
|
499 | mm[f] = r.add(t, {}, tr, linkrev, | |
@@ -565,8 +549,7 b' class localrepository:' | |||||
565 | for f in commit: |
|
549 | for f in commit: | |
566 | self.ui.note(f + "\n") |
|
550 | self.ui.note(f + "\n") | |
567 | try: |
|
551 | try: | |
568 |
|
|
552 | mf1[f] = util.is_exec(self.wjoin(f), mf1.get(f, False)) | |
569 | mf1[f] = is_exec(fp) |
|
|||
570 | t = self.wfile(f).read() |
|
553 | t = self.wfile(f).read() | |
571 | except IOError: |
|
554 | except IOError: | |
572 | self.warn("trouble committing %s!\n" % f) |
|
555 | self.warn("trouble committing %s!\n" % f) | |
@@ -1031,7 +1014,7 b' class localrepository:' | |||||
1031 | mfw = mf1.copy() |
|
1014 | mfw = mf1.copy() | |
1032 | for f in a + c + u: |
|
1015 | for f in a + c + u: | |
1033 | mw[f] = "" |
|
1016 | mw[f] = "" | |
1034 | mfw[f] = is_exec(self.wjoin(f)) |
|
1017 | mfw[f] = util.is_exec(self.wjoin(f), mfw.get(f, False)) | |
1035 | for f in d: |
|
1018 | for f in d: | |
1036 | if f in mw: del mw[f] |
|
1019 | if f in mw: del mw[f] | |
1037 |
|
1020 | |||
@@ -1081,13 +1064,13 b' class localrepository:' | |||||
1081 | if not s and mfw[f] != mf2[f]: |
|
1064 | if not s and mfw[f] != mf2[f]: | |
1082 | if force: |
|
1065 | if force: | |
1083 | self.ui.debug(" updating permissions for %s\n" % f) |
|
1066 | self.ui.debug(" updating permissions for %s\n" % f) | |
1084 | set_exec(self.wjoin(f), mf2[f]) |
|
1067 | util.set_exec(self.wjoin(f), mf2[f]) | |
1085 | else: |
|
1068 | else: | |
1086 | a, b, c = mfa.get(f, 0), mfw[f], mf2[f] |
|
1069 | a, b, c = mfa.get(f, 0), mfw[f], mf2[f] | |
1087 | mode = ((a^b) | (a^c)) ^ a |
|
1070 | mode = ((a^b) | (a^c)) ^ a | |
1088 | if mode != b: |
|
1071 | if mode != b: | |
1089 | self.ui.debug(" updating permissions for %s\n" % f) |
|
1072 | self.ui.debug(" updating permissions for %s\n" % f) | |
1090 | set_exec(self.wjoin(f), mode) |
|
1073 | util.set_exec(self.wjoin(f), mode) | |
1091 | mark[f] = 1 |
|
1074 | mark[f] = 1 | |
1092 | del m2[f] |
|
1075 | del m2[f] | |
1093 | elif f in ma: |
|
1076 | elif f in ma: | |
@@ -1169,7 +1152,7 b' class localrepository:' | |||||
1169 | except IOError: |
|
1152 | except IOError: | |
1170 | os.makedirs(os.path.dirname(self.wjoin(f))) |
|
1153 | os.makedirs(os.path.dirname(self.wjoin(f))) | |
1171 | self.wfile(f, "w").write(t) |
|
1154 | self.wfile(f, "w").write(t) | |
1172 | set_exec(self.wjoin(f), mf2[f]) |
|
1155 | util.set_exec(self.wjoin(f), mf2[f]) | |
1173 | self.dirstate.update([f], mode) |
|
1156 | self.dirstate.update([f], mode) | |
1174 |
|
1157 | |||
1175 | # merge the tricky bits |
|
1158 | # merge the tricky bits | |
@@ -1179,7 +1162,7 b' class localrepository:' | |||||
1179 | self.ui.status("merging %s\n" % f) |
|
1162 | self.ui.status("merging %s\n" % f) | |
1180 | m, o, flag = merge[f] |
|
1163 | m, o, flag = merge[f] | |
1181 | self.merge3(f, m, o) |
|
1164 | self.merge3(f, m, o) | |
1182 | set_exec(self.wjoin(f), flag) |
|
1165 | util.set_exec(self.wjoin(f), flag) | |
1183 | self.dirstate.update([f], 'm') |
|
1166 | self.dirstate.update([f], 'm') | |
1184 |
|
1167 | |||
1185 | for f in remove: |
|
1168 | for f in remove: |
@@ -16,6 +16,12 b' def rename(src, dst):' | |||||
16 |
|
16 | |||
17 | # Platfor specific varients |
|
17 | # Platfor specific varients | |
18 | if os.name == 'nt': |
|
18 | if os.name == 'nt': | |
|
19 | def is_exec(f, last): | |||
|
20 | return last | |||
|
21 | ||||
|
22 | def set_exec(f, mode): | |||
|
23 | pass | |||
|
24 | ||||
19 | def pconvert(path): |
|
25 | def pconvert(path): | |
20 | return path.replace("\\", "/") |
|
26 | return path.replace("\\", "/") | |
21 |
|
27 | |||
@@ -27,6 +33,22 b" if os.name == 'nt':" | |||||
27 | def readlock(pathname): |
|
33 | def readlock(pathname): | |
28 | return file(pathname).read() |
|
34 | return file(pathname).read() | |
29 | else: |
|
35 | else: | |
|
36 | def is_exec(f, last): | |||
|
37 | return (os.stat(f).st_mode & 0100 != 0) | |||
|
38 | ||||
|
39 | def set_exec(f, mode): | |||
|
40 | s = os.stat(f).st_mode | |||
|
41 | if (s & 0100 != 0) == mode: | |||
|
42 | return | |||
|
43 | if mode: | |||
|
44 | # Turn on +x for every +r bit when making a file executable | |||
|
45 | # and obey umask. | |||
|
46 | umask = os.umask(0) | |||
|
47 | os.umask(umask) | |||
|
48 | os.chmod(f, s | (s & 0444) >> 2 & ~umask) | |||
|
49 | else: | |||
|
50 | os.chmod(f, s & 0666) | |||
|
51 | ||||
30 | def pconvert(path): |
|
52 | def pconvert(path): | |
31 | return path |
|
53 | return path | |
32 |
|
54 |
General Comments 0
You need to be logged in to leave comments.
Login now