我怎样才能找到所有曾在一个Mercurial库冲突合并? [英] How can I find all the merges that had conflicts in a Mercurial repository?

查看:116
本文介绍了我怎样才能找到所有曾在一个Mercurial库冲突合并?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的一个研究,研究开源项目合并。

I am working on a research to study merges in open source projects.

最近,我问<一个href=\"http://stackoverflow.com/questions/15637103/how-can-i-find-all-the-commits-that-have-multiple-parents-in-a-mercurial-reposit\">How我能找到的所有具备多个家长在Mercurial库的提交?,并取得了很好的答案。

I recently asked How can I find all the commits that have multiple parents in a Mercurial repository?, and got a very good answer.

现在我需要缩小我的查询,只发现有冲突的提交。

Now I need to narrow my query to only find the commits that had conflicts.

随着冲突我的意思是相同的文件是在两个起作用提交修改。

With conflicts I mean that the same file was modified in the two contributing commits.

此外,这将是非常有用的,如果我能找到一个反复无常或bash(grep的,AWK?)命令,让我只在同一行是由两个贡献者修改这些提交。

Also, it would be very useful if I can find a mercurial or bash (grep, awk?) command that gives me only those commits in which the same line was modified by the two contributors.

的想法是要找到提交即不能自动解决。

The idea is to find commits that cannot be auto-resolved.

所以,我怎样才能找到所有曾在一个Mercurial库冲突的合并?

So, How can I find all the merges that had conflicts in a Mercurial repository?

推荐答案

有关每个合并修订版,你可以检索更改的文件,相对于第一和第二父修订的名单。同时出现在列表中的文件是presumably冲突。

For each merge revision, you can retrieve the list of changed files, relative to the first and second parent revisions. Files that appear in both lists are presumably conflicts.

下面是一个例子:

for rev in $(hg log -r "merge()" --template '{rev}\n'); do
    hg status --rev "p1($rev)" --rev $rev --no-status | sort > /tmp/p1
    hg status --rev "p2($rev)" --rev $rev --no-status | sort > /tmp/p2
    echo Conflicts in $rev:
    comm -1 -2 /tmp/p1 /tmp/p2
done

请注意:这可能不会对文件重命名处理。你可以尝试加入--copies到汞地位的电话。

Note: this probably won't cope with files being renamed. You could try adding "--copies" to the "hg status" calls.

这篇关于我怎样才能找到所有曾在一个Mercurial库冲突合并?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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