Some more fixes to the script
Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
This commit is contained in:
parent
c825ebf5a0
commit
cab27352d2
1 changed files with 5 additions and 6 deletions
|
@ -57,7 +57,7 @@ def is_valid_hook(hook, target_link):
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
||||||
def process_namespace(namespace):
|
def process_namespace(namespace, check):
|
||||||
""" Process all the git repo in a specified namespace. """
|
""" Process all the git repo in a specified namespace. """
|
||||||
target_link = _target_link
|
target_link = _target_link
|
||||||
if namespace == 'forks':
|
if namespace == 'forks':
|
||||||
|
@ -66,7 +66,7 @@ def process_namespace(namespace):
|
||||||
print('Processing: %s' % namespace)
|
print('Processing: %s' % namespace)
|
||||||
path = os.path.join(_base_path, namespace)
|
path = os.path.join(_base_path, namespace)
|
||||||
if not os.path.isdir(path):
|
if not os.path.isdir(path):
|
||||||
continue
|
return
|
||||||
|
|
||||||
for dirpath, dirnames, filenames in os.walk(path):
|
for dirpath, dirnames, filenames in os.walk(path):
|
||||||
# Don't go down the .git repos
|
# Don't go down the .git repos
|
||||||
|
@ -79,7 +79,7 @@ def process_namespace(namespace):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
hook = os.path.join(repo_path, 'hooks', 'post-receive')
|
hook = os.path.join(repo_path, 'hooks', 'post-receive')
|
||||||
if not is_valid_hook(hook, target_link) and not args.check:
|
if not is_valid_hook(hook, target_link) and not check:
|
||||||
fix_link(hook, target_link)
|
fix_link(hook, target_link)
|
||||||
|
|
||||||
|
|
||||||
|
@ -111,13 +111,12 @@ def main():
|
||||||
fix_link(hook, target_link)
|
fix_link(hook, target_link)
|
||||||
|
|
||||||
elif args.namespace:
|
elif args.namespace:
|
||||||
process_namespace(args.namespace)
|
process_namespace(args.namespace, args.check)
|
||||||
else:
|
else:
|
||||||
# Check all repos
|
# Check all repos
|
||||||
for namespace in namespaces:
|
for namespace in namespaces:
|
||||||
process_namespace(namespace)
|
process_namespace(namespace, args.check)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
sys.exit(main())
|
sys.exit(main())
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue