bitbucket: Fix full lister with fallback [start, end] if not provided
Related T1826
This commit is contained in:
parent
b3463ecddc
commit
e129e48c31
1 changed files with 18 additions and 1 deletions
|
@ -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')
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue