Changeset View
Changeset View
Standalone View
Standalone View
swh/web/tests/testcase.py
Show First 20 Lines • Show All 141 Lines • ▼ Show 20 Lines | def snapshot_get(self, snapshot_id): | ||||
return converters.from_snapshot(snp) | return converters.from_snapshot(snp) | ||||
def snapshot_get_branches(self, snapshot_id, branches_from='', | def snapshot_get_branches(self, snapshot_id, branches_from='', | ||||
branches_count=1000, target_types=None): | branches_count=1000, target_types=None): | ||||
snp = self.storage.snapshot_get_branches( | snp = self.storage.snapshot_get_branches( | ||||
hash_to_bytes(snapshot_id), branches_from.encode(), | hash_to_bytes(snapshot_id), branches_from.encode(), | ||||
branches_count, target_types) | branches_count, target_types) | ||||
return converters.from_snapshot(snp) | return converters.from_snapshot(snp) | ||||
def snapshot_get_head(self, snapshot): | |||||
if snapshot['branches']['HEAD']['target_type'] == 'alias': | |||||
target = snapshot['branches']['HEAD']['target'] | |||||
head = snapshot['branches'][target]['target'] | |||||
else: | |||||
head = snapshot['branches']['HEAD']['target'] | |||||
return head |