[Kmymoney-devel] [kmymoney] /: Add generation of version suffix for Git based repository

Alvaro Soliverez asoliverez at kde.org
Fri Nov 11 11:55:40 UTC 2011


Hello all,
keep in mind that the branch name in git doesn't mean squat. The only one
thing that can identify the proper version is the commit id. The id
guarantees a specific parent. If rebased, the commit id will change.
However, you can have n number of branches, named the way you want, and
they could have stuff that doesn't really match the "branch name".

To give a proper example:
- at this moment I have a repository of Telepathy in my local PC. The
repository has 3 branches: master, upstream, android
Upstream contains stuff from the fd.o repository (eg. master on the public,
well-known repository in freedesktop.org), master branch contains stuff
from an old closed repo I have worked on stuff for a client, and android is
a branch I'm using to merge both master and upstream branches to prepare
patches.

Git brings in a different way of thinking, and some stuff no longer has the
meaning we'd expect it too in other source repositories.

Regards,
Alvaro


On Fri, Nov 11, 2011 at 8:40 AM, Thomas Baumgart <thb at net-bembel.de> wrote:

> Git commit a7dfac98ae4f913f43e55ff318f7f00806d2a215 by Thomas Baumgart.
> Committed on 11/11/2011 at 12:40.
> Pushed by tbaumgart into branch 'master'.
>
> Add generation of version suffix for Git based repository
>
> M  +16   -0    CMakeLists.txt
>
> http://commits.kde.org/kmymoney/a7dfac98ae4f913f43e55ff318f7f00806d2a215
>
> diff --git a/CMakeLists.txt b/CMakeLists.txt
> index 95da58a..3a3bd82 100644
> --- a/CMakeLists.txt
> +++ b/CMakeLists.txt
> @@ -40,6 +40,22 @@ IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.svn)
>   SET(ENV{LANG} ${LANG})
>  ENDIF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.svn)
>
> +# Determine the GIT reference (if we're based on GIT)
> +IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
> +  # make sure we don't use translated messages here
> +  SET(LANG $ENV{LANG})
> +  SET(ENV{LANG} "C")
> +  EXECUTE_PROCESS(COMMAND git log -1 COMMAND head -n 1 OUTPUT_VARIABLE
> BRANCH)
> +  # extract branch name
> +  STRING(REGEX MATCH "commit ([^$]+)" BRANCH "${BRANCH}")
> +  SET(BRANCH ${CMAKE_MATCH_1})
> +  # and use the first 10 chars of the commit id
> +  STRING(SUBSTRING ${BRANCH} 0 10 BRANCH)
> +  SET(VERSION_SUFFIX "-${BRANCH}")
> +  # switch back to the original language setting
> +  SET(ENV{LANG} ${LANG})
> +ENDIF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
> +
>  ######################### General Requirements ##########################
>
>  # setup default CMAKE_INSTALL_PREFIX before calling FIND_PACKAGE(KDE4)
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kmymoney-devel/attachments/20111111/bdc406c1/attachment.html>


More information about the KMyMoney-devel mailing list