Mercurial 和 Word 或 PDF 文档

发布于 2024-08-25 02:22:54 字数 128 浏览 1 评论 0原文

是否可以使用 Mercurial 版本控制来跟踪 Word 或 PDF 文件? 有什么限制或问题吗?

is it possible to use Mercurial version control to track Word or PDF files?
Is there any limitation or problem?

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

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

发布评论

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

评论(4

白日梦 2024-09-01 02:22:54

是的。

能够对 MS Word 文档进行有意义的比较。

  • 如果您安装了 TortoiseHg 并且
    您已经设置了一个存储库,
    右键单击您要查找的文件
    想要检查差异。

  • 在上下文菜单中,单击 TortoiseHg >视觉差异。

  • 在“视觉差异”对话框中,选择
    docdiff,而不是 kdiff3。

  • 双击视觉中的文件
    “差异”对话框。

MS Word 将打开一个比较结果 Word 文档,该文档将显示文档当前版本与先前版本之间的差异作为“跟踪更改”。

Yes.

You will be able to do meaningful diffs for MS Word documents.

  • If you have TortoiseHg installed and
    you have set up a repository,
    right-click the file for which you
    want to check the diffs.

  • On the context menu, click TortoiseHg > Visual Diffs.

  • In the Visual Diffs dialog, select
    docdiff, instead of kdiff3.

  • Double-click the file in the Visual
    Diffs dialog.

MS Word will open a Compare Result Word document, which will show the differences between the current version of the document and the previous version as Tracked Changes.

淡笑忘祈一世凡恋 2024-09-01 02:22:54

是的,但是您当然无法以任何有意义的方式进行差异。因此,这些文件在合并期间将被视为二进制文件。

Mercurial 完全能够跟踪二进制文件:

Mercurial 通常不会
关于文件内容的假设。因此,
Mercurial 中的大部分功能都工作正常
任何类型的文件。

无论文件类型如何,Mercurial 都会存储二进制差异。 PDF/Word 文件的问题在于,对它们进行一点点更改通常会导致它们在磁盘上的二进制表示形式出现巨大差异。 .docx 文档存储为压缩的 xml,因为压缩存档内的单个翻转位可能会导致 zip 存档看起来完全不同。

如果您不将存储库增长得太大,那么使用 Mercurial 可能不会遇到任何问题。

Yes, but of course you won't be able to diff in any meaningful way. The files will therefore be treated as binary during merges.

Mercurial is perfectly capable of tracking binary files:

Mercurial generally makes no
assumptions about file contents. Thus,
most things in Mercurial work fine
with any type of file.

Mercurial stores a binary diff regardless of the file type. The problem with PDF/Word files is that a little change to them usually causes a huge difference in their binary representation on disk. .docx Documents are stored as a zipped xml, due to the zipping a single flipped bit inside the archive can cause the zip archive to look completely different.

If you don't grow your repository too large, you probably won't experience any issues using Mercurial.

放飞的风筝 2024-09-01 02:22:54

请注意,建议的

cmd.pdfdiff = [\path\to\diffpdf.exe]
opts.pdfdiff= -a $local $other

$local 和 $other 在 extdiff 上下文中没有任何意义。文字字符串“$local”和“$other”(而不是文件名)将传递给“diffpdf.exe”。我发现这很困难。

cmd.pdfdiff = [\path\to\diffpdf.exe]
opts.pdfdiff= -a

将起作用,两个文件将作为“-a”后面的参数传递。 cf https://www.mercurial-scm.org/wiki/ExtdiffExtension 其中指出:

每个自定义 diff 命令可以有两部分:“cmd”和“opts”部分。 cmd.xxx 选项定义将运行的可执行程序的名称,opts.xxx 定义一组命令行选项,这些选项将插入到程序名称和要比较的文件/目录之间的命令

Beware the suggested

cmd.pdfdiff = [\path\to\diffpdf.exe]
opts.pdfdiff= -a $local $other

$local and $other have no meaning in the extdiff context. The literal strings "$local" and "$other", not the file names, will be passed to "diffpdf.exe". I found this the hard way.

cmd.pdfdiff = [\path\to\diffpdf.exe]
opts.pdfdiff= -a

will work and the two files will be passed as parameters following the "-a". c.f. https://www.mercurial-scm.org/wiki/ExtdiffExtension where it is stated:

Each custom diff commands can have two parts: a 'cmd' and an 'opts' part. The cmd.xxx option defines the name of an executable program that will be run, and opts.xxx defines a set of command-line options which will be inserted to the command between the program name and the files/directories to diff

美男兮 2024-09-01 02:22:54

对于 Pdf 文件,我能够获得 GPL 许可 DiffPDF 连接起来,以便在修订版之间进行比较pdf 文件。

我将以下内容添加到我的 mercurial.ini 文件中:

[extdiff]
cmd.pdfdiff = [\path\to\diffpdf.exe]
opts.pdfdiff= -a $local $other

[diff-patterns]
**.pdf=pdfdiff

现在,当我单击 tortoisehg 中的 pdf 文件(或在 cmd 行使用 hg pdfdiff)时,它会打开两个用于比较的文件。由于我的 pdf 往往包含图像,因此我使用外观比较器(opts 中的-a)。如果您主要有文本,则可以使用 -w 代替。

它默认突出显示以显示差异。我更喜欢使用 Src Xor Dest 选项来显示差异,但我不认为有这样的命令行选项。

For Pdf files, I was able to get the GPL licensed DiffPDF hooked up to do comparisons between revisions of pdf files.

I added the following to my mercurial.ini file:

[extdiff]
cmd.pdfdiff = [\path\to\diffpdf.exe]
opts.pdfdiff= -a $local $other

[diff-patterns]
**.pdf=pdfdiff

Now when I click on the pdf file in tortoisehg (or use hg pdfdiff at the cmd line), it opens the two files for comparison. Since my pdf's tend to contain images, I use the appearance comparer (-a in opts). If you have mostly text, you can use -w instead.

It defaults to highlighting to show the diffs. I prefer the Src Xor Dest option for displaying the differences, but I don't think there is a cmd line option for that.

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