On Thu, Feb 12, 2015 at 11:30:26PM +0100, Stefan Sperling wrote:
> 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?

No, seems an old change I did was still present in the previous diff.

> Is timebuf still needed?

Yes.

.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       13 Feb 2015 06:08:26 -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   13 Feb 2015 06:08:26 -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] == '-') {
@@ -187,6 +188,8 @@ cvs_ent_parse(const char *entry)
                        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. */
                        if (strptime(p, "%a %b %d %T %Y", &t) != NULL) {
@@ -384,6 +387,7 @@ cvs_ent_free(struct cvs_ent *ent)
        if (ent->ce_rev != NULL)
                rcsnum_free(ent->ce_rev);
        xfree(ent->ce_buf);
+       xfree(ent->ce_time);
        xfree(ent);
 }
 
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    13 Feb 2015 06:08:26 -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));

Reply via email to