=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/cvs/getlog.c,v retrieving revision 1.54 retrieving revision 1.55 diff -u -r1.54 -r1.55 --- src/usr.bin/cvs/getlog.c 2006/01/30 17:58:47 1.54 +++ src/usr.bin/cvs/getlog.c 2006/02/06 16:21:43 1.55 @@ -1,6 +1,7 @@ -/* $OpenBSD: getlog.c,v 1.54 2006/01/30 17:58:47 xsa Exp $ */ +/* $OpenBSD: getlog.c,v 1.55 2006/02/06 16:21:43 xsa Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau + * Copyright (c) 2005, 2006 Xavier Santolaria * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,14 +32,16 @@ #include "proto.h" -#define CVS_GLOG_RFONLY 0x01 -#define CVS_GLOG_HDONLY 0x02 - - #define CVS_GETLOG_REVSEP "----------------------------" #define CVS_GETLOG_REVEND \ "=============================================================================" +#define GLOG_BRANCH (1<<0) +#define GLOG_HEADER (1<<1) +#define GLOG_HEADER_DESCR (1<<2) +#define GLOG_NAME (1<<3) +#define GLOG_NOTAGS (1<<4) + static int cvs_getlog_init(struct cvs_cmd *, int, char **, int *); static int cvs_getlog_remote(CVSFILE *, void *); static int cvs_getlog_local(CVSFILE *, void *); @@ -79,10 +82,7 @@ CVS_CMD_SENDDIR | CVS_CMD_ALLOWSPEC | CVS_CMD_SENDARGS2 }; -static int log_rfonly = 0; -static int log_honly = 0; -static int log_lhonly = 0; -static int log_notags = 0; +static int runflags = 0; static int cvs_getlog_init(struct cvs_cmd *cmd, int argc, char **argv, int *arg) @@ -92,27 +92,28 @@ while ((ch = getopt(argc, argv, cmd->cmd_opts)) != -1) { switch (ch) { case 'b': + runflags |= GLOG_BRANCH; break; case 'd': break; case 'h': - log_honly = 1; + runflags |= GLOG_HEADER; break; case 'l': cmd->file_flags &= ~CF_RECURSE; break; case 'N': - log_notags = 1; + runflags |= GLOG_NOTAGS; break; case 'R': - log_rfonly = 1; + runflags |= GLOG_NAME; break; case 'r': break; case 's': break; case 't': - log_lhonly = 1; + runflags |= GLOG_HEADER_DESCR; break; case 'w': break; @@ -129,13 +130,19 @@ cvs_getlog_pre_exec(struct cvsroot *root) { if (root->cr_method != CVS_METHOD_LOCAL) { - if (log_honly == 1) + if (runflags & GLOG_BRANCH) + cvs_sendarg(root, "-b", 0); + + if (runflags & GLOG_HEADER) cvs_sendarg(root, "-h", 0); - if (log_notags == 1) + + if (runflags & GLOG_NOTAGS) cvs_sendarg(root, "-N", 0); - if (log_rfonly == 1) + + if (runflags & GLOG_NAME) cvs_sendarg(root, "-R", 0); - if (log_lhonly == 1) + + if (runflags & GLOG_HEADER_DESCR) cvs_sendarg(root, "-t", 0); } return (0); @@ -218,7 +225,7 @@ cvs_rcs_getpath(cf, rcspath, sizeof(rcspath)); - if (log_rfonly == 1) { + if (runflags & GLOG_NAME) { cvs_printf("%s\n", rcspath); return (0); } @@ -245,7 +252,7 @@ TAILQ_FOREACH(acp, &(rf->rf_access), ra_list) cvs_printf("\t%s\n", acp->ra_name); - if (log_notags == 0) { + if (!(runflags & GLOG_NOTAGS)) { cvs_printf("symbolic names:\n"); TAILQ_FOREACH(sym, &(rf->rf_symbols), rs_list) cvs_printf("\t%s: %s\n", sym->rs_name, @@ -257,15 +264,15 @@ cvs_printf("total revisions: %u", rf->rf_ndelta); - if ((log_honly == 0) && (log_lhonly == 0)) + if (!(runflags & GLOG_HEADER) && !(runflags & GLOG_HEADER_DESCR)) cvs_printf(";\tselected revisions: %u", nrev); cvs_printf("\n"); - if ((log_honly == 0) || (log_lhonly == 1)) + if (!(runflags & GLOG_HEADER) || (runflags & GLOG_HEADER_DESCR)) cvs_printf("description:\n%s", rf->rf_desc); - if ((log_honly == 0) && (log_lhonly == 0)) { + if (!(runflags & GLOG_HEADER) && !(runflags & GLOG_HEADER_DESCR)) { TAILQ_FOREACH(rdp, &(rf->rf_delta), rd_list) { rcsnum_tostr(rdp->rd_num, numbuf, sizeof(numbuf)); cvs_printf(CVS_GETLOG_REVSEP "\nrevision %s\n", numbuf);