Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » Why doesn't my patch work?(EGit Team > Apply patch can't apply patch created by History > Create patch)
Why doesn't my patch work? [message #1753905] Sun, 12 February 2017 05:45 Go to next message
Jim DeLaHunt is currently offline Jim DeLaHuntFriend
Messages: 7
Registered: March 2014
Location: Vancouver, Canada
Junior Member

Hello, everyone:

I am using EGit with LiClipse, an Eclipse derivative. I am trying to move changes from one Git repository using patches. Team > Apply patches... cannot recognise the relevant locations to patch. The patch was created by History > Create Patch..., and is in Eclipse format.

Both Git repositories are versions of the Python source code tree on github. I'm moving from a clone of python/cpython-mirror to a clone of python/cpython.

I created a patch from the History view of the source repo. I right-clicked on the commit with my changes. A pop-up menu appeared. I selected Create Patch.... I followed the two-step wizard. I specified the format "Eclipse workspace". All this was as described in the User Guide section on patches.

Here's an excerpt of the patch file:
### Eclipse Workspace Patch 1.0
#P cpython-mirror
diff --git Doc/Makefile Doc/Makefile
index 91f937f..6e1c183 100644
--- Doc/Makefile
+++ Doc/Makefile
@@ -10,7 +10,7 @@
 SOURCES      =
 DISTVERSION  = $(shell $(PYTHON) tools/extensions/
-ALLSPHINXOPTS = -b $(BUILDER) -d build/doctrees -D latex_paper_size=$(PAPER) \
+ALLSPHINXOPTS = -b $(BUILDER) -d build/doctrees -D latex_elements.papersize=$(PAPER) \
                 $(SPHINXOPTS) . build/$(BUILDER) $(SOURCES)
 .PHONY: help build html htmlhelp latex text changes linkcheck \
diff --git Doc/ Doc/
index b1bb620..6640349 100644
--- Doc/
+++ Doc/
... [omit the rest to save space]...

I switched to the destination repo. I didn't see any way to apply the patch from the EGit perspective. Is there?

I opened the "PyDev Package Explorer" view. I right-clicked on a node in the project. A pop-up menu appeared. I selected the Team > Create patch... menu item. An Apply Patch dialogue box appeared. Under Patch Contents, it listed each file I expected, and each set of lines I expected.

What I didn't expect:

Each item in the Patch Contents pane had a bright red circle with a white "X" on it. I take it that EGit is trying to tell me there was a problem. I'm not sure what was the problem.

In the Text Compare pane, the left "Patched Local File" part looked correct, but the right-hand part was labelled "Unmatched Patch Segment". I don't know how to interpret "Unmatched", but it sounds like something went wrong.

When I clicked the [Finish] button, the dialogue closed. The changes seemed not to have been applied.

Why isn't this patch being applied? What is the problem which EGit is trying to tell me about with the red and white "X" marks? How do I make this work?

My LiClipse IDE is based on Eclipse Platform 4.6.1.v20160907-1200, with Eclipse Git Team Provider I am on Mac OS X 10.10.5.

Thanks in advance for your help.

--Jim DeLaHunt, multilingual websites consultant, Vancouver Canada
Running Liclipse. Coding in Python, SQL, PHP, Prolog.
Re: Why doesn't my patch work? [message #1755279 is a reply to message #1753905] Wed, 01 March 2017 22:38 Go to previous message
Matthias Sohn is currently offline Matthias SohnFriend
Messages: 1097
Registered: July 2009
Senior Member
It seems you are trying to apply a patch on top of another version of your project which looks very different from
the base version you created the patch from. If context lines around the modifications you created a patch for don't match
between the two base versions (source where you created the patch and target where you want to apply the patch)
it may happen that the patch can't be applied cleanly.

See section 5 under "apply patch" in
Previous Topic:What should Team > Create patch do? Does EGit supply it?
Next Topic:Dialogue or control for push --set-upstream origin
Goto Forum:

Current Time: Tue Oct 15 14:59:38 GMT 2019

Powered by FUDForum. Page generated in 0.09928 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top