blob: d0853074d78ca9a5b7eb1607ae9bdd2309f2efe3 [file] [log] [blame]
Josip Sokcevic4de5dea2022-03-23 21:15:14 +00001#!/usr/bin/env python3
sammc@chromium.org900a33f2015-09-29 06:57:09 +00002# Copyright 2015 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.
sammc@chromium.org900a33f2015-09-29 06:57:09 +00005
6import argparse
sammc@chromium.org900a33f2015-09-29 06:57:09 +00007
Edward Lesmes1ea23332021-02-01 17:48:56 +00008_HELP_MESSAGE = """\
9git drover has been deprecated in favor of cherry-picking using Gerrit.
10Try it, it's faster!
sammc@chromium.org89901892015-11-03 00:57:48 +000011
Edward Lesmes1ea23332021-02-01 17:48:56 +000012See https://www.chromium.org/developers/how-tos/drover for instructions.
sammc@chromium.org89901892015-11-03 00:57:48 +000013
Edward Lesmes1ea23332021-02-01 17:48:56 +000014If the Gerrit UI is not sufficient, and you know what you're doing:
15 git checkout -b branch-name refs/remotes/branch-heads/{branch}
16 git cherry-pick -x {cherry_pick}
sammc@chromium.org89901892015-11-03 00:57:48 +000017
Edward Lesmes1ea23332021-02-01 17:48:56 +000018If you have to do a lot of merges, consider using multiple working directories
19in your checkout:
20https://www.chromium.org/developers/how-tos/get-the-code/multiple-working-directories
sammc@chromium.org89901892015-11-03 00:57:48 +000021"""
22
23
sammc@chromium.org900a33f2015-09-29 06:57:09 +000024def main():
Mike Frysinger124bb8e2023-09-06 05:48:55 +000025 parser = argparse.ArgumentParser(description=_HELP_MESSAGE)
26 parser.add_argument(
27 '--branch',
28 default='BRANCH',
29 metavar='BRANCH',
30 type=str,
31 help='the name of the branch to which to cherry-pick; e.g. 1234')
32 parser.add_argument(
33 '--cherry-pick',
34 default='HASH_OF_THE_COMMIT_TO_CHERRY_PICK',
35 metavar='HASH_OF_THE_COMMIT_TO_CHERRY_PICK',
36 type=str,
37 help=('the change to cherry-pick; this can be any string '
38 'that unambiguosly refers to a revision not involving HEAD'))
39 options, _ = parser.parse_known_args()
sammc@chromium.org900a33f2015-09-29 06:57:09 +000040
Mike Frysinger124bb8e2023-09-06 05:48:55 +000041 print(
42 _HELP_MESSAGE.format(branch=options.branch,
43 cherry_pick=options.cherry_pick))
44
sammc@chromium.org900a33f2015-09-29 06:57:09 +000045
46if __name__ == '__main__':
Mike Frysinger124bb8e2023-09-06 05:48:55 +000047 main()