parsepatch's People
parsepatch's Issues
Decode exception on HGMO content
Happens in Docker using python:3-alpine (i discovered that running on Heroku):
To reproduce, write that file as crash.py
:
from parsepatch.patch import Patch
import requests
r = requests.get('https://hg.mozilla.org/try/raw-rev/5812353e06c977115314cf979e2909ab4eab21b4')
Patch.parse_patch(r.content)
Then run as:
docker run -it -v $(pwd)/crash.py:/crash.py python:3-alpine sh
In the docker shell:
pip install -q requests parsepatch six
python /crash.py
You should get the following exception:
Traceback (most recent call last):
File "/crash.py", line 4, in <module>
Patch.parse_patch(r.content)
File "/usr/local/lib/python3.7/site-packages/parsepatch/patch.py", line 84, in parse_patch
return p.parse()
File "/usr/local/lib/python3.7/site-packages/parsepatch/patch.py", line 342, in parse
while self.next_diff():
File "/usr/local/lib/python3.7/site-packages/parsepatch/patch.py", line 206, in next_diff
for line in self.get_lines:
File "/usr/local/lib/python3.7/site-packages/parsepatch/patch.py", line 129, in _lines
if self._check(line):
File "/usr/local/lib/python3.7/site-packages/parsepatch/patch.py", line 150, in _check
return self.conditions[-1](line)
File "/usr/local/lib/python3.7/site-packages/parsepatch/patch.py", line 205, in <lambda>
self._condition(lambda x: not x.startswith('diff --git a/') and not x.startswith('diff -r '))
AttributeError: 'int' object has no attribute 'startswith'
Which does not happen with Patch.parse_patch(r.content.decode('utf-8'))
Specify that Python 3 is supported
pyup shows parsepatch as not supporting Python 3
File renames not supported
A patch with a file rename is not supported by parsepatch.
diff --git a/please b/lol
similarity index 100%
rename from please
rename to lol
should give
{
'lol' : {
'renamed_from': 'please',
'changes': []
}
}
Wiki changes
FYI: The following changes were made to this repository's wiki:
-
defacing spam has been removed
-
Restricting write access to contributors is strongly encouraged. Please make that change (documentation).
These were made as the result of a recent automated defacement of publically writeable wikis.
Add open source software license
This Mozilla repository has been identified as lacking a license. Consistent with Mozilla's Licensing Policy an open source license should be applied to the code in this repository.
Please add an appropriate LICENSE.md file to the root directory of the project. In general, Mozilla's licensing policies are as follows:
-
Client-side products created by Mozilla employees or contributors should use the Mozilla Public License, Version 2.0 (MPL).
-
Server-side products or utilities that support Mozilla products may use either the MPL or the Apache License 2.0 (Apache 2.0).
In special cases, another license might be appropriate. If the repository is a fork of another repository it must apply the license of the original. Similarly, another license might be appropriate to match that of a broader project (for example Rust crates that Firefox depends on are published under an Apache 2.0 / MIT dual license, as that is the dual license used by the Rust programming language and projects).
Please ensure that any license added to the LICENSE.md file matches other licensing information in the repository (for example, it should match any license indicated in a setup.py or package.json file).
Mozilla staff can access more information in our Software Licensing Runbook – search for “Licensing Runbook” in Confluence to find it.
If you have any questions you can contact Daniel Nazer who can be reached at dnazer on Mozilla email or Slack.
OPENLIC-2023-01
List chunks in a patch
For the code review bot, i would need a new method in parsepatch that would list all the chunks in a diff.
The method get_chunks
would list all chunks, and store at least the following informations in a namedtuple
(or class, or even dict):
- filename
- start/end line in source
- start/end line in dest
- the diff from the chunk.
For example, this diff:
DIFF diff -r 11d2a13d8286 bad.cpp
--- a/bad.cpp Mon Oct 15 10:26:44 2018 +0000
+++ b/bad.cpp Mon Oct 15 10:26:45 2018 +0000
@@ -1,4 +1,5 @@
#include <demo>
-int main(void){
- printf("plop");return 42;
+int main(void) {
+ printf("plop");
+ return 42;
}
would give for patch.get_chunks()
:
[
Chunk(
filename='bad.cpp',
src_start=2,
src_end=3,
dest_start=2,
dest_end=4,
diff='''#include <demo>
-int main(void){
- printf("plop");return 42;
+int main(void) {
+ printf("plop");
+ return 42;
}'''
)
]
CODE_OF_CONDUCT.md file missing
As of January 1 2019, Mozilla requires that all GitHub projects include this CODE_OF_CONDUCT.md file in the project root. The file has two parts:
- Required Text - All text under the headings Community Participation Guidelines and How to Report, are required, and should not be altered.
- Optional Text - The Project Specific Etiquette heading provides a space to speak more specifically about ways people can work effectively and inclusively together. Some examples of those can be found on the Firefox Debugger project, and Common Voice. (The optional part is commented out in the raw template file, and will not be visible until you modify and uncomment that part.)
If you have any questions about this file, or Code of Conduct policies and procedures, please see Mozilla-GitHub-Standards or email [email protected].
(Message COC001)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.