Search in sources :

Example 11 with AccuRev

use of org.apache.maven.scm.provider.accurev.AccuRev in project maven-scm by apache.

the class AccuRevExportCommand method extractSource.

@Override
protected List<File> extractSource(AccuRevScmProviderRepository repository, File basedir, AccuRevVersion version) throws AccuRevException {
    AccuRev accuRev = repository.getAccuRev();
    AccuRevInfo info = accuRev.info(basedir);
    String basisStream = version.getBasisStream();
    String transactionId = version.getTimeSpec();
    if (!AccuRevVersion.isNow(transactionId) && !AccuRevCapability.POPULATE_TO_TRANSACTION.isSupported(accuRev.getClientVersion())) {
        getLogger().warn(String.format("Ignoring transaction id %s, Export can only extract current sources", transactionId));
        transactionId = "now";
    } else {
        // We might be heading to a transaction id that is not yet available on a replica
        accuRev.syncReplica();
    }
    boolean removedWorkspace = false;
    if (info.isWorkSpace()) {
        String stat = accuRev.stat(basedir);
        if (stat != null) {
            throw new AccuRevException(String.format("Cannot populate %s, as it is a non-ignored " + "subdirectory of workspace %s rooted at %s.", basedir.getAbsolutePath(), info.getWorkSpace(), info.getTop()));
        }
        // ok, the subdirectory must be ignored. temporarily remove the workspace.
        removedWorkspace = accuRev.rmws(info.getWorkSpace());
    }
    try {
        File path = new File(repository.getDepotRelativeProjectPath());
        return accuRev.popExternal(basedir, basisStream, transactionId, Collections.singletonList(path));
    } finally {
        if (removedWorkspace) {
            accuRev.reactivate(info.getWorkSpace());
        }
    }
}
Also used : AccuRev(org.apache.maven.scm.provider.accurev.AccuRev) AccuRevException(org.apache.maven.scm.provider.accurev.AccuRevException) ScmFile(org.apache.maven.scm.ScmFile) File(java.io.File) AccuRevInfo(org.apache.maven.scm.provider.accurev.AccuRevInfo)

Aggregations

AccuRev (org.apache.maven.scm.provider.accurev.AccuRev)11 File (java.io.File)9 AccuRevInfo (org.apache.maven.scm.provider.accurev.AccuRevInfo)6 ScmFile (org.apache.maven.scm.ScmFile)5 AccuRevException (org.apache.maven.scm.provider.accurev.AccuRevException)4 ArrayList (java.util.ArrayList)2 ScmException (org.apache.maven.scm.ScmException)2 ScmVersion (org.apache.maven.scm.ScmVersion)2 AccuRevVersion (org.apache.maven.scm.provider.accurev.AccuRevVersion)2 Date (java.util.Date)1 ScmBranch (org.apache.maven.scm.ScmBranch)1 ScmRevision (org.apache.maven.scm.ScmRevision)1 AddScmResult (org.apache.maven.scm.command.add.AddScmResult)1 BlameLine (org.apache.maven.scm.command.blame.BlameLine)1 BlameScmResult (org.apache.maven.scm.command.blame.BlameScmResult)1 ChangeLogScmResult (org.apache.maven.scm.command.changelog.ChangeLogScmResult)1 ChangeLogSet (org.apache.maven.scm.command.changelog.ChangeLogSet)1 CheckInScmResult (org.apache.maven.scm.command.checkin.CheckInScmResult)1 LoginScmResult (org.apache.maven.scm.command.login.LoginScmResult)1 RemoveScmResult (org.apache.maven.scm.command.remove.RemoveScmResult)1