【问题标题】:Automatic conversion of specific binary files to text to compare (diff) in Mercurial在 Mercurial 中自动将特定二进制文件转换为要比较的文本(差异)
【发布时间】:2011-12-04 03:49:12
【问题描述】:

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

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

【问题讨论】:

    标签: mercurial diff mercurial-extension


    【解决方案1】:

    您可以 (TBT) 将 ExtDiff extension 用于纯 Mercurial。如果是 TortoiseHG

    [diff-patterns]
    **.ext = difftool
    

    在 hgrc 里玩游戏

    【讨论】:

      【解决方案2】:

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

      @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
      

      【讨论】:

        猜你喜欢
        • 2013-08-20
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-07-30
        • 1970-01-01
        相关资源
        最近更新 更多