Re: [gerrit] Multiline comments on ssh approve using --message not working.

542 views
Skip to first unread message

Shawn Pearce

unread,
Feb 12, 2010, 11:46:14 AM2/12/10
to repo-discuss, sri...@codeaurora.org
sri...@codeaurora.org wrote:
> I have been playing with the SSH feature of approving and marking verified
> on changes in gerrit.
>
> Here is what what works for me .
>
> $ ssh -p 29418 <server_name> gerrit approve --verified=-1 --message
> "Failed" 12,1
> $
>
> The following two don't work.
>
> $ ssh -p 29418 <server_name> gerrit approve --verified=-1 --message "This
> change has failed verification" 12,1
> fatal: "change" is not a valid patch set
> $ ssh -p 29418 <server_name> gerrit approve --verified=-1 --message="This
> failed" 12,1
> fatal: "failed" is not a valid patch set
>
> I would ideally like to place multiple line comments too using the
> --message feature, but this doesn't work now. Is there an new line
> character or something like that, which I can insert into the message?

I think you need to double quote the message string:

$ ssh -p 29418 <server_name> gerrit approve --verified=-1 \
\'--message='This failed'\' \
12,1

The first level of quotes is discarded by the shell that is running
SSH, and then SSH just joins everything together into a single giant
string and ships it to Gerrit. Gerrit has to break that apart on
spaces, but it tries to honor '' around arguments when possible.

Putting \' and \' around the --message option makes your shell pass
a literal ' and ' to SSH, and then Gerrit can see these and keep
the whole message together as a single string.

Once the value is properly quoted, you should also be able to pass
a newline in the middle of the message:

$ ssh -p 29418 <server_name> gerrit approve --verified=-1 \
\'--message='Message with more than one line.

We needed two paragraphs here.'\' \
12,1

Reply all
Reply to author
Forward
0 new messages