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

fix: support line removal in patch tool #267

Merged
merged 1 commit into from
Nov 22, 2024
Merged

Conversation

ErikBjare
Copy link
Owner

@ErikBjare ErikBjare commented Nov 22, 2024

The patch tool now properly handles empty content between ======= and >>>>>>> UPDATED, allowing for line removal in patches.

This is done by:

  • Splitting patch content in multiple steps
  • Special handling of the case where UPDATED marker follows immediately after DIVIDER
  • Maintaining compatibility with existing patch formats

Important

Enhances patch tool to support line removal by handling empty content between ======= and >>>>>>> UPDATED in patch.py.

  • Behavior:
    • Supports line removal in patches by handling empty content between ======= and >>>>>>> UPDATED in patch.py.
    • Special case handling when UPDATED marker follows immediately after DIVIDER.
  • Functions:
    • Modifies _from_codeblock() in Patch class to split patch content in multiple steps and handle empty content cases.

This description was created by Ellipsis for bc7891d. It will automatically update as commits are pushed.

The patch tool now properly handles empty content between ======= and >>>>>>> UPDATED,
allowing for line removal in patches. This is done by:
- Splitting patch content in multiple steps
- Special handling of the case where UPDATED marker follows immediately after DIVIDER
- Maintaining compatibility with existing patch formats
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Reviewed everything up to bc7891d in 10 seconds

More details
  • Looked at 37 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. gptme/tools/patch.py:122
  • Draft comment:
    Consider using re.search or re.match to check for the presence of patterns before splitting, to improve efficiency. This applies to lines 122, 126, and 139.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The code uses re.split multiple times, which can be inefficient. Using re.search or re.match might be more efficient for checking the presence of a pattern before splitting.

Workflow ID: wflow_fBqCSJ4FkdhXa37q


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@codecov-commenter
Copy link

codecov-commenter commented Nov 22, 2024

Codecov Report

Attention: Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 72.65%. Comparing base (2ade667) to head (bc7891d).
Report is 2 commits behind head on master.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
gptme/tools/patch.py 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #267      +/-   ##
==========================================
- Coverage   72.66%   72.65%   -0.01%     
==========================================
  Files          64       64              
  Lines        4298     4301       +3     
==========================================
+ Hits         3123     3125       +2     
- Misses       1175     1176       +1     
Flag Coverage Δ
anthropic/claude-3-haiku-20240307 71.37% <80.00%> (+0.01%) ⬆️
openai/gpt-4o-mini 71.26% <80.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@ErikBjare ErikBjare merged commit 7c51573 into master Nov 22, 2024
7 checks passed
@ErikBjare ErikBjare deleted the fix/patch-tool-removals branch November 22, 2024 14:14
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.

2 participants