git_drover.py 1.5 KB

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