如何在SVN中找到两个分支的共同祖先? [英] How to find the common ancestor of two branches in SVN?

查看:39
本文介绍了如何在SVN中找到两个分支的共同祖先?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

想象一下,你有一棵很大的 SVN 树,到处都是树枝.有树干,有分支,那些分支有分支等等.那么,给定树中的两个分支,你如何找到共同的祖先?

Imagine you've got a big SVN tree with branches all over the place. There is the trunk, there are branches, those branches have branches, etc. So, given two branches in the tree, how can you find the common ancestor?

我知道您可以简单地获取完整日志并进行比较,但是如果您的主干有 75,000 次修订(并且大部分时间您确实将主干与另一个可能很远的分支进行比较),那么它会变得有点慢.

I know that you could simply take the full log and compare it, but it get's kinda slow if your trunk has 75,000 revisions (and most of the time you do compare trunk with another, possibly faraway, branch).

该过程将自动进行,因此您可以建议手动无法轻松完成的事情.

The process will be automated, so you can suggest things which are not done easily by hand.

补充:忘记说了,我需要实时完成.不是像 10ms 这样的实时",而是像在等待输出的人生气之前"那样的实时".所以如果不到 10 秒就好了.

Added: Forgot to say, I need to get it done in real time. Not in "real time" as in 10ms, but in "real time" as in "before the person waiting for the output gets annoyed". So it'd be nice if it was under 10s.

推荐答案

我想这就是你所需要的

svn log -v --stop-on-copy

svn log -v --stop-on-copy

将返回以下内容

r43477 |用户名 |2010-09-21 13:19:58 +0530(21 日,星期二)2010 年 9 月) |1 行更改路径:A/trunk/re/XXX(来自/branches/release/post_XXX/re/XXX:43476)

r43477 | username | 2010-09-21 13:19:58 +0530 (Tue, 21 Sep 2010) | 1 line Changed paths: A /trunk/re/XXX (from /branches/release/post_XXX/re/XXX:43476)

由此可以确定这个分支是当前分支的祖先分支.如果你结合 Victor Nicollet 提到的逻辑,你将能够实时获得结果.

From this you can identify that this branch is a ancestor of the current branch. If you combine this the logic mentioned by Victor Nicollet you will be able to get the results in real time.

这篇关于如何在SVN中找到两个分支的共同祖先?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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