Add {firstpushtbpl}
authorGregory Szorc <gps@mozilla.com>
Fri, 08 Nov 2013 00:46:52 -0800
changeset 66 4a8116044c658cba94c6bab9bc92892fc262df36
parent 65 d4dd9768a411706c413694814e6d679cd322228c
child 67 40cd3c48f7817119e1f65f5cad8566bf78039079
push id47
push usergszorc@mozilla.com
push dateFri, 08 Nov 2013 08:46:59 +0000
Add {firstpushtbpl}
__init__.py
--- a/__init__.py
+++ b/__init__.py
@@ -184,16 +184,19 @@ nightlydate
    See auroradate for accuracy information.
 
 firstpushuser
    The username of the first person who pushed this changeset.
 
 firstpushtree
    The name of the first tree this changeset was pushed to.
 
+firstpushtbpl
+   The URL of the TBPL results for the first push of this changeset.
+
 Config Options
 ==============
 
 This extension consults the following config options.
 
 mozext.headless
    Indicates that this extension is running in *headless* mode. *headless*
    mode is intended for server operation, not local development.
@@ -920,16 +923,29 @@ def template_firstpushtree(repo, ctx, **
     pushes = list(repo.changetracker.pushes_for_changeset(ctx.node()))
 
     if not pushes:
         return None
 
     return pushes[0][0]
 
 
+def template_firstpushtbpl(repo, ctx, **args):
+    """:firstpushtbpl: String. TBPL URL for the first push of this changeset.
+    """
+    pushes = list(repo.changetracker.pushes_for_changeset(ctx.node()))
+    if not pushes:
+        return None
+
+    push = pushes[0]
+    tree, node = push[0], push[4]
+
+    return tbpl_url(tree, hex(node)[0:12])
+
+
 def extsetup(ui):
     global bz_available
     try:
         extensions.find('bzexport')
         bz_available = True
     except KeyError:
         pass
 
@@ -946,16 +962,17 @@ def extsetup(ui):
     templatekw.keywords['firstrelease'] = template_firstrelease
     templatekw.keywords['firstbeta'] = template_firstbeta
     templatekw.keywords['firstaurora'] = template_firstaurora
     templatekw.keywords['firstnightly'] = template_firstnightly
     templatekw.keywords['auroradate'] = template_auroradate
     templatekw.keywords['nightlydate'] = template_nightlydate
     templatekw.keywords['firstpushuser'] = template_firstpushuser
     templatekw.keywords['firstpushtree'] = template_firstpushtree
+    templatekw.keywords['firstpushtbpl'] = template_firstpushtbpl
 
 
 def reposetup(ui, repo):
     """Custom repository implementation.
 
     Our custom repository class tracks remote tree references so users can
     reference specific revisions on remotes.
     """