blob: 9b9485ab07396193c1e73b75b3c1cbeb333ba4cf [file] [log] [blame]
Josip Sokcevic4de5dea2022-03-23 21:15:14 +00001#!/usr/bin/env python3
iannucci@chromium.orgc050a5b2014-03-26 06:18:50 +00002# Copyright 2014 The Chromium Authors. All rights reserved.
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6import argparse
7import sys
8
sbc@chromium.org71437c02015-04-09 19:29:40 +00009import git_common
iannucci@chromium.orgc050a5b2014-03-26 06:18:50 +000010
11def main(args):
12 parser = argparse.ArgumentParser()
13 parser.add_argument(
Alan Cutter00017822016-12-20 17:39:59 +110014 '-m', '--message', metavar='<msg>', default=None,
iannucci@chromium.orgc050a5b2014-03-26 06:18:50 +000015 help='Use the given <msg> as the first line of the commit message.')
16 opts = parser.parse_args(args)
sbc@chromium.org71437c02015-04-09 19:29:40 +000017 if git_common.is_dirty_git_tree('squash-branch'):
18 return 1
19 git_common.squash_current_branch(opts.message)
sbc@chromium.org013731e2015-02-26 18:28:43 +000020 return 0
21
iannucci@chromium.orgc050a5b2014-03-26 06:18:50 +000022
23if __name__ == '__main__':
sbc@chromium.org013731e2015-02-26 18:28:43 +000024 try:
25 sys.exit(main(sys.argv[1:]))
26 except KeyboardInterrupt:
27 sys.stderr.write('interrupted\n')
28 sys.exit(1)