[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Cvs-cvs] ccvs/src ChangeLog annotate.c rcs.c rcs.h sanit...
From: |
Mark D. Baushke |
Subject: |
[Cvs-cvs] ccvs/src ChangeLog annotate.c rcs.c rcs.h sanit... |
Date: |
Sat, 31 Dec 2005 23:33:44 +0000 |
CVSROOT: /cvsroot/cvs
Module name: ccvs
Branch:
Changes by: Mark D. Baushke <address@hidden> 05/12/31 23:33:43
Modified files:
src : ChangeLog annotate.c rcs.c rcs.h sanity.sh
Log message:
[Add CVSNT compatible [-w width] switch to cvs (r)annotate command.]
* rcs.c (RCS_deltas): Provide for annotate_width for author field
and use Xasprintf in place of xmalloc/sprintf.
* rcs.h (annotate_width): New global.
* annotate.c (annotate_width): Default to 8.
(annotate_usage): New -w width option.
(annotate): Ditto.
* sanity.sh (userlen, username1): New variables.
(basica-10w1, basica-10wmax, ann-10w1, ann-10wmax): New tests for
the annotate -w width option.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/ChangeLog.diff?tr1=1.3330&tr2=1.3331&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/annotate.c.diff?tr1=1.20&tr2=1.21&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/rcs.c.diff?tr1=1.356&tr2=1.357&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/rcs.h.diff?tr1=1.82&tr2=1.83&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/sanity.sh.diff?tr1=1.1106&tr2=1.1107&r1=text&r2=text
Patches:
Index: ccvs/src/ChangeLog
diff -u ccvs/src/ChangeLog:1.3330 ccvs/src/ChangeLog:1.3331
--- ccvs/src/ChangeLog:1.3330 Wed Dec 21 02:18:42 2005
+++ ccvs/src/ChangeLog Sat Dec 31 23:33:43 2005
@@ -1,3 +1,16 @@
+2005-12-31 Mark D. Baushke <address@hidden>
+
+ [Add CVSNT compatible [-w width] switch to cvs (r)annotate command.]
+ * rcs.c (RCS_deltas): Provide for annotate_width for author field
+ and use Xasprintf in place of xmalloc/sprintf.
+ * rcs.h (annotate_width): New global.
+ * annotate.c (annotate_width): Default to 8.
+ (annotate_usage): New -w width option.
+ (annotate): Ditto.
+ * sanity.sh (userlen, username1): New variables.
+ (basica-10w1, basica-10wmax, ann-10w1, ann-10wmax): New tests for
+ the annotate -w width option.
+
2005-12-20 Derek Price <address@hidden>
* sanity.sh (config3): Accept `.' in paths.
Index: ccvs/src/annotate.c
diff -u ccvs/src/annotate.c:1.20 ccvs/src/annotate.c:1.21
--- ccvs/src/annotate.c:1.20 Thu Mar 17 17:15:19 2005
+++ ccvs/src/annotate.c Sat Dec 31 23:33:43 2005
@@ -26,6 +26,7 @@
static char *tag = NULL;
static int tag_validated;
static char *date = NULL;
+int annotate_width = 8; /* Used in RCS_deltas() */
static int is_rannotate;
@@ -43,6 +44,7 @@
"\t-F\tAnnotate binary files.\n",
"\t-r rev\tAnnotate file as of specified revision/tag.\n",
"\t-D date\tAnnotate file as of specified date.\n",
+ "\t-w width\tModify width of username field (default 8, 0 < width <
80).\n",
"(Specify the --help global option for a list of other help options)\n",
NULL
};
@@ -55,6 +57,7 @@
{
int local = 0;
int err = 0;
+ char *widthstr = NULL;
int c;
is_rannotate = (strcmp(cvs_cmd_name, "rannotate") == 0);
@@ -63,7 +66,7 @@
usage (annotate_usage);
optind = 0;
- while ((c = getopt (argc, argv, "+lr:D:fFR")) != -1)
+ while ((c = getopt (argc, argv, "+lr:D:fFRw:")) != -1)
{
switch (c)
{
@@ -86,6 +89,20 @@
case 'F':
force_binary = 1;
break;
+ case 'w':
+ {
+ int w = atoi(optarg);
+ /* check bounds */
+ if (0 < w && w < 80)
+ {
+ widthstr = optarg;
+ annotate_width = w;
+ }
+ else
+ error (1, 0, "-w %d is invalid, must be > 0 && < 80",
+ w);
+ }
+ break;
case '?':
default:
usage (annotate_usage);
@@ -114,6 +131,8 @@
option_with_arg ("-r", tag);
if (date)
client_senddate (date);
+ if (widthstr)
+ option_with_arg ("-w", widthstr);
send_arg ("--");
if (is_rannotate)
{
Index: ccvs/src/rcs.c
diff -u ccvs/src/rcs.c:1.356 ccvs/src/rcs.c:1.357
--- ccvs/src/rcs.c:1.356 Mon Sep 26 03:36:44 2005
+++ ccvs/src/rcs.c Sat Dec 31 23:33:43 2005
@@ -7496,10 +7496,10 @@
if (prvers == NULL)
prvers = vers;
- buf = xmalloc (strlen (prvers->version) + 24);
- sprintf (buf, "%-12s (%-8.8s ",
- prvers->version,
- prvers->author);
+ buf = Xasprintf ("%-12s (%-*.*s ",
+ prvers->version,
+ annotate_width, annotate_width,
+ prvers->author);
cvs_output (buf, 0);
free (buf);
Index: ccvs/src/rcs.h
diff -u ccvs/src/rcs.h:1.82 ccvs/src/rcs.h:1.83
--- ccvs/src/rcs.h:1.82 Thu Mar 17 22:36:24 2005
+++ ccvs/src/rcs.h Sat Dec 31 23:33:43 2005
@@ -255,6 +255,7 @@
char *make_file_label (const char *, const char *, RCSNode *);
extern bool preserve_perms;
+extern int annotate_width;
/* From import.c. */
extern int add_rcs_file (const char *, const char *, const char *,
Index: ccvs/src/sanity.sh
diff -u ccvs/src/sanity.sh:1.1106 ccvs/src/sanity.sh:1.1107
--- ccvs/src/sanity.sh:1.1106 Wed Dec 21 02:18:42 2005
+++ ccvs/src/sanity.sh Sat Dec 31 23:33:43 2005
@@ -1092,6 +1092,10 @@
exit 1
fi
+# Also check for exactly the length of the username
+userlen=`echo $username | wc -c`
+userlen=`expr $userlen - 1`
+
# Only 8 characters of $username appear in some output.
if test `echo $username |wc -c` -gt 8; then
username8=`echo $username |sed 's/^\(........\).*/\1/'`
@@ -1099,6 +1103,13 @@
username8=$username
fi
+# Only 1 character of $username appear in some output.
+if test `echo $username |wc -c` -gt 1; then
+ username1=`echo $username |sed 's/^\(.\).*/\1/'`
+else
+ username1=$username
+fi
+
# Rarely, we need to match any username, not just the name of the user
# running this test. This variable usually shouldn't be used. $username
# contains the name of the user actually running this test.
@@ -3106,6 +3117,21 @@
1\.1 .'"$username8"' *[0-9a-zA-Z-]*.: ssfile
1\.2 .'"$username8"' *[0-9a-zA-Z-]*.: ssfile line 2'
+ dotest basica-10w1 "${testcvs} annotate -w 1" \
+'
+Annotations for sdir/ssdir/ssfile
+\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
+1\.1 .'"$username1"' *[0-9a-zA-Z-]*.: ssfile
+1\.2 .'"$username1"' *[0-9a-zA-Z-]*.: ssfile line 2'
+ if test $userlen -lt 80; then
+ dotest basica-10wmax "${testcvs} annotate -w $userlen" \
+'
+Annotations for sdir/ssdir/ssfile
+\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
+1\.1 .'"$username"' *[0-9a-zA-Z-]*.: ssfile
+1\.2 .'"$username"' *[0-9a-zA-Z-]*.: ssfile line 2'
+ fi
+
# Test resurrecting with strange revision numbers
cd sdir/ssdir
dotest basica-r1 "${testcvs} rm -f ssfile" \
@@ -21874,6 +21900,34 @@
1\.2 ($username8 *[0-9a-zA-Z-]*): a
1\.2 ($username8 *[0-9a-zA-Z-]*): blank
1\.2 ($username8 *[0-9a-zA-Z-]*): line"
+ dotest ann-10w1 "${testcvs} ann -w 1" \
+"
+Annotations for file1
+\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
+1\.1 ($username1 *[0-9a-zA-Z-]*): this
+1\.1 ($username1 *[0-9a-zA-Z-]*): is
+1\.2 ($username1 *[0-9a-zA-Z-]*): a
+1\.3 ($username1 *[0-9a-zA-Z-]*): trunk file
+1\.2 ($username1 *[0-9a-zA-Z-]*):
+1\.2 ($username1 *[0-9a-zA-Z-]*): with
+1\.2 ($username1 *[0-9a-zA-Z-]*): a
+1\.2 ($username1 *[0-9a-zA-Z-]*): blank
+1\.2 ($username1 *[0-9a-zA-Z-]*): line"
+ if test $userlen -lt 80; then
+ dotest ann-10wmax "${testcvs} ann -w $userlen" \
+"
+Annotations for file1
+\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
+1\.1 ($username *[0-9a-zA-Z-]*): this
+1\.1 ($username *[0-9a-zA-Z-]*): is
+1\.2 ($username *[0-9a-zA-Z-]*): a
+1\.3 ($username *[0-9a-zA-Z-]*): trunk file
+1\.2 ($username *[0-9a-zA-Z-]*):
+1\.2 ($username *[0-9a-zA-Z-]*): with
+1\.2 ($username *[0-9a-zA-Z-]*): a
+1\.2 ($username *[0-9a-zA-Z-]*): blank
+1\.2 ($username *[0-9a-zA-Z-]*): line"
+ fi
dotest ann-11 "${testcvs} ann -r br" \
"
Annotations for file1
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Cvs-cvs] ccvs/src ChangeLog annotate.c rcs.c rcs.h sanit...,
Mark D. Baushke <=