patch on freebsd

Giorgos Keramidas keramida at ceid.upatras.gr
Wed Aug 15 14:48:33 CDT 2007


On 2007-08-15 21:12, Giorgos Keramidas <keramida at ceid.upatras.gr> wrote:
>On 2007-08-14 21:33, Brad Schick <schickb at gmail.com> wrote:
>> I have mercurial 0.9.4 installed in a local account on FreeBSD
>> 6.2-RELEASE. So far it works except for patch. Anyone know the trick for
>> making hg happy with freebsd's patch?
>>
>> When I set patch to "gpatch" in my .hgrc I get:
>>
>> $ hg debuginstall -v
>> Checking encoding (US-ASCII)...
>> Checking extensions...
>> Checking templates...
>> Checking patch...
>> NAME
>>   gpatch - Apply a gdiff patch to a file
>
> gpatch is not really FreeBSD's patch(1).
>
>> $ hg debuginstall -v
>> Checking encoding (US-ASCII)...
>> Checking extensions...
>> Checking templates...
>> Checking patch...
>> Hmm...  Looks like a unified diff to me...
>> The text leading up to this was:
>> --------------------------
>> |--- a/tmptHSSFV        None
>> |+++ b/tmptHSSFV        None
>> --------------------------
>> Patching file tmptHSSFV using Plan A...
>> Hunk #1 succeeded at 1.
>> done
>>  unexpected patch output! (you may have an incompatible version of patch)
>
> I don't have a 6.2-RELEASE installation near me, but I've been using
> hg with FreeBSD's patch in 7.0-CURRENT a long time (until the "crew"
> version of hg grew mpatch support).
>
> Can you set `patch' to a wrapper script which logs everything in a
> script file, and email me that script?

For example, a test script which can do this sort of thing is:

    #!/bin/sh

    PATH='/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin'
    export PATH

    echo "Running command: gpatch $*" > /tmp/gpatch.log
    exec /usr/local/bin/gpatch "$@" 2>&1 | tee -a /tmp/gpatch.log

If you save this as `/tmp/gpatch-wrapper.sh' and then configure Hg to
use this as its patch utility by setting in your ~/.hgrc file:

    [ui]
    patch = /tmp/gpatch-wrapper.sh

Then you will be able to run `hg debuginstall' and keep the output of
the patch utility in `/tmp/gpatch.log'.  When I run `hg debuginstall'
with gpatch-2.5.4 on FreeBSD 7.0-CURRENT here, I see something like this
in the `/tmp/gpatch.log' file:

    % cat /tmp/gpatch.log
    Running command: gpatch -d /var/tmp -p1
    patching file hg-debuginstall-QLQJZX
    %



More information about the Mercurial mailing list