+git_root = subprocess.check_output(['git', 'rev-parse', '--show-toplevel'],
+ universal_newlines=True).rstrip('\n')
+os.chdir(git_root)
+
+parser = argparse.ArgumentParser(description='Set commit date')
+parser.add_argument('-a', '--author', '--author-date',
+ action='store_true')
+parser.add_argument('-c', '--committer', '--committer-date',
+ action='store_true')
+args = parser.parse_args()
+
+if args.author and args.committer:
+ parser.print_help()
+ sys.exit("Use only one of `-a' or `-c' but not both")
+
+if args.author:
+ date_format = 'a'
+else:
+ date_format = 'c' # This is the default
+