* Re: Choosing a mergetool according to file type
[not found] <4A44A66B.10906@viscovery.net>
@ 2009-06-26 11:04 ` Gregory Jefferis
2009-06-26 11:29 ` Johannes Sixt
2009-06-26 12:04 ` Matthieu Moy
0 siblings, 2 replies; 9+ messages in thread
From: Gregory Jefferis @ 2009-06-26 11:04 UTC (permalink / raw)
To: Johannes Sixt; +Cc: git
Hi Johannes,
On 2009-06-26 11:43, "Johannes Sixt" <j.sixt@viscovery.net> wrote:
> I don't think that you can choose the merge tool by setting attributes.
OK, that was my impression, but I wanted to check.
> The reason I write to you is: Can you tell me what 'wordgitmerge' and
> 'wordgitdiff' are?
>
> I, too, have a number of Word files that I need to merge every now and then.
Ah! Well they are nothing fancy, I'm afraid, just scripts that call Word
itself, but that turns out to work pretty well. For Mac (my platform) they
have to be in applescript. For Windows I imagine they could be pretty much
the same as the scripts here:
http://tortoisesvn.tigris.org/svn/tortoisesvn/trunk/contrib/diff-scripts/
diff-doc.js
merge-doc.js
Perhaps tortoisegit already exposes this. Those scripts include fallbacks
for openoffice so I suppose one could use that on linux.
Best,
Greg.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Choosing a mergetool according to file type
2009-06-26 11:04 ` Choosing a mergetool according to file type Gregory Jefferis
@ 2009-06-26 11:29 ` Johannes Sixt
2009-06-26 12:04 ` Matthieu Moy
1 sibling, 0 replies; 9+ messages in thread
From: Johannes Sixt @ 2009-06-26 11:29 UTC (permalink / raw)
To: Gregory Jefferis; +Cc: git
Gregory Jefferis schrieb:
> http://tortoisesvn.tigris.org/svn/tortoisesvn/trunk/contrib/diff-scripts/
>
> diff-doc.js
> merge-doc.js
>
> Perhaps tortoisegit already exposes this. Those scripts include fallbacks
> for openoffice so I suppose one could use that on linux.
Thanks a lot for the pointer.
The interesting one is merge-doc.js. Unfortunately, it still only just
compares "their" and "our" versions, and the user must go through all
marked changes and reject everything that would undo "our" changes and
accept all "their" changes. That's exactly what I already do. :-(
That said, the scripts are written *much* nicer than what I have written
myself.
-- Hannes
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Choosing a mergetool according to file type
2009-06-26 11:04 ` Choosing a mergetool according to file type Gregory Jefferis
2009-06-26 11:29 ` Johannes Sixt
@ 2009-06-26 12:04 ` Matthieu Moy
2009-06-26 13:27 ` Gregory Jefferis
1 sibling, 1 reply; 9+ messages in thread
From: Matthieu Moy @ 2009-06-26 12:04 UTC (permalink / raw)
To: Gregory Jefferis; +Cc: Johannes Sixt, git
Gregory Jefferis <jefferis@gmail.com> writes:
> Hi Johannes,
>
> On 2009-06-26 11:43, "Johannes Sixt" <j.sixt@viscovery.net> wrote:
>
>> I don't think that you can choose the merge tool by setting attributes.
>
> OK, that was my impression, but I wanted to check.
Never used it, but man gitattributes says
Performing a three-way merge
merge
[...]
String
3-way merge is performed using the specified custom merge driver. The built-in 3-way merge driver can be explicitly specified by asking
for "text" driver; the built-in "take the current branch" driver can be requested with "binary".
[...]
Defining a custom merge driver
Is it not what you're looking for?
--
Matthieu
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Choosing a mergetool according to file type
2009-06-26 12:04 ` Matthieu Moy
@ 2009-06-26 13:27 ` Gregory Jefferis
2009-06-26 13:51 ` Matthieu Moy
0 siblings, 1 reply; 9+ messages in thread
From: Gregory Jefferis @ 2009-06-26 13:27 UTC (permalink / raw)
To: Matthieu Moy; +Cc: git
Hi Matthieu,
Thanks for your reply.
On 2009-06-26 13:04, "Matthieu Moy" <Matthieu.Moy@imag.fr> wrote:
> Never used it, but man gitattributes says
>
> Performing a three-way merge
> merge
> [...]
> String
> 3-way merge is performed using the specified custom merge
> driver. The built-in 3-way merge driver can be explicitly specified by asking
> for "text" driver; the built-in "take the current branch"
> driver can be requested with "binary".
> [...]
> Defining a custom merge driver
>
> Is it not what you're looking for?
This defines the merge driver but not the mergetool. A mergetool is
presumably an interactive tool that helps you clean up failed automatic
merges. For my binary files the internal merge driver "binary" will be used
which as your quote points our keeps the local file and signals a conflict
if it is different from the remote file. I cannot define a custom merge
driver for my binary word files because I don't have such a program (which
would have to carry out the merge in a non-interactive fashion). As
mergetool I use a script that calls Word and that of course has to be
interactive.
Best,
Greg.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Choosing a mergetool according to file type
2009-06-26 13:27 ` Gregory Jefferis
@ 2009-06-26 13:51 ` Matthieu Moy
2009-06-26 16:57 ` Junio C Hamano
2009-06-26 17:03 ` Gregory Jefferis
0 siblings, 2 replies; 9+ messages in thread
From: Matthieu Moy @ 2009-06-26 13:51 UTC (permalink / raw)
To: Gregory Jefferis; +Cc: git
Gregory Jefferis <jefferis@gmail.com> writes:
> This defines the merge driver but not the mergetool. A mergetool is
> presumably an interactive tool that helps you clean up failed automatic
> merges.
This is why I quoted the title of the section
>> Defining a custom merge driver
Just tried it with
[merge "filfre"]
name = feel-free merge driver
driver = gedit %O %A %B
recursive = binary
It did launch gedit interactively during the merge.
--
Matthieu
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Choosing a mergetool according to file type
2009-06-26 13:51 ` Matthieu Moy
@ 2009-06-26 16:57 ` Junio C Hamano
2009-06-26 17:43 ` Gregory Jefferis
2009-06-26 17:03 ` Gregory Jefferis
1 sibling, 1 reply; 9+ messages in thread
From: Junio C Hamano @ 2009-06-26 16:57 UTC (permalink / raw)
To: Matthieu Moy; +Cc: Gregory Jefferis, David Aguilar, git
Matthieu Moy <Matthieu.Moy@imag.fr> writes:
> Gregory Jefferis <jefferis@gmail.com> writes:
>
>> This defines the merge driver but not the mergetool. A mergetool is
>> presumably an interactive tool that helps you clean up failed automatic
>> merges.
>
> This is why I quoted the title of the section
>
>>> Defining a custom merge driver
>
> Just tried it with
>
> [merge "filfre"]
> name = feel-free merge driver
> driver = gedit %O %A %B
> recursive = binary
>
> It did launch gedit interactively during the merge.
You are both correct. Your example runs "gedit" with three files before
merge. If Gregory's custom mergetool expects the failed half-merge result
as its input, this is not the interface he is looking for.
It shouldn't be hard to teach mergetool/difftool wrapper to support the
per-path tool selection by running "git check-attr".
Right now it uses "diff.tool" and "merge.tool" configuration variables.
In addition, it can arrange to consult "mergetool.$type.diff" and
"mergetool.$type.merge". These new two variables will override the
existing ones that are now treated as type-agnostic default.
IOW, something like this.
(1) In .gitattributes, define files whose name end with js is of type
gjefferis in the mergetool namespace:
*.js mergetool=gjefferis
(2) In .git/config, define that gjefferis type is handled by diff-doc.js
and merge-doc.js
[mergetool "gjefferis"]
diff = diff-doc.js
merge = merge-doc.js
(3) Enhance get_configured_merge_tool() in git-mergetool--lib.sh and
callchain that leads to it.
type=$(git checkattr mergetool -- $file)
if test -n "$type"
then
mergetool=$(git config mergetool.$type.merge)
difftool=$(git config mergetool.$type.diff)
else
mergetool=$(git config merge.tool)
difftool=$(git config diff.tool)
fi
It appears that right now the function does not know what file it is
dealing with, so you may need to first restructure the callchain a bit,
but it shouldn't be too painful.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Choosing a mergetool according to file type
2009-06-26 13:51 ` Matthieu Moy
2009-06-26 16:57 ` Junio C Hamano
@ 2009-06-26 17:03 ` Gregory Jefferis
1 sibling, 0 replies; 9+ messages in thread
From: Gregory Jefferis @ 2009-06-26 17:03 UTC (permalink / raw)
To: Matthieu Moy; +Cc: git
Hi Matthieu,
On 2009-06-26 14:51, "Matthieu Moy" <Matthieu.Moy@imag.fr> wrote:
> Gregory Jefferis <jefferis@gmail.com> writes:
>
>> This defines the merge driver but not the mergetool. A mergetool is
>> presumably an interactive tool that helps you clean up failed automatic
>> merges.
>
> This is why I quoted the title of the section
>
>>> Defining a custom merge driver
>
> Just tried it with
>
> [merge "filfre"]
> name = feel-free merge driver
> driver = gedit %O %A %B
> recursive = binary
>
> It did launch gedit interactively during the merge.
Hmm, I had of course looked at this but this thought that it wouldn't do
what I want. For one, I thought this would _always_ call gedit even if the
file is unchanged in remote. Testing, however this doesn't seem to be the
case. So I think you're right that this method can be used satisfactorily
even with an interactive merge and I have made a little script that seems to
do what I need.
On the other hand to me it does somewhat violate the separation between
automatic and interactive merging and one probably has to be quite careful
about what state the merge files are left in - presumably things that
whoever wrote the builtin "binary" merge thought about carefully.
All the best,
Greg.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Choosing a mergetool according to file type
2009-06-26 16:57 ` Junio C Hamano
@ 2009-06-26 17:43 ` Gregory Jefferis
0 siblings, 0 replies; 9+ messages in thread
From: Gregory Jefferis @ 2009-06-26 17:43 UTC (permalink / raw)
To: Junio C Hamano, Matthieu Moy; +Cc: David Aguilar, git
On 2009-06-26 17:57, "Junio C Hamano" <gitster@pobox.com> wrote:
> You are both correct. Your example runs "gedit" with three files before
> merge. If Gregory's custom mergetool expects the failed half-merge result
> as its input, this is not the interface he is looking for.
I think that Matthieu is more correct this time in that I can do what I need
with the merge driver because I don't need the failed half-merge result.
But I prefer the 2 level arrangement of 1) automatic then 2) fixing merge
conflicts manually since there will be other cases where this is required.
Thank you Junio for pointing out how to do add the necessary functionality -
a project for a rainy weekend I guess.
Best,
Greg.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Choosing a mergetool according to file type
@ 2009-06-26 10:28 Gregory Jefferis
0 siblings, 0 replies; 9+ messages in thread
From: Gregory Jefferis @ 2009-06-26 10:28 UTC (permalink / raw)
To: git
Dear all,
Is there a way to specify which mergetool is called for different files in a
repository in the same way that one can specify a diff tool using
.gitattributes? I would like to use a custom mergetool for certain binary
file types (MS Word dare I say it) but stick with my standard tool
(FileMerge.app) for regular files.
I have set up custom mergetool and diff commands in .git/config:
[mergetool "wordmergetool"]
path = /Users/jefferis/bin/
cmd = wordgitmerge "$PWD/$REMOTE" "$PWD/$BASE" "$PWD/$LOCAL"
"$PWD/$MERGED"
[diff "wordgitdiff"]
command = wordgitdiff
# adding the following to gitattributes handles the diff case
*.doc diff=wordgitdiff
# but of course this doesn't alter the mergetool that is called.
*.doc mergetool= wordmergetool
Many thanks for any suggestions,
Greg.
git version 1.6.3.2.202.g26c11
MacOS X 10.5.7
--
Gregory Jefferis, PhD
Division of Neurobiology
MRC Laboratory of Molecular Biology,
Hills Road,
Cambridge, CB2 0QH, UK.
http://www2.mrc-lmb.cam.ac.uk/NB/jefferis_g
http://www.neuroscience.cam.ac.uk/directory/profile.php?gsxej2
http://flybrain.stanford.edu
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2009-06-26 17:43 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <4A44A66B.10906@viscovery.net>
2009-06-26 11:04 ` Choosing a mergetool according to file type Gregory Jefferis
2009-06-26 11:29 ` Johannes Sixt
2009-06-26 12:04 ` Matthieu Moy
2009-06-26 13:27 ` Gregory Jefferis
2009-06-26 13:51 ` Matthieu Moy
2009-06-26 16:57 ` Junio C Hamano
2009-06-26 17:43 ` Gregory Jefferis
2009-06-26 17:03 ` Gregory Jefferis
2009-06-26 10:28 Gregory Jefferis
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.