Mercury log format with file statuses

I was wondering how to return files added / changed / deleted for commit in this format:

<modifier> file <modifier> path/to/a/file <modifier> path/to/another/file 

In git, I do this: "git show --pretty =" format: "--name-status commitish" and get:

 D file A path/to/a/file M path/to/another/file 

For mercury, I can’t figure out how to do this using templates. I have a style file:

 changeset = "{file_mods}{file_adds}{file_dels}" file_add = "A {file_add}\n" file_mod = "M {file_mod}\n" file_del = "D {file_del}\n" 

and with this style and the command "hg log -r commitish -style ~ / .hgstyle" I get almost what I want:

 M path/to/another/file A path/to/a/file D file 

There is another problem with mercurial files - files are not sorted in order.

How to get the same result as in git command (with modifiers and sorted correctly) on mercurial?

+4
source share
4 answers

There is no direct path using the template engine, but you can try:

hg log --style ~/.hgstyle -r <rev> | sort -k2

This will sort the output of the log command in the second data column (i.e. file names).

0
source

Try the following:

 hg stat --change THE_REV_YOU_WANT 
+1
source

Perhaps I did not understand correctly, but if you want to delete first, then add and finally modifications, change the first line of your style file:

 changeset = "{file_dels}{file_adds}{file_mods}" 

You can also add a table ( \t ) instead of a space if you want to be closer to the look of Git:

 file_add = "A\t{file_add}\n" 
0
source

Add this to your .hgrc file

 [alias] prettylog = log -r : --template "{rev} | {date|shortdate} | {desc|strip|firstline}\n{file_dels % ' - {file}\n'}{file_adds % ' + {file}\n'}{file_mods % ' ~ {file}\n'}\n" 

It will print a neatly formatted output similar to this (2 - turnover number):

 2 | 2014-03-21 | my new log format - js/remove_me.js + js/add_me.js ~ doc/modified_me.txt ~ www/index.html 
0
source

All Articles