-
Notifications
You must be signed in to change notification settings - Fork 39
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
Get diff between specified commits #87
Comments
It looks like this is something both git and SVN support. I think an API for this can be added to the SCM interface without too much difficulty. @ayaankazerouni Want to try a PR for the git path? |
Yeah, I don't mind putting some time into it. |
@mauricioaniche any thoughts or pointers? |
How do you see one using this feature? You are visiting commits, and you need the diff between X and X - 3, let's say? And you need to do this over time, and that's why you need this feature in repodriller? I agree that |
My imagined use case is you've identified two commits of interest with a variable amount of time between them, and you need the diff. I don't really have to do anything 'over time' except identify the two commits of interest. One could argue that repodriller need not support this; I thought it might provide a convenient wrapper around JGit's diffing functionality (which is not difficult, but kind of tedious to implement). |
So @ayaankazerouni if I understand correctly: During your RepoDriller scan you identify a bunch of pairs of commits of interest <X_i, Y_i>. While visiting each commit Y_i, you'd like your analysis to include "How different are X and this Y_i"? This seems like a reasonable question to want to ask. I don't think you can ask it smoothly right now as part of the RepoDriller interface. At the moment it looks like you would have to print all the <X_i, Y_i> pairs during your CommitVisitor and then do post-processing outside of RepoDriller, or do a bunch of JGit etc. hacking in your CommitVisitor. |
@mauricioaniche Can you clarify when to put functionality into the |
Sounds good to me, then! @davisjam I meant |
@mauricioaniche -- I have some questions about the format in which we want the diff information returned. Do we want to return a list of |
There is some relevant discussion in #62. |
Sounds like something I can add as part of this pull request. |
Agreed, seems like a good fit. Some clarity on the relationship between Diffs, Modifications, Commits, etc. in the Javadoc would also be helpful. |
I'd say we should avoid exposing JGit details out of At this moment, I'd say either returning a simple String or repodriller's diff classes would be good. Then, as soon as we get more people using this feature, we'll make it better for them! |
Ok, I'm returning a list of |
List of modifications? Not sure if I understood. I thought the goal was to return the diff between version A and B! |
While visiting commits, we use EDIT: See the latest in #90 to see what I mean. |
The goal is to return the diff between commit A and commit B, yes. This can be done either by:
I like 2 better. 1 seems too fine-grained and hard to define. 2 seems straightforward to work with. I note, however, that since the RepoDriller idiom is that you are visiting a sequence of commits, it might make sense to have the diff here be between the commit you are visiting and the specified commit. I don't see a nice way to manage that given that CommitVisitor is an interface, not a class for which we can define private state, so offering the more general diff may be the best option. |
I do not see Repodriller returning a list of I'd rather model it as an utility method, e.g., Does that make sense? |
Modification or DiffEntry is fine, I'm not sure of the difference yet. Not a String though, per #62: why provide a String when we have better options? |
I agree with @davisjam, I'm not certain what the difference would be. My intuition is that anyone using this diff will probably turn it into a Modification or DiffEntry or something anyway, instead of interacting with it as a String. |
Ah, that's why I couldn't find Since a CommitVisitor gets an SCMRepository<->SCM, SCM needs to offer an abstract diff type. Review of the source suggests that A String is the most portable between SCMs, but since a Modification offers a String we've got that covered. So +1 for returning a |
Sorry for the confusion, I do not know all the class names by heart. It definitely does not make sense to pass JGit's internals to outside. However, our model contains
What kind of diff are you talking about ? If you are talking about the text-based source code diff, then, |
This is the type I'm talking about. I would like to interact with the diff the same way as we do in |
Go for it! Let me know when the PR is done! :) |
Ok PR #90 should be ready for review and merge now. |
LGTM. Nice job. |
Thanks! I'll review it soon!! :) |
This is a feature request. I'd like a way to get the diff between two specified commits.
The text was updated successfully, but these errors were encountered: