Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/usr/bin/env python | |
| 2 # 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 | |
| 6 """ | |
| 7 Explicitly set/remove the merge-base for the current branch. | |
| 8 | |
| 9 This manually set merge base will be a stand-in for `git merge-base` for the | |
| 10 purposes of the chromium depot_tools git extensions. If the |merge_base| | |
| 11 parameter is omitted the merge-base for this branch will be set to the | |
| 12 equivalent of `git merge-base <branch> <upstream>`. | |
| 13 """ | |
| 14 | |
| 15 import argparse | |
| 16 import sys | |
| 17 | |
| 18 from subprocess2 import CalledProcessError | |
| 19 | |
| 20 from git_common import remove_merge_base, manual_merge_base, current_branch | |
| 21 | |
| 22 | |
| 23 def main(argv): | |
| 24 parser = argparse.ArgumentParser( | |
| 25 description=__doc__.strip().splitlines()[0], | |
| 26 epilog=''.join(__doc__.strip().splitlines()[1:])) | |
| 27 parser.add_argument( | |
| 28 'merge_base', nargs='?', | |
| 29 help='The new hash to use as the merge base for the current branch' | |
| 30 ) | |
| 31 opts = parser.parse_args(argv) | |
| 32 | |
| 33 if opts.merge_base: | |
| 34 manual_merge_base(current_branch(), opts.merge_base) | |
| 35 else: | |
| 36 try: | |
| 37 remove_merge_base(current_branch()) | |
|
agable
2014/03/21 01:14:21
running this with no argument removes the tag? Tha
iannucci
2014/03/22 04:17:35
Well, the helptext does say that. I guess no args
| |
| 38 except CalledProcessError: | |
| 39 print "No merge base currently exists for this branch." | |
| 40 return 0 | |
| 41 | |
| 42 | |
| 43 if __name__ == '__main__': | |
| 44 sys.exit(main(sys.argv[1:])) | |
| OLD | NEW |