Example usage for org.apache.commons.jrcs.rcs Version Version

List of usage examples for org.apache.commons.jrcs.rcs Version Version

Introduction

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

Prototype

public Version(Version v) 

Source Link

Document

Create a new Version by copying another.

Usage

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

/**
 * Updates working and version member variables by running bk --version.
 *//*from   ww  w.jav  a2s .co m*/
private void ensureVersion() {
    if (working == null) {
        ensureCommand(CMD_PROPERTY_KEY, CMD_FALLBACK);
        final Executor exec = new Executor(new String[] { RepoCommand, "--version" });
        if (exec.exec(false) == 0) {
            working = Boolean.TRUE;
            final Matcher matcher = VERSION_PATTERN.matcher(exec.getOutputString());
            if (matcher.find()) {
                try {
                    version = new Version(matcher.group(1));
                } catch (final InvalidVersionNumberException e) {
                    assert false : "Failed to parse a version number.";
                }
            }
        } else {
            working = Boolean.FALSE;
        }
        if (version == null) {
            version = new Version(0, 0);
        }
    }
}