Mercurial > hg-stable
comparison tests/test-extdiff.t @ 32323:8a1ff5ed620e
extdiff: copy back execbit-only changes to the working directory
Some tools like BeyondCompare allow the file mode to be changed. The change
was previously applied if the content of the file changed (either according to
size or mtime), but was not being copied back for a mode-only change. That
would seem to indicate handling this in an 'elif' branch, but I opted not to in
order to avoid copying back the mode without the content changes when mtime and
size are unchanged. (Yes, that's a rare corner case, but all the more reason
not to have a subtle difference in behavior.)
The only way I can think to handle this undetected change is to set each file in
the non-wdir() snapshot to readonly, and check for that attribute (as well as
mtime) when deciding to copy back. That would avoid the overhead of copying the
whole file when only the mode changed. But a chmod in a diff tool is likely
rare. See also affd753ddaf1.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Thu, 11 May 2017 22:33:45 -0400 |
parents | affd753ddaf1 |
children | b6776b34e44e |
comparison
equal
deleted
inserted
replaced
32322:0c0c9b12de52 | 32323:8a1ff5ed620e |
---|---|
327 $ cat > 'dir/tool.sh' << 'EOF' | 327 $ cat > 'dir/tool.sh' << 'EOF' |
328 > #!/bin/sh | 328 > #!/bin/sh |
329 > # Mimic a tool that syncs all attrs, including mtime | 329 > # Mimic a tool that syncs all attrs, including mtime |
330 > cp $1/a $2/a | 330 > cp $1/a $2/a |
331 > touch -r $1/a $2/a | 331 > touch -r $1/a $2/a |
332 > chmod +x $2/a | |
332 > echo "** custom diff **" | 333 > echo "** custom diff **" |
333 > EOF | 334 > EOF |
334 #if execbit | 335 #if execbit |
335 $ chmod +x dir/tool.sh | 336 $ chmod +x dir/tool.sh |
336 #endif | 337 #endif |
364 cleaning up temp directory | 365 cleaning up temp directory |
365 [1] | 366 [1] |
366 $ cat a | 367 $ cat a |
367 a | 368 a |
368 | 369 |
370 #if execbit | |
371 $ [ -x a ] | |
372 | |
373 $ cat > 'dir/tool.sh' << 'EOF' | |
374 > #!/bin/sh | |
375 > chmod -x $2/a | |
376 > echo "** custom diff **" | |
377 > EOF | |
378 | |
379 $ hg --debug tl --config extdiff.tl= --config merge-tools.tl.executable=$tool | |
380 making snapshot of 2 files from rev * (glob) | |
381 a | |
382 b | |
383 making snapshot of 2 files from working directory | |
384 a | |
385 b | |
386 running '$TESTTMP/a/dir/tool.sh a.* a' in */extdiff.* (glob) | |
387 ** custom diff ** | |
388 file changed while diffing. Overwriting: $TESTTMP/a/a (src: */extdiff.*/a/a) (glob) | |
389 cleaning up temp directory | |
390 [1] | |
391 | |
392 $ [ -x a ] | |
393 [1] | |
394 #endif | |
395 | |
369 $ cd .. | 396 $ cd .. |
370 | 397 |
371 #if symlink | 398 #if symlink |
372 | 399 |
373 Test symlinks handling (issue1909) | 400 Test symlinks handling (issue1909) |