OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # coding: utf-8 | 2 # coding: utf-8 |
3 # | 3 # |
4 # Copyright 2007 Google Inc. | 4 # Copyright 2007 Google Inc. |
5 # | 5 # |
6 # Licensed under the Apache License, Version 2.0 (the "License"); | 6 # Licensed under the Apache License, Version 2.0 (the "License"); |
7 # you may not use this file except in compliance with the License. | 7 # you may not use this file except in compliance with the License. |
8 # You may obtain a copy of the License at | 8 # You may obtain a copy of the License at |
9 # | 9 # |
10 # http://www.apache.org/licenses/LICENSE-2.0 | 10 # http://www.apache.org/licenses/LICENSE-2.0 |
(...skipping 2422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2433 if options.target_ref: | 2433 if options.target_ref: |
2434 form_fields.append(("target_ref", options.target_ref)) | 2434 form_fields.append(("target_ref", options.target_ref)) |
2435 if options.cq_dry_run: | 2435 if options.cq_dry_run: |
2436 form_fields.append(("cq_dry_run", "1")) | 2436 form_fields.append(("cq_dry_run", "1")) |
2437 form_fields.append(("commit", "1")) | 2437 form_fields.append(("commit", "1")) |
2438 if options.depends_on_patchset: | 2438 if options.depends_on_patchset: |
2439 form_fields.append(("depends_on_patchset", options.depends_on_patchset)) | 2439 form_fields.append(("depends_on_patchset", options.depends_on_patchset)) |
2440 | 2440 |
2441 # Process --message, --title and --file. | 2441 # Process --message, --title and --file. |
2442 message = options.message or "" | 2442 message = options.message or "" |
| 2443 explicit_title = options.title is not None |
2443 title = options.title or "" | 2444 title = options.title or "" |
2444 if options.file: | 2445 if options.file: |
2445 if options.message: | 2446 if options.message: |
2446 ErrorExit("Can't specify both message and message file options") | 2447 ErrorExit("Can't specify both message and message file options") |
2447 file = open(options.file, 'r') | 2448 file = open(options.file, 'r') |
2448 message = file.read() | 2449 message = file.read() |
2449 file.close() | 2450 file.close() |
2450 title = title or message.split('\n', 1)[0].strip() | 2451 title = title or message.split('\n', 1)[0].strip() |
2451 if not title: | 2452 if not title and not explicit_title: |
2452 if options.issue: | 2453 if options.issue: |
2453 prompt = "Title describing this patch set" | 2454 prompt = "Title describing this patch set" |
2454 else: | 2455 else: |
2455 prompt = "New issue subject" | 2456 prompt = "New issue subject" |
2456 title_default = vcs.GetMostRecentCommitSummary() | 2457 title_default = vcs.GetMostRecentCommitSummary() |
2457 if title_default: | 2458 if title_default: |
2458 prompt += " [%s]" % title_default | 2459 prompt += " [%s]" % title_default |
2459 title = raw_input(prompt + ": ").strip() or title_default | 2460 title = raw_input(prompt + ": ").strip() or title_default |
2460 if not title and not options.issue: | 2461 if not title and not options.issue: |
2461 ErrorExit("A non-empty title is required for a new issue") | 2462 ErrorExit("A non-empty title is required for a new issue") |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2551 print | 2552 print |
2552 StatusUpdate("Interrupted.") | 2553 StatusUpdate("Interrupted.") |
2553 sys.exit(1) | 2554 sys.exit(1) |
2554 except auth.AuthenticationError as e: | 2555 except auth.AuthenticationError as e: |
2555 print(e, file=sys.stderr) | 2556 print(e, file=sys.stderr) |
2556 sys.exit(1) | 2557 sys.exit(1) |
2557 | 2558 |
2558 | 2559 |
2559 if __name__ == "__main__": | 2560 if __name__ == "__main__": |
2560 main() | 2561 main() |
OLD | NEW |