Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/svn/loader.py
Show First 20 Lines • Show All 534 Lines • ▼ Show 20 Lines | Local repository not cleaned up for investigation: %s''' % ( | ||||
def store_data(self): | def store_data(self): | ||||
"""We store the data accumulated in internal instance variable. If | """We store the data accumulated in internal instance variable. If | ||||
the iteration over the svn revisions is done, we create the | the iteration over the svn revisions is done, we create the | ||||
snapshot and flush to storage the data. | snapshot and flush to storage the data. | ||||
This also resets the internal instance variable state. | This also resets the internal instance variable state. | ||||
""" | """ | ||||
self.maybe_load_contents(self._contents) | self.send_contents(self._contents) | ||||
self.maybe_load_directories(self._directories) | self.send_directories(self._directories) | ||||
self.maybe_load_revisions(self._revisions) | self.send_revisions(self._revisions) | ||||
if self.done: # finish line, snapshot! | if self.done: # finish line, snapshot! | ||||
self.generate_and_load_snapshot(revision=self._last_revision, | self.generate_and_load_snapshot(revision=self._last_revision, | ||||
snapshot=self._snapshot) | snapshot=self._snapshot) | ||||
self.flush() | self.flush() | ||||
self._contents = [] | self._contents = [] | ||||
self._directories = [] | self._directories = [] | ||||
Show All 13 Lines | def generate_and_load_snapshot(self, revision=None, snapshot=None): | ||||
if revision: # Priority to the revision | if revision: # Priority to the revision | ||||
snap = build_swh_snapshot(revision['id']) | snap = build_swh_snapshot(revision['id']) | ||||
snap['id'] = identifier_to_bytes(snapshot_identifier(snap)) | snap['id'] = identifier_to_bytes(snapshot_identifier(snap)) | ||||
elif snapshot: # Fallback to prior snapshot | elif snapshot: # Fallback to prior snapshot | ||||
snap = snapshot | snap = snapshot | ||||
else: | else: | ||||
return None | return None | ||||
self.log.debug('snapshot: %s' % snap) | self.log.debug('snapshot: %s' % snap) | ||||
self.maybe_load_snapshot(snap) | self.send_snapshot(snap) | ||||
def load_status(self): | def load_status(self): | ||||
return { | return { | ||||
'status': self._load_status, | 'status': self._load_status, | ||||
} | } | ||||
def visit_status(self): | def visit_status(self): | ||||
return self._visit_status | return self._visit_status | ||||
▲ Show 20 Lines • Show All 182 Lines • Show Last 20 Lines |