6

根据HG 手册

默认情况下,此命令会打印修订号和变更集 ID、标签、重要的父级、用户、日期和时间以及每个提交的摘要。当使用 -v/--verbose 开关时,将显示已更改文件的列表和完整的提交消息。

我已经尝试过hg log -v,但仍然没有显示出琐碎的父母。

4

4 回答 4

7

您可以使用该--debug选项。

$ hg log --template '{parents}\n' --debug
12:49f2f93d2efdd41c9ffb9dccf4d451e2d8bfbc5f -1:0000000000000000000000000000000000000000 
7:012b1bb5d99549a5a7c1a280755fa6336c0b472a -1:0000000000000000000000000000000000000000 
10:d6dc52582cfaa0e8be17a5b9da61b55692353afc 11:8ee9fa792548fc30669a34cf39fcc7185aabaa19 
8:d589ca45072469148f833f38918861e8de406e64 -1:0000000000000000000000000000000000000000 
于 2010-06-02T17:56:18.793 回答
5

打开Graphlog Extension后,您可以在 'hg log -G' 中直观地看到它们。

在这种情况下,“微不足道”只是意味着“是当前修订号减一”,所以在这样的情况下:

o  changeset:   1440:fe26f69d4b84
|  user:        dan@scofield.bx.psu.edu
|  date:        Fri Jul 18 12:11:58 2008 -0400
|  summary:     Typo in last commit.
|
o  changeset:   1439:74cbef36b62f
|  user:        dan@scofield.bx.psu.edu
|  date:        Fri Jul 18 12:10:23 2008 -0400
|  summary:     Fix bug in JobWrapper.get_input_fnames(), used by pbs runner, when an input dataset was optional and left empty.
|
o  changeset:   1438:1e111ebb2664
|  user:        James Taylor <james@jamestaylor.org>
|  date:        Thu Jul 17 22:14:40 2008 -0400
|  summary:     Workflows (owned and shared) can now be added to the tool menu.
|
o    changeset:   1437:4a4de494fbf6
|\   parent:      1436:37a7f508eb30
| |  parent:      1431:8b83b7250224
| |  user:        James Taylor <james@jamestaylor.org>
| |  date:        Thu Jul 17 20:42:00 2008 -0400
| |  summary:     Merge.
| |
| o  changeset:   1436:37a7f508eb30
| |  user:        James Taylor <james@jamestaylor.org>
| |  date:        Thu Jul 17 20:40:20 2008 -0400
| |  summary:     Allow loading a specific controller/action in the root middle frame, and use
| |
| o  changeset:   1435:96e1cda02414
| |  user:        James Taylor <james@jamestaylor.org>
| |  date:        Thu Jul 17 20:16:13 2008 -0400
| |  summary:     Fix for scroll panel when dropping while still overlapping the edge.
| |

仅显示 1437 的父列表,因为其余的只有一个父列表,即修订号减一。

于 2010-03-03T15:44:35.990 回答
3

当唯一的父节点是下一个节点时,模板关键字 parents 为空

hg log --template "{parents}\n" -l 20

于 2011-03-12T18:10:59.070 回答
0

通过这个简单的 mercurial 源补丁,您将在日志中获得所有父母:文件 cmdutil.py:(hg 3.1.2 中的第 990 行)

 def _meaningful_parentrevs(self, log, rev):
    """Return list of meaningful (or all if debug) parentrevs for rev.

    For merges (two non-nullrev revisions) both parents are meaningful.
    Otherwise the first parent revision is considered meaningful if it
    is not the preceding revision.
    """
    parents = log.parentrevs(rev)
    return parents    #<=================add this line
    if not self.ui.debugflag and parents[1] == nullrev:
        if parents[0] >= rev - 1:
            parents = []
        else:
            parents = [parents[0]]
    return parents

在 mercurial 4.0 中,在文件 scmutil.py 中找到:

def meaningfulparents(repo, ctx):
    """Return list of meaningful (or all if debug) parentrevs for rev.

    For merges (two non-nullrev revisions) both parents are meaningful.
    Otherwise the first parent revision is considered meaningful if it
    is not the preceding revision.
    """
    parents = ctx.parents()
    return parents       #<===========================add this line
    if len(parents) > 1:
        return parents
    if repo.ui.debugflag:
        return [parents[0], repo['null']]
    if parents[0].rev() >= intrev(ctx.rev()) - 1:
        return []
    return parents

你会得到类似的东西:

$ hg log
changeset:   62355:2722bdc1f0fc
branch:      ALL-3158-fortran-memkind
tag:         tip
parent:      62354:82da46786838
parent:      -1:000000000000
user:        Marcos Mayorga <mm@mm-studios.com>
date:        Mon Jan 30 09:12:13 2017 +0000
summary:     memkind smoke tests for FORTRAN

changeset:   62354:82da46786838
branch:      ALL-3158-fortran-memkind
parent:      62194:c98a4c8295ab
parent:      -1:000000000000
user:        Marcos Mayorga <mm@mm-studios.com>
date:        Fri Jan 27 14:38:53 2017 +0000
summary:     create branch

...
于 2017-02-01T07:42:52.133 回答