I’m making use of an open source project that is changing quite frequently. It is necessary for me to always have the latest version with all changes and bug fixes.
The source code has been adjusted to make it do what I need. So it now contains my own code as well. Whenever sth changes, I currently manually read what changed in the changelog or compare files and then copy and paste everything into my own files. This is quite time consuming.
So now I was thinking about using a different approach:
- Instead of long code snippets, only insert function calls and keep all of them in a separate file. Add this file to the make system.
- If the source code changes, download it and re-insert all the changes automatically
- Recompile, done
This way I can now compare old and new (untouched) versions with the original source code and see what has changed between the state of the code that I used and the new one.
My question is for step 2:
Line numbers might change if additional code is added. How can I find the right positions to inject my own functions?
Do as the Jonathan says. Use source control.