Read about our upcoming Code of Conduct on this issue

Commit 6a33333a authored by Georges Racinet's avatar Georges Racinet 🦑
Browse files

convert-git-tags-push: replaced sys.exit() by early returns

parent 09ac40556b6c
......@@ -59,7 +59,7 @@
dirty = check_output(('hg', 'status', '-mard')).strip()
if dirty:
logger.error("Repository %r has local modifications. Aborting.", repo)
sys.exit(1)
return 1
logger.info("Updating repository %r to the %r branch",
repo, GIT_TAGS_BRANCH)
......@@ -74,7 +74,8 @@
diff = check_output(('hg', 'diff'))
if not(diff.strip()):
logger.warning("Empty diff, nothing to do, see you next time.")
sys.exit(0)
return 0
remote = check_output(('hg', 'config', 'paths.default')).strip().decode()
sys.stdout.buffer.write(diff)
......@@ -83,7 +84,7 @@
if confirmation.strip() != 'YES':
revert()
logger.warning("Not confirmed, changes reverted. Bye")
sys.exit(0)
return 0
if simulate:
logger.info("Simulation mode: reverting .hgtags")
......@@ -106,6 +107,7 @@
logger.warning("End of simulation, hope you enjoyed it. Bye")
else:
logger.warning("Changes committed and pushed. Bye")
return 0
if __name__ == '__main__':
......@@ -109,4 +111,4 @@
if __name__ == '__main__':
main()
sys.exit(main())
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment