# This patch file was generated by NetBeans IDE
# This patch can be applied using context Tools: Apply Diff Patch action on respective folder.
# It uses platform neutral UTF-8 encoding.
# Above lines and this line are ignored by the patching process.
Index: versioncontrol/apichanges.xml
--- versioncontrol/apichanges.xml Base (1.3)
+++ versioncontrol/apichanges.xml Locally Modified (Based On 1.3)
@@ -108,6 +108,21 @@
+ Added getFiles() method to VCSContext
+
+
+
+
+
+ This new method provides access to all files and folders that the user originally selected in the IDE. Current
+ getRootFiles() method removes files from the context if their ancestors are already in the context.
+
+
+
+
+
+
+
Added beforeEdit method to VCSInterceptor
Index: versioncontrol/src/org/netbeans/modules/versioning/spi/VCSContext.java
--- versioncontrol/src/org/netbeans/modules/versioning/spi/VCSContext.java Base (1.20)
+++ versioncontrol/src/org/netbeans/modules/versioning/spi/VCSContext.java Locally Modified (Based On 1.20)
@@ -85,6 +85,7 @@
private final Lookup elements;
+ private final Set unfilteredRootFiles;
private final Set rootFiles;
private final Set exclusions;
@@ -184,9 +185,29 @@
/**
* Retrieves set of files/folders that represent this context.
+ * This set contains all files the user selected, unfiltered.
+ * For example, if the user selects two elements: folder /var and file /var/Foo.java then getFiles()
+ * returns both of them and getRootFiles returns only the folder /var.
+ * This method is suitable for versioning systems that DO manage folders, such as Clearcase.
*
* @return Set set of Files this context represents
+ * @see #getRootFiles()
+ * @since 1.6
*/
+ public Set getFiles() {
+ return unfilteredRootFiles;
+ }
+
+ /**
+ * Retrieves set of root files/folders that represent this context.
+ * This set only contains context roots, not files/folders that are contained within these roots.
+ * For example, if the user selects two elements: folder /var and file /var/Foo.java then getFiles()
+ * returns both of them and getRootFiles returns only the folder /var.
+ * This method is suitable for versioning systems that do not manage folders, such as CVS.
+ *
+ * @return Set set of Files this context represents
+ * @see #getFiles()
+ */
public Set getRootFiles() {
return rootFiles;
}
@@ -308,6 +329,7 @@
this.elements = nodes != null ? Lookups.fixed(nodes) : Lookups.fixed(new Node[0]);
Set tempRootFiles = new HashSet(rootFiles);
Set tempExclusions = new HashSet(exclusions);
+ this.unfilteredRootFiles = Collections.unmodifiableSet(new HashSet(tempRootFiles));
while (normalize(tempRootFiles, tempExclusions));
this.rootFiles = Collections.unmodifiableSet(tempRootFiles);
this.exclusions = Collections.unmodifiableSet(tempExclusions);
Index: versioncontrol/test/unit/src/org/netbeans/modules/versioning/spi/VCSContextTest.java
--- versioncontrol/test/unit/src/org/netbeans/modules/versioning/spi/VCSContextTest.java Base (1.2)
+++ versioncontrol/test/unit/src/org/netbeans/modules/versioning/spi/VCSContextTest.java Locally Modified (Based On 1.2)
@@ -74,6 +74,7 @@
public void testForEmptyNodes() {
VCSContext ctx = VCSContext.forNodes(new Node[0]);
assertTrue(ctx.getRootFiles().size() == 0);
+ assertTrue(ctx.getFiles().size() == 0);
assertTrue(ctx.getExclusions().size() == 0);
assertTrue(ctx.computeFiles(new DummyFileDilter()).size() == 0);
}
@@ -81,28 +82,39 @@
public void testForFileNodes() {
VCSContext ctx = VCSContext.forNodes(new Node[] { new DummyFileNode(dataRootDir) });
assertTrue(ctx.getRootFiles().size() == 1);
+ assertTrue(ctx.getFiles().size() == 1);
assertTrue(ctx.getExclusions().size() == 0);
assertTrue(ctx.computeFiles(new DummyFileDilter()).size() == 1);
ctx = VCSContext.forNodes(new Node[] { new DummyFileNode(dataRootDir), new DummyFileNode(dataRootDir) });
assertTrue(ctx.getRootFiles().size() == 1);
+ assertTrue(ctx.getFiles().size() == 1);
assertTrue(ctx.getExclusions().size() == 0);
assertTrue(ctx.computeFiles(new DummyFileDilter()).size() == 1);
ctx = VCSContext.forNodes(new Node[] { new DummyFileNode(dataRootDir), new DummyFileNode(new File(dataRootDir, "dummy")) });
assertTrue(ctx.getRootFiles().size() == 1);
+ assertTrue(ctx.getFiles().size() == 2);
assertTrue(ctx.getExclusions().size() == 0);
assertTrue(ctx.computeFiles(new DummyFileDilter()).size() == 1);
ctx = VCSContext.forNodes(new Node[] { new DummyFileNode(new File(dataRootDir, "dummy2")), new DummyFileNode(new File(dataRootDir, "dummy")) });
assertTrue(ctx.getRootFiles().size() == 2);
+ assertTrue(ctx.getFiles().size() == 2);
assertTrue(ctx.getExclusions().size() == 0);
assertTrue(ctx.computeFiles(new DummyFileDilter()).size() == 2);
+
+ ctx = VCSContext.forNodes(new Node[] { new DummyFileNode(new File(dataRootDir, "workdir/root")), new DummyFileNode(new File(dataRootDir, "workdir/root/a.txt")) });
+ assertTrue(ctx.getRootFiles().size() == 1);
+ assertTrue(ctx.getFiles().size() == 2);
+ assertTrue(ctx.getExclusions().size() == 0);
+ assertTrue(ctx.computeFiles(new DummyFileDilter()).size() == 1);
}
public void testForProjectNodes() {
VCSContext ctx = VCSContext.forNodes(new Node[] { new DummyProjectNode(new File(dataRootDir, "workdir/root")) });
assertTrue(ctx.getRootFiles().size() == 1);
+ assertTrue(ctx.getFiles().size() == 1);
assertTrue(ctx.getExclusions().size() == 1);
assertTrue(ctx.computeFiles(new DummyFileDilter()).size() == 0);
}