[cvsnt] Ann: XML schema for cvs log output

Bernhard Weichel from-support.cvsnt at b-weichel.7to.de
Tue Apr 15 17:11:42 BST 2003


Tony Hoyle wrote:
> On Tue, 15 Apr 2003 07:45:07 -0500, "Kari Hoijarvi"
> <hoijarvi at me.wustl.edu> wrote:
>
>> It indeed could be nice, if you didn't have to parse the
>> CVSNT output. Adding XML output option is probably less
>> work than writing a parser to do it.
>>
> You *have* to be joking.  I estimate 3-6 months work to make a server
> that uses XML, and it would be completely incompatible with all other
> CVS servers (so nobody would use it anyway).
>
> I really don't understand why anyone would want an XML version anyway
> (and not to be too harsh, spending 10 seconds sticking tags around
> every word in the output from 'cvs log' does *not* constitute an XML
> schema) - the client/server protocol is well defined and easy to
> parse.

Sorry, I do not know the internals of CVSNT and even not the CVS server
protocol.
I am simply using the output of the command lines. So I thought, it should
be
possible to change the client such that it produces similar output.

Tony, what I in fact did, is to write a parser using an XML tool
(MetaMorphosis)
that parses the output of CVS -log. The parse tree is represented as XML.
>From this xml, I derived the XML schema.

One of the major problems is the extraction of the descriptions.
So the production rules below will fail if a user comment starts with
"--" or with "==".

Here are the production rules I am using:

grammar   []  !bg

                <cvslog> .

                <cvslog> =  <noncvsfiles> (<rcsinfo> | <_ws> | <garbage> ) *
.

                <noncvsfiles>  = <noncvsfile> * .
                <noncvsfile>   = ("? "%) <_restline> .

                <garbage> =! ^[\n]? "\n".

                <rcsinfo> =! <rcsfile>
                            <workingfile>
                            <head>
                            <branch>
                            <locks>
                            <accesslist>
                            <symbolicnames>
                            <keywordsubstitution>
                            <totalrevisions> (";" [ \t]! % )
<selectedrevisions>
                            ("description:\n" %)<description>*

("==========================================================================
===\n" %)

                            .

                 <_restline>   = ([ ]?%) ^[\n]? ("\n"%) .
                 <_ws>         = ([ \n\t]! %) .

                 <rcsfile>       =! ("RCS file:" % ) <_restline> .
                 <workingfile>   =! ("Working file: "%) <_restline> .
                 <head>          =! ("head:"%) <_restline> .
                 <branch>        =! ("branch:"%) <_restline> .
                 <locks>         =! ("locks:" %) <_restline> .
                 <accesslist>    =! ("access list:" %) <_restline> .
                 <symbolicnames> =! ("symbolic names:\n" %)
                                     <symbolicname> *
                                     .
                 <symbolicname>  =! ([ \t]!%) <_restline> .

                 <keywordsubstitution> =! ("keyword substitution:"%)
<_restline> .

                 <totalrevisions> = ("total revisions: "%) [0-9]! .
                 <selectedrevisions> = ("selected revisions:"%) <_restline>
.

                 <description>  =! ("----------------------------\n" %)
                                  <revision>
                                  <date> (";"%)
                                  <author> (";"%)
                                  <state>  (";"%) <lines>/
                                  ( ("\n"%))/
                                  <comment>/
                                  .

                 <revision>    = ("revision"%) <_restline>.
                 <date>        = ("date: "%) ^[;]! .
                 <keep> = <yyyy> ("/"%)
                                           <mon>   ("/"%)
                                           <dd>   (" "%)
                                           <hh>   (":"%)
                                           <min>  (":"%)
                                           <sec>
                                           .

                 <yyyy>        = [0-9][0-9][0-9][0-9] .
                 <mon>         = "1" [0-2]  |
                                 "0" [0-9]  .

                 <dd>          = [0-2] [0-9] |
                                 "3"   [0-1] .
                 <hh>          = [0-1][0-9] |
                                 "2"  [0-3] .

                 <min>         = [0-5][0-9] .
                 <sec>         = [0-5][0-9] .

                 <author>      = ([ ]! "author: "%) ^[;]!.
                 <state>       = ([ ]! "state: "%) ^[;]!.
                 <lines>       = ([ ]! "lines: "%) <addedlines> ([ ]!  %)
                                                 <deletedlines>  .

                 <addedlines>   = ("+"%) [0-9]! .
                 <deletedlines> = ("-"%) [0-9]! .

                 <comment>    =! (  ^[\-\=] ^[\n]? "\n"  )*  .  // todo:
does not cover "--foo"

              !eg

              ;



More information about the cvsnt mailing list