summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2014-02-06 14:02:54 -0800
committerTor Norbye <tnorbye@google.com>2014-02-06 14:02:59 -0800
commit70ae6f2a102f9dcd665861668cccae9590cdbef1 (patch)
treee5b3a4f2419b9f630851b209c02e14179b6fa2ba /plugins
parent809cb3e73653399e59e45e0b10749a8e37b85a75 (diff)
downloadidea-70ae6f2a102f9dcd665861668cccae9590cdbef1.tar.gz
Snapshot dc1944e804515a346297e368c3b9c35a203c9912 from idea/133.818 of git://git.jetbrains.org/idea/community.git
dc1944e: Merge remote-tracking branch 'origin/133' into 133 c2e9002: Merge remote-tracking branch 'origin/133' into 133 dbd4198: IDEA-117777 Change the way native splashscreen is shown in WinLauncher IDEA-117163 Parameter "nosplash" is broken on launcher (cherry picked from commit b783716) cfcbcbb: distinct prover: do not distinguish raw type arguments from type arguments without params (IDEA-119546) (cherry picked from commit baee0eb) a1b2686: Copyright: commit document after comment updating (cherry picked from commit 0f2e2a5) 210e309: IDEA-119677 AWT thread blocking during start up 607d561: do not replace checked exception with unchecked (IDEA-119345) 34d7d0d: cls reference ignores passed outer class type arguments (IDEA-118733) afb6d22: revert (IDEA-120153) 512ceae: temp solution (IDEA-118527) (cherry picked from commit 32094bf) a1cb63e: Merge remote-tracking branch 'origin/133' into 133 b90c09e: Logo updated: 'Tools matter' moved. 87174f2: [git] Don't read default commit message from .COMMIT_EDITMSG 00bc294: Add new plugins to brokenPlugins.txt a42d688: PyCharm 3.1 artwork c7a0fea: IDEA-119510 Update Pivotal connector to correctly set "Started" and "Finished" states for stories. Unify titles of error dialogs in "Close task" and "Open task" actions. (cherry picked from commit 85bcbe8) c498973: root detection call optimized for empty root checkers (cherry picked from commit acdc335) f54d2a5: unnecessary 'else' removed (cherry picked from commit 65bce6c) 2f60cdc: style (cherry picked from commit 321cebb) 0ca33de: VcsRootDetectorI renamed (cherry picked from commit 5a75778) e8a0a07: VcsRootDetector refactoring dd9ee0b: GitRootFinder removed as unnecessary (cherry picked from commit 470ad4d) 6061019: IDEA-119738 Problem with Android Studio connecting to wrong VCS (Git vs. Mercurial) a0afcc5: style (cherry picked from commit 1195dd4) 0b6023f: Mercurial Repository info problem fixed eae61e9: style (cherry picked from commit 96ec395) 6be71da: Unnecessary parameter --ignore removed from appropriate status commands. 8d896ca: Annotate for renamed/moved file fixed 95fe78f: getFileNameInTargetRevision updated 2eb0039: VcsRoot detector tests updated 5a89ec5: VcsRootError changed to be an interface, implementation moved to vcs-impl (cherry picked from commit 49815e2) 6e7297f: Reverted percent formatting by default for MySQL parser compatibility with Python (PY-10771) c92b0d9: Fixed add method quick fix after changing the element reported by the unresolved references inspection cede286: do not prefer simple python run configuration over tests fa2e308: do not prefer simple python run configuration over custom (django, etc.) 5bdf739: Don't use JSON to store broken plugins. Loading JSON on startup take 50m.s. e2617c0: Fill brokenPlugins.json (cherry picked from commit ebf4294) 50938aa: [git] IDEA-120042 Protect against zero timestamp 03b587d: Kill Python console with SIGKILL, because SIGINT generates KeyboardInterrupt and closes nothing. (cherry picked from commit 35603ff416a1c6b95d2ba4459fcc7bbb864315a1) 24baeea: NotNull annotation. (cherry picked from commit 8bf273fc402c574fe67f39f0a43018e0b3758cdd) 4fb7ecf: NotNull annotation. (cherry picked from commit 8204f64b865634da512600488441c5001e902c5d) 13a9206: NPE (EA-52843) (cherry picked from commit 5f2c78ef5b3b574d620aa3abe6a619c7deb143f5) 5bb5de4: EA-49160 (cherry picked from commit 2e82518e58e42959f9153f2685a1fb6c924b524e) d33f8a2: NPE(EA-52907). (cherry picked from commit b44000de9a05193e218d159565a40e10d0770afa) eb15fe6: IOOBE (EA-53138). (cherry picked from commit 1ac0a958e7902e9503b1584aa9a5099a5645592a) 5a76e10: SIOOBE(EA-53677). (cherry picked from commit 8e887d7) d0de4d4: Fixed spelling in names of variables (cherry picked from commit e37f9b1) 43d19a0: Simplified always true expressions (cherry picked from commit 61f5888) 0d1f896: Fixed EA-49990: assert: TextRange.<init> bf30c71: Fixed EA-52685 - assert: MultiHostRegistrarImpl.doneInjecting 845984e: Reordered methods (cherry picked from commit 35afccf) 4bd4b91: Fixed SQL 'select/insert/...' rule injection into indented string literals (PY-11970) (cherry picked from commit 5fd0a91) afc90e9: Assume that string without '%' operator or 'format()' contains no formatting (PY-11771) (cherry picked from commit 2621f17) 58b30ff: Don't run code analysis for injections with interpolation in string formatting (PY-11962) (cherry picked from commit 6e66b22) e7ff3f0: Add injection place even if a string fragment consists of zero chunks (cherry picked from commit e4bf6e4) 077db26: Fixed parsing of unbalanced new style string formatting (PY-11962) (cherry picked from commit 76e0d23) d1d3177: IDEA-56096 Allow to create file templates with extension contains dot [CR-IC-3923] (cherry picked from commit c1728ca) ef7c9e4: assume custom stubs only if psifile's content element type isn't IStubElementType, this fixes performance problem of previous change (that added support for dom indices). The performance problem was manifested for flex stubs produced by decompiler. (cherry picked from commit 4b5b6e8) 7ab32ff: IDEA-119773 (slf4j placeholder inspection false warnings when passing in Object array) (cherry picked from commit d8e1c94) f6951b4: high CPU and EditorTextField/LanguageConsole scrolling ef19cd4: [git] IDEA-119887 Support one more git version output format 6ebae26: [git] convert GitVersionTest to junit 86970d3: Add brokenPlugins.json 2f5b006: [^Peter] IDEA-117390 don't complete light elements containing IntelliJIdeaRulezzz 3abd741: [^peter]IDEA-119647 CCE on groovy file 585208a: Merge remote-tracking branch 'origin/133' into 133 6257aa0: PyCharm 3.1 a7af6ae: Gradle: buildscript configuration respect inheritance (cherry picked from commit 0f133cf) d2311e1: [github] IDEA-119693 Don't share workspace.xml 8ed66a5: EA-53411 (more reliable diagnostic and better recovery) 7ac7972: IDEA-119498 (only suppress plugin updates for true command-line usage) db1690c: IDEA-55171 (prevent sync refresh from locking if application is disposed) f9286bb: fixed merge problem: extra test method was added 5b068d0: Traverse class owners via ScopeUtil in order to prevent switching from stubs to AST 527b224: Compare decorators by name preventing unnecessary switch from stubs to AST d4d3308: Fix CCE (PY-10999). 8e0523a: Setup __loader__ for __main__ module (PY-10535). 273934b: Added test for PY-11337 989d3a3: PY-3569 Inspection to warn if a loop variable is assigned inside the loop 44efd68: fixed EA-53497 - assert: TextRange.<init> 85c7dee: better fix for IDEA-111684 (cherry picked from commit bb558e8) 50207de: 13.0.3 EAP e3dcc49: IDEA-103743 Settings > Code Style > Arrangement UI glitch (after-review improvement) (cherry picked from commit 4269a85) f6d1bd3: 1) IDEA-103743 Settings > Code Style > Arrangement UI glitch 2) checkbox unselection doesn't disable combobox (cherry picked from commit b788397) e145138: Do not allow view to be larger than viewport with SCROLLBAR_NEVER policy 5ea4a3b: IDEA-118601 New Module: Maven: click on "Create from archetype" reverts typed coordinates. (cherry picked from commit 34d1109) +review CR-IC-3798 83fe636: hotfix: IDEA-119851 Gradle: the "out-of-process" mode doesn't work 0d06fcd: Merge branch '133' of git.labs.intellij.net:idea/community into 133 c1c74dc: Revert "updated external tools. Added annoying *.whl for the needs of virtualenv." 5e91a0d: advance bomb 37c6d1b: add read action (EA-51111) 239497a: read action 9f91062: PY-11882 Assignment to for loop inspection false positive PY-3569 Inspection to warn if a loop variable is assigned inside the loop c571c78: Don't analyze target expressions not located in the current file 59eff48: PY-6955 Unused import not greyed out if also failing 2db3187: PY-6955 Unused import not greyed out if also failing db42545: PY-6955 Unused import not greyed out if also failing (test refactored) 7aa1822: PY-3569 Inspection to warn if a loop variable is assigned inside the loop 086e91e: PY-3569 Inspection to warn if a loop variable is assigned inside the loop a4d9d17: updated external tools. Added annoying *.whl for the needs of virtualenv. e03288e: Cache presence or absence of a user skeleton for file in its user data 0f403e5: Rewritten PyQualifiedReference.collectAssignedAttributes() for better performance cff2993: Cache the result of asQualifiedName() 938b089: Forgot call to super 5c00d1f: fixed missing sys import 7a48578: Disabled comment injector for Python for performance reasons 6e1a348: fixed missing sys import ecc919e: fixed PY-11561 "Add super class call" incorrectly inserts parameter annotations 30556f2: fixed PY-11495 Create function: do not propose quick-fix for unresolved parts of fqn 3697485: fixed PY-11484 Implement abstract method: pushes docstring out of the way 5fa3f46: fixed isAbstractmethod 40ad42e: Fix align multiline elements in parenthesized expressions, parameters and arguments lists. 269d729: Cleanup of API for qualified names of expressions 51fb114: Method call in indenting statement should have continuation indent. a29830e: fixed PY-11353 Creating Run Configuration from specific test gets the "target" wrong 4cbbccb: fixed PY-11312 False positive CamelCase variable imported as lowercase 72ace3a: fixed PY-11281 Convert dict comprehension to dict call omits if expression 145c46c: Deprecated PyResolveUtil.treeCrawlUp() as a slow way of traversing the PSI 04eb283: Made several internal methods of PyResolveUtil private ffe45f7: fixed PY-11277 Python: Wrong "argument equals default" inspection 819364e: fixed PY-11617 Nosetest runner: simple function tests cannot jump to source 9b389fc: fixed PY-11696 Cancel after adding new interpreter removes configured project interpreter a74d7e3: proper fix for PY-11879 23a7505: Added PyQualifiedReference.isQualified() that potentially doesn't require AST access 5991dac: Use ScopeUtil.getScopeOwner() for preventing unnecessary stubs to AST switch 04a4e01: fixed PY-11340 Invalid case for can't assign to literal inspection 0f03c21: fixed PY-11341 Invalid case for identifier expected inspection after as in with statement 90143fb: Fix continuation indentation in while statement (PY-11869). bba7892: default test runner is unittest 92d2caf: Cache the results of asQualifiedName() for performance reasons 7a9fffc: Indent comment in tuple (PY-11904). 5c7ac44: Fixed test data to satisfy PEP8. 1d845d9: fixed PY-11879 Refactor: Rename: references in ivar directive are not updated 50bcfc0: fixed PY-11884 Missing completion for finally keyword after else statement f2a14b8: Insert two spaces before line comment (PY-11901). 17e208c: Fix indent in parenthesized expression in indenting statement (PY-11868). 04c1a4a: Inject SQL only into strings that have SELECT/UPDATE... at the beginning 40ddc62: fixed PY-11428 "Variable in function should be lowercase" false positive for variables declared global e214615: Try stub-based containers for Python PSI elements instead of getParent() b7f8286: Use hasDefaultValue() instead of getDefaultValue() in order to prevent switching from stubs to AST 4831476: Qualified targets are never local 68e8c17: Use isQualified() instead of getQualifier() in order to prevent switching from stubs to AST d351953: Find owner via ScopeUtil in order to prevent switching from stubs to AST 28b4b21: Note about stubs to AST 65a8a45: Traverse class owners via ScopeUtil in order to prevent switching from stubs to AST 51aef87: Compare decorators by name preventing unnecessary switch from stubs to AST df0f3bb: Fixed NPE 9da12c1: Calculate iteration type via types, not PyClass elements ae275ce: fixed PY-11875 Pycharm code analysis stalls on specific code (caused by AIOOB in getArguments of decorator) a38300c: Removed redundant PyTypeProvider.getIterationType() 8e05ff9: Types of Enum members' fields and type of Enum.__members__ 94cb03f: Fixed PyABCUtil.isSubtype() check for class definitions that have metaclasses 0060111: Type provider for enum.Enum members cbb65bb: Store metaclass qualified name in class stub for better performance 79b43ed: Added PyClass.getMetaClassExpression() 7916719: Extracted getMetaClassExpression() 44a5f41: Evaluate metaclass type using TypeEvalContext 55fdf8e: Check __metaclass__ attribute only for Python 2.x 7afe4fc: Refactored PyUtil.getMetaClass() into PyClass.getMetaClassType() 14f98ae: Keywords already contains 'as' and 'with' c38e6a3: Merge PyKeywords with PyNames c4a0746: Extracted PyStdlibTypeProvider.getNamedTupleType() Change-Id: Ia6001b030336ec63b47f7b49d53a595cc7fc0598
Diffstat (limited to 'plugins')
-rw-r--r--plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/logging/PlaceholderCountMatchesArgumentCountInspection.java63
-rw-r--r--plugins/InspectionGadgets/testsrc/com/siyeh/ig/logging/PlaceholderCountMatchesArgumentCountInspectionTest.java24
-rw-r--r--plugins/copyright/src/com/maddyhome/idea/copyright/psi/UpdatePsiFileCopyright.java42
-rw-r--r--plugins/eclipse/src/org/jetbrains/idea/eclipse/config/CachedXmlDocumentSet.java24
-rw-r--r--plugins/eclipse/src/org/jetbrains/idea/eclipse/config/EclipseClasspathStorageProvider.java4
-rw-r--r--plugins/eclipse/src/org/jetbrains/idea/eclipse/conversion/IdeaSpecificSettings.java2
-rw-r--r--plugins/git4idea/src/META-INF/plugin.xml2
-rw-r--r--plugins/git4idea/src/git4idea/GitVcs.java6
-rw-r--r--plugins/git4idea/src/git4idea/checkin/GitCheckinEnvironment.java10
-rw-r--r--plugins/git4idea/src/git4idea/config/GitVersion.java2
-rw-r--r--plugins/git4idea/src/git4idea/roots/GitIntegrationEnabler.java19
-rw-r--r--plugins/git4idea/src/git4idea/roots/GitRootFinder.java46
-rw-r--r--plugins/git4idea/tests/git4idea/roots/GitIntegrationEnablerTest.java27
-rw-r--r--plugins/git4idea/tests/git4idea/tests/GitVersionTest.java5
-rw-r--r--plugins/github/src/org/jetbrains/plugins/github/GithubShareAction.java17
-rw-r--r--plugins/gradle/src/org/jetbrains/plugins/gradle/model/builder/ModelBuildScriptClasspathBuilderImpl.java26
-rw-r--r--plugins/gradle/src/org/jetbrains/plugins/gradle/service/task/GradleTaskManager.java7
-rw-r--r--plugins/gradle/testData/testModelBuildScriptClasspathBuilder/build.gradle8
-rw-r--r--plugins/gradle/testData/testModelBuildScriptClasspathBuilder/settings.gradle2
-rw-r--r--plugins/gradle/testSources/org/jetbrains/plugins/gradle/model/builder/ModelBuildScriptClasspathBuilderImplTest.java16
-rw-r--r--plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GroovyCompletionContributor.java16
-rw-r--r--plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/expectedTypes/GroovyExpectedTypesProvider.java3
-rw-r--r--plugins/hg4idea/src/org/zmlx/hg4idea/action/HgBranchPopup.java11
-rw-r--r--plugins/hg4idea/src/org/zmlx/hg4idea/action/HgBranchesAction.java14
-rw-r--r--plugins/hg4idea/src/org/zmlx/hg4idea/log/HgLogProvider.java1
-rw-r--r--plugins/hg4idea/src/org/zmlx/hg4idea/provider/annotate/HgAnnotationProvider.java7
-rw-r--r--plugins/hg4idea/src/org/zmlx/hg4idea/provider/update/HgRegularUpdater.java2
-rw-r--r--plugins/hg4idea/src/org/zmlx/hg4idea/util/HgUtil.java15
-rw-r--r--plugins/maven/src/main/java/org/jetbrains/idea/maven/wizards/MavenModuleWizardStep.java19
-rw-r--r--plugins/tasks/tasks-api/src/com/intellij/tasks/TaskRepository.java2
-rw-r--r--plugins/tasks/tasks-core/src/com/intellij/tasks/actions/OpenTaskDialog.java2
-rw-r--r--plugins/tasks/tasks-core/src/com/intellij/tasks/pivotal/PivotalTrackerRepository.java34
-rw-r--r--plugins/terminal/src/org/jetbrains/plugins/terminal/AbstractTerminalRunner.java1
33 files changed, 289 insertions, 190 deletions
diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/logging/PlaceholderCountMatchesArgumentCountInspection.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/logging/PlaceholderCountMatchesArgumentCountInspection.java
index 660a88f81a4a..a2c9307fc80c 100644
--- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/logging/PlaceholderCountMatchesArgumentCountInspection.java
+++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/logging/PlaceholderCountMatchesArgumentCountInspection.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013 Bas Leijdekkers
+ * Copyright 2013-2014 Bas Leijdekkers
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -91,27 +91,14 @@ public class PlaceholderCountMatchesArgumentCountInspection extends BaseInspecti
return;
}
final PsiExpression secondArgument = arguments[1];
- if (!ExpressionUtils.hasStringType(secondArgument)) {
- return;
- }
- final String value = (String)ExpressionUtils.computeConstantExpression(secondArgument);
- if (value == null) {
- return;
- }
- placeholderCount = countPlaceholders(value);
- argumentCount = hasThrowableType(arguments[arguments.length - 1]) ? arguments.length - 3 : arguments.length - 2;
+ placeholderCount = countPlaceholders(secondArgument);
+ argumentCount = countArguments(arguments, 2);
}
- else if (ExpressionUtils.hasStringType(firstArgument)) {
- final String value = (String)ExpressionUtils.computeConstantExpression(firstArgument);
- if (value == null) {
- return;
- }
- placeholderCount = countPlaceholders(value);
- argumentCount = hasThrowableType(arguments[arguments.length - 1]) ? arguments.length - 2 : arguments.length - 1;
- } else {
- return;
+ else {
+ placeholderCount = countPlaceholders(firstArgument);
+ argumentCount = countArguments(arguments, 1);
}
- if (placeholderCount == argumentCount) {
+ if (placeholderCount < 0 || argumentCount < 0 || placeholderCount == argumentCount) {
return;
}
registerMethodCallError(expression, Integer.valueOf(argumentCount), Integer.valueOf(placeholderCount));
@@ -131,16 +118,44 @@ public class PlaceholderCountMatchesArgumentCountInspection extends BaseInspecti
return InheritanceUtil.isInheritor(type, CommonClassNames.JAVA_LANG_THROWABLE);
}
- public static int countPlaceholders(String value) {
+ public static int countPlaceholders(PsiExpression argument) {
+ final Object value = ExpressionUtils.computeConstantExpression(argument);
+ if (!(value instanceof String)) {
+ return -1;
+ }
+ final String string = (String)value;
int count = 0;
- int index = value.indexOf("{}");
+ int index = string.indexOf("{}");
while (index >= 0) {
- if (index <= 0 || value.charAt(index - 1) != '\\') {
+ if (index == 0 || string.charAt(index - 1) != '\\') {
count++;
}
- index = value.indexOf("{}", index + 1);
+ index = string.indexOf("{}", index + 1);
}
return count;
}
+
+ private static int countArguments(PsiExpression[] arguments, int countFrom) {
+ if (arguments.length <= countFrom) {
+ return 0;
+ }
+ final int count = arguments.length - countFrom;
+ if (count == 1) {
+ final PsiExpression argument = arguments[countFrom];
+ final PsiType argumentType = argument.getType();
+ if (argumentType instanceof PsiArrayType) {
+ if (argumentType.equalsToText("java.lang.Object[]") && argument instanceof PsiNewExpression) {
+ final PsiNewExpression newExpression = (PsiNewExpression)argument;
+ final PsiArrayInitializerExpression arrayInitializerExpression = newExpression.getArrayInitializer();
+ if (arrayInitializerExpression != null) {
+ return arrayInitializerExpression.getInitializers().length;
+ }
+ }
+ return -1;
+ }
+ }
+ final PsiExpression lastArgument = arguments[arguments.length - 1];
+ return hasThrowableType(lastArgument) ? count - 1 : count;
+ }
}
}
diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/logging/PlaceholderCountMatchesArgumentCountInspectionTest.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/logging/PlaceholderCountMatchesArgumentCountInspectionTest.java
index c122583ee586..1bd7feadae45 100644
--- a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/logging/PlaceholderCountMatchesArgumentCountInspectionTest.java
+++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/logging/PlaceholderCountMatchesArgumentCountInspectionTest.java
@@ -80,11 +80,31 @@ public class PlaceholderCountMatchesArgumentCountInspectionTest extends LightIns
public void testNoSlf4j() {
doTest("class FalsePositiveSLF4J {\n" +
" public void method( DefinitelyNotSLF4J definitelyNotSLF4J ) {\n" +
- " definitelyNotSLF4J.trace( \"not a trace message\", \"not a trace parameter\" );\n" +
+ " definitelyNotSLF4J.info( \"not a trace message\", \"not a trace parameter\" );\n" +
" }\n" +
" public interface DefinitelyNotSLF4J {\n" +
- " void trace( String firstParameter, Object secondParameter );\n" +
+ " void info( String firstParameter, Object secondParameter );\n" +
" }\n" +
"}");
}
+
+ public void testArrayArgument() {
+ doTest("import org.slf4j.*;" +
+ "class X {" +
+ " Logger LOG = LoggerFactory.getLogger( X.class );" +
+ " void m(String a, int b, Object c) {" +
+ " LOG.info(\"schnizzle {} for blurb {} in quark {}\", new Object[] {a, b, c});" +
+ " }" +
+ "}");
+ }
+
+ public void testUncountableArray() {
+ doTest("import org.slf4j.*;" +
+ "class X {" +
+ " Logger LOG = LoggerFactory.getLogger( X.class );" +
+ " void m(Object[] objects) {" +
+ " LOG.info(\"deep cover {} quantum disstressor {} at light speed {}\", objects);" +
+ " }" +
+ "}");
+ }
} \ No newline at end of file
diff --git a/plugins/copyright/src/com/maddyhome/idea/copyright/psi/UpdatePsiFileCopyright.java b/plugins/copyright/src/com/maddyhome/idea/copyright/psi/UpdatePsiFileCopyright.java
index 9b9d9105e81c..66ea6e340caa 100644
--- a/plugins/copyright/src/com/maddyhome/idea/copyright/psi/UpdatePsiFileCopyright.java
+++ b/plugins/copyright/src/com/maddyhome/idea/copyright/psi/UpdatePsiFileCopyright.java
@@ -36,6 +36,7 @@ import com.maddyhome.idea.copyright.CopyrightManager;
import com.maddyhome.idea.copyright.CopyrightProfile;
import com.maddyhome.idea.copyright.options.LanguageOptions;
import com.maddyhome.idea.copyright.util.FileTypeUtil;
+import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.LinkedHashSet;
@@ -321,25 +322,28 @@ public abstract class UpdatePsiFileCopyright extends AbstractUpdateCopyright {
@Override
public void run() {
Document doc = FileDocumentManager.getInstance().getDocument(getRoot());
- PsiDocumentManager.getInstance(file.getProject()).doPostponedOperationsAndUnblockDocument(doc);
- for (CommentAction action : actions) {
- int start = action.getStart();
- int end = action.getEnd();
-
- switch (action.getType()) {
- case CommentAction.ACTION_INSERT:
- String comment = getCommentText(action.getPrefix(), action.getSuffix());
- if (!comment.isEmpty()) {
- doc.insertString(start, comment);
- }
- break;
- case CommentAction.ACTION_REPLACE:
- doc.replaceString(start, end, getCommentText("", ""));
- break;
- case CommentAction.ACTION_DELETE:
- doc.deleteString(start, end);
- break;
+ if (doc != null) {
+ PsiDocumentManager.getInstance(file.getProject()).doPostponedOperationsAndUnblockDocument(doc);
+ for (CommentAction action : actions) {
+ int start = action.getStart();
+ int end = action.getEnd();
+
+ switch (action.getType()) {
+ case CommentAction.ACTION_INSERT:
+ String comment = getCommentText(action.getPrefix(), action.getSuffix());
+ if (!comment.isEmpty()) {
+ doc.insertString(start, comment);
+ }
+ break;
+ case CommentAction.ACTION_REPLACE:
+ doc.replaceString(start, end, getCommentText("", ""));
+ break;
+ case CommentAction.ACTION_DELETE:
+ doc.deleteString(start, end);
+ break;
+ }
}
+ PsiDocumentManager.getInstance(file.getProject()).commitDocument(doc);
}
}
});
@@ -423,7 +427,7 @@ public abstract class UpdatePsiFileCopyright extends AbstractUpdateCopyright {
}
@Override
- public int compareTo(CommentAction object) {
+ public int compareTo(@NotNull CommentAction object) {
int s = object.getStart();
int diff = s - start;
if (diff == 0) {
diff --git a/plugins/eclipse/src/org/jetbrains/idea/eclipse/config/CachedXmlDocumentSet.java b/plugins/eclipse/src/org/jetbrains/idea/eclipse/config/CachedXmlDocumentSet.java
index 548d19048989..9edbad2a2413 100644
--- a/plugins/eclipse/src/org/jetbrains/idea/eclipse/config/CachedXmlDocumentSet.java
+++ b/plugins/eclipse/src/org/jetbrains/idea/eclipse/config/CachedXmlDocumentSet.java
@@ -23,7 +23,6 @@ import com.intellij.openapi.util.JDOMUtil;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.containers.HashMap;
-import com.intellij.util.io.fs.IFile;
import org.jdom.Document;
import org.jdom.JDOMException;
import org.jdom.output.EclipseJDOMUtil;
@@ -44,8 +43,12 @@ public class CachedXmlDocumentSet implements FileSet {
this.project = project;
}
- public Document read (final String name) throws IOException, JDOMException {
- return (Document)load(name).clone();
+ public Document read(final String name) throws IOException, JDOMException {
+ return read(name, true);
+ }
+
+ public Document read(final String name, final boolean refresh) throws IOException, JDOMException {
+ return (Document)load(name, refresh).clone();
}
public void write(Document document, String name) throws IOException {
@@ -66,13 +69,18 @@ public class CachedXmlDocumentSet implements FileSet {
public boolean exists(String name) {
assertKnownName(name);
- return !deletedContent.contains(name) && getVFile(name) != null;
+ return !deletedContent.contains(name) && getVFile(name, false) != null;
}
@Nullable
protected VirtualFile getVFile(final String name) {
+ return getVFile(name, true);
+ }
+
+ @Nullable
+ protected VirtualFile getVFile(final String name, boolean refresh) {
final VirtualFile file = LocalFileSystem.getInstance().findFileByIoFile(new File(getParent(name), name));
- if (file != null) {
+ if (file != null && refresh) {
file.refresh(false, true);
if (!file.isValid()) return null;
}
@@ -107,7 +115,7 @@ public class CachedXmlDocumentSet implements FileSet {
}
}
- protected Document load(final String name) throws IOException, JDOMException {
+ protected Document load(final String name, boolean refresh) throws IOException, JDOMException {
assertKnownName(name);
final Document logical = modifiedContent.get(name);
if (logical != null) {
@@ -116,7 +124,7 @@ public class CachedXmlDocumentSet implements FileSet {
Document physical = savedContent.get(name);
if (physical == null) {
- final VirtualFile vFile = deletedContent.contains(name) ? null : getVFile(name);
+ final VirtualFile vFile = deletedContent.contains(name) ? null : getVFile(name, refresh);
if (vFile == null) {
throw new IOException(name + ": file does not exist");
}
@@ -136,7 +144,7 @@ public class CachedXmlDocumentSet implements FileSet {
public void preload() {
for (String key : nameToDir.keySet()) {
try {
- load(key);
+ load(key, true);
}
catch (IOException ignore) {
}
diff --git a/plugins/eclipse/src/org/jetbrains/idea/eclipse/config/EclipseClasspathStorageProvider.java b/plugins/eclipse/src/org/jetbrains/idea/eclipse/config/EclipseClasspathStorageProvider.java
index 6787a9c448cd..5f06150ce0cc 100644
--- a/plugins/eclipse/src/org/jetbrains/idea/eclipse/config/EclipseClasspathStorageProvider.java
+++ b/plugins/eclipse/src/org/jetbrains/idea/eclipse/config/EclipseClasspathStorageProvider.java
@@ -172,7 +172,7 @@ public class EclipseClasspathStorageProvider implements ClasspathStorageProvider
DotProjectFileHelper.saveDotProjectFile(module, fileCache.getParent(EclipseXml.PROJECT_FILE));
fileCache.delete(oldEmlName);
fileCache.register(newName + EclipseXml.IDEA_SETTINGS_POSTFIX, ClasspathStorage.getModuleDir(module));
- fileCache.load(newName + EclipseXml.IDEA_SETTINGS_POSTFIX);
+ fileCache.load(newName + EclipseXml.IDEA_SETTINGS_POSTFIX, true);
}
catch (IOException ignore) {
}
@@ -208,7 +208,7 @@ public class EclipseClasspathStorageProvider implements ClasspathStorageProvider
classpathReader.init(model);
if (documentSet.exists(EclipseXml.CLASSPATH_FILE)) {
classpathReader.readClasspath(model, new ArrayList<String>(), new ArrayList<String>(), usedVariables, new HashSet<String>(), null,
- documentSet.read(EclipseXml.CLASSPATH_FILE).getRootElement());
+ documentSet.read(EclipseXml.CLASSPATH_FILE, false).getRootElement());
}
else {
EclipseClasspathReader.setOutputUrl(model, path + "/bin");
diff --git a/plugins/eclipse/src/org/jetbrains/idea/eclipse/conversion/IdeaSpecificSettings.java b/plugins/eclipse/src/org/jetbrains/idea/eclipse/conversion/IdeaSpecificSettings.java
index 865d7c2a66c9..ffd71fd6ef76 100644
--- a/plugins/eclipse/src/org/jetbrains/idea/eclipse/conversion/IdeaSpecificSettings.java
+++ b/plugins/eclipse/src/org/jetbrains/idea/eclipse/conversion/IdeaSpecificSettings.java
@@ -74,7 +74,7 @@ public class IdeaSpecificSettings extends AbstractIdeaSpecificSettings<Modifiabl
}
public static void readIDEASpecific(ModifiableRootModel model, CachedXmlDocumentSet documentSet, String eml) throws InvalidDataException, IOException, JDOMException {
- new IdeaSpecificSettings().readIDEASpecific(documentSet.read(eml).getRootElement(), model, null, new HashMap<String, String>());
+ new IdeaSpecificSettings().readIDEASpecific(documentSet.read(eml, false).getRootElement(), model, null, new HashMap<String, String>());
}
@Override
diff --git a/plugins/git4idea/src/META-INF/plugin.xml b/plugins/git4idea/src/META-INF/plugin.xml
index 0c98e1491a7b..62640bf0bbd1 100644
--- a/plugins/git4idea/src/META-INF/plugin.xml
+++ b/plugins/git4idea/src/META-INF/plugin.xml
@@ -116,8 +116,6 @@
<logProvider implementation="git4idea.log.GitLogProvider"/>
<vcsChangesViewRefresher implementation="git4idea.changes.GitChangesViewRefresher" />
- <vcs.rootFinder implementation="git4idea.roots.GitRootFinder"/>
-
<projectService
serviceInterface="git4idea.history.wholeTree.LogFactoryService"
serviceImplementation="git4idea.history.wholeTree.LogFactoryService"/>
diff --git a/plugins/git4idea/src/git4idea/GitVcs.java b/plugins/git4idea/src/git4idea/GitVcs.java
index 6d62a07bf422..714f6096a3e4 100644
--- a/plugins/git4idea/src/git4idea/GitVcs.java
+++ b/plugins/git4idea/src/git4idea/GitVcs.java
@@ -46,7 +46,6 @@ import com.intellij.openapi.vcs.history.VcsHistoryProvider;
import com.intellij.openapi.vcs.history.VcsRevisionNumber;
import com.intellij.openapi.vcs.merge.MergeProvider;
import com.intellij.openapi.vcs.rollback.RollbackEnvironment;
-import com.intellij.openapi.vcs.roots.VcsRootDetectInfo;
import com.intellij.openapi.vcs.roots.VcsRootDetector;
import com.intellij.openapi.vcs.ui.VcsBalloonProblemNotifier;
import com.intellij.openapi.vcs.update.UpdateEnvironment;
@@ -89,6 +88,7 @@ import org.jetbrains.annotations.Nullable;
import javax.swing.event.HyperlinkEvent;
import java.io.File;
import java.text.SimpleDateFormat;
+import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.List;
@@ -586,8 +586,8 @@ public class GitVcs extends AbstractVcs<CommittedChangeList> {
public void enableIntegration() {
ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
public void run() {
- VcsRootDetectInfo detectInfo = new VcsRootDetector(myProject).detect();
- new GitIntegrationEnabler(myProject, myGit, myPlatformFacade).enable(detectInfo);
+ Collection<VcsRoot> roots = ServiceManager.getService(myProject, VcsRootDetector.class).detect();
+ new GitIntegrationEnabler(myProject, myGit, myPlatformFacade).enable(roots);
}
});
}
diff --git a/plugins/git4idea/src/git4idea/checkin/GitCheckinEnvironment.java b/plugins/git4idea/src/git4idea/checkin/GitCheckinEnvironment.java
index ee75d19d7e71..7331fd7fdbfa 100644
--- a/plugins/git4idea/src/git4idea/checkin/GitCheckinEnvironment.java
+++ b/plugins/git4idea/src/git4idea/checkin/GitCheckinEnvironment.java
@@ -113,22 +113,16 @@ public class GitCheckinEnvironment implements CheckinEnvironment {
for (VirtualFile root : GitUtil.gitRoots(Arrays.asList(filesToCheckin))) {
VirtualFile mergeMsg = root.findFileByRelativePath(GitRepositoryFiles.GIT_MERGE_MSG);
VirtualFile squashMsg = root.findFileByRelativePath(GitRepositoryFiles.GIT_SQUASH_MSG);
- VirtualFile normalMsg = root.findFileByRelativePath(GitRepositoryFiles.GIT_COMMIT_EDITMSG);
try {
- if (mergeMsg == null && squashMsg == null && normalMsg == null) {
+ if (mergeMsg == null && squashMsg == null) {
continue;
}
-
String encoding = GitConfigUtil.getCommitEncoding(myProject, root);
-
if (mergeMsg != null) {
messages.add(loadMessage(mergeMsg, encoding));
}
- else if (squashMsg != null) {
- messages.add(loadMessage(squashMsg, encoding));
- }
else {
- messages.add(loadMessage(normalMsg, encoding));
+ messages.add(loadMessage(squashMsg, encoding));
}
}
catch (IOException e) {
diff --git a/plugins/git4idea/src/git4idea/config/GitVersion.java b/plugins/git4idea/src/git4idea/config/GitVersion.java
index 794ca8b500e3..57ac40dfb5fa 100644
--- a/plugins/git4idea/src/git4idea/config/GitVersion.java
+++ b/plugins/git4idea/src/git4idea/config/GitVersion.java
@@ -69,7 +69,7 @@ public final class GitVersion implements Comparable<GitVersion> {
public static final GitVersion NULL = new GitVersion(0, 0, 0, 0, Type.NULL);
private static final Pattern FORMAT = Pattern.compile(
- "git version (\\d+)\\.(\\d+)\\.(\\d+)(?:\\.(\\d+))?(.*)", Pattern.CASE_INSENSITIVE);
+ "git version (\\d+)\\.(\\d+)(?:\\.(\\d+))?(?:\\.(\\d+))?(.*)", Pattern.CASE_INSENSITIVE);
private static final Logger LOG = Logger.getInstance(GitVersion.class.getName());
diff --git a/plugins/git4idea/src/git4idea/roots/GitIntegrationEnabler.java b/plugins/git4idea/src/git4idea/roots/GitIntegrationEnabler.java
index a9e0c6ee0ad0..4e9533ab81b1 100644
--- a/plugins/git4idea/src/git4idea/roots/GitIntegrationEnabler.java
+++ b/plugins/git4idea/src/git4idea/roots/GitIntegrationEnabler.java
@@ -22,8 +22,8 @@ import com.intellij.openapi.vcs.AbstractVcs;
import com.intellij.openapi.vcs.ProjectLevelVcsManager;
import com.intellij.openapi.vcs.VcsDirectoryMapping;
import com.intellij.openapi.vcs.VcsRoot;
-import com.intellij.openapi.vcs.roots.VcsRootDetectInfo;
import com.intellij.openapi.vcs.roots.VcsRootErrorsFinder;
+import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.ui.UIUtil;
@@ -56,9 +56,9 @@ public class GitIntegrationEnabler {
myPlatformFacade = platformFacade;
}
- public void enable(@NotNull VcsRootDetectInfo detectInfo) {
+ public void enable(@NotNull Collection<VcsRoot> vcsRoots) {
Notificator notificator = myPlatformFacade.getNotificator(myProject);
- Collection<VcsRoot> gitRoots = ContainerUtil.filter(detectInfo.getRoots(), new Condition<VcsRoot>() {
+ Collection<VcsRoot> gitRoots = ContainerUtil.filter(vcsRoots, new Condition<VcsRoot>() {
@Override
public boolean value(VcsRoot root) {
AbstractVcs gitVcs = root.getVcs();
@@ -77,13 +77,24 @@ public class GitIntegrationEnabler {
}
else {
assert !roots.isEmpty();
- if (roots.size() > 1 || detectInfo.projectIsBelowVcs()) {
+ if (roots.size() > 1 || isProjectBelowVcs(roots)) {
notifyAddedRoots(notificator, roots);
}
addVcsRoots(roots);
}
}
+ private boolean isProjectBelowVcs(@NotNull Collection<VirtualFile> gitRoots) {
+ //check if there are vcs roots strictly above the project dir
+ VirtualFile baseDir = myProject.getBaseDir();
+ for (VirtualFile root : gitRoots) {
+ if (VfsUtilCore.isAncestor(root, baseDir, true)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
private static void notifyAddedRoots(Notificator notificator, Collection<VirtualFile> roots) {
notificator.notifySuccess("", String.format("Added Git %s: %s", pluralize("root", roots.size()), joinRootsPaths(roots)));
}
diff --git a/plugins/git4idea/src/git4idea/roots/GitRootFinder.java b/plugins/git4idea/src/git4idea/roots/GitRootFinder.java
deleted file mode 100644
index 01e20992d0f9..000000000000
--- a/plugins/git4idea/src/git4idea/roots/GitRootFinder.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package git4idea.roots;
-
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.vcs.VcsDirectoryMapping;
-import com.intellij.openapi.vcs.VcsRoot;
-import com.intellij.openapi.vcs.VcsRootFinder;
-import com.intellij.openapi.vcs.roots.VcsRootDetectInfo;
-import com.intellij.openapi.vcs.roots.VcsRootDetector;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.util.containers.ContainerUtilRt;
-import git4idea.GitVcs;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.Collection;
-import java.util.Collections;
-
-/**
- * @author Denis Zhdanov
- * @since 7/18/13 6:02 PM
- */
-public class GitRootFinder implements VcsRootFinder {
-
- @NotNull private final Project myProject;
-
- public GitRootFinder(@NotNull Project project) {
- myProject = project;
- }
-
- @NotNull
- @Override
- public Collection<VcsDirectoryMapping> findRoots(@NotNull VirtualFile root) {
- VcsRootDetectInfo info = new VcsRootDetector(myProject).detect(root);
- Collection<VcsRoot> roots = info.getRoots();
- if (roots.isEmpty()) {
- return Collections.emptyList();
- }
- Collection<VcsDirectoryMapping> result = ContainerUtilRt.newArrayList();
- for (VcsRoot vcsRoot : roots) {
- VirtualFile vFile = vcsRoot.getPath();
- if (vFile != null) {
- result.add(new VcsDirectoryMapping(vFile.getPath(), GitVcs.getKey().getName()));
- }
- }
- return result;
- }
-}
diff --git a/plugins/git4idea/tests/git4idea/roots/GitIntegrationEnablerTest.java b/plugins/git4idea/tests/git4idea/roots/GitIntegrationEnablerTest.java
index 8643348ba2f5..37b1d926303a 100644
--- a/plugins/git4idea/tests/git4idea/roots/GitIntegrationEnablerTest.java
+++ b/plugins/git4idea/tests/git4idea/roots/GitIntegrationEnablerTest.java
@@ -22,7 +22,6 @@ import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vcs.AbstractVcs;
import com.intellij.openapi.vcs.VcsRoot;
import com.intellij.openapi.vcs.VcsTestUtil;
-import com.intellij.openapi.vcs.roots.VcsRootDetectInfo;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.Function;
import com.intellij.util.containers.ContainerUtil;
@@ -38,7 +37,7 @@ import org.junit.Test;
import java.io.File;
import java.util.*;
-import static junit.framework.Assert.*;
+import static org.junit.Assert.*;
/**
* @author Nadya Zabrodina
@@ -63,7 +62,7 @@ public class GitIntegrationEnablerTest extends GitLightTest {
public void oneRootForTheWholeProjectThenJustAddVcsrRoot() {
Map<String, List<String>> map = new HashMap<String, List<String>>();
map.put("git_init", Collections.<String>emptyList());
- doTest(given(Arrays.asList("."), false),
+ doTest(given(Arrays.asList(".")),
map, null);
}
@@ -74,7 +73,7 @@ public class GitIntegrationEnablerTest extends GitLightTest {
map.put("vcs_roots", VcsTestUtil.toAbsolute(Arrays.asList("."), myProject));
- doTest(given(Collections.<String>emptyList(), false),
+ doTest(given(Collections.<String>emptyList()),
map, notification("Created Git repository in " + myProjectRoot));
}
@@ -83,7 +82,7 @@ public class GitIntegrationEnablerTest extends GitLightTest {
Map<String, List<String>> map = new HashMap<String, List<String>>();
map.put("git_init", Collections.<String>emptyList());
- doTest(given(Arrays.asList(".."), true),
+ doTest(given(Arrays.asList("..")),
map, notification("Added Git root: " + myTestRoot));
}
@@ -92,7 +91,7 @@ public class GitIntegrationEnablerTest extends GitLightTest {
Map<String, List<String>> map = new HashMap<String, List<String>>();
map.put("git_init", Collections.<String>emptyList());
- doTest(given(Arrays.asList(".", "community"), false),
+ doTest(given(Arrays.asList(".", "community")),
map, notification("Added Git roots: " + myProjectRoot + ", " + getPresentationForRoot("community")));
}
@@ -101,7 +100,7 @@ public class GitIntegrationEnablerTest extends GitLightTest {
Map<String, List<String>> map = new HashMap<String, List<String>>();
map.put("git_init", Collections.<String>emptyList());
- doTest(given(Arrays.asList("..", "community"), true),
+ doTest(given(Arrays.asList("..", "community")),
map, notification("Added Git roots: " + myTestRoot + ", " + getPresentationForRoot("community")));
}
@@ -110,16 +109,16 @@ public class GitIntegrationEnablerTest extends GitLightTest {
Map<String, List<String>> map = new HashMap<String, List<String>>();
map.put("git_init", Collections.<String>emptyList());
- doTest(given(Arrays.asList("community", "contrib"), false),
+ doTest(given(Arrays.asList("community", "contrib")),
map, notification(
"Added Git roots: " + getPresentationForRoot("community") + ", " + getPresentationForRoot("contrib")));
}
- private void doTest(@NotNull VcsRootDetectInfo detectInfo, @NotNull Map<String, List<String>> map, @Nullable Notification notification) {
+ private void doTest(@NotNull Collection<VcsRoot> vcsRoots, @NotNull Map<String, List<String>> map, @Nullable Notification notification) {
//default
if (map.get("vcs_roots") == null) {
- map.put("vcs_roots", ContainerUtil.map(detectInfo.getRoots(), new Function<VcsRoot, String>() {
+ map.put("vcs_roots", ContainerUtil.map(vcsRoots, new Function<VcsRoot, String>() {
@Override
public String fun(VcsRoot root) {
@@ -129,7 +128,7 @@ public class GitIntegrationEnablerTest extends GitLightTest {
}));
}
- new GitIntegrationEnabler(myProject, myGit, myPlatformFacade).enable(detectInfo);
+ new GitIntegrationEnabler(myProject, myGit, myPlatformFacade).enable(vcsRoots);
assertVcsRoots(map.get("vcs_roots"));
assertGitInit(map.get("git_init"));
@@ -148,14 +147,14 @@ public class GitIntegrationEnablerTest extends GitLightTest {
VcsTestUtil.assertEqualCollections(expectedVcsRoots, getPaths(actualRoots));
}
- VcsRootDetectInfo given(@NotNull Collection<String> roots, boolean below) {
- return new VcsRootDetectInfo(ContainerUtil.map(roots, new Function<String, VcsRoot>() {
+ Collection<VcsRoot> given(@NotNull Collection<String> roots) {
+ return ContainerUtil.map(roots, new Function<String, VcsRoot>() {
@Override
public VcsRoot fun(String s) {
return new VcsRoot(myVcs, new MockVirtualFile(VcsTestUtil.toAbsolute(s, myProject)));
}
- }), below);
+ });
}
Notification notification(String content) {
diff --git a/plugins/git4idea/tests/git4idea/tests/GitVersionTest.java b/plugins/git4idea/tests/git4idea/tests/GitVersionTest.java
index 798d5088dbbe..52232a1c4c88 100644
--- a/plugins/git4idea/tests/git4idea/tests/GitVersionTest.java
+++ b/plugins/git4idea/tests/git4idea/tests/GitVersionTest.java
@@ -17,7 +17,7 @@ package git4idea.tests;
import com.intellij.openapi.util.SystemInfo;
import git4idea.config.GitVersion;
-import org.testng.annotations.Test;
+import org.junit.Test;
import java.lang.reflect.Field;
@@ -34,7 +34,8 @@ public class GitVersionTest {
new TestGitVersion("git version 1.7.3.3", 1, 7, 3, 3),
new TestGitVersion("git version 1.7.3.5.gb27be", 1, 7, 3, 5),
new TestGitVersion("git version 1.7.4-rc1", 1, 7, 4, 0),
- new TestGitVersion("git version 1.7.7.5 (Apple Git-24)", 1, 7, 7, 5)
+ new TestGitVersion("git version 1.7.7.5 (Apple Git-24)", 1, 7, 7, 5),
+ new TestGitVersion("git version 1.9.rc0.143.g6fd479e", 1, 9, 0, 0)
};
private static final TestGitVersion[] msysTests = {
diff --git a/plugins/github/src/org/jetbrains/plugins/github/GithubShareAction.java b/plugins/github/src/org/jetbrains/plugins/github/GithubShareAction.java
index b30f57b97cff..4d70975880e6 100644
--- a/plugins/github/src/org/jetbrains/plugins/github/GithubShareAction.java
+++ b/plugins/github/src/org/jetbrains/plugins/github/GithubShareAction.java
@@ -23,7 +23,9 @@ import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.Task;
import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.project.Project;
+import com.intellij.openapi.roots.FileIndexFacade;
import com.intellij.openapi.ui.Splitter;
+import com.intellij.openapi.util.Condition;
import com.intellij.openapi.vcs.VcsDataKeys;
import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vcs.changes.ChangeListManager;
@@ -284,7 +286,8 @@ public class GithubShareAction extends DumbAwareAction {
// ask for files to add
final List<VirtualFile> trackedFiles = ChangeListManager.getInstance(project).getAffectedFiles();
- final Collection<VirtualFile> untrackedFiles = repository.getUntrackedFilesHolder().retrieveUntrackedFiles();
+ final Collection<VirtualFile> untrackedFiles = filterOutIgnored(project,
+ repository.getUntrackedFilesHolder().retrieveUntrackedFiles());
final List<VirtualFile> allFiles = new ArrayList<VirtualFile>();
allFiles.addAll(trackedFiles);
allFiles.addAll(untrackedFiles);
@@ -337,6 +340,18 @@ public class GithubShareAction extends DumbAwareAction {
return true;
}
+ @NotNull
+ private static Collection<VirtualFile> filterOutIgnored(@NotNull Project project, @NotNull Collection<VirtualFile> files) {
+ final ChangeListManager changeListManager = ChangeListManager.getInstance(project);
+ final FileIndexFacade fileIndex = FileIndexFacade.getInstance(project);
+ return ContainerUtil.filter(files, new Condition<VirtualFile>() {
+ @Override
+ public boolean value(VirtualFile file) {
+ return !changeListManager.isIgnoredFile(file) && !fileIndex.isExcludedFile(file);
+ }
+ });
+ }
+
private static boolean pushCurrentBranch(@NotNull Project project,
@NotNull GitRepository repository,
@NotNull String remoteName,
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/model/builder/ModelBuildScriptClasspathBuilderImpl.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/model/builder/ModelBuildScriptClasspathBuilderImpl.java
index 875d9cc26bc6..5572290c996a 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/model/builder/ModelBuildScriptClasspathBuilderImpl.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/model/builder/ModelBuildScriptClasspathBuilderImpl.java
@@ -22,14 +22,13 @@ import org.gradle.plugins.ide.idea.model.IdeaModel;
import org.gradle.plugins.ide.internal.IdeDependenciesExtractor;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.gradle.model.BuildScriptClasspathModel;
+import org.jetbrains.plugins.gradle.model.ClasspathEntryModel;
import org.jetbrains.plugins.gradle.model.ModelBuilderService;
import org.jetbrains.plugins.gradle.model.internal.BuildScriptClasspathModelImpl;
import org.jetbrains.plugins.gradle.model.internal.ClasspathEntryModelImpl;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
+import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
/**
* @author Vladislav.Soroka
@@ -37,6 +36,8 @@ import java.util.List;
*/
public class ModelBuildScriptClasspathBuilderImpl implements ModelBuilderService {
+ private final Map<String, BuildScriptClasspathModelImpl> cache = new ConcurrentHashMap<String, BuildScriptClasspathModelImpl>();
+
@Override
public boolean canBuild(String modelName) {
return BuildScriptClasspathModel.class.getName().equals(modelName);
@@ -45,6 +46,9 @@ public class ModelBuildScriptClasspathBuilderImpl implements ModelBuilderService
@Nullable
@Override
public Object buildAll(final String modelName, final Project project) {
+ BuildScriptClasspathModelImpl buildScriptClasspath = cache.get(project.getPath());
+ if (buildScriptClasspath != null) return buildScriptClasspath;
+
boolean offline = false;
boolean downloadJavadoc = false;
boolean downloadSources = true;
@@ -60,13 +64,22 @@ public class ModelBuildScriptClasspathBuilderImpl implements ModelBuilderService
}
}
+ buildScriptClasspath = new BuildScriptClasspathModelImpl();
+ Project parent = project.getParent();
+ if (parent != null) {
+ BuildScriptClasspathModelImpl parentBuildScriptClasspath = (BuildScriptClasspathModelImpl)buildAll(modelName, parent);
+ if (parentBuildScriptClasspath != null) {
+ for (ClasspathEntryModel classpathEntryModel : parentBuildScriptClasspath.getClasspath()) {
+ buildScriptClasspath.add(classpathEntryModel);
+ }
+ }
+ }
+
final IdeDependenciesExtractor dependenciesExtractor = new IdeDependenciesExtractor();
final Configuration configuration = project.getBuildscript().getConfigurations().findByName("classpath");
Collection<Configuration> plusConfigurations = Collections.singletonList(configuration);
- BuildScriptClasspathModelImpl buildScriptClasspath = new BuildScriptClasspathModelImpl();
-
if (!offline) {
// download sources and/or javadoc
List<IdeDependenciesExtractor.IdeRepoFileDependency> repoFileDependencies = dependenciesExtractor.extractRepoFileDependencies(
@@ -88,6 +101,7 @@ public class ModelBuildScriptClasspathBuilderImpl implements ModelBuilderService
buildScriptClasspath.add(new ClasspathEntryModelImpl(dependency.getFile(), null, null));
}
+ cache.put(project.getPath(), buildScriptClasspath);
return buildScriptClasspath;
}
}
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/task/GradleTaskManager.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/task/GradleTaskManager.java
index 00d9ca5e193e..67cb359db180 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/task/GradleTaskManager.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/task/GradleTaskManager.java
@@ -125,8 +125,11 @@ public class GradleTaskManager extends AbstractExternalSystemTaskManager<GradleE
public boolean cancelTask(@NotNull ExternalSystemTaskId id, @NotNull ExternalSystemTaskNotificationListener listener)
throws ExternalSystemException {
- for (GradleTaskManagerExtension gradleTaskManagerExtension : GradleTaskManagerExtension.EP_NAME.getExtensions()) {
- if (gradleTaskManagerExtension.cancelTask(id, listener)) return true;
+ // extension points are available only in IDE process
+ if (ExternalSystemApiUtil.isInProcessMode(GradleConstants.SYSTEM_ID)) {
+ for (GradleTaskManagerExtension gradleTaskManagerExtension : GradleTaskManagerExtension.EP_NAME.getExtensions()) {
+ if (gradleTaskManagerExtension.cancelTask(id, listener)) return true;
+ }
}
// TODO replace with cancellation gradle API invocation when it will be ready, see http://issues.gradle.org/browse/GRADLE-1539
diff --git a/plugins/gradle/testData/testModelBuildScriptClasspathBuilder/build.gradle b/plugins/gradle/testData/testModelBuildScriptClasspathBuilder/build.gradle
index 5b09fca15f4d..45214e367483 100644
--- a/plugins/gradle/testData/testModelBuildScriptClasspathBuilder/build.gradle
+++ b/plugins/gradle/testData/testModelBuildScriptClasspathBuilder/build.gradle
@@ -7,3 +7,11 @@ project("moduleWithAdditionalClasspath") {
}
}
}
+
+project("baseModule") {
+ buildscript {
+ dependencies {
+ classpath files("lib/inheritedDep.jar")
+ }
+ }
+}
diff --git a/plugins/gradle/testData/testModelBuildScriptClasspathBuilder/settings.gradle b/plugins/gradle/testData/testModelBuildScriptClasspathBuilder/settings.gradle
index 02978875f494..20bd8ca0d9b8 100644
--- a/plugins/gradle/testData/testModelBuildScriptClasspathBuilder/settings.gradle
+++ b/plugins/gradle/testData/testModelBuildScriptClasspathBuilder/settings.gradle
@@ -2,3 +2,5 @@
include 'moduleWithoutAdditionalClasspath'
include 'moduleWithAdditionalClasspath'
+include 'baseModule'
+include 'baseModule:moduleWithInheritedClasspath' \ No newline at end of file
diff --git a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/model/builder/ModelBuildScriptClasspathBuilderImplTest.java b/plugins/gradle/testSources/org/jetbrains/plugins/gradle/model/builder/ModelBuildScriptClasspathBuilderImplTest.java
index d812d8df6a68..d802d086e4df 100644
--- a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/model/builder/ModelBuildScriptClasspathBuilderImplTest.java
+++ b/plugins/gradle/testSources/org/jetbrains/plugins/gradle/model/builder/ModelBuildScriptClasspathBuilderImplTest.java
@@ -55,20 +55,28 @@ public class ModelBuildScriptClasspathBuilderImplTest extends AbstractModelBuild
ClasspathEntryModel classpathEntry = classpathModel.getClasspath().getAt(0);
assertEquals("someDep.jar", classpathEntry.getClassesFile().getName());
}
+ else if (module.getName().equals("baseModule") ||
+ module.getName().equals("moduleWithInheritedClasspath")) {
+ assertNotNull("Null build classpath for module: " + module.getName(), classpathModel);
+ assertEquals("Wrong build classpath for module: " + module.getName(), 1, classpathModel.getClasspath().size());
+
+ ClasspathEntryModel classpathEntry = classpathModel.getClasspath().getAt(0);
+ assertEquals("Wrong build classpath for module: " + module.getName(), "inheritedDep.jar", classpathEntry.getClassesFile().getName());
+ }
else if (module.getName().equals("moduleWithoutAdditionalClasspath") ||
module.getName().equals("testModelBuildScriptClasspathBuilder")) {
- assertNotNull(classpathModel);
- assertTrue(classpathModel.getClasspath().isEmpty());
+ assertNotNull("Wrong build classpath for module: " + module.getName(), classpathModel);
+ assertTrue("Wrong build classpath for module: " + module.getName(), classpathModel.getClasspath().isEmpty());
}
else {
- fail();
+ fail("Unexpected module found: " + module.getName());
}
return classpathModel;
}
});
- assertEquals(3, ideaModule.size());
+ assertEquals(5, ideaModule.size());
}
@Override
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GroovyCompletionContributor.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GroovyCompletionContributor.java
index 58ee7a9325f4..198db8478d18 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GroovyCompletionContributor.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GroovyCompletionContributor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,6 +34,7 @@ import com.intellij.psi.codeStyle.JavaCodeStyleManager;
import com.intellij.psi.codeStyle.SuggestedNameInfo;
import com.intellij.psi.codeStyle.VariableKind;
import com.intellij.psi.filters.FilterPositionUtil;
+import com.intellij.psi.impl.light.LightElement;
import com.intellij.psi.impl.source.tree.LeafPsiElement;
import com.intellij.psi.scope.PsiScopeProcessor;
import com.intellij.psi.util.InheritanceUtil;
@@ -65,7 +66,6 @@ import org.jetbrains.plugins.groovy.lang.psi.api.types.GrCodeReferenceElement;
import org.jetbrains.plugins.groovy.lang.psi.api.types.GrTypeParameter;
import org.jetbrains.plugins.groovy.lang.psi.api.types.GrTypeParameterList;
import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.CompleteReferenceExpression;
-import org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.GrBindingVariable;
import org.jetbrains.plugins.groovy.lang.psi.util.GroovyPropertyUtils;
import org.jetbrains.plugins.groovy.lang.psi.util.PsiUtil;
import org.jetbrains.plugins.groovy.refactoring.DefaultGroovyVariableNameValidator;
@@ -451,7 +451,7 @@ public class GroovyCompletionContributor extends CompletionContributor {
object = ((GroovyResolveResult)object).getElement();
}
- if (object instanceof GrBindingVariable && ((GrBindingVariable)object).getName().contains(CompletionInitializationContext.DUMMY_IDENTIFIER_TRIMMED)) {
+ if (isLightElementDeclaredDuringCompletion(object)) {
return;
}
@@ -495,6 +495,16 @@ public class GroovyCompletionContributor extends CompletionContributor {
return EmptyRunnable.INSTANCE;
}
+ private static boolean isLightElementDeclaredDuringCompletion(Object object) {
+ if (!(object instanceof LightElement && object instanceof PsiNamedElement)) return false;
+ final String name = ((PsiNamedElement)object).getName();
+ if (name == null) return false;
+
+ return name.contains(CompletionInitializationContext.DUMMY_IDENTIFIER_TRIMMED.trim()) ||
+ name.contains(DUMMY_IDENTIFIER_DECAPITALIZED.trim());
+ }
+
+
private static Runnable addStaticMembers(CompletionParameters parameters,
final PrefixMatcher matcher,
final Map<PsiModifierListOwner, LookupElement> staticMembers, final Consumer<LookupElement> consumer) {
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/expectedTypes/GroovyExpectedTypesProvider.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/expectedTypes/GroovyExpectedTypesProvider.java
index f3779a15910a..152ceb5ef40d 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/expectedTypes/GroovyExpectedTypesProvider.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/expectedTypes/GroovyExpectedTypesProvider.java
@@ -522,7 +522,8 @@ public class GroovyExpectedTypesProvider {
@Override
public void visitCaseLabel(GrCaseLabel caseLabel) {
final PsiElement parent = caseLabel.getParent().getParent();
- assert parent instanceof GrSwitchStatement : parent + " of class " + parent.getClass();
+ if (!(parent instanceof GrSwitchStatement)) return;
+
final GrExpression condition = ((GrSwitchStatement)parent).getCondition();
if (condition == null) return;
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/action/HgBranchPopup.java b/plugins/hg4idea/src/org/zmlx/hg4idea/action/HgBranchPopup.java
index 5cdbd364ffe7..f272547934b9 100644
--- a/plugins/hg4idea/src/org/zmlx/hg4idea/action/HgBranchPopup.java
+++ b/plugins/hg4idea/src/org/zmlx/hg4idea/action/HgBranchPopup.java
@@ -29,7 +29,6 @@ import com.intellij.ui.popup.list.ListPopupImpl;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.zmlx.hg4idea.repo.HgRepository;
-import org.zmlx.hg4idea.repo.HgRepositoryImpl;
import org.zmlx.hg4idea.util.HgUtil;
import javax.swing.*;
@@ -110,10 +109,12 @@ public class HgBranchPopup {
popupGroup.addSeparator("Repositories");
boolean isMultiRepoConfig = repositories.size() > 1;
for (VirtualFile repository : repositories) {
- HgRepository repo = HgRepositoryImpl.getInstance(repository, myProject, myProject);
- popupGroup.add(new RootAction<HgRepository>(repo, isMultiRepoConfig ? myCurrentRepository : null,
- new HgBranchPopupActions(repo.getProject(), repo).createActions(null),
- HgUtil.getDisplayableBranchText(repo)));
+ HgRepository repo = HgUtil.getRepositoryManager(myProject).getRepositoryForRoot(repository);
+ if (repo != null) {
+ popupGroup.add(new RootAction<HgRepository>(repo, isMultiRepoConfig ? myCurrentRepository : null,
+ new HgBranchPopupActions(repo.getProject(), repo).createActions(null),
+ HgUtil.getDisplayableBranchText(repo)));
+ }
}
return popupGroup;
}
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/action/HgBranchesAction.java b/plugins/hg4idea/src/org/zmlx/hg4idea/action/HgBranchesAction.java
index 648309fae35b..61cf991c20a5 100644
--- a/plugins/hg4idea/src/org/zmlx/hg4idea/action/HgBranchesAction.java
+++ b/plugins/hg4idea/src/org/zmlx/hg4idea/action/HgBranchesAction.java
@@ -20,7 +20,6 @@ import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.zmlx.hg4idea.repo.HgRepository;
-import org.zmlx.hg4idea.repo.HgRepositoryImpl;
import org.zmlx.hg4idea.util.HgUtil;
import java.util.Collection;
@@ -33,19 +32,18 @@ public class HgBranchesAction extends HgAbstractGlobalAction {
@Override
protected void execute(@NotNull Project project, @NotNull Collection<VirtualFile> repositories, @Nullable VirtualFile selectedRepo) {
- HgRepository repository;
+ HgRepository repository = null;
if (selectedRepo != null) {
- repository = HgRepositoryImpl.getInstance(selectedRepo, project, project);
+ repository = HgUtil.getRepositoryManager(project).getRepositoryForRoot(selectedRepo);
}
else {
VirtualFile selectedRoot = HgUtil.getRootForSelectedFile(project);
if (selectedRoot != null) {
- repository = HgRepositoryImpl.getInstance(selectedRoot, project, project);
- }
- else {
- return;
+ repository = HgUtil.getRepositoryManager(project).getRepositoryForRoot(selectedRoot);
}
}
- HgBranchPopup.getInstance(project, repository).asListPopup().showInFocusCenter();
+ if (repository != null) {
+ HgBranchPopup.getInstance(project, repository).asListPopup().showInFocusCenter();
+ }
}
}
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/log/HgLogProvider.java b/plugins/hg4idea/src/org/zmlx/hg4idea/log/HgLogProvider.java
index 9fc2b16aedaf..c538825c53e4 100644
--- a/plugins/hg4idea/src/org/zmlx/hg4idea/log/HgLogProvider.java
+++ b/plugins/hg4idea/src/org/zmlx/hg4idea/log/HgLogProvider.java
@@ -165,7 +165,6 @@ public class HgLogProvider implements VcsLogProvider {
List<String> filterParameters = ContainerUtil.newArrayList();
// branch filter and user filter may be used several times without delimiter
- // or -r options with appropriate revset arguments delimited by '|' or 'and'.
if (!branchFilters.isEmpty()) {
for (VcsLogBranchFilter branchFilter : branchFilters) {
filterParameters.add(prepareParameter("branch", branchFilter.getBranchName()));
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/annotate/HgAnnotationProvider.java b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/annotate/HgAnnotationProvider.java
index 5592151eea8f..74e5177f77da 100644
--- a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/annotate/HgAnnotationProvider.java
+++ b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/annotate/HgAnnotationProvider.java
@@ -16,6 +16,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vcs.annotate.AnnotationProvider;
import com.intellij.openapi.vcs.annotate.FileAnnotation;
+import com.intellij.openapi.vcs.changes.ChangeListManager;
import com.intellij.openapi.vcs.history.VcsFileRevision;
import com.intellij.openapi.vcs.history.VcsRevisionNumber;
import com.intellij.openapi.vfs.VfsUtilCore;
@@ -53,8 +54,10 @@ public class HgAnnotationProvider implements AnnotationProvider {
throw new VcsException("vcs root is null for " + file);
}
final HgFile hgFile = new HgFile(vcsRoot, VfsUtilCore.virtualToIoFile(file));
- HgFile fileToAnnotate = revision instanceof HgFileRevision ? HgUtil
- .getFileNameInTargetRevision(myProject, ((HgFileRevision)revision).getRevisionNumber(), hgFile) : hgFile;
+ HgFile fileToAnnotate = revision instanceof HgFileRevision
+ ? HgUtil.getFileNameInTargetRevision(myProject, ((HgFileRevision)revision).getRevisionNumber(), hgFile)
+ : new HgFile(vcsRoot,
+ HgUtil.getOriginalFileName(hgFile.toFilePath(), ChangeListManager.getInstance(myProject)));
final List<HgAnnotationLine> annotationResult = (new HgAnnotateCommand(myProject)).execute(fileToAnnotate, revision);
final List<HgFileRevision> logResult;
try {
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/update/HgRegularUpdater.java b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/update/HgRegularUpdater.java
index 6cf3bcadf500..b0b4c7a0ab56 100644
--- a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/update/HgRegularUpdater.java
+++ b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/update/HgRegularUpdater.java
@@ -268,7 +268,7 @@ public class HgRegularUpdater implements HgUpdater {
if (parentAfterUpdate.equals(parentBeforeUpdate)) { // nothing to update => returning not to capture local uncommitted changes
return;
}
- HgStatusCommand statusCommand = new HgStatusCommand.Builder(true).baseRevision(parentBeforeUpdate).targetRevision(
+ HgStatusCommand statusCommand = new HgStatusCommand.Builder(true).ignored(false).unknown(false).baseRevision(parentBeforeUpdate).targetRevision(
parentAfterUpdate).build(project);
Set<HgChange> changes = statusCommand.execute(repo);
for (HgChange change : changes) {
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/util/HgUtil.java b/plugins/hg4idea/src/org/zmlx/hg4idea/util/HgUtil.java
index b1a52f37230b..61dd6a774836 100644
--- a/plugins/hg4idea/src/org/zmlx/hg4idea/util/HgUtil.java
+++ b/plugins/hg4idea/src/org/zmlx/hg4idea/util/HgUtil.java
@@ -351,9 +351,10 @@ public abstract class HgUtil {
@NotNull
public static HgFile getFileNameInTargetRevision(Project project, HgRevisionNumber vcsRevisionNumber, HgFile localHgFile) {
- HgStatusCommand statCommand = new HgStatusCommand.Builder(true).unknown(false).baseRevision(vcsRevisionNumber).build(project);
+ //get file name in target revision if it was moved/renamed
+ HgStatusCommand statCommand = new HgStatusCommand.Builder(false).copySource(true).baseRevision(vcsRevisionNumber).build(project);
- Set<HgChange> changes = statCommand.execute(localHgFile.getRepo());
+ Set<HgChange> changes = statCommand.execute(localHgFile.getRepo(), Collections.singletonList(localHgFile.toFilePath()));
for (HgChange change : changes) {
if (change.afterFile().equals(localHgFile)) {
@@ -470,13 +471,15 @@ public abstract class HgUtil {
if (rev1 != null) {
revNumber1 = rev1.getRevisionNumber();
//rev2==null means "compare with local version"
- statusCommand = new HgStatusCommand.Builder(true).copySource(false).baseRevision(revNumber1)
+ statusCommand = new HgStatusCommand.Builder(true).ignored(false).unknown(false).copySource(false).baseRevision(revNumber1)
.targetRevision(rev2 != null ? rev2.getRevisionNumber() : null).build(project);
}
else {
LOG.assertTrue(rev2 != null, "revision1 and revision2 can't both be null. Path: " + path); //rev1 and rev2 can't be null both//
//get initial changes//
- statusCommand = new HgStatusCommand.Builder(true).copySource(false).baseRevision(rev2.getRevisionNumber()).build(project);
+ statusCommand =
+ new HgStatusCommand.Builder(true).ignored(false).unknown(false).copySource(false).baseRevision(rev2.getRevisionNumber())
+ .build(project);
}
Collection<HgChange> hgChanges = statusCommand.execute(root, Collections.singleton(path));
@@ -484,11 +487,11 @@ public abstract class HgUtil {
//convert output changes to standart Change class
for (HgChange hgChange : hgChanges) {
FileStatus status = convertHgDiffStatus(hgChange.getStatus());
- if (status != FileStatus.UNKNOWN && status!= FileStatus.IGNORED) {
+ if (status != FileStatus.UNKNOWN) {
changes.add(createChange(project, root, hgChange.beforeFile().getRelativePath(), revNumber1,
hgChange.afterFile().getRelativePath(),
rev2 != null ? rev2.getRevisionNumber() : null, status));
- }
+ }
}
return changes;
}
diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/wizards/MavenModuleWizardStep.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/wizards/MavenModuleWizardStep.java
index ef5d2451cab1..ec99bd5a6db5 100644
--- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/wizards/MavenModuleWizardStep.java
+++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/wizards/MavenModuleWizardStep.java
@@ -23,6 +23,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.IconLoader;
import com.intellij.openapi.util.text.StringUtil;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.maven.model.MavenArchetype;
import org.jetbrains.idea.maven.model.MavenId;
@@ -197,6 +198,12 @@ public class MavenModuleWizardStep extends ModuleWizardStep {
return true;
}
+ private static void setTestIfEmpty(@NotNull JTextField artifactIdField, @Nullable String text) {
+ if (StringUtil.isEmpty(artifactIdField.getText())) {
+ artifactIdField.setText(StringUtil.notNullize(text));
+ }
+ }
+
@Override
public void updateStep() {
if (myArchetypes != null && myArchetypes.isSkipUpdateUI()) return;
@@ -210,14 +217,14 @@ public class MavenModuleWizardStep extends ModuleWizardStep {
MavenId projectId = myBuilder.getProjectId();
if (projectId == null) {
- myArtifactIdField.setText(myBuilder.getName());
- myGroupIdField.setText(myParent == null ? myBuilder.getName() : myParent.getMavenId().getGroupId());
- myVersionField.setText(myParent == null ? "1.0-SNAPSHOT" : myParent.getMavenId().getVersion());
+ setTestIfEmpty(myArtifactIdField, myBuilder.getName());
+ setTestIfEmpty(myGroupIdField, myParent == null ? myBuilder.getName() : myParent.getMavenId().getGroupId());
+ setTestIfEmpty(myVersionField, myParent == null ? "1.0-SNAPSHOT" : myParent.getMavenId().getVersion());
}
else {
- myArtifactIdField.setText(projectId.getArtifactId());
- myGroupIdField.setText(projectId.getGroupId());
- myVersionField.setText(projectId.getVersion());
+ setTestIfEmpty(myArtifactIdField, projectId.getArtifactId());
+ setTestIfEmpty(myGroupIdField, projectId.getGroupId());
+ setTestIfEmpty(myVersionField, projectId.getVersion());
}
myInheritGroupIdCheckBox.setSelected(myBuilder.isInheritGroupId());
diff --git a/plugins/tasks/tasks-api/src/com/intellij/tasks/TaskRepository.java b/plugins/tasks/tasks-api/src/com/intellij/tasks/TaskRepository.java
index 9256b3543f11..8d2e756dd251 100644
--- a/plugins/tasks/tasks-api/src/com/intellij/tasks/TaskRepository.java
+++ b/plugins/tasks/tasks-api/src/com/intellij/tasks/TaskRepository.java
@@ -130,7 +130,7 @@ public abstract class TaskRepository {
* @see com.intellij.tasks.TaskRepositoryType#getPossibleTaskStates()
*/
public void setTaskState(Task task, TaskState state) throws Exception {
- throw new UnsupportedOperationException();
+ throw new UnsupportedOperationException("Setting task to state " + state + " is not supported");
}
// for serialization
diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/actions/OpenTaskDialog.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/actions/OpenTaskDialog.java
index 3eeea41976ec..564c8066bd54 100644
--- a/plugins/tasks/tasks-core/src/com/intellij/tasks/actions/OpenTaskDialog.java
+++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/actions/OpenTaskDialog.java
@@ -134,7 +134,7 @@ public class OpenTaskDialog extends DialogWrapper {
repository.setTaskState(myTask, TaskState.IN_PROGRESS);
}
catch (Exception ex) {
- Messages.showErrorDialog(myProject, "Could not set state for " + myTask.getId(), "Error");
+ Messages.showErrorDialog(myProject, ex.getMessage(), "Cannot Set State For Issue");
LOG.warn(ex);
}
}
diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/pivotal/PivotalTrackerRepository.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/pivotal/PivotalTrackerRepository.java
index c0d46b8add42..12ba0672f96b 100644
--- a/plugins/tasks/tasks-core/src/com/intellij/tasks/pivotal/PivotalTrackerRepository.java
+++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/pivotal/PivotalTrackerRepository.java
@@ -35,6 +35,8 @@ import java.util.regex.Pattern;
/**
* @author Dennis.Ushakov
+ *
+ * TODO: update to REST APIv5
*/
@Tag("PivotalTracker")
public class PivotalTrackerRepository extends BaseRepositoryImpl {
@@ -333,22 +335,42 @@ public class PivotalTrackerRepository extends BaseRepositoryImpl {
@Override
public void setTaskState(Task task, TaskState state) throws Exception {
- if (state != TaskState.IN_PROGRESS) super.setTaskState(task, state);
final String realId = getRealId(task.getId());
if (realId == null) return;
+ final String stateName;
+ switch (state) {
+ case IN_PROGRESS:
+ stateName = "started";
+ break;
+ case RESOLVED:
+ stateName = "finished";
+ break;
+ // may add some others in future
+ default:
+ return;
+ }
String url = API_URL + "/projects/" + myProjectId + "/stories/" + realId;
- url +="?" + encodeUrl("story[current_state]") + "=" + encodeUrl("started");
+ url += "?" + encodeUrl("story[current_state]") + "=" + encodeUrl(stateName);
LOG.info("Updating issue state by id: " + url);
final HttpMethod method = doREST(url, HTTPMethod.PUT);
final InputStream stream = method.getResponseBodyAsStream();
final Element element = new SAXBuilder(false).build(stream).getRootElement();
- final Task story = element.getName().equals("story") ? createIssue(element) : null;
- if (story == null) {
- throw new Exception("Error setting state for: " + url + ", HTTP status code: " + method.getStatusCode() +
- "\n" + element.getText());
+ if (!element.getName().equals("story")) {
+ if (element.getName().equals("errors")) {
+ throw new Exception(extractErrorMessage(element));
+ } else {
+ // unknown error, probably our fault
+ LOG.warn("Error setting state for: " + url + ", HTTP status code: " + method.getStatusCode());
+ throw new Exception(String.format("Cannot set state '%s' for issue.", stateName));
+ }
}
}
+ @NotNull
+ private static String extractErrorMessage(@NotNull Element element) {
+ return StringUtil.notNullize(element.getChild("error").getText());
+ }
+
@Override
public boolean equals(final Object o) {
if (!super.equals(o)) return false;
diff --git a/plugins/terminal/src/org/jetbrains/plugins/terminal/AbstractTerminalRunner.java b/plugins/terminal/src/org/jetbrains/plugins/terminal/AbstractTerminalRunner.java
index 121958b849db..6624ad9b5555 100644
--- a/plugins/terminal/src/org/jetbrains/plugins/terminal/AbstractTerminalRunner.java
+++ b/plugins/terminal/src/org/jetbrains/plugins/terminal/AbstractTerminalRunner.java
@@ -165,6 +165,7 @@ public abstract class AbstractTerminalRunner<T extends Process> {
});
}
+ @NotNull
protected Project getProject() {
return myProject;
}