Git Product home page Git Product logo

Comments (15)

stoesselt avatar stoesselt commented on August 29, 2024 1

Ok, so rest/api/1.0/projects/P2/repos/code/pull-requests/48/changes?limit=999999 seems to report all files changed. At least ListView.cpp is included.

However, your other request rest/api/1.0/projects/P2/repos/code/pull-requests/48/diff?limit=999999 indeed only returns the changes for the first 6 files. As said before, many files were renamed and Bitbucket treat them as removed and added, so the whole content of many files has to be retrieved by this request. Without the content of hunks the json data looks like this:

{
	"fromHash":"9ab4dd79061abe6552bff5506505493e38d19e77",
	"toHash":"b7e95fdd339b9b8b98faa7a9a97b2600b761ecb6",
	"contextLines":10,
	"whitespace":"SHOW",
	"diffs":[
		{"source":
			{"components":["pump","build","Makefile.common.gcc.mk"],"parent":"pump/build","name":"Makefile.common.gcc.mk","extension":"mk","toString":"pump/build/Makefile.common.gcc.mk"
			},"destination":
			{"components":["pump","build","Makefile.common.gcc.mk"],"parent":"pump/build","name":"Makefile.common.gcc.mk","extension":"mk","toString":"pump/build/Makefile.common.gcc.mk"
			},"hunks":[]
		},
		{"source":
			{"components":["pump","build","Makefile.common.iar.mk"],"parent":"pump/build","name":"Makefile.common.iar.mk","extension":"mk","toString":"pump/build/Makefile.common.iar.mk"
			},"destination":
			{"components":["pump","build","Makefile.common.iar.mk"],"parent":"pump/build","name":"Makefile.common.iar.mk","extension":"mk","toString":"pump/build/Makefile.common.iar.mk"
			},"hunks":[]
		},
		{"source":
			{"components":["pump","build","controller","Makefile.gcc.mk"],"parent":"pump/build/controller","name":"Makefile.gcc.mk","extension":"mk","toString":"pump/build/controller/Makefile.gcc.mk"
			},"destination":
			{"components":["pump","build","controller","Makefile.gcc.mk"],"parent":"pump/build/controller","name":"Makefile.gcc.mk","extension":"mk","toString":"pump/build/controller/Makefile.gcc.mk"
			},"hunks":[]
		},
		{"source":
			{"components":["pump","build","controller","Makefile.iar.mk"],"parent":"pump/build/controller","name":"Makefile.iar.mk","extension":"mk","toString":"pump/build/controller/Makefile.iar.mk"
			},"destination":
			{"components":["pump","build","controller","Makefile.iar.mk"],"parent":"pump/build/controller","name":"Makefile.iar.mk","extension":"mk","toString":"pump/build/controller/Makefile.iar.mk"
			},"hunks":[]
		},
		{"source":
			{"components":["pump","build","eclipse","GccController",".cproject"],"parent":"pump/build/eclipse/GccController","name":".cproject","extension":"cproject","toString":"pump/build/eclipse/GccController/.cproject"
			},"destination":
			{"components":["pump","build","eclipse","GccController",".cproject"],"parent":"pump/build/eclipse/GccController","name":".cproject","extension":"cproject","toString":"pump/build/eclipse/GccController/.cproject"
			},"hunks":[]
		},
		{"source":
			{"components":["pump","build","eclipse","GccServiceProvider",".cproject"],"parent":"pump/build/eclipse/GccServiceProvider","name":".cproject","extension":"cproject","toString":"pump/build/eclipse/GccServiceProvider/.cproject"
			},"destination":
			{"components":["pump","build","eclipse","GccServiceProvider",".cproject"],"parent":"pump/build/eclipse/GccServiceProvider","name":".cproject","extension":"cproject","toString":"pump/build/eclipse/GccServiceProvider/.cproject"
			},"hunks":[]
		}],
	"truncated":true
}

So the "truncated":true clearly means that not everything is sent. The question is how to retrieve all data by incremental requests or how to get the changed lines in another way.

from violation-comments-to-stash-plugin.

tomasbjerre avatar tomasbjerre commented on August 29, 2024 1

Releasing 1.90 now with a fix for this. Will now make rest calls for diff on each file.

Available in update center within a few hours.

Open issue again if not working!

from violation-comments-to-stash-plugin.

tomasbjerre avatar tomasbjerre commented on August 29, 2024

Looks like: tomasbjerre/violations-lib#40

Can you get rid of the relative paths?

from violation-comments-to-stash-plugin.

stoesselt avatar stoesselt commented on August 29, 2024

So the relative path of the compiler warning is transformed properly, by script in Jenkinsfile before the plugin parses it.

