开发者

How can I get the changeset ID of the base file when merging with mercurial?

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.


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

hg log -r ancestor(rev1,rev2)


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