-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 01.08.2013 14:13, Dr. Trigon wrote:
On 01.08.2013 13:33, info@gno.de wrote:
Hi folks,
unfortunately the git Id numer is not a sequential release number as in svn but a hash. I find it a good idea to have a release number in the code as it was before git migration. A git statement generates it:
git rev-list HEAD | wc -l
which is the revision number. A better idea would be the gerrit number which gives us the last and actual change for that code. It is posible to merge such a number to the __version__ header of the script instead or in addition to the hash?
I looked this up already. The answer is given in [1] (and more in [3] and [2]), in short:
1.) You probably don't want to do this. Using git describe is a reasonable alternative. 2.) If you do need to do this, $Id$ and $Format$ are fairly easy. 3.) Anything more advanced will require using gitattributes and a custom filter. I provide an example implementation of $Date$.
That was the reason why I activated $Id$ ("fairly easy"). As I understand, what you want to do (I also would like to see ;) needs "using gitattributes and a custom filter" in [1] somebody provided an example implementation of $Date$. I strongly support this, but assmue we might need to use another keyword than $Id$, e.g. $Rev$ or $Ver$?
[1] http://stackoverflow.com/questions/39742/does-git-have-anything-like-svn-pro...
[2]
http://stackoverflow.com/questions/11534655/git-keyword-substitution-like-th...
[3]
http://git-scm.com/book/en/Customizing-Git-Git-Attributes#Keyword-Expansion
Meanwhile
I had time to have a close look to this and was able to implement [1] for compat and [2] for core.
[1] https://gerrit.wikimedia.org/r/77554 [2] https://gerrit.wikimedia.org/r/77555
This allows to use $pwbId$ like $Id$ before and even more to implement further such keywords if needed. The drawback is that during a checkout all files are touched and for each 2 calls to git shell command are invoked (which takes time). However if you like to enable this feature in your local repo please confer "4. optionally/opt-in further settings:" in [3] and run:
For compat: $ git config filter.rcs-keywords.smudge maintenance/rcs-keywords $ git config filter.rcs-keywords.clean 'maintenance/rcs-keywords --clean'
and for core the same, except you have to omit "maintenance/". See [3].
[3] http://www.mediawiki.org/wiki/Manual:Pywikipediabot/Gerrit#Example_.28step-b...
Greetings and enjoy! DrTrigon