graphlog by default

Harvey Chapman hchapman-hg at 3gfp.com
Wed Feb 4 14:42:10 UTC 2015


> On Feb 4, 2015, at 2:19 AM, Ellison Marks <gotyaoi at hotmail.com> wrote:
> 
> Hello. As the subject says, I'm trying to get the output from hg log to display the graph visualization by default. Looking into the configuration docs, it seems there's defaults, which says it's deprecated and to use alias instead, and alias, which says it's a bad idea to shadow builtin commands. My muscle memory is pretty set into typing log instead of glog or some other alias, so would anyone happen to know what's the best/safest way to get the graph output from log by default?

I just got in the habit of running “hg gl” and I reserve “hg log” in my head for anything special. I believe the docs say not to use defaults because it’ll break anything else that runs those commands (a script) that doesn’t expect the extra options added by the defaults. As for alias, “don’t shadow” should be obvious for almost the same reason. The only “safe” thing to do is create your own unique command using an alias. However, I still use defaults for glog because I want it to look a certain way 100% of the time. If I want to change it up, I run “hg log -g”. Also, don’t forget that later arguments on the command line will override (usually) the ones in defaults, e.g. “hg gl -l 20” will show 20 results instead of the 10 I have configured below.

All that said, here’s what I have in my hgrc. I didn’t even know that I had the show and verbose aliases in there. I really don’t use anything other than “hg gl” in daily use.

[alias]
# Show the log and the paged, colored patch for a given revision 
show = log --color=always —pager=yes -pr
slog = log --template '{rev}:{node|short}| {date|age}| {author|user}| {desc|firstline}\n' -d '>1/1/70' -l 10
# Like glog, but with real dates for figuring out timesheet logs
verbose = glog --template 'changeset:   {rev}:{node|short} {tags} {branches} {date|date} {author|email}\n             {desc|firstline|fill68|tabindent|tabindent}\n'

[defaults]
glog = --template 'changeset:   {rev}:{node|short} {tags} {branches} {bookmarks} {phase}\n             {desc|firstline|fill68|tabindent|tabindent}\n' -l 10

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20150204/8c81d2fa/attachment-0002.html>


More information about the Mercurial mailing list