2

I'm trying to checkin a file using rcleartool and pass in a comment which contains more than 1 line (on windows)

> rcleartool.bat ci file1.cxx -c "comment 
with more than 
one
line"

but this doesn't seem to work well, infact I can't even enter such a think in bash or in cmd

can anyone give me any pointers if there is a way to encode \n in the message

doing

rcleartool.bat ci file1.cxx -c "comment \nwith more than\none\nline"

simply leave the string "\n" in my message and not an actual newline

Is this possible? rcleartool doesn't seem to take the -cfile argument

Many thanks in advance Paul

MyDeveloperDay
  • 2,095
  • 1
  • 14
  • 15

2 Answers2

1

One immediate workaround is to use the -cfile parameter of rcleartool ci

That allows you to write your multi-lines comment in a file, and pass that file as a parameter to the checkin command.

If -cfile is not supported, then you need to wrap the checkin call in a script, as in "Long commands split over multiple lines in Windows Vista batch (.bat) file"

setlocal EnableDelayedExpansion
set text=This creates ^

a line feed
echo Test7: %text%
echo Test8: !text!
--- Output ---
Test7: This creates
Test8: This creates
a line feed

In that script, you can call rcleartool i -m !Test8! afile to see if that works.

Or you can read the content of a file in a variable, and use that variable as a -m parameter.

Community
  • 1
  • 1
VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283
  • I was going to do that but unlike cleartool, rcleartool does not support -cfile from what I can tell see
    Usage: checkin | ci [-c/omment comment | -cq | -cqe | -nc] [-kee/p | -rm] [-pti/
    me] [-fro/m source-pname] [-ide/ntical] {-cac/t | activity-selector ... | [-ato/
    mic] pname ...}
    – MyDeveloperDay Mar 09 '16 at 13:42
  • @MyDeveloperDay OK, I have edited the answer accordingly. – VonC Mar 09 '16 at 13:50
  • @MyDeveloperDay By the way, don't forget to read http://stackoverflow.com/help/why-vote and http://stackoverflow.com/help/accepted-answer (not for this question necessarily, but for all the other questions you already asked on Stack Overflow) – VonC Mar 09 '16 at 14:27
1

I always hate answering my own questions, but it appears that you can put %0A instead of the \n in the checkin message and that then appears as a newline in the history

MyDeveloperDay
  • 2,095
  • 1
  • 14
  • 15
  • Answering one's own question is a good practice. And again, don't forget to read http://stackoverflow.com/help/why-vote and http://stackoverflow.com/help/accepted-answer (for this question necessarily, but for all the other questions you already asked on Stack Overflow) – VonC Mar 10 '16 at 12:16