Re: [fossil-users] fossil-users Digest, Vol 120, Issue 2

2018-01-02 Thread j. van den hoff
On Tue, 02 Jan 2018 04:33:56 +0100, Stephan Beal   
wrote:



(this time back to the list)
On Tue, Jan 2, 2018 at 3:43 AM, Andy Bradford 
wrote:


Thus said Stephan Beal on Tue, 02 Jan 2018 03:07:20 +0100:

> That will  still strip  any newlines from  his input,  though, because
> that's how $(...) works.

It actually only strips the trailing newline. Any newlines in the middle
of the file are fine.



That's not what i'm seeing:

[stephan@host:~]$ echo -e "1\n2\n3"
1
2
3
[stephan@host:~]$ echo $(echo -e "1\n2\n3")
1 2 3


you would need echo "$(echo -e "1\n2\n3")" here to protect the embedded  
newlines in the outer echo's output command expansion does not mess  
with the newlines, really. as andy said, it strips only trailing ones.








--
Using Opera's revolutionary email client: http://www.opera.com/mail/
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] fossil-users Digest, Vol 120, Issue 2

2018-01-01 Thread Andy Bradford
Thus said Stephan Beal on Tue, 02 Jan 2018 04:33:56 +0100:

> That's not what i'm seeing:
> 
> [stephan@host:~]$ echo -e "1\n2\n3"
> 1
> 2
> 3
> [stephan@host:~]$ echo $(echo -e "1\n2\n3")
> 1 2 3

Hmm, that's interesting.  Have a look at this... Here's  a file that has
newlines in it,  and which I will  commit as a comment to  a ticket from
command  line arguments.  Then  I  will inspect  the  artifact that  was
generated from the ticket:

$ cat first.txt 
First from file.

With multiple lines.

$ fossil ticket add title "Test" comment "$(cat first.txt)"
ticket add succeeded for 0e9c37eab5c7123d530097be4b298ba507a443af
$ fossil artifact 07760c2485   
D 2018-01-02T05:54:32.670
J comment First\sfrom\sfile.\n\nWith\smultiple\slines.
J title Test
K 0e9c37eab5c7123d530097be4b298ba507a443af
U amb
Z 360677764c30fd6bb5049d637b0c1c28

Notice that the J-card shows all the newlines except the last two (which
were stripped I presume by the shell).

Now let's append:

$ cat second.txt 

Second from file.

With multiple lines.

$ fossil ticket change 0e9c37eab +comment "$(cat second.txt)"  
ticket set succeeded for 0e9c37eab5c7123d530097be4b298ba507a443af
$ fossil artifact 34db266dcb0f117b
D 2018-01-02T06:03:46.839
J +comment \nSecond\sfrom\sfile.\n\nWith\smultiple\slines.
K 0e9c37eab5c7123d530097be4b298ba507a443af
U amb
Z da0a4b7d872315fd7c46c42cfa1259aa

In  this  case, the  newline  at  the beginning  of  the  file was  also
preserved in the J-card. When it gets rendered, however, there is no 
tag in front of the second chunk of comment (I'm not sure why). But if I
add a newline this way:

$ cat third.txt 
Third comment from file.

With multiple lines.
$ fossil ticket change 0e9c37eab +comment "  
> $(cat third.txt)"
ticket set succeeded for 0e9c37eab5c7123d530097be4b298ba507a443af
$ fossil artifact db16ba984f4d543d
D 2018-01-02T06:07:43.120
J +comment \nThird\scomment\sfrom\sfile.\n\nWith\smultiple\slines.
K 0e9c37eab5c7123d530097be4b298ba507a443af
U amb
Z c6de4dba1e840597206da2c761f94053

But this seems to work differently, even with similar input:

$ cat fourth.txt 
Fourth from file.

With multiple lines.
$ fossil artifact 902a2ec529584f13
D 2018-01-02T06:09:02.317
J +comment \nFourth\sfrom\sfile.\n\nWith\smultiple\slines.\n
K 0e9c37eab5c7123d530097be4b298ba507a443af
U amb
Z f6470d3a73f9ee9e94020219a70c0195


The output in the UI now looks like the following:

First from file.

With multiple lines. Second from file.

With multiple lines. Third comment from file.

With multiple lines. Fourth from file.

With multiple lines. 

So, if  the shell is  stripping all the  newlines, how does  Fossil know
that there  are newlines as  evidenced by  the J-card entries  that show
multiple embedded newlines?

And even the shell seems to work as I would expect:

$ echo "$(cat first.txt)" > /tmp/output.txt
$ cat /tmp/output.txt 
First from file.

With multiple lines.

So I'm not sure why this wouldn't also work for the OP with Fossil.

Thanks,

Andy
-- 
TAI64 timestamp: 40005a4b241f


___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] fossil-users Digest, Vol 120, Issue 2

