Patchwork [6,of,8] templater: add revbisect function

login
register
mail settings
Submitter timeless@mozdev.org
Date Sept. 11, 2015, 3:36 a.m.
Message ID <9cc5be267d6ffe26daf2.1441942604@waste.org>
Download mbox | patch
Permalink /patch/10483/
State Rejected
Headers show

Comments

timeless@mozdev.org - Sept. 11, 2015, 3:36 a.m.
# HG changeset patch
# User timeless@mozdev.org
# Date 1441936353 14400
#      Thu Sep 10 21:52:33 2015 -0400
# Node ID 9cc5be267d6ffe26daf24049c71eb5d5ab3bf1a3
# Parent  92c2c986bd73dc949ab8e94cd319254973c4ba2c
templater: add revbisect function

revbisect takes a revision and returns its bisect status

for use like:
  {revset("...") % "{revision|revbisect}"}

Patch

diff --git a/mercurial/templater.py b/mercurial/templater.py
--- a/mercurial/templater.py
+++ b/mercurial/templater.py
@@ -15,8 +15,10 @@ 
 from . import (
     config,
     error,
+    hbisect,
     minirst,
     parser,
+    patch,
     revset as revsetmod,
     templatefilters,
     templatekw,
@@ -583,6 +585,12 @@ 
     ctx, repo = ctxrepo('revauthor', context, mapping, args)
     return ctx.user()
 
+def revbisect(context, mapping, args):
+    """:revbisect(rev): Show bisect.
+    See :hg:`help templates.bisect`."""
+    ctx, repo = ctxrepo('revbisect', context, mapping, args)
+    return hbisect.label(repo, ctx.node())
+
 def revset(context, mapping, args):
     """:revset(query[, formatargs...]): Execute a revision set query. See
     :hg:`help revset`."""
@@ -779,6 +787,7 @@ 
     "localdate": localdate,
     "pad": pad,
     "revauthor": revauthor,
+    "revbisect": revbisect,
     "revdesc": revdesc,
     "revfiles": revfiles,
     "revset": revset,
diff --git a/tests/test-log.t b/tests/test-log.t
--- a/tests/test-log.t
+++ b/tests/test-log.t
@@ -2112,6 +2112,13 @@ 
   $ hg log -r 0 --template '{revset("0::0") % "user:\t{revision|revauthor}\n\n"}'
   user:	test
   
+  $ hg bisect -b 0
+  $ hg bisect -g 2 > ignored
+  $ hg log -r 0 --template '{revset("all()") % "bisect:\t{revision|revbisect}\n"}\n'
+  bisect:	bad
+  bisect:	
+  bisect:	good
+  
   $ hg log -r . --template '{revdesc()}'
   hg: parse error: revdesc expects one argument
   [255]