views:

1430

answers:

2

I recently got involved in a Java project at work: we're using MyEclipse for the IDE, and Subclipse for source control integration. Since I am new to the project, I am currently submitting any changes I make as patches, to make it easier for the other team members to review my changes and decide whether or not to commit them to the trunk. However, when I create a patch using the Create Patch option in the Team menu, the resulting patch contains absolute paths to the files that have changed. Since I want to be able to e-mail these patches to other team members and have them simply apply the patches to their own working folder, I would like to produce patches that contain only relative file paths (I'm running on Ubuntu and currently my working copy is in my home folder, so the absolute paths are especially annoying).

Is there a way to configure Eclipse/Subclipse to do this? I searched the Eclipse Preferences and clicked through the Create Patch wizard a few times, but I couldn't find anything that looks like it will do this. Currently, I'm manually editing the patch files with a text editor to convert the absolute file paths to relative paths. If Subclipse can't do this, I'm open to other suggestions.

EDIT: I know that there is the option to ignore a certain number of segments in file name paths when you go to apply the patch from within Eclipse, but I was curious if there was a way to avoid this to reduce the number of steps involved in applying patches. By manually editing the paths to make them relative to the project's root folder, an end-user just has to be sure to apply the patch at the root project folder level. I'd like to have that simplicity without having to manually edit the patch files.

+2  A: 

The newest versions of subclipse are able to do what you say. Probably I have your same version because the 1.2.4 (my version) by default uses the filesystem as a patch root, while version 1.5.2 allows you to select the Patch Root (between project, workspace or selection) before creating the patchfile.

Well, sorry, I read after that you already knew how to patch it by hand, but I am leaving this out as reference:

Before you upgrade you can open the patchfile by hand and edit it:

  1. right click -> open with -> Text Editor,
  2. Find and replace all the occurrences of /home/user/projectfiles/project/ with a blank...
  3. remember to leave out only a single space between the "Index:" and the filename, like "Index: .classpath", otherwise your patch will not be usable in Windows-based Eclipse
Davide Inglima
+2  A: 

The Subversion API was enhanced in 1.5 to allow the relative path location to be passed to the API. If you install Subclipse 1.4.x (which uses Subversion 1.5) then the patches will have relative paths. There are a number of other patch related enhancements including multi-project patches and the ability to select which files are included in the patch.

Mark Phippard
+1. Thanks, 1.5 works as advertised.
Leigh