views:

177

answers:

4

What is your favorite non obvious feature of mercurial?

+3  A: 

Maybe it's obvious, but I like the "diff context" comment... (probably calling it the wrong thing):

@@ -81,6 +83,8 @@ def main(argv):
     if '-h' in options or '--help' in options:
         usage()

+    # change in main() function
+
     # load any available cache
     try:
         cache = pickle.load(open(CACHE_PATH))

versus

@@ -81,6 +83,8 @@
     if '-h' in options or '--help' in options:
         usage()

+    # change in main() function
+
     # load any available cache
     try:
         cache = pickle.load(open(CACHE_PATH))

Notice the def main(argv): after the @@ in the first one?

xyld
That's not actually a Mercurial innovation, though. I think GNU diff offers that, at least for some languages.
djc
@djc yes and no. gnu diff does it for C (I believe), but not most scripting languages like python/perl. Mercurial maybe just does a better job of it.
xyld
+4  A: 

One feature that can be very useful is log's -P/--prune option. It lets you, for example, see a changelog for a new release. If the last release is 1.0.3, then you issue hg log -P 1.0.3, and it will only show changesets that are not in 1.0.3 (no matter what the DAG looks like).

djc
This is also a great way, if you use `hg pull` rather than `hg fetch`, to see what you've just pulled. E.g.: `hg pull; hg log -P .` will show you what's new in the upstream repository, giving you the opportunity to merge, rebase, or simply keep developing, as appropriate. Alias it to `hg whatsnew` for even better results.
Benjamin Pollack
+5  A: 

I really like the ASCII graphical log, I actually find it easier to read than the GUI ones in murky/bitbucket/hg share.

hg log --graph -r 32:27

o  changeset:   32:b7d46e86a5f1
|  user:        Bryan O'Sullivan <[email protected]>
|  date:        Sat Jul 15 21:23:35 2006 -0700
|  summary:     Stop inkscape from printing an annoying message.
|
o    changeset:   31:51d94bd2804c
|\   parent:      29:6e988159394b
| |  parent:      30:cc1e6f1d7161
| |  user:        Bryan O'Sullivan <[email protected]>
| |  date:        Sat Jul 15 21:02:13 2006 -0700
| |  summary:     Merge Jeff's PDF image fixes.
| |
| o  changeset:   30:cc1e6f1d7161
| |  parent:      28:f5ce861d6fcc
| |  user:        Josef "Jeff" Sipek <[email protected]>
| |  date:        Sat Jul 15 21:53:57 2006 -0400
| |  summary:     Use PDF instead of PNG for images in the PDF book
| |
o |  changeset:   29:6e988159394b
| |  parent:      27:535e87792eb1
| |  user:        Bryan O'Sullivan <[email protected]>
| |  date:        Wed Jul 12 00:33:27 2006 -0700
| |  summary:     Add revision ID to output.
| |
| o  changeset:   28:f5ce861d6fcc
|/   user:        Bryan O'Sullivan <[email protected]>
|    date:        Thu Jul 13 14:58:31 2006 -0700
|    summary:     Fix description of quilt.
|

Especially when combined with a custom formatter like this one:

hg sglog -r -v 32:27

o  32:b7d46e86a5f1 Stop inkscape from printing an annoying message.
|  (2006-07-15 by Bryan O'Sullivan)
|
o    31:51d94bd2804c Merge Jeff's PDF image fixes.
|\   (2006-07-15 by Bryan O'Sullivan)
| |
| o  30:cc1e6f1d7161 Use PDF instead of PNG for images in the PDF book
| |  (2006-07-15 by Josef "Jeff" Sipek)
| |
o |  29:6e988159394b Add revision ID to output.
| |  (2006-07-12 by Bryan O'Sullivan)
| |
| o  28:f5ce861d6fcc Fix description of quilt.
|/   (2006-07-13 by Bryan O'Sullivan)
|
o  27:535e87792eb1 More MQ content and examples.
|  (2006-07-12 by Bryan O'Sullivan)
Ted Naleid
+2  A: 

Possibly this falls into the 'obvious' category more than the than 'non-obvious', but the Extdiff extension is great. I like that I can easily use colordiff and kdiff3 via cdiff and vdiff respectively.

Config (~/.hgrc):

[extensions]
hgext.extdiff =

[extdiff]
cmd.cdiff = colordiff
cmd.vdiff = kdiff3
overthink