Brown paper bag fix for StartTestOp operation (closes #2822711) stable
authorJulien Cristau <julien.cristau@logilab.fr>
Mon, 15 Apr 2013 17:09:39 +0200
branchstable
changeset 895 93e13d3e0ee9
parent 885 844d067d102c
child 896 c727a537bae1
Brown paper bag fix for StartTestOp operation (closes #2822711) - need to use DataOperationMixIn for get_instance - operations have .session, not ._cw
hooks.py
--- a/hooks.py	Wed Apr 10 11:06:57 2013 +0200
+++ b/hooks.py	Mon Apr 15 17:09:39 2013 +0200
@@ -122,7 +122,7 @@
         self.repo.looping_task(60*60, check_test_to_start, self.repo)
 
 
-class StartTestOp(hook.Operation):
+class StartTestOp(hook.DataOperationMixIn, hook.Operation):
     def precommit_event(self):
         for revision in self.get_data():
             vcsrepo = revision.repository
@@ -131,7 +131,7 @@
                     if pe.vcs_path:
                         # start test only if the revision is modifying file under
                         # specified directory.
-                        if not self._cw.execute(
+                        if not self.session.execute(
                             'Any R LIMIT 1 WHERE R eid %(r)s, VC from_revision R,'
                             'VC content_for VF, VF directory ~= %(path)s',
                             {'r': revision.eid, 'path': pe.vcs_path + '%'}):
@@ -153,7 +153,7 @@
             # object, use it to create the link later when the changeset is
             # imported.
             done = set(x.eid for x in revision.reverse_using_revision) 
-            for cri in self._cw.execute(
+            for cri in self.session.execute(
                 'Any CRI, X WHERE CRI for_check X, CRI type "revision", '
                 'CRI label ~= %(repo)s, CRI value %(cs)s',
                 {'cs': revision.changeset,