From: David Aguilar <davvid@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Jonathan Nieder <jrnieder@gmail.com>,
Tanguy Ortolo <tanguy+debian@ortolo.eu>,
Charles Bailey <charles@hashpling.org>,
Sebastian Schuberth <sschuberth@gmail.com>
Subject: [PATCH 4/4] mergetools/meld: Use '--output' when available
Date: Thu, 18 Aug 2011 00:23:47 -0700 [thread overview]
Message-ID: <1313652227-48545-5-git-send-email-davvid@gmail.com> (raw)
In-Reply-To: <1313652227-48545-1-git-send-email-davvid@gmail.com>
meld 1.5.0 and newer allow the output file to be specified
when merging multiple files. Check the meld version and use
the '--output' option when available.
Signed-off-by: David Aguilar <davvid@gmail.com>
---
mergetools/meld | 33 ++++++++++++++++++++++++++++++++-
1 files changed, 32 insertions(+), 1 deletions(-)
diff --git a/mergetools/meld b/mergetools/meld
index 73d70ae..1923797 100644
--- a/mergetools/meld
+++ b/mergetools/meld
@@ -4,6 +4,37 @@ diff_cmd () {
merge_cmd () {
touch "$BACKUP"
- "$merge_tool_path" "$LOCAL" "$MERGED" "$REMOTE"
+ if test "$meld_has_output_option" = true
+ then
+ "$merge_tool_path" --output "$MERGED" \
+ "$BASE" "$LOCAL" "$REMOTE"
+ else
+ "$merge_tool_path" "$LOCAL" "$MERGED" "$REMOTE"
+ fi
check_unchanged
}
+
+check_meld_version () {
+ if test -n "$meld_version_checked"
+ then
+ return
+ fi
+ # Whether 'meld --output <file>' is supported
+ meld_has_output_option=false
+
+ # Filter meld --version to contain numbers and dots only
+ meld="$(meld --version 2>/dev/null | sed -e 's/[^0-9.]\+//g')"
+ meld="${meld:-0.0.0}"
+
+ meld_major="$(expr "$meld" : '\([0-9]\{1,\}\)' || echo 0)"
+ meld_minor="$(expr "$meld" : '[0-9]\{1,\}\.\([0-9]\{1,\}\)' || echo 0)"
+
+ # 'meld --output <file>' was introduced in meld 1.5.0
+ if test "$meld_major" -gt 1 ||
+ (test "$meld_major" = 1 && test "$meld_minor" -ge 5)
+ then
+ meld_has_output_option=true
+ fi
+ meld_version_checked=true
+}
+check_meld_version
--
1.7.6.476.g57292
next prev parent reply other threads:[~2011-08-18 7:24 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-18 7:23 [PATCH 0/4] Refactor git-mergetool--lib.sh David Aguilar
2011-08-18 7:23 ` [PATCH 1/4] difftool--helper: Make style consistent with git David Aguilar
2011-08-18 7:49 ` Sebastian Schuberth
2011-08-18 9:08 ` David Aguilar
2011-08-18 17:31 ` Junio C Hamano
2011-08-18 7:23 ` [PATCH 2/4] mergetool--lib: " David Aguilar
2011-08-18 7:23 ` [PATCH 3/4] mergetool--lib: Refactor tools into separate files David Aguilar
2011-10-09 9:17 ` [PATCH da/difftool-mergtool-refactor] Makefile: fix permissions of mergetools/ checked out with permissive umask Jonathan Nieder
2011-10-09 11:43 ` Jonathan Nieder
2011-10-09 18:26 ` David Aguilar
2011-10-09 21:47 ` Jonathan Nieder
2011-10-11 0:00 ` Junio C Hamano
2011-08-18 7:23 ` David Aguilar [this message]
2011-08-18 8:13 ` [PATCH 4/4] mergetools/meld: Use '--output' when available Jonathan Nieder
2011-08-18 9:24 ` David Aguilar
2011-08-19 9:14 ` [PATCH v2 " David Aguilar
2011-08-19 22:58 ` Junio C Hamano
2011-08-18 7:57 ` [PATCH 0/4] Refactor git-mergetool--lib.sh Sebastian Schuberth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1313652227-48545-5-git-send-email-davvid@gmail.com \
--to=davvid@gmail.com \
--cc=charles@hashpling.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jrnieder@gmail.com \
--cc=sschuberth@gmail.com \
--cc=tanguy+debian@ortolo.eu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 NNTP newsgroup(s).