diff options
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/cvs/annotate.c | 41 | ||||
-rw-r--r-- | usr.bin/cvs/rcs.c | 116 |
2 files changed, 3 insertions, 154 deletions
diff --git a/usr.bin/cvs/annotate.c b/usr.bin/cvs/annotate.c index 50a2440fca4..8f719dcae6e 100644 --- a/usr.bin/cvs/annotate.c +++ b/usr.bin/cvs/annotate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: annotate.c,v 1.34 2007/01/11 17:44:18 niallo Exp $ */ +/* $OpenBSD: annotate.c,v 1.35 2007/01/13 20:59:49 joris Exp $ */ /* * Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org> * @@ -107,15 +107,6 @@ cvs_annotate(int argc, char **argv) void cvs_annotate_local(struct cvs_file *cf) { - struct cvs_line *lp; - struct cvs_lines *lines; - BUF *b; - RCSNUM *ann_rev; - char *content; - size_t len; - - ann_rev = NULL; - cvs_log(LP_TRACE, "cvs_annotate_local(%s)", cf->file_path); cvs_file_classify(cf, NULL, 0); @@ -126,33 +117,5 @@ cvs_annotate_local(struct cvs_file *cf) cvs_printf("Annotations for %s", cf->file_name); cvs_printf("\n***************\n"); - - if (rev != NULL) - ann_rev = rcs_translate_tag(rev, cf->file_rcs); - else { - ann_rev = rcsnum_alloc(); - rcsnum_cpy(cf->file_rcs->rf_head, ann_rev, 0); - } - - b = rcs_getrev(cf->file_rcs, ann_rev); - cvs_buf_putc(b, '\0'); - - len = cvs_buf_len(b); - content = cvs_buf_release(b); - if ((lines = cvs_splitlines(content, len)) == NULL) - fatal("cvs_annotate_local: cvs_splitlines failed"); - - xfree(content); - - /* XXX */ - TAILQ_FOREACH(lp, &(lines->l_lines), l_list) { - if (lp->l_line == NULL) - continue; - - cvs_printf("%s\n", lp->l_line); - } - cvs_freelines(lines); - - if (ann_rev != NULL) - rcsnum_free(ann_rev); + cvs_printf("no code yet\n"); } diff --git a/usr.bin/cvs/rcs.c b/usr.bin/cvs/rcs.c index 20f747e5dc3..313ec093ace 100644 --- a/usr.bin/cvs/rcs.c +++ b/usr.bin/cvs/rcs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcs.c,v 1.198 2007/01/13 05:09:17 joris Exp $ */ +/* $OpenBSD: rcs.c,v 1.199 2007/01/13 20:59:49 joris Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -1169,120 +1169,6 @@ rcs_patch_lines(struct cvs_lines *dlines, struct cvs_lines *plines) } /* - * rcs_getrev() - * - * Get the whole contents of revision <rev> from the RCSFILE <rfp>. The - * returned buffer is dynamically allocated and should be released using - * cvs_buf_free() once the caller is done using it. - */ -BUF* -rcs_getrev(RCSFILE *rfp, RCSNUM *frev) -{ - size_t i, dlen, plen; - int done, nextroot, found; - BUF *rcsbuf; - RCSNUM *tnum, *bnum; - struct rcs_branch *brp; - struct rcs_delta *hrdp, *trdp, *rdp; - u_char *data, *patch; - - if ((hrdp = rcs_findrev(rfp, rfp->rf_head)) == NULL) - fatal("rcs_getrev: no HEAD revision"); - - tnum = frev; - rcs_parse_deltatexts(rfp, hrdp->rd_num); - - /* revision on branch, get the branch root */ - nextroot = 2; - if (RCSNUM_ISBRANCHREV(tnum)) { - bnum = rcsnum_alloc(); - rcsnum_cpy(tnum, bnum, nextroot); - } else { - bnum = tnum; - } - - rcsbuf = cvs_buf_alloc(hrdp->rd_tlen, BUF_AUTOEXT); - cvs_buf_append(rcsbuf, hrdp->rd_text, hrdp->rd_tlen); - - done = 0; - - rdp = hrdp; - if (!rcsnum_differ(rdp->rd_num, bnum)) - goto next; - - if ((rdp = rcs_findrev(rfp, hrdp->rd_next)) == NULL) - return (rcsbuf); - -again: - for (;;) { - if (rdp->rd_next->rn_len != 0) { - trdp = rcs_findrev(rfp, rdp->rd_next); - if (trdp == NULL) - fatal("failed to grab next revision"); - } - - if (rdp->rd_tlen == 0) { - rcs_parse_deltatexts(rfp, rdp->rd_num); - if (rdp->rd_tlen == 0) { - if (!rcsnum_differ(rdp->rd_num, bnum)) - break; - rdp = trdp; - continue; - } - } - - plen = rdp->rd_tlen; - dlen = cvs_buf_len(rcsbuf); - patch = rdp->rd_text; - data = cvs_buf_release(rcsbuf); - rcsbuf = cvs_patchfile(data, dlen, patch, plen, - rcs_patch_lines); - xfree(data); - if (rcsbuf == NULL) - fatal("rcs_getrev: failed to apply rcsdiff"); - - if (!rcsnum_differ(rdp->rd_num, bnum)) - break; - - rdp = trdp; - } - -next: - if (!rcsnum_differ(rdp->rd_num, frev)) - done = 1; - - if (RCSNUM_ISBRANCHREV(frev) && done != 1) { - nextroot += 2; - rcsnum_cpy(frev, bnum, nextroot); - - TAILQ_FOREACH(brp, &(rdp->rd_branches), rb_list) { - found = 1; - for (i = 0; i < nextroot - 1; i++) { - if (brp->rb_num->rn_id[i] != bnum->rn_id[i]) { - found = 0; - break; - } - } - - break; - } - - if (brp == NULL) - fatal("expected branch not found on branch list"); - - if ((rdp = rcs_findrev(rfp, brp->rb_num)) == NULL) - fatal("rcs_getrev: failed to get delta for target rev"); - - goto again; - } - - if (bnum != tnum) - rcsnum_free(bnum); - - return (rcsbuf); -} - -/* * rcs_rev_add() * * Add a revision to the RCS file <rf>. The new revision's number can be |