Show More
@@ -98,7 +98,8 b' def isexec(f):' | |||||
98 | return (os.lstat(f).st_mode & 0o100 != 0) |
|
98 | return (os.lstat(f).st_mode & 0o100 != 0) | |
99 |
|
99 | |||
100 | def setflags(f, l, x): |
|
100 | def setflags(f, l, x): | |
101 |
s = os.lstat(f) |
|
101 | st = os.lstat(f) | |
|
102 | s = st.st_mode | |||
102 | if l: |
|
103 | if l: | |
103 | if not stat.S_ISLNK(s): |
|
104 | if not stat.S_ISLNK(s): | |
104 | # switch file to link |
|
105 | # switch file to link | |
@@ -125,6 +126,14 b' def setflags(f, l, x):' | |||||
125 | s = 0o666 & ~umask # avoid restatting for chmod |
|
126 | s = 0o666 & ~umask # avoid restatting for chmod | |
126 |
|
127 | |||
127 | sx = s & 0o100 |
|
128 | sx = s & 0o100 | |
|
129 | if st.st_nlink > 1 and bool(x) != bool(sx): | |||
|
130 | # the file is a hardlink, break it | |||
|
131 | with open(f, "rb") as fp: | |||
|
132 | data = fp.read() | |||
|
133 | unlink(f) | |||
|
134 | with open(f, "wb") as fp: | |||
|
135 | fp.write(data) | |||
|
136 | ||||
128 | if x and not sx: |
|
137 | if x and not sx: | |
129 | # Turn on +x for every +r bit when making a file executable |
|
138 | # Turn on +x for every +r bit when making a file executable | |
130 | # and obey umask. |
|
139 | # and obey umask. |
@@ -203,10 +203,18 b' Committing a change to f1 in r1 must bre' | |||||
203 | 2 r2/.hg/store/fncache |
|
203 | 2 r2/.hg/store/fncache | |
204 | #endif |
|
204 | #endif | |
205 |
|
205 | |||
|
206 | Create a file which exec permissions we will change | |||
|
207 | $ cd r3 | |||
|
208 | $ echo "echo hello world" > f3 | |||
|
209 | $ hg add f3 | |||
|
210 | $ hg ci -mf3 | |||
|
211 | $ cd .. | |||
|
212 | ||||
206 | $ cd r3 |
|
213 | $ cd r3 | |
207 | $ hg tip --template '{rev}:{node|short}\n' |
|
214 | $ hg tip --template '{rev}:{node|short}\n' | |
208 | 11:a6451b6bc41f |
|
215 | 12:d3b77733a28a | |
209 | $ echo bla > f1 |
|
216 | $ echo bla > f1 | |
|
217 | $ chmod +x f3 | |||
210 | $ hg ci -m1 |
|
218 | $ hg ci -m1 | |
211 | $ cd .. |
|
219 | $ cd .. | |
212 |
|
220 | |||
@@ -241,6 +249,7 b' r4 has hardlinks in the working dir (not' | |||||
241 | 2 r4/.hg/store/data/d1/f2.d |
|
249 | 2 r4/.hg/store/data/d1/f2.d | |
242 | 2 r4/.hg/store/data/d1/f2.i |
|
250 | 2 r4/.hg/store/data/d1/f2.i | |
243 | 2 r4/.hg/store/data/f1.i |
|
251 | 2 r4/.hg/store/data/f1.i | |
|
252 | 2 r4/.hg/store/data/f3.i | |||
244 | 2 r4/.hg/store/fncache |
|
253 | 2 r4/.hg/store/fncache | |
245 | 2 r4/.hg/store/phaseroots |
|
254 | 2 r4/.hg/store/phaseroots | |
246 | 2 r4/.hg/store/undo |
|
255 | 2 r4/.hg/store/undo | |
@@ -256,17 +265,18 b' r4 has hardlinks in the working dir (not' | |||||
256 | 2 r4/d1/data1 |
|
265 | 2 r4/d1/data1 | |
257 | 2 r4/d1/f2 |
|
266 | 2 r4/d1/f2 | |
258 | 2 r4/f1 |
|
267 | 2 r4/f1 | |
|
268 | 2 r4/f3 | |||
259 |
|
269 | |||
|
270 | Update back to revision 12 in r4 should break hardlink of file f1 and f3: | |||
260 | #if hardlink-whitelisted |
|
271 | #if hardlink-whitelisted | |
261 | $ nlinksdir r4/.hg/undo.backup.dirstate r4/.hg/undo.dirstate |
|
272 | $ nlinksdir r4/.hg/undo.backup.dirstate r4/.hg/undo.dirstate | |
262 | 4 r4/.hg/undo.backup.dirstate |
|
273 | 4 r4/.hg/undo.backup.dirstate | |
263 | 4 r4/.hg/undo.dirstate |
|
274 | 4 r4/.hg/undo.dirstate | |
264 | #endif |
|
275 | #endif | |
265 |
|
276 | |||
266 | Update back to revision 11 in r4 should break hardlink of file f1: |
|
|||
267 |
|
277 | |||
268 |
$ hg -R r4 up 1 |
|
278 | $ hg -R r4 up 12 | |
269 |
|
|
279 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
270 |
|
280 | |||
271 | $ nlinksdir r4 |
|
281 | $ nlinksdir r4 | |
272 | 2 r4/.hg/00changelog.i |
|
282 | 2 r4/.hg/00changelog.i | |
@@ -287,6 +297,7 b' Update back to revision 11 in r4 should ' | |||||
287 | 2 r4/.hg/store/data/d1/f2.d |
|
297 | 2 r4/.hg/store/data/d1/f2.d | |
288 | 2 r4/.hg/store/data/d1/f2.i |
|
298 | 2 r4/.hg/store/data/d1/f2.i | |
289 | 2 r4/.hg/store/data/f1.i |
|
299 | 2 r4/.hg/store/data/f1.i | |
|
300 | 2 r4/.hg/store/data/f3.i | |||
290 | 2 r4/.hg/store/fncache |
|
301 | 2 r4/.hg/store/fncache | |
291 | 2 r4/.hg/store/phaseroots |
|
302 | 2 r4/.hg/store/phaseroots | |
292 | 2 r4/.hg/store/undo |
|
303 | 2 r4/.hg/store/undo | |
@@ -302,6 +313,7 b' Update back to revision 11 in r4 should ' | |||||
302 | 2 r4/d1/data1 |
|
313 | 2 r4/d1/data1 | |
303 | 2 r4/d1/f2 |
|
314 | 2 r4/d1/f2 | |
304 | 1 r4/f1 |
|
315 | 1 r4/f1 | |
|
316 | 1 r4/f3 | |||
305 |
|
317 | |||
306 | #if hardlink-whitelisted |
|
318 | #if hardlink-whitelisted | |
307 | $ nlinksdir r4/.hg/undo.backup.dirstate r4/.hg/undo.dirstate |
|
319 | $ nlinksdir r4/.hg/undo.backup.dirstate r4/.hg/undo.dirstate |
General Comments 0
You need to be logged in to leave comments.
Login now