Why to synchronize with SVN in Eclipse?

Today we had an interesting experience with SVN. I always thought SVN Update and Commit is safe way how to do stuff, that you have to either hit conflict or everything is merged without any losses. After so many years with SVN I was proved wrong. We create incremental diff files for our SQL model – and today both me and my colleague created the file with the same name. He committed first. I updated. I didn’t check that file (it was just one of many). I committed. And he complained I had overwritten his changes.

How could that happen? Why team synchronization in Eclipse helps? Why update didn’t complain in the first place?! Is SVN to blame? Why it never happened to me in Idea? Actually could it? Have I ever committed the same files created the same day along with my team-mate before? If not, can it happen in Idea too? (It doesn’t have the synchronization as you know it from Eclipse, remember.)

First test with Eclipse – we did it again. Synchronization warns you about conflicting incoming changes. But you can update without any punishment from SVN itself. You have to check the file. When you create a file in Eclipse it is not added locally to the repository (actually, many of Eclipse users don’t know SVN basics “thanks” to this). After the update it becomes locally added and you can clearly see the changes in quick diff – or in outgoing changes – IF you diff them that is. Why would you care when there is no warning, right? Normally it’s not expected two of you create the same file in the same time. The whole process looks like update without any problem followed by your modifications (like they were done afterwards).

This means you should avoid creating the same files (we actually don’t need daily SQL changes tracking – in the end we have to aggregate a lot of files when we’re about to release the next version) or be very careful – or use Synchronize feature before you update. Or check newly added files for differences (who would think about that!).

I check the behavior with Tortoise, just to be sure it’s SVN here cheating me and not Eclipse. I checked out the same project twice and added files to both versions. I didn’t add it locally to the repository in checkout A. Then I added it in the local version B, committed and updated local copy A. File showed differences against HEAD, but no conflict, no warning – except for info that the file was added (and came from the repository).

If you add the file locally to both copies, then conflict is detected and you have to resolve it. When you know your file will be committed sooner or later, that it indeed is part of the project, the best way is to add it locally as soon as possible. You can do this in Eclipse too with Team, Add to version control – but I didn’t find any preferences that would do it automatically.

You can safely rely on update and checkout with IntelliJ IDEA, because Idea typically adds the file locally right after the creation – unless you go against its suggestions, which is not rational (R is not capital :-) ). Actually why should you? If you want to have the file in the SVN, there is no reason not to add it. Not to mention you can see nicely whether the file is “under control” or not.

Eclipse tries to handle it differently – I actually don’t like this way (with or without today’s incident, which I consider non-essential, really). I want to know which file is going to SVN and which one is not. Actually, not only know – I want to be the one in control. Of course, you are in control with Eclipse too – but much later. In Synchronization perspective you can remove the file from view. Again – none of my colleagues knows how to remove particular file from this view forever without using svn:ignore feature – which is (I hope you agree) stupid. You’re using SVN ignore (that is SVN’s mechanism) because Eclipse doesn’t make any difference between files locally added and files out of control.

I nearly wanted to finish – but now I realized that I haven’t specified the plugin we use for SVN in Eclipse! Subclipse was used – and if this problem is approached differently with the other plugin (can’t recall the name) let me know in comments and I’ll probably switch. Idea has SVN support fully built-in and you can have only single problem with that (from what I experienced). When we had some older Idea and I “upgraded” local repository version (using newer SVN client for instance) my Idea couldn’t commit or update anymore. But currently with Idea’s free community edition I don’t expect this problem to occur again. :-)

Happy synchronizing, updating and committing with as few conflicts as possible. And even less wannabe-no-conflicts. ;-)

Don’t miss other posts on this topic:
Eclipse vs IntelliJ IDEA
From IntelliJ IDEA to Eclipse (2)
From IntelliJ IDEA to Eclipse (3)
From IntelliJ IDEA to Eclipse (4)
From IntelliJ IDEA to Eclipse (5)

Eclipse vs IntelliJ IDEA

It’s official. This is just a rant. It always is, because even the most serious comparisons of these tools are always clear win for the one used originally and total dismiss of the newly adopted one. I’m Idea user – for almost 9 years or so. I remember a few let downs with Idea – the biggest one for me is clearly introduction of Modules and lack of some good Project view as a result. And also the need to reorganize your project because to get support for web you had to move sources out of the standalone java part of the application (for instance). And application.xml must go to another (module) directory too. And if you add module “All” with the real project root, you can’t see anything in module subdirectories. This was more or less fixed somehow after Idea 4, but still… However – most IDEs somehow forces you to do something with your project anyway. And if you start follow patterns like Maven (not a bad idea either) than you should be safe.

