summaryrefslogtreecommitdiff
path: root/plugins/github
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2013-09-11 15:53:32 -0700
committerTor Norbye <tnorbye@google.com>2013-09-11 15:53:37 -0700
commita28de544d7f6bae0c637a1f8175ea613a976c52e (patch)
tree0b506efac9439f5a06d00e4aef4597c6d49bba3c /plugins/github
parentc7f983b5dcd0499fc68aacaba043874648932b6b (diff)
downloadidea-a28de544d7f6bae0c637a1f8175ea613a976c52e.tar.gz
Snapshot b7cfcd5072e521a95c49cdd58405fa262075116e from idea/132.197 of git://git.jetbrains.org/idea/community.git
b7cfcd5: 2013-09-10 Alexey Kudravtsev - cleanup 98e9b07: 2013-09-10 Alexey Kudravtsev - optimisation: almost always one element set/map 06b1744: 2013-09-10 Alexey Kudravtsev - cleanup static final constants c2f6153: 2013-09-10 Alexey Kudravtsev - cleanup df9d3ff: 2013-09-10 Alexey Kudravtsev - IDEA-113331 c502feb: 2013-09-10 Alexey Kudravtsev - cleanup 4790327: 2013-09-09 Alexey Kudravtsev - cleanup 734f361: 2013-09-09 Alexey Kudravtsev - cleanup 4fa0b86: 2013-09-11 Dmitry Avdeev - action moved from platform to IDEA cade1ac: 2013-09-11 Bas Leijdekkers - don't make quickfix available when it does nothing e25c86f: 2013-09-11 nik - fixed copying items from 'Dependencies' panel (IDEA-108071) ba416aa: 2013-09-11 nik - IDEA-108213: ZipException on attempt to extract non-existent jar when building artifact e55712a: 2013-09-11 nik - show path to incorrect zip-file in error message (IDEA-113123), improved 68d131a: 2013-09-11 Vladislav.Soroka - Gradle: gradle build file can be used to resolve project info instead of gradle project dir 09cdde1: 2013-09-11 nik - JPS bootstrap build libs updated 6e4c9f0: 2013-09-10 nik - xdebugger: mark new properties appeared after step in debugger trees (WI-3066) 7aa6d26: 2013-09-10 nik - jps model: added method to process annotation roots from module and its dependencies de4cbc7: 2013-09-10 nik - IDEA-112009: Library selection dialog is too small ba3c923: 2013-09-10 Bas Leijdekkers - IDEA-93530 (bad code green: cannot assign a value to final variable) ae1a4ca: 2013-09-11 Vassiliy Kudryashov - Lense mode "internal" preview 296e85f: 2013-09-10 Dmitry Jemerov - Merge branch 'master' of git://github.com/asedunov/intellij-community into pull97 816cc8a: 2013-09-10 Bas Leijdekkers - IDEA-93515 (Good code red: variable might not have been initialized) f3a5bef: 2013-09-10 Gregory.Shrago - IDEA-113281 Ctrl+E for Console History shadows hotkey for Recent 00c7cc6: 2013-09-10 Anna Kozlova - EA-49751 - NPE: TestsOutputConsolePrinter.isRoot c848db6: 2013-09-10 Anna Kozlova - Poly Expressions 9f5e9d5: 2013-09-10 Vladimir Krivosheev - correct fix WEB-8151 8534bf1: 2013-09-10 peter - cache the default dfaVar type 2ee4c95: 2013-09-10 peter - merge DfaNotNullValue into DfaTypeValue 650794d: 2013-09-10 peter - some findusageability in dfa a75c57d: 2013-09-10 Alexey Sedunov - Refactor method search classes for better reusability 049514a: 2013-09-10 Vladislav.Soroka - IDEA-50450 Gradle code insight; tasks dsl resolving (incomplete) 8bb28e2: 2013-09-10 Denis Fokin - Cocoa does not like activities while transition in full screen is happening. This fix prevents simultaneous entering in the full screen mode. c837b30: 2013-09-10 Sergey Evdokimov - IDEA-109771 Incorrent Maven dependency resolution with war classes dependency eede608: 2013-09-10 Dmitry Avdeev - no icons in wizards a18ab7c: 2013-09-10 Dmitry Avdeev - cleanup 204e83b: 2013-09-10 Dmitry Avdeev - cleanup 33d61c5: 2013-09-10 Dmitry Avdeev - fixed layout in absence of icons 70a172a: 2013-09-10 Bas Leijdekkers - IDEA-91960 (Type parameter extends final class inspection warns on cases when can not be removed) f0e77a8: 2013-09-10 Rustam Vishnyakov - Allow to move a standard code style option to another group [CR-IC-2192] (cherry picked from commit 81c4f16) 3748154: 2013-09-10 Max Medvedev - IDEA-113299 Imports removed when writing javadoc 1a6ca29: 2013-09-10 Max Medvedev - IDEA-52424 language injection for GStrings and binary expressions 83237e6: 2013-07-07 Max Medvedev - IDEA-99638 completion in @Language("<caret>") 075e763: 2013-09-10 Aleksey Pivovarov - @NotNull 836e1af: 2013-09-10 Aleksey Pivovarov - Github: Ref -> AtomicReference 2c384d0: 2013-09-10 Aleksey Pivovarov - Github: remove duplication 1d09e47: 2013-09-10 Aleksey Pivovarov - Github: fetch a single branch for diff 3361c53: 2013-09-10 Aleksey Pivovarov - Github: use BorderFactory 0c1a982: 2013-09-10 Aleksey Pivovarov - Github: Nullable 403902b: 2013-09-07 Aleksey Pivovarov - Github: project-level settings 911bea9: 2013-09-10 Vladislav.Soroka - IDEA-113403 Gradle: disable wrapper verification by default and add check for default wrapper files 7434b38: 2013-09-10 Dmitry Avdeev - preferred focused component for wizards ecf3594: 2013-09-10 peter - static CachedValueManager.getCachedValue(PsiElement, CachedValueProvider) for less verbose cached value storage in psi user data 7d3f4f25: 2013-09-10 peter - some dfa simplifications not affecting tests 9d04224: 2013-09-09 peter - remove unused DelegatingInstructionVisitor dff5e27: 2013-09-10 Denis Fokin - Windows long paths issue has been fixed, the com.intellij.ui.win.Task was moved from RecentTasks class because of some problems with JNI invocations. Class path now is enclosed by double quotes. a1e5a9d: 2013-09-10 Ekaterina Tuzova - Merge remote-tracking branch 'origin/master' dcb78a4: 2013-09-10 Ekaterina Tuzova - Merge remote-tracking branch 'origin/master' 7840bbe: 2013-09-10 Anna Kozlova - deprecate to be able to be used in PsiClass etc 401e730: 2013-09-10 Ekaterina Tuzova - Merge remote-tracking branch 'origin/master' 2fb38cf: 2013-09-10 Anna Kozlova - Merge remote-tracking branch 'origin/master' 6bae9e1: 2013-09-10 Anna Kozlova - optimization a5ebbff: 2013-09-10 Anna Kozlova - cleanup lambda specifics a44e101: 2013-09-10 Anna Kozlova - EA-49734 - IAE: GenericsHighlightUtil.checkReferenceTypeArgumentList 73bc4cb: 2013-09-10 Vladimir Krivosheev - auth works now, continue "sync now" button f590909: 2013-09-10 Dmitry Jemerov - Merge branch 'master' of git://github.com/bashor/intellij-community into pull96 769fd94: 2013-09-10 Ekaterina Tuzova - fixed PY-10714 Reformat of string creates error da07f0e: 2013-09-10 Konstantin Kolosovsky - Merge branch 'svn1_8_new' 08f3baf: 2013-09-10 Konstantin Kolosovsky - IDEA-112179 PropertiesComponent refactored - duplication removed cdfb7ae: 2013-09-10 Konstantin Kolosovsky - IDEA-112179 Add/Edit/Delete svn properties 0a36021: 2013-09-10 nik - IDEA-112941: Throwable at com.intellij.openapi.roots.ui.configuration.classpath.ChangeLibraryLevelActionBase$1.run da397a1: 2013-09-10 peter - add a note on adverse groovy-hotswap effects on serialization (IDEA-61884) adf5bb7: 2013-09-10 nik - fixed building CE by 64-bit JDK (IDEA-112953) 1b396ef: 2013-09-10 nik - jps build: memory usage optimization 921a2f3: 2013-09-10 Konstantin Bulenkov - mem leak fixed 276c402: 2013-09-10 Dmitry Avdeev - new project wizard b07de54: 2013-09-10 nik - show path to incorrect zip-file in error message (IDEA-113123) ab4e6c6: 2013-09-10 nik - remote servers: allow to show additional logs for deployments in 'Servers View' - 2 eb65d57: 2013-09-09 nik - remote servers: allow to show additional logs for deployments in 'Servers View' faff6c2: 2013-07-07 Max Medvedev - duplicated test fe0569b: 2013-07-07 Max Medvedev - fix broken jar in test-data a840eb2: 2013-07-07 Max Medvedev - Groovy shell: support commands bb2ff42: 2013-07-07 Max Medvedev - Groovy Shell: support classes a7658c1: 2013-07-07 Max Medvedev - Complete imported classes in GroovyCodeFragment e53f7be: 2013-07-07 Max Medvedev - NN/Nu edd7e1e: 2013-07-07 Max Medvedev - support imports in GroovyShell f203ff2: 2013-07-07 Max Medvedev - support imports in GroovyShell d45e9cd: 2013-07-07 Max Medvedev - Groovy element factory: create import from statement 59f6256: 2013-07-07 Max Medvedev - IDEA-110179 fix control flow building for if-statement c9f45b6: 2013-07-07 Max Medvedev - fix GroovyIntentionsBundle 02bf9a6: 2013-07-07 Max Medvedev - IDEA-110178 'convert concatenation to GString' intention supports regexes 8f4f1ac: 2013-07-06 Max Medvedev - fix GroovyEnterHandler f5bb52d: 2013-07-06 Max Medvedev - IDEA-110178 upper letters 711f61e: 2013-07-06 Max Medvedev - IDEA-110178 'convert string literal to dollar-slashy string' intention 9462203: 2013-07-06 Max Medvedev - IDEA-110178 'convert string literal to regex' intention should convert dollar-slashy regexes c53a519: 2013-07-06 Max Medvedev - cleanup GrStringUtil 7134b63: 2013-07-06 Max Medvedev - IDEA-110178 'convert string literal to regex' intention 60b2f0a: 2013-07-06 Max Medvedev - IDEA-109053 Convert to single-line string fixed 1dea12c: 2013-09-10 Vladimir Krivosheev - fix fetch initial "sync now" button 3cc0794: 2013-09-09 Vladimir Krivosheev - add note about SkipDefaultValuesSerializationFilters 67ecfc0: 2013-09-09 Vladimir Krivosheev - ApplicationImpl — cleanup getExtensions ics — commit under progress 4cae157: 2013-09-09 Anna Kozlova - more specific: lambda extended initial fix (IDEA-113357) 0195034: 2013-09-09 Anna Kozlova - lambda -> method ref: reject unresolved lambdas f1b399b: 2013-09-09 Alexander Lobas - RenderServer 4252a50: 2013-09-09 Vladimir Krivosheev - SingleAlarm — should use ModalityState.NON_MODAL a5ca071: 2013-09-09 Konstantin Kolosovsky - IDEA-112179 "Set property" action implemented 2fa6ff6: 2013-09-09 Bas Leijdekkers - test for IDEA-53184 b57f5e1: 2013-09-09 Konstantin Bulenkov - WI-19949 Parent class methods aren't shown after second Command-F12 a2beba8: 2013-09-09 Zalim Bashorov - When we don't have any dependency(after f4a27e8) we should use ModificationTracker.NEVER_CHANGED instead empty array. 5154748: 2013-09-09 Konstantin Kolosovsky - IDEA-112181 Handling readonly files with or without "svn:needs-lock" property 55a5f4c: 2013-09-09 Dmitry Trofimov - Merge remote-tracking branch 'origin/master' e6f6c94: 2013-09-09 Vladimir Krivosheev - WEB-6780 JS Debugger / Variables: "Jump to Source" not working: This action should be available only for object or functions. cd02963: 2013-09-09 Konstantin Kolosovsky - IDEA-112181 Lock data parsing for "svn info" command 66b72f8: 2013-09-09 Bas Leijdekkers - fix test and add test for IOE bb9b1f5: 2013-09-09 peter - IDEA-113391 Edit Method Contract intention for library methods b77731d: 2013-09-09 Konstantin Kolosovsky - IDEA-112181 Lock/Unlock actions implemented bc8cb84: 2013-09-09 Konstantin Kolosovsky - IDEA-94942 Utility methods to parse svn command line warnings b45114d: 2013-09-09 Dmitry Trofimov - Possibility to select Maya.app on Mac in add interpreter dialog. 631b361: 2013-09-09 Sergey Evdokimov - Completion of dependency should honor <dependencyManagement> section 0fcbc91: 2013-09-09 Roman Shevchenko - platform: correct formatting in the missing framework library validator 660731f: 2013-09-09 Bas Leijdekkers - use TypeConversionUtil.erasure() instead of reinventing the wheel badly 0fcec29: 2013-09-09 Bas Leijdekkers - prevent IOE on array initializer without array type (e.g. Map<String, String> m = {}) 5d70c64: 2013-09-09 Fedor Korotkov - Reverted 482c517 ea4b4f2: 2013-09-09 Vladimir Krivosheev - continue WEB-1171 javascript live console: execution enabled condition 54872b0: 2013-09-09 Anna Kozlova - accept interfaces as main classes for java 8 (IDEA-113340) c9fc494: 2013-09-09 Anna Kozlova - pull up: ensure that default won't be inserted for ll < 1.8 (IDEA-113323) c51363b: 2013-09-09 Vladimir Krivosheev - we should not call execute action if completion variant not focused 7c5f486: 2013-09-09 Dmitry Trofimov - Disposable parent can be null. 1e9a0d8: 2013-09-09 nik - xdebugger: simplified calling old deprecated method & javadocs added 2e3c259: 2013-09-09 nik - notnullification 0aa3d9d: 2013-09-09 Vladimir Krivosheev - continue WEB-1171 javascript live console: add history actions ac12238: 2013-09-09 Vladimir Krivosheev - add Copyright c7d7080: 2013-09-08 Alex Ruiz - Minor changes to NewProjectCheckoutListener to reuse its code. 8d29e4f: 2013-09-09 Sergey Simonchik - XDebugProcess method rename: createLayouter -> createTabLayouter f58251b: 2013-09-09 Sergey Simonchik - XDebugProcess.registerAdditionalContent method restored to keep compatibility with IDEA 12 API 286cdc3: 2013-09-09 Anna Kozlova - anonym -> lambda: unique param names (IDEA-113338) 238e311: 2013-09-09 Vladimir Krivosheev - prefer to use interface LanguageConsoleView instead of impl class d75838a: 2013-09-06 Vladimir Krivosheev - continue WEB-1171 javascript live console — works now, but UI is ugly 9f054b0: 2013-09-09 Sergey Simonchik - XDebug layout API improvement: XDebugProcess.registerAdditionalContent moved to XDebugLayouter 7cc0d20: 2013-09-08 Vladimir Krivosheev - schedule commit&push 4d9e998: 2013-09-08 Vladimir Krivosheev - move SingleAlarm to platform-impl 4d840cf: 2013-09-08 Dmitry Trofimov - Merge remote-tracking branch 'origin/master' 134a7fa: 2013-09-08 Fedor Korotkov - WEB-8731 HTML parser breaks with unquoted complex attributes 482c517: 2013-09-08 Fedor Korotkov - WEB-8397 Incorrect "element is not allowed here" inspection 3bbc3f7: 2013-09-08 Dmitry Trofimov - Implement get variable for console variables view. 12e32a8: 2013-09-08 Bas Leijdekkers - IDEA-96419 ("Externalizable class without public no-arg constructor" inspection options) 2d25b3b: 2013-09-08 Bas Leijdekkers - DRY 8941cf8: 2013-09-08 Bas Leijdekkers - IDEA-113298 (replace assertTrue with assertFalse removes message) 72c972f: 2013-09-07 Max Medvedev - auto inject RegExp lang to reg-exp operator argeuments e7fa284: 2013-09-07 Max Medvedev - IDEA-113346 False negative in groovy withStream closure 0b795be: 2013-09-07 Bas Leijdekkers - IDEA-85224 (Inspection "non thread-safe static field access" gives false +ve for static initializers) 28a1e72: 2013-09-07 Bas Leijdekkers - cleanup 8bc5fbf: 2013-06-12 Max Medvedev - IDEA-111780 Extract method from static closure should create static method bc4b2d7: 2013-06-12 Max Medvedev - IDEA-112878 Groovy code completion doesn't obey 'before parentheses -> method parentheses' settings. 1afc036: 2013-09-07 Dmitry Trofimov - Merge remote-tracking branch 'origin/master' 80cd221: 2013-09-07 Aleksey Pivovarov - Github: simplify 80a15fc: 2013-09-07 Aleksey Pivovarov - Github: simplify mapping user -> fork repository ef91648: 2013-09-07 Aleksey Pivovarov - Github: fix remote branch ref 307f921: 2013-09-07 Bas Leijdekkers - IDEA-53184 (False positive unused field inspection for serialVersionUID fields) c1545b5: 2013-09-06 Vassiliy Kudryashov - Lense mode "internal" preview 5a2c378: 2013-09-06 Roman Shevchenko - platform: correct formatting in downloadable library version chooser 4ffa7ea: 2013-09-06 Konstantin Kolosovsky - IDEA-112802 Fixed parameters for "checkout completed" event e8a4550: 2013-09-06 peter - there are no constructor field initializers in compiled psi cee022e: 2013-09-06 peter - IDEA-113013 When insert selected variant is enabled the "generated" code comply with code style 762a0ca: 2013-09-06 peter - empty for loop condition means "true" (IDEA-113242) 75c1cd6: 2013-09-06 peter - IDEA-113149 Constructor parameters completion is not available in case of classes with generics 243adf0: 2013-09-06 peter - IDEA-113028 Complete statement doesn't complete class declaration 9dfa286: 2013-09-06 Anna Kozlova - Merge remote-tracking branch 'origin/master' d901cc2: 2013-09-06 Anna Kozlova - drop old external annotations format a0d17e6: 2013-09-06 nik - xdebugger: restored custom presentation for keywords and numbers, changed values are highlighted by coloring their names 65dc74c: 2013-09-06 Sergey Evdokimov - Refactoring: use PsiImplUtil.isLeafElementOfType() instead of org.jetbrains.plugins.groovy.lang.psi.util.PsiUtil.isLeafElementOfType() 5d1dddc: 2013-09-06 peter - fail-fast DfaMemoryStateImpl.equals 59734e3: 2013-09-06 peter - calculate constructor initialization for all fields at once, and cache (needed for dfa and nullable-stuff inspections) 2bad29c: 2013-09-06 peter - 2x faster implicit field nullability detection 1952eee: 2013-09-06 peter - IDEA-112567 Don't show any completion variants after method reference and dot 6b3d77c: 2013-09-06 peter - IDEA-112968 Show "Value is always" warning only for null/true/false ae94260: 2013-09-06 peter - revert meaningless: use actual (maybe unsaved) psi text for find usages (EA-49575) 4275fcb: 2013-09-06 Anna Kozlova - drop old external annotations format d34fcc5: 2013-09-06 Anna Kozlova - move: take into account usages which won't be changed textually but could affect possible conflicts (IDEA-113280) f1b0f11: 2013-09-06 Sergey Simonchik - xdebug api improvement 1a1eacf: 2013-09-06 Konstantin Kolosovsky - IDEA-112802 Initial checkout implementation (with svn command line client) b7e7f12: 2013-09-06 Sergey Evdokimov - Bug fix: hint "(, )" is shown beside any goal in maven tool window 953771d: 2013-09-06 Sergey Evdokimov - Run completion automatically after inserting of <dependency> 14e7fec: 2013-09-06 Nadya Zabrodina - fix for windows (template need not to be quoted because GeneralCommandline is smart) f1a9f68: 2013-09-06 Bas Leijdekkers - IDEA-89557 (Inspection `RawUseOfParameterizedType` is redundant on inspection of parameterized type object arrays with the trailing `class` keyword) 80de1ec: 2013-09-06 Bas Leijdekkers - clarify that the "Raw use of parameterized type" inspection mirrors javac's rawtypes warning (IDEA-99892) 6942d1c: 2013-09-06 Bas Leijdekkers - IDEA-99829 (Problem with inspection "Raw use of parameterized class" option "Ignore where a type parameter would not compile.) b5c1f0e: 2013-09-06 nik - set default dependency scope for framework libraries added to a module 9683169: 2013-09-06 Eugene Zhuravlev - not-null + manager-thread assertions 86f4be9: 2013-09-06 Anna Kozlova - plugins: do not warn about disabled optional dependencies fb5e6e7: 2013-09-06 Anna Kozlova - plugins downloading: enable dependencies: make suggester answer Yes/No ac38433: 2013-09-06 Anna Kozlova - optimization: retrieve PsiElement when problem occurs only 9cd0458: 2013-09-06 Dmitry Trofimov - Merge remote-tracking branch 'origin/master' 683ece5: 2013-09-06 nik - xdebugger: 'jump to type source' action added 1448c7d: 2013-09-06 nik - cleanup 4c471d2: 2013-09-06 Vladislav.Soroka - IDEA-102653 tooltip with description added to external project task tree 499cd73: 2013-09-06 Bas Leijdekkers - no generic array creation 6a2d6f4: 2013-09-06 Konstantin Bulenkov - the fix of IDEA-26026 doesn't make sense nowadays. Dialog should be modal IDEA-105611 Invalid focus when invoking find in files 13d56b2: 2013-09-06 Konstantin Kolosovsky - IDEA-94942 Support nullable handler for update commands 9d07f2e: 2013-09-06 Konstantin Kolosovsky - IDEA-94942 Refactored merge, update implementation to use common command listener 8bd8e93: 2013-09-06 Denis Fokin - IDEA-113303 Headless Exception when using inspect.sh on OS X 599c49b: 2013-09-06 Vladimir Krivosheev - init WEB-1171 javascript live console 04b3c6b: 2013-09-06 Konstantin Kolosovsky - IDEA-94942 Force SVNKit implementation for 1.6 working copies bb8daac: 2013-09-06 Vladimir Krivosheev - investigate: java.lang.IllegalArgumentException: void return types for handler methods not supported f9f74a5: 2013-09-06 Vladimir Krivosheev - don't hide original exception: java.lang.Exception: java.lang.IllegalStateException: AES/CBC/NoPadding is not available 8df26d7: 2013-09-06 Mikhail Golubev - Merge remote-tracking branch 'origin/master' 87b1100: 2013-09-06 nik - xdebugger api: support grouping values in debugger trees c1e214a: 2013-09-06 Vladislav.Soroka - IDEA-50450 Gradle code insight f63250d: 2013-09-04 Alex Ruiz - Disabled "Use embedded Gradle" option for importing project. 517c614: 2013-09-06 Konstantin Bulenkov - remove refs to Project asap 636ac6d: 2013-09-06 Konstantin Bulenkov - IDEA-99897 When "block caret" mode is on, after deleting a character at the end of a line, the character deleted appears in inverse 021d4a5: 2013-06-12 Max Medvedev - Groovy formatter: blank lines in declarations 706feca: 2013-06-12 Max Medvedev - IDEA-113124 Groovy files in the navigation bar 81ba9a5: 2013-09-05 Vladimir Krivosheev - cleanup 198c147: 2013-06-12 Max Medvedev - IDEA-107520 Groovy Shell: support commands in groovy shell cd1aa72: 2013-06-12 Max Medvedev - IDEA-69673 Generate toString() template Groovy GString style should be added 5e1454a: 2013-06-12 Max Medvedev - generateToString: shorten class references not only for java files 2509702: 2013-06-12 Max Medvedev - don't manually replace toString() if it exists; generate the new one in the appropriate place instead 2e72f08: 2013-06-09 Max Medvedev - Groovy: smart complete type definition body c8ab923: 2013-06-09 Max Medvedev - Groovy: In-place introduce parameter: delegate 98ae7ed: 2013-09-04 Bas Leijdekkers - Fix all known "Field may be final" inspection problems 2 (IDEA-75321, IDEA-80439, IDEA-84561, IDEA-84614, IDEA-87373,IDEA-89711, IDEA-91969, IDEA-111396) 24184340: 2013-09-05 peter - update FixAllQuickfixTest test data, so that it identifies the quick fix unambiguously 082a0f9: 2013-09-05 Konstantin Bulenkov - make search everywhere available in current context 4eaae16: 2013-09-05 Konstantin Bulenkov - remove dead code dde304f: 2013-09-05 Konstantin Bulenkov - refactor to make autoSelectOnMouseMove available in ListUtil 150d337: 2013-09-05 Dmitry Trofimov - Merge remote-tracking branch 'origin/master' 1790f99: 2013-09-05 Dmitry Trofimov - Merge remote-tracking branch 'origin/master' 981c3f6: 2013-09-05 Sergey Evdokimov - Rename class 06eb88d: 2013-09-05 Sergey Evdokimov - Add test for inserting maven dependency by smart completion dc54349: 2013-09-05 Konstantin Kolosovsky - Merge branch 'svn1_8_new' a742e91: 2013-09-05 Dmitry Trofimov - Take correct setting for console background color (PY-10737). c55ba74: 2013-09-05 Nadya Zabrodina - ShellCommandLine changed to GeneralCommandline to provide shell variables to ide bb3ff5f: 2013-09-05 Sergey Evdokimov - IDEA-112939 Smart dependency completion for pom.xml d1daa65: 2013-09-05 Anna Kozlova - fix ranges 5ac8d00: 2013-09-05 Anna Kozlova - accept narrowing conversion from byte[] to T< extends Serializable> (IDEA-113225) 5e7db4f: 2013-09-05 Konstantin Kolosovsky - IDEA-112060 Notification added when working copy format and client version do not correspond to each other 804db7e: 2013-09-05 Konstantin Kolosovsky - IDEA-112060 Force validate executable if project is svn 1.8 working copy cdc6f6b: 2013-09-05 Konstantin Kolosovsky - IDEA-112071 Refresh svn working copies/statuses if "use command line" option or path to executable changed 613144f: 2013-09-05 Konstantin Kolosovsky - Make equal SvnConfigurable and SvnVcs display names (to "show settings" work correctly) 002eadb: 2013-09-05 Serega Vasiliev - javaee libs,project structure, etc. 559ab96: 2013-09-05 peter - no matter if there are other variables having that constant value, it's still constant bec4757: 2013-09-04 Mikhail Golubev - * Add error message when template variable used isn't defined * Template variables values are urlencoded during their substitution in URLs c01b85b: 2013-09-04 Mikhail Golubev - Add sprint.ly integration 68d131b: 2013-09-05 peter - use actual (maybe unsaved) psi text for find usages (EA-49575) b138d05: 2013-09-05 peter - rely less on mutable state in ChooseByNameBase.getNames (IDEA-112779) f0dc4b1: 2013-09-05 Anna Kozlova - optimization: skip external usages processing when scope already contains everything bfb94e0: 2013-09-05 Alexey Kudravtsev - renamed module editor-ui-impl to editor-ui-ex d711697: 2013-09-05 peter - really focus existing project frame when opening already opened project (related to IDEA-113158) 57d5690: 2013-09-05 Anna Kozlova - logging for EA-49553 - assert: SingleInspectionProfilePanel.copyUsedSeveritiesIfUndefined ed2cc9b: 2013-09-05 Anna Kozlova - logging for EA-49541 - assert: FileReference.rename 5a3cc7c: 2013-09-05 Roman Shevchenko - test framework: commit or dispose model 0735047: 2013-09-05 Anna Kozlova - scopes: escape dot as it is not a separator in file pattern (IDEA-113148) 6ae3bf7: 2013-09-05 Anna Kozlova - inference graph nodes: merge value/dependencies f02d237: 2013-09-05 Konstantin Bulenkov - fix test data 830b9c1: 2013-09-05 Konstantin Bulenkov - better english 400062d: 2013-09-05 Sergey Evdokimov - Make GrailsRunConfiguration singleton by default. 8caf8af: 2013-09-05 Vladimir Krivosheev - add javadoc 32394f0: 2013-09-05 Vladimir Krivosheev - WEB-7511 "Evaluate Expression" window does not build correct path to currently selected object node d59afd6: 2013-09-05 nik - xdebugger: removed duplicated 'Collecting data' text value node 32d3038: 2013-09-05 nik - unused class deleted 42255de: 2013-09-05 nik - xdebugger api streamlined: reworked the way node presentation is customized 36d908c: 2013-09-05 Sergey Evdokimov - IDEA-113188 Go to related files works incorrectly for Model and Controller in Groovy 55a5b28: 2013-09-05 Dmitry Avdeev - final methods in task api cd0f640: 2013-09-04 Dmitry Avdeev - running tests without ModuleTypeManager a41a8dc: 2013-09-05 Svetlana.Zemlyanskaya - Arrangement: make tokens aware of their type (author=Roman.Shein) 20bfe63: 2013-06-09 Max Medvedev - IDEA-71176 Encapsulate Java fields should update Groovy usages 30889b4: 2013-06-08 Max Medvedev - pluggable EncapsulateFields refactoring a3ed6bd: 2013-06-08 Max Medvedev - refactor EncapsulateFieldProcessor b7103d5: 2013-09-04 Max Medvedev - IDEA-113176 Groovy: place caret inside parentheses when compliting constructors b44e415: 2013-09-04 Vladimir Krivosheev - NotNull, StreamProvider.listSubFiles accept roaming type 89f6078: 2013-09-04 Vladimir Krivosheev - init WEB-7511 "Evaluate Expression" window does not build correct path to currently selected object node Now only hint show correct evaluated expression faaea11: 2013-09-04 Vladimir Krivosheev - remove deprecated method 98d4f5e: 2013-09-04 Vladimir Krivosheev - cleanup, remove deprecated method f4a27e8: 2013-09-04 peter - CachedValueProvider.Result: force non-empty list of not-null dependencies 19df6f4: 2013-09-04 Dmitry Trofimov - Merge remote-tracking branch 'origin/master' b12d474: 2013-09-04 Andrey Vlasovskikh - Merge branch 'python-fixes' 824377b: 2013-09-04 Andrey Vlasovskikh - Use new serializer for Python shadowing inspection 9bc2733: 2013-09-04 peter - single-pass control flow building 257d23a: 2013-09-04 peter - IDEA-112474 Expression might evaluate to null and not @Nullable annotated inspection is not aware of @Contract e586777: 2013-09-04 peter - a more descriptive DupInstruction.toString 9c9e366: 2013-09-04 peter - dfa: pop all the contract-unchecked arguments from stack (IDEA-112500) 6c2ead1: 2013-09-04 jgindin - Branch view in RepositoryTab 616f50f: 2013-09-04 Konstantin Kolosovsky - Merge branch 'svn1_8_new' 631a6ae: 2013-09-04 Konstantin Bulenkov - IDEA-113217 Check spelling and grammar in Community Bundles 45009eb: 2013-09-04 Konstantin Bulenkov - IDEA-113216 Darcula: Equal sign is too bright in properties files 711b2f5: 2013-09-04 Konstantin Kolosovsky - IDEA-94942 Force separate SVNKit client for each info request (to prevent multithreaded issues) 9ea7a68: 2013-09-04 Konstantin Bulenkov - IDEA-113215 GSP looks weird under Darcula 76f2e32: 2013-09-04 Konstantin Kolosovsky - IDEA-94942 Removed unused JavaHL code 3a8a697: 2013-09-04 Vladimir Krivosheev - fix possible NPE 1dd1635: 2013-09-04 Vladimir Krivosheev - We must not use variable if it is not yet set — we must set channel in "init" handler, but not in "connected" handler. Issue is actual under windows (I don't know why). 4860142: 2013-09-04 Mikhail Golubev - Change TaskBuilder constructor: repository field is mandatory ccb5502: 2013-09-04 Dmitry Trofimov - Merge remote-tracking branch 'origin/master' d43513f: 2013-09-03 Dmitry Trofimov - Variable view in Python Console. dd251c7: 2013-09-03 Dmitry Trofimov - Merge remote-tracking branch 'origin/master' dc83844: 2013-09-03 Dmitry Trofimov - Prevent CCE. Change-Id: I9ce8f336e5ab08b9a26d806a3faa8db7e0d9813f
Diffstat (limited to 'plugins/github')
-rw-r--r--plugins/github/src/META-INF/plugin.xml2
-rw-r--r--plugins/github/src/org/jetbrains/plugins/github/GithubCreateGistAction.java6
-rw-r--r--plugins/github/src/org/jetbrains/plugins/github/GithubCreatePullRequestAction.java267
-rw-r--r--plugins/github/src/org/jetbrains/plugins/github/GithubRebaseAction.java37
-rw-r--r--plugins/github/src/org/jetbrains/plugins/github/GithubShareAction.java35
-rw-r--r--plugins/github/src/org/jetbrains/plugins/github/api/GithubFullPath.java3
-rw-r--r--plugins/github/src/org/jetbrains/plugins/github/ui/GithubCreatePullRequestDialog.java12
-rw-r--r--plugins/github/src/org/jetbrains/plugins/github/ui/GithubSettingsPanel.java3
-rw-r--r--plugins/github/src/org/jetbrains/plugins/github/util/GithubProjectSettings.java57
-rw-r--r--plugins/github/src/org/jetbrains/plugins/github/util/GithubSettings.java10
-rw-r--r--plugins/github/src/org/jetbrains/plugins/github/util/GithubUtil.java40
-rw-r--r--plugins/github/test/org/jetbrains/plugins/github/GithubCreatePullRequestTest.java2
12 files changed, 222 insertions, 252 deletions
diff --git a/plugins/github/src/META-INF/plugin.xml b/plugins/github/src/META-INF/plugin.xml
index 86240aa4e428..c448f7bc6d08 100644
--- a/plugins/github/src/META-INF/plugin.xml
+++ b/plugins/github/src/META-INF/plugin.xml
@@ -13,6 +13,8 @@
<checkoutProvider implementation="org.jetbrains.plugins.github.extensions.GithubCheckoutProvider"/>
<applicationService serviceInterface="org.jetbrains.plugins.github.util.GithubSettings"
serviceImplementation="org.jetbrains.plugins.github.util.GithubSettings"/>
+ <projectService serviceInterface="org.jetbrains.plugins.github.util.GithubProjectSettings"
+ serviceImplementation="org.jetbrains.plugins.github.util.GithubProjectSettings"/>
<vcsAnnotationGutterActionProvider implementation="org.jetbrains.plugins.github.extensions.GithubAnnotationGutterActionProvider" />
<checkoutCompletedListener implementation="org.jetbrains.plugins.github.extensions.GithubCheckoutListener" order="after PlatformProjectCheckoutListener"/>
<vcsConfigurableProvider implementation="org.jetbrains.plugins.github.ui.GithubSettingsConfigurable"/>
diff --git a/plugins/github/src/org/jetbrains/plugins/github/GithubCreateGistAction.java b/plugins/github/src/org/jetbrains/plugins/github/GithubCreateGistAction.java
index 598330288cfd..c3ce3b90c6c7 100644
--- a/plugins/github/src/org/jetbrains/plugins/github/GithubCreateGistAction.java
+++ b/plugins/github/src/org/jetbrains/plugins/github/GithubCreateGistAction.java
@@ -29,7 +29,6 @@ import com.intellij.openapi.progress.Task;
import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Computable;
-import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vcs.changes.ChangeListManager;
import com.intellij.openapi.vfs.VirtualFile;
@@ -47,6 +46,7 @@ import org.jetbrains.plugins.github.util.GithubUtil;
import java.io.IOException;
import java.util.*;
+import java.util.concurrent.atomic.AtomicReference;
import static org.jetbrains.plugins.github.api.GithubGist.FileContent;
@@ -124,7 +124,7 @@ public class GithubCreateGistAction extends DumbAwareAction {
}
}
- final Ref<String> url = new Ref<String>();
+ final AtomicReference<String> url = new AtomicReference<String>();
final GithubAuthData finalAuth = auth;
new Task.Backgroundable(project, "Creating Gist...") {
@Override
@@ -136,7 +136,7 @@ public class GithubCreateGistAction extends DumbAwareAction {
@Override
public void onSuccess() {
- if (url.isNull()) {
+ if (url.get() == null) {
return;
}
if (dialog.isOpenInBrowser()) {
diff --git a/plugins/github/src/org/jetbrains/plugins/github/GithubCreatePullRequestAction.java b/plugins/github/src/org/jetbrains/plugins/github/GithubCreatePullRequestAction.java
index f282d0e92a28..2cf7cdddb392 100644
--- a/plugins/github/src/org/jetbrains/plugins/github/GithubCreatePullRequestAction.java
+++ b/plugins/github/src/org/jetbrains/plugins/github/GithubCreatePullRequestAction.java
@@ -26,7 +26,6 @@ import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.Pair;
-import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vcs.changes.Change;
@@ -37,16 +36,16 @@ import com.intellij.util.ThrowableConsumer;
import com.intellij.util.ThrowableConvertor;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.Convertor;
+import com.intellij.util.containers.HashMap;
import com.intellij.util.containers.HashSet;
import git4idea.DialogManager;
import git4idea.GitCommit;
import git4idea.GitLocalBranch;
import git4idea.GitRemoteBranch;
+import git4idea.branch.GitBranchUtil;
import git4idea.changes.GitChangeUtils;
import git4idea.commands.Git;
-import git4idea.commands.GitCommand;
import git4idea.commands.GitCommandResult;
-import git4idea.commands.GitSimpleHandler;
import git4idea.history.GitHistoryUtils;
import git4idea.repo.GitRemote;
import git4idea.repo.GitRepository;
@@ -66,10 +65,8 @@ import org.jetbrains.plugins.github.util.GithubUrlUtil;
import org.jetbrains.plugins.github.util.GithubUtil;
import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
+import java.util.concurrent.atomic.AtomicReference;
import static org.jetbrains.plugins.github.util.GithubUtil.setVisibleEnabled;
@@ -128,7 +125,7 @@ public class GithubCreatePullRequestAction extends DumbAwareAction {
}
repository.update();
- final Pair<GitRemote, String> remote = GithubUtil.findGithubRemote(repository);
+ Pair<GitRemote, String> remote = GithubUtil.findGithubRemote(repository);
if (remote == null) {
GithubNotifications.showError(project, CANNOT_CREATE_PULL_REQUEST, "Can't find GitHub remote");
return;
@@ -136,11 +133,7 @@ public class GithubCreatePullRequestAction extends DumbAwareAction {
final String remoteUrl = remote.getSecond();
final String remoteName = remote.getFirst().getName();
- String upstreamUrl = GithubUtil.findUpstreamRemote(repository);
- final GithubFullPath upstreamUserAndRepo =
- upstreamUrl == null || !GithubUrlUtil.isGithubUrl(upstreamUrl) ? null : GithubUrlUtil.getUserAndRepositoryFromRemoteUrl(upstreamUrl);
-
- final GithubFullPath userAndRepo = GithubUrlUtil.getUserAndRepositoryFromRemoteUrl(remoteUrl);
+ GithubFullPath userAndRepo = GithubUrlUtil.getUserAndRepositoryFromRemoteUrl(remoteUrl);
if (userAndRepo == null) {
GithubNotifications.showError(project, CANNOT_CREATE_PULL_REQUEST, "Can't process remote: " + remoteUrl);
return;
@@ -152,16 +145,23 @@ public class GithubCreatePullRequestAction extends DumbAwareAction {
return;
}
- final GithubInfo info = loadGithubInfoWithModal(project, userAndRepo, upstreamUserAndRepo);
+ String upstreamUrl = GithubUtil.findUpstreamRemote(repository);
+ GithubFullPath upstreamUserAndRepo =
+ upstreamUrl == null || !GithubUrlUtil.isGithubUrl(upstreamUrl) ? null : GithubUrlUtil.getUserAndRepositoryFromRemoteUrl(upstreamUrl);
+
+ final Map<String, String> forks = new HashMap<String, String>();
+ final Set<RemoteBranch> branches = new HashSet<RemoteBranch>();
+ addAvailableBranchesFromGit(repository, forks, branches);
+ GithubInfo info = loadGithubInfoAndBranchesWithModal(project, userAndRepo, upstreamUserAndRepo, forks, branches);
if (info == null) {
return;
}
- final Set<RemoteBranch> branches = getAvailableBranchesFromGit(repository);
- branches.addAll(info.getBranches());
- final BranchesInfo branchesInfo = new BranchesInfo(info.getRepo(), upstreamUserAndRepo, branches);
+ final GithubRepoDetailed repo = info.getRepo();
+ final GithubAuthData auth = info.getAuthData();
- GithubRepo parent = info.getRepo().getParent();
- String suggestedBranch = parent == null ? null : parent.getUserName() + ":" + parent.getDefaultBranch();
+ GithubRepo parent = repo.getParent();
+ String defaultBranch =
+ parent == null || parent.getDefaultBranch() == null ? null : parent.getUserName() + ":" + parent.getDefaultBranch();
Collection<String> suggestions = ContainerUtil.map(branches, new Function<RemoteBranch, String>() {
@Override
public String fun(RemoteBranch remoteBranch) {
@@ -171,10 +171,10 @@ public class GithubCreatePullRequestAction extends DumbAwareAction {
Consumer<String> showDiff = new Consumer<String>() {
@Override
public void consume(String ref) {
- showDiffByRef(project, ref, repository, currentBranch.getName(), info.getAuthData(), branchesInfo);
+ showDiffByRef(project, ref, repository, currentBranch.getName(), auth, forks, branches, repo.getSource());
}
};
- final GithubCreatePullRequestDialog dialog = new GithubCreatePullRequestDialog(project, suggestions, suggestedBranch, showDiff);
+ final GithubCreatePullRequestDialog dialog = new GithubCreatePullRequestDialog(project, suggestions, defaultBranch, showDiff);
DialogManager.show(dialog);
if (!dialog.isOK()) {
return;
@@ -191,11 +191,11 @@ public class GithubCreatePullRequestAction extends DumbAwareAction {
return;
}
- String from = info.getRepo().getUserName() + ":" + currentBranch.getName();
+ String from = repo.getUserName() + ":" + currentBranch.getName();
String onto = dialog.getTargetBranch();
- GithubAuthData auth = info.getAuthData();
+ String targetUser = onto.substring(0, onto.indexOf(':'));
- GithubFullPath targetRepo = findTargetRepository(project, auth, onto, branchesInfo);
+ GithubFullPath targetRepo = findRepositoryByUser(project, targetUser, forks, auth, repo.getSource());
if (targetRepo == null) {
GithubNotifications.showError(project, CANNOT_CREATE_PULL_REQUEST, "Can't find repository for specified branch: " + onto);
return;
@@ -216,15 +216,17 @@ public class GithubCreatePullRequestAction extends DumbAwareAction {
}
@Nullable
- private static GithubInfo loadGithubInfoWithModal(@NotNull final Project project,
- @NotNull final GithubFullPath userAndRepo,
- @Nullable final GithubFullPath upstreamUserAndRepo) {
+ private static GithubInfo loadGithubInfoAndBranchesWithModal(@NotNull final Project project,
+ @NotNull final GithubFullPath userAndRepo,
+ @Nullable final GithubFullPath upstreamUserAndRepo,
+ @NotNull final Map<String, String> forks,
+ @NotNull final Set<RemoteBranch> branches) {
try {
return GithubUtil
.computeValueInModal(project, "Access to GitHub", new ThrowableConvertor<ProgressIndicator, GithubInfo, IOException>() {
@Override
public GithubInfo convert(ProgressIndicator indicator) throws IOException {
- final Ref<GithubRepoDetailed> reposRef = new Ref<GithubRepoDetailed>();
+ final AtomicReference<GithubRepoDetailed> reposRef = new AtomicReference<GithubRepoDetailed>();
final GithubAuthData auth =
GithubUtil.runAndGetValidAuth(project, indicator, new ThrowableConsumer<GithubAuthData, IOException>() {
@Override
@@ -232,8 +234,8 @@ public class GithubCreatePullRequestAction extends DumbAwareAction {
reposRef.set(GithubApiUtil.getDetailedRepoInfo(authData, userAndRepo.getUser(), userAndRepo.getRepository()));
}
});
- List<RemoteBranch> branches = loadAvailableBranchesFromGithub(project, auth, reposRef.get(), upstreamUserAndRepo);
- return new GithubInfo(auth, reposRef.get(), branches);
+ addAvailableBranchesFromGithub(project, auth, reposRef.get(), upstreamUserAndRepo, forks, branches);
+ return new GithubInfo(auth, reposRef.get());
}
});
}
@@ -247,47 +249,33 @@ public class GithubCreatePullRequestAction extends DumbAwareAction {
}
@Nullable
- private static GithubFullPath findTargetRepository(@NotNull Project project,
+ private static GithubFullPath findRepositoryByUser(@NotNull Project project,
+ @NotNull String user,
+ @NotNull Map<String, String> forks,
@NotNull GithubAuthData auth,
- @NotNull String onto,
- @NotNull BranchesInfo branchesInfo) {
- String targetUser = onto.substring(0, onto.indexOf(':'));
- GithubRepoDetailed repo = branchesInfo.getRepo();
- GithubFullPath upstreamPath = branchesInfo.getUpstream();
- @Nullable GithubRepo parent = repo.getParent();
- @Nullable GithubRepo source = repo.getSource();
-
- for (RemoteBranch branch : branchesInfo.getBranches()) {
- if (StringUtil.equalsIgnoreCase(targetUser, branch.getUser()) && branch.getRepo() != null) {
- return new GithubFullPath(branch.getUser(), branch.getRepo());
+ @Nullable GithubRepo source) {
+ for (Map.Entry<String, String> entry : forks.entrySet()) {
+ if (StringUtil.equalsIgnoreCase(user, entry.getKey())) {
+ return new GithubFullPath(entry.getKey(), entry.getValue());
}
}
- if (isRepoOwner(targetUser, repo)) {
- return repo.getFullPath();
- }
- if (parent != null && isRepoOwner(targetUser, parent)) {
- return parent.getFullPath();
- }
- if (source != null && isRepoOwner(targetUser, source)) {
- return source.getFullPath();
- }
- if (upstreamPath != null && StringUtil.equalsIgnoreCase(targetUser, upstreamPath.getUser())) {
- return upstreamPath;
- }
if (source != null) {
try {
- GithubRepoDetailed target = GithubApiUtil.getDetailedRepoInfo(auth, targetUser, repo.getName());
- if (target.getSource() != null && StringUtil.equalsIgnoreCase(target.getSource().getUserName(), source.getUserName())) {
+ GithubRepoDetailed target = GithubApiUtil.getDetailedRepoInfo(auth, user, source.getName());
+ if (target.getSource() != null && StringUtil.equals(target.getSource().getUserName(), source.getUserName())) {
+ forks.put(target.getUserName(), target.getName());
return target.getFullPath();
}
}
catch (IOException ignore) {
+ // such repo may not exist
}
try {
- GithubRepo fork = GithubApiUtil.findForkByUser(auth, source.getUserName(), source.getName(), targetUser);
+ GithubRepo fork = GithubApiUtil.findForkByUser(auth, source.getUserName(), source.getName(), user);
if (fork != null) {
+ forks.put(fork.getUserName(), fork.getName());
return fork.getFullPath();
}
}
@@ -299,10 +287,6 @@ public class GithubCreatePullRequestAction extends DumbAwareAction {
return null;
}
- private static boolean isRepoOwner(@NotNull String user, @NotNull GithubRepo repo) {
- return StringUtil.equalsIgnoreCase(user, repo.getUserName());
- }
-
@Nullable
private static GithubPullRequest createPullRequest(@NotNull Project project,
@NotNull GithubAuthData auth,
@@ -320,51 +304,54 @@ public class GithubCreatePullRequestAction extends DumbAwareAction {
}
}
- @NotNull
- private static Set<RemoteBranch> getAvailableBranchesFromGit(@NotNull GitRepository gitRepository) {
- Set<RemoteBranch> result = new HashSet<RemoteBranch>();
+ private static void addAvailableBranchesFromGit(@NotNull GitRepository gitRepository,
+ @NotNull Map<String, String> forks,
+ @NotNull Set<RemoteBranch> branches) {
for (GitRemoteBranch remoteBranch : gitRepository.getBranches().getRemoteBranches()) {
for (String url : remoteBranch.getRemote().getUrls()) {
if (GithubUrlUtil.isGithubUrl(url)) {
GithubFullPath path = GithubUrlUtil.getUserAndRepositoryFromRemoteUrl(url);
if (path != null) {
- result.add(new RemoteBranch(path.getUser(), remoteBranch.getNameForRemoteOperations(), path.getRepository(), remoteBranch));
+ forks.put(path.getUser(), path.getRepository());
+ branches.add(new RemoteBranch(path.getUser(), remoteBranch.getNameForRemoteOperations(), remoteBranch));
break;
}
}
}
}
- return result;
}
- @NotNull
- private static List<RemoteBranch> loadAvailableBranchesFromGithub(@NotNull final Project project,
- @NotNull final GithubAuthData auth,
- @NotNull final GithubRepoDetailed repo,
- @Nullable final GithubFullPath upstreamPath) {
- List<RemoteBranch> result = new ArrayList<RemoteBranch>();
+ private static void addAvailableBranchesFromGithub(@NotNull final Project project,
+ @NotNull final GithubAuthData auth,
+ @NotNull final GithubRepoDetailed repo,
+ @Nullable final GithubFullPath upstreamPath,
+ @NotNull Map<String, String> forks,
+ @NotNull Set<RemoteBranch> branches) {
try {
final GithubRepo parent = repo.getParent();
final GithubRepo source = repo.getSource();
+ forks.put(repo.getUserName(), repo.getName());
+ branches.addAll(getBranches(auth, repo.getUserName(), repo.getName()));
+
if (parent != null) {
- result.addAll(getBranches(auth, parent.getUserName(), parent.getName()));
+ forks.put(parent.getUserName(), parent.getName());
+ branches.addAll(getBranches(auth, parent.getUserName(), parent.getName()));
}
- result.addAll(getBranches(auth, repo.getUserName(), repo.getName()));
-
if (source != null && !equals(source, parent)) {
- result.addAll(getBranches(auth, source.getUserName(), source.getName()));
+ forks.put(source.getUserName(), source.getName());
+ branches.addAll(getBranches(auth, source.getUserName(), source.getName()));
}
if (upstreamPath != null && !equals(upstreamPath, repo) && !equals(upstreamPath, parent) && !equals(upstreamPath, source)) {
- result.addAll(getBranches(auth, upstreamPath.getUser(), upstreamPath.getRepository()));
+ forks.put(upstreamPath.getUser(), upstreamPath.getRepository());
+ branches.addAll(getBranches(auth, upstreamPath.getUser(), upstreamPath.getRepository()));
}
}
catch (IOException e) {
GithubNotifications.showError(project, "Can't load available branches", e);
}
- return result;
}
@NotNull
@@ -374,7 +361,7 @@ public class GithubCreatePullRequestAction extends DumbAwareAction {
return ContainerUtil.map(branches, new Function<GithubBranch, RemoteBranch>() {
@Override
public RemoteBranch fun(GithubBranch branch) {
- return new RemoteBranch(user, branch.getName(), repo);
+ return new RemoteBranch(user, branch.getName());
}
});
}
@@ -398,7 +385,9 @@ public class GithubCreatePullRequestAction extends DumbAwareAction {
@NotNull final GitRepository gitRepository,
@NotNull final String currentBranch,
@NotNull final GithubAuthData auth,
- @NotNull final BranchesInfo branchesInfo) {
+ @NotNull final Map<String, String> forks,
+ @NotNull final Set<RemoteBranch> branches,
+ @Nullable final GithubRepo source) {
if (ref == null) {
return;
}
@@ -407,18 +396,18 @@ public class GithubCreatePullRequestAction extends DumbAwareAction {
@Override
@Nullable
public DiffInfo convert(ProgressIndicator indicator) {
+ List<String> list = StringUtil.split(ref, ":");
+ assert list.size() == 2 : ref;
+ final String user = list.get(0);
+ final String branch = list.get(1);
+
TargetBranchInfo targetBranchInfo;
- RemoteBranch remoteBranch = findRemoteBranch(branchesInfo.getBranches(), ref);
+ RemoteBranch remoteBranch = findRemoteBranch(branches, user, branch);
if (remoteBranch != null && remoteBranch.getRemoteBranch() != null) {
targetBranchInfo = getTargetBranchInfo(remoteBranch.getRemoteBranch());
}
else {
- List<String> list = StringUtil.split(ref, ":");
- assert list.size() == 2 : ref;
- final String user = list.get(0);
- final String branch = list.get(1);
-
- GithubFullPath forkPath = findTargetRepository(project, auth, ref, branchesInfo);
+ GithubFullPath forkPath = findRepositoryByUser(project, user, forks, auth, source);
if (forkPath == null) {
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
@@ -431,7 +420,7 @@ public class GithubCreatePullRequestAction extends DumbAwareAction {
targetBranchInfo = findRemote(branch, gitRepository, forkPath);
if (targetBranchInfo == null) {
- final Ref<Integer> responseRef = new Ref<Integer>();
+ final AtomicReference<Integer> responseRef = new AtomicReference<Integer>();
ApplicationManager.getApplication().invokeAndWait(new Runnable() {
@Override
public void run() {
@@ -449,13 +438,14 @@ public class GithubCreatePullRequestAction extends DumbAwareAction {
return null;
}
- GitFetchResult result = new GitFetcher(project, indicator, false).fetch(gitRepository.getRoot(), targetBranchInfo.getRemote());
+ GitFetchResult result = new GitFetcher(project, indicator, false)
+ .fetch(gitRepository.getRoot(), targetBranchInfo.getRemote(), targetBranchInfo.getBranchNameForRemoteOperations());
if (!result.isSuccess()) {
GitFetcher.displayFetchResult(project, result, null, result.getErrors());
return null;
}
- DiffInfo info = getDiffInfo(project, gitRepository, currentBranch, targetBranchInfo.getBranch());
+ DiffInfo info = getDiffInfo(project, gitRepository, currentBranch, targetBranchInfo.getBranchNameForLocalOperations());
if (info == null) {
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
@@ -477,7 +467,7 @@ public class GithubCreatePullRequestAction extends DumbAwareAction {
}
private static TargetBranchInfo getTargetBranchInfo(@NotNull GitRemoteBranch remoteBranch) {
- return new TargetBranchInfo(remoteBranch.getRemote().getName(), remoteBranch.getNameForLocalOperations());
+ return new TargetBranchInfo(remoteBranch.getRemote().getName(), remoteBranch.getNameForRemoteOperations());
}
@Nullable
@@ -486,7 +476,6 @@ public class GithubCreatePullRequestAction extends DumbAwareAction {
@NotNull GithubFullPath forkPath) {
for (GitRemote remote : gitRepository.getRemotes()) {
for (String url : remote.getUrls()) {
- //noinspection ConstantConditions
if (forkPath.equals(GithubUrlUtil.getUserAndRepositoryFromRemoteUrl(url))) {
return new TargetBranchInfo(remote.getName(), branch);
}
@@ -503,33 +492,19 @@ public class GithubCreatePullRequestAction extends DumbAwareAction {
@NotNull GithubFullPath forkPath) {
String url = GithubUrlUtil.getCloneUrl(forkPath);
- final GitSimpleHandler handler = new GitSimpleHandler(project, gitRepository.getRoot(), GitCommand.REMOTE);
- handler.setSilent(true);
-
- try {
- handler.addParameters("add", user, url);
- handler.run();
- if (handler.getExitCode() != 0) {
- GithubNotifications.showError(project, "Can't add remote", "Failed to add GitHub remote: '" + url + "'. " + handler.getStderr());
- return null;
- }
- // catch newly added remote
- gitRepository.update();
+ if (GithubUtil.addGithubRemote(project, gitRepository, user, url)) {
return new TargetBranchInfo(user, branch);
}
- catch (VcsException e) {
- GithubNotifications.showError(project, "Can't add remote", e);
+ else {
return null;
}
}
@Nullable
- private static RemoteBranch findRemoteBranch(@NotNull Set<RemoteBranch> branches, @NotNull String ref) {
- List<String> list = StringUtil.split(ref, ":");
- assert list.size() == 2 : ref;
- for (RemoteBranch branch : branches) {
- if (StringUtil.equalsIgnoreCase(list.get(0), branch.getUser()) && StringUtil.equals(list.get(1), branch.getBranch())) {
- return branch;
+ private static RemoteBranch findRemoteBranch(@NotNull Set<RemoteBranch> branches, @NotNull String user, @NotNull String branch) {
+ for (RemoteBranch remoteBranch : branches) {
+ if (StringUtil.equalsIgnoreCase(user, remoteBranch.getUser()) && StringUtil.equals(branch, remoteBranch.getBranch())) {
+ return remoteBranch;
}
}
@@ -559,21 +534,15 @@ public class GithubCreatePullRequestAction extends DumbAwareAction {
@NotNull final String myUser;
@NotNull final String myBranch;
- @Nullable final String myRepo;
@Nullable final GitRemoteBranch myRemoteBranch;
private RemoteBranch(@NotNull String user, @NotNull String branch) {
- this(user, branch, null, null);
- }
-
- private RemoteBranch(@NotNull String user, @NotNull String branch, @NotNull String repo) {
- this(user, branch, repo, null);
+ this(user, branch, null);
}
- public RemoteBranch(@NotNull String user, @NotNull String branch, @Nullable String repo, @Nullable GitRemoteBranch localBranch) {
+ public RemoteBranch(@NotNull String user, @NotNull String branch, @Nullable GitRemoteBranch localBranch) {
myUser = user;
myBranch = branch;
- myRepo = repo;
myRemoteBranch = localBranch;
}
@@ -593,11 +562,6 @@ public class GithubCreatePullRequestAction extends DumbAwareAction {
}
@Nullable
- public String getRepo() {
- return myRepo;
- }
-
- @Nullable
public GitRemoteBranch getRemoteBranch() {
return myRemoteBranch;
}
@@ -626,12 +590,10 @@ public class GithubCreatePullRequestAction extends DumbAwareAction {
private static class GithubInfo {
@NotNull private final GithubRepoDetailed myRepo;
@NotNull private final GithubAuthData myAuthData;
- @NotNull private final List<RemoteBranch> myBranches;
- private GithubInfo(@NotNull GithubAuthData authData, @NotNull GithubRepoDetailed repo, @NotNull List<RemoteBranch> branches) {
+ private GithubInfo(@NotNull GithubAuthData authData, @NotNull GithubRepoDetailed repo) {
myAuthData = authData;
myRepo = repo;
- myBranches = branches;
}
@NotNull
@@ -643,11 +605,6 @@ public class GithubCreatePullRequestAction extends DumbAwareAction {
public GithubAuthData getAuthData() {
return myAuthData;
}
-
- @NotNull
- public List<RemoteBranch> getBranches() {
- return myBranches;
- }
}
private static class DiffInfo {
@@ -677,40 +634,15 @@ public class GithubCreatePullRequestAction extends DumbAwareAction {
}
}
- private static class BranchesInfo {
- @NotNull private final GithubRepoDetailed myRepo;
- @Nullable private final GithubFullPath myUpstreamPath;
- @NotNull private final Set<RemoteBranch> myBranches;
-
- private BranchesInfo(@NotNull GithubRepoDetailed repo, @Nullable GithubFullPath upstreamPath, @NotNull Set<RemoteBranch> branches) {
- myBranches = branches;
- myUpstreamPath = upstreamPath;
- myRepo = repo;
- }
-
- @NotNull
- public GithubRepoDetailed getRepo() {
- return myRepo;
- }
-
- @Nullable
- public GithubFullPath getUpstream() {
- return myUpstreamPath;
- }
-
- @NotNull
- public Set<RemoteBranch> getBranches() {
- return myBranches;
- }
- }
-
private static class TargetBranchInfo {
@NotNull private final String myRemote;
- @NotNull private final String myBranch;
+ @NotNull private final String myName;
+ @NotNull private final String myNameAtRemote;
- private TargetBranchInfo(@NotNull String remote, @NotNull String branch) {
+ private TargetBranchInfo(@NotNull String remote, @NotNull String nameAtRemote) {
myRemote = remote;
- myBranch = branch;
+ myNameAtRemote = GitBranchUtil.stripRefsPrefix(nameAtRemote);
+ myName = myRemote + "/" + myNameAtRemote;
}
@NotNull
@@ -719,8 +651,13 @@ public class GithubCreatePullRequestAction extends DumbAwareAction {
}
@NotNull
- public String getBranch() {
- return myBranch;
+ public String getBranchNameForLocalOperations() {
+ return myName;
+ }
+
+ @NotNull
+ public String getBranchNameForRemoteOperations() {
+ return myNameAtRemote;
}
}
}
diff --git a/plugins/github/src/org/jetbrains/plugins/github/GithubRebaseAction.java b/plugins/github/src/org/jetbrains/plugins/github/GithubRebaseAction.java
index 1db546b1c0bd..e62aee3adca0 100644
--- a/plugins/github/src/org/jetbrains/plugins/github/GithubRebaseAction.java
+++ b/plugins/github/src/org/jetbrains/plugins/github/GithubRebaseAction.java
@@ -23,7 +23,6 @@ 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.vcs.VcsException;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.ThrowableConvertor;
import git4idea.GitPlatformFacade;
@@ -175,7 +174,12 @@ public class GithubRebaseAction extends DumbAwareAction {
LOG.info("Adding GitHub parent as a remote host");
indicator.setText("Adding GitHub parent as a remote host...");
- return addParentAsUpstreamRemote(project, root, parentRepoUrl, gitRepository);
+
+ if (GithubUtil.addGithubRemote(project, gitRepository, "upstream", parentRepoUrl)) {
+ return parentRepoUrl;
+ } else {
+ return null;
+ }
}
@Nullable
@@ -211,37 +215,10 @@ public class GithubRebaseAction extends DumbAwareAction {
}
}
- @Nullable
- private static String addParentAsUpstreamRemote(@NotNull Project project,
- @NotNull VirtualFile root,
- @NotNull String parentRepoUrl,
- @NotNull GitRepository gitRepository) {
- final GitSimpleHandler handler = new GitSimpleHandler(project, root, GitCommand.REMOTE);
- handler.setSilent(true);
-
- try {
- handler.addParameters("add", "upstream", parentRepoUrl);
- handler.run();
- if (handler.getExitCode() != 0) {
- GithubNotifications
- .showError(project, CANNOT_PERFORM_GITHUB_REBASE, "Failed to add GitHub remote: '" + parentRepoUrl + "'. " + handler.getStderr());
- return null;
- }
- // catch newly added remote
- gitRepository.update();
-
- return parentRepoUrl;
- }
- catch (VcsException e) {
- GithubNotifications.showError(project, CANNOT_PERFORM_GITHUB_REBASE, e);
- return null;
- }
- }
-
private static boolean fetchParent(@NotNull final Project project,
@NotNull final GitRepository repository,
@NotNull final ProgressIndicator indicator) {
- GitFetchResult result = new GitFetcher(project, indicator, false).fetch(repository.getRoot(), "upstream");
+ GitFetchResult result = new GitFetcher(project, indicator, false).fetch(repository.getRoot(), "upstream", null);
if (!result.isSuccess()) {
GitFetcher.displayFetchResult(project, result, null, result.getErrors());
return false;
diff --git a/plugins/github/src/org/jetbrains/plugins/github/GithubShareAction.java b/plugins/github/src/org/jetbrains/plugins/github/GithubShareAction.java
index 5aa1934dc209..5efa2682e695 100644
--- a/plugins/github/src/org/jetbrains/plugins/github/GithubShareAction.java
+++ b/plugins/github/src/org/jetbrains/plugins/github/GithubShareAction.java
@@ -24,7 +24,6 @@ import com.intellij.openapi.progress.Task;
import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Splitter;
-import com.intellij.openapi.util.Ref;
import com.intellij.openapi.vcs.VcsDataKeys;
import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vcs.changes.ChangeListManager;
@@ -61,6 +60,7 @@ import org.jetbrains.plugins.github.util.GithubUtil;
import javax.swing.*;
import java.io.IOException;
import java.util.*;
+import java.util.concurrent.atomic.AtomicReference;
import static org.jetbrains.plugins.github.util.GithubUtil.setVisibleEnabled;
@@ -167,6 +167,10 @@ public class GithubShareAction extends DumbAwareAction {
GitRepositoryManager repositoryManager = GitUtil.getRepositoryManager(project);
final GitRepository repository = repositoryManager.getRepositoryForRoot(root);
LOG.assertTrue(repository != null, "GitRepository is null for root " + root);
+ if (repository == null) {
+ GithubNotifications.showError(project, "Failed to create GitHub Repository", "Can't find Git repository");
+ return;
+ }
final String remoteUrl = GithubUrlUtil.getGitHost() + "/" + githubInfo.getUser().getLogin() + "/" + name + ".git";
final String remoteName = finalExternalRemoteDetected ? "github" : "origin";
@@ -174,7 +178,7 @@ public class GithubShareAction extends DumbAwareAction {
//git remote add origin git@github.com:login/name.git
LOG.info("Adding GitHub as a remote host");
indicator.setText("Adding GitHub as a remote host...");
- if (!addGithubRemote(project, root, remoteName, remoteUrl, repository)) {
+ if (!GithubUtil.addGithubRemote(project, repository, remoteName, remoteUrl)) {
return;
}
@@ -203,7 +207,7 @@ public class GithubShareAction extends DumbAwareAction {
@Override
public GithubInfo convert(ProgressIndicator indicator) throws IOException {
// get existing github repos (network) and validate auth data
- final Ref<List<GithubRepo>> availableReposRef = new Ref<List<GithubRepo>>();
+ final AtomicReference<List<GithubRepo>> availableReposRef = new AtomicReference<List<GithubRepo>>();
final GithubAuthData auth =
GithubUtil.runAndGetValidAuth(project, indicator, new ThrowableConsumer<GithubAuthData, IOException>() {
@Override
@@ -262,29 +266,6 @@ public class GithubShareAction extends DumbAwareAction {
return true;
}
- private static boolean addGithubRemote(@NotNull Project project,
- @NotNull VirtualFile root,
- @NotNull String remoteName,
- @NotNull String remoteUrl,
- @NotNull GitRepository repository) {
- final GitSimpleHandler addRemoteHandler = new GitSimpleHandler(project, root, GitCommand.REMOTE);
- addRemoteHandler.setSilent(true);
- addRemoteHandler.addParameters("add", remoteName, remoteUrl);
- try {
- addRemoteHandler.run();
- repository.update();
- if (addRemoteHandler.getExitCode() != 0) {
- GithubNotifications.showError(project, "Failed to add GitHub repository as remote", "Failed to add GitHub repository as remote");
- return false;
- }
- }
- catch (VcsException e) {
- GithubNotifications.showError(project, "Failed to add GitHub repository as remote", e);
- return false;
- }
- return true;
- }
-
private static boolean performFirstCommitIfRequired(@NotNull final Project project,
@NotNull VirtualFile root,
@NotNull GitRepository repository,
@@ -308,7 +289,7 @@ public class GithubShareAction extends DumbAwareAction {
allFiles.addAll(trackedFiles);
allFiles.addAll(untrackedFiles);
- final Ref<GithubUntrackedFilesDialog> dialogRef = new Ref<GithubUntrackedFilesDialog>();
+ final AtomicReference<GithubUntrackedFilesDialog> dialogRef = new AtomicReference<GithubUntrackedFilesDialog>();
ApplicationManager.getApplication().invokeAndWait(new Runnable() {
@Override
public void run() {
diff --git a/plugins/github/src/org/jetbrains/plugins/github/api/GithubFullPath.java b/plugins/github/src/org/jetbrains/plugins/github/api/GithubFullPath.java
index 7488c175a0ff..c2c7c7f63d86 100644
--- a/plugins/github/src/org/jetbrains/plugins/github/api/GithubFullPath.java
+++ b/plugins/github/src/org/jetbrains/plugins/github/api/GithubFullPath.java
@@ -16,6 +16,7 @@
package org.jetbrains.plugins.github.api;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
/**
* @author Aleksey Pivovarov
@@ -45,7 +46,7 @@ public class GithubFullPath {
}
@Override
- public boolean equals(Object o) {
+ public boolean equals(@Nullable Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
diff --git a/plugins/github/src/org/jetbrains/plugins/github/ui/GithubCreatePullRequestDialog.java b/plugins/github/src/org/jetbrains/plugins/github/ui/GithubCreatePullRequestDialog.java
index 528437e0dde2..e0c648e16568 100644
--- a/plugins/github/src/org/jetbrains/plugins/github/ui/GithubCreatePullRequestDialog.java
+++ b/plugins/github/src/org/jetbrains/plugins/github/ui/GithubCreatePullRequestDialog.java
@@ -23,7 +23,7 @@ import com.intellij.util.Consumer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.TestOnly;
-import org.jetbrains.plugins.github.util.GithubSettings;
+import org.jetbrains.plugins.github.util.GithubProjectSettings;
import javax.swing.*;
import java.util.Collection;
@@ -33,8 +33,9 @@ import java.util.regex.Pattern;
* @author Aleksey Pivovarov
*/
public class GithubCreatePullRequestDialog extends DialogWrapper {
- private final GithubCreatePullRequestPanel myGithubCreatePullRequestPanel;
- private static final Pattern GITHUB_REPO_PATTERN = Pattern.compile("[a-zA-Z0-9_.-]+:[a-zA-Z0-9_.-]+");
+ @NotNull private final GithubCreatePullRequestPanel myGithubCreatePullRequestPanel;
+ @NotNull private static final Pattern GITHUB_REPO_PATTERN = Pattern.compile("[a-zA-Z0-9_.-]+:[a-zA-Z0-9_.-]+");
+ @NotNull private final Project myProject;
public GithubCreatePullRequestDialog(@NotNull final Project project,
@NotNull Collection<String> branches,
@@ -45,7 +46,8 @@ public class GithubCreatePullRequestDialog extends DialogWrapper {
myGithubCreatePullRequestPanel.setBranches(branches);
- String configBranch = GithubSettings.getInstance().getCreatePullRequestDefaultBranch();
+ myProject = project;
+ String configBranch = GithubProjectSettings.getInstance(myProject).getCreatePullRequestDefaultBranch();
myGithubCreatePullRequestPanel.setSelectedBranch(configBranch != null ? configBranch : suggestedBranch);
setTitle("Create Pull Request");
@@ -92,7 +94,7 @@ public class GithubCreatePullRequestDialog extends DialogWrapper {
@Override
protected void doOKAction() {
super.doOKAction();
- GithubSettings.getInstance().setCreatePullRequestDefaultBranch(getTargetBranch());
+ GithubProjectSettings.getInstance(myProject).setCreatePullRequestDefaultBranch(getTargetBranch());
}
@Nullable
diff --git a/plugins/github/src/org/jetbrains/plugins/github/ui/GithubSettingsPanel.java b/plugins/github/src/org/jetbrains/plugins/github/ui/GithubSettingsPanel.java
index 26cbbf6f539a..f07512db669b 100644
--- a/plugins/github/src/org/jetbrains/plugins/github/ui/GithubSettingsPanel.java
+++ b/plugins/github/src/org/jetbrains/plugins/github/ui/GithubSettingsPanel.java
@@ -33,7 +33,6 @@ import org.jetbrains.plugins.github.util.GithubUtil;
import org.jetbrains.plugins.github.api.GithubUser;
import javax.swing.*;
-import javax.swing.border.EmptyBorder;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.event.HyperlinkEvent;
@@ -80,7 +79,7 @@ public class GithubSettingsPanel {
mySignupTextField.setText("<html>Do not have an account at github.com? <a href=\"https://github.com\">" + "Sign up" + "</a></html>");
mySignupTextField.setBackground(myPane.getBackground());
mySignupTextField.setCursor(new Cursor(Cursor.HAND_CURSOR));
- myAuthTypeLabel.setBorder(new EmptyBorder(0, 10, 0, 0));
+ myAuthTypeLabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0));
myAuthTypeComboBox.addItem(AUTH_PASSWORD);
myAuthTypeComboBox.addItem(AUTH_TOKEN);
diff --git a/plugins/github/src/org/jetbrains/plugins/github/util/GithubProjectSettings.java b/plugins/github/src/org/jetbrains/plugins/github/util/GithubProjectSettings.java
new file mode 100644
index 000000000000..716da7479ff8
--- /dev/null
+++ b/plugins/github/src/org/jetbrains/plugins/github/util/GithubProjectSettings.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2000-2013 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jetbrains.plugins.github.util;
+
+import com.intellij.openapi.components.*;
+import com.intellij.openapi.project.Project;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * @author Aleksey Pivovarov
+ */
+@State(
+ name = "GithubProjectSettings",
+ storages = {@Storage(
+ file = StoragePathMacros.WORKSPACE_FILE )})
+public class GithubProjectSettings implements PersistentStateComponent<GithubProjectSettings.State> {
+ private State myState = new State();
+
+ public State getState() {
+ return myState;
+ }
+
+ public void loadState(State state) {
+ myState = state;
+ }
+
+ public static class State {
+ @Nullable public String CREATE_PULL_REQUEST_DEFAULT_BRANCH = null;
+ }
+
+ @Nullable
+ public String getCreatePullRequestDefaultBranch() {
+ return myState.CREATE_PULL_REQUEST_DEFAULT_BRANCH;
+ }
+
+ public void setCreatePullRequestDefaultBranch(@NotNull String branch) {
+ myState.CREATE_PULL_REQUEST_DEFAULT_BRANCH = branch;
+ }
+
+ public static GithubProjectSettings getInstance(@NotNull Project project) {
+ return ServiceManager.getService(project, GithubProjectSettings.class);
+ }
+}
diff --git a/plugins/github/src/org/jetbrains/plugins/github/util/GithubSettings.java b/plugins/github/src/org/jetbrains/plugins/github/util/GithubSettings.java
index 4afb2a9672bd..9a3fc6a4b3aa 100644
--- a/plugins/github/src/org/jetbrains/plugins/github/util/GithubSettings.java
+++ b/plugins/github/src/org/jetbrains/plugins/github/util/GithubSettings.java
@@ -62,7 +62,6 @@ public class GithubSettings implements PersistentStateComponent<GithubSettings.S
public boolean PRIVATE_GIST = true;
public boolean SAVE_PASSWORD = true;
@NotNull public Collection<String> TRUSTED_HOSTS = new ArrayList<String>();
- @Nullable public String CREATE_PULL_REQUEST_DEFAULT_BRANCH = null;
}
public static GithubSettings getInstance() {
@@ -121,11 +120,6 @@ public class GithubSettings implements PersistentStateComponent<GithubSettings.S
return passwordSafe.getSettings().getProviderType() == PasswordSafeSettings.ProviderType.MASTER_PASSWORD;
}
- @Nullable
- public String getCreatePullRequestDefaultBranch() {
- return myState.CREATE_PULL_REQUEST_DEFAULT_BRANCH;
- }
-
public void setAnonymousGist(final boolean anonymousGist) {
myState.ANONYMOUS_GIST = anonymousGist;
}
@@ -142,10 +136,6 @@ public class GithubSettings implements PersistentStateComponent<GithubSettings.S
myState.OPEN_IN_BROWSER_GIST = openInBrowserGist;
}
- public void setCreatePullRequestDefaultBranch(@NotNull String branch) {
- myState.CREATE_PULL_REQUEST_DEFAULT_BRANCH = branch;
- }
-
@NotNull
public Collection<String> getTrustedHosts() {
return myState.TRUSTED_HOSTS;
diff --git a/plugins/github/src/org/jetbrains/plugins/github/util/GithubUtil.java b/plugins/github/src/org/jetbrains/plugins/github/util/GithubUtil.java
index c6f13675e562..c0373c64c105 100644
--- a/plugins/github/src/org/jetbrains/plugins/github/util/GithubUtil.java
+++ b/plugins/github/src/org/jetbrains/plugins/github/util/GithubUtil.java
@@ -23,14 +23,15 @@ import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.progress.Task;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Pair;
-import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.ThrowableConsumer;
import com.intellij.util.ThrowableConvertor;
-import com.intellij.util.ThrowableRunnable;
import com.intellij.util.containers.Convertor;
import git4idea.GitUtil;
+import git4idea.commands.GitCommand;
+import git4idea.commands.GitSimpleHandler;
import git4idea.config.GitVcsApplicationSettings;
import git4idea.config.GitVersion;
import git4idea.i18n.GitBundle;
@@ -49,6 +50,7 @@ import org.jetbrains.plugins.github.util.*;
import java.io.IOException;
import java.util.List;
+import java.util.concurrent.atomic.AtomicReference;
/**
* Various utility methods for the GutHub plugin.
@@ -140,7 +142,7 @@ public class GithubUtil {
private static boolean checkSSLCertificate(IOException e, final String host, ProgressIndicator indicator) {
final GithubSslSupport sslSupport = GithubSslSupport.getInstance();
if (GithubSslSupport.isCertificateException(e)) {
- final Ref<Boolean> result = new Ref<Boolean>();
+ final AtomicReference<Boolean> result = new AtomicReference<Boolean>();
ApplicationManager.getApplication().invokeAndWait(new Runnable() {
@Override
public void run() {
@@ -241,8 +243,8 @@ public class GithubUtil {
public static <T, E extends Throwable> T computeValueInModal(@NotNull Project project,
@NotNull String caption,
@NotNull final ThrowableConvertor<ProgressIndicator, T, E> task) throws E {
- final Ref<T> dataRef = new Ref<T>();
- final Ref<E> exceptionRef = new Ref<E>();
+ final AtomicReference<T> dataRef = new AtomicReference<T>();
+ final AtomicReference<E> exceptionRef = new AtomicReference<E>();
ProgressManager.getInstance().run(new Task.Modal(project, caption, true) {
public void run(@NotNull ProgressIndicator indicator) {
try {
@@ -260,7 +262,7 @@ public class GithubUtil {
}
}
});
- if (!exceptionRef.isNull()) {
+ if (exceptionRef.get() != null) {
throw exceptionRef.get();
}
return dataRef.get();
@@ -269,7 +271,7 @@ public class GithubUtil {
public static <T> T computeValueInModal(@NotNull Project project,
@NotNull String caption,
@NotNull final Convertor<ProgressIndicator, T> task) {
- final Ref<T> dataRef = new Ref<T>();
+ final AtomicReference<T> dataRef = new AtomicReference<T>();
ProgressManager.getInstance().run(new Task.Modal(project, caption, true) {
public void run(@NotNull ProgressIndicator indicator) {
dataRef.set(task.convert(indicator));
@@ -379,4 +381,28 @@ public class GithubUtil {
}
return manager.getRepositoryForFile(project.getBaseDir());
}
+
+ public static boolean addGithubRemote(@NotNull Project project,
+ @NotNull GitRepository repository,
+ @NotNull String remote,
+ @NotNull String url) {
+ final GitSimpleHandler handler = new GitSimpleHandler(project, repository.getRoot(), GitCommand.REMOTE);
+ handler.setSilent(true);
+
+ try {
+ handler.addParameters("add", remote, url);
+ handler.run();
+ if (handler.getExitCode() != 0) {
+ GithubNotifications.showError(project, "Can't add remote", "Failed to add GitHub remote: '" + url + "'. " + handler.getStderr());
+ return false;
+ }
+ // catch newly added remote
+ repository.update();
+ return true;
+ }
+ catch (VcsException e) {
+ GithubNotifications.showError(project, "Can't add remote", e);
+ return false;
+ }
+ }
}
diff --git a/plugins/github/test/org/jetbrains/plugins/github/GithubCreatePullRequestTest.java b/plugins/github/test/org/jetbrains/plugins/github/GithubCreatePullRequestTest.java
index f8c9087f23bd..e5659d8e109f 100644
--- a/plugins/github/test/org/jetbrains/plugins/github/GithubCreatePullRequestTest.java
+++ b/plugins/github/test/org/jetbrains/plugins/github/GithubCreatePullRequestTest.java
@@ -17,8 +17,6 @@ package org.jetbrains.plugins.github;
import com.intellij.notification.NotificationType;
-import static com.intellij.dvcs.test.Executor.cd;
-
/**
* @author Aleksey Pivovarov
*/