--- a/nbbuild/cluster.properties
+++ a/nbbuild/cluster.properties
@@ -394,6 +394,7 @@
usersguide,\
utilities,\
utilities.project,\
+ vcs.ade.treestamp,\
versioning,\
versioning.core,\
versioning.indexingbridge,\
--- a/vcs.ade.treestamp/build.xml
+++ a/vcs.ade.treestamp/build.xml
@@ -0,0 +1,5 @@
+
+
+ Builds, tests, and runs the project org.netbeans.modules.vcs.ade.treestamp
+
+
--- a/vcs.ade.treestamp/manifest.mf
+++ a/vcs.ade.treestamp/manifest.mf
@@ -0,0 +1,5 @@
+Manifest-Version: 1.0
+OpenIDE-Module: org.netbeans.modules.vcs.ade.treestamp
+OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/vcs/ade/treestamp/Bundle.properties
+OpenIDE-Module-Specification-Version: 1.0
+
--- a/vcs.ade.treestamp/nbproject/project.properties
+++ a/vcs.ade.treestamp/nbproject/project.properties
@@ -0,0 +1,3 @@
+is.eager=true
+javac.source=1.6
+javac.compilerargs=-Xlint -Xlint:-serial
--- a/vcs.ade.treestamp/nbproject/project.xml
+++ a/vcs.ade.treestamp/nbproject/project.xml
@@ -0,0 +1,45 @@
+
+
+ org.netbeans.modules.apisupport.project
+
+
+ org.netbeans.modules.vcs.ade.treestamp
+
+
+ org.netbeans.modules.versioning
+
+
+
+ 1
+ 1.29
+
+
+
+ org.openide.filesystems
+
+
+
+ 7.60
+
+
+
+ org.openide.util
+
+
+
+ 8.22
+
+
+
+ org.openide.util.lookup
+
+
+
+ 8.12
+
+
+
+
+
+
+
--- a/vcs.ade.treestamp/src/org/netbeans/modules/vcs/ade/treestamp/ADEInterceptor.java
+++ a/vcs.ade.treestamp/src/org/netbeans/modules/vcs/ade/treestamp/ADEInterceptor.java
@@ -0,0 +1,63 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2012 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+ * Other names may be trademarks of their respective owners.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common
+ * Development and Distribution License("CDDL") (collectively, the
+ * "License"). You may not use this file except in compliance with the
+ * License. You can obtain a copy of the License at
+ * http://www.netbeans.org/cddl-gplv2.html
+ * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
+ * specific language governing permissions and limitations under the
+ * License. When distributing the software, include this License Header
+ * Notice in each file and include the License file at
+ * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the
+ * License Header, with the fields enclosed by brackets [] replaced by
+ * your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * If you wish your version of this file to be governed by only the CDDL
+ * or only the GPL Version 2, indicate your decision by adding
+ * "[Contributor] elects to include this software in this distribution
+ * under the [CDDL or GPL Version 2] license." If you do not indicate a
+ * single choice of license, a recipient has the option to distribute
+ * your version of this file under either the CDDL, the GPL Version 2 or
+ * to extend the choice of license to its licensees as provided above.
+ * However, if you add GPL Version 2 code and therefore, elected the GPL
+ * Version 2 license, then the option applies only if the new code is
+ * made subject to such option by the copyright holder.
+ *
+ * Contributor(s):
+ *
+ * Portions Copyrighted 2012 Sun Microsystems, Inc.
+ */
+package org.netbeans.modules.vcs.ade.treestamp;
+
+import java.io.File;
+import org.netbeans.modules.versioning.spi.VCSInterceptor;
+import org.openide.filesystems.TreeStamp;
+
+/**
+ *
+ * @author Tomas Zezula
+ */
+public class ADEInterceptor extends VCSInterceptor {
+
+ @Override
+ public Object getAttribute(File file, String attrName) {
+ if (TreeStamp.Provider.class.getName().equals(attrName)) {
+ return ADETreeStampProvider.getInstance();
+ } else {
+ return super.getAttribute(file, attrName);
+ }
+ }
+
+}
--- a/vcs.ade.treestamp/src/org/netbeans/modules/vcs/ade/treestamp/ADETreeStampProvider.java
+++ a/vcs.ade.treestamp/src/org/netbeans/modules/vcs/ade/treestamp/ADETreeStampProvider.java
@@ -0,0 +1,232 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2012 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+ * Other names may be trademarks of their respective owners.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common
+ * Development and Distribution License("CDDL") (collectively, the
+ * "License"). You may not use this file except in compliance with the
+ * License. You can obtain a copy of the License at
+ * http://www.netbeans.org/cddl-gplv2.html
+ * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
+ * specific language governing permissions and limitations under the
+ * License. When distributing the software, include this License Header
+ * Notice in each file and include the License file at
+ * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the
+ * License Header, with the fields enclosed by brackets [] replaced by
+ * your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * If you wish your version of this file to be governed by only the CDDL
+ * or only the GPL Version 2, indicate your decision by adding
+ * "[Contributor] elects to include this software in this distribution
+ * under the [CDDL or GPL Version 2] license." If you do not indicate a
+ * single choice of license, a recipient has the option to distribute
+ * your version of this file under either the CDDL, the GPL Version 2 or
+ * to extend the choice of license to its licensees as provided above.
+ * However, if you add GPL Version 2 code and therefore, elected the GPL
+ * Version 2 license, then the option applies only if the new code is
+ * made subject to such option by the copyright holder.
+ *
+ * Contributor(s):
+ *
+ * Portions Copyrighted 2012 Sun Microsystems, Inc.
+ */
+package org.netbeans.modules.vcs.ade.treestamp;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openide.filesystems.TreeStamp;
+import org.openide.util.Exceptions;
+
+/**
+ *
+ * @author Tomas Zezula
+ */
+public final class ADETreeStampProvider extends TreeStamp.Provider {
+
+ private static final String LABEL = "BASE_LABEL:"; //NOI18N
+ private static final String CHANGED_FILES = "ALL AFFECTED FILES:"; //NOI18N
+ private static final String NEW_FILES = "NEW FILES:"; //NOI18N
+ private static final String REMOVED_FILES = "RMNAMED (REMOVED) FILES:"; //NOI18N
+ private static final Pattern CHANGE = Pattern.compile("\\s*\\d+\\.\\s+(.*)"); //NOI18N
+
+ private static final Logger LOG = Logger.getLogger(ADETreeStampProvider.class.getName());
+
+ private final AtomicReference adeRoot = new AtomicReference();
+
+ private ADETreeStampProvider() {}
+
+ @Override
+ protected Map stamps(Map rootsAndBaseIds) {
+ final Map result = new HashMap();
+ Transaction tx = null;
+ boolean described = false;
+ for (Map.Entry entry : rootsAndBaseIds.entrySet()) {
+ final FileObject root = entry.getKey();
+ final String base = entry.getValue();
+ final String adeRootPath = getADERootPath();
+ final String rootDirPath = getPath(FileUtil.toFile(root));
+ if (adeRootPath != null &&
+ rootDirPath != null &&
+ rootDirPath.startsWith(adeRootPath)) { //NOI18N
+ if (!described) {
+ described = true;
+ tx = describeTrans(getADERoot());
+ }
+ if (tx != null && (base == null || base.equals(tx.getLabel()))) {
+ final Set paths = new HashSet();
+ for (String cf : tx.getChanges()) {
+ if (cf.startsWith(rootDirPath)) {
+ paths.add(cf.substring(rootDirPath.length()));
+ }
+ }
+ result.put(root, create(tx.getLabel(), null, paths));
+ LOG.log(
+ Level.FINE,
+ "Root: {0}, Label: {1}, Changes: {2}", //NOI18N
+ new Object[] {
+ rootDirPath,
+ tx.getLabel(),
+ paths
+ });
+ }
+ }
+ }
+ return result;
+ }
+
+
+ File getADERoot() {
+ File adeRootDir = adeRoot.get();
+ if (adeRootDir == null) {
+ final String adeRootStr = System.getenv("ADE_VIEW_ROOT"); //NOI18N
+ if (adeRootStr != null) {
+ adeRootDir = FileUtil.normalizeFile(new File(adeRootStr));
+ adeRoot.compareAndSet(null, adeRootDir);
+ }
+ }
+ return adeRootDir;
+ }
+
+ String getADERootPath() {
+ return getPath(getADERoot());
+ }
+
+ private static String getPath(final File file) {
+ if (file == null) {
+ return null;
+ }
+ String path = file.getAbsolutePath();
+ if (!path.endsWith(File.separator)) {
+ path = path + File.separatorChar;
+ }
+ return path;
+ }
+
+
+ private Transaction describeTrans(final File rootDir) {
+ try {
+ final Process process = new ProcessBuilder("ade","describetrans","-short").start(); //NOI18N
+ final BufferedReader in = new BufferedReader( new InputStreamReader(process.getInputStream()));
+ try {
+ String label = null;
+ Set changedFiles = new HashSet();
+ int mode = 0;
+ String line;
+ while ((line=in.readLine())!=null) {
+ if (mode == 0) {
+ if (line.startsWith(LABEL)) {
+ String[] parts = line.split("\\s*:\\s*"); //NOI18N
+ if (parts.length == 2) {
+ label = parts[1];
+ }
+ } else if (line.startsWith(CHANGED_FILES)) {
+ mode = 1;
+ } else if (line.startsWith(NEW_FILES)) {
+ mode = 1;
+ } else if (line.startsWith(REMOVED_FILES)) {
+ mode = 1;
+ }
+ } else if (mode == 1) {
+ if (line.startsWith(CHANGED_FILES)) {
+ mode = 1;
+ } else if (line.startsWith(NEW_FILES)) {
+ mode = 1;
+ } else if (line.startsWith(REMOVED_FILES)) {
+ mode = 1;
+ } else {
+ final Matcher m = CHANGE.matcher(line);
+ if (m.matches()) {
+ String path = m.group(1);
+ changedFiles.add(
+ FileUtil.normalizeFile(new File(rootDir,path.trim())).getAbsolutePath());
+ } else {
+ mode = 0;
+ }
+ }
+ }
+ }
+ if (label != null) {
+ return new Transaction(label, changedFiles);
+ }
+ } finally {
+ in.close();
+ }
+ } catch (IOException ioe) {
+ Exceptions.printStackTrace(ioe);
+ }
+ return null;
+ }
+
+ static ADETreeStampProvider getInstance() {
+ return Holder.instance;
+ }
+
+ private static class Transaction {
+
+ private final String label;
+ private final Set extends String> changedFiles;
+
+ private Transaction(
+ final String label,
+ final Set extends String> changedFiles) {
+ this.label = label;
+ this.changedFiles = changedFiles;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public Set extends String> getChanges() {
+ return changedFiles;
+ }
+
+ }
+
+ private static class Holder {
+ private static final ADETreeStampProvider instance = new ADETreeStampProvider();
+ }
+
+}
--- a/vcs.ade.treestamp/src/org/netbeans/modules/vcs/ade/treestamp/ADEVersioning.java
+++ a/vcs.ade.treestamp/src/org/netbeans/modules/vcs/ade/treestamp/ADEVersioning.java
@@ -0,0 +1,73 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2012 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+ * Other names may be trademarks of their respective owners.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common
+ * Development and Distribution License("CDDL") (collectively, the
+ * "License"). You may not use this file except in compliance with the
+ * License. You can obtain a copy of the License at
+ * http://www.netbeans.org/cddl-gplv2.html
+ * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
+ * specific language governing permissions and limitations under the
+ * License. When distributing the software, include this License Header
+ * Notice in each file and include the License file at
+ * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the
+ * License Header, with the fields enclosed by brackets [] replaced by
+ * your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * If you wish your version of this file to be governed by only the CDDL
+ * or only the GPL Version 2, indicate your decision by adding
+ * "[Contributor] elects to include this software in this distribution
+ * under the [CDDL or GPL Version 2] license." If you do not indicate a
+ * single choice of license, a recipient has the option to distribute
+ * your version of this file under either the CDDL, the GPL Version 2 or
+ * to extend the choice of license to its licensees as provided above.
+ * However, if you add GPL Version 2 code and therefore, elected the GPL
+ * Version 2 license, then the option applies only if the new code is
+ * made subject to such option by the copyright holder.
+ *
+ * Contributor(s):
+ *
+ * Portions Copyrighted 2012 Sun Microsystems, Inc.
+ */
+package org.netbeans.modules.vcs.ade.treestamp;
+
+import java.io.File;
+import org.netbeans.modules.versioning.spi.VCSInterceptor;
+import org.netbeans.modules.versioning.spi.VersioningSystem;
+import org.openide.util.lookup.ServiceProvider;
+
+/**
+ *
+ * @author Tomas Zezula
+ */
+@ServiceProvider(service=VersioningSystem.class)
+public class ADEVersioning extends VersioningSystem {
+
+ private final VCSInterceptor interceptor = new ADEInterceptor();
+
+ @Override
+ public File getTopmostManagedAncestor(File file) {
+ final File adeRootDir = ADETreeStampProvider.getInstance().getADERoot();
+ if (adeRootDir != null && file.getAbsolutePath().startsWith(adeRootDir.getAbsolutePath())) {
+ return adeRootDir;
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public VCSInterceptor getVCSInterceptor() {
+ return interceptor;
+ }
+
+}
--- a/vcs.ade.treestamp/src/org/netbeans/modules/vcs/ade/treestamp/Bundle.properties
+++ a/vcs.ade.treestamp/src/org/netbeans/modules/vcs/ade/treestamp/Bundle.properties
@@ -0,0 +1,1 @@
+OpenIDE-Module-Name=ADE TreeStamp Implementation