Split: Applying github patch problems

For test results, bug reports, announcements of new builds etc.

Moderators: winston, another_commander, Getafix

Post Reply
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6681
Joined: Wed Feb 28, 2007 7:54 am

Split: Applying github patch problems

Post by another_commander »

Split from Screenshots thread

OK, thanks for testing. Note that the current 1.85 nightlies do not have PR #153 applied and one of the reasons is that we did not have enough information about what happens at extreme distances. If the 10Mkm disappearance gets sorted out and it does look better, then we could consider bringing #153 into the master branch.

If you feel like experimenting with the distance clear value, try changing the #define MAX_CLEAR_DEPTH 10000000000.0 in MyOpenGLView.h to a much higher value and see how it behaves.

For now, I have updated the comments in the PR on github with your results. Thanks again for your help.
User avatar
Frame
---- E L I T E ----
---- E L I T E ----
Posts: 1477
Joined: Fri Mar 30, 2007 8:32 am
Location: Witchspace

Re: Screenshots

Post by Frame »

another_commander wrote:
OK, thanks for testing. Note that the current 1.85 nightlies do not have PR #153 applied and one of the reasons is that we did not have enough information about what happens at extreme distances. If the 10Mkm disappearance gets sorted out and it does look better, then we could consider bringing #153 into the master branch.

If you feel like experimenting with the distance clear value, try changing the #define MAX_CLEAR_DEPTH 10000000000.0 in MyOpenGLView.h to a much higher value and see how it behaves.

NP:
For now, I have updated the comments in the PR on github with your results. Thanks again for your help.
Well I tried, but i cant make sense of git. making a local patch procedure is extremely annoying steep learning curve and the help files is not helping. I tried branching etc. but always some box comes up with something about a message and i'm stuck there. allways end up pressing the X (close button)
Bounty Scanner
Number 935
Commander_X
---- E L I T E ----
---- E L I T E ----
Posts: 675
Joined: Sat Aug 09, 2014 4:16 pm

Re: Split: Applying github patch problems

Post by Commander_X »

Frame wrote:
Well I tried, but i cant make sense of git. making a local patch procedure is extremely annoying steep learning curve and the help files is not helping.
Being in the "Screenshots" thread [sic] I was trying to screenshot the (simple) procedure to apply a patch against a pulled git source tree (using the nice dev environment a_c released). Unfortunately this is what the last step returned:

Code: Select all

$ patch -p1 <../153/153.diff
patching file src/Cocoa/MyOpenGLView.h
Hunk #1 FAILED at 30.
1 out of 1 hunk FAILED -- saving rejects to file src/Cocoa/MyOpenGLView.h.rej
patching file src/Core/Entities/Entity.h
Hunk #1 FAILED at 150.
Hunk #2 FAILED at 275.
2 out of 2 hunks FAILED -- saving rejects to file src/Core/Entities/Entity.h.rej

patching file src/Core/Entities/Entity.m
Hunk #1 FAILED at 94.
Hunk #2 FAILED at 1048.
2 out of 2 hunks FAILED -- saving rejects to file src/Core/Entities/Entity.m.rej

patching file src/Core/Universe.h
Hunk #1 FAILED at 309.
1 out of 1 hunk FAILED -- saving rejects to file src/Core/Universe.h.rej
patching file src/Core/Universe.m
Hunk #1 FAILED at 382.
Hunk #2 FAILED at 4398.
Hunk #3 FAILED at 4489.
Hunk #4 FAILED at 4512.
Hunk #5 FAILED at 4531.
Hunk #6 FAILED at 4581.
Hunk #7 FAILED at 4632.
7 out of 7 hunks FAILED -- saving rejects to file src/Core/Universe.m.rej
patching file src/SDL/MyOpenGLView.h
Hunk #1 FAILED at 41.
1 out of 1 hunk FAILED -- saving rejects to file src/SDL/MyOpenGLView.h.rej
Is it a branch the "153.diff" should be applied to?*

*I've actually did a "pull" and "submodule update" beforehand ...
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6681
Joined: Wed Feb 28, 2007 7:54 am

Re: Split: Applying github patch problems

Post by another_commander »

Applying the patch should be straightforward, but I have unfortunately just confirmed the problem described by Commander_X. The patch utility that the development environment runs is an old version which seems to have problems with applying github formatted patches on Windows. Thankfully, the solution is very easy: Use a newer patch utility, and more specifically, the one that comes with the version of git distributed with the dev environment.

To fix the patch issue:
1. Go to <DevEnvInstallPath>/Msys_x2/1.0/bin, find the files patch.exe and patch.exe.manifest and rename them.
2. Go to <DevEnvInstallPath>/git/bin, find the files with the same name as above and right-click->Copy,
3. Return to <DevEnvInstallPath>/Msys_x2/1.0/bin, right-click->Paste. You now have the newer patch.exe version at the right location.

How to apply a patch (let's use pr153.diff as example):
Normally a pull request patch should be directly applicable to the master branch, unless the PR is too old and things on master have changed a lot compared to the time the PR was created. In any case, we will normally not make you patch incompatible branches, so #153 can be safely merged with current 1.85 master.

1. Go to https://github.com/OoliteProject/oolite/pull/153.diff select everything with Ctrl+A, copy to clipboard and paste in a new file in your text editor; let's call it pr153.diff. Save the file at the top level of your Oolite checkout, i.e. the folder that has src, Docs, Resources etc. directly below it. -- Bonus Tip: You can obtain the patch diff for any pull request or specific revision in github, by navigating to the appropriate github page and adding .diff at the end of the link appearing on yout browser's url box.

2. Using the dev environment shell, go to <OoliteSourcePath>. You will need to be at the top level folder of your Oolte checkout in order for the patch to be able to find the paths of the files it works with.

3. Execute patch -p1 < pr153.diff. If you are using the new version of patch.exe, it should be able to execute without errors.

Hopefully this helps. If you feel it's too much work or too much hassle to go through, don't worry, I fully agree with you :-).
User avatar
kanthoney
Commodore
Commodore
Posts: 281
Joined: Thu Nov 07, 2013 10:21 pm

Re: Split: Applying github patch problems

Post by kanthoney »

If you're struggling with patches, here's an alternative. Assuming the remote name of the Oolite repo is 'origin' (it is unless you're using your own fork), run the command

Code: Select all

git checkout origin/master
and then

Code: Select all

git merge origin/two_pass_planet_slice
You may be taken into a text editor to record a commit message - if so you can just quit the editor to use the default one. Then you can build as normal.

The branch you created when checking out master will be in a "detached head" state, which means it's a temporary branch which will be lost if you check out another one. To save it for future work, run

Code: Select all

git checkout -b name_of_branch
Commander_X
---- E L I T E ----
---- E L I T E ----
Posts: 675
Joined: Sat Aug 09, 2014 4:16 pm

Re: Split: Applying github patch problems

Post by Commander_X »

*sighs*

... or I could had used the patch utility from my Cygwin distro. I wasn't sure though if it wasn't due to a branch specific need, that's why I posted. Oh well!
Post Reply