[Updated] D12171: filemerge: put temporary files in single temp dir by default
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Tue Feb 15 17:00:25 UTC 2022
martinvonz edited the summary of this revision.
martinvonz updated this revision to Diff 32218.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D12171?vs=32181&id=32218
BRANCH
default
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D12171/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D12171
AFFECTED FILES
mercurial/configitems.py
mercurial/filemerge.py
tests/test-merge-tools.t
CHANGE DETAILS
diff --git a/tests/test-merge-tools.t b/tests/test-merge-tools.t
--- a/tests/test-merge-tools.t
+++ b/tests/test-merge-tools.t
@@ -1592,34 +1592,7 @@
arg: "ll:working copy"
arg: "lo:"
arg: "merge rev"
- arg: "lb:common ancestor: */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'
-
-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:common ancestor: */hgmerge.*/f~base" (glob)
+ arg: "lb:common ancestor: */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'
@@ -1649,7 +1622,7 @@
arg: "ll:working copy: tooltmpl ef83787e2614"
arg: "lo:"
arg: "merge rev: tooltmpl 0185f4e0cf02"
- arg: "lb:common ancestor: */f~base.*" (glob)
+ arg: "lb:common ancestor: */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'
@@ -1895,23 +1868,7 @@
$ hg update -q -C 2
$ hg merge -y -r tip --tool echo --config merge-tools.echo.args='$base $local $other $output'
merging f and f.txt to f.txt
- */f~base.* */f~local.*.txt */f~other.*.txt $TESTTMP/repo/f.txt (glob)
- 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"
- warning: commit already existed in the repository!
- $ 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/hgmerge.*/f~local.txt $TESTTMP/hgmerge.*/f~other.txt $TESTTMP/repo/f.txt (glob)
+ */hgmerge-*/f~base */hgmerge-*/f~local.txt */hgmerge-*/f~other.txt */repo/f.txt (glob)
0 files updated, 1 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -926,22 +926,15 @@
copies `localpath` to another temporary file, so an external merge tool may
use them.
"""
- tmproot = None
- tmprootprefix = repo.ui.config(b'experimental', b'mergetempdirprefix')
- if tmprootprefix:
- tmproot = pycompat.mkdtemp(prefix=tmprootprefix)
+ tmproot = pycompat.mkdtemp(prefix=b'hgmerge-')
def maketempfrompath(prefix, path):
fullbase, ext = os.path.splitext(path)
pre = b"%s~%s" % (os.path.basename(fullbase), prefix)
- if tmproot:
- name = os.path.join(tmproot, pre)
- if ext:
- name += ext
- f = open(name, "wb")
- else:
- fd, name = pycompat.mkstemp(prefix=pre + b'.', suffix=ext)
- f = os.fdopen(fd, "wb")
+ name = os.path.join(tmproot, pre)
+ if ext:
+ name += ext
+ f = open(name, "wb")
return f, name
def tempfromcontext(prefix, ctx):
@@ -967,15 +960,7 @@
try:
yield b, c, d
finally:
- if tmproot:
- shutil.rmtree(tmproot)
- else:
- util.unlink(b)
- util.unlink(c)
- # if not uselocalpath, d is the 'orig'/backup file which we
- # shouldn't delete.
- if d and uselocalpath:
- util.unlink(d)
+ shutil.rmtree(tmproot)
def filemerge(repo, wctx, mynode, orig, fcd, fco, fca, labels=None):
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -1042,11 +1042,6 @@
)
coreconfigitem(
b'experimental',
- b'mergetempdirprefix',
- default=None,
-)
-coreconfigitem(
- b'experimental',
b'mmapindexthreshold',
default=None,
)
To: martinvonz, #hg-reviewers, marmoute, Alphare
Cc: Alphare, spectral, mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20220215/cc7313bf/attachment-0002.html>
More information about the Mercurial-patches
mailing list