Changeset - 00cac9e13622
[Not reviewed]
stable
0 1 0
Mads Kiilerich - 9 years ago 2017-01-22 01:16:52
madski@unity3d.com
Grafted from: 347f38529080
cleanup: make sure the kind of repos found by scanning also are ignored for cleanup - don't recurse into non-bare git or svn repos
1 file changed with 2 insertions and 0 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/paster_commands/cleanup.py
Show inline comments
 
@@ -80,24 +80,26 @@ class Command(BasePasterCommand):
 
        return datetime.datetime.strptime(date_part, '%Y%m%d_%H%M%S')
 

	
 
    def command(self):
 
        #get SqlAlchemy session
 
        self._init_session()
 

	
 
        repos_location = Ui.get_repos_location()
 
        to_remove = []
 
        for dn_, dirs, f in os.walk(safe_str(repos_location)):
 
            alldirs = list(dirs)
 
            del dirs[:]
 
            if ('.hg' in alldirs or
 
                '.git' in alldirs or
 
                '.svn' 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()
 
        older_than = self.options.older_than
0 comments (0 inline, 0 general)