将特定二进制文件自动转换为文本以在 Mercurial 中进行比较(差异)

发布于 2024-12-09 02:43:29 字数 224 浏览 1 评论 0原文

我在 Mercurial 存储库中添加了几个小二进制文件。这些文件是我的开发工具之一的“源”文件(报告/表单/类定义)。

我制作了一个程序,将这些二进制文件转储到文本文件中,以便轻松区分它们。有没有办法告诉 Mercurial 某些文件扩展名需要在运行 diff 程序之前运行此转换?或者我必须将我的转换程序设置为主要 diff 工具并运行转换 - 或不运行 - 然后然后运行真正的 diff 程序?

I have several -small- binary files added in my Mercurial repository. The files are the "source" files of one of my development tools (report / form / class definitions).

I made a program that dumps this binary files to a text file to allow easy diffs between them. Is there any way to tell Mercurial that certain file extensions need to run this conversion before running the diff program? Or I have to set my conversion program as the main diff tool and run the conversion -or not- and then run the real diff program?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

四叶草在未来唯美盛开 2024-12-16 02:43:29

您可以(待定)使用 ExtDiff 扩展 来实现纯 Mercurial。如果

[diff-patterns]
**.ext = difftool

hgrc 中的 TortoiseHG 玩游戏

You can (TBT) use ExtDiff extension for pure Mercurial. In case of TortoiseHG

[diff-patterns]
**.ext = difftool

in hgrc plays the game

魔法少女 2024-12-16 02:43:29

我最终在 diff 程序之前得到了一个批次:

@echo off
set f1=%1
set f2=%2
::Temporary dir created by hg to copy the snapshot file
set tdir=%~dp1
::Original repository dir
set repo=%~dp2
::Filename extension
set ext=%~x1
::The binary files comes in pairs: scx/sct \ vcx/vct ...
set ex2=%ext:~0,-1%t

::Check if "dumpable" extension
echo %ext% | grep -iE "(vcx|vct|scx|sct|pjx|pjt|frx|frt)" > nul && goto DumpFile
goto diff

:DumpFile
set f1="%tdir%\_Dump1.prg"
set f2="%tdir%\_Dump2.prg"
::Get the pair file from the repository
hg cat %repo%\%~n1%ex2% -o "%~dpn1%ex2%" -R %repo%

::Do the dump, then the diff
MyDumpProgram.exe %1 %f1%
MyDumpProgram.exe %2 %f2%
goto diff

:diff
ExamDiff.exe %f1% %f2%
pause

然后在 %UserProfile%\.hgrc 中配置该批次

[extdiff]
cmd.ediff = d:\Utiles\diff2.bat

I ended up with a small batch previous to the diff program:

@echo off
set f1=%1
set f2=%2
::Temporary dir created by hg to copy the snapshot file
set tdir=%~dp1
::Original repository dir
set repo=%~dp2
::Filename extension
set ext=%~x1
::The binary files comes in pairs: scx/sct \ vcx/vct ...
set ex2=%ext:~0,-1%t

::Check if "dumpable" extension
echo %ext% | grep -iE "(vcx|vct|scx|sct|pjx|pjt|frx|frt)" > nul && goto DumpFile
goto diff

:DumpFile
set f1="%tdir%\_Dump1.prg"
set f2="%tdir%\_Dump2.prg"
::Get the pair file from the repository
hg cat %repo%\%~n1%ex2% -o "%~dpn1%ex2%" -R %repo%

::Do the dump, then the diff
MyDumpProgram.exe %1 %f1%
MyDumpProgram.exe %2 %f2%
goto diff

:diff
ExamDiff.exe %f1% %f2%
pause

and then config the batch in %UserProfile%\.hgrc

[extdiff]
cmd.ediff = d:\Utiles\diff2.bat
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文