monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Monotone-devel] Non-modal merge


From: Ralf S. Engelschall
Subject: Re: [Monotone-devel] Non-modal merge
Date: Sun, 23 Sep 2007 18:35:03 +0200
User-agent: Mutt/1.5.16 OpenPKG/CURRENT (2007-06-09)

On Sun, Sep 23, 2007, Stephen Leake wrote:

> "Ralf S. Engelschall" <address@hidden> writes:
>
> > I've now improved my "diffutils" merger implementation in std_hook.lua.
> > One now can use MTN_MERGE_DIFFUTILS=partial to get the results
> > of contrib/diff3_keep_conflicts_merger.lua. When combined with
> > "merge_into_workspace" as in...
> >
> > $ MTN_MERGE=diffutils_new MTN_MERGE_DIFFUTILS=partial mtn 
> > merge_into_workspace
> >
> > ...one now gets mostly the operation one is used from "cvs update" and
> > "svn update", i.e. a revision is merged into the workspace and conflicts
> > are marked for further manual editing before comitting.
>
> Excellent.
>
> However, --show-overlap removes the 'ancestor' information from the
> merged output; sometimes, that info is useful. So I think I prefer
> running diff3 without --show-overlap. I'll have to try it some more.

Yes, I know. But without --show-overlap the output also
includes all the non-overlapping changes and this confuses one
dramatically, too. I've not found an option combination for diff3(1)
which shows the ancestors but not the non-overlapping parts. I've tried
many combinations of --merge, -A, -E, -x and -X but have not found a
solution. As CVS also doesn't show the ancestor information, I decided
that I go this way, too.

> I'm not sure how to allow the user to specify that option; there could
> be yet another environment variable; MTN_MERGE_DIFFUTILS_OPTS.
> Probably better to just copy the code to .monotonerc and edit it.
> Although this is not immediately available as source in a binary
> installation.

Yes, such an additional environment variable would be possible.
But I've now made MTN_MERGE_DIFFUTILS more flexible: it can hold a
comma-separated list of options. Currently "partial" and "showall" are
implemented. "showall" is to pass --show-all to diff3(1) now.

> I'm not sure you should change the name to 'diffutils_new'. Perhaps
> that's left over from a development experiment?
>
> The default behavior is the same as the old (with improved messages),
> and get_preferred_merge3_command uses the name "diffutils". If anyone
> already has MTN_MERGE set to "diffutils", it will break.

Sure, this is already fixed. Was a mistake by copy & pasting the stuff
from ~/.monotone/monotonerc during development to std_hooks.lua for
committing.

> 'partial' depends on 'sh', which may not be available on Windows, so
> 'available' should check for it. Hmm. non-partial diff3utils doesn't
> depend on 'sh', so that would be overkill. I guess we need to qualify
> the check for 'sh' on MTN_MERGE_DIFFUTILS:
>
>     available = function ()
>         --  make sure the GNU diffutils tools are available
>         return program_exists_in_path("diff3") and
>                program_exists_in_path("sdiff") and
>                program_exists_in_path("diff") and
>                (os.getenv("MTN_MERGE_DIFFUTILS") ~= "partial" or
>                 program_exists_in_path("sh"));
>     end,
> [...]

I've now replaced the "sh" hack with a variant based on
execute_redirected(). This is more portable and clear, too.

                                       Ralf S. Engelschall
                                       address@hidden
                                       www.engelschall.com





reply via email to

[Prev in Thread] Current Thread [Next in Thread]