0

I would like to find out which commit in QGIS code caused a certain change in behaviour. Since the archives at http://download2.osgeo.org/osgeo4w/release/qgis/qgis-dev/ are not complete, I think that the best would be to compile the source code and generate a snapshot of qgis-dev at certain commits that are suspected to have caused the change. How should I proceed, if I want to try e.g. to make a binary of QGIS based on the following snapshot tree: https://github.com/qgis/QGIS/tree/0b9d1dc49b?

Both, Linux and Windows suggestions, are welcome.

2
  • 1
    Using Git, you could checkout to a particular commit, and build from there. Is that enough? May 19, 2015 at 11:24
  • Yes, indeed, this was the information I was looking for but I would not understand it without the detailed answer posted below by Matthias.
    – Pavol
    May 21, 2015 at 9:33

1 Answer 1

2

The term master is just a pointer to a commit in git. It will always point to the latest commit on the branch called master. If you have the git repository cloned locally you can checkout a specific historic version by just entering

git checkout {sha1}

e.g.

git checkout 0b9d1dc49b

and then run make or trigger a build in your IDE.

For the particular usecase you describe, there's a functionality in git which is called git bisect. It will take a known-good and a known-bad revision as start and then checkout versions to test for you in between to find the commit responsible for something.

git bisect start git bisect bad [<rev>] git bisect good [<rev>...]

Compile... Test (It's good)...

git bisect good

Compile... Test (It's bad)...

git bisect bad

If you are able to test with a script if a commit is good or bad, you can read the documentation behind the link from above to see how to let git do all the work for you without the requirements for manual testing of each commit.

3
  • This looks to be exactly what I needed! I tried "git checkout" and received the message "checking files ... done", yet I did not manage to produce a binary so far. My old linux computer collapsed while building it and my windows computer keeps reporting errors and aborts the compilation. Yet, I suppose these are "internal" problems and I will try to resolve them and I will report back as soon as I find out which version was compiled...
    – Pavol
    May 20, 2015 at 8:14
  • I am getting a sip error that was described at: gis.stackexchange.com/questions/71027/…. The proposed fix is outside of the time period I am interested in. Is there a way to downgrade sip, in order to compile exactly the commits I need?
    – Pavol
    May 20, 2015 at 12:18
  • 1
    You could cherry-pick the commit. Or disable python by setting WITH_BINDINGS to OFF in cmake (cmake -DWITH_BINDINGS=OFF). May 20, 2015 at 17:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.