# HG changeset patch # User Mads Kiilerich # Date 1584029248 -3600 # Node ID 38a833e742ea75bf90ade327a5ee78861a12014f # Parent 75e2d061385a6c6c679f6505c0169ff34601c93a cli: fix indexing of repos where last indexed revision has been stripped diff -r 75e2d061385a -r 38a833e742ea kallithea/lib/indexers/daemon.py --- a/kallithea/lib/indexers/daemon.py Thu Mar 12 17:06:56 2020 +0100 +++ b/kallithea/lib/indexers/daemon.py Thu Mar 12 17:07:28 2020 +0100 @@ -40,7 +40,7 @@ from kallithea.config.conf import INDEX_EXTENSIONS, INDEX_FILENAMES from kallithea.lib.indexers import CHGSET_IDX_NAME, CHGSETS_SCHEMA, IDX_NAME, SCHEMA from kallithea.lib.utils2 import safe_str -from kallithea.lib.vcs.exceptions import ChangesetError, NodeDoesNotExistError, RepositoryError +from kallithea.lib.vcs.exceptions import ChangesetDoesNotExistError, ChangesetError, NodeDoesNotExistError, RepositoryError from kallithea.model.db import Repository from kallithea.model.scm import ScmModel @@ -299,7 +299,11 @@ # assuming that there is only one result, if not this # may require a full re-index. start_id = results[0]['raw_id'] - last_rev = repo.get_changeset(revision=start_id).revision + try: + last_rev = repo.get_changeset(revision=start_id).revision + except ChangesetDoesNotExistError: + log.error('previous last revision %s not found - indexing from scratch', start_id) + start_id = None # there are new changesets to index or a new repo to index if last_rev == 0 or num_of_revs > last_rev + 1: