# HG changeset patch # User drewp@bigasterisk.com # Date 1357717273 28800 # Node ID 22ccc05756de72bea21731f77e05db4ee59b42e0 # Parent 1da34eecdfd852cbcc33fb23819ee53d6b259579 don't waste time scanning repos that appear to have no recent activity Ignore-this: 9a29d293662729aa46d775c4b5d31146 diff -r 1da34eecdfd8 -r 22ccc05756de sync.py --- a/sync.py Tue Jan 08 23:40:24 2013 -0800 +++ b/sync.py Tue Jan 08 23:41:13 2013 -0800 @@ -10,6 +10,14 @@ self.config = config self.gh = gh self.name = name + + def darcsTime(self): + j = os.path.join + darcsPriv = j(self.config['darcsDir'], self.name, '_darcs') + for n in ['inventory', 'hashed_inventory']: + if os.path.exists(j(darcsPriv, n)): + return os.path.getmtime(j(darcsPriv, n)) + raise ValueError("can't find a darcs time") def gitDir(self): gitDir = os.path.join(self.config['gitSyncDir'], self.name) @@ -56,12 +64,14 @@ gh = Github(config['gitHubToken']).get_user() for proj in os.listdir(config['darcsDir']): - if 'repo' not in proj: - continue if not os.path.isdir(os.path.join(config['darcsDir'], proj)): continue try: p = Project(config, gh, proj) + + if p.darcsTime() < time.time() - 86400*config['tooOldDays']: + continue + log.info("syncing %s" % proj) p.syncToLocalGit() p.makeGitHubRepo()