git_drover.py 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/usr/bin/env python3
  2. # 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.
  5. from __future__ import print_function
  6. import argparse
  7. _HELP_MESSAGE = """\
  8. git drover has been deprecated in favor of cherry-picking using Gerrit.
  9. Try it, it's faster!
  10. See https://www.chromium.org/developers/how-tos/drover for instructions.
  11. If the Gerrit UI is not sufficient, and you know what you're doing:
  12. git checkout -b branch-name refs/remotes/branch-heads/{branch}
  13. git cherry-pick -x {cherry_pick}
  14. If you have to do a lot of merges, consider using multiple working directories
  15. in your checkout:
  16. https://www.chromium.org/developers/how-tos/get-the-code/multiple-working-directories
  17. """
  18. def main():
  19. parser = argparse.ArgumentParser(description=_HELP_MESSAGE)
  20. parser.add_argument(
  21. '--branch',
  22. default='BRANCH',
  23. metavar='BRANCH',
  24. type=str,
  25. help='the name of the branch to which to cherry-pick; e.g. 1234')
  26. parser.add_argument(
  27. '--cherry-pick',
  28. default='HASH_OF_THE_COMMIT_TO_CHERRY_PICK',
  29. metavar='HASH_OF_THE_COMMIT_TO_CHERRY_PICK',
  30. type=str,
  31. help=('the change to cherry-pick; this can be any string '
  32. 'that unambiguosly refers to a revision not involving HEAD'))
  33. options, _ = parser.parse_known_args()
  34. print(_HELP_MESSAGE.format(
  35. branch=options.branch, cherry_pick=options.cherry_pick))
  36. if __name__ == '__main__':
  37. main()