Merge lp:~bzr-unbunt/bzr4j/subbranch-fix into lp:bzr4j

Proposed by Harry Hirsch
Status: Needs review
Proposed branch: lp:~bzr-unbunt/bzr4j/subbranch-fix
Merge into: lp:bzr4j
Prerequisite: lp:~frankoid/bzr4j/idea11-fixes
Diff against target: 137 lines (+43/-12)
1 file modified
modules/intellij/src/main/java/org/emergent/bzr4j/intellij/provider/BzrChangeProvider.java (+43/-12)
To merge this branch: bzr merge lp:~bzr-unbunt/bzr4j/subbranch-fix
Reviewer Review Type Date Requested Status
Patrick Woodworth Pending
Review via email: mp+94670@code.launchpad.net

Description of the change

Fixes incorrect handling of nested branches as reported in bug #727294.

The changes were tested in the current IDEA trunk (11.x) and PhpStorm 3.0.1.

With these the file status of nested branches is shown correctly in the Project tool window. Also the Changes tool window now reports changes in nested branches correctly.

To post a comment you must log in.

Unmerged revisions

61. By Harry Hirsch

Honour branch boundaries when determining ignored/unversion status of files

60. By Francis Devereux

Update <change-notes> in plugin.xml and bump version to 2.6.2-SNAPSHOT

59. By Francis Devereux

Add methods to BzrAnnotation to fix compilation against IntelliJ IDEA 11.0

58. By Francis Devereux

Add Set<String> feedback argument to BzrCheckinEnvironment.commit so that it compiles against IntelliJ IDEA 11.0

57. By Francis Devereux

Form changes made automatically when building with IntelliJ 11.0

56. By Francis Devereux

Update BzrFileRevision to compile against IntelliJ IDEA 11.0 SDK and to use ContentRevisionCache

55. By Francis Devereux

VcsUtil.showErrorMessage has moved to VcsImplUtil

54. By Francis Devereux

