Graph log extension
This extension is currently being distributed along with Mercurial.
This extension is now part of core Mercurial
As of Mercurial 2.3, log supports -G without any extensions. The included graphlog extension merely adds glog as an alias to log -G.
Author: Joel Rosdahl
Overview
This extension adds a new option, -G, to the log command that formats the output as a graph representing the revision history using ASCII characters to the left of the log. This extension also adds a new command glog to do the same thing.
Configuration
Enable this extension by adding the following lines to your configuration file (hgrc):
[extensions] graphlog =
Usage
hg log -G [OPTIONS]
where options are the standard options to log, including:
-l --limit LIMIT limit number of changes displayed -p --patch show patch -r --rev REV show the specified revision or range --style STYLE display using template map file STYLE (e.g., "compact") --template TEMPLATE display with template TEMPLATE (e.g., "{desc}\n\n")
Examples
% hg log -G @ changeset: 4276:cb6107f78b92 |\ tag: tip | | parent: 4269:73c918c71300 | | parent: 4275:81402b2b294d | | user: Matt Mackall <mpm@selenic.com> | | date: Sat Mar 24 02:57:27 2007 -0500 | | summary: Merge with crew | | o | changeset: 4275:81402b2b294d | | user: Alexis S. L. Carvalho <alexis@cecm.usp.br> | | date: Fri Mar 23 23:40:25 2007 -0300 | | summary: use os.path.islink instead of util.is_link [...]
Nodes printed as an @ character are parents of the working directory.
After a hg merge (but before the commit – see TutorialMerge):
$ hg log -G @ changeset: 3:86794f718fb1 | tag: tip | parent: 1:82e55d328c8c | user: mpm@selenic.com | date: Mon May 05 01:20:46 2008 +0200 | summary: Express great joy at existence of Mercurial | | @ changeset: 2:c3844fde99f0 |/ user: mpm@selenic.com | date: Tue May 06 20:10:35 2008 +0200 | summary: Add description of hello.c | o changeset: 1:82e55d328c8c | user: mpm@selenic.com | date: Fri Aug 26 01:21:28 2005 -0700 | summary: Create a makefile | o changeset: 0:0a04b987be5a user: mpm@selenic.com date: Fri Aug 26 01:20:50 2005 -0700 summary: Create a standard "hello, world" program
Using [ui] style = compact in hgrc and option -l:
> hg log -G -l9 @ 7017[tip]:7015,7016 8362086a1227 2008-09-10 08:49 +0200 benoit |\ merge backout | | | o 7016:7009 58dcf10eea2b 2008-09-10 08:48 +0200 benoit | | Backed out changeset 3d54cf97598d (see issue916 for details) | | o | 7015 6651de7176a0 2008-09-09 21:32 +0200 mg | | i18n, record: improve use of translated docstring in prompts | | o | 7014 46456a51e247 2008-09-09 21:32 +0200 mg | | i18n: use gettext instead of _ | | o | 7013 f56e788fa292 2008-09-09 21:32 +0200 mg | | i18n: mark help strings for translation | | o | 7012 78341ea65d16 2008-09-09 21:32 +0200 mg | | restructure helptable | | o | 7011 7da76778dbd7 2008-09-09 14:43 +0200 benoit | | Do not try to load extensions twice (issue811) | | o | 7010 9141bebefe3e 2008-09-08 14:22 +0200 benoit |/ enhance the error output in case of failure during http push | o 7009 3d54cf97598d 2008-09-08 14:04 +0200 benoit | tag: without a checkout, base the tag changeset on tip instead of nullid |
Symbols explanation
|
Graph edges |
| |
Regular connection (vertical) |
\ |
Regular connection (diagonal left) |
/ |
Regular connection (diagonal right) |
- |
Regular connection (horizontal, used with +) |
+ |
Graph branching point |
: |
There are nodes between the nodes on this line, but they've been omitted |
~ |
The graph was cut off to exclude the node on the other end of this line |
|
Graph nodes |
@ |
The commit you're currently on |
_ |
Branch was closed |
x |
Obsolete commit (ChangesetEvolution) |
* |
Unstable commit (ChangesetEvolution) |
o |
Regular commit |
|\ \ \ | _ | | 104 Branch was closed | | | | | @ | | 103 The commit that you're currently on | | | | | | | o 102 Regular commit, child of 100 (not 101) | | | | |/ / / o---+ 101 Merge of 99 and 100 | | | | | o 100 | | | o | | 99 | | | | * | 98 Unstable | | | | x | 97 Obsolete
Example for the "~" and ":" symbols(assuming you have commits 0->1->2->3):
$ hg log -Gr '1+3' -T '{rev} {ifeq("{rev}", "1", "ancestor excluded from graph range", "parent omitted from graph range")}' o 3 parent omitted from graph range : o 1 ancestor excluded from graph range | ~