Mercurial日志模板

时间:2016-03-16 13:16:56

标签: mercurial

我在.hgrc文件

中创建了一个日志别名
nlog = glog --style=${HOME}/.hg-ext/templates.lg

现在在templates.lg我使用label函数来着色输出

changeset = "{label('red',rev)} {label('c.author', author|person)} {desc|firstline|strip} {label('green', date|age)} {label('yellow', branches)}{label('yellow',bookmarks)}{label('yellow', tags)}\n\n"

changeset_verbose = "{label('red',rev)}:{node|short} {label('c.author',author|person)} {desc|firstline|strip} {label('green',date|age)} {label('yellow', branches)}{label('yellow',bookmarks)}{label('yellow', tags)}\n\n"

start_branches = " "
branch = "{label('yellow', branch)}"

start_bookmarks = " "
bookmark = "{label('yellow', bookmark)}, "
last_bookmark = "{label('yellow', bookmark}"

start_tags = " "
tag = "{label('yellow', tag)}, "
last_tag = "{label('yellow', tag)}"

当我运行hg nlog时,它在某些存储库上运行正常,但在跟踪跟踪的其他存储库上失败

C:\Users\esharapov\Repos\Composer.Hg>hg -v --traceback nlog
Traceback (most recent call last):
  File "mercurial\dispatch.pyo", line 191, in _runcatch
  File "mercurial\dispatch.pyo", line 924, in _dispatch
  File "mercurial\dispatch.pyo", line 681, in runcommand
  File "mercurial\extensions.pyo", line 195, in closure
  File "hgext\color.pyo", line 518, in colorcmd
  File "mercurial\extensions.pyo", line 195, in closure
  File "hgext\pager.pyo", line 143, in pagecmd
  File "mercurial\dispatch.pyo", line 1055, in _runcommand
  File "mercurial\dispatch.pyo", line 1015, in checkargs
  File "mercurial\dispatch.pyo", line 921, in <lambda>
  File "mercurial\util.pyo", line 991, in check
  File "mercurial\dispatch.pyo", line 537, in __call__
  File "mercurial\util.pyo", line 991, in check
  File "mercurial\extensions.pyo", line 195, in closure
  File "mercurial\util.pyo", line 991, in check
  File "hgext\mq.pyo", line 3516, in mqcommand
  File "mercurial\util.pyo", line 991, in check
  File "hgext\graphlog.pyo", line 64, in glog
  File "mercurial\commands.pyo", line 5076, in log
  File "mercurial\cmdutil.pyo", line 2219, in graphlog
  File "mercurial\cmdutil.pyo", line 2196, in displaygraph
  File "mercurial\cmdutil.pyo", line 1184, in show
  File "mercurial\cmdutil.pyo", line 1489, in _show
  File "mercurial\templatefilters.pyo", line 340, in stringify
  File "mercurial\util.pyo", line 802, in increasingchunks
  File "mercurial\templater.pyo", line 783, in _flatten
  File "mercurial\templater.pyo", line 262, in runtemplate
  File "hgext\color.pyo", line 501, in templatelabel
  File "mercurial\templatefilters.pyo", line 340, in stringify
  File "mercurial\templatekw.pyo", line 115, in _showlist
  File "mercurial\templatekw.pyo", line 106, in one
  File "mercurial\templater.pyo", line 938, in __call__
  File "mercurial\templater.pyo", line 845, in process
  File "mercurial\templater.pyo", line 835, in _load
  File "mercurial\templater.pyo", line 181, in compiletemplate
  File "mercurial\templater.pyo", line 173, in _parsetemplate
  File "mercurial\parser.pyo", line 78, in parse
  File "mercurial\parser.pyo", line 70, in _parse
  File "mercurial\parser.pyo", line 50, in _parseoperand
  File "mercurial\parser.pyo", line 41, in _match
ParseError: ('unexpected token: end', 26)
hg: parse error at 26: unexpected token: end

可能是什么原因?

1 个答案:

答案 0 :(得分:1)

我不能告诉你你的错误,但我在条件和结果之间进行了一些严格的相关性的额外测试

制备

  • 创建<?php if( is_front_page() && is_home() ) { ?> // you are on homepage, show your another menu <?php } else { ?> <div class="category_menu"> <nav class="cat_menu"> <div class="menu_title parent_cat_name"> <h6><?php echo $category->name; ?></h6> </div> <?php rs_left_menu_subcats($subcategories); ?> </nav> </div> <?php } ?> 内容,与您的$TortoiseHg\templates\map-cmdline.colorglog相同(我懒得在每个测试中编写长命令)
  • 在我的3.7.1中找到了命令行,相当于你的templates.lg(因为nlog):它是

      

    hg log -G --style = colorglog

log -G和没有路径的样式,因为默认地图位置中的样式文件具有良好名称

  • 启用颜色扩展

测试

没有代码的回购(强制性hg: unknown command 'glog'除外)或书签

tip

hg log - 确定

使用标签和书签进行回购

>hg paths
default = https://bitbucket.org/albert_brand/hgexportfiles
>hg tags
tip                               10:ee40a7b06166

>hg book
no bookmarks set

hg log - FAIL(“hg:26处解析错误:意外令牌:结束”)

使用代码回复

>hg paths
default = http://bitbucket.org/durin42/hg-git/

>hg book
   master                    987:be0d1413a06f
   next                      490:ac644c0e16d4

>hg tags
tip                              987:be0d1413a06f
0.8.5                            985:53d514c9c7e6
0.8.4                            976:22a12bf143a3
0.8.3                            946:d7ad67f850b2
0.8.2                            926:e183fdc198f0
0.8.1                            902:e6489cf3fe8c
0.8.0                            857:cf3dafce0611
0.7.0                            827:fc63d0e2653d
...

hg log - 确定

hg-git gepo中带有单个标记|书签的修订的附加测试

>hg paths
default = http://bitbucket.org/durin42/hgsubversion/

>hg book
no bookmarks set

>hg tags
tip                             1378:e1619c051788
1.8.5                           1370:bd979667611d
1.8.4                           1365:89997a5fc181
1.8.3                           1347:759cafce6bec
1.8.2                           1344:38be7a6b6def
1.8.1                           1324:dde1ade36a49
...

标记修订 - 确定

>hg log -r 985 --style=colorglog
985 Siddharth Agarwal init: mark Mercurial 3.7 as supported and prepare for 0.8.5 6 weeks ago  0.8.5

已加书签的修订版 - 失败

ADDITION

好的,我抓住了它。像往常一样,明显错字在明显的地方。而不是

>hg log -r 490 --style=colorglog
hg: parse error at 26: unexpected token: end

一定是

last_bookmark = "{label('yellow', bookmark}"

原因很明显:last_bookmark = "{label('yellow', bookmark)}" ,而不是label()

和书签修订版不会再生成错误

enter image description here