[PATCH 2 of 3] merge: provide *_ISLINK environment vars to merge helper
Patrick Mézard
pmezard at gmail.com
Fri Oct 5 15:58:50 UTC 2007
Matt Mackall a écrit :
> On Fri, Oct 05, 2007 at 12:55:43AM +0200, Patrick Mezard wrote:
>> # HG changeset patch
>> # User Patrick Mezard <pmezard at gmail.com>
>> # Date 1191445776 -7200
>> # Node ID 51655b6b134e2bb19ba75e65e6bdc82108a563bb
>> # Parent 1f29a31ea5ba0aab660c18e5678942e82d462be6
>> merge: provide *_ISLINK environment vars to merge helper
>>
>> Sets HG_MY_ISLINK, HG_OTHER_ISLINK, HG_BASE_ISLINK in environment. Without these variables, it's impossible for the merge application to know whether the 'other' and 'base' files were symlinks in their original contexts. For the purposes of the merge they are always emitted as small text files.
>
> If they have a filename and a revision id, it certainly is possible to
> know: just ask hg.
By calling "hg manifest -r rev", then parsing the output ?
I am not fond of this solution. Our current attitude toward merging is
"roll your own hgmerge and do whatever you want". I feel that if we
delegate the merge, we must help implementers. Maybe, these environment
variables are not the right way to do that, but asking people to spawn a
couple of subprocesses and parse their output is not especially
appealing. Besides, the existence of such variables may make people
aware of symlink issues.
>> diff --git a/mercurial/merge.py b/mercurial/merge.py
>> --- a/mercurial/merge.py
>> +++ b/mercurial/merge.py
>> @@ -17,6 +17,8 @@ def filemerge(repo, fw, fd, fo, wctx, mc
>> fo = filename in other parent
>> wctx, mctx = working and merge changecontexts
>> """
>> + def islink(fctx):
>> + return 'l' in fctx.fileflags()
>
> Perhaps filectx objects should have islink and isexec methods?
Ok.
--
Patrick Mézard
More information about the Mercurial-devel
mailing list