Fixed IDEA 10 (latest git as of 14 Feb 2011) compile errors

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'modules/intellij/src/main/java/org/emergent/bzr4j/intellij/provider/BzrChangeProvider.java'
2--- modules/intellij/src/main/java/org/emergent/bzr4j/intellij/provider/BzrChangeProvider.java 2010-07-29 10:15:04 +0000
3+++ modules/intellij/src/main/java/org/emergent/bzr4j/intellij/provider/BzrChangeProvider.java 2012-02-25 23:10:23 +0000
4@@ -46,12 +46,7 @@
5 import org.xml.sax.SAXParseException;
6
7 import java.io.File;
8-import java.util.Collection;
9-import java.util.HashMap;
10-import java.util.LinkedHashMap;
11-import java.util.LinkedList;
12-import java.util.List;
13-import java.util.Map;
14+import java.util.*;
15
16 public class BzrChangeProvider implements ChangeProvider {
17
18@@ -93,7 +88,20 @@
19 }
20
21 for (Map.Entry<VirtualFile,FilePath> rootEntry : rootsMap.entrySet()) {
22- process(builder, rootEntry.getKey(), rootEntry.getValue(), rootRevnos);
23+ VirtualFile virtualRoot = rootEntry.getKey();
24+ FilePath rootPath = rootEntry.getValue();
25+
26+ HashMap<VirtualFile, FilePath> subRoots = new HashMap<VirtualFile, FilePath>();
27+ for (Map.Entry<VirtualFile, FilePath> subEntry : rootsMap.entrySet()) {
28+ VirtualFile virtualSubRoot = subEntry.getKey();
29+ FilePath subPath = subEntry.getValue();
30+ if (!subPath.isUnder(rootPath, true)) {
31+ continue;
32+ }
33+ subRoots.put(virtualSubRoot, subPath);
34+ }
35+
36+ process(builder, virtualRoot, rootPath, rootRevnos, subRoots);
37 }
38 } catch (BzrExecException e) {
39 LOG.debug(e);
40@@ -133,7 +141,7 @@
41 ChangelistBuilder builder,
42 VirtualFile vcsVirtualRoot,
43 FilePath filePath,
44- Map<File, BzrRevisionNumber> processedRoots) throws BzrExecException {
45+ Map<File, BzrRevisionNumber> processedRoots, HashMap<VirtualFile, FilePath> subRoots) throws BzrExecException {
46
47 if (filePath.isNonLocal()) {
48 CHANGES.debug("no processing (nonlocal path): " + String.valueOf(filePath));
49@@ -150,6 +158,18 @@
50
51 final File ioRoot = bzrRoot.getFile();
52
53+ Set<File> ioSubRoots = new HashSet<File>();
54+ for (FilePath path : subRoots.values()) {
55+ BazaarRoot bzrSubRoot = BazaarRoot.findBranchLocation(path.getIOFile());
56+ if (bzrSubRoot == null) {
57+ continue;
58+ }
59+ File ioSubRoot = bzrSubRoot.getFile();
60+ if (!ioRoot.equals(ioSubRoot)) {
61+ ioSubRoots.add(ioSubRoot);
62+ }
63+ }
64+
65 final String relpath = target.equals(ioRoot) ? null : BzrUtil.relativePath(ioRoot,target);
66
67 CHANGES.debug("is processing: " + String.valueOf(filePath));
68@@ -162,7 +182,7 @@
69
70 final ShellCommandService service = ShellCommandService.getInstance(m_project);
71
72- MyIgnoredHandler ignoredHandler = new MyIgnoredHandler(builder, ioRoot);
73+ MyIgnoredHandler ignoredHandler = new MyIgnoredHandler(builder, ioRoot, ioSubRoots);
74
75 BzrIdeaExec ignoredExec = new BzrIdeaExec(bzrRoot, "xmlls");
76 ignoredExec.addArguments("--ignored");
77@@ -171,7 +191,7 @@
78 service.executeUnsafe(ignoredExec, BzrXmlResult.createBzrXmlResult(ignoredHandler));
79 ignoredHandler.processResults();
80
81- MyStatusHandler statusHandler = new MyStatusHandler(vcsVirtualRoot, builder, ioRoot, revno);
82+ MyStatusHandler statusHandler = new MyStatusHandler(vcsVirtualRoot, builder, ioRoot, revno, ioSubRoots);
83
84 BzrIdeaExec statusExec = new BzrIdeaExec(bzrRoot, "xmlstatus");
85 statusExec.setStderrValidationEnabled(false);
86@@ -186,11 +206,13 @@
87
88 private ChangelistBuilder m_builder;
89 private File m_bzrRoot;
90+ private Set<File> m_bzrSubRoots;
91 private final Collection<String> m_ignoredList = new LinkedList<String>();
92
93- public MyIgnoredHandler(ChangelistBuilder builder, File bzrRoot) {
94+ public MyIgnoredHandler(ChangelistBuilder builder, File bzrRoot, Set<File> ioSubRoots) {
95 m_builder = builder;
96 m_bzrRoot = bzrRoot;
97+ m_bzrSubRoots = ioSubRoots;
98 }
99
100 public void processResults() {
101@@ -211,6 +233,9 @@
102
103 private void processIgnore(String path) {
104 File ignored = new File(m_bzrRoot, path);
105+ if (m_bzrSubRoots.contains(ignored)) {
106+ return;
107+ }
108 IGNORED.debug(String.format("%10s \"%s\"", "ignored", ignored));
109 m_builder.processIgnoredFile(VcsUtil.getVirtualFile(ignored));
110 }
111@@ -223,12 +248,14 @@
112 private VirtualFile m_vcsRoot;
113 private File m_bzrRoot;
114 private final Collection<GenericChange> m_changes = new LinkedList<GenericChange>();
115+ private Set<File> m_bzrSubRoots;
116
117- public MyStatusHandler(VirtualFile vcsRoot, ChangelistBuilder builder, File bzrRoot, BzrRevisionNumber bzrRev) {
118+ public MyStatusHandler(VirtualFile vcsRoot, ChangelistBuilder builder, File bzrRoot, BzrRevisionNumber bzrRev, Set<File> ioSubRoots) {
119 m_vcsRoot = vcsRoot;
120 m_builder = builder;
121 m_bzrRoot = bzrRoot;
122 m_bzrRev = bzrRev;
123+ m_bzrSubRoots = ioSubRoots;
124 }
125
126 public void processResults() {
127@@ -324,6 +351,10 @@
128 UNKNOWN.debug(String.format("%10s \"%s\"", "unknown", vFile));
129 builder.processUnversionedFile(vFile);
130 if (vFile.isDirectory()) {
131+ File ioFile = VcsUtil.getFilePath(vFile.getPath(), true).getIOFile();
132+ if (this.m_bzrSubRoots.contains(ioFile)) {
133+ return;
134+ }
135 for (VirtualFile child : vFile.getChildren()) {
136 processRecursive(builder, child);
137 }

Subscribers

People subscribed via source and target branches