Sussman wished aloud for this on IRC.  It was so simple I couln't
resist making the change.
The patch below makes the date/time display behavior of "svn ls
-v" match that of "ls" on most Un*x variants.
Log message:
* ls-cmd.c
  (print_dirents) Include the date (instead of the time) in the verbose 
  list output if the entry's date is more than half a year in the past
  or future.
Index: subversion/clients/cmdline/ls-cmd.c
===================================================================
--- subversion/clients/cmdline/ls-cmd.c	(revision 6985)
+++ subversion/clients/cmdline/ls-cmd.c	(working copy)
@@ -68,6 +68,7 @@
                                           utf8_entryname, pool));      
       if (verbose)
         {
+          apr_time_t now = apr_time_now();
           apr_time_exp_t exp_time;
           apr_status_t apr_err;
           apr_size_t size;
@@ -78,10 +79,20 @@
                                                 dirent->last_author, pool));
 
           /* svn_time_to_human_cstring gives us something *way* to long
-             to use for this, so we have to roll our own. */
+             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);
-          apr_err = apr_strftime (timestr, &size, sizeof (timestr),
-                                  "%b %d %H:%M", &exp_time);
+          if (apr_time_sec(now - dirent->time) < (365 * 86400 / 2)
+              && apr_time_sec(dirent->time - now) < (365 * 86400 / 2))
+            {
+              apr_err = apr_strftime (timestr, &size, sizeof (timestr),
+                                      "%b %d %H:%M", &exp_time);
+            }
+          else
+            {
+              apr_err = apr_strftime (timestr, &size, sizeof (timestr),
+                                      "%b %d  %Y", &exp_time);
+            }
 
           /* if that failed, just zero out the string and print nothing */
           if (apr_err)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Sep  5 23:43:22 2003