Add {firstpushdate}
authorGregory Szorc <gps@mozilla.com>
Tue, 12 Nov 2013 17:01:11 -0800
changeset 77 ce54350967e7
parent 76 03156d8451c9
child 78 b783c532dc5d
push id56
push usergszorc@mozilla.com
push dateWed, 13 Nov 2013 01:01:15 +0000
Add {firstpushdate}
__init__.py
--- a/__init__.py
+++ b/__init__.py
@@ -204,16 +204,19 @@ 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.
 
+firstpushdate
+   The date of the first push of this changeset.
+
 trees
    The list of trees a changeset has landed in.
 
 reltrees
    The list of release trees a changeset has landed in.
 
 Config Options
 ==============
@@ -1081,16 +1084,26 @@ def template_firstpushtbpl(repo, ctx, **
         return None
 
     push = pushes[0]
     tree, node = push[0], push[4]
 
     return tbpl_url(tree, hex(node)[0:12])
 
 
+def template_firstpushdate(repo, ctx, **args):
+    """:firstpushdate: Date information. The date of the first push of this
+    changeset."""
+    pushes = list(repo.changetracker.pushes_for_changeset(ctx.node()))
+    if not pushes:
+        return None
+
+    return util.makedate(pushes[0][2])
+
+
 def template_trees(repo, ctx, **args):
     """:trees: List of strings. Trees this changeset has landed in.
     """
     return [p[0] for p in repo.changetracker.pushes_for_changeset(ctx.node())]
 
 
 def template_reltrees(repo, ctx, **args):
     """:reltrees: List of strings. Release trees this changeset has landed in.
@@ -1127,16 +1140,17 @@ def extsetup(ui):
     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
+    templatekw.keywords['firstpushdate'] = template_firstpushdate
     templatekw.keywords['trees'] = template_trees
     templatekw.keywords['reltrees'] = template_reltrees
 
 
 def reposetup(ui, repo):
     """Custom repository implementation.
 
     Our custom repository class tracks remote tree references so users can