Affichage des articles dont le libellé est Git. Afficher tous les articles
Affichage des articles dont le libellé est Git. Afficher tous les articles

vendredi 25 janvier 2013

BuildNumber Component for Yii framework

Today I have committed the build number component for Yii framework.

This component is very simple but yet powerful and useful for industrial and enterprise-wide applications.



The project is hosted on GitHub - https://github.com/yev/yiiGitBuildNumber

jeudi 9 février 2012

Maven BuildNumber plugin - short revision id for Git

Today, I would like to explain the improvement for maven plugin - buildNumber, that I talked in my previous message - short revision id for Git SCM.

IMPORTANT : This feature is present in the maven-buildnumber-plugin 1.1 version.

You can specify the length for the Git revision. To enable this feature you have to specify the new tag
<shortRevisionLength>
in the
<configuration>
section. For exemple:

The associated maven output informs us about the detection of shortRevisionLength tag and print the length of the revision that will be used in buildNumber formatting:


Some implementation details

This feature uses internally the git rev-pasre --short (see associated git help section) command and the revision length is set to minimum 4 characters. So you can't have the revision id shorter then 4 characters. Even if you specify the length between 0 and 4, the plugin will inform you about this situation and the minimum value (4) will be used.

UPDATED: If your maven build can't find the dependency for maven-buildnumber-plugin 1.1 , try to force the dependency update  by adding option "-U" for your mvn command.

mercredi 8 février 2012

My first Open Source commitment - Git short revision

Today, my patches for 2 maven projects have been accepted by the maven-buildNumber-plugin's project lead Olivier Lamy.

One of the web Java project, I currently working on, is fully automated with Maven. One interesting and useful thing is to have the date & the revision number at the bottom of the web page. Like this:
It was done with excellent maven plugin buildNumber - http://mojo.codehaus.org/buildnumber-maven-plugin

The problem was that the project SCM migrated from the SVN to Git. And the revision ID in Git is too long. In fact it's SHA-1 sequence that should be unique across the world and all possible revisions... So the build id at the bottom of the page was so ugly for business users that I receive the task to make it shorter.

After asking the question about the git short revision id in StackOverflow.com and in the user's mailing lists of the maven, I understood that the buildNumber plugin does not support this feature. And the project Lead, Olivier Lamy, gracefully proposed to me to make a patch and pointed out the first java class I have to look at.
The code he sent me was very clear and I quickly figured out how to add the new feature that I called shortRevisionLength.
After one day of working I have sent the patch to Olivier and created 2 issues on the codehouse JIRA server:
  1. http://jira.codehaus.org/browse/MBUILDNUM-86
  2. http://jira.codehaus.org/browse/SCM-664
I added some test cases and the documentation patch as well.

The next day the patch has been approved and integrated in the SVN. So, the next version of buildNumber plugin 1.1 contains some peace of code from Ukraine :) Nice.

mercredi 25 mai 2011

Git killer features

After 3 weeks of working with Git (the DCVS written by Linus Torwalds), I definitely can say that it is a great technology.

If you are asking yourself what you need to learn right now? What is the next major revolution in the IT world? Maybe, the answer will be Git.


What are the killer features of Git for me:
  • Distributed – I can develop normally even without Internet and access to the central repository. It’s a great feature to make small and concise commits while developing at home, during the weekend.
  • Rich history revision mechanism – the search within the log-history is wonderful. With
    git log –sSecurityManager
    I can find, for example, all commits that introduce or remove the SecurityManager class. Attention, the search is performed on the source code and not on the commit log. It’s a best tool for making the code live analysis.
  • Git bisect – automatically find a failing commit using the binary search and a set of unit tests. If you don’t use the CI server (shame on you :)), you can nevertheless quickly find a bad commit. Git bisect command will run the tests against the project snapshots. Each snapshot is associated with a particular commit. I did not try to use this command yet. But, the concept is great.
  • CMD – git is a command line based tool. You can script the commands, make aliasing etc. CMD speed up your productivity. Of course, for making the merge it’s not so trivial, but the guys from Eclipse will soon release a completely functional version of the plugin eGit.
  • git cherry-pick - reintegate an existing commit to the current branch. How many times you have forgot to switch to the correct branch before making a commit? I have been confronted with this painfull mistake quite often. Now you don't have to report your commit manually to the correct branch. The magic cherry-pick command will make it four you!

I have worked with git on Windows and Mac. Git for Mac is a stable and I have not noticed any problem. It is not the case for Windows...

Git remote tags problems

For running Git on Windows box, you have to install msysgit (I used 1.7.4.msysgit.0). The one problem I encountered with msysgit, it was that I could not push my tag to the remote repo. The command
git push --tags origin master
did not create a tag remotely. The same command executed on Mac did the job correctly
.

Git - pdf book about git

I can recommend to download a free PDF book "Git Community Book" about git from http://book.git-scm.com

As long as I learning Git, as more I understand its powerfull.