Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guidance for applying patches for review and potentially handling conflicts #170

Open
zkamvar opened this issue Apr 11, 2024 · 3 comments
Open
Labels
good first issue Good for newcomers

Comments

@zkamvar
Copy link
Contributor

zkamvar commented Apr 11, 2024

I'm interested in helping to confirm the patches proposed in r-devel/bug-bbq#2, but at the moment, I cannot find instructions for applying a patch.

An example I can find is from the patches proposed in https://bugs.r-project.org/show_bug.cgi?id=18145 and https://bugs.r-project.org/show_bug.cgi?id=17918, which both touch the same function, but are yet unconfirmed. These patches are both over 2 years old and it's not clear whether or not they can be neatly applied.

@MichaelChirico
Copy link
Contributor

Ideally it's as simple as running svn patch, e.g. for #18145

svn patch ~/Downloads/fix_s3method_detection_debugcall.diff

But unfortunately it cannot be neatly applied 🙃

C         src/library/utils/R/debugcall.R
>         rejected hunk @@ -31,13 +31,27 @@
C         tests/reg-tests-1d.R
>         rejected hunk @@ -5998,7 +5998,23 @@
Summary of conflicts:
  Text conflicts: 2

I am unclear myself how to proceed in this case since it didn't leave any conflict markers. It looks like we'll have to generate the patch from scratch based on the current trunk?

@llrs
Copy link
Member

llrs commented Apr 12, 2024

Here are the instructions about applying a patch: https://contributor.r-project.org/rdevguide/FixBug.html
It might be a good moment to check how to update the patch, and update the documentation accordingly.

@aitap
Copy link

aitap commented Apr 14, 2024

svn help patch recommends updating to the revision the patch had been generated from before applying a patch and then updating back to HEAD (which will uncover the conflicts and prompt for resolution). So in order to "rebase" a patch, it will be needed to:

  1. Start with a clean checkout of R
  2. svn up -r $N where $N is the source revision
  3. svn apply "$patch", which should apply cleanly
  4. svn up HEAD, which will interactively ask about each conflict. If interrupted, conflict resolution can be continued again by running svn resolve.
  5. svn diff to obtain the newly conflict-free patch

People who prefer Git can also start with a Git mirror, find out the commit $start corresponding to the source revision of the patch and then run:

  1. git checkout -b updated_patch $start
  2. patch -p0 <"$patch" or apply the patch in a different way
  3. git commit -a -m "Patch from R Bugzilla PRNNNNN"
  4. git rebase master
  5. Resolve conflicts
  6. git diff master...updated_patch to obtain the now conflict-free patch
  7. Adjust or regenerate patch for Subversion compatibility

@hturner hturner added the good first issue Good for newcomers label Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

5 participants