Add pushdate() revset
authorGregory Szorc <gps@mozilla.com>
Wed, 13 Nov 2013 18:14:55 -0800
changeset 84 2948a807c49c820016867a3f137f1e6c95ee1538
parent 83 35f92fa51b9606b4f72c4f5242dd86aa353189f0
child 85 a791d156bddee738b956ee1abf42cfd42f80481d
push id61
push usergszorc@mozilla.com
push dateThu, 14 Nov 2013 02:14:59 +0000
Add pushdate() revset
__init__.py
--- a/__init__.py
+++ b/__init__.py
@@ -134,16 +134,19 @@ pushhead([TREE])
    Retrieve changesets that are push heads.
 
 firstpushdate(DATE)
    Retrieve changesets that were first pushed according to the date spec.
 
 firstpushtree(TREE)
    Retrieve changesets that initially landed on the specified tree.
 
+pushdate(DATE)
+   Retrieve changesets that were pushed according to the date spec.
+
 reviewer(REVIEWER)
    Retrieve changesets there were reviewed by the specified person.
 
    The reviewer string matches the *r=* string specified in the commit. In
    the future, we may consult a database of known aliases, etc.
 
 reviewed()
    Retrieve changesets that have a reviewer marked.
@@ -872,16 +875,38 @@ def revset_firstpushtree(repo, subset, x
             continue
 
         if pushes[0][0] == tree:
             revs.append(rev)
 
     return revs
 
 
+def revset_pushdate(repo, subset, x):
+    """``pushdate(DATE)``
+    Changesets that were pushed according to the date spec provided.
+
+    All pushes are examined.
+    """
+    ds = revset.getstring(x, _('pushdate() requires a string'))
+    dm = util.matchdate(ds)
+
+    revs = []
+
+    for rev in subset:
+        for push in repo.changetracker.pushes_for_changeset(repo[rev].node()):
+            when = push[2]
+
+            if dm(when):
+                revs.append(rev)
+                break
+
+    return revs
+
+
 def revset_pushhead(repo, subset, x):
     """``pushhead([TREE])``
     Changesets that are push heads.
 
     A push head is a changeset that was a head when it was pushed to a
     repository. In other words, the automation infrastructure likely
     kicked off a build using this changeset.
 
@@ -1195,16 +1220,17 @@ def extsetup(ui):
     revset.symbols['me'] = revset_me
     revset.symbols['nobug'] = revset_nobug
     revset.symbols['pushhead'] = revset_pushhead
     revset.symbols['reviewer'] = revset_reviewer
     revset.symbols['reviewed'] = revset_reviewed
     revset.symbols['tree'] = revset_tree
     revset.symbols['firstpushdate'] = revset_firstpushdate
     revset.symbols['firstpushtree'] = revset_firstpushtree
+    revset.symbols['pushdate'] = revset_pushdate
 
     templatekw.keywords['bug'] = template_bug
     templatekw.keywords['bugs'] = template_bugs
     templatekw.keywords['reviewer'] = template_reviewer
     templatekw.keywords['reviewers'] = template_reviewers
     templatekw.keywords['firstrelease'] = template_firstrelease
     templatekw.keywords['firstbeta'] = template_firstbeta
     templatekw.keywords['firstaurora'] = template_firstaurora