Skip to content
Snippets Groups Projects
Verified Commit e129e48c authored by Antoine R. Dumont's avatar Antoine R. Dumont
Browse files

bitbucket: Fix full lister with fallback [start, end] if not provided

Related T1826
parent b3463ecd
No related branches found
Tags v0.0.23
1 merge request!75bitbucket: Fix full lister with fallback [start, end] if not provided
......@@ -2,10 +2,12 @@
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
from urllib import parse
import datetime
import logging
import iso8601
from urllib import parse
from swh.lister.bitbucket.models import BitBucketModel
from swh.lister.core.indexing_lister import IndexingHttpLister
......@@ -39,6 +41,21 @@ class BitBucketLister(IndexingHttpLister):
repos = response.json()['values']
return [self.get_model_from_repo(repo) for repo in repos]
def db_first_index(self):
"""For the first time listing, there is no data in db, so fallback to the
bitbucket starting year.
"""
return super().db_first_index() or '2008-01-01T00:00:00Z'
def db_last_index(self):
"""For the first time listing, there is no data in db, so fallback to the time
of the first run as max date.
"""
return super().db_last_index() or datetime.datetime.now(
tz=datetime.timezone.utc).isoformat()
def request_uri(self, identifier):
return super().request_uri(identifier or '1970-01-01')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment