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

PATCH: column alignment in 'svn list -v' and 'svn status -v'

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: 2003-09-19 20:48:32 CEST

[From thread "minor bug in 'svn list -v'" on the "users" list.]

Martin Maurer requested a wider "file size" field in "svn list" output.

I suggested left-aligning the author field there and in "svn status" output, and other related column-alignment changes. Here is a patch for review.

Branko said that that there should be some indication that the username is truncated. This patch does not address that. Is there a good reason for it to be truncated while the other fields are not? I suppose long user names are quite common and long file sizes or revision numbers are not. But shouldn't it be consistent with "svn status"? Should both "list" and "status" truncate long user names ... and indicate that they are truncated? That's for a separate patch.

[[[
Improve the alignment of columns in "svn list" and "svn status" output.

* subversion/clients/cmdline/ls-cmd.c
  (print_dirents)
    Widen the file size field to allow 10 digits before breaking alignment,
      because sizes over 8 digits are becoming common. [From Martin Maurer.]
    Left-align the author field: it makes more sense.
    Remove redundant padding from constants: they will be padded by "printf".

* subversion/clients/cmdline/status.c
  (print_status)
    Allow the author field to extent an extra two characters into existing
      white space before breaking alignment of subsequent fields.
    Align the "?" for no-working-revision in the same way as others "?"s.
    Left-align the author field: it makes more sense.
    Remove redundant padding from constants: they will be padded by "printf".
]]]

- Julian

Improve the alignment of columns in "svn list" and "svn status" output.

* subversion/clients/cmdline/ls-cmd.c
  (print_dirents)
    Widen the file size field to allow 10 digits before breaking alignment,
      because sizes over 8 digits are becoming common. [From Martin Maurer.]
    Left-align the author field: it makes more sense.
    Remove redundant padding from constants: they will be padded by "printf".

* subversion/clients/cmdline/status.c
  (print_status)
    Allow the author field to extent an extra two characters into existing
      white space before breaking alignment of subsequent fields.
    Align the "?" for no-working-revision in the same way as others "?"s.
    Left-align the author field: it makes more sense.
    Remove redundant padding from constants: they will be padded by "printf".

Index: subversion/clients/cmdline/ls-cmd.c
===================================================================
--- subversion/clients/cmdline/ls-cmd.c (revision 7090)
+++ subversion/clients/cmdline/ls-cmd.c (working copy)
@@ -98,11 +98,11 @@
           if (apr_err)
             timestr[0] = '\0';
 
- printf ("%c %7"SVN_REVNUM_T_FMT" %8.8s "
- "%8"SVN_FILESIZE_T_FMT" %12s %s%s\n",
+ printf ("%c %7"SVN_REVNUM_T_FMT" %-8.8s "
+ "%10"SVN_FILESIZE_T_FMT" %12s %s%s\n",
                   dirent->has_props ? 'P' : '_',
                   dirent->created_rev,
- native_author ? native_author : " ? ",
+ native_author ? native_author : " ?",
                   dirent->size,
                   timestr,
                   native_entryname,
Index: subversion/clients/cmdline/status.c
===================================================================
--- subversion/clients/cmdline/status.c (revision 7090)
+++ subversion/clients/cmdline/status.c (working copy)
@@ -72,11 +72,11 @@
   if (detailed)
     {
       if (! status->entry)
- working_rev = " ";
+ working_rev = "";
       else if (! SVN_IS_VALID_REVNUM (status->entry->revision))
- working_rev = " ? "; /* ### Why the odd alignment? */
+ working_rev = "? ";
       else if (status->copied)
- working_rev = " -";
+ working_rev = "-";
       else
         sprintf (working_rev_buf, "%6" SVN_REVNUM_T_FMT,
                  status->entry->revision);
@@ -93,21 +93,21 @@
             sprintf(commit_rev_buf, "%6" SVN_REVNUM_T_FMT,
                     status->entry->cmt_rev);
           else if (status->entry)
- commit_rev = " ? ";
+ commit_rev = "? ";
           else
- commit_rev = " ";
+ commit_rev = "";
 
           if (status->entry && status->entry->cmt_author)
             commit_author = status->entry->cmt_author;
           else if (status->entry)
- commit_author = " ? ";
+ commit_author = " ?";
           else
- commit_author = " ";
+ commit_author = "";
         }
     }
 
   if (detailed && show_last_committed)
- printf ("%c%c%c%c%c %c %6s %6s %8s %s\n",
+ printf ("%c%c%c%c%c %c %6s %6s %-10s %s\n",
             generate_status_code (status->text_status),
             generate_status_code (status->prop_status),
             status->locked ? 'L' : ' ',

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Fri Sep 19 20:49:09 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.