Do you mean the relative path from pump/and-so-on ? This is toplevel folder from repository, so I think this is correct.

from violation-comments-to-stash-plugin.

tomasbjerre avatar tomasbjerre commented on August 29, 2024

Try to make this:

../../source/gui/controls/ListView.cpp:39:61: warning: default argument given for parameter 2 of 'pfm::ListView::ListView(const PegRect&, PEGUINT)' [-fpermissive]

Change to:

pump/source/gui/controls/ListView.cpp:39:61: warning: default argument given for parameter 2 of 'pfm::ListView::ListView(const PegRect&, PEGUINT)' [-fpermissive]

from violation-comments-to-stash-plugin.

stoesselt avatar stoesselt commented on August 29, 2024

Yes, I do so, as written in both previous posts...

from violation-comments-to-stash-plugin.

tomasbjerre avatar tomasbjerre commented on August 29, 2024

Ok! I think it is something happening in this method: https://github.com/tomasbjerre/violation-comments-to-bitbucket-server-lib/blob/master/src/main/java/se/bjurr/violations/comments/bitbucketserver/lib/BitbucketServerCommentsProvider.java#L157
Returning false when it should return true in this case.

I guess you don't want to post the result of rest/api/1.0/projects/P2/repos/code/pull-requests/48/diff?limit=999999 here? But if you email it to me, I can try to reproduce it with a unit test.

from violation-comments-to-stash-plugin.

tomasbjerre avatar tomasbjerre commented on August 29, 2024

[email protected]

from violation-comments-to-stash-plugin.

stoesselt avatar stoesselt commented on August 29, 2024

The url returns the changes for the first 6 changed files only. Changes of the ListView.cpp are not included. I will try to retrieve the information and I will have a look to the code you pointed out.

from violation-comments-to-stash-plugin.

tomasbjerre avatar tomasbjerre commented on August 29, 2024

Only first 6 changed files!? This code will assume all files are retrieved, unless more than 999999 changed files.

It happens here: https://github.com/tomasbjerre/violation-comments-to-bitbucket-server-lib/blob/master/src/main/java/se/bjurr/violations/comments/bitbucketserver/lib/client/BitbucketServerClient.java#L97

from violation-comments-to-stash-plugin.

tomasbjerre avatar tomasbjerre commented on August 29, 2024

Possible fix might be to use bitbucket-rest: cdancy/bitbucket-rest#158

from violation-comments-to-stash-plugin.

tomasbjerre avatar tomasbjerre commented on August 29, 2024

@stoesselt Would you say this is a major issue? If it only happens for very big PR:s then maby it is just a minor.

from violation-comments-to-stash-plugin.

tomasbjerre avatar tomasbjerre commented on August 29, 2024

Perhaps an acceptable solution is to introduce logging when this happens, with a short explanation.

from violation-comments-to-stash-plugin.

stoesselt avatar stoesselt commented on August 29, 2024

I don't know what impact it has for the plugin when you declare this as a major. However, this issue makes me not to rely on the automatic comments anymore. I will check the Jenkins reports manually as workaround.

I doubt that this issue concerns only very big changes, but also medium changes. I mean, in my case I had hundreds of changed files. Nonetheless only 6 changed files were retrieved. Ok there were a lot of changes in these 6 files. But think of another case, where maybe the half of the change is retrieved and some comments are generated and the others not. I got distrustful because no comment at all was made. If some where added, I would believe the other files are ok, but oversee violations.

I followed your question on bitbucket-rest. It does not seem to be a solution.

  • Is there a way to retrieve the changed lines somehow else from Bitbucket?
  • Would it be an option to get the information from local git repository? I think this would break pull requests which cross repositories.

from violation-comments-to-stash-plugin.

tomasbjerre avatar tomasbjerre commented on August 29, 2024

It would be possible to get it from local repo, if it was always a merge commit to look at. But I think some people rebase source onto target or perhaps fast forward source to target... I think it may generate support issues.

I don't think you are using Maven or gradle, but I have made offline solutions for that:

Perhaps a fix would be to change http://localhost:7990/bitbucket/rest/api/1.0/projects/PROJECT_1/repos/violations-test/pull-requests/1/diff to several requests, one per file, like:
http://localhost:7990/bitbucket/rest/api/1.0/projects/PROJECT_1/repos/violations-test/pull-requests/1/diff/src/main/java/se/bjurr/violations/lib/example/MyClass.java

If you do rest/api/1.0/projects/P2/repos/code/pull-requests/48/diff/pump/source/gui/controls/ListView.cpp you will probably not get a truncated response right?

from violation-comments-to-stash-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.