aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xgrok-cron.py19
1 files changed, 16 insertions, 3 deletions
diff --git a/grok-cron.py b/grok-cron.py
index 37efbb1..9a4eba8 100755
--- a/grok-cron.py
+++ b/grok-cron.py
@@ -16,6 +16,21 @@ logging.basicConfig(level=logging.INFO)
log = logging.getLogger('grok-cron')
+def _can_mirror(full_path):
+ # we have a couple of old symlinks set up, that we don't have
+ # to manage via grokmirror
+ if os.path.isdir(full_path) and not os.path.islink(full_path):
+ if os.path.exists(os.path.join(full_path, 'noweb')):
+ return False
+ if len(os.listdir(os.path.join(full_path, 'refs/heads'))) == 0:
+ # grokmirror won't add these to the manifest (although it should)
+ # these are typicall Gerrit project holders with:
+ # HEAD=refs/meta/config
+ return False
+ return True
+ return False
+
+
def handle_unmanaged(manifile, manifest_repos, repo_dir, dryrun):
'''Handle repos that have been moved and not picked up by grokmirror.
This can happen when ITS moves a repo from one user's account to another
@@ -29,9 +44,7 @@ def handle_unmanaged(manifile, manifest_repos, repo_dir, dryrun):
for repo in repos.splitlines():
repo = repo.strip() + '.git'
full_path = os.path.join(repo_dir, repo)
- # we have a couple of old symlinks set up, that we don't have
- # to manage via grokmirror
- if os.path.isdir(full_path) and not os.path.islink(full_path):
+ if _can_mirror(full_path):
if repo not in manifest_repos and repo not in EXCLUDES:
missing.append(repo)