logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

Re: [PATCH] safer version of the FileMerge merge technique: msg#00325

Subject: Re: [PATCH] safer version of the FileMerge merge technique
On Tuesday, 31 January 2006 at 22:50, Radoslaw Szkodzinski wrote:
> Brendan Cully wrote:
> > On Tuesday, 31 January 2006 at 22:28, Radoslaw Szkodzinski wrote:
> >>> +# on MacOS X try FileMerge.app, shipped with Apple's developer tools
> >>> +# TODO: make proper temp files. foo.orig and foo.link are dangerous
> >>> +FILEMERGE='/Developer/Applications/Utilities/FileMerge.app/Contents/MacOS/FileMerge'
> >>> +if type "$FILEMERGE" > /dev/null 2>&1; then
> >>> +    cp "$LOCAL.orig" "$LOCAL"
> >>> +    ln "$LOCAL" "$LOCAL.link"
> >> And what if the filesystem doesn't support hardlinks?
> > 
> > I guess it's broken in that case. Is there such a filesystem for OS X?
> > (this should work over AFS, since it's in the same directory)
> > 
> 
> FAT at least. The lowest common denominator.

ah, for when you're using hg on your friend's ipod :)

> Maybe you should use cp instead? Not much loss of a performance.
> Maybe use test -nt instead of test -ef.

that was my original instinct, but mpm pointed out that there's an
issue with timestamp granularity. Probably not easy to trigger, but
possible. I guess the bulletproof way is to try ln, and if it fails,
fall back to cp. cp just means you might ask whether a merge is
successful more often than strictly necessary.

> I hope that isn't another GNU extension.

/bin/test on 10.4 supports it, and it's in the apple (BSD) man page.



<Prev in Thread] Current Thread [Next in Thread>