2018-01-01 Thread Roy Keene

Stephan,

	You need to quote the argument to "echo", otherwise the whitespace 
is collapsed by the shell.


For example:
echo "$(echo -e "1\n2\n3")"

On Tue, 2 Jan 2018, Stephan Beal wrote:


(this time back to the list)
On Tue, Jan 2, 2018 at 3:43 AM, Andy Bradford  wrote:
  Thus said Stephan Beal on Tue, 02 Jan 2018 03:07:20 +0100:

  > That will  still strip  any newlines from  his input,  though, because
  > that's how $(...) works.

  It actually only strips the trailing newline. Any newlines in the middle
  of the file are fine.


That's not what i'm seeing:

[stephan@host:~]$ echo -e "1\n2\n3"
1
2
3
[stephan@host:~]$ echo $(echo -e "1\n2\n3")
1 2 3 

--
- stephan beal
http://wanderinghorse.net/home/stephan/"Freedom is sloppy. But since tyranny's the 
only guaranteed byproduct of those who insist on a perfect world, freedom will have to 
do." -- Bigby Wolf

___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] fossil-users Digest, Vol 120, Issue 2

2018-01-01 Thread Stephan Beal
(this time back to the list)
On Tue, Jan 2, 2018 at 3:43 AM, Andy Bradford 
wrote:

> Thus said Stephan Beal on Tue, 02 Jan 2018 03:07:20 +0100:
>
> > That will  still strip  any newlines from  his input,  though, because
> > that's how $(...) works.
>
> It actually only strips the trailing newline. Any newlines in the middle
> of the file are fine.


That's not what i'm seeing:

[stephan@host:~]$ echo -e "1\n2\n3"
1
2
3
[stephan@host:~]$ echo $(echo -e "1\n2\n3")
1 2 3

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
"Freedom is sloppy. But since tyranny's the only guaranteed byproduct of
those who insist on a perfect world, freedom will have to do." -- Bigby Wolf
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] fossil-users Digest, Vol 120, Issue 2

2018-01-01 Thread Andy Bradford
Thus said Stephan Beal on Tue, 02 Jan 2018 03:07:20 +0100:

> That will  still strip  any newlines from  his input,  though, because
> that's how $(...) works.

It actually only strips the trailing newline. Any newlines in the middle
of the file are fine. So for example:

$ cat third.txt 
Third from file.

With multiple lines.

$ fossil ticket change 64f086ad5be82495327100a66dcdee24432e2b79 +comment "
$(cat third.txt)"
ticket add succeeded for 64f086ad5be82495327100a66dcdee24432e2b79

Will  work, as  long as  that embedded  newline (maybe  it's actually  a
carriage-return) is in there.

> To get the  comment text imported verbatim, i suspect  that the ticket
> command needs  to support a  -M FILENAME  option to import  a comment,
> like checkin does.

And this certainly would be a friendlier option. :-)

Andy
-- 
TAI64 timestamp: 40005a4af1ee


___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] fossil-users Digest, Vol 120, Issue 2

2018-01-01 Thread Stephan Beal
On Tue, Jan 2, 2018 at 2:25 AM, Ron W  wrote:

> Try splitting the long text file into 2 or more smaller files, then add
> the ticket using the first file. Then you can append to the comment:
>
>$ fossil ticket change TICKETUUID +comment "$(cat content_next)"
>

That will still strip any newlines from his input, though, because that's
how $(...) works.

To get the comment text imported verbatim, i suspect that the ticket
command needs to support a -M FILENAME option to import a comment, like
checkin does.

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
"Freedom is sloppy. But since tyranny's the only guaranteed byproduct of
those who insist on a perfect world, freedom will have to do." -- Bigby Wolf
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] fossil-users Digest, Vol 120, Issue 2

2018-01-01 Thread Ron W
On Mon, Jan 1, 2018 at 6:48 PM, 
wrote:

> Date: Mon, 01 Jan 2018 12:44:42 +
> From: Sergey Bronnikov 
> Subject: [fossil-users] ticket length limitation
>
> For most by bugs it works fine, but command is failed when ticket body
> exceed limits. Command line length is limited by value in `getconf
> ARG_MAX`, in my case it is 262144. So when file is too long it is
> impossible to create ticket.
> $ echo "fossil ticket add title "title" comment \"$(cat content)\"" | wc -c
> 469207
>
> Is there any workaround?
>

Try splitting the long text file into 2 or more smaller files, then add the
ticket using the first file. Then you can append to the comment:

   $ fossil ticket change TICKETUUID +comment "$(cat content_next)"
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users