git_freezer.py 872 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/usr/bin/env python3
  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. from __future__ import print_function
  6. import sys
  7. import optparse
  8. import subcommand
  9. from git_common import freeze, thaw
  10. def CMDfreeze(parser, args):
  11. """Freeze a branch's changes."""
  12. parser.parse_args(args)
  13. return freeze()
  14. def CMDthaw(parser, args):
  15. """Returns a frozen branch to the state before it was frozen."""
  16. parser.parse_args(args)
  17. return thaw()
  18. def main(args):
  19. dispatcher = subcommand.CommandDispatcher(__name__)
  20. ret = dispatcher.execute(optparse.OptionParser(), args)
  21. if ret:
  22. print(ret)
  23. return 0
  24. if __name__ == '__main__':
  25. try:
  26. sys.exit(main(sys.argv[1:]))
  27. except KeyboardInterrupt:
  28. sys.stderr.write('interrupted\n')
  29. sys.exit(1)