Is it possible to Create Patch in Eclipse from changes that have already been committed?
I've used the Create Patch facility in Eclipse to create patches for uncommitted changes. I'm looking for a way to create patches in Eclipse for changes that have already been committed to the VCS.
Unless I've missed something I don't think this is possible, but is there a plugin that adds this capa开发者_运维知识库bility? e.g. enabling you to select two versions in the History view and create a patch between them or comparing two branches and being able to create a patch from the results in the Synchronize view?
I'm happy creating such patches from the command line but am looking for a way to streamline/integrate the process if possible.
Thanks for any help.
Update: if any suggestions are specific to a particular source control system I'm particularly interested in CVS, SVN and Mercurial. Thanks again.
With subclipse you can select two revisions of a directory in the history view, compare them and save the patch as a unified diff.
I just made a patch SVN after a commit! :)
- Enter in "SVN Repository"
- Go to the root of the project.
- Click on "Compare"
- Select "Unified diff to output file"
- Click on "Select" and choose the name and location of the file
- Click "Ok"
I did some extensive research... and I've found out that there is no way to use the actual Eclipse Comparison Editor to generate a .patch file based on the differences in the "Local History" section.
I am going to create a new feature request for this.
It's possible to do it using the "SVN Repository explorer" perspective.
- Navigate to the root element you want to compare (typically the trunk folder)
- Show "History view" (if not already displayed)
- Select two revisions from "History view"
- Right-click on one of the two revisions and select "Create Patch..." in the contextual menu.
As per the other answers, no, it is not currently possible.
But for now, here's a manual work-around with SVN as the example (I imagine other VCSs will allow very similar comparisons):
- Create a second Eclipse Workspace; Workspace 2.
- Ensure that Workspace 2 has the right code for the "target" of the merge and the original Workspace 1, has the code you forgot to take a patch from.
- Manually compare Workspace 1 and 2 using a merge tool capable of comparing directories (On Windows, I like Araxis Merge, but WinMerge works too).
- Open each file and ensure only your changes are in it, if there are other changes, you'll have to take each of your changed lines across, if no one else has changed the target file, you can copy the whole file across.
- Synchronise Workspace 2 (but do not check in!) so you can see the changes you've now got there.
- In Workspace 1, open "SVN Repository Exploring Perspective"
- Right click the folder where the code was checked in (something under "branches" or "trunk" probably) -> "Compare..." and it should already have filled in the revision number just before your check in.
- You can now see the changes from the code you checked in (which you forgot to take a patch of) with the version before you checked it in.
- Have Workspaces 1 and 2 open side by side and run each changed file visually to ensure they match everything from 1 now appears in 2.
Very, very tedious but it should pick up all the changes.
When I couldn't make this in Eclipse (I needed to work with CVS only), I tried other software available and found that SmartCVS can do it. However, this function is available only in the Pro paid version and it takes a bit of time (kind of slow in comparison) when you have more code.
I would like to know about some open source software with this ability, if someone knows about it. Thanks
精彩评论