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

List chunks in a patch #2

La0 opened this Issue Oct 15, 2018 · 0 comments


None yet
1 participant

La0 commented Oct 15, 2018

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():

   diff='''#include <demo>
-int 	main(void){
- printf("plop");return 42;
+int main(void) {
+  printf("plop");
+  return 42;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment