Return-Path: Delivered-To: apmail-maven-commits-archive@www.apache.org Received: (qmail 82795 invoked from network); 9 Jan 2010 18:24:10 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 9 Jan 2010 18:24:09 -0000 Received: (qmail 83439 invoked by uid 500); 9 Jan 2010 18:24:09 -0000 Delivered-To: apmail-maven-commits-archive@maven.apache.org Received: (qmail 83358 invoked by uid 500); 9 Jan 2010 18:24:09 -0000 Mailing-List: contact commits-help@maven.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@maven.apache.org Delivered-To: mailing list commits@maven.apache.org Received: (qmail 83335 invoked by uid 99); 9 Jan 2010 18:24:09 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 09 Jan 2010 18:24:09 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 09 Jan 2010 18:23:59 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 015C223889FA; Sat, 9 Jan 2010 18:23:39 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r897510 [1/5] - in /maven/sandbox/trunk/scm: ./ maven-scm-provider-accurevnew/ maven-scm-provider-accurevnew/src/ maven-scm-provider-accurevnew/src/main/ maven-scm-provider-accurevnew/src/main/java/ maven-scm-provider-accurevnew/src/main/ja... Date: Sat, 09 Jan 2010 18:23:37 -0000 To: commits@maven.apache.org From: olamy@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100109182339.015C223889FA@eris.apache.org> Author: olamy Date: Sat Jan 9 18:23:30 2010 New Revision: 897510 URL: http://svn.apache.org/viewvc?rev=897510&view=rev Log: [SCM-445] import the patch AS IS. Still need some review regarding formatting etc.... Added: maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/pom.xml maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRev.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevException.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevInfo.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevScmProvider.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevScmProviderRepository.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevStat.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevVersion.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/Transaction.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/WorkSpace.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/cli/ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/cli/AccuRevCommandLine.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/cli/AuthTokenConsumer.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/cli/CommandOutputConsumer.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/cli/ErrorConsumer.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/cli/FileConsumer.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/cli/HistoryConsumer.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/cli/InfoConsumer.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/cli/StatBackingConsumer.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/cli/StatConsumer.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/cli/WorkSpaceConsumer.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/cli/XppStreamConsumer.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/command/ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/command/AbstractAccuRevCommand.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/command/AbstractAccuRevExtractSourceCommand.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/command/add/ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/command/add/AccuRevAddCommand.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/command/changelog/ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/command/changelog/AccuRevChangeLogCommand.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/command/checkin/ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/command/checkin/AccuRevCheckInCommand.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/command/checkout/ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/command/checkout/AccuRevCheckOutCommand.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/command/export/ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/command/export/AccuRevExportCommand.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/command/login/ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/command/login/AccuRevLoginCommand.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/command/remove/ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/command/remove/AccuRevRemoveCommand.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/command/status/ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/command/status/AccuRevStatusCommand.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/command/tag/ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/command/tag/AccuRevTagCommand.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/command/update/ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/command/update/AccuRevUpdateCommand.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/command/update/AccuRevUpdateScmResult.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/site/ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/site/apt/ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/site/apt/index.apt (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/site/apt/tcktests.apt (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/site/site.xml maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/maven/ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/maven/scm/ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/maven/scm/ScmFileMatcher.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/maven/scm/provider/ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/maven/scm/provider/accurev/ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/maven/scm/provider/accurev/AccuRevScmProviderRepositoryMatcher.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/maven/scm/provider/accurev/AccuRevScmProviderRepositoryTest.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/maven/scm/provider/accurev/AccurevScmProviderTest.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/maven/scm/provider/accurev/AddElementsAction.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/maven/scm/provider/accurev/PutMapEntryAction.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/maven/scm/provider/accurev/cli/ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/maven/scm/provider/accurev/cli/AccuRevCommandLineTest.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/maven/scm/provider/accurev/cli/AccuRevJUnitUtil.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/maven/scm/provider/accurev/cli/AccuRevStatTest.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/maven/scm/provider/accurev/cli/AuthTokenConsumerTest.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/maven/scm/provider/accurev/cli/FileConsumerTest.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/maven/scm/provider/accurev/cli/HistoryConsumerTest.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/maven/scm/provider/accurev/cli/InfoConsumerTest.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/maven/scm/provider/accurev/cli/StatBackingConsumerTest.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/maven/scm/provider/accurev/cli/StatConsumerTest.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/maven/scm/provider/accurev/cli/WorkSpaceConsumerTest.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/maven/scm/provider/accurev/command/ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/maven/scm/provider/accurev/command/AbstractAccuRevCommandTest.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/maven/scm/provider/accurev/command/AccuRevTckUtil.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/maven/scm/provider/accurev/command/add/ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/maven/scm/provider/accurev/command/add/AccuRevAddCommandTest.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/maven/scm/provider/accurev/command/changelog/ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/maven/scm/provider/accurev/command/changelog/AccuRevChangeLogCommandTckTest.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/maven/scm/provider/accurev/command/changelog/AccuRevChangeLogCommandTest.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/maven/scm/provider/accurev/command/checkin/ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/maven/scm/provider/accurev/command/checkin/AccuRevCheckInCommandTckTest.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/maven/scm/provider/accurev/command/checkin/AccuRevCheckInCommandTest.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/maven/scm/provider/accurev/command/checkout/ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/maven/scm/provider/accurev/command/checkout/AccuRevCheckOutCommandTest.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/maven/scm/provider/accurev/command/checkout/AccuRevCheckoutCommandTckTest.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/maven/scm/provider/accurev/command/export/ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/maven/scm/provider/accurev/command/export/AccuRevExportCommandTest.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/maven/scm/provider/accurev/command/remove/ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/maven/scm/provider/accurev/command/remove/AccuRevRemoveCommandTest.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/maven/scm/provider/accurev/command/status/ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/maven/scm/provider/accurev/command/status/AccuRevStatusCommandTckTest.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/maven/scm/provider/accurev/command/status/AccuRevStatusCommandTest.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/maven/scm/provider/accurev/command/tag/ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/maven/scm/provider/accurev/command/tag/AccuRevTagCommandTckTest.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/maven/scm/provider/accurev/command/tag/AccuRevTagCommandTest.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/maven/scm/provider/accurev/command/update/ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/maven/scm/provider/accurev/command/update/AccuRevUpdateCommandTckTest.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/java/org/apache/maven/scm/provider/accurev/command/update/AccurevUpdateCommandTest.java (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/resources/ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/resources/PlexusTestContainerConfig.xml maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/resources/elementHistory.xml maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/resources/info.inworkspace.txt (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/resources/info.outsideworkspace.txt (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/resources/showrefs.xml maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/resources/showworkspaces.xml maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/resources/stat.backed.txt (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/resources/stat.backed.xml maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/resources/stat.ignored.txt (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/resources/stat.ignored.xml maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/resources/stat.noelement.xml maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/resources/stat.noworkspace.txt (with props) maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/resources/stat.noworkspace.xml maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/resources/streamHistory.xml maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/test/resources/workspaceHistory.xml Modified: maven/sandbox/trunk/scm/README.TXT Modified: maven/sandbox/trunk/scm/README.TXT URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/scm/README.TXT?rev=897510&r1=897509&r2=897510&view=diff ============================================================================== --- maven/sandbox/trunk/scm/README.TXT (original) +++ maven/sandbox/trunk/scm/README.TXT Sat Jan 9 18:23:30 2010 @@ -1,2 +1,4 @@ until legacy issue is solved a fork has been created here http://code.google.com/p/maven-scm-provider-svnjava ASF issue : https://issues.apache.org/jira/browse/LEGAL-45 + +regarding accurevnew have a look at http://jira.codehaus.org/browse/SCM-445 Added: maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/pom.xml URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/pom.xml?rev=897510&view=auto ============================================================================== --- maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/pom.xml (added) +++ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/pom.xml Sat Jan 9 18:23:30 2010 @@ -0,0 +1,121 @@ + + + + 4.0.0 + + org.apache.maven.scm + maven-scm-providers + 1.2 + + maven-scm-provider-accurevnew + 1.2.1-SNAPSHOT + Maven SCM AccuRev Provider + SCM Provider implementation for AccuRev + (http://www.accurev.com/). + + + + + + + org.apache.maven.scm + maven-scm-test + + + junit + junit + 4.5 + test + + + org.jmock + jmock + 2.5.1 + test + + + + + + org.codehaus.plexus + plexus-maven-plugin + + + + descriptor + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.5 + 1.5 + + + + org.apache.maven.plugins + maven-surefire-plugin + + + + tckBaseDir + ${tckBaseDir} + + + tckUrlPrefix + ${tckUrlPrefix} + + + tckAllowImpliedLogin + ${tckAllowImpliedLogin} + + + + + + + + + + org.apache.maven.plugins + maven-surefire-report-plugin + 2.4.2 + + + org.codehaus.mojo + cobertura-maven-plugin + 2.2 + + + + .*ScmLogger.* + + + + + + + Added: maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRev.java URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRev.java?rev=897510&view=auto ============================================================================== --- maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRev.java (added) +++ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRev.java Sat Jan 9 18:23:30 2010 @@ -0,0 +1,251 @@ +package org.apache.maven.scm.provider.accurev; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; +import java.text.SimpleDateFormat; +import java.util.Collection; +import java.util.List; +import java.util.Map; + +/** + * Represents the AccuRev CLI interface + * + * @author ggardner + */ +public interface AccuRev +{ + + public static final SimpleDateFormat ACCUREV_TIME_SPEC = new SimpleDateFormat( "yyyy/MM/dd HH:mm:ss" ); + + public static final String DEFAULT_REMOVE_MESSAGE = "removed (maven-scm)"; + + String DEFAULT_ADD_MESSAGE = "initial version (maven-scm)"; + + String DEFAULT_PROMOTE_MESSAGE = "promote (maven-scm)"; + + /** + * Reset command process, clear command output accumulators + */ + void reset(); + + /** + * Populate external to a workspace a specific version, to a specific location. + * + * @param basedir + * @param versionSpec + * @param elements (must be depot relative. if null "/./" root is used) + * @param poppedFiles + * @return + * @throws AccuRevException + */ + boolean pop( File basedir, String versionSpec, Collection elements, List poppedFiles ) + throws AccuRevException; + + /** + * Re populate missing files to existing workspace. + * + * @param basedir + * @param elements + * @param poppedFiles + * @return + * @throws AccuRevException + */ + boolean pop( File basedir, Collection elements, List poppedFiles ) + throws AccuRevException; + + /** + * Make workspace + * + * @param basisStream + * @param workspaceName + * @param basedir + * @return + * @throws AccuRevException + */ + boolean mkws( String basisStream, String workspaceName, File basedir ) + throws AccuRevException; + + /** + * Update a workspace or reftree, to a particular transaction id + * + * @param basedir + * @param transactionId + * @param updatedFiles + * @return + * @throws AccuRevException + */ + boolean update( File basedir, String transactionId, List updatedFiles ) + throws AccuRevException; + + /** + * Get info about the current logged in user for the current workspace. + * + * @param basedir + * @return + */ + AccuRevInfo info( File basedir ) + throws AccuRevException; + + /** + * Deactivate a workspace + * + * @param workSpaceName full name of the workspace, including the user suffix + * @return + */ + boolean rmws( String workSpaceName ) + throws AccuRevException; + + /** + * Reactivate a workspace + * + * @param workSpaceName full name of the workspace, including the user suffix + * @return + */ + boolean reactivate( String workSpaceName ) + throws AccuRevException; + + /** + * The accurev command line strings since last reset(), separated by ";" + * + * @return + */ + String getCommandLines(); + + /** + * Full output of accurev command line invocations since reset + * + * @return + */ + String getErrorOutput(); + + /** + * Add the file to the repository. File must be within a workspace + * + * @param basedir base directory of the workspace + * @param files to add (relative to basedir, or absolute) + * @param message the commit message + * @param addedFiles , list to which accurev will confirm the added files + */ + boolean add( File basedir, List files, String message, List addedFiles ) + throws AccuRevException; + + /** + * Remove the file from the repository. Files must be within a workspace + * + * @param basedir + * @param files + * @param message + * @param defunctedFiles + * @return + * @throws AccuRevException + */ + boolean defunct( File basedir, List files, String message, List defunctedFiles ) + throws AccuRevException; + + /** + * Any elements that have been kept previously or are currently modified will be promoted. + * + * @param basedir - location of the workspace to act on + * @param message + * @param promotedFiles list to which the promoted elements should be added + * @return + * @throws AccuRevException + */ + boolean promoteAll( File basedir, String message, List promotedFiles ) + throws AccuRevException; + + boolean promote( File basedir, List files, String message, List promotedFiles ) + throws AccuRevException; + + /** + * Relocate/reparent a workspace + * + * @param basedir + * @param workSpaceName (full workspacename including user) + * @param newBasisStream + * @return + * @throws AccuRevException + */ + boolean chws( File basedir, String workSpaceName, String newBasisStream ) + throws AccuRevException; + + boolean mksnap( String snapShotName, String basisStream ) + throws AccuRevException; + + boolean statTag( String streamName, List taggedFiles ) + throws AccuRevException; + + /** + * Sorts list of elements by whether they exist in the backing stream or not. + * + * @param basedir + * @param elements + * @param memberElements + * @param nonMemberElements + * @return + * @throws AccuRevException + */ + boolean statBackingStream( File basedir, Collection elements, Collection memberElements, + Collection nonMemberElements ) + throws AccuRevException; + + /** + * @param basedir + * @param elements list of elements to stat, relative to basedir + * @param statType + * @param matchingElements list of files relative to basedir that match the statType + * @return + * @throws AccuRevException + */ + boolean stat( File basedir, Collection elements, AccuRevStat statType, List matchingElements ) + throws AccuRevException; + + /** + * Accurev status of an element + * + * @param element + * @return null if ignored or not in workspace + */ + String stat( File element ) + throws AccuRevException; + + boolean history( String baseStream, String fromTimeSpec, String toTimeSpec, int count, + List transactions ) + throws AccuRevException; + + /** + * Logins in as the given user, retains authtoken for use with subsequent commands. + * + * @param user + * @param password + * @return + * @throws AccuRevException + */ + boolean login( String user, String password ) + throws AccuRevException; + + boolean showWorkSpaces( Map workSpaces ) + throws AccuRevException; + + boolean showRefTrees( Map workSpaces ) + throws AccuRevException; + +} \ No newline at end of file Propchange: maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRev.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRev.java ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Added: maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevException.java URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevException.java?rev=897510&view=auto ============================================================================== --- maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevException.java (added) +++ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevException.java Sat Jan 9 18:23:30 2010 @@ -0,0 +1,48 @@ +package org.apache.maven.scm.provider.accurev; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +public class AccuRevException + extends Exception +{ + + private static final long serialVersionUID = 1L; + + public AccuRevException() + { + super(); + } + + public AccuRevException( String message, Throwable cause ) + { + super( message, cause ); + } + + public AccuRevException( String message ) + { + super( message ); + } + + public AccuRevException( Throwable cause ) + { + super( cause ); + } + +} Propchange: maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevException.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevException.java ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Added: maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevInfo.java URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevInfo.java?rev=897510&view=auto ============================================================================== --- maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevInfo.java (added) +++ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevInfo.java Sat Jan 9 18:23:30 2010 @@ -0,0 +1,121 @@ +package org.apache.maven.scm.provider.accurev; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; + +public class AccuRevInfo +{ + + private File basedir; + + private String user; + + private String workSpace; + + private String basis; + + private String top; + + private String server; + + private int port; + + public int getPort() + { + return port; + } + + public void setPort( int port ) + { + this.port = port; + } + + public String getServer() + { + return server; + } + + public void setServer( String server ) + { + this.server = server; + } + + public String getUser() + { + return user; + } + + public void setUser( String user ) + { + this.user = user; + } + + public String getWorkSpace() + { + return workSpace; + } + + public void setWorkSpace( String workSpace ) + { + this.workSpace = workSpace; + } + + public String getBasis() + { + return basis; + } + + public void setBasis( String basis ) + { + this.basis = basis; + } + + public String getTop() + { + return top; + } + + public void setTop( String top ) + { + this.top = top; + } + + public File getBasedir() + { + return basedir; + } + + public AccuRevInfo( File basedir ) + { + this.basedir = basedir; + } + + public boolean isWorkSpace() + { + return getWorkSpace() != null; + } + + public boolean isWorkSpaceTop() + { + return ( getTop() != null ) && getBasedir().equals( new File( getTop() ) ); + } + +} Propchange: maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevInfo.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevInfo.java ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Added: maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevScmProvider.java URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevScmProvider.java?rev=897510&view=auto ============================================================================== --- maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevScmProvider.java (added) +++ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevScmProvider.java Sat Jan 9 18:23:30 2010 @@ -0,0 +1,289 @@ +package org.apache.maven.scm.provider.accurev; + +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the + * Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" + * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ + +import java.io.File; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.List; + +import org.apache.maven.scm.ChangeSet; +import org.apache.maven.scm.CommandParameter; +import org.apache.maven.scm.CommandParameters; +import org.apache.maven.scm.ScmException; +import org.apache.maven.scm.ScmFile; +import org.apache.maven.scm.ScmFileSet; +import org.apache.maven.scm.ScmRevision; +import org.apache.maven.scm.command.add.AddScmResult; +import org.apache.maven.scm.command.changelog.ChangeLogScmResult; +import org.apache.maven.scm.command.checkin.CheckInScmResult; +import org.apache.maven.scm.command.checkout.CheckOutScmResult; +import org.apache.maven.scm.command.export.ExportScmResult; +import org.apache.maven.scm.command.login.LoginScmResult; +import org.apache.maven.scm.command.remove.RemoveScmResult; +import org.apache.maven.scm.command.status.StatusScmResult; +import org.apache.maven.scm.command.tag.TagScmResult; +import org.apache.maven.scm.command.update.UpdateScmResult; +import org.apache.maven.scm.provider.AbstractScmProvider; +import org.apache.maven.scm.provider.ScmProviderRepository; +import org.apache.maven.scm.provider.accurev.cli.AccuRevCommandLine; +import org.apache.maven.scm.provider.accurev.command.add.AccuRevAddCommand; +import org.apache.maven.scm.provider.accurev.command.changelog.AccuRevChangeLogCommand; +import org.apache.maven.scm.provider.accurev.command.checkin.AccuRevCheckInCommand; +import org.apache.maven.scm.provider.accurev.command.checkout.AccuRevCheckOutCommand; +import org.apache.maven.scm.provider.accurev.command.export.AccuRevExportCommand; +import org.apache.maven.scm.provider.accurev.command.login.AccuRevLoginCommand; +import org.apache.maven.scm.provider.accurev.command.remove.AccuRevRemoveCommand; +import org.apache.maven.scm.provider.accurev.command.status.AccuRevStatusCommand; +import org.apache.maven.scm.provider.accurev.command.tag.AccuRevTagCommand; +import org.apache.maven.scm.provider.accurev.command.update.AccuRevUpdateCommand; +import org.apache.maven.scm.provider.accurev.command.update.AccuRevUpdateScmResult; +import org.apache.maven.scm.repository.ScmRepositoryException; +import org.apache.maven.scm.repository.UnknownRepositoryStructure; +import org.codehaus.plexus.util.StringUtils; + +/** + * AccuRev integration with Maven SCM + * + * @plexus.component role="org.apache.maven.scm.provider.ScmProvider" role-hint="accurev" + */ +public class AccuRevScmProvider extends AbstractScmProvider { + + public String getScmType() { + return "accurev"; + } + + /** + * The basic url parsing approach is to be as loose as possible. If you specify as per the docs you'll get what you expect. If + * you do something else the result is undefined. Don't use "/" "\" or "@" as the delimiter, + */ + public ScmProviderRepository makeProviderScmRepository(String scmSpecificUrl, char delimiter) throws ScmRepositoryException { + + List validationMessages = new ArrayList(); + + String[] tokens = StringUtils.split(scmSpecificUrl, Character.toString(delimiter)); + + //[[user][/pass]@host[:port]][:stream][:\project\dir] + + String basisStream = null; + String projectPath = null; + int port = AccuRevScmProviderRepository.DEFAULT_PORT; + String host = null; + String user = null; + String password = null; + + int i = 0; + while (i < tokens.length) { + int at = tokens[i].indexOf('@'); + // prefer "/", better not have a "/" or a "\\" in your password. + int slash = tokens[i].indexOf('/'); + slash = slash < 0 ? tokens[i].indexOf('\\') : slash; + + if (slash == 0) { + // this is the project path + projectPath = tokens[i].substring(1); + break; + } else if ((slash > 0 || (at >= 0)) && host == null && user == null) { + // user/pass@host + int len = tokens[i].length(); + if (at >= 0 && len > at) { + // everything after the "@" + host = tokens[i].substring(at + 1); + } + + if (slash > 0) { + // user up to / + user = tokens[i].substring(0, slash); + // pass between / and @ + password = tokens[i].substring(slash + 1, at < 0 ? len : at); + } else { + // no /, user from beginning to @ + user = tokens[i].substring(0, at < 0 ? len : at); + } + + } else if (host != null && tokens[i].matches("^[0-9]+$")) { + // only valid entry with all digits is the port specification. + port = Integer.parseInt(tokens[i]); + } else { + basisStream = tokens[i]; + } + + i++; + } + + if (i < tokens.length) { + validationMessages.add("Unknown tokens in URL " + scmSpecificUrl); + } + + AccuRevScmProviderRepository repo = new AccuRevScmProviderRepository(); + if (!StringUtils.isEmpty(user)) { + repo.setUser(user); + } + if (!StringUtils.isEmpty(password)) { + repo.setPassword(password); + } + if (!StringUtils.isEmpty(basisStream)) { + repo.setStreamName(basisStream); + } + if (!StringUtils.isEmpty(projectPath)) { + repo.setProjectPath(projectPath); + } + if (!StringUtils.isEmpty(host)) { + repo.setHost(host); + } + repo.setPort(port); + AccuRevCommandLine accuRev = new AccuRevCommandLine(host, port); + accuRev.setLogger(getLogger()); + repo.setAccuRev(accuRev); + + return repo; + + } + + @Override + protected LoginScmResult login(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) + throws ScmException { + + if (getLogger().isDebugEnabled()) { + getLogger().debug(repository.toString()); + } + + AccuRevLoginCommand command = new AccuRevLoginCommand(getLogger()); + return command.login(repository, fileSet, parameters); + } + + protected CheckOutScmResult checkout(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) + throws ScmException { + + // workaround deprecated behaviour + // TODO pull up to AbstractScmProvider + AccuRevScmProviderRepository accuRevRepo = (AccuRevScmProviderRepository) repository; + if (!repository.isPersistCheckout() && accuRevRepo.shouldUseExportForNonPersistentCheckout()) { + + ExportScmResult result = export(repository, fileSet, parameters); + if (result.isSuccess()) { + return new CheckOutScmResult(result.getCommandLine(), result.getExportedFiles(), accuRevRepo + .getExportRelativePath()); + } else { + return new CheckOutScmResult(result.getCommandLine(), result.getProviderMessage(), result.getCommandOutput(), false); + } + } + + AccuRevCheckOutCommand command = new AccuRevCheckOutCommand(getLogger()); + + return command.checkout(repository, fileSet, parameters); + + } + + @Override + protected CheckInScmResult checkin(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) + throws ScmException { + AccuRevCheckInCommand command = new AccuRevCheckInCommand(getLogger()); + + return command.checkIn(repository, fileSet, parameters); + } + + public ScmProviderRepository makeProviderScmRepository(File path) throws ScmRepositoryException, UnknownRepositoryStructure { + // TODO: accurev info with current dir = "path", find workspace. Find use-case for this. + return super.makeProviderScmRepository(path); + } + + @Override + protected AddScmResult add(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) + throws ScmException { + AccuRevAddCommand command = new AccuRevAddCommand(getLogger()); + return command.add(repository, fileSet, parameters); + } + + @Override + protected TagScmResult tag(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) + throws ScmException { + + AccuRevTagCommand command = new AccuRevTagCommand(getLogger()); + return command.tag(repository, fileSet, parameters); + + } + + @Override + protected StatusScmResult status(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) + throws ScmException { + AccuRevStatusCommand command = new AccuRevStatusCommand(getLogger()); + return command.status(repository, fileSet, parameters); + + } + + @Override + protected UpdateScmResult update(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) + throws ScmException { + AccuRevUpdateCommand command = new AccuRevUpdateCommand(getLogger()); + + Date now = new Date(); // better to store this before we run the update... + + UpdateScmResult result = command.update(repository, fileSet, parameters); + + if (result.isSuccess() && parameters.getBoolean(CommandParameter.RUN_CHANGELOG_WITH_UPDATE)) { + AccuRevUpdateScmResult accuRevResult = (AccuRevUpdateScmResult) result; + AccuRevVersion startVersion = accuRevResult.getFromVersion(); + AccuRevVersion endVersion = accuRevResult.getToVersion(); + + if (endVersion.isNow()) { + endVersion = new AccuRevVersion(endVersion.getBasisStream(), now); + } + + parameters.setScmVersion(CommandParameter.START_SCM_VERSION, new ScmRevision(startVersion.toString())); + parameters.setScmVersion(CommandParameter.END_SCM_VERSION, new ScmRevision(endVersion.toString())); + + if (startVersion.getBasisStream().equals(endVersion.getBasisStream())) { + ChangeLogScmResult changeLogResult = changelog(repository, fileSet, parameters); + + if (changeLogResult.isSuccess()) { + result.setChanges(changeLogResult.getChangeLog().getChangeSets()); + } + } else { + String comment = "Cross stream update result from " + startVersion + " to " + endVersion; + String author = ""; + @SuppressWarnings("unchecked") + List files = result.getUpdatedFiles(); + ChangeSet dummyChangeSet = new ChangeSet(now, comment, author, files); + // different streams invalidates the change log, insert a dummy change instead. + List changeSets = Collections.singletonList(dummyChangeSet); + result.setChanges(changeSets); + } + + } + return result; + } + + @Override + protected ExportScmResult export(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) + throws ScmException { + AccuRevExportCommand command = new AccuRevExportCommand(getLogger()); + return command.export(repository, fileSet, parameters); + } + + @Override + protected ChangeLogScmResult changelog(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) + throws ScmException { + AccuRevChangeLogCommand command = new AccuRevChangeLogCommand(getLogger()); + return command.changelog(repository, fileSet, parameters); + } + + @Override + protected RemoveScmResult remove(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) + throws ScmException { + AccuRevRemoveCommand command = new AccuRevRemoveCommand(getLogger()); + return command.remove(repository, fileSet, parameters); + } +} Propchange: maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevScmProvider.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevScmProvider.java ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Added: maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevScmProviderRepository.java URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevScmProviderRepository.java?rev=897510&view=auto ============================================================================== --- maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevScmProviderRepository.java (added) +++ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevScmProviderRepository.java Sat Jan 9 18:23:30 2010 @@ -0,0 +1,226 @@ +package org.apache.maven.scm.provider.accurev; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; + +import org.apache.maven.scm.ScmVersion; +import org.apache.maven.scm.provider.ScmProviderRepositoryWithHost; +import org.codehaus.plexus.util.StringUtils; + +public class AccuRevScmProviderRepository + extends ScmProviderRepositoryWithHost +{ + public AccuRevScmProviderRepository() + { + super(); + // True is a more sensible default (ie for tck tests) + // TODO raise jira so tck tests properly handle setPersist + setPersistCheckout( true ); + + setShouldUseExportForNonPersistentCheckout( true ); + } + + /** + * System property for prefixing tags + */ + public static final String TAG_PREFIX = "accuRevTagPrefix"; + + private String streamName; + + private String projectPath; + + private AccuRev accurev; + + public String getStreamName() + { + return streamName; + } + + public void setStreamName( String streamName ) + { + this.streamName = streamName; + } + + public String getProjectPath() + { + return projectPath; + } + + public void setProjectPath( String projectPath ) + { + this.projectPath = projectPath; + setCheckoutRelativePath( projectPath ); + } + + public AccuRev getAccuRev() + { + return this.accurev; + } + + public void setAccuRev( AccuRev accurev ) + { + this.accurev = accurev; + } + + /** + * @param info + * @return true if info indicates a root of the workspace. + */ + public boolean isWorkSpaceRoot( AccuRevInfo info ) + { + + return ( ( getProjectPath() != null && info.getBasedir().equals( new File( info.getTop(), getProjectPath() ) ) ) || isWorkSpaceTop( info ) ); + } + + public boolean isWorkSpaceTop( AccuRevInfo info ) + { + return info.isWorkSpaceTop(); + + } + + public String getExtendedTagName( String tagName ) + { + return System.getProperty( TAG_PREFIX, "" ) + tagName; + } + + // TODO raise JIRA to pull up these methods to ScmProviderRepository + + private String checkoutRelativePath; + + private boolean shouldUseExportForNonPersistentCheckout = true; + + public static final int DEFAULT_PORT = 5050; + + /** + * The relative path of the directory of the checked out project in comparison to the checkout directory, or an + * empty String in case the checkout directory equals the project directory. + *

