Can I put space characters as separators only if I have any Tag or Bookmark?
Example:
hg log --template "{rev} {author} {tags} {bookmarks} {desc|firstline}\n"
Output:
3: Author1 TIP BKMRK_NAME Another commit
2: Author1 Third commit
1: Author1 TAG1 Second commit
0: Author1 Initial commit
The changesets that don’t have Tags or Bookmarks prints the space characters. I’d like to suppress those extra spaces:
3: Author1 TAG_NAME BKMRK_NAME Another commit
2: Author1 Third commit
1: Author1 TAG1 Second commit
0: Author1 Initial commit
A new style can be created that defines how the start of a collection (i.e. bookmarks), the element in the collection itself and the last element of a collection look like.
Save the following style definition in a file e.g. called “my_style”:
You then can call hg log with the just newly created style:
This would only insert a space and bracket if there are bookmarks at all (note that there’s no space between {author} and {bookmarks}).
Some nice cli templates as reference can be found here.