{"id":108,"date":"2012-08-20T14:41:57","date_gmt":"2012-08-20T19:41:57","guid":{"rendered":"http:\/\/blog.mozilla.org\/ted\/?p=108"},"modified":"2012-08-20T14:41:57","modified_gmt":"2012-08-20T19:41:57","slug":"prettier-mercurial-output","status":"publish","type":"post","link":"https:\/\/blog.mozilla.org\/ted\/2012\/08\/20\/prettier-mercurial-output\/","title":{"rendered":"Prettier Mercurial output"},"content":{"rendered":"<p>I don&#8217;t use git on a daily basis, but I&#8217;m a fan of how its output is both colorful and run through a pager (like less) if necessary. As it turns out, Mercurial (which I do use daily) ships with all the functionality you need to replicate this behavior, it&#8217;s just not enabled by default. You need to enable the <a href=\"http:\/\/mercurial.selenic.com\/wiki\/ColorExtension\">color<\/a> and <a href=\"http:\/\/mercurial.selenic.com\/wiki\/PagerExtension\">pager<\/a> extensions (which ship with Mercurial), so just a few lines in your ~\/.hgrc will get you there:<\/p>\n<pre>[extensions]\r\ncolor =\r\npager =<\/pre>\n<pre>[pager]\r\npager = LESS=FRSXQ less\r\nquiet = True<\/pre>\n<p>The pager configuration simply makes less handle the colored output properly, and also behave like cat if the output fits on the screen.<\/p>\n<p>I frequently find myself using <em>hg export<\/em> to view the contents of patches in my mq, so I also added an alias that I could use instead to get nice colored and pagered diffs:<\/p>\n<pre>[alias]\r\nshow = log --patch --verbose --rev<\/pre>\n<pre>[pager]\r\nattend = diff,status,log,qdiff,blame,annotate,pdiff,glog,show<\/pre>\n<p>The pager configuration is necessary because by default pager only works on a whitelist of commands, so you need to add this new show alias. Then you can simply use it like <em>hg show tip<\/em> to view the contents of your topmost mq patch.<\/p>\n<p>I&#8217;ve only tested this configuration on Ubuntu 12.04 with Mercurial 2.0.2, so I&#8217;d be interested to hear if it works elsewhere.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I don&#8217;t use git on a daily basis, but I&#8217;m a fan of how its output is both colorful and run through a pager (like less) if necessary. As it turns out, Mercurial (which I do use daily) ships with all the functionality you need to replicate this behavior, it&#8217;s just not enabled by default. [&hellip;]<\/p>\n","protected":false},"author":65,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.mozilla.org\/ted\/wp-json\/wp\/v2\/posts\/108"}],"collection":[{"href":"https:\/\/blog.mozilla.org\/ted\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.mozilla.org\/ted\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/ted\/wp-json\/wp\/v2\/users\/65"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/ted\/wp-json\/wp\/v2\/comments?post=108"}],"version-history":[{"count":0,"href":"https:\/\/blog.mozilla.org\/ted\/wp-json\/wp\/v2\/posts\/108\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.mozilla.org\/ted\/wp-json\/wp\/v2\/media?parent=108"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.mozilla.org\/ted\/wp-json\/wp\/v2\/categories?post=108"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.mozilla.org\/ted\/wp-json\/wp\/v2\/tags?post=108"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}