Search in sources :

Example 16 with AccuRevInfo

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

the class InfoConsumerTest method testConsumeInsideWorkspace.

@Test
public void testConsumeInsideWorkspace() throws Exception {
    AccuRevInfo info = consume("/info.inworkspace.txt");
    assertThat(info.getBasis(), is("maventst"));
    assertThat(info.getTop(), is("/home/ggardner/accurev/ws/maventst"));
    assertThat(info.getWorkSpace(), is("maventst_ggardner"));
    assertThat(info.getUser(), is("ggardner"));
}
Also used : AccuRevInfo(org.apache.maven.scm.provider.accurev.AccuRevInfo) Test(org.junit.Test)

Example 17 with AccuRevInfo

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

the class InfoConsumerTest method testNotLoggedIn.

@Test
public void testNotLoggedIn() throws Exception {
    AccuRevInfo info = consume("/info.notloggedin.txt");
    assertThat(info.isLoggedIn(), is(false));
}
Also used : AccuRevInfo(org.apache.maven.scm.provider.accurev.AccuRevInfo) Test(org.junit.Test)

Example 18 with AccuRevInfo

use of org.apache.maven.scm.provider.accurev.AccuRevInfo 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

AccuRevInfo (org.apache.maven.scm.provider.accurev.AccuRevInfo)18 File (java.io.File)10 Test (org.junit.Test)8 AccuRev (org.apache.maven.scm.provider.accurev.AccuRev)6 CommandParameters (org.apache.maven.scm.CommandParameters)5 ScmFileSet (org.apache.maven.scm.ScmFileSet)5 AbstractAccuRevCommandTest (org.apache.maven.scm.provider.accurev.command.AbstractAccuRevCommandTest)5 ScmFileMatcher.assertHasScmFile (org.apache.maven.scm.ScmFileMatcher.assertHasScmFile)4 CheckInScmResult (org.apache.maven.scm.command.checkin.CheckInScmResult)3 TagScmResult (org.apache.maven.scm.command.tag.TagScmResult)3 AccuRevException (org.apache.maven.scm.provider.accurev.AccuRevException)3 ScmFile (org.apache.maven.scm.ScmFile)2 AccuRevScmProviderRepository (org.apache.maven.scm.provider.accurev.AccuRevScmProviderRepository)2 BufferedReader (java.io.BufferedReader)1 InputStream (java.io.InputStream)1 InputStreamReader (java.io.InputStreamReader)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 ScmException (org.apache.maven.scm.ScmException)1 ScmVersion (org.apache.maven.scm.ScmVersion)1