Synchronization

This way of upgrading Your l2j server is needed if You have customized the source code / added new files to it.

This guide will tell You how to do a synchronization in Eclipse.

Of course, the pre-requisites are Eclipse itself and an l2j server project with any changes in it (even configuration files count).

IF You haven't done any changes in source You have no need to do synchronization, You can just do Team > Update.

So then, to start a synchronization, You need to right-click Your project (L2J_Server, L2J_DataPack or similar), and choose Team > Synchronize with Repository.



Now Eclipse will synchronize the current source on Your PC with files contained in the SVN repository.

''WARNING! this may take some time (up to several minutes) if You haven't updated Your server in a while and if Your network connection or computer is slow.''

After synchronization has finished, a new perspective should open up showing a Synchronize view (a file tree with all changed files in it). By default, the view is set to display ALL changes, i.e. incoming, outgoing, and conflicts. You can set it to show only a specific type of changes by clicking on one of the four arrow icons in the menu bar of the view, as seen in the picture below.



The blue arrow means "Incoming changes" (ones that come from the SVN), the black arrow means "Outgoing changes" (ones You've made which are not in the SVN) and the red arrow means "Conflicting changes" (file has been modified both in the SVN and in Your local copy).

Files with a blue arrow are usually safe to update (Right-click > Update), the black ones are to be left alone unless You have commit rights, and the red ones are the troublesome ones.

Those You need to double-click, they will open in a new window on the right, which will have 2 columns - the one on the left being Your local file with Your changes, and the other one being the fresh SVN file.

The different parts of both columns will be marked in the same colors as the arrows, i.e. blue - incoming changes, black - outgoing, red - conflicting.

You can browse the differences by clicking "Next/Previous Difference" buttons found at the top right of the "Java Source Compare" window, instead of scrolling with mouse wheel, and copy the changes from the right to the left pane by clicking the "Copy Current Change from Right to Left" button or the "Copy All Non-Conflicting Changes from Right to Left" button, which does exactly what is says - it copies only the incoming changes (not conflicting ones) to the left side, which is very handy.



At this point everything depends on whether You want to keep Your local changes or not.

If You do, You will have to find a way to make both Your and the incoming code work together (perhaps You will simply ignore the incoming change and mark the file as merged (will talk about it later), or You will replace Your own changes with the incoming ones, it all depends on You).

If not, however, you can simply overwrite the local file with the one in the repository by right-clicking the file and choosing "Override and Update".



After You're done merging the changes (that's what this process is called - merging), save the file and close it.

The file still has a RED arrow in the Synchronize view. To fix it, right-click the file and choose "Mark as Merged".



The icon will now have a BLACK arrow (Outgoing). This way You can easily find the files that You have updated and which contain Your custom code in them.

Also, If You have ADDED any files/folders to the source, their icon will have a BLACK arrow with a white + on it(Again, to easily spot Your files/folders).

After You have updated all the files and double-, if not triple-checked if everything is correct and no custom code has been deleted, you can close the Synchronize view (You have already saved the files, remember?). Now You can compile the source as always.

Summary: BLUE arrow - Incoming change, usually safe to update. RED arrow - Conflicting change, contains both Your and SVN updates. Use Synchronize view to see changes made. BLACK arrow - Outgoing change, contains only changes made by you, and marked as such (Right-click -> Mark as Merged).

And that is pretty much all there is to synchronizing your local copy with the SVN. There are many shortcut keys available for this process (You can find them by opening Window > Preferences, going to General > Keys and typing "compare" in the search bar), I have set the following keybindings for myself:

Select Next Change - Shift+Down

Select Previous Change - Shift+Up

Copy from Right to Left - Shift+Left

Copy from Left to Right - Shift+Right

This makes it very easy to navigate and merge the changes in a file using only the keyboard.