summaryrefslogtreecommitdiffstats
path: root/subcmds/cherry_pick.py
diff options
context:
space:
mode:
Diffstat (limited to 'subcmds/cherry_pick.py')
-rw-r--r--subcmds/cherry_pick.py22
1 files changed, 9 insertions, 13 deletions
diff --git a/subcmds/cherry_pick.py b/subcmds/cherry_pick.py
index 980720eb..f9ae3e32 100644
--- a/subcmds/cherry_pick.py
+++ b/subcmds/cherry_pick.py
@@ -18,9 +18,11 @@ import sys
18from command import Command 18from command import Command
19from error import GitError 19from error import GitError
20from git_command import GitCommand 20from git_command import GitCommand
21from repo_logging import RepoLogger
21 22
22 23
23CHANGE_ID_RE = re.compile(r"^\s*Change-Id: I([0-9a-f]{40})\s*$") 24CHANGE_ID_RE = re.compile(r"^\s*Change-Id: I([0-9a-f]{40})\s*$")
25logger = RepoLogger(__file__)
24 26
25 27
26class CherryPick(Command): 28class CherryPick(Command):
@@ -52,7 +54,7 @@ change id will be added.
52 try: 54 try:
53 p.Wait() 55 p.Wait()
54 except GitError: 56 except GitError:
55 print(p.stderr, file=sys.stderr) 57 logger.error(p.stderr)
56 raise 58 raise
57 59
58 sha1 = p.stdout.strip() 60 sha1 = p.stdout.strip()
@@ -67,9 +69,7 @@ change id will be added.
67 try: 69 try:
68 p.Wait() 70 p.Wait()
69 except GitError: 71 except GitError:
70 print( 72 logger.error("error: Failed to retrieve old commit message")
71 "error: Failed to retrieve old commit message", file=sys.stderr
72 )
73 raise 73 raise
74 74
75 old_msg = self._StripHeader(p.stdout) 75 old_msg = self._StripHeader(p.stdout)
@@ -85,14 +85,13 @@ change id will be added.
85 try: 85 try:
86 p.Wait() 86 p.Wait()
87 except GitError as e: 87 except GitError as e:
88 print(str(e)) 88 logger.error(e)
89 print( 89 logger.warn(
90 "NOTE: When committing (please see above) and editing the " 90 "NOTE: When committing (please see above) and editing the "
91 "commit message, please remove the old Change-Id-line and " 91 "commit message, please remove the old Change-Id-line and "
92 "add:" 92 "add:\n%s",
93 self._GetReference(sha1),
93 ) 94 )
94 print(self._GetReference(sha1), file=sys.stderr)
95 print(file=sys.stderr)
96 raise 95 raise
97 96
98 if p.stdout: 97 if p.stdout:
@@ -115,10 +114,7 @@ change id will be added.
115 try: 114 try:
116 p.Wait() 115 p.Wait()
117 except GitError: 116 except GitError:
118 print( 117 logger.error("error: Failed to update commit message")
119 "error: Failed to update commit message",
120 file=sys.stderr,
121 )
122 raise 118 raise
123 119
124 def _IsChangeId(self, line): 120 def _IsChangeId(self, line):