[SOLVED] QtCreator: git question concerning switching between releases of a project



  • Our company has just recently switched from using CVS to GIT and I'm trying to become familiar with GIT and how well QtCreator plays with it.

    I need to often switch between releases of our project. In the CVS world, I would simply checkout different versions of the project in different directories and then create a QtCreator session for each.

    With GIT, I could do the same but:

    • GIT clones the full repository... so having multiple instances of my projects full repository on my system seems pretty silly
    • I really like the concept of "git checkout" and how it simply changes all my files in place.

    I have been using "git checkout [branch-name]" but each time I checkout another release I have to do a full recompile.
    For instance,

    say I've been working on version 1.2 of my project.

    -[git checkout project-1_2]
    -Do some work
    -Compile, run, make sure it works
    -git commit -a

    Now I have to jump over to version 1.1 to trouble shoot an issue a client is complaining about

    -[git checkout project-1_1]
    -clean my project (to get rid of all the 1.2 build files and binaries)
    -Rebuild
    -Troubleshoot problem
    "That's not a defect, it's a feature"

    Now I want to go back to version 1.2 to continue what I was working on

    -[git checkout project 1_2]
    -clean my project (to get rid of all the 1.1 build files and binaries)
    -Rebuild
    -Continue where I left off prior to getting interrupted with the 1.1 issue.

    My wish is that in step 3 I can simply checkout my previous version and continue working on what I was working on prior to getting interrupted... without having to clean and recompile my whole project (which can take some time).

    Does anyone have any suggestion on how to do this?


  • Moderators

    The trick is having separate shadow build directories for the different versions of the project.

    I do have a separate repository for each version of Qt Creator I have to work with. I am on Linux and git uses hardlinks when cloning a local repository, so cloning from a local repository is really fast and does not take too much storage.

    Each version is set up to shadow-build into a special location, so I don't have to continuesly rebuild (even though rebuilding is pretty fast thanks to "ccache":http://ccache.samba.org/ ;-).

    You could also have separate build configurations for each version they care about. Each has a separate shadow build directory set up to avoid the recompilations.

    You could improve on that by adding a custom build step as the first thing that any build does: It checks whether the current version is based on the head of the version-branch and if not checks out the version-branch. Switching is then a matter of changing the buildconfiguration and hitting ctrl-B to build the project.

    There also is a scripting plugin in development for Qt Creator... which would help to automate such work flows further. It is a 3rd party plugin, so I am not sure when/whether it will get contributed, but we would really love to see that:-)



  • [quote author="Tobias Hunger" date="1328720758"]The trick is having separate shadow build directories for the different versions of the project.
    [/quote]

    Ya, but to do that I would need to save the *.pro.user in my repository... right? That or manually change the shadow build location every time I switch branches.

    [quote author="Tobias Hunger" date="1328720758"](even though rebuilding is pretty fast thanks to "ccache":http://ccache.samba.org/ ;-).[/quote]

    Haven't heard of ccache. I'll have to check that out!


  • Moderators

    No, the .user file mostly contains the project data (everything you see in Projects mode).

    You can set up a shadow build directory per build configuration you have (in fact that is done by default for non-Symbian builds).



  • [quote author="Tobias Hunger" date="1328773916"]No, the .user file mostly contains the project data (everything you see in Projects mode).

    You can set up a shadow build directory per build configuration you have (in fact that is done by default for non-Symbian builds).[/quote]

    Gotcha, now I understand.

    I've got ccache up and running (really slick!). Also I've figured out how to set up my build configuration. All I need to do now is figure out a way to have that conditional build step that only checks out the branch if it's not already checked out.

    Thank you for your help!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.