Submitter | Durham Goode |
---|---|
Date | Feb. 14, 2014, 8:23 p.m. |
Message ID | <6958dd4c11c6f8929a95.1392409437@dev010.prn1.facebook.com> |
Download | mbox | patch |
Permalink | /patch/3661/ |
State | Accepted |
Commit | 5c65ee4193e13551ad9cd54010fc80094e12fec0 |
Headers | show |
Comments
On Fri, 2014-02-14 at 12:23 -0800, Durham Goode wrote: > # HG changeset patch > # User Durham Goode <durham@fb.com> > # Date 1392183633 28800 > # Tue Feb 11 21:40:33 2014 -0800 > # Node ID 6958dd4c11c6f8929a955b3c468e39dea1f11cc8 > # Parent c30dc74862faaf6e4a5a701799506b4dcfe0697b > template: add 'current' to scope during {bookmarks % ...} These are queued for default, thanks. I think you owe me a doc patch for this one and ifcontains though.
Patch
diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py --- a/mercurial/templatekw.py +++ b/mercurial/templatekw.py @@ -195,8 +195,12 @@ """:bookmarks: List of strings. Any bookmarks associated with the changeset. """ + repo = args['ctx']._repo bookmarks = args['ctx'].bookmarks() - return showlist('bookmark', bookmarks, **args) + hybrid = showlist('bookmark', bookmarks, **args) + for value in hybrid.values: + value['current'] = repo._bookmarkcurrent + return hybrid def showchildren(**args): """:children: List of strings. The children of the changeset.""" diff --git a/tests/test-command-template.t b/tests/test-command-template.t --- a/tests/test-command-template.t +++ b/tests/test-command-template.t @@ -1676,3 +1676,10 @@ Rev: 0 Ancestor: 0 +Test current bookmark templating + + $ hg book foo + $ hg book bar + $ hg log --template "{rev} {bookmarks % '{bookmark}{ifeq(bookmark, current, \"*\")} '}\n" + 1 bar* foo + 0