From 336061bcd623f77112df2371e75e030f216f1341 Mon Sep 17 00:00:00 2001 From: Andy Doan Date: Mon, 7 Nov 2016 11:41:20 -0600 Subject: bugs found while debug last commmit Change-Id: Id7bc4bd2997c9998de4cf8f89b33cdd4040fe57a --- grok-cron.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'grok-cron.py') 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) -- cgit v1.2.3