version-control - 如何在 mercurial 的 "hg log"上显示当前的工作修订版?

标签 version-control mercurial logging

我希望我的“hg h”(一个 hg 日志别名的输出)在历史/日志的上下文中显示我当前工作的修订版。

在我的 .hgrc 上,我有以下内容:

[alias]
h = log --template "{rev} {node|short} {date|shortdate} | [{author|user}] {desc|strip|firstline} :: {tags}\n"

这是一个示例输出:
$ hg h
1 f130b4194c90 2011-07-21 | [slashfoo] added a comment :: tip
0 f4b4ec3c8c95 2011-07-21 | [slashfoo] initial commit ::

但是如果我更新到修订版 0,输出仍然相同:
$ hg up 0
1 files updated, 0 files merged, 0 files removed, 0 files unresolved

$ hg h
1 f130b4194c90 2011-07-21 | [slashfoo] added a comment :: tip
0 f4b4ec3c8c95 2011-07-21 | [slashfoo] initial commit ::

所需输出的示例是:
$ hg h
1 f130b4194c90 2011-07-21 | [slashfoo] added a comment :: tip
0 f4b4ec3c8c95 2011-07-21 | [slashfoo] initial commit :: [working]

注意:[working] 不是标签,只是我的工作修订版,我更新的那个。

另一个例子可能是:
$ hg h
1 f130b4194c90 2011-07-21 | | [slashfoo] added a comment :: tip
0 f4b4ec3c8c95 2011-07-21 |X| [slashfoo] initial commit ::

我使用 hgbook 关于“自定义 Mercurial 的输出”的条目自定义了我的“hg h”输出http://hgbook.red-bean.com/read/customizing-the-output-of-mercurial.html

我想做的替代方案可能是:
  • 使用 graphlog 扩展并做 hg h -G以便@ 表示当前的工作修订版
  • 使用 hg id想知道我是什么版本
  • 使用 hg parents想知道我是什么版本,还有一些额外的信息

  • 但只有替代 #1 向我展示了上下文,但 hg log -G 和别名比我想要的输出更不“紧凑”。

    这是替代方案 #1 的输出示例
    $ hg h -G
    o  1 f130b4194c90 2011-07-21 | [slashfoo] added a comment :: tip
    |
    @  0 f4b4ec3c8c95 2011-07-21 | [slashfoo] initial commit ::
    

    这个问题类似于How can I find my working revision in mercurial但我希望在上下文中以紧凑的方式(即没有 -G)

    最佳答案

    hg log --rev $(hg id -i | sed 's/.$//')

    关于version-control - 如何在 mercurial 的 "hg log"上显示当前的工作修订版?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6780853/

    相关文章:

    git - 使用 Microsoft Git Provider 时用 winmerge 替换 visual studio 2012 Diff 工具

    mercurial - 在Mercurial中,在 "hg init"创建项目并推送到服务器后,如何使本地目录具有服务器的 "hg path"?

    mongodb - MQTT 代理 - Mosquitto 事件记录

    ios - iOS 11 上的控制台日志垃圾邮件

    Mercurial:如何处理一个有两个头的分支

    python - 用 Pandas 读取日志文件

    version-control - 有人在企业环境中使用分布式 VCS 吗?

    version-control - 您是否将开发/运行时工具放在存储库中?

    version-control - 源代码控制背后的理论(和术语)

    mercurial - 一组开发人员如何通过 mercurial 修复先前发布版本中的多个错误?