=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/rcs/rlog.c,v retrieving revision 1.59 retrieving revision 1.60 diff -c -r1.59 -r1.60 *** src/usr.bin/rcs/rlog.c 2007/09/09 17:01:38 1.59 --- src/usr.bin/rcs/rlog.c 2008/02/02 16:21:38 1.60 *************** *** 1,4 **** ! /* $OpenBSD: rlog.c,v 1.59 2007/09/09 17:01:38 ray Exp $ */ /* * Copyright (c) 2005 Joris Vink * Copyright (c) 2005, 2006 Xavier Santolaria --- 1,4 ---- ! /* $OpenBSD: rlog.c,v 1.60 2008/02/02 16:21:38 xsa Exp $ */ /* * Copyright (c) 2005 Joris Vink * Copyright (c) 2005, 2006 Xavier Santolaria *************** *** 262,267 **** --- 262,269 ---- struct tm t; char *author, numb[RCS_REV_BUFSZ], *fmt, timeb[RCS_TIME_BUFSZ]; struct rcs_argvector *largv, *sargv, *wargv; + struct rcs_branch *rb; + struct rcs_delta *nrdp; i = found = 0; author = NULL; *************** *** 347,356 **** fmt = "%Y/%m/%d %H:%M:%S"; } ! strftime(timeb, sizeof(timeb), fmt, &t); ! printf("\ndate: %s; author: %s; state: %s;\n", timeb, rdp->rd_author, rdp->rd_state); printf("%s", rdp->rd_log); } --- 349,394 ---- fmt = "%Y/%m/%d %H:%M:%S"; } ! (void)strftime(timeb, sizeof(timeb), fmt, &t); ! printf("\ndate: %s; author: %s; state: %s;", timeb, rdp->rd_author, rdp->rd_state); + + /* + * If we are a branch revision, the diff of this revision is stored + * in place. + * Otherwise, it is stored in the previous revision as a reversed diff. + */ + if (RCSNUM_ISBRANCHREV(rdp->rd_num)) + nrdp = rdp; + else + nrdp = TAILQ_NEXT(rdp, rd_list); + + /* + * We do not write diff stats for the first revision of the default + * branch, since it was not a diff but a full text. + */ + if (nrdp != NULL && rdp->rd_num->rn_len == nrdp->rd_num->rn_len) { + int added, removed; + rcs_delta_stats(nrdp, &added, &removed); + if (RCSNUM_ISBRANCHREV(rdp->rd_num)) + printf(" lines: +%d -%d", added, removed); + else + printf(" lines: +%d -%d", removed, added); + } + printf("\n"); + + if (!TAILQ_EMPTY(&(rdp->rd_branches))) { + printf("branches:"); + TAILQ_FOREACH(rb, &(rdp->rd_branches), rb_list) { + RCSNUM *branch; + branch = rcsnum_revtobr(rb->rb_num); + (void)rcsnum_tostr(branch, numb, sizeof(numb)); + printf(" %s;", numb); + rcsnum_free(branch); + } + printf("\n"); + } printf("%s", rdp->rd_log); }