Properly perform a revision lookup so update -r actually
works again, as a bonus throw a more correct error when
the revision could not be found.
(not on list, cc me)
.joris
Index: rcs.c
===================================================================
RCS file: /cvs/src/usr.bin/cvs/rcs.c,v
retrieving revision 1.312
diff -u -p -u -r1.312 rcs.c
--- rcs.c 16 Jan 2015 06:40:07 -0000 1.312
+++ rcs.c 12 Feb 2015 20:07:49 -0000
@@ -1821,17 +1821,13 @@ rcs_rev_getlines(RCSFILE *rfp, RCSNUM *f
again:
for (;;) {
+ if (rdp == NULL)
+ break;
+
if (rdp->rd_next->rn_len != 0) {
trdp = rcs_findrev(rfp, rdp->rd_next);
if (trdp == NULL)
fatal("failed to grab next revision");
- } else {
- /*
- * XXX Fail, although the caller does not always do the
- * right thing (eg cvs diff when the tree is ahead of
- * the repository).
- */
- break;
}
if (rdp->rd_tlen == 0) {
@@ -1882,7 +1878,7 @@ again:
}
next:
- if (!rcsnum_differ(rdp->rd_num, frev))
+ if (rdp == NULL || !rcsnum_differ(rdp->rd_num, frev))
done = 1;
if (RCSNUM_ISBRANCHREV(frev) && done != 1) {
@@ -2071,6 +2067,7 @@ rcs_rev_getbuf(RCSFILE *rfp, RCSNUM *rev
struct rcs_delta *rdp;
struct rcs_lines *lines;
struct rcs_line *lp, *nlp;
+ char version[RCSNUM_MAXSTR];
BUF *bp;
rdp = NULL;
@@ -2083,8 +2080,12 @@ rcs_rev_getbuf(RCSFILE *rfp, RCSNUM *rev
expmode = rcs_kwexp_get(rfp);
if (!(expmode & RCS_KWEXP_NONE)) {
- if ((rdp = rcs_findrev(rfp, rev)) == NULL)
- fatal("could not fetch revision");
+ if ((rdp = rcs_findrev(rfp, rev)) == NULL) {
+ rcsnum_tostr(rev, version, sizeof(version));
+ fatal("could not find desired version %s in %s",
+ version, rfp->rf_path);
+ }
+
expand = 1;
}
}