git_freezer.py 911 B

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