changeset 2069:003c504da933 beta

fixed issues with removed repos was accidentally added as groups, after full rescan of paths
author Marcin Kuzminski <marcin@python-works.com>
date Wed, 29 Feb 2012 02:57:57 +0200
parents f664d3b57fa4
children 8330d5778ba3
files docs/changelog.rst rhodecode/lib/utils.py rhodecode/model/scm.py
diffstat 3 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/docs/changelog.rst	Wed Feb 29 02:38:14 2012 +0200
+++ b/docs/changelog.rst	Wed Feb 29 02:57:57 2012 +0200
@@ -18,6 +18,8 @@
 +++++
 
 - 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**)
 ----------------------
--- a/rhodecode/lib/utils.py	Wed Feb 29 02:38:14 2012 +0200
+++ b/rhodecode/lib/utils.py	Wed Feb 29 02:57:57 2012 +0200
@@ -24,6 +24,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 import os
+import re
 import logging
 import datetime
 import traceback
@@ -56,6 +57,8 @@
 
 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 @@
 #            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)
--- a/rhodecode/model/scm.py	Wed Feb 29 02:38:14 2012 +0200
+++ b/rhodecode/model/scm.py	Wed Feb 29 02:57:57 2012 +0200
@@ -38,7 +38,7 @@
 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 @@
         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