Example usage for org.apache.commons.jrcs.rcs Node getAuthor

List of usage examples for org.apache.commons.jrcs.rcs Node getAuthor

Introduction

In this page you can find the example usage for org.apache.commons.jrcs.rcs Node getAuthor.

Prototype

public final String getAuthor() 

Source Link

Usage

From source file:org.opensolaris.opengrok.history.RCSHistoryParser.java

private void traverse(Node n, List<HistoryEntry> history) {
    if (n == null) {
        return;//from www . j  av a2s  .  c o m
    }
    traverse(n.getChild(), history);
    TreeMap<?, ?> brt = n.getBranches();
    if (brt != null) {
        for (Iterator<?> i = brt.values().iterator(); i.hasNext();) {
            Node b = (Node) i.next();
            traverse(b, history);
        }
    }
    if (!n.isGhost()) {
        HistoryEntry entry = new HistoryEntry();
        entry.setRevision(n.getVersion().toString());
        entry.setDate(n.getDate());
        entry.setAuthor(n.getAuthor());
        entry.setMessage(n.getLog());
        entry.setActive(true);
        history.add(entry);
    }
}

From source file:org.opensolaris.opengrok.history.RCSRepository.java

static Annotation annotate(File file, String revision, File rcsFile) throws IOException {
    try {//w  w  w .  j  a va 2  s . c  o m
        Archive archive = new Archive(rcsFile.getPath());
        // If revision is null, use current revision
        Version version = revision == null ? archive.getRevisionVersion()
                : archive.getRevisionVersion(revision);
        // Get the revision with annotation
        archive.getRevision(version, true);
        Annotation a = new Annotation(file.getName());
        // A comment in Archive.getRevisionNodes() says that it is not
        // considered public API anymore, but it works.
        for (Node n : archive.getRevisionNodes()) {
            String rev = n.getVersion().toString();
            String author = n.getAuthor();
            a.addLine(rev, author, true);
        }
        return a;
    } catch (ParseException pe) {
        throw wrapInIOException("Parse exception annotating RCS repository", pe);
    } catch (InvalidFileFormatException iffe) {
        throw wrapInIOException("File format exception annotating RCS repository", iffe);
    } catch (PatchFailedException pfe) {
        throw wrapInIOException("Patch failed exception annotating RCS repository", pfe);
    }
}