diff options
author | Niall O'Higgins <niallo@cvs.openbsd.org> | 2005-10-15 22:56:04 +0000 |
---|---|---|
committer | Niall O'Higgins <niallo@cvs.openbsd.org> | 2005-10-15 22:56:04 +0000 |
commit | 2ebe15dc9e474b432ed87be5440a9d682ec74363 (patch) | |
tree | 3b1038294e331e841a5ab1e522cdea1e4c537043 /usr.bin | |
parent | 930e44e402c22e1d31fdc0173dd37b7adae2216d (diff) |
- add username parameter to rcs_rev_add(), needed to implement at least
`ci -wusername'.
ok joris@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/cvs/import.c | 6 | ||||
-rw-r--r-- | usr.bin/cvs/rcs.c | 12 | ||||
-rw-r--r-- | usr.bin/cvs/rcs.h | 5 |
3 files changed, 15 insertions, 8 deletions
diff --git a/usr.bin/cvs/import.c b/usr.bin/cvs/import.c index 835dc0e8830..d3f98274261 100644 --- a/usr.bin/cvs/import.c +++ b/usr.bin/cvs/import.c @@ -1,4 +1,4 @@ -/* $OpenBSD: import.c,v 1.26 2005/08/04 12:20:42 xsa Exp $ */ +/* $OpenBSD: import.c,v 1.27 2005/10/15 22:56:02 niallo Exp $ */ /* * Copyright (c) 2004 Joris Vink <joris@openbsd.org> * All rights reserved. @@ -314,7 +314,7 @@ cvs_import_local(CVSFILE *cf, void *arg) } rev = rcsnum_brtorev(imp_brnum); - if (rcs_rev_add(rf, rev, cvs_msg, stamp) < 0) { + if (rcs_rev_add(rf, rev, cvs_msg, stamp, NULL) < 0) { cvs_log(LP_ERR, "failed to add revision: %s", rcs_errstr(rcs_errno)); rcs_close(rf); @@ -331,7 +331,7 @@ cvs_import_local(CVSFILE *cf, void *arg) } rcsnum_cpy(imp_brnum, rev, 2); - if (rcs_rev_add(rf, rev, cvs_msg, stamp) < 0) { + if (rcs_rev_add(rf, rev, cvs_msg, stamp, NULL) < 0) { cvs_log(LP_ERR, "failed to add revision: %s", rcs_errstr(rcs_errno)); rcs_close(rf); diff --git a/usr.bin/cvs/rcs.c b/usr.bin/cvs/rcs.c index 9211b99d471..e214d9cb5f8 100644 --- a/usr.bin/cvs/rcs.c +++ b/usr.bin/cvs/rcs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcs.c,v 1.89 2005/10/11 00:10:16 joris Exp $ */ +/* $OpenBSD: rcs.c,v 1.90 2005/10/15 22:56:03 niallo Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -1433,10 +1433,13 @@ rcs_getrev(RCSFILE *rfp, RCSNUM *frev) * one). The <msg> argument specifies the log message for that revision, and * <date> specifies the revision's date (a value of -1 is * equivalent to using the current time). + * If <username> is NULL, set the author for this revision to the current user. + * Otherwise, set it to <username>. * Returns 0 on success, or -1 on failure. */ int -rcs_rev_add(RCSFILE *rf, RCSNUM *rev, const char *msg, time_t date) +rcs_rev_add(RCSFILE *rf, RCSNUM *rev, const char *msg, time_t date, + const char *username) { time_t now; struct passwd *pw; @@ -1490,7 +1493,10 @@ rcs_rev_add(RCSFILE *rf, RCSNUM *rev, const char *msg, time_t date) rcsnum_cpy(old, rdp->rd_next, 0); rcsnum_free(old); - if ((rdp->rd_author = cvs_strdup(pw->pw_name)) == NULL) { + if (username == NULL) + username = pw->pw_name; + + if ((rdp->rd_author = cvs_strdup(username)) == NULL) { rcs_freedelta(rdp); return (-1); } diff --git a/usr.bin/cvs/rcs.h b/usr.bin/cvs/rcs.h index 951b03ea4fd..8ebf55ba010 100644 --- a/usr.bin/cvs/rcs.h +++ b/usr.bin/cvs/rcs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rcs.h,v 1.34 2005/10/10 23:37:15 joris Exp $ */ +/* $OpenBSD: rcs.h,v 1.35 2005/10/15 22:56:03 niallo Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -209,7 +209,8 @@ const char *rcs_comment_get(RCSFILE *); int rcs_comment_set(RCSFILE *, const char *); int rcs_kwexp_set(RCSFILE *, int); int rcs_kwexp_get(RCSFILE *); -int rcs_rev_add(RCSFILE *, RCSNUM *, const char *, time_t); +int rcs_rev_add(RCSFILE *, RCSNUM *, const char *, time_t, + const char *); int rcs_rev_setlog(RCSFILE *, RCSNUM *, const char *); int rcs_rev_remove(RCSFILE *, RCSNUM *); RCSNUM *rcs_tag_resolve(RCSFILE *, const char *); |