[PATCH 2 of 3] merge: provide *_ISLINK environment vars to merge helper

Matt Mackall mpm at selenic.com
Fri Oct 5 10:23:25 CDT 2007


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.



> 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?

-- 
Mathematics is the supreme nostalgia of our time.


More information about the Mercurial-devel mailing list