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

Generate diff between two versions of the same code #33

Open
webmozart opened this issue Jan 9, 2014 · 3 comments
Open

Generate diff between two versions of the same code #33

webmozart opened this issue Jan 9, 2014 · 3 comments

Comments

@webmozart
Copy link

I'm currently looking for a tool which is able to generate a machine-readable diff between two versions of some code and was pointed here by @beberlei. For example, if a parameter $foo was added to a method \Vendor\Foo::bar(), the generated diff should mention all other relevant information (type hint, default value, position) that is needed to reproduce the change.

My idea is to use this diff in another tool in order to automate refactorings. For example, if a dependent project uses \Vendor\Foo::bar(), I want to automatically perform the necessary changes (as far as possible) to make it compliant with the new version of that method.

Do you think changetrack could be able to do this?

@tobyS
Copy link
Member

tobyS commented Jan 9, 2014

Thanks for your feature request. I'm not sure, if it really fits to ChangeTrack.

At least from an infrastructure perspective, ChangeTrack already provides quite some of the technical requirements to determine API changes between to revisions of a library: It can detect that a certain method has changed and it uses staticReflection which can provide you with the typing information of parameters.

I could imagine to add a new command (compare?) to ChangeTrack, which performs your comparison.

However you should be aware that there are some problems involved, from which ChangeTrack suffers in general. The biggest one is to track that a method was renamed or moved, for which I did not find a solution, yet.

Do you already have code which performs some kind of automatic refactoring? Maybe https://github.com/QafooLabs/php-refactoring-browser could be a place to move that code?

@webmozart
Copy link
Author

I think that command could be called diff.

Yes I have seen this refactoring tool. After talking to @beberlei I'm not sure however whether it is capable of performing these refactorings, nor if any other PHP solution is able to do so in a timely manner.

@tobyS
Copy link
Member

tobyS commented Jan 9, 2014

Well, that of course depends on what you expect a "timely manner" to be. ;) But that should be discussed over at the refactoring browsers side.

api-diff would be the best name, I guess.

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

No branches or pull requests

2 participants