与另一个路径/修订版的差异事务树 [英] Diff transaction tree against another path/revision

查看:30
本文介绍了与另一个路径/修订版的差异事务树的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在预提交脚本中,如何获取已提交更改与同一存储库中任意路径/修订版的差异?

In a pre-commit script, how can I get a diff of the committed changes against an arbitrary path/revision within the same repository?

例如,当提交对 /trunk 中的文件的更改时,我想获得提交的 /trunk(尚未修订)的差异,比如说,/branches/feature_x(它是 /trunk 的一个分支).

For example, when changes to files within /trunk are commited, I would like to get a diff of the committed /trunk (not yet a revision) against, say, /branches/feature_x (which is a branch of /trunk).

据我所知,svnlook diff 仅显示该事务提出的更改,而 svn diff 仅适用于修订而不适用于事务.

As far as I can tell, svnlook diff only shows changes proposed by that transaction, while svn diff only works with revisions and not transactions.

一种蛮力方法是为每个被修改的文件区分svnlook cat ..."和svn cat PATH:REV"的输出.但是,这似乎效率很低,而且我不希望在钩子脚本中使用这种方法.

A brute force way approach would be to diff the output of "svnlook cat ..." and "svn cat PATH:REV" for every file that was modified. However, that seems rather inefficient and not something I'd like to have in a hook script.

我正在尝试创建一个预提交脚本,该脚本拒绝对某些目录的所有提交,并仅允许通过分支重新集成进行更改(相关帖子:在预提交脚本中检测分支重新集成或合并).

I'm trying to create a pre-commit script which rejects all commits to certain directories and allow changes only through branch reintegrations (related post: Detecting branch reintegration or merge in pre-commit script).

到目前为止,似乎可以通过检查基本目录的 svn:mergeinfo 属性来检测 svn merge 的使用.但是,无法区分合并应用的文件修改和手动修改的文件,因此不会检测到合并后的编辑.

So far, it seems possible to detect the use of svn merge by inspecting the svn:mergeinfo properties of the base directory. However, it is not possible to differentiate between file modifications applied by the merge and those made manually, and so post-merge edits will go undetected.

我希望能够将提交的事务树与合并源进行比较,以确保没有进行额外的更改.(根据我们的项目政策,所有冲突解决都在重新集成之前在功能分支中完成,因此在 merge --reintegrate/trunk 之后不需要任何更改).

I would like to be able to compare the committed transaction tree against the source of the merge to ensure that no extra changes were made. (As per our project policy, all conflict resolution are done in the feature branch before reintegration so no changes are required after a merge --reintegrate into /trunk).

推荐答案

区分svnlook cat ..."和svn cat PATH:REV"的输出

diff the output of "svnlook cat ..." and "svn cat PATH:REV"

OS-diff 只能接受来自标准输入的一个文件,您不能同时替换两者

OS-diff can accept only one FILE from stdin, you can't substitute both

肮脏的想法,而不是解决方案

Dirty idea, not solution

  • 您可以尝试将事务中的 pre-commit hook 提交文件放入额外的(与主无关的)存储库和第二个存储库的 post-commit hook 中的 diff-files,这将返回所需的结果以调用 repo 中的 pre-commit hook(有为这个repo预先制作本地repo和WC,将事务中的文件保存到WC中,添加/如果需要/,提交)

这篇关于与另一个路径/修订版的差异事务树的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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