Another issue I have with Idea (and I reported it – but it’s probably not good idea for creators) is a new search bar (since 7? 8? not sure now). Thing is, Ctrl+F is ok, but Enter should work differently. When you write your search string, Enter works like F3 and arrow down – but focus stays in the bar. Not only too many keys do the same thing – but you’re also not in the code after Enter. You have to Enter and Escape to get there. Hell, you can even Ctrl+F, write the search string and Escape – that’s does what I want (and expect from Enter). However, highlighting is gone. So what you really need to do is Ctrl+F, write and click to the code – you have to touch the mouse! :-) Not to mention that if you press Ctrl+F, write, Enter, Enter… you go through your searches and then you need to do another search, Ctrl+F pulls down previous searches instead of giving you the fastest way how to start another search. Firefox selects all and you can search something else – great! Idea’s solution is just so silly that probably previous dialog using way worked better for me. But maybe I’m the only one here.

But that’s it – otherwise I just love Idea. When I’m in code I can just feel it.

And then Eclipse. I’ve read someone complaining about how contextual (hence smart) Eclipse is and how difficult Idea shortcuts are. I can just say, that I’m going crazy when Eclipse offers different search depending on the file I’m in (is there EASY way how to full-text search the whole project – Ctrl+Shift+F in Idea?). Idea’s three different completions might be a bit problematic at the start, but much faster when you know what they do. And then – comparing Ctrl+N with Ctrl+Shift+T… well, I think it’s clear what is easier. I can always get faster to editor in Idea (and that’s actually what I do a lot) while in Eclipse it’s a real finger exercise.

Or Mark Occurrences – they are not sticky! I can’t choose and highlight this… and that… and go somewhere else. It just blinks like disco music all over the screen – or you can turn it off. There are so many features that were copied in much better fashion from Idea do Eclipse, but this one is just ridiculous. Sure I have to click Ctrl+Shift+F7 in Idea – but then – I can highlight any text, not just a type. And more of them. And obviously – I don’t need this Christmas lights turned on all the time (not to mention that the default colour is hardly highlighting – I was rather confused whether I selected something or what).

I also found that in many cases where Idea happily completes, Eclipse wants me to fix some braces first (took me some time to realize that) before he is capable to do so. And Idea goes to the next line after (un)commenting one, Eclipse not (by default at least).

Or SVN support – how can anyone compare SVN support in Idea and Eclipse? In Idea it just works out of the box (even in community edition). And Quick diff (that’s how it’s called in Eclipse, never needed to know the name in Idea) – it’s just far superior (and working right away) in Idea. Also colours are much more distinct (by default!), items in the outline on the right are easier to recognize, etc. In Eclipse all these things are rather greyish, often coloured with pattern instead of solid colour and always outlined instead of being nice thin (yet thick enough) line like in Idea. Deleted stuff in Idea’s diff shows as a triangle, not line nearly impossible to hit with a cursor.

And then commit! Lately I had to do my first “synchronization” and I was shocked how inferior the commit is in terms of my control over the process. Files that are not yet added can’t be told from those that are added to SVN – you have to right click them and check if Add option is available. Not to mention I don’t want to add them by default at all! It was also not that easy to find option to ignore white-spaces in diff view, not to mention I like three options offered by Idea more.

Rename refactoring in Idea selects the whole identifier and I can just write a new one – in Eclipse you have this feature if you switch to rename dialog, not in editor, you have to remember to select the stuff. On the other hand, sometimes it indeed is useful to have cursor on a specific place of the identifier. In Idea I actually miss easy way how to deselect the word without moving the caret – so let’s call it a draw here. Ad selecting – with Idea I can select a word in a string or part of dot separated property name – and then go on to the whole string, line, and on. In Eclipse I can’t select word from its middle in an easy way.

Eclipse is just like this. I don’t see things there, I need more perspectives to use it (never needed that in Idea), Console contains too many… well actually consoles – and there is yet another mechanism to switch between them (funny drop-down button instead of more tabs for instance). I just like Changes window and Run window separate! And that’s probably the point. We all love different things. And while both Idea and Eclipse are customizable to some extent, they can’t satisfy all developers. Even when both do the job (unless you want to sticky highlight thingies ;-) ).

