xcode FileMerge 从 SourceTree 启动后立即退出

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32729049/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 07:54:55  来源:igfitidea点击:

FileMerge quits immediately after launching from SourceTree

xcodeatlassian-sourcetreefilemerge

提问by Greg Kopff

I regularly use Atlassian SourceTree (on Mac OS X) to launch FileMerge to resolve git merge conflicts. Out of the blue it has stopped working: when I right click and select Resolve Conflicts > Launch External Merge Tool, FileMerge launches, creates its intermediate files, then immediately exits. SourceTree interprets that as the merge process being complete.

我经常使用 Atlassian SourceTree(在 Mac OS X 上)来启动 FileMerge 来解决 git 合并冲突。它Resolve Conflicts > Launch External Merge Tool突然停止工作:当我右键单击并选择 时,FileMerge 启动,创建其中间文件,然后立即退出。SourceTree 将其解释为合并过程已完成。

What's the issue and how can I debug/fix it?

有什么问题,我该如何调试/修复它?

I note that a previous question 'SourceTree filemerge quits immediately and creates 4 files. How to fix it?' does not address this particular scenario (for one, it says FileMerge quits in the title, but in the body it says FileMerge displays /dev/null as one of the panels. Additionally, my merge conflict is not due to a removed file.)

我注意到上一个问题 ' SourceTree filemerge 立即退出并创建 4 个文件。如何解决?' 没有解决这种特殊情况(例如,它在标题中说 FileMerge 退出,但在正文中说 FileMerge 将 /dev/null 显示为面板之一。此外,我的合并冲突不是由于已删除的文件造成的。 )

回答by ChrisJF

To diagnose the problem, I ran opendifffrom the Terminal. I received the following error:

为了诊断问题,我opendiff从终端运行。我收到以下错误:

xcode-select: error: tool 'opendiff' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

xcode-select:错误:工具“opendiff”需要 Xcode,但活动开发者目录“/Library/Developer/CommandLineTools”是命令行工具实例

To solve:

要解决:

  1. Open Xcode > Preferences > Locations
  2. Click on the drop-down box beside Command Line Toolsand select your current Xcode version. (This was empty for me because I had recently installed Xcode on a new Mac.)
  1. 打开Xcode > 首选项 > 位置
  2. 单击命令行工具旁边的下拉框并选择您当前的 Xcode 版本。(这对我来说是空的,因为我最近在一台新 Mac 上安装了 Xcode。)

Command Line Tools

命令行工具

  1. Run opendiffin Terminal again, and the above error should no longer appear.
  1. opendiff再次在终端中运行,应该不再出现上述错误。

Now FileMerge will open correctly from SourceTree when you click Launch External Merge Tool.

现在,当您单击Launch External Merge Tool时,FileMerge 将从 SourceTree 正确打开。

回答by Tom Kraina

For me, SourceTree didn't even launch FileMerge. When clicking Launch External Merge Toolnothing happened.

对我来说,SourceTree 甚至没有启动 FileMerge。单击启动外部合并工具时什么也没发生。

Moreover, running opendiffin Terminal worked as expected:

此外,opendiff在终端中运行按预期工作:

$ opendiff
opendiff[64176:5561154] too few arguments
opendiff[64176:5561154] usage: opendiff file1 file2 [-ancestor ancestorFile] [-merge mergeFile]

What helped me was manually configuring SourceTreeto use FileMerge via the opendiffcommand with the following arguments: $LOCAL $REMOTE -ancestor $BASE -merge $MERGED

帮助我的是通过带有以下参数的命令手动配置 SourceTree以使用FileMergeopendiff$LOCAL $REMOTE -ancestor $BASE -merge $MERGED

SourceTree manually configure to use opendiff

SourceTree 手动配置使用 opendiff

This way, SourceTree opens FileMerge as expected.

这样,SourceTree 按预期打开 FileMerge。

回答by Greg Kopff

If Xcode has recently updated itself, you may need to agree to the new license terms. If you have not agreed to the license terms, FileMerge (when launched from SourceTree) will quit immediately.

如果 Xcode 最近自行更新,您可能需要同意新的许可条款。如果您不同意许可条款,FileMerge(从 SourceTree 启动时)将立即退出。

To check for this, open a shell and run as your usual user:

要检查这一点,请打开一个 shell 并以您的普通用户身份运行:

$ opendiff

If the license is the problem, it will tell you. To agree to the new license terms, you'll need to run open diff using sudo:

如果许可证有问题,它会告诉您。要同意新的许可条款,您需要使用sudo以下命令运行 open diff :

$ sudo opendiff

After agreeing to the license terms, you can now retry launching FileMerge from SourceTree using Resolve Conflicts > Launch External Merge Tool. FileMerge should launch and behave normally.

同意许可条款后,您现在可以使用Resolve Conflicts > Launch External Merge Tool. FileMerge 应该启动并正常运行。

回答by user3027622

This helped: https://gist.github.com/kylefox/4512777

这有帮助:https: //gist.github.com/kylefox/4512777

Tell system when Xcode utilities live:

在 Xcode 实用程序上线时告诉系统:

sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

须藤 xcode-select -switch /Applications/Xcode.app/Contents/Developer

Set "opendiff" as the default mergetool globally:

将“opendiff”设置为全局默认合并工具:

git config --global merge.tool opendiff

git config --global merge.tool opendiff

回答by fabe

This also works to resolve the message "xcode-select: error: tool 'opendiff' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance":

这也适用于解决消息“xcode-select:错误:工具'opendiff'需要Xcode,但活动开发人员目录'/Library/Developer/CommandLineTools'是命令行工具实例”

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer