I love IntelliJ diff tool, is it possible to launch from command line?

Is it possible to launch the diff tool through command line?  I'm wondering because I would love to use it as an external diff/mergetool for example from Mercurial, etc.  

Also, I often need to compare directories.  I've seen there's an IntelliJ to compare directories, but usually the directories I need to compare are not within an IntelliJ project, so I'm not sure this plugin would work.  It would be great if some of these tools were available outside IntelliJ via a shell extension, from the explorer!

0
15 comments

Hello Otto,

Is it possible to launch the diff tool through command line?  I'm
wondering because I would love to use it as an external diff/mergetool
for example from Mercurial, etc.


idea.exe diff

(or idea.sh diff)

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


1

I got an error saying "cannot find file diff"

0

When you have intellij open, and start idea.exe diff you will get an error. When I close intellij and start the command, it starts idea.exe then exit right away.

0

Hello Otto,

Running "idea.exe diff" when an IntelliJ IDEA instance is already running
will be supported in version 10.5.

I got an error saying "cannot find file diff"


--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0

so we cannot run diff separately before 10.5, with intellij running or not, right?

0

Thanks for the info.  I look forward to the IntelliJ 1.5 EAP :)

0

Hello ying,

You can run diff when IntelliJ IDEA is not running. The only thing to note
is that the current directory must be the bin directory under the IDEA installation,
not the directory with the files being diffed.

so we cannot run diff separately before 10.5, with intellij running or
not, right?


--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0

tried with ver 10.0.2, same result. Intellij starts then dies. Log as below:

2011-04-12 08:00:36,112 [      0]   INFO -        #com.intellij.idea.Main - ------------------------------------------------------ IDEA STARTED ------------------------------------------------------
2011-04-12 08:00:36,832 [    720]   INFO -        #com.intellij.idea.Main - Using "FocusKiller" library to prevent focus stealing.
2011-04-12 08:00:47,530 [  11418]   INFO - j.ide.plugins.PluginDescriptor - Cannot find plugin CFML Support resource-bundle: messages.CfmlBundlemessages.CfmlBundle
2011-04-12 08:00:48,445 [  12333]   INFO - llij.ide.plugins.PluginManager - Loaded plugins:IDEA CORE, QAPlug (1.2.6), QAPlug - Hammurapi (1.2.3), QAPlug - Checkstyle (1.2.3), QAPlug - FindBugs (1.2.4), QAPlug - PMD (1.2.5), SpellChecker (1.0), Properties Support, CSS Support, JavaScript Support (1.0), Java Server Pages Integration (1.0), I18n for Java, UML Support (1.0), Database Support (1.0), Persistence Frameworks Support (1.0), Java EE Integration (1.0), Ant Support (1.0), IntelliLang (8.0), Groovy (9.0), Spring-AOP and AspectJ support (1.0), Spring Support (1.0), JUnit (1.0), TestNG-J (8.0), Coverage, Maven Integration, Scala (0.4.589), AspectJ Support (1.0), Commander (1.0.0), Spring OSGi (1.0), Eclipse Integration (3.0), Flex Support (1.0), Task Management (1.0), hg4idea (10.0), HTML Tools (2.0), Inspection Gadgets (1.0), Intention Power Pack (1.0), JavaScript Debugger (1.0), Inspection-JS (2.0), JavaScript Intention Power Pack (0.9.4), JSR45 Integration (1.0), LESS support, Maven Integration Extension, QuirksMode, Refactor-X (2.01), RELAX-NG Support (1.6), SASS support, Spring Security (1.0), Structural Search (9.0), Velocity support (1.0), Subversion Integration (1.0), GenerateToString (5.0), Type Migration, UI Designer, W3C Validators (2.0), WebServicesPlugin (0.9 build 5)
2011-04-12 08:00:48,445 [  12333]   INFO - llij.ide.plugins.PluginManager - Disabled plugins: Copyright (8.1), JSF Support (1.1.1.), XPathView + XSLT Support (3.1-Diana), Struts 1.x (2.0), Android Support (10.0), ASP (0.1), Bean Validation Support (1.0), CDI Support (1.0), SQL support (1.0), CFML Support (3.53), ClearCase Integration (2.0), CVS Integration (0.1), Plugin DevKit (1.0), DSM Analysis (1.0.0), Emma, FreeMarker support (1.0), Geronimo Integration (1.0), Git Integration (8.1), GitHub, Glassfish Integration (1.0), GWT Support (1.0), Google App Engine Integration (1.1.4), Grails/Griffon (9.0), GuiceyIDEA (8.0), Hibernate Support (1.0), IDEtalk (1.0), J2ME (1.0), JBoss Integration (1.0), Osmorc (1.3.4), Perforce Integration (2.0), Remote Hosts Access (0.1), PHP (2), Resin Integration (8.1), Seam Support (1.0), Seam Pages Support (1.0), Seam Pageflow Support (1.0), Spring Web Flow (1.0), Spring Web Services (1.0), Struts 2 (1.0), Tapestry support (1.0), TFS Integration (1.08.1), Tomcat Integration (1.0), Visual SourceSafe Integration (2.0), WebLogic Integration (1.0), WebSphere Integration (1.0), YAML, ZKM-Unscramble (1.0)
2011-04-12 08:00:48,537 [  12425]   INFO -        #com.intellij.idea.Main - ------------------------------------------------------ IDEA SHUTDOWN ------------------------------------------------------

0

I have mixed success on lates 10.5 EAP, my settigns with git mergetool are:

[mergetool "idea"]
        cmd = /home/USER/ideax/bin/idea.sh diff $PWD/$LOCAL $PWD/$REMOTE
        trustExitCode = false




