blob: 7f54443855cb59653d30d4b3abf353c4c0d85153 [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
Mike Frysinger124bb8e2023-09-06 05:48:55 +000011
iannucci@chromium.orgc050a5b2014-03-26 06:18:50 +000012def main(args):
Mike Frysinger124bb8e2023-09-06 05:48:55 +000013 parser = argparse.ArgumentParser()
14 parser.add_argument(
15 '-m',
16 '--message',
17 metavar='<msg>',
18 default=None,
19 help='Use the given <msg> as the first line of the commit message.')
20 opts = parser.parse_args(args)
21 if git_common.is_dirty_git_tree('squash-branch'):
22 return 1
23 git_common.squash_current_branch(opts.message)
24 return 0
sbc@chromium.org013731e2015-02-26 18:28:43 +000025
iannucci@chromium.orgc050a5b2014-03-26 06:18:50 +000026
27if __name__ == '__main__':
Mike Frysinger124bb8e2023-09-06 05:48:55 +000028 try:
29 sys.exit(main(sys.argv[1:]))
30 except KeyboardInterrupt:
31 sys.stderr.write('interrupted\n')
32 sys.exit(1)