diff options
Diffstat (limited to 'subcmds/cherry_pick.py')
| -rw-r--r-- | subcmds/cherry_pick.py | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/subcmds/cherry_pick.py b/subcmds/cherry_pick.py index 7a6d4c20..0cefec13 100644 --- a/subcmds/cherry_pick.py +++ b/subcmds/cherry_pick.py | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | # See the License for the specific language governing permissions and | 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. | 14 | # limitations under the License. |
| 15 | 15 | ||
| 16 | from __future__ import print_function | ||
| 16 | import re | 17 | import re |
| 17 | import sys | 18 | import sys |
| 18 | from command import Command | 19 | from command import Command |
| @@ -46,13 +47,13 @@ change id will be added. | |||
| 46 | capture_stdout = True, | 47 | capture_stdout = True, |
| 47 | capture_stderr = True) | 48 | capture_stderr = True) |
| 48 | if p.Wait() != 0: | 49 | if p.Wait() != 0: |
| 49 | print >>sys.stderr, p.stderr | 50 | print(p.stderr, file=sys.stderr) |
| 50 | sys.exit(1) | 51 | sys.exit(1) |
| 51 | sha1 = p.stdout.strip() | 52 | sha1 = p.stdout.strip() |
| 52 | 53 | ||
| 53 | p = GitCommand(None, ['cat-file', 'commit', sha1], capture_stdout=True) | 54 | p = GitCommand(None, ['cat-file', 'commit', sha1], capture_stdout=True) |
| 54 | if p.Wait() != 0: | 55 | if p.Wait() != 0: |
| 55 | print >>sys.stderr, "error: Failed to retrieve old commit message" | 56 | print("error: Failed to retrieve old commit message", file=sys.stderr) |
| 56 | sys.exit(1) | 57 | sys.exit(1) |
| 57 | old_msg = self._StripHeader(p.stdout) | 58 | old_msg = self._StripHeader(p.stdout) |
| 58 | 59 | ||
| @@ -62,8 +63,8 @@ change id will be added. | |||
| 62 | capture_stderr = True) | 63 | capture_stderr = True) |
| 63 | status = p.Wait() | 64 | status = p.Wait() |
| 64 | 65 | ||
| 65 | print >>sys.stdout, p.stdout | 66 | print(p.stdout, file=sys.stdout) |
| 66 | print >>sys.stderr, p.stderr | 67 | print(p.stderr, file=sys.stderr) |
| 67 | 68 | ||
| 68 | if status == 0: | 69 | if status == 0: |
| 69 | # The cherry-pick was applied correctly. We just need to edit the | 70 | # The cherry-pick was applied correctly. We just need to edit the |
| @@ -76,16 +77,14 @@ change id will be added. | |||
| 76 | capture_stderr = True) | 77 | capture_stderr = True) |
| 77 | p.stdin.write(new_msg) | 78 | p.stdin.write(new_msg) |
| 78 | if p.Wait() != 0: | 79 | if p.Wait() != 0: |
| 79 | print >>sys.stderr, "error: Failed to update commit message" | 80 | print("error: Failed to update commit message", file=sys.stderr) |
| 80 | sys.exit(1) | 81 | sys.exit(1) |
| 81 | 82 | ||
| 82 | else: | 83 | else: |
| 83 | print >>sys.stderr, """\ | 84 | print('NOTE: When committing (please see above) and editing the commit' |
| 84 | NOTE: When committing (please see above) and editing the commit message, | 85 | 'message, please remove the old Change-Id-line and add:') |
| 85 | please remove the old Change-Id-line and add: | 86 | print(self._GetReference(sha1), file=stderr) |
| 86 | """ | 87 | print(file=stderr) |
| 87 | print >>sys.stderr, self._GetReference(sha1) | ||
| 88 | print >>sys.stderr | ||
| 89 | 88 | ||
| 90 | def _IsChangeId(self, line): | 89 | def _IsChangeId(self, line): |
| 91 | return CHANGE_ID_RE.match(line) | 90 | return CHANGE_ID_RE.match(line) |
