Diff transaction tree against another path/revision

妖精的绣舞 提交于 2019-12-10 11:26:12

问题


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

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).

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.

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.

Background:

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).

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.

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).


回答1:


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

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

Dirty idea, not solution

  • You can try in pre-commit hook commit files in transaction into additional (unrelated to main) repository and diff-files in second repository's post-commit hook, which return needed result into calling pre-commit hook in repo one (have pre-made local repo and WC for this repo, save files in transaction into WC, add /if needed/, commit)


来源:https://stackoverflow.com/questions/8801803/diff-transaction-tree-against-another-path-revision

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!