changeset 2:22ccc05756de

don't waste time scanning repos that appear to have no recent activity Ignore-this: 9a29d293662729aa46d775c4b5d31146
author drewp@bigasterisk.com
date Tue, 08 Jan 2013 23:41:13 -0800
parents 1da34eecdfd8
children 4077903a9520
files sync.py
diffstat 1 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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()