summaryrefslogtreecommitdiff
path: root/mergetools
AgeCommit message (Collapse)AuthorFilesLines
2013-03-13mergetools/p4merge: create a base if none availableLibravatar Kevin Bracey1-1/+5
Originally, with no base, Git gave P4Merge $LOCAL as a dummy base: p4merge "$LOCAL" "$LOCAL" "$REMOTE" "$MERGED" Commit 0a0ec7bd changed this to: p4merge "empty file" "$LOCAL" "$REMOTE" "$MERGED" to avoid the problem of being unable to save in some circumstances with similar inputs. Unfortunately this approach produces much worse results on differing inputs. P4Merge really regards the blank file as the base, and once you have just a couple of differences between the two branches you end up with one a massive full-file conflict. The 3-way diff is not readable, and you have to invoke "difftool MERGE_HEAD HEAD" manually to get a useful view. The original approach appears to have invoked special 2-way merge behaviour in P4Merge that occurs only if the base filename is "" or equal to the left input. You get a good visual comparison, and it does not auto-resolve differences. (Normally if one branch matched the base, it would autoresolve to the other branch). But there appears to be no way of getting this 2-way behaviour and being able to reliably save. Having base==left appears to be triggering other assumptions. There are tricks the user can use to force the save icon on, but it's not intuitive. So we now follow a suggestion given in the original patch's discussion: generate a virtual base, consisting of the lines common to the two branches. This is the same as the technique used in resolve and octopus merges, so we relocate that code to a shared function. Note that if there are no differences at the same location, this technique can lead to automatic resolution without conflict, combining everything from the 2 files. As with the other merges using this technique, we assume the user will inspect the result before saving. Signed-off-by: Kevin Bracey <kevin@bracey.fi> Reviewed-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-03-13mergetools/p4merge: swap LOCAL and REMOTELibravatar Kevin Bracey1-1/+1
Reverse LOCAL and REMOTE when invoking P4Merge as a mergetool, so that the incoming branch is now in the left-hand, blue triangle pane, and the current branch is in the right-hand, green circle pane. This change makes use of P4Merge consistent with its built-in help, its reference documentation, and Perforce itself. But most importantly, it makes merge results clearer. P4Merge is not totally symmetrical between left and right; despite changing a few text labels from "theirs/ours" to "left/right" when invoked manually, it still retains its original Perforce "theirs/ours" viewpoint. Most obviously, in the result pane P4Merge shows changes that are common to both branches in green. This is on the basis of the current branch being green, as it is when invoked from Perforce; it means that lines in the result are blue if and only if they are being changed by the merge, making the resulting diff clearer. Note that P4Merge now shows "ours" on the right for both diff and merge, unlike other diff/mergetools, which always have REMOTE on the right. But observe that REMOTE is the working tree (ie "ours") for a diff, while it's another branch (ie "theirs") for a merge. Ours and theirs are reversed for a rebase - see "git help rebase". However, this does produce the desired "show the results of this commit" effect in P4Merge - changes that remain in the rebased commit (in your branch, but not in the new base) appear in blue; changes that do not appear in the rebased commit (from the new base, or common to both) are in green. If Perforce had rebase, they'd probably not swap ours/theirs, but make P4Merge show common changes in blue, picking out our changes in green. We can't do that, so this is next best. Signed-off-by: Kevin Bracey <kevin@bracey.fi> Reviewed-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-02-14Merge branch 'da/p4merge-mktemp-fix'Libravatar Junio C Hamano1-1/+1
* da/p4merge-mktemp-fix: p4merge: fix printf usage
2013-02-10p4merge: fix printf usageLibravatar David Aguilar1-1/+1
Do not use a random string as if it is a format string for printf when showing it literally; instead feed it to '%s' format. Reported-by: Asheesh Laroia <asheesh@asheesh.org> Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-02-07Merge branch 'ss/mergetools-tortoise'Libravatar Junio C Hamano1-4/+21
Update mergetools to work better with newer merge helper tortoise ships. * ss/mergetools-tortoise: mergetools: teach tortoisemerge to handle filenames with SP correctly mergetools: support TortoiseGitMerge
2013-02-07Merge branch 'jk/mergetool'Libravatar Junio C Hamano5-32/+5
Cleans up mergetool/difftool combo. * jk/mergetool: mergetools: simplify how we handle "vim" and "defaults" mergetool--lib: don't call "exit" in setup_tool mergetool--lib: improve show_tool_help() output mergetools/vim: remove redundant diff command git-difftool: use git-mergetool--lib for "--tool-help" git-mergetool: don't hardcode 'mergetool' in show_tool_help git-mergetool: remove redundant assignment git-mergetool: move show_tool_help to mergetool--lib
2013-02-01mergetools: teach tortoisemerge to handle filenames with SP correctlyLibravatar Sven Strickroth1-3/+11
TortoiseGitMerge, unlike TortoiseMerge, can be told to handle paths with spaces in them by using -option "$FILE" (not -option:"$FILE", which does not work for such paths) syntax. This change was necessary because of MSYS path mangling [1], the ":" after the "base" etc. arguments to TortoiseMerge caused the whole argument instead of just the file name to be quoted in case of file names with spaces. So TortoiseMerge was passed "-base:new file.txt" instead of -base:"new file.txt" (including the quotes). To work around this, TortoiseGitMerge does not require the ":" after the arguments anymore which fixes handling file names with spaces [2] (as written above). [1] http://www.mingw.org/wiki/Posix_path_conversion [2] https://github.com/msysgit/msysgit/issues/57 Signed-off-by: Sven Strickroth <email@cs-ware.de> Reported-by: Sebastian Schuberth <sschuberth@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-28mergetools: simplify how we handle "vim" and "defaults"Libravatar David Aguilar5-22/+3
Remove the exceptions for "vim" and "defaults" in the mergetool library so that every filename in mergetools/ matches 1:1 with the name of a valid built-in tool. Define the trivial fallback definition of shell functions in-line in git-mergetool-lib script, instead of dot-sourcing them from another file. The result is much easier to follow. [jc: squashed in an update from John Keeping as well] Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-27mergetools/vim: remove redundant diff commandLibravatar David Aguilar1-10/+2
vimdiff and vimdiff2 differ only by their merge command so remove the logic in the diff command since it's not actually needed. Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-26mergetools: support TortoiseGitMergeLibravatar Sven Strickroth1-1/+10
TortoiseMerge.exe was ben renamed to TortoiseGitMerge.exe (starting with 1.8.0) in order to make it clear that it has special support for git, and prevent confusion with the TortoiseSVN TortoiseMerge version. Signed-off-by: Sven Strickroth <email@cs-ware.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-12-26mergetools/p4merge: Honor $TMPDIR for the /dev/null placeholderLibravatar David Aguilar1-14/+13
Use $TMPDIR when creating the /dev/null placeholder for p4merge. This prevents users from finding a seemingly random untracked file in their worktree. This is different than what mergetool does with $LOCAL and $REMOTE because those files exist to aid users when resolving merges. p4merge's /dev/null placeholder is not helpful in that situation so it is sensible to keep it out of the worktree. Reported-by: Jeremy Morton <admin@game-point.net> Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-10-25Merge branch 'da/mergetools-p4'Libravatar Jeff King1-0/+25
* da/mergetools-p4: mergetools/p4merge: Handle "/dev/null"
2012-10-11mergetools/p4merge: Handle "/dev/null"Libravatar David Aguilar1-0/+25
p4merge does not properly handle the case where "/dev/null" is passed as a filename. Work it around by creating a temporary file for this purpose. Reported-by: Jeremy Morton <admin@game-point.net> Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com> --- Needs to be amended with Tested-by when a report comes...
2012-10-01Merge branch 'da/mergetool-custom'Libravatar Junio C Hamano1-26/+2
The actual external command to run for mergetool backend can be specified with difftool/mergetool.$name.cmd configuration variables, but this mechanism was ignored for the backends we natively support. * da/mergetool-custom: mergetool--lib: Allow custom commands to override built-ins
2012-09-25mergetool--lib: Allow custom commands to override built-insLibravatar David Aguilar1-26/+2
Allow users to override the default commands provided by the mergetools/* scriptlets. Users occasionally run into problems where they expect to be able to override the built-in tool names. The documentation does not explicitly mention that built-ins cannot be overridden, so it's easy to assume that it should work. Lift this restriction so that built-in tools are handled the same way as user-configured tools. Add tests to guarantee this behavior. A nice benefit of this change is that it protects users from having future versions of git trump their custom configuration with a new built-in tool. C.f.: http://stackoverflow.com/questions/7435002/mergetool-from-gitconfig-being-ignored http://thread.gmane.org/gmane.comp.version-control.msysgit/13188 http://thread.gmane.org/gmane.comp.version-control.git/148267 Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-08-10Add Code Compare v2.80.4 as a merge / diff tool for WindowsLibravatar Sebastian Schuberth1-0/+25
Code Compare is a commercial file comparison tool for Windows, see http://www.devart.com/codecompare/ Version 2.80.4 added support for command line arguments preceded by a dash instead of a slash. This is required for Git for Windows because slashes in command line arguments get mangled with according to these rules: http://www.mingw.org/wiki/Posix_path_conversion Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-03-05mergetools: add a plug-in to support DeltaWalkerLibravatar Tim Henigan1-0/+21
DeltaWalker is a non-free tool popular among some users. Add a plug-in to support it from difftool and mergetool. Note that the $(pwd)/ in front of $MERGED should not be necessary. However without it, DeltaWalker crashes with a JRE exception. Signed-off-by: Tim Henigan <tim.henigan@gmail.com> Helped-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-02-14Merge branch 'jn/ancient-meld-support'Libravatar Junio C Hamano1-1/+1
* jn/ancient-meld-support: mergetools/meld: Use --help output to detect --output support
2012-02-10mergetools/meld: Use --help output to detect --output supportLibravatar Jonathan Nieder1-1/+1
In v1.7.7-rc0~3^2 (2011-08-19), git mergetool's "meld" support learned to use the --output option when calling versions of meld that are detected to support it (1.5.0 and newer, hopefully). Alas, it misdetects old versions (before 1.1.5, 2006-06-11) of meld as supporting the option, so on systems with such meld, instead of getting a nice merge helper, the operator gets a dialog box with the text "Wrong number of arguments (Got 5)". (Version 1.1.5 is when meld switched to using optparse. One consequence of that change was that errors in usage are detected and signalled through the exit status even when --help was passed.) Luckily there is a simpler check that is more reliable: the usage string printed by "meld --help" reliably reflects whether --output is supported in a given version. Use it. Reported-by: Jeff Epler <jepler@unpythonic.net> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-15mergetools: use the correct tool for Beyond Compare 3 on WindowsLibravatar Pat Thoyts1-1/+6
On Windows the bcompare tool launches a graphical program and does not wait for it to terminate. A separate 'bcomp' tool is provided which will wait for the view to exit so we use this instead. Reported-by: Werner BEROUX <werner@beroux.com> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-19mergetools/meld: Use '--output' when availableLibravatar David Aguilar1-1/+24
meld 1.5.0 and newer allow the output file to be specified when merging multiple files. Check whether the meld command supports '--output' and use it when available. Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-19mergetool--lib: Refactor tools into separate filesLibravatar David Aguilar15-0/+306
Individual merge tools are now defined in a mergetools/$tool file which is sourced at runtime. The individual files are installed into $(git --exec-path)/mergetools/. New tools can be added by creating a new file instead of editing the git-mergetool--lib.sh scriptlet. http://thread.gmane.org/gmane.comp.version-control.git/134906/focus=135006 Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>