与 Mercurial 合并时如何获取基础文件的变更集 ID?

发布于 2024-10-13 03:09:35 字数 118 浏览 3 评论 0原文

我有几个需要合并的分支,但我不知道合并工具中显示的一些更改来自哪里。 local 和 other 的变更集很明显,但是我如何找出基础文件来自哪个变更集?我正在一个有数十个分支的存储库中工作,因此查看图表并跟踪它效果不太好。

I have a couple branches that I need to merge, but I don't know where some of the changes are coming from that are showing up in my merge tool. The change sets of local and other are obvious, but how can I find out which change set the base file came from? I'm working in a repository with dozens of branches, so viewing the graph and tracking it doesn't work very well.

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

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

发布评论

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

评论(2

此岸叶落 2024-10-20 03:09:35

使用 revsets (Mercurial 1.6 及更高版本),您可以获得共同祖先两个变更集:

hg log -r ancestor(rev1,rev2)

Using revsets (Mercurial 1.6 and later), you can get the common ancestor of two changesets with:

hg log -r ancestor(rev1,rev2)
浮华 2024-10-20 03:09:35

尝试使用 hg grep 命令:

hg grep [OPTION]... PATTERN [FILE]...

search for a pattern in specified files and revisions

    Search revisions of files for a regular expression.

    This command behaves differently than Unix grep. It only accepts
    Python/Perl regexps. It searches repository history, not the working
    directory. It always prints the revision number in which a match appears.

    By default, grep only prints output for the first revision of a file in
    which it finds a match. To get it to print every revision that contains a
    change in match status ("-" for a match that becomes a non-match, or "+"
    for a non-match that becomes a match), use the --all flag.

    Returns 0 if a match is found, 1 otherwise.

options:

 -0 --print0               end fields with NUL
    --all                  print all revisions that match
 -f --follow               follow changeset history, or file history across
                           copies and renames
 -i --ignore-case          ignore case when matching
 -l --files-with-matches   print only filenames and revisions that match
 -n --line-number          print matching line numbers
 -r --rev REV [+]          only search files changed within revision range
 -u --user                 list the author (long with -v)
 -d --date                 list the date (short with -q)
 -I --include PATTERN [+]  include names matching the given patterns
 -X --exclude PATTERN [+]  exclude names matching the given patterns
    --mq                   operate on patch repository

[+] marked option can be specified multiple times

use "hg -v help grep" to show global options

您可以像这样使用它:

hg grep "a string"

它会告诉您它是在哪个版本中首次添加的。

如果您正在寻找较少搜索和更多概述的内容,您可以使用 hg log -v 来查看每个变更集中哪些文件发生了更改,并使用 hg log -p 来查看哪些文件在每个变更集中发生了更改> 查看每个的实际差异。

Try the hg grep command:

hg grep [OPTION]... PATTERN [FILE]...

search for a pattern in specified files and revisions

    Search revisions of files for a regular expression.

    This command behaves differently than Unix grep. It only accepts
    Python/Perl regexps. It searches repository history, not the working
    directory. It always prints the revision number in which a match appears.

    By default, grep only prints output for the first revision of a file in
    which it finds a match. To get it to print every revision that contains a
    change in match status ("-" for a match that becomes a non-match, or "+"
    for a non-match that becomes a match), use the --all flag.

    Returns 0 if a match is found, 1 otherwise.

options:

 -0 --print0               end fields with NUL
    --all                  print all revisions that match
 -f --follow               follow changeset history, or file history across
                           copies and renames
 -i --ignore-case          ignore case when matching
 -l --files-with-matches   print only filenames and revisions that match
 -n --line-number          print matching line numbers
 -r --rev REV [+]          only search files changed within revision range
 -u --user                 list the author (long with -v)
 -d --date                 list the date (short with -q)
 -I --include PATTERN [+]  include names matching the given patterns
 -X --exclude PATTERN [+]  exclude names matching the given patterns
    --mq                   operate on patch repository

[+] marked option can be specified multiple times

use "hg -v help grep" to show global options

You can use it like:

hg grep "a string"

and it will tell you in which revision it was first added.

If you're looking for something less search-y and more overview-y you can use hg log -v to see what files were changes in each changeset and hg log -p to see the actual diffs for each.

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