# HG changeset patch # User Mads Kiilerich # Date 2015-11-07 12:16:58 # Node ID 737c3704b44a8d210fddbc3dcab8bd442fa582ab # Parent b428b05e5ceac9c50d77dea14d5ca4127382e662 cleanup: fixes of checking for None Don't update repoinfo for all repos if an invalid repo is specified. diff --git a/kallithea/lib/paster_commands/update_repoinfo.py b/kallithea/lib/paster_commands/update_repoinfo.py --- a/kallithea/lib/paster_commands/update_repoinfo.py +++ b/kallithea/lib/paster_commands/update_repoinfo.py @@ -63,7 +63,7 @@ class Command(BasePasterCommand): self.options.repo_update_list.split(',')) \ if self.options.repo_update_list else None - if repo_update_list: + if repo_update_list is not None: repo_list = list(Repository.query()\ .filter(Repository.repo_name.in_(repo_update_list))) else: diff --git a/kallithea/lib/vcs/backends/git/changeset.py b/kallithea/lib/vcs/backends/git/changeset.py --- a/kallithea/lib/vcs/backends/git/changeset.py +++ b/kallithea/lib/vcs/backends/git/changeset.py @@ -287,7 +287,7 @@ class GitChangeset(BaseChangeset): cs_id = safe_str(self.id) f_path = safe_str(path) - if limit: + if limit is not None: cmd = ['log', '-n', str(safe_int(limit, 0)), '--pretty=format:%H', '-s', cs_id, '--', f_path] diff --git a/kallithea/lib/vcs/backends/hg/changeset.py b/kallithea/lib/vcs/backends/hg/changeset.py --- a/kallithea/lib/vcs/backends/hg/changeset.py +++ b/kallithea/lib/vcs/backends/hg/changeset.py @@ -256,7 +256,7 @@ class MercurialChangeset(BaseChangeset): for cs in reversed([x for x in fctx.filelog()]): cnt += 1 hist.append(hex(fctx.filectx(cs).node())) - if limit and cnt == limit: + if limit is not None and cnt == limit: break return [self.repository.get_changeset(node) for node in hist] diff --git a/kallithea/model/repo.py b/kallithea/model/repo.py --- a/kallithea/model/repo.py +++ b/kallithea/model/repo.py @@ -175,7 +175,7 @@ class RepoModel(BaseModel): @classmethod def update_repoinfo(cls, repositories=None): - if not repositories: + if repositories is None: repositories = Repository.getAll() for repo in repositories: repo.update_changeset_cache()