Mercurial/extdiff不会更改为temp dir(正如我想的那样) [英] Mercurial/extdiff not changing to temp dir (as I THINK it's supposed to)

查看:105
本文介绍了Mercurial/extdiff不会更改为temp dir(正如我想的那样)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Windows,Mercurial和extdiff扩展名(用于Mercurial).我试图设置extdiff以将WinDiff用作外部diff工具,但我认为我已将问题缩小到足以说出问题出在我未解决之前.

Using Windows, Mercurial, and the extdiff extension (for Mercurial). I was trying to set up extdiff to use WinDiff as an external diff tool, but I think I've narrowed the problem down enough to say that the trouble is before I'm even getting that far.

据我对extdiff的了解,它仅调用cmd.winmerge程序,并将必要的目录传递给它.我还根据此处概述的一些假设(可能是正确的,也可能是不正确的;我只是在学习Mercurial)进行工作:

From what I understand of extdiff, it merely calls your cmd.winmerge program, and passes the necessary directories to it. I'm also working off of some assumptions outlined here (which may or may not be accurate; I'm just learning Mercurial):

http://bitbucket.org/tortoisehg/stable/issue/457/multiple-extdiff-threads-in-one-process-causes-side#comment-36216

其中说:

The extdiff (visual diff) extension works like this:

1-Generate temporary directory(ies) for older changesets 
2-run util.system( cwd=tempdir, "yourdiff tool dir1 dir2" ) 
    util.system does: 
        2.1 store cwd; 
        2.2 cd tempdir 
3-run your diff tool, wait for it to exit 
4-cd oldcwd 
5-Then finally extdiff deletes the temp directories. 

我遇到的麻烦是,extdiff在继续之前似乎并没有切换到temp目录,因为它似乎应该在上面的步骤2.1中进行.

The trouble that I'm having is that extdiff doesn't seem to be changing into the temp directory before proceeding, as it appears it is supposed to do in step 2.1 above.

在试图找出问题时,我编写了一个批处理文件,目的只是为了查看cd是什么,正在传递的内容以及传递的准确程度.批处理文件如下:

In trying to isolate the problem, I wrote a batch file just to see what the cd was, what was being passed, and how exactly it was being passed. The batch file is as follows:

@echo off
echo %cd%
echo %1
echo %2
D:\Documents\apps\WinMergePortable\App\WinMerge\WinMergeU.exe %1 %2

然后我将extdiff设置为将此批处理文件用作extdiff程序.这可行,但是我看到当它回显%cd%时,它只是c:\,而不是预期的c:\ temp.我已经验证extdiff在适当的临时目录中创建了临时文件(如上面的步骤1所述;类似于c:\ temp \ extdiff.xxxxxx \ someFolder.someChangesetID \ file.ext),所以我知道查看这些目录.在调用WinMerge之前,只是没有正确地更改它们,因此,当WinMerge打开时,它看不到临时文件(因为它不在正确的工作目录中).

I then set up extdiff to use this batch file as my extdiff program. This works, but I see that when it echoes %cd%, it's just c:\ , not c:\temp as expected. I've verified that extdiff is creating the temporary files in the proper temporary directories (as it's supposed to per step 1 above; something like c:\temp\extdiff.xxxxxx\someFolder.someChangesetID\file.ext), so I know it's SEEING those directories. It's just not properly changing into them before it's calling WinMerge, so when WinMerge is opened, it doesn't see the temp files (since it's not in the proper working directory).

基本上,这就是我遇到的问题.我不知道从这里还能去哪里.我想到了

That's basically where I'm stuck. I don't know where else to go from here. I thought of just putting

cd %tmp%

在我的批处理文件中,但是仍然无法获取extdiff.xxxxx \子目录,而extdiff正在其中创建临时文件.

in my batch file, but that still doesn't grab the extdiff.xxxxx\ subdirectory which extdiff is creating the temp files in.

总结::-(

编辑:将批处理文件更改为

Changing the batch file to

@echo off
echo %cd%\extdiff*
echo %1
echo %2
D:\Documents\apps\WinMergePortable\App\WinMerge\WinMergeU.exe %1 %2

似乎可以使其工作(注意第二行已更改),但似乎仍然令人讨厌,而不是应该如何工作. :-\

seems to make it work (note changed second line), but it still seems a nasty hack to instead of how it's supposed to work. :-\

编辑:这是我的Mercurial.ini文件:

Here is my Mercurial.ini file:

[ui]
username = Tim Skoch <my_real@email.address>
editor = D:\Documents\apps\Notepad++\notepad++.exe -multiInst

[extensions]
hgext.graphlog = 
hgext.extdiff = 

[extdiff]
cmd.winmerge = d:\Documents\apps\mercurial\diff_winmerge.bat

推荐答案

在启动diff程序之前,我可以确认extdiff 更改为临时目录.您可以使用--debug进行查看.在这里,我使用true作为差异程序(它立即存在):

I can confirm that extdiff will change to a temporary directory before starting your diff program. You can use --debug to see this. Here I'm using true as the diff program (it just exist immediately):

$ hg extdiff -p true --debug
making snapshot of 2 files from rev 18480437f81b
  a
  b
making snapshot of 2 files from working directory
  a
  b
running "'true'  'foo.18480437f81b' 'foo'" in /tmp/extdiff.IJ9clg
cleaning up temp directory

diff程序的两个参数是目录:旧版本的快照目录,新版本的快照目录.它们在/tmp/extdiff.IJ9clg临时目录中.

The two arguments for the diff program are directories: a snapshot directory for the old versions and one for the new versions. They are inside the /tmp/extdiff.IJ9clg temporary directory.

一个令人困惑的观点是,diff程序的参数根据修改文件的数量而不同.仅需一个修改的文件,就无需创建一个 工作副本的快照.因此,如果a是唯一的修改文件,您会看到

One confusing point is that the arguments for the diff program are different depending on the number of modified files. With just one modified file, there is no need to create a snapshot of the working copy. So if a is the only modified file, you'll see

$ hg extdiff -p true --debug
making snapshot of 1 files from rev 18480437f81b
  a
running "'true'  '/tmp/extdiff.mUlnP_/foo.18480437f81b/a' '/home/mg/tmp/foo/a'"
in /tmp/extdiff.mUlnP_
cleaning up temp directory

在这里,diff程序以两个文件作为参数启动.如hg help -e extdiff中所述,您可以使用一些变量来构建命令行.默认对应于$parent $child.

Here the diff program was started with two files as arguments. As described in hg help -e extdiff, you can use some variables to build the command line. The default corresponds to $parent $child.

您说WinMerge无法正确找到文件".关于WinMerge的有关SO的其他问题和答案,他们似乎也能正常工作.也许您可以尝试使用他们的命令行选项.

You say that WinMerge "cannot find the files correctly". There are other questions and answers on SO about WinMerge and they seem to have it working just fine. Maybe you can try their command line options.

这篇关于Mercurial/extdiff不会更改为temp dir(正如我想的那样)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