+ * With most SCMs, this is just an empty String, meaning that the checkout directory equals the project directory. + * But there are cases (e.g. ClearCase) where within the checkout directory, the directory structure of the SCM + * system is repeated. E.g. if you check out the project "my/project" to "/some/dir", the project sources are + * actually checked out to "some/dir/my/project". In this example, relativePathProjectDirectory would contain + * "my/project". + */ + public String getCheckoutRelativePath() + { + if ( this.checkoutRelativePath == null ) + { + return ""; + } + return this.checkoutRelativePath; + } + + public void setCheckoutRelativePath( String checkoutRelativePath ) + { + this.checkoutRelativePath = checkoutRelativePath; + } + + /** + * Relative project path for export + * + * @return default same as {@link #getCheckoutRelativePath()} + */ + public String getExportRelativePath() + { + return getCheckoutRelativePath(); + } + + /** + * When checkout is not expected to be refreshed or committed, should export be used instead? Perforce, Clearcase + * and AccuRev store their meta-data about file status within the server rather than files in the source tree. This + * makes checkouts within checkouts (eg release:perform) difficult. Typically there is a way to do a lightweight + * export instead which can be implemented as the "export" command. This is a hint to downstream applications that + * "export" is available and should be used in preference to "checkout" in cases where "update" and "commit" are not + * intended to be used. (ie release:perform) + * + * @return false by default + */ + public boolean shouldUseExportForNonPersistentCheckout() + { + return this.shouldUseExportForNonPersistentCheckout; + } + + public void setShouldUseExportForNonPersistentCheckout( boolean shouldUseExportForNonPersistentCheckout ) + { + this.shouldUseExportForNonPersistentCheckout = shouldUseExportForNonPersistentCheckout; + } + + public String toString() + { + StringBuffer buff = new StringBuffer( "AccuRevScmProviderRepository" ); + buff.append( " user=" ); + buff.append( getUser() ); + buff.append( " pass=" ); + buff.append( getPassword() == null ? "null" : StringUtils.repeat( "*", getPassword().length() ) ); + buff.append( " host=" ); + buff.append( getHost() ); + buff.append( " port=" ); + buff.append( getPort() ); + buff.append( " stream=" ); + buff.append( getStreamName() ); + buff.append( " projectPath=" ); + buff.append( getProjectPath() ); + + return buff.toString(); + } + + public AccuRevVersion getAccuRevVersion( ScmVersion scmVersion ) + { + + String tran = null; + String basisStream; + + if ( scmVersion == null ) + { + basisStream = getStreamName(); + } + else + { + String name = scmVersion.getName(); + + String[] versionComponents = name.split( "[/\\\\]", 2 ); + basisStream = versionComponents[0]; + if ( basisStream.length() == 0 ) + { + // Use the default stream from the URL + basisStream = getStreamName(); + } + else + { + // Need to add the tag prefix + basisStream = getExtendedTagName( basisStream ); + } + + if ( versionComponents.length == 2 && versionComponents[1].length() > 0 ) + { + tran = versionComponents[1]; + } + } + + return new AccuRevVersion( basisStream, tran ); + } + + public String getDepotRelativeProjectPath() + { + return "/./" + ( projectPath == null ? "" : projectPath ); + } + +} Propchange: maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevScmProviderRepository.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevScmProviderRepository.java ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Added: maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevStat.java URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevStat.java?rev=897510&view=auto ============================================================================== --- maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevStat.java (added) +++ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevStat.java Sat Jan 9 18:23:30 2010 @@ -0,0 +1,56 @@ +package org.apache.maven.scm.provider.accurev; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.regex.Pattern; + +public enum AccuRevStat +{ + DEFUNCT( "-D", "defunct" ), + MODIFIED( "-m", "modified" ), + KEPT( "-k", "kept" ), + MISSING( "-M", "missing" ), + EXTERNAL( "-x", "external" ) + // TODO Test KEPT pattern skips items that are both (kept) and (defunct). + ; + + private String statArg; + + private Pattern matchPattern; + + private AccuRevStat( String statArg, String indicator ) + { + String pattern = "\\s*(\\S+)\\s+.*\\(" + indicator + "\\).*"; + matchPattern = Pattern.compile( pattern ); + this.statArg = statArg; + } + + public String getStatArg() + { + return statArg; + } + + public Pattern getMatchPattern() + { + + return matchPattern; + } + +} Propchange: maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevStat.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevStat.java ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Added: maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevVersion.java URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevVersion.java?rev=897510&view=auto ============================================================================== --- maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevVersion.java (added) +++ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevVersion.java Sat Jan 9 18:23:30 2010 @@ -0,0 +1,66 @@ +package org.apache.maven.scm.provider.accurev; + +import java.util.Date; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +public class AccuRevVersion +{ + + private String basisStream; + + public String getBasisStream() + { + return basisStream; + } + + public String getTimeSpec() + { + return timeSpec; + } + + private String timeSpec; + + public AccuRevVersion( String basisStream, String tran ) + { + this.basisStream = basisStream; + this.timeSpec = tran; + } + + public AccuRevVersion( String basis, Date startDate ) + { + this( basis, AccuRev.ACCUREV_TIME_SPEC.format( startDate ) ); + } + + public AccuRevVersion( String basis, long transactionId ) + { + this( basis, Long.toString( transactionId ) ); + } + + public String toString() + { + return basisStream + "/" + timeSpec; + } + + public boolean isNow() + { + return timeSpec == null || "highest".equalsIgnoreCase( timeSpec ) || "now".equalsIgnoreCase( timeSpec ); + } +} Propchange: maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevVersion.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevVersion.java ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Added: maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/Transaction.java URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/Transaction.java?rev=897510&view=auto ============================================================================== --- maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/Transaction.java (added) +++ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/Transaction.java Sat Jan 9 18:23:30 2010 @@ -0,0 +1,180 @@ +package org.apache.maven.scm.provider.accurev; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.Collection; +import java.util.Date; +import java.util.HashSet; + +public class Transaction +{ + + public class Version + { + + private String realSpec; + + private String virtualSpec; + + private String ancestorSpec; + + private Long elementId; + + private String elementName; + + private Version( Long id, String elementName, String virtualSpec, String realSpec, String ancestor ) + { + this.elementId = id; + this.virtualSpec = virtualSpec; + this.realSpec = realSpec; + this.ancestorSpec = ancestor; + this.elementName = elementName; + } + + public String getVirtualSpec() + { + return virtualSpec; + } + + public void setVirtualSpec( String virtualSpec ) + { + this.virtualSpec = virtualSpec; + } + + public String getAncestorSpec() + { + return ancestorSpec; + } + + public void setAncestorSpec( String ancestorSpec ) + { + this.ancestorSpec = ancestorSpec; + } + + public void setRealSpec( String realSpec ) + { + this.realSpec = realSpec; + } + + public void setElementId( Long elementId ) + { + this.elementId = elementId; + } + + public String getRealSpec() + { + return realSpec; + } + + public Long getElementId() + { + return elementId; + } + + public Transaction getTransaction() + { + return getOuterTransaction(); + } + + public String getElementName() + { + return elementName; + } + + } + + private Collection versions = new HashSet(); + + private long id; + + public Transaction( Long id, Date when, String tranType, String user ) + { + this.id = id; + this.tranType = tranType; + this.when = when; + this.author = user; + } + + public long getId() + { + return id; + } + + public String getTranType() + { + return tranType; + } + + public String getComment() + { + return comment; + } + + public void setComment( String comment ) + { + this.comment = comment; + } + + private Date when; + + private String tranType; + + private String author; + + private String comment; + + public long getTranId() + { + return id; + } + + private Transaction getOuterTransaction() + { + return this; + } + + public Collection getVersions() + { + return versions; + } + + public Date getWhen() + { + return when; + } + + public String getType() + { + return tranType; + } + + public String getAuthor() + { + return author; + } + + public void addVersion( Long id, String name, String virtualSpec, String realSpec, String ancestor ) + { + Transaction.Version v = new Version( id, name, virtualSpec, realSpec, ancestor ); + versions.add( v ); + + } + +} Propchange: maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/Transaction.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/Transaction.java ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Added: maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/WorkSpace.java URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/WorkSpace.java?rev=897510&view=auto ============================================================================== --- maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/WorkSpace.java (added) +++ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/WorkSpace.java Sat Jan 9 18:23:30 2010 @@ -0,0 +1,51 @@ +package org.apache.maven.scm.provider.accurev; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +public class WorkSpace +{ + + private long transactionId; + + private String name; + + public String getName() + { + return name; + } + + public WorkSpace( String name, long transactionId ) + { + this.transactionId = transactionId; + this.name = name; + + } + + public long getTransactionId() + { + return transactionId; + } + + public String toString() + { + return name; + } + +} Propchange: maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/WorkSpace.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/WorkSpace.java ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Added: maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/cli/AccuRevCommandLine.java URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/cli/AccuRevCommandLine.java?rev=897510&view=auto ============================================================================== --- maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/cli/AccuRevCommandLine.java (added) +++ maven/sandbox/trunk/scm/maven-scm-provider-accurevnew/src/main/java/org/apache/maven/scm/provider/accurev/cli/AccuRevCommandLine.java Sat Jan 9 18:23:30 2010 @@ -0,0 +1,522 @@ +package org.apache.maven.scm.provider.accurev.cli; + +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the + * Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" + * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ + +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.InputStream; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.regex.Pattern; + +import org.apache.maven.scm.log.DefaultLog; +import org.apache.maven.scm.log.ScmLogger; +import org.apache.maven.scm.provider.accurev.AccuRev; +import org.apache.maven.scm.provider.accurev.AccuRevException; +import org.apache.maven.scm.provider.accurev.AccuRevInfo; +import org.apache.maven.scm.provider.accurev.AccuRevStat; +import org.apache.maven.scm.provider.accurev.Transaction; +import org.apache.maven.scm.provider.accurev.WorkSpace; +import org.codehaus.plexus.util.Os; +import org.codehaus.plexus.util.StringUtils; +import org.codehaus.plexus.util.cli.CommandLineException; +import org.codehaus.plexus.util.cli.CommandLineUtils; +import org.codehaus.plexus.util.cli.Commandline; +import org.codehaus.plexus.util.cli.StreamConsumer; + +public class AccuRevCommandLine implements AccuRev { + + private static final String[] EMPTY_STRING_ARRAY = new String[] {}; + + private static final File CURRENT_DIR = new File("."); + + private ScmLogger logger; + + private Commandline cl = new Commandline(); + + private StreamConsumer systemErr; + + private StringBuffer commandLines = new StringBuffer(); + + private StringBuffer errorOutput = new StringBuffer(); + + private String[] hostArgs = EMPTY_STRING_ARRAY; + + private String[] authArgs = EMPTY_STRING_ARRAY; + + private String executable = "accurev"; + + public AccuRevCommandLine() { + super(); + reset(); + + } + + public AccuRevCommandLine(String host, int port) { + + this(); + setServer(host, port); + } + + public void setServer(String host, int port) { + + if (host != null) { + hostArgs = new String[] { "-H", host + ":" + port }; + } else { + hostArgs = EMPTY_STRING_ARRAY; + } + + } + + public void setExecutable(String accuRevExe) { + executable = accuRevExe; + reset(); + } + + private boolean executeCommandLine(File basedir, String[] args, Iterable elements, Pattern matchPattern, + List matchedFiles) throws AccuRevException { + + FileConsumer stdoutConsumer = new FileConsumer(matchedFiles, matchPattern); + + return executeCommandLine(basedir, args, elements, stdoutConsumer); + } + + private boolean executeCommandLine(File basedir, String[] args, Iterable elements, StreamConsumer stdoutConsumer) + throws AccuRevException { + setWorkingDirectory(basedir); + setCommandLineArgs(args); + + if (elements != null) { + for (File file : elements) { + String path = file.getPath(); + //Hack for Windows "/./". TODO find a nicer way to handle this. + if ("\\.".equals(path)) { + path = "\\.\\"; + } + cl.createArg().setValue(path); + } + } + return executeCommandLine(null, stdoutConsumer); + } + + private void setCommandLineArgs(String[] args) { + cl.clearArgs(); + + if (args.length > 0) { + // First arg is the accurev command + cl.createArg().setValue(args[0]); + + // Inject -H and -A here + cl.addArguments(hostArgs); + cl.addArguments(authArgs); + } + + for (int i = 1; i < args.length; i++) { + cl.createArg().setValue(args[i]); + } + + } + + private boolean executeCommandLine(String[] args) throws AccuRevException { + + return executeCommandLine(args, null, null); + } + + private boolean executeCommandLine(String[] args, InputStream stdin, StreamConsumer stdout) throws AccuRevException { + + setCommandLineArgs(args); + + return executeCommandLine(stdin, stdout); + + } + + private boolean executeCommandLine(InputStream stdin, StreamConsumer stdout) throws AccuRevException { + commandLines.append(cl.toString()); + commandLines.append(';'); + + if (getLogger().isDebugEnabled()) { + getLogger().debug(cl.toString()); + } + try { + + int result = executeCommandLine(cl, stdin, new CommandOutputConsumer(getLogger(), stdout), systemErr); + if (result != 0) { + getLogger().debug("Non zero result - " + result); + } + return result == 0; + } catch (CommandLineException ex) { + throw new AccuRevException("Error executing command " + cl.toString(), ex); + } + + } + + /** + * Extracted so test class can override + * + * @param stdin + * @param stdout + * @param stderr + * @return + * @throws CommandLineException + */ + protected int executeCommandLine(Commandline cl, InputStream stdin, CommandOutputConsumer stdout, StreamConsumer stderr) + throws CommandLineException { + int result = CommandLineUtils.executeCommandLine(cl, stdin, stdout, stderr); + stdout.waitComplete(); + + return result; + } + + protected Commandline getCommandline() { + return cl; + } + + public void reset() { + // TODO find out why Commandline allows executable, args etc to be initialised to + // null, but not allowing them to be reset to null. This results is weird "clear" + // behaviour. It is just safer to start again. + + cl = new Commandline(); + commandLines = new StringBuffer(); + errorOutput = new StringBuffer(); + cl.getShell().setQuotedArgumentsEnabled(true); + cl.setExecutable(executable); + try { + cl.addSystemEnvironment(); + } catch (Exception e) { + if (getLogger().isDebugEnabled()) { + getLogger().warn("Unable to obtain system environment", e); + } else { + getLogger().warn("Unable to obtain system environment"); + } + } + } + + /** + * {@inheritDoc} + */ + public boolean mkws(String basisStream, String workspaceName, File basedir) throws AccuRevException { + setWorkingDirectory(basedir); + String[] mkws = { "mkws", "-b", basisStream, "-w", workspaceName, "-l", basedir.getAbsolutePath() }; + + return executeCommandLine(mkws); + + } + + /** + * {@inheritDoc} + */ + public boolean update(File baseDir, String transactionId, List updatedFiles) throws AccuRevException { + if (transactionId == null) { + transactionId = "highest"; + } + String[] update = { "update", "-t", transactionId }; + setWorkingDirectory(baseDir); + + return executeCommandLine(update, null, new FileConsumer(updatedFiles, FileConsumer.UPDATE_PATTERN)); + + } + + /** + * {@inheritDoc} + */ + public boolean add(File basedir, List elements, String message, List addedFiles) throws AccuRevException { + if (StringUtils.isBlank(message)) { + message = AccuRev.DEFAULT_ADD_MESSAGE; + } + + boolean recursive = false; + + if (elements == null || elements.isEmpty()) { + elements = Collections.singletonList(CURRENT_DIR); + recursive = true; + } else if (elements.size() == 1 && elements.toArray()[0].equals(CURRENT_DIR)) { + recursive = true; + } + + return executeCommandLine(basedir, new String[] { "add", "-c", message, recursive ? "-R" : null }, elements, + FileConsumer.ADD_PATTERN, addedFiles); + + } + + public boolean defunct(File basedir, List files, String message, List defunctedFiles) throws AccuRevException { + if (StringUtils.isBlank(message)) { + message = AccuRev.DEFAULT_REMOVE_MESSAGE; + } + + if (files == null || files.isEmpty()) { + files = Collections.singletonList(CURRENT_DIR); + } + + return executeCommandLine(basedir, new String[] { "defunct", "-c", message }, files, FileConsumer.DEFUNCT_PATTERN, + defunctedFiles); + } + + public boolean promote(File basedir, List files, String message, List promotedFiles) throws AccuRevException { + if (StringUtils.isBlank(message)) { + message = AccuRev.DEFAULT_PROMOTE_MESSAGE; + } + return executeCommandLine(basedir, new String[] { "promote", "-K", "-c", message }, files, FileConsumer.PROMOTE_PATTERN, + promotedFiles); + + } + + public String getCommandLines() { + return commandLines.toString(); + } + + public String getErrorOutput() { + return errorOutput.toString(); + } + + public void setLogger(ScmLogger logger) { + this.logger = logger; + this.systemErr = new ErrorConsumer(logger, errorOutput); + } + + public ScmLogger getLogger() { + return logger; + } + + public boolean mkdepot(String depotName) throws AccuRevException { + String[] mkdepot = { "mkdepot", "-p", depotName }; + + return executeCommandLine(mkdepot); + + } + + /** + * {@inheritDoc} + */ + public boolean promoteAll(File baseDir, String commitMessage, List promotedFiles) throws AccuRevException { + setWorkingDirectory(baseDir); + String[] promote = { "promote", "-p", "-K", "-c", commitMessage }; + + return executeCommandLine(promote, null, new FileConsumer(promotedFiles, FileConsumer.PROMOTE_PATTERN)); + + } + + public AccuRevInfo info(File basedir) throws AccuRevException { + setWorkingDirectory(basedir); + String[] info = { "info" }; + AccuRevInfo result = new AccuRevInfo(basedir); + + executeCommandLine(info, null, new InfoConsumer(result)); + return result; + } + + private void setWorkingDirectory(File basedir) { + // TODO raise bug against plexus. Null is OK for working directory + // but once set to not-null cannot be set back to null! + // this is a problem if the old workingdir has been deleted + // probably safer to use a new commandline + + if (basedir == null) { + cl.setWorkingDirectory("."); + } + cl.setWorkingDirectory(basedir); + } + + public boolean reactivate(String workSpaceName) throws AccuRevException { + String[] reactivate = { "reactivate", "wspace", workSpaceName }; + + return executeCommandLine(reactivate, null, new CommandOutputConsumer(getLogger(), null)); + + } + + public boolean rmws(String workSpaceName) throws AccuRevException { + String[] rmws = { "rmws", "-s", workSpaceName }; + + return executeCommandLine(rmws); + + } + + public String stat(File element) throws AccuRevException { + String[] stat = { "stat", "-fx", element.getAbsolutePath() }; + + StatConsumer statConsumer = new StatConsumer(getLogger()); + executeCommandLine(stat, null, statConsumer); + return statConsumer.getStatus(); + + } + + public boolean chws(File basedir, String workSpaceName, String newBasisStream) throws AccuRevException { + setWorkingDirectory(basedir); + return executeCommandLine(new String[] { "chws", "-s", workSpaceName, "-b", newBasisStream, "-l", "." }); + + } + + public boolean mksnap(String snapShotName, String basisStream) throws AccuRevException { + + return executeCommandLine(new String[] { "mksnap", "-s", snapShotName, "-b", basisStream, "-t", "now" }); + } + + public boolean statTag(String streamName, List taggedFiles) throws AccuRevException { + return executeCommandLine(null, new String[] { "stat", "-a", "-ffl", "-s", streamName }, null, FileConsumer.STAT_PATTERN, + taggedFiles); + } + + public boolean stat(File basedir, Collection elements, AccuRevStat statType, List matchingElements) + throws AccuRevException { + + boolean recursive = false; + + if (elements == null || elements.isEmpty()) { + elements = Collections.singletonList(CURRENT_DIR); + recursive = true; + } else if (elements.size() == 1 && elements.toArray()[0].equals(CURRENT_DIR)) { + recursive = true; + } + + String[] args = { "stat", "-ffr", statType.getStatArg(), recursive ? "-R" : null }; + + return executeCommandLine(basedir, args, elements, statType.getMatchPattern(), matchingElements); + } + + public boolean pop(File basedir, Collection elements, List poppedFiles) throws AccuRevException { + + if (elements == null || elements.isEmpty()) { + elements = Collections.singletonList(CURRENT_DIR); + } + + String[] popws = { "pop", "-R" }; + + return executeCommandLine(basedir, popws, elements, FileConsumer.POPULATE_PATTERN, poppedFiles); + } + + public boolean pop(File basedir, String versionSpec, Collection elements, List poppedFiles) throws AccuRevException { + + if (elements == null || elements.isEmpty()) { + elements = Collections.singletonList(new File("/./")); + } + + String[] pop = { "pop", "-v", versionSpec, "-L", basedir.getAbsolutePath(), "-R" }; + + return executeCommandLine(basedir, pop, elements, FileConsumer.POPULATE_PATTERN, poppedFiles); + } + + public boolean statBackingStream(File basedir, Collection elements, Collection memberElements, + Collection nonMemberElements) throws AccuRevException { + if (elements.isEmpty()) { + return true; + } + String[] args = { "stat", "-b", "-ffr" }; + + return executeCommandLine(basedir, args, elements, new StatBackingConsumer(memberElements, nonMemberElements)); + + } + + public boolean history(String baseStream, String fromTimeSpec, String toTimeSpec, int count, List transactions) + throws AccuRevException { + String timeSpec = fromTimeSpec; + + if (toTimeSpec != null) { + timeSpec = timeSpec + "-" + toTimeSpec; + } + + if (count > 0) { + timeSpec = timeSpec + "." + count; + } + + String[] hist = { "hist", "-fx", "-s", baseStream, "-t", timeSpec }; + HistoryConsumer stdout = new HistoryConsumer(getLogger(), transactions); + return executeCommandLine(hist, null, stdout); + } + + public boolean login(String user, String password) throws AccuRevException { + + // TODO Raise bug against plexus commandline - can't set workingdir to null + // and will get an error if the working directory is deleted. + cl.setWorkingDirectory("."); + authArgs = EMPTY_STRING_ARRAY; + AuthTokenConsumer stdout = new AuthTokenConsumer(); + + boolean result; + if (Os.isFamily(Os.FAMILY_WINDOWS)) { + if (StringUtils.isBlank(password)) { + // Ensure blank is passed in. + password = "\"\""; + } + String[] login = { "login", "-A", user, password }; + result = executeCommandLine(login, null, stdout); + } else { + String[] login = { "login", "-A", user }; + password = StringUtils.clean(password) + "\n"; + byte[] bytes = password.getBytes(); + ByteArrayInputStream stdin = new ByteArrayInputStream(bytes); + result = executeCommandLine(login, stdin, stdout); + + } + + authArgs = new String[] { "-A", stdout.getAuthToken() }; + return result; + } + + public boolean logout() throws AccuRevException { + String[] logout = { "logout" }; + return executeCommandLine(logout); + + } + + public boolean showRefTrees(Map workSpaces) throws AccuRevException { + String[] show = { "show", "-fx", "refs" }; + WorkSpaceConsumer stdout = new WorkSpaceConsumer(getLogger(), workSpaces); + return executeCommandLine(show, null, stdout); + } + + public boolean showWorkSpaces(Map workSpaces) throws AccuRevException { + String[] show = { "show", "-a", "-fx", "wspaces" }; + WorkSpaceConsumer stdout = new WorkSpaceConsumer(getLogger(), workSpaces); + return executeCommandLine(show, null, stdout); + } + + public static void main(String[] args) throws AccuRevException { + AccuRevCommandLine myCL = new AccuRevCommandLine(args[0], Integer.parseInt(args[1])); + myCL.setLogger(new DefaultLog() { + + @Override + public void debug(String content) { + debug(content, null); + } + + @Override + public void debug(Throwable error) { + debug(null, error); + } + + @Override + public void debug(String content, Throwable error) { + if (content != null) { + System.err.println(content); + } + if (error != null) { + error.printStackTrace(System.err); + } + } + + @Override + public boolean isDebugEnabled() { + return true; + } + }); + + myCL.login(args[2], args[3]); + + System.out.println(Arrays.toString(myCL.authArgs)); + + } +}