git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH v2] mergetools/diffmerge: support DiffMerge as a git mergetool
@ 2013-10-12  5:01 Stefan Saasen
  2013-10-12 19:55 ` David Aguilar
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Saasen @ 2013-10-12  5:01 UTC (permalink / raw)
  To: gitster; +Cc: git, Stefan Saasen

DiffMerge is a non-free (but gratis) tool that supports OS X, Windows and Linux.

    See http://www.sourcegear.com/diffmerge/

DiffMerge includes a script `/usr/bin/diffmerge` that can be used to launch the
graphical compare tool.

This change adds mergetool support for DiffMerge and adds 'diffmerge' as an
option to the mergetool help.

Signed-off-by: Stefan Saasen <ssaasen@atlassian.com>
Acked-by: David Aguilar <davvid@gmail.com>
---
 contrib/completion/git-completion.bash |  2 +-
 git-mergetool--lib.sh                  |  3 ++-
 mergetools/diffmerge                   | 15 +++++++++++++++
 3 files changed, 18 insertions(+), 2 deletions(-)
 create mode 100644 mergetools/diffmerge

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index e1b7313..07b0ba5 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1188,7 +1188,7 @@ _git_diff ()
 	__git_complete_revlist_file
 }
 
-__git_mergetools_common="diffuse ecmerge emerge kdiff3 meld opendiff
+__git_mergetools_common="diffuse diffmerge ecmerge emerge kdiff3 meld opendiff
 			tkdiff vimdiff gvimdiff xxdiff araxis p4merge bc3 codecompare
 "
 
diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh
index feee6a4..0fcb253 100644
--- a/git-mergetool--lib.sh
+++ b/git-mergetool--lib.sh
@@ -250,7 +250,8 @@ list_merge_tool_candidates () {
 		else
 			tools="opendiff kdiff3 tkdiff xxdiff meld $tools"
 		fi
-		tools="$tools gvimdiff diffuse ecmerge p4merge araxis bc3 codecompare"
+		tools="$tools gvimdiff diffuse diffmerge ecmerge "
+		tools+="p4merge araxis bc3 codecompare"
 	fi
 	case "${VISUAL:-$EDITOR}" in
 	*vim*)
diff --git a/mergetools/diffmerge b/mergetools/diffmerge
new file mode 100644
index 0000000..85ac720
--- /dev/null
+++ b/mergetools/diffmerge
@@ -0,0 +1,15 @@
+diff_cmd () {
+	"$merge_tool_path" "$LOCAL" "$REMOTE" >/dev/null 2>&1
+}
+
+merge_cmd () {
+	if $base_present
+	then
+		"$merge_tool_path" --merge --result="$MERGED" \
+			"$LOCAL" "$BASE" "$REMOTE"
+	else
+		"$merge_tool_path" --merge \
+			--result="$MERGED" "$LOCAL" "$REMOTE"
+	fi
+	status=$?
+}
-- 
1.8.2.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] mergetools/diffmerge: support DiffMerge as a git mergetool
  2013-10-12  5:01 [PATCH v2] mergetools/diffmerge: support DiffMerge as a git mergetool Stefan Saasen
@ 2013-10-12 19:55 ` David Aguilar
  2013-10-12 22:27   ` Stefan Saasen
  0 siblings, 1 reply; 3+ messages in thread
From: David Aguilar @ 2013-10-12 19:55 UTC (permalink / raw)
  To: Stefan Saasen; +Cc: Junio C Hamano, Git Mailing List

Thanks for the re-roll.  We're very close; see below.

On Fri, Oct 11, 2013 at 10:01 PM, Stefan Saasen <ssaasen@atlassian.com> wrote:
> DiffMerge is a non-free (but gratis) tool that supports OS X, Windows and Linux.
>
>     See http://www.sourcegear.com/diffmerge/
>
> DiffMerge includes a script `/usr/bin/diffmerge` that can be used to launch the
> graphical compare tool.
>
> This change adds mergetool support for DiffMerge and adds 'diffmerge' as an
> option to the mergetool help.
>
> Signed-off-by: Stefan Saasen <ssaasen@atlassian.com>
> Acked-by: David Aguilar <davvid@gmail.com>
> ---
>  contrib/completion/git-completion.bash |  2 +-
>  git-mergetool--lib.sh                  |  3 ++-
>  mergetools/diffmerge                   | 15 +++++++++++++++
>  3 files changed, 18 insertions(+), 2 deletions(-)
>  create mode 100644 mergetools/diffmerge
>
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index e1b7313..07b0ba5 100644
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -1188,7 +1188,7 @@ _git_diff ()
>         __git_complete_revlist_file
>  }
>
> -__git_mergetools_common="diffuse ecmerge emerge kdiff3 meld opendiff
> +__git_mergetools_common="diffuse diffmerge ecmerge emerge kdiff3 meld opendiff
>                         tkdiff vimdiff gvimdiff xxdiff araxis p4merge bc3 codecompare
>  "
>
> diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh
> index feee6a4..0fcb253 100644
> --- a/git-mergetool--lib.sh
> +++ b/git-mergetool--lib.sh
> @@ -250,7 +250,8 @@ list_merge_tool_candidates () {
>                 else
>                         tools="opendiff kdiff3 tkdiff xxdiff meld $tools"
>                 fi
> -               tools="$tools gvimdiff diffuse ecmerge p4merge araxis bc3 codecompare"
> +               tools="$tools gvimdiff diffuse diffmerge ecmerge "
> +               tools+="p4merge araxis bc3 codecompare"

I don't believe "+=" is portable across all POSIX shells.

I tried this on "dash" (which is the default /bin/sh on Debian) and it
was not understood there.

$ f="1 2 3"
$ f+=" 4"
/bin/dash: 2: f+= 4: not found

I think we should stick to the tools="$tools ....." style of concatenation.

Everything else looks good to me.

Thanks,
-- 
David

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] mergetools/diffmerge: support DiffMerge as a git mergetool
  2013-10-12 19:55 ` David Aguilar
