summaryrefslogtreecommitdiff
path: root/usr.bin/cvs/rcs.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/cvs/rcs.c')
-rw-r--r--usr.bin/cvs/rcs.c116
1 files changed, 1 insertions, 115 deletions
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