summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorJoris Vink <joris@cvs.openbsd.org>2006-05-29 07:15:53 +0000
committerJoris Vink <joris@cvs.openbsd.org>2006-05-29 07:15:53 +0000
commit466952ab02e295f3dd0d8db5d7f7f65e430913f6 (patch)
treef855ba45940da91b02ee53a52c096f7dea3c4790 /usr.bin
parent96e7fade355a7917a326f58e67f6dea50d99577f (diff)
add rcs_translate_tag which will translate a specified
revision or symbol given to us on the command line into the matching revision in the RCS file (if any);
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/cvs/rcs.c22
-rw-r--r--usr.bin/cvs/rcs.h3
2 files changed, 23 insertions, 2 deletions
diff --git a/usr.bin/cvs/rcs.c b/usr.bin/cvs/rcs.c
index 0efff87219f..39663f425b0 100644
--- a/usr.bin/cvs/rcs.c
+++ b/usr.bin/cvs/rcs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcs.c,v 1.175 2006/05/28 10:14:59 joris Exp $ */
+/* $OpenBSD: rcs.c,v 1.176 2006/05/29 07:15:52 joris Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -798,6 +798,12 @@ rcs_sym_getrev(RCSFILE *file, const char *sym)
return (NULL);
}
+ if (!strcmp(sym, RCS_HEAD_BRANCH)) {
+ num = rcsnum_alloc();
+ rcsnum_cpy(file->rf_head, num, 0);
+ return (num);
+ }
+
num = NULL;
TAILQ_FOREACH(symp, &(file->rf_symbols), rs_list)
if (strcmp(symp->rs_name, sym) == 0)
@@ -2957,3 +2963,17 @@ rcs_kwexp_buf(BUF *bp, RCSFILE *rf, RCSNUM *rev)
}
return (bp);
}
+
+RCSNUM *
+rcs_translate_tag(const char *revstr, RCSFILE *rfp)
+{
+ RCSNUM *rev;
+
+ rev = rcs_sym_getrev(rfp, revstr);
+ if (rev == NULL) {
+ if ((rev = rcsnum_parse(revstr)) == NULL)
+ fatal("%s is an invalid revision/symbol", revstr);
+ }
+
+ return (rev);
+}
diff --git a/usr.bin/cvs/rcs.h b/usr.bin/cvs/rcs.h
index 12d0cce7d96..f6926a6f2c9 100644
--- a/usr.bin/cvs/rcs.h
+++ b/usr.bin/cvs/rcs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcs.h,v 1.64 2006/05/28 10:14:59 joris Exp $ */
+/* $OpenBSD: rcs.h,v 1.65 2006/05/29 07:15:52 joris Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -229,6 +229,7 @@ struct rcs_delta *rcs_findrev(RCSFILE *, RCSNUM *);
int rcs_sym_add(RCSFILE *, const char *, RCSNUM *);
int rcs_sym_remove(RCSFILE *, const char *);
RCSNUM *rcs_sym_getrev(RCSFILE *, const char *);
+RCSNUM *rcs_translate_tag(const char *, RCSFILE *);
int rcs_sym_check(const char *);
int rcs_lock_getmode(RCSFILE *);
int rcs_lock_setmode(RCSFILE *, int);