Conflicts can cause lots of problems. They can hamper your productivity, put you in a bad mood, and even cause you to lose lots of money. In severe cases, they can result in emotional distress leading to live-long trauma. Beleive me, I know. When my next-door neighbor took me to small claims court over the damage I caused when I accidentally drove my pick-up into his son's segway, not only did it breed ill-will, but it ended up costing me $2000 dollars. But that's another story. I wanted to focus on the work I been doing lately with Subversion, a version control software, and try to explain how it is possible to actually create a conflict. Why you ask? Becuase I had the task of doing the screenshots for the updated NetBeans 6.0 Subversion Tutorial, and so I needed to make it look like there was a conflictorial state.
At first, I tried to access the same versioned project through 2 different IDE's at the same time. Of course that didn't work, and the more I think about it, that just seems silly now. I finally realized that the key is in creating a second project and linking to the same repository. Here's what I did:
At first, I tried to access the same versioned project through 2 different IDE's at the same time. Of course that didn't work, and the more I think about it, that just seems silly now. I finally realized that the key is in creating a second project and linking to the same repository. Here's what I did:
- Create Local Subversion repository from terminal:
svnadmin create /home/larry/Desktop/svnRepo - In NetBeans, link a project with the new repository. There's 2 simple ways to do this:
- Create a new project, then, from the project node in the Projects window, choose Versioning > Import into Subversion Repository.
- Use the SVN checkout wizard (Versioning > Subversion > Checkout from main menu). Add the path to the new repository:
Then, when the wizard finishes, it scans the repo (and finds nothing) and asks you if you want to create a project from checked out sources. Do this. When the project opens in the IDE, notice that it already contains versioning badges.
- Now, step through the Subversion checkout wizard (again), and this time in the second step, select the project you just created:
When you finish the wizard, note that you now got 2 identical projects listed in the Projects window, both linked to the same repository:
- Open the index.jsp file of project 1, and make some change:
Save and commit that change to the repository. - Now, open the index.jsp file of project 2, and make some different change to the same line as you did for project 1:
Save the file. - Then, when you do an update on project 2, the project is compared with the current version of the repository's project (already contains Hola Amigo! from project 1). Here's the conflict, and the Projects window tells you so:
- To resolve the conflict, you can open the Conflict Resolver to fix the matter. The Conflict Resolver is like some high-profile lawyer who arrives upon the scene willing to offer legal services pro bono:
With the click of a button, all your problems go away! Of course, conflicts are much easier to resolve when they're just between you and yourself.
