Skip to content

Built parser to parse a patch file#4

Merged
vikramsubramanian merged 1 commit intomasterfrom
feature/parser
Jun 11, 2020
Merged

Built parser to parse a patch file#4
vikramsubramanian merged 1 commit intomasterfrom
feature/parser

Conversation

@vikramsubramanian
Copy link
Copy Markdown
Collaborator

Still working on Documentation!
Comments should be detailed enough...(I hope)
Still testing, but didn't want to hold anyone up!

@vikramsubramanian vikramsubramanian self-assigned this Jun 9, 2020
@vikramsubramanian vikramsubramanian linked an issue Jun 9, 2020 that may be closed by this pull request
Copy link
Copy Markdown
Collaborator

@shaybanerjee shaybanerjee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job! Just left a few comments. Let me know if you would like discuss anything.

Comment thread scripts/patchParser.py
Comment thread scripts/patchParser.py
Comment thread scripts/patchParser.py
@shaybanerjee shaybanerjee self-requested a review June 9, 2020 20:19
Comment thread scripts/patchParser.py Outdated
Comment thread scripts/patchParser.py
Comment thread scripts/patchParser.py Outdated
Comment thread scripts/patchParser.py Outdated
Comment thread scripts/patchParser.py
Comment thread scripts/patchParser.py Outdated
@YinuoWang YinuoWang requested review from YinuoWang and removed request for YinuoWang June 10, 2020 19:25
Comment thread scripts/patchParser.py Outdated
@vikramsubramanian
Copy link
Copy Markdown
Collaborator Author

I've made the changes you guys asked for. Please do tell me if there are more changes you want.

@vikramsubramanian vikramsubramanian merged commit f364ada into master Jun 11, 2020
@vikramsubramanian vikramsubramanian deleted the feature/parser branch June 11, 2020 17:38
gwurster added a commit to gwurster/ApplyPlus that referenced this pull request Oct 12, 2022
This patch fixes a number of errors encountered during internal testing:

1. Processing of hunks within a patch file was incorrect.  We were
   starting a new hunk every time we saw a --- or +++, but we should
   have been looking at the number of lines remaining in the current
   hunk (which started with a @@) to determine if we were at the end
   of the hunk.  In the rare case where the patch is removing a line
   that starts with --, or adding a line that starts with ++, you'll
   have a --- or +++ within the hunk which we were treating as a new
   hunk even though it should not have been.  Now, instead of looking
   for a +++ or --- on every line, we count the number of lines which
   should be in the hunk and treat those lines as part of the hunk
   instead of starting a new hunk.  As part of implementing this
   feature, we renamed the _lineschanged array to the more descriptive
   _oldStart, _oldLength, _newStart, and _newLength variables.

2. We were not handling hunks which created or removed files
   correctly.  In this case, either the source or target file will
   appear as /dev/null and we should be able to handle this.

3. On occasion, srcml was hanging which meant that apply.py also hung.
   Implement a timeout on the external program calls so that we can
   detect hangs and error out.

4. We do not handle binary patches, but we should be able to detect
   when they appear and raise an appropriate error.

5. Update the Makefile to automatically install srcml if it's not
   already installed.  The http://gehry.sdml.cs.kent.edu site is
   unfortunately not available over HTTPS (it's a self-signed
   certificate and a default Apache testing page) and so for now we
   are downloading over HTTP.  We install it into the env path.

6. Only ask questions about the possible files to apply the patch to
   if we are running over a TTY.  This avoids the questions being
   asked if the output of apply.py is being piped to a file or another
   program.

Unit tests are added for meido#1, meido#2, and meido#4 above.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

create .patch file parser

3 participants