OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 # Copyright (C) 2008 Evan Martin <martine@danga.com> | 6 # Copyright (C) 2008 Evan Martin <martine@danga.com> |
7 | 7 |
8 """A git-command for integrating reviews on Rietveld.""" | 8 """A git-command for integrating reviews on Rietveld.""" |
9 | 9 |
10 import json | 10 import json |
(...skipping 1779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1790 def CMDset_commit(parser, args): | 1790 def CMDset_commit(parser, args): |
1791 """set the commit bit""" | 1791 """set the commit bit""" |
1792 _, args = parser.parse_args(args) | 1792 _, args = parser.parse_args(args) |
1793 if args: | 1793 if args: |
1794 parser.error('Unrecognized args: %s' % ' '.join(args)) | 1794 parser.error('Unrecognized args: %s' % ' '.join(args)) |
1795 cl = Changelist() | 1795 cl = Changelist() |
1796 cl.SetFlag('commit', '1') | 1796 cl.SetFlag('commit', '1') |
1797 return 0 | 1797 return 0 |
1798 | 1798 |
1799 | 1799 |
| 1800 def CMDset_close(parser, args): |
| 1801 """close the issue""" |
| 1802 _, args = parser.parse_args(args) |
| 1803 if args: |
| 1804 parser.error('Unrecognized args: %s' % ' '.join(args)) |
| 1805 cl = Changelist() |
| 1806 # Ensure there actually is an issue to close. |
| 1807 cl.GetDescription() |
| 1808 cl.CloseIssue() |
| 1809 return 0 |
| 1810 |
| 1811 |
1800 def Command(name): | 1812 def Command(name): |
1801 return getattr(sys.modules[__name__], 'CMD' + name, None) | 1813 return getattr(sys.modules[__name__], 'CMD' + name, None) |
1802 | 1814 |
1803 | 1815 |
1804 def CMDhelp(parser, args): | 1816 def CMDhelp(parser, args): |
1805 """print list of commands or help for a specific command""" | 1817 """print list of commands or help for a specific command""" |
1806 _, args = parser.parse_args(args) | 1818 _, args = parser.parse_args(args) |
1807 if len(args) == 1: | 1819 if len(args) == 1: |
1808 return main(args + ['--help']) | 1820 return main(args + ['--help']) |
1809 parser.print_help() | 1821 parser.print_help() |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1871 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) | 1883 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) |
1872 | 1884 |
1873 # Not a known command. Default to help. | 1885 # Not a known command. Default to help. |
1874 GenUsage(parser, 'help') | 1886 GenUsage(parser, 'help') |
1875 return CMDhelp(parser, argv) | 1887 return CMDhelp(parser, argv) |
1876 | 1888 |
1877 | 1889 |
1878 if __name__ == '__main__': | 1890 if __name__ == '__main__': |
1879 fix_encoding.fix_encoding() | 1891 fix_encoding.fix_encoding() |
1880 sys.exit(main(sys.argv[1:])) | 1892 sys.exit(main(sys.argv[1:])) |
OLD | NEW |