Now, this works fine when Intellij is not running. When Intellij is already running, it throws error

"Error showing diff: Cannot file file: /home/USER/testing_merge/./test.txt.LOCAL.13445.txt

Above,  *Cannot file* should probably be "Cannot find".
There is some "racing" condition, at the moment idea diff is opened, files doesn't exist yet...
0

Hello,

Please try the next EAP - this should work better there.

I have mixed success on lates 10.5 EAP, my settigns with git mergetool
are:

[mergetool "idea"]
cmd = /home/USER/ideax/bin/idea.sh diff $PWD/$LOCAL
$PWD/$REMOTE
trustExitCode = false
Now, this works fine when Intellij is not running. When Intellij is
already running, it throws error

"Error showing diff: Cannot file file:
/home/USER/testing_merge/./test.txt.LOCAL.13445.txt

Above,  Cannot file should probably be "Cannot find". There is some
"racing" condition, at the moment idea diff is opened, files doesn't
exist yet...


--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0

Hi Dimitry,
it works better now, however, there is no way to save your changes. Or  there is, but I still didn't figure out how ;-) (there is no save button & Ctrl+S doesn't do anything, at least not at Linux)

0

Hi Dmitry,

I always get an IllegalArgumentException for a @NotNull constraint when opening the editor in diff mode. Any idea?


java.lang.IllegalArgumentException: Argument 0 for @NotNull parameter of com/intellij/openapi/fileEditor/impl/FileEditorProviderManagerImpl.getProviders must not be null
        at com.intellij.openapi.fileEditor.impl.FileEditorProviderManagerImpl.getProviders(FileEditorProviderManagerImpl.java)
        at com.intellij.openapi.diff.impl.highlighting.EditorPlaceHolder.setContent(EditorPlaceHolder.java:73)
        at com.intellij.openapi.diff.impl.highlighting.DiffPanelState$1.run(DiffPanelState.java:38)
        at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:840)
        at com.intellij.openapi.diff.impl.highlighting.DiffPanelState.setContents(DiffPanelState.java:36)
        at com.intellij.openapi.diff.impl.DiffPanelImpl.setContents(DiffPanelImpl.java:137)
        at com.intellij.openapi.diff.impl.DiffPanelImpl.setDiffRequest(DiffPanelImpl.java:345)
        at com.intellij.openapi.diff.impl.external.DiffManagerImpl.createDiffPanel(DiffManagerImpl.java:159)
        at com.intellij.openapi.diff.impl.external.FrameDiffTool.a(FrameDiffTool.java:84)
        at com.intellij.openapi.diff.impl.external.FrameDiffTool.show(FrameDiffTool.java:48)
        at com.intellij.openapi.diff.DiffApplication.processDiffCommand(DiffApplication.java:86)
        at com.intellij.openapi.diff.DiffApplication.main(DiffApplication.java:49)
        at com.intellij.idea.IdeaApplication.run(IdeaApplication.java:110)
        at com.intellij.idea.MainImpl$3.run(MainImpl.java:156)


EDIT:
Ok, found out, that this happens, if I try to open files without a file extension.

0

On Win i also have no any confirmation form idea, but right side editor modifications are saved properly on exit. Ctrl+S doesn't work. it's a little bit dangerous feature. Left side edtitor isn't editable for me. Build 107.18

0

Hello Timo,

Please file a YouTrack issue, and we'll investigate this in more detail.

I always get an IllegalArgumentException for a @NotNull constraint
when opening the editor in diff mode. Any idea?

java.lang.IllegalArgumentException: Argument 0 for
> @NotNull parameter of
> com/intellij/openapi/fileEditor/impl/FileEditorProviderManagerImpl.get
> Providers must not be null
> at
> com.intellij.openapi.fileEditor.impl.FileEditorProviderManagerImpl.get
> Providers(FileEditorProviderManagerImpl.java)
> at
> com.intellij.openapi.diff.impl.highlighting.EditorPlaceHolder.setConte
> nt(EditorPlaceHolder.java:73)
> at
> com.intellij.openapi.diff.impl.highlighting.DiffPanelState$1.run(DiffP
> anelState.java:38)
> at
> com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(A
> pplicationImpl.java:840)
> at
> com.intellij.openapi.diff.impl.highlighting.DiffPanelState.setContents
> (DiffPanelState.java:36)
> at
> com.intellij.openapi.diff.impl.DiffPanelImpl.setContents(DiffPanelImpl
> .java:137)
> at
> com.intellij.openapi.diff.impl.DiffPanelImpl.setDiffRequest(DiffPanelI
> mpl.java:345)
> at
> com.intellij.openapi.diff.impl.external.DiffManagerImpl.createDiffPane
> l(DiffManagerImpl.java:159)
> at
> com.intellij.openapi.diff.impl.external.FrameDiffTool.a(FrameDiffTool.
> java:84)
> at
> com.intellij.openapi.diff.impl.external.FrameDiffTool.show(FrameDiffTo
> ol.java:48)
> at
> com.intellij.openapi.diff.DiffApplication.processDiffCommand(DiffAppli
> cation.java:86)
> at
> com.intellij.openapi.diff.DiffApplication.main(DiffApplication.java:49
> )
> at
> com.intellij.idea.IdeaApplication.run(IdeaApplication.java:110)
> at com.intellij.idea.MainImpl$3.run(MainImpl.java:156)
>

---
Original message URL:
http://devnet.jetbrains.net/message/5302333#5302333


--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0

Could we have a toolbar button/menu item in Idea to execute the diff for external files/folders?

0

Please sign in to leave a comment.