Add pipeline requirement for current-patchset.

Zuul can get itself into test loops when it receives comments for old
patchsets because it attempts to vote on old patchsets which is not
possible so the vote based requeuing stuff falls over and loops. Add
an option to ignore old patchsets.

Co-Authored-By: James E. Blair <jeblair@openstack.org>
Change-Id: Ie3cd82fb9535e27b549a2483ac4fa9736930b044
diff --git a/zuul/model.py b/zuul/model.py
index c5c5c7d..39d004d 100644
--- a/zuul/model.py
+++ b/zuul/model.py
@@ -1158,8 +1158,10 @@
 
 
 class ChangeishFilter(object):
-    def __init__(self, open=None, statuses=[], approvals=[]):
+    def __init__(self, open=None, current_patchset=None,
+                 statuses=[], approvals=[]):
         self.open = open
+        self.current_patchset = current_patchset
         self.statuses = statuses
         self.approvals = approvals
 
@@ -1176,10 +1178,12 @@
 
         if self.open is not None:
             ret += ' open: %s' % self.open
+        if self.current_patchset is not None:
+            ret += ' current-patchset: %s' % self.current_patchset
         if self.statuses:
             ret += ' statuses: %s' % ', '.join(self.statuses)
         if self.approvals:
-            ret += ' approvals: %s' % ', '.join(str(self.approvals))
+            ret += ' approvals: %s' % str(self.approvals)
         ret += '>'
 
         return ret
@@ -1189,6 +1193,10 @@
             if self.open != change.open:
                 return False
 
+        if self.current_patchset is not None:
+            if self.current_patchset != change.is_current_patchset:
+                return False
+
         if self.statuses:
             if change.status not in self.statuses:
                 return False