@ 2013-10-12 22:27   ` Stefan Saasen
  0 siblings, 0 replies; 3+ messages in thread
From: Stefan Saasen @ 2013-10-12 22:27 UTC (permalink / raw)
  To: David Aguilar; +Cc: Junio C Hamano, Git Mailing List

Not a problem. I'll change it to:

tools="$tools gvimdiff diffuse diffmerge ecmerge"
tools="$tools p4merge araxis bc3 code compare"

and send a v3. Thanks for the review David.


On 13 October 2013 06:55, David Aguilar <davvid@gmail.com> wrote:
> Thanks for the re-roll.  We're very close; see below.
>
> On Fri, Oct 11, 2013 at 10:01 PM, Stefan Saasen <ssaasen@atlassian.com> wrote:
>> DiffMerge is a non-free (but gratis) tool that supports OS X, Windows and Linux.
>>
>>     See http://www.sourcegear.com/diffmerge/
>>
>> DiffMerge includes a script `/usr/bin/diffmerge` that can be used to launch the
>> graphical compare tool.
>>
>> This change adds mergetool support for DiffMerge and adds 'diffmerge' as an
>> option to the mergetool help.
>>
>> Signed-off-by: Stefan Saasen <ssaasen@atlassian.com>
>> Acked-by: David Aguilar <davvid@gmail.com>
>> ---
>>  contrib/completion/git-completion.bash |  2 +-
>>  git-mergetool--lib.sh                  |  3 ++-
>>  mergetools/diffmerge                   | 15 +++++++++++++++
>>  3 files changed, 18 insertions(+), 2 deletions(-)
>>  create mode 100644 mergetools/diffmerge
>>
>> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
>> index e1b7313..07b0ba5 100644
>> --- a/contrib/completion/git-completion.bash
>> +++ b/contrib/completion/git-completion.bash
>> @@ -1188,7 +1188,7 @@ _git_diff ()
>>         __git_complete_revlist_file
>>  }
>>
>> -__git_mergetools_common="diffuse ecmerge emerge kdiff3 meld opendiff
>> +__git_mergetools_common="diffuse diffmerge ecmerge emerge kdiff3 meld opendiff
>>                         tkdiff vimdiff gvimdiff xxdiff araxis p4merge bc3 codecompare
>>  "
>>
>> diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh
>> index feee6a4..0fcb253 100644
>> --- a/git-mergetool--lib.sh
>> +++ b/git-mergetool--lib.sh
>> @@ -250,7 +250,8 @@ list_merge_tool_candidates () {
>>                 else
>>                         tools="opendiff kdiff3 tkdiff xxdiff meld $tools"
>>                 fi
>> -               tools="$tools gvimdiff diffuse ecmerge p4merge araxis bc3 codecompare"
>> +               tools="$tools gvimdiff diffuse diffmerge ecmerge "
>> +               tools+="p4merge araxis bc3 codecompare"
>
> I don't believe "+=" is portable across all POSIX shells.
>
> I tried this on "dash" (which is the default /bin/sh on Debian) and it
> was not understood there.
>
> $ f="1 2 3"
> $ f+=" 4"
> /bin/dash: 2: f+= 4: not found
>
> I think we should stick to the tools="$tools ....." style of concatenation.
>
> Everything else looks good to me.
>
> Thanks,
> --
> David

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-10-12 22:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-12  5:01 [PATCH v2] mergetools/diffmerge: support DiffMerge as a git mergetool Stefan Saasen
2013-10-12 19:55 ` David Aguilar
2013-10-12 22:27   ` Stefan Saasen

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).