# HG changeset patch # User Sylvain Thénault # Date 1295460904 -3600 # Node ID 824d5b6eae7fd40ec70fadeb8451a4c871b65b27 # Parent 5a0c2cfc19bf3f649a5acd0e920ab58b298d67a7 [repo] kill no more needed 'recreate' feature diff -r 5a0c2cfc19bf -r 824d5b6eae7f devtools/fake.py --- a/devtools/fake.py Wed Jan 19 12:47:08 2011 +0100 +++ b/devtools/fake.py Wed Jan 19 19:15:04 2011 +0100 @@ -185,8 +185,7 @@ def internal_session(self): return FakeSession(self) - def extid2eid(self, source, extid, etype, session, insert=True, - recreate=False): + def extid2eid(self, source, extid, etype, session, insert=True): try: return self.extids[extid] except KeyError: diff -r 5a0c2cfc19bf -r 824d5b6eae7f server/repository.py --- a/server/repository.py Wed Jan 19 12:47:08 2011 +0100 +++ b/server/repository.py Wed Jan 19 19:15:04 2011 +0100 @@ -1016,8 +1016,7 @@ raise UnknownEid(eid) return extid - def extid2eid(self, source, extid, etype, session=None, insert=True, - recreate=False): + def extid2eid(self, source, extid, etype, session=None, insert=True): """get eid from a local id. An eid is attributed if no record is found""" cachekey = (extid, source.uri) try: @@ -1032,16 +1031,6 @@ if eid is not None: self._extid_cache[cachekey] = eid self._type_source_cache[eid] = (etype, source.uri, extid) - # XXX used with extlite (eg vcsfile), probably not needed anymore - if recreate: - entity = source.before_entity_insertion(session, extid, etype, eid) - entity._cw_recreating = True - if source.should_call_hooks: - self.hm.call_hooks('before_add_entity', session, entity=entity) - # XXX add fti op ? - source.after_entity_insertion(session, extid, entity) - if source.should_call_hooks: - self.hm.call_hooks('after_add_entity', session, entity=entity) if reset_pool: session.reset_pool() return eid diff -r 5a0c2cfc19bf -r 824d5b6eae7f server/sources/native.py --- a/server/sources/native.py Wed Jan 19 12:47:08 2011 +0100 +++ b/server/sources/native.py Wed Jan 19 19:15:04 2011 +0100 @@ -886,20 +886,19 @@ 'source': source.uri, 'mtime': datetime.now()} self.doexec(session, self.sqlgen.insert('entities', attrs), attrs) # insert core relations: is, is_instance_of and cw_source - if not hasattr(entity, '_cw_recreating'): - try: - self.doexec(session, 'INSERT INTO is_relation(eid_from,eid_to) VALUES (%s,%s)' - % (entity.eid, eschema_eid(session, entity.e_schema))) - except IndexError: - # during schema serialization, skip - pass - else: - for eschema in entity.e_schema.ancestors() + [entity.e_schema]: - self.doexec(session, 'INSERT INTO is_instance_of_relation(eid_from,eid_to) VALUES (%s,%s)' - % (entity.eid, eschema_eid(session, eschema))) - if 'CWSource' in self.schema and source.eid is not None: # else, cw < 3.10 - self.doexec(session, 'INSERT INTO cw_source_relation(eid_from,eid_to) ' - 'VALUES (%s,%s)' % (entity.eid, source.eid)) + try: + self.doexec(session, 'INSERT INTO is_relation(eid_from,eid_to) VALUES (%s,%s)' + % (entity.eid, eschema_eid(session, entity.e_schema))) + except IndexError: + # during schema serialization, skip + pass + else: + for eschema in entity.e_schema.ancestors() + [entity.e_schema]: + self.doexec(session, 'INSERT INTO is_instance_of_relation(eid_from,eid_to) VALUES (%s,%s)' + % (entity.eid, eschema_eid(session, eschema))) + if 'CWSource' in self.schema and source.eid is not None: # else, cw < 3.10 + self.doexec(session, 'INSERT INTO cw_source_relation(eid_from,eid_to) ' + 'VALUES (%s,%s)' % (entity.eid, source.eid)) # now we can update the full text index if self.do_fti and self.need_fti_indexation(entity.__regid__): if complete: