# HG changeset patch # User Marcin Kuzminski # Date 2013-02-19 18:48:45 # Node ID 95c38de476a7339165ac6a4f465b0ee2425dacd3 # Parent c8fd8cca71f29cf6995415af9733201cddd05c31 cleanup would recurse into every leaf and could thus not be used on lots of large repositories. diff --git a/rhodecode/lib/paster_commands/cleanup.py b/rhodecode/lib/paster_commands/cleanup.py --- a/rhodecode/lib/paster_commands/cleanup.py +++ b/rhodecode/lib/paster_commands/cleanup.py @@ -85,10 +85,17 @@ class Command(BasePasterCommand): repos_location = RhodeCodeUi.get_repos_location() to_remove = [] for dn, dirs, f in os.walk(safe_str(repos_location)): - for loc in dirs: + alldirs = list(dirs) + del dirs[:] + if ('.hg' in alldirs or + 'objects' in alldirs and ('refs' in alldirs or 'packed-refs' in f)): + continue + for loc in alldirs: if REMOVED_REPO_PAT.match(loc): to_remove.append([os.path.join(dn, loc), self._extract_date(loc)]) + else: + dirs.append(loc) #filter older than (if present)! now = datetime.datetime.now()