This area is an archive and is no longer actively maintained. Information found on this page is likely to be extremely out of date and therefore highly inaccurate. We recommend the Ximbiot - CVS Wiki for up-to-date information about CVS and its associtated tools.

If you do find anything useful on this page that is not yet in the Ximbiot - CVS Wiki and you have the time, please add it!

CVS and the W3C Document Object Model (DOM)

CVS and the W3C Document Object Model (DOM)

This page is concerned with some experimental patches to get CVS to generate XML/HTML which can then be used for scripting CVS using the DOM. This has the potential to allow scripts to have a _much_ cleaner interface to CVS than via, for example, the CVS command line.

Right now it is a proof of concept (that is, it does not give scripts access to all of CVS's features), but extending it probably wouldn't be too hard.

Demo

To see how this is supposed to work look at the following demo which is supposed to let you see a "cvs log" and show/hide various fields, all without contacting the web server. If you want the demo to actually run for you, you need a browser which supports ECMAscript (javascript) and DOM (see disclaimers below). But the cool thing is that even with a totally vanilla browser, you do get to see the plain text output from "cvs log". The demo page is a static page which was produced on a one-shot basis using the tools below, although of course running this kind of thing from a live repository is more how you would use this approach in practice.

The main disclaimer is that there is a bug here somewhere; can you help find it? On that note, Joerg Brunsmann has supplied a nice table which may be helpful in understanding both DOM in general, and DOM as currently implemented in Mozilla.

How does it work?

First the data is generated by a modified CVS server which outputs tagged text for cvs log. Tagged text ("MT" response) is a general-purpose feature, there is nothing hackish about the patch which enables tagged text.

Secondly a CGI script (our example is written in perl) takes that data and converts the tagged text to XML/HTML. The conversion doesn't need to know about particular tags - tagged text is very similar to XML/HTML, so this kind of conversion is easy. For example, MT fname foo.c from the CVS protocol becomes <cvs-fname>foo.c</cvs-fname> in XML/HTML. We add cvs- to the start of the tag name to avoid name clashes with standard HTML tags. Or another variant would be <span name="fname">foo.c</span>.

Thirdly your browser displays the XML/HTML. The code which actually lets the client show and hide fields is written in ECMAscript and the DOM is the interface by which ECMAscript code has a clean way to access particular parts of the XML/HTML document.

For More Information

The Mozilla DOM page explains what DOM is and how to get a DOM browser.

[Cyclic Home]

Derek Price, CVS developer and technical editor of Essential CVS (Essentials line from O'Reilly Press) , and others offer consulting services and training through Ximbiot.