On Thu, Feb 12, 2015 at 09:16:30PM +0100, Joris Vink wrote:
> Opencvs showed the incorrect time for status.
> 
> Changed it to do what GNU does which is taking the
> actual time string from the entries line.
> (not on the list, cc me)
> 
> .joris
> 
> Index: cvs.h
> ===================================================================
> RCS file: /cvs/src/usr.bin/cvs/cvs.h,v
> retrieving revision 1.181
> diff -u -p -u -r1.181 cvs.h
> --- cvs.h     20 Sep 2011 12:43:45 -0000      1.181
> +++ cvs.h     12 Feb 2015 19:45:05 -0000
> @@ -249,6 +249,7 @@ struct cvs_ent {
>       char            *ce_name;
>       char            *ce_opts;
>       char            *ce_tag;
> +     char            *ce_time;
>       time_t           ce_date;
>       time_t           ce_mtime;
>       u_int16_t        ce_type;
> Index: entries.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/cvs/entries.c,v
> retrieving revision 1.103
> diff -u -p -u -r1.103 entries.c
> --- entries.c 16 Jan 2015 06:40:07 -0000      1.103
> +++ entries.c 12 Feb 2015 19:45:05 -0000
> @@ -151,6 +151,7 @@ cvs_ent_parse(const char *entry)
>       ent->ce_rev = NULL;
>       ent->ce_date = -1;
>       ent->ce_tag = NULL;
> +     ent->ce_time = NULL;
>  
>       if (ent->ce_type == CVS_ENT_FILE) {
>               if (*fields[2] == '-') {
> @@ -186,6 +187,8 @@ cvs_ent_parse(const char *entry)
>                       p = fields[3];
>                       if (strncmp(fields[3], "Result of merge+", 16) == 0)
>                               p += 16;
> +
> +                     ent->ce_time = xstrdup(p);
>  
>                       /* Date field can be a '+=' with remote to indicate
>                        * conflict.  In this case do nothing. */

This looks right for non-conflicted files.

But for conflicted files, the version of GNU cvs we have in base,
and opencvs without this patch, both show:

   Working revision:    1.18    Result of merge

With this patch opencvs shows the date even for conflicted files.
Intentional change?

> Index: status.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/cvs/status.c,v
> retrieving revision 1.94
> diff -u -p -u -r1.94 status.c
> --- status.c  16 Jan 2015 06:40:07 -0000      1.94
> +++ status.c  12 Feb 2015 19:45:05 -0000
> @@ -176,9 +176,8 @@ cvs_status_local(struct cvs_file *cf)
>               rcsnum_tostr(cf->file_ent->ce_rev, revbuf, sizeof(revbuf));
>  
>               if (cf->file_ent->ce_conflict == NULL) {
> -                     ctime_r(&(cf->file_ent->ce_mtime), timebuf);
> -                     if (timebuf[strlen(timebuf) - 1] == '\n')
> -                             timebuf[strlen(timebuf) - 1] = '\0';
> +                     (void)strlcpy(timebuf, cf->file_ent->ce_time,
> +                         sizeof(timebuf));
>               } else {
>                       len = strlcpy(timebuf, cf->file_ent->ce_conflict,
>                           sizeof(timebuf));
> @@ -189,7 +188,7 @@ cvs_status_local(struct cvs_file *cf)
>               (void)strlcpy(buf, revbuf, sizeof(buf));
>               if (cvs_server_active == 0) {
>                       (void)strlcat(buf, "\t", sizeof(buf));
> -                     (void)strlcat(buf, timebuf, sizeof(buf));
> +                     (void)strlcat(buf, cf->file_ent->ce_time, sizeof(buf));

Is timebuf still needed?

>               }
>       }
>  

Reply via email to