diff tests/test-merge-tools.t @ 36999:e349ad5cbb71

filemerge: use a single temp dir instead of temp files This can help to remove the clutter from UIs that display just the filenames; instead of seeing foo~local.C9ru9r.txt and foo~base.2DMV22.txt (in the /tmp directory on most platforms), we create a single new directory and use that, producing filenames like /tmp/hgmerge.C9ru9r/foo~local.txt. Differential Revision: https://phab.mercurial-scm.org/D2888
author Kyle Lippincott <spectral@google.com>
date Fri, 19 Jan 2018 19:07:58 -0800
parents ccc2d5f10421
children 6bc2f1b3bc9d
line wrap: on
line diff
--- a/tests/test-merge-tools.t	Fri Jan 19 19:14:09 2018 -0800
+++ b/tests/test-merge-tools.t	Fri Jan 19 19:07:58 2018 -0800
@@ -1363,6 +1363,33 @@
   (branch merge, don't forget to commit)
   $ rm -f 'printargs_merge_tool'
 
+Same test with experimental.mergetempdirprefix set:
+
+  $ beforemerge
+  [merge-tools]
+  false.whatever=
+  true.priority=1
+  true.executable=cat
+  # hg update -C 1
+  $ cat <<EOF > printargs_merge_tool
+  > while test \$# -gt 0; do echo arg: \"\$1\"; shift; done
+  > EOF
+  $ hg --config experimental.mergetempdirprefix=$TESTTMP/hgmerge. \
+  >    --config merge-tools.true.executable='sh' \
+  >    --config merge-tools.true.args='./printargs_merge_tool ll:$labellocal lo: $labelother lb:$labelbase": "$base' \
+  >    --config merge-tools.true.mergemarkertemplate='tooltmpl {short(node)}' \
+  >    --config ui.mergemarkertemplate='uitmpl {rev}' \
+  >    --config ui.mergemarkers=detailed \
+  >    merge -r 2
+  merging f
+  arg: "ll:working copy"
+  arg: "lo:"
+  arg: "merge rev"
+  arg: "lb:base: $TESTTMP/hgmerge.*/f~base" (glob)
+  0 files updated, 1 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ rm -f 'printargs_merge_tool'
+
 Merge using a tool that supports labellocal, labelother, and labelbase, checking
 that they're quoted properly as well. This is using 'detailed' mergemarkers,
 even though ui.mergemarkers is 'basic', and using the tool's
@@ -1562,6 +1589,21 @@
   0 files updated, 1 files merged, 0 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
 
+Verify naming of temporary files and that extension is preserved
+(experimental.mergetempdirprefix version):
+
+  $ hg update -q -C 1
+  $ hg mv f f.txt
+  $ hg ci -qm "f.txt"
+  $ hg update -q -C 2
+  $ hg merge -y -r tip --tool echo \
+  >    --config merge-tools.echo.args='$base $local $other $output' \
+  >    --config experimental.mergetempdirprefix=$TESTTMP/hgmerge.
+  merging f and f.txt to f.txt
+  $TESTTMP/hgmerge.*/f~base $TESTTMP/f.txt.orig $TESTTMP/hgmerge.*/f~other.txt $TESTTMP/f.txt (glob)
+  0 files updated, 1 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+
 Check that debugpicktool examines which merge tool is chosen for
 specified file as expected