backport stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 13 Jan 2011 21:27:38 +0100
changeset 610 c6cc91533d7a
parent 605 c61aa24c85e7 (current diff)
parent 609 257a78538ff2 (diff)
child 612 2e60c6578324
backport stable
--- a/.hgtags	Wed Nov 03 16:43:44 2010 +0100
+++ b/.hgtags	Thu Jan 13 21:27:38 2011 +0100
@@ -60,3 +60,5 @@
 23bd1f36ec77f30cd525327d408ef6836f88eb24 rql-debian-version-0.26.6-1
 3c59bf663ec78dad82016b43f58348d5e35058ad rql-version-0.27.0
 0a5a70c34c65fccaf64603613d5d295b332e85cb rql-debian-version-0.27.0-1
+ae02408da51e63aa2d1be6ac7170d77060bd0910 rql-version-0.28.0
+21e94bc12c1fcb7f97826fe6aae5dbe62cc4bd06 rql-debian-version-0.28.0-1
--- a/ChangeLog	Wed Nov 03 16:43:44 2010 +0100
+++ b/ChangeLog	Thu Jan 13 21:27:38 2011 +0100
@@ -1,6 +1,12 @@
 ChangeLog for RQL
 =================
 
+2011-01-12  --  0.28.0
+    * enhance rewrite_shared_optional so one can specify where the new identity
+      relation should be added (used by cw multi-sources planner)
+
+
+
 2010-10-13  --  0.27.0
     * select.undefine_variable properly cleanup solutions (and restore them on
       undo)
--- a/__pkginfo__.py	Wed Nov 03 16:43:44 2010 +0100
+++ b/__pkginfo__.py	Thu Jan 13 21:27:38 2011 +0100
@@ -20,7 +20,7 @@
 __docformat__ = "restructuredtext en"
 
 modname = "rql"
-numversion = (0, 27, 0)
+numversion = (0, 28, 0)
 version = '.'.join(str(num) for num in numversion)
 
 license = 'LGPL'
--- a/debian/changelog	Wed Nov 03 16:43:44 2010 +0100
+++ b/debian/changelog	Thu Jan 13 21:27:38 2011 +0100
@@ -1,3 +1,9 @@
+rql (0.28.0-1) unstable; urgency=low
+
+  * new upstream release
+
+ -- Sylvain Thénault <sylvain.thenault@logilab.fr>  Wed, 12 Jan 2011 09:21:26 +0100
+
 rql (0.27.0-1) unstable; urgency=low
 
   * new upstream release
--- a/nodes.py	Wed Nov 03 16:43:44 2010 +0100
+++ b/nodes.py	Thu Jan 13 21:27:38 2011 +0100
@@ -440,7 +440,12 @@
             return False
         rhs = self.children[1]
         if isinstance(rhs, Comparison):
-            rhs = rhs.children[0]
+            try:
+                rhs = rhs.children[0]
+            except:
+                print 'opppp', rhs
+                print rhs.root
+                raise
         # else: relation used in SET OR DELETE selection
         return ((isinstance(rhs, Constant) and rhs.type == 'etype')
                 or (isinstance(rhs, Function) and rhs.name == 'IN'))
--- a/stcheck.py	Wed Nov 03 16:43:44 2010 +0100
+++ b/stcheck.py	Thu Jan 13 21:27:38 2011 +0100
@@ -27,7 +27,7 @@
 from rql._exceptions import BadRQLQuery
 from rql.utils import function_description
 from rql.nodes import (Relation, VariableRef, Constant, Not, Exists, Function,
-                       Variable, variable_refs)
+                       And, Variable, variable_refs, make_relation)
 from rql.stmts import Union
 
 
@@ -517,7 +517,7 @@
                 for vref in term.get_nodes(VariableRef):
                     bloc_simplification(vref.variable, term)
 
-    def rewrite_shared_optional(self, exists, var):
+    def rewrite_shared_optional(self, exists, var, identity_rel_scope=None):
         """if variable is shared across multiple scopes, need some tree
         rewriting
         """
@@ -574,9 +574,14 @@
             newvar.stinfo['possibletypes'] = var.stinfo['possibletypes']
             for sol in newvar.stmt.solutions:
                 sol[newvar.name] = sol[var.name]
-        rel = exists.add_relation(var, 'identity', newvar)
+        if identity_rel_scope is None:
+            rel = exists.add_relation(var, 'identity', newvar)
+            identity_rel_scope = exists
+        else:
+            rel = make_relation(var, 'identity', (newvar,), VariableRef)
+            exists.parent.replace(exists, And(exists, Exists(rel)))
         # we have to force visit of the introduced relation
-        self.visit_relation(rel, exists)
+        self.visit_relation(rel, identity_rel_scope)
         return newvar
 
     # tree nodes ##############################################################