156 self.oldsource.reset_caches() |
156 self.oldsource.reset_caches() |
157 repo = self.session.repo |
157 repo = self.session.repo |
158 entity = self.entity |
158 entity = self.entity |
159 extid = entity.cw_metainformation()['extid'] |
159 extid = entity.cw_metainformation()['extid'] |
160 repo._type_source_cache[entity.eid] = ( |
160 repo._type_source_cache[entity.eid] = ( |
161 entity.__regid__, self.newsource.uri, None, self.newsource.uri) |
161 entity.cw_etype, self.newsource.uri, None, self.newsource.uri) |
162 if self.oldsource.copy_based_source: |
162 if self.oldsource.copy_based_source: |
163 uri = 'system' |
163 uri = 'system' |
164 else: |
164 else: |
165 uri = self.oldsource.uri |
165 uri = self.oldsource.uri |
166 repo._extid_cache[(extid, uri)] = -entity.eid |
166 repo._extid_cache[(extid, uri)] = -entity.eid |
214 # source='system'. External source will then have consider case |
214 # source='system'. External source will then have consider case |
215 # where `extid2eid` return a negative eid as 'this entity was known |
215 # where `extid2eid` return a negative eid as 'this entity was known |
216 # but has been moved, ignore it'. |
216 # but has been moved, ignore it'. |
217 self._cw.system_sql('UPDATE entities SET eid=-eid WHERE eid=%(eid)s', |
217 self._cw.system_sql('UPDATE entities SET eid=-eid WHERE eid=%(eid)s', |
218 {'eid': self.eidfrom}) |
218 {'eid': self.eidfrom}) |
219 attrs = {'type': entity.__regid__, 'eid': entity.eid, 'extid': None, |
219 attrs = {'type': entity.cw_etype, 'eid': entity.eid, 'extid': None, |
220 'source': 'system', 'asource': 'system', |
220 'source': 'system', 'asource': 'system', |
221 'mtime': datetime.now()} |
221 'mtime': datetime.now()} |
222 self._cw.system_sql(syssource.sqlgen.insert('entities', attrs), attrs) |
222 self._cw.system_sql(syssource.sqlgen.insert('entities', attrs), attrs) |
223 # register an operation to update repository/sources caches |
223 # register an operation to update repository/sources caches |
224 ChangeEntityUpdateCaches(self._cw, entity=entity, |
224 ChangeEntityUpdateCaches(self._cw, entity=entity, |