Avoid duplicate using_revision relations (closes #2766223) stable
authorJulien Cristau <julien.cristau@logilab.fr>
Thu, 21 Mar 2013 12:13:10 +0100
branchstable
changeset 879 58359ab60f98
parent 878 601c4a1f8c53
child 880 14cfe77807c7
Avoid duplicate using_revision relations (closes #2766223) For some reason sometimes two CheckResultInfo entities with the same information are created, which causes things to explode.
_apycotlib/writer.py
hooks.py
--- a/_apycotlib/writer.py	Tue Mar 12 16:20:36 2013 +0100
+++ b/_apycotlib/writer.py	Thu Mar 21 12:13:10 2013 +0100
@@ -204,7 +204,8 @@
             if not self._cnxh.execute(
                 'SET X using_revision REV '
                 'WHERE X eid %(x)s, REV changeset %(cs)s, '
-                'REV from_repository R, R eid %(r)s',
+                'REV from_repository R, R eid %(r)s, '
+                'NOT X using_revision REV',
                 {'x': self._eid, 'cs': changeset,
                  'r': environment.repository.eid}):
                 self.raw(repr(vcsrepo), changeset, 'revision')
--- a/hooks.py	Tue Mar 12 16:20:36 2013 +0100
+++ b/hooks.py	Thu Mar 21 12:13:10 2013 +0100
@@ -152,7 +152,7 @@
             # fails. In such case the information is kept as a CheckResultInfo
             # object, use it to create the link later when the changeset is
             # imported.
-            done = set()
+            done = set(x.eid for x in revision.reverse_using_revision) 
             for cri in self._cw.execute(
                 'Any CRI, X WHERE CRI for_check X, CRI type "revision", '
                 'CRI label ~= %(repo)s, CRI value %(cs)s',