help-rcs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RFC: null-terminated separators for rlog


From: Jonathan Noack
Subject: RFC: null-terminated separators for rlog
Date: Wed, 19 Apr 2006 13:18:10 -0400
User-agent: Thunderbird 1.5 (X11/20060331)

Hey all,
I'm doing some work to improve CVSweb.  CVSweb attempts to parse rlog
output to display revision information but I keep bumping into
situations where rlog's output is ambiguous.  This happens when commit
logs include rlog/cvs log output.  For example, a revision on the main
branch will be merged back to an older branch and the rlog/cvs log
output of the original revision will be pasted into the commit log.
This makes accurately parsing rlog output quite difficult.  Example
output is at the bottom of this message.

I would like your comments on the following idea:
Add an optional argument to rlog (tentatively '-n') that appends a null
character to the end of revision and file separators.  Null characters
don't print to the console, so even if the user pasted in rlog '-n'
output into a commit log it wouldn't cause problems.  It is highly
unlikely that rlog's output would be ambiguous with this option.

Am I missing something?  Is there any easier way to accomplish this?

A prototype patch is attached.

Thanks!
-Jonathan

Here is an example where the cvs log output of revision 1.372 was pasted
into the commit log for 1.342.2.13:
$ rlog -r1.342.2.13 /home/ncvs/src/UPDATING,v
...
----------------------------
revision 1.342.2.13
date: 2004/10/10 16:16:31;  author: mtm;  state: Exp;  lines: +14 -5
branches:  1.342.2.13.2;
RCS file: /home/ncvs/src/UPDATING,v
----------------------------
revision 1.372
date: 2004/10/07 14:51:23;  author: mtm;  state: Exp;  lines: +0 -0
Make a note in UPDATING about the recent change regarding
the FreeBSD keyword.
=============================================================================

o Add additional information on how to cope with this change.
o Fix the date for the previous libthr change to correctly reflect
  the date it was MFCed on.

Approved by: re/assumed because of approval for the actual src change
----------------------------
=============================================================================

-- 
Jonathan Noack | address@hidden | OpenPGP: 0x991D8195
Index: rlog.c
===================================================================
RCS file: /home/ncvs/src/gnu/usr.bin/rcs/rlog/rlog.c,v
retrieving revision 1.13
diff -u -r1.13 rlog.c
--- rlog.c      27 Aug 1999 23:36:59 -0000      1.13
+++ rlog.c      19 Apr 2006 15:54:06 -0000
@@ -211,6 +211,7 @@
 static int branchflag; /*set on -b */
 static int exitstatus;
 static int lockflag;
+static int separatorNullflag;
 static struct Datepairs *datelist, *duelst;
 static struct Revpairs *revlist, *Revlst;
 static struct authors *authorlist;
@@ -221,7 +222,7 @@
 mainProg(rlogId, "rlog", "$FreeBSD: src/gnu/usr.bin/rcs/rlog/rlog.c,v 1.13 
1999/08/27 23:36:59 peter Exp $")
 {
        static char const cmdusage[] =
-               "\nrlog usage: rlog -{bhLNRt} -v[string] -ddates -l[lockers] 
-r[revs] -sstates -Vn -w[logins] -xsuff -zzone file ...";
+               "\nrlog usage: rlog -{bhLNnRt} -v[string] -ddates -l[lockers] 
-r[revs] -sstates -Vn -w[logins] -xsuff -zzone file ...";
 
        register FILE *out;
        char *a, **newargv;
@@ -325,6 +326,10 @@
                        vstring = a;
                        break;
 
+               case 'n':
+                       separatorNullflag = true;
+                       break;
+
                 default:
                unknown:
                        error("unknown option: %s%s", *argv, cmdusage);
@@ -475,8 +480,13 @@
                putrunk();
                putree(Head);
            }
-           aputs("----------------------------\n", out);
-           
aputs("=============================================================================\n",out);
+           aputs("----------------------------", out);
+           if (separatorNullflag)
+               aputc_('\0', out);
+           
aputs("\n=============================================================================",out);
+           if (separatorNullflag)
+               aputc_('\0', out);
+           aputc_('\n', out);
          }
        Ofclose(out);
        exitmain(exitstatus);
@@ -585,8 +595,11 @@
             return;
 
        out = stdout;
+       aputs("----------------------------", out);
+       if (separatorNullflag)
+           aputc_('\0', out);
        aprintf(out,
-               "----------------------------\nrevision %s%s",
+               "\nrevision %s%s",
                node->num,  pre5 ? "        " : ""
        );
         if ( node->lockedby )

reply via email to

[Prev in Thread] Current Thread [Next in Thread]