require 'cvs'
# needs read permission only:
c = CVS.create(':pserver:anonymous@cvs.m17n.org:/cvs/root')
c.dir('.').listdir.each {|d| p d.path}
c.dir('gnus').listdir.each {|d| p d.path}
c.dir('gnus/lisp').listfile.each {|f| p f.name}
c.dir('semi').parse_log(CVS::Visitor::Dump.new)
c.file('flim/ChangeLog').tags.each {|tag,rev| p [tag,rev.to_s]}
c.file('flim/DOODLE-VERSION').tags.each {|tag,rev| p [tag,rev.to_s]} # cvs.rb handles attic-ness for you.
c.file('semi/ChangeLog').parse_raw_log(CVS::Visitor::Dump.new)
c.file('semi/ChangeLog').parse_log(CVS::Visitor::Dump.new)
c.file('apel/ChangeLog').checkout(RCS::Revision.create('1.1.1.1')) {|d, a| p a; print d}
c.file('apel/ChangeLog').heads.each {|t, h| print "#{t||'*maintrunk*'} #{h}\n"}
c.file('flim/ChangeLog').annotate(RCS::Revision.create("1.30")) {|line, date, rev, author| p [line, date, rev.to_s, author]}
# needs write permission (works with remote repositories):
d = CVS.create(':ext:foo@bar:/cvsroot//tst')
d.mkdir('subdirname')
h = d.mkfile('a', 'initial contents', 'first log')
h.checkin('modified contents', 'modified log')
h.remove('removed log')
h.add('re-added contents', 'added log')
# needs to be local repository:
c = CVS.create('/home/foo/.cvsroot')
c.file('cvs/ChangeLog').parse_log(CVS::Visitor::Dump.new)
c.file('cvs/ChangeLog').fullannotate(RCS::Revision.create("1.30")) {|line, date1, rev1, author, rev2, date2| p [line, date1, rev1.to_s, author, rev2.to_s, date2]}
Abstract CVS repository class.
CVS.create(arg[, readonly])CVS.create is an intelligent factory method for CVS objects.
cvsroot// => CVS repository object. cvsroot//dir => CVS directory object. cvsroot//dir// => CVS directory object. (same as above.) cvsroot//dir//file => CVS file object. cvsroot//dir//Attic/file => CVS file object which is placed in Attic.
If cvsroot begins with `/', a instantiated obect accesseses a repository directly. Otherwise, the object accesses the repository by cvs command. I.e. this module works well with remote repositories as well as local repositores. It gets speed advantages with local repositories.
If the argument doesn't contain `//' and begins with `/', CVS.create searches a CVSROOT directory and RCS file in given argument and instantiate a suitable object. If it doesn't begins with `/', instantiate a remote CVS repository object.
Syntax:
cvs_create_arg = exact_arg | ambiguous_arg exact_arg = cvsroot '//' [directory ['//' [file]]] | cvsroot = local_cvsroot | remote_cvsroot local_cvsroot = <cvsroot begins with '/'> remote_cvsroot = <cvsroot not begins with '/'> directory = '.' | path path = name | name '/' path file = ['Attic/'] name name = <filename> ambiguous_arg = '/' path
If `readonly' is true, only write operations are forbidden and locking is disabled.
cvsrootreturns CVSROOT as an string.
top_dircreates a CVS directory object which points top directory of the repository.
dir(path)creates a CVS directory object which points `path'.
file(path[, attic])creates a CVS file object which points `path'.
`attic' specify whether the file is placed in Attic.
Abstract CVS directory class.
cvsrootreturns the CVS repository object.
pathreturns a path from a top directory of the repository.
top?returns true if self is a top directory of the repository.
parentreturns a parent directory. If self is a top directory, nil is returned.
simple_dir(name)creates a CVS directory object for direct subdirectory.
simple_file(name[, attic])creates a CVS file object for a file contained by the directory.
dir(path)creates a CVS directory object for a directory under the directory.
file(path[, attic])creates a CVS file object for a file under the directory.
listdirreturns an array of CVS directory objects which represent subdirectories.
listfilereturns an array of CVS file objects for non-directory files directly under the directory.
parse_log(visitor[, opts])run `cvs log' or `rlog' for all non-directory files in the directory.
mkdir(directory_name)creates a directory under the directory.
mkfile(file_name, contents, log[, description[, branch_tag]])creates a file in the directory.
Abstract CVS file class.
dirreturns the CVS directory object.
namereturns the filename.
atticreturns attic info.
pathreturns a path from a top directory of the repository.
parse_log(visitor[, opts])run `cvs log' or `rlog' for the file.
tagsreturns a hash which maps a tag to a revision.
checkout(rev) {|contents, attr| ...}
annotate(rev) {|line, date, rev, author| ...}
mkbranch(rev, tag)
head([tag])creates a head object.
If `tag' is not specified, a head object for main trunk is created.
headsreturns a hash which maps a tag to a head object.
The hash contains a head object for main trunk as a value of nil as a key.
Abstract CVS head class.
add(contents, log)
checkin(contents, log)
remove(log)
CVS file attribute class
mtime
mode