diff --git a/docs/changelog.rst b/docs/changelog.rst --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -18,6 +18,8 @@ fixes +++++ - fixed some python2.5 compatibility issues +- fixed issues with removed repos was accidentally added as groups, after + full rescan of paths 1.3.2 (**2012-02-28**) ---------------------- diff --git a/rhodecode/lib/utils.py b/rhodecode/lib/utils.py --- a/rhodecode/lib/utils.py +++ b/rhodecode/lib/utils.py @@ -24,6 +24,7 @@ # along with this program. If not, see . import os +import re import logging import datetime import traceback @@ -56,6 +57,8 @@ from rhodecode.model.repos_group import log = logging.getLogger(__name__) +REMOVED_REPO_PAT = re.compile(r'rm__\d{8}_\d{6}_\d{6}__.*') + def recursive_replace(str_, replace=' '): """Recursive replace of given sign to just one instance @@ -393,6 +396,10 @@ def map_groups(groups): # group = rgm.create(group_name, desc, parent, just_db=True) # sa.commit() + # skip folders that are now removed repos + if REMOVED_REPO_PAT.match(group_name): + break + if group is None: log.debug('creating group level: %s group_name: %s' % (lvl, group_name)) group = RepoGroup(group_name, parent) diff --git a/rhodecode/model/scm.py b/rhodecode/model/scm.py --- a/rhodecode/model/scm.py +++ b/rhodecode/model/scm.py @@ -38,7 +38,7 @@ from rhodecode.lib import helpers as h from rhodecode.lib import safe_str from rhodecode.lib.auth import HasRepoPermissionAny, HasReposGroupPermissionAny from rhodecode.lib.utils import get_repos as get_filesystem_repos, make_ui, \ - action_logger, EmptyChangeset + action_logger, EmptyChangeset, REMOVED_REPO_PAT from rhodecode.model import BaseModel from rhodecode.model.db import Repository, RhodeCodeUi, CacheInvalidation, \ UserFollowing, UserLog, User, RepoGroup @@ -182,6 +182,9 @@ class ScmModel(BaseModel): repos = {} for name, path in get_filesystem_repos(repos_path, recursive=True): + # skip removed repos + if REMOVED_REPO_PAT.match(name): + continue # name need to be decomposed and put back together using the / # since this is internal storage separator for rhodecode