[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: minor bug in 'svn list -v'

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: 2003-09-16 22:12:13 CEST

Branko Čibej wrote:
> Julian Foad wrote:
>
>>While we're talking column widths, "svn list" shows only the first 8
>>characters of my username, while "svn status -v" shows the whole name
>>(10 characters in my case: "julianfoad"), breaking its formatting
>>which otherwise is geared to a maximum of 8:
>>
>>~/src/subversion/doc/book> svn ls -v
>>_ 4371 rassilon 3234 Jan 13 2003 HACKING
>>_ 7047 julianfo 5938 Sep 11 22:55 Makefile
>>_ 6717 kfogel 6666 Aug 12 21:58 README
>>_ 7014 fitz 4058 Sep 09 05:47 TODO
>>_ 7062 cmpilato 0 Sep 15 16:12 book/
>>_ 7009 dimentiy 0 Sep 08 22:39 misc-docs/
>>_ 6632 julianfo 4441 Aug 01 19:34 outline.txt
>>_ 6593 fitz 0 Jul 28 06:02 tools/
>>~/src/subversion/doc/book> svn status -v -N
>> 7064 7062 cmpilato .
>> 7064 6593 fitz tools
>> 7064 7009 dimentiy misc-docs
>> 7064 4371 rassilon HACKING
>> 7064 7014 fitz TODO
>> 7064 7062 cmpilato book
>> 7064 7047 julianfoad Makefile
>> 7064 6632 julianfoad outline.txt
>> 7064 6717 evenlongername README
>>
>>I'm not sure which of those is best. I wouldn't want the "status"
>>output truncated, but perhaps "list" output is OK truncated because it
>>is not so important for it to be machine-readabile?
>
> The way "svn st" behaves is still problematic if you take into account
> that usernames can contain spaces. Yes, perhaps not on Unix, but they can.

Yes.

>>Anyway, there is room in the existing white space for two more
>>characters.

I was referring to the "status" output, which does not get truncated...

> At the very least, there should be some indication that the username is
> truncated.

...but yes, if and when it does get truncated (e.g. in the "list" output), I agree that an indication should be given. How about {if (name > 8 chars) then (display first 7 chars plus a '>')}, like this:

~/src/subversion/doc/book> svn ls -v
_ 4371 rassilon 3234 Jan 13 2003 HACKING
_ 7047 julianf> 5938 Sep 11 22:55 Makefile
_ 6717 kfogel 6666 Aug 12 21:58 README
_ 7014 fitz 4058 Sep 09 05:47 TODO
_ 7062 cmpilato 0 Sep 15 16:12 book/
_ 7009 dimentiy 0 Sep 08 22:39 misc-docs/
_ 6632 julianf> 4441 Aug 01 19:34 outline.txt
_ 6593 fitz 0 Jul 28 06:02 tools/

Actually, I don;t like that much. It's a notation sometimes used for a scrollable field.

>>And it doesn't make much sense for user names to be right-aligned.
>>Left-aligned would facilitate sorting and searching. (Not that you
>>can't sort or search with them as they are, but ...)
>
> I agree.
>
>>Want to accept a patch to change that to left-aligned (in both "list"
>>and "status", with the alignment of "status" output preserved for up
>>to 10 characters rather then 8? Like this:
>>
>>~/src/subversion/doc/book> svn ls -v
>>_ 4371 rassilon 3234 Jan 13 2003 HACKING
>>_ 7047 julianfo 5938 Sep 11 22:55 Makefile
>>_ 6717 kfogel 6666 Aug 12 21:58 README
>>_ 7014 fitz 4058 Sep 09 05:47 TODO
>>_ 7062 cmpilato 0 Sep 15 16:12 book/
>>_ 7009 dimentiy 0 Sep 08 22:39 misc-docs/
>>_ 6632 julianfo 4441 Aug 01 19:34 outline.txt
>>_ 6593 fitz 0 Jul 28 06:02 tools/
>>~/src/subversion/doc/book> svn st -v -N
>> 7064 7062 cmpilato .
>> 7064 6593 fitz tools
>> 7064 7009 dimentiy misc-docs
>> 7064 4371 rassilon HACKING
>> 7064 7014 fitz TODO
>> 7064 7062 cmpilato book
>> 7064 7047 julianfoad Makefile
>> 7064 6632 julianfoad outline.txt
>> 7064 6717 evenlongername README
>>
>>[[[
>>Improve the display of user names in "svn status" and "svn list" output.
>>
>>* subversion/clients/cmdline/ls-cmd.c
>> Fix a typo in a comment.
>> Left-align the user names, as that makes more sense.
>>
>>* subversion/clients/cmdline/status.c
>> Left-align the user names, and allow them to reach 10 characters
>> rather than 8 before disrupting the alignment of the following column.
>>]]]
>>
>>Index: subversion/clients/cmdline/ls-cmd.c
>>===================================================================
>>--- subversion/clients/cmdline/ls-cmd.c (revision 7064)
>>+++ subversion/clients/cmdline/ls-cmd.c (working copy)
>>@@ -78,7 +78,7 @@
>> SVN_ERR (svn_utf_cstring_from_utf8 (&native_author,
>> dirent->last_author,
>>pool));
>>
>>- /* svn_time_to_human_cstring gives us something *way* to long
>>+ /* svn_time_to_human_cstring gives us something *way* too long
>> to use for this, so we have to roll our own. We include
>> the year if the entry's time is not within half a year. */
>> apr_time_exp_lt (&exp_time, dirent->time);
>>@@ -98,7 +98,7 @@
>> if (apr_err)
>> timestr[0] = '\0';
>>
>>- printf ("%c %7"SVN_REVNUM_T_FMT" %8.8s "
>>+ printf ("%c %7"SVN_REVNUM_T_FMT" %-8.8s "
>> "%8"SVN_FILESIZE_T_FMT" %12s %s%s\n",
>> dirent->has_props ? 'P' : '_',
>> dirent->created_rev,
>
> This is fine.
>
>>Index: subversion/clients/cmdline/status.c
>>===================================================================
>>--- subversion/clients/cmdline/status.c (revision 7064)
>>+++ subversion/clients/cmdline/status.c (working copy)
>>@@ -100,14 +100,14 @@
>> if (status->entry && status->entry->cmt_author)
>> commit_author = status->entry->cmt_author;
>> else if (status->entry)
>>- commit_author = " ? ";
>>+ commit_author = "?";
>
> Could you explain this change? I can't see any reason for it.

That is the string displayed when the author is unknown, such as files scheduled for addition. It was previously designed to display a question mark one character back from the end of the 8-character right-aligned field. With left alignment, the question mark wants to be on the left, so there is no need for this string to be padded with spaces out to the field width. I also removed the single space that made the question mark not quite line up with the edge of the field, because I didn't like that aspect of it. I suppose I shouldn't do that without comment, so I should have set the string to " ?".

~/src/subversion/doc/book> svn st -Nv # present
A 0 ? ? svn-book-usage.sh
             7074 7014 fitz TODO
             7074 7062 cmpilato book
             7074 7047 julianfoad Makefile
             7074 6717 evenlongername README

~/src/subversion/doc/book> svn st -Nv # my patch as I sent it
A 0 ? ? svn-book-usage.sh
             7074 7014 fitz TODO
             7074 7062 cmpilato book
             7074 7047 julianfoad Makefile
             7074 6717 evenlongername README

~/src/subversion/doc/book> svn st -Nv # what my patch should probably have done
A 0 ? ? svn-book-usage.sh
             7074 7014 fitz TODO
             7074 7062 cmpilato book
             7074 7047 julianfoad Makefile
             7074 6717 evenlongername README

- Julian

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Tue Sep 16 22:12:21 2003

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.