What I can’t deny to Eclipse – their plugin ecosystem is just absolutely awesome. And all these things like EMF or Xtext… many companies use their own plugins built on Eclipse. For a reason. Whether it’s because Idea wasn’t for free (as is Community Edition now) or not – it’s hard to say. But that probably helped a lot.

I’m now stuck with Eclipse and will probably learn to overcome some of the problems. But I can smell it right now, it will hardly grow on me as Idea did.

Don’t miss other posts on this topic:
From IntelliJ IDEA to Eclipse (2)
Why to synchronize with SVN in Eclipse?
From IntelliJ IDEA to Eclipse (3)
From IntelliJ IDEA to Eclipse (4)
From IntelliJ IDEA to Eclipse (5)

Personal Log (2): Leaving Linux, buing guitars

Not that I write continuation of the personal log every time Federer wins a Slam title, but after dramatic final of the Wimbledon it really happened. (Just another instant classic after last year final? :-) ) Fifteen and counting so it seems.

I wanted to confess that I stopped using Linux on my computers. I still have out of date Ubuntu on my desktop, but I can’t remember last time I used it. I went for Windows XP after all those Linux years, because I play more games now than ever. Video and music processing is also better supported on Windows – more software to choose from, VST support, etc. Seriously, why to use Wine just to pretend I’m not using Windows, right? Of course – anytime I have to work in command line in Windows, it’s real pain in the ass. When I changed my old computer at work for Lenovo T500 (with some troubles though) I decided to go for Windows XP only and in order to have some Linux I searched for some virtual machine solution. Friend of mine recommended VirtualBox and I was satisfied! It worked nicely, there was some trick with virtual folder name (try different name then the directory name if you have problem, or something like that ;-) ), but after just a few hours I had nice Ubuntu machine for development tasks that required Unix tools, strong command line and all the rest you don’t have in Windows for free. Of course, performance was… virtual. :-) But if you want to try some virtual machine software, I strongly recommend this one. Documentation is OK, not too much to drown in and I found everything important there.

What I can’t understand is SVN Tortoise client. It’s absolutely great tool, looks nice, integrates to contextual menus for files, etc. So far so good. But when you want to check modified files to find out what is not added to repository (and should be) or when you want to commit, the view shows you either only managed files or all files recursively – there is no way that non-managed directory is just reported without the complete sub-tree. Compare this to default CLI functionality of the svn st command. Man I miss that so much! But not that much that I plan to setup my system PATH and run the all-time-looser “cmd” to use it.

There is one more thing I dislike on Windows. I alt-tab a lot, I’m of those erratic guys. :-) And sometimes I alt-shift-tab back too. Sometimes, when I depress these keys in a wrong order, Windows is strongly convinced I wanted to switch the keyboard layout (alt-shift). Trouble is, there is limited amount of options (keyboard shortcuts) to do so, this one is clearly the best. I should probably download some tool just do switch between keyboard layouts. Slovak keyboard is not good for coding really. Enough Windows rant for now.

I bought a new guitar! I have infamous Behringer’s V-Tone pack – because it was cheap and I was young(er) and uninformed when I bought it. The price was good, amplifier is good, guitar is… well, it’s some kind of Strat and it is possible to play on it. Now I know there are better options in the same price tag (not too many though), but what’s done is done. To have at least semi-decent guitar I bought French LAG AM100:


Black beauty!

It looks cool, it’s Superstrat, it is something different than the Strat, so I might actually also learn more about guitars per se. It was priced 356€ but in a massive sale action I acquired it for 156€, why not? I actually didn’t know what to buy as I also wanted some Ovation, but I decided to buy the best value from whatever I wanted. Funny sale strategy when you learn prices only on site. :-) Even before I bought it I had started to learn some scales and other stuff to enhance my play. Chords, rhythm, no problem, but I wanted to go on after a long stagnation – and with better guitar it’s even more fun!

Is the guitar good? More people claim it’s a good value even for the original price, so I guess I wasn’t wrong with my buy. Quality is OK, but I honestly can’t judge guitar when I can’t compare it. Maybe later I’ll write more on the guitar, trouble with LAG is that they have no official English site (as a manufacturer, not as reseller), forums are dominated by French language, no real documentation for newbies like me. So I have to rely on other forums, other people and learn the rest by myself. Of course, when I just play on it, there is no problem, but you know… when you have a new toy, you want to play with it even more. Tune it (later probably, and I don’t mean just strings now), understand it. However, enough for this time – I need to practice!

Follow

Get every new post delivered to your Inbox.

Join 217 other followers