code's life

Better Code, Better Life

Follow me on TwitterRSS Feeds

  • Home
  • About
image.png

implement git-model in gitolite – 1

Sep 2nd

Posted by larrycai in tool

No comments

As I mentioned before http://nvie.com/git-model really gives a start point for you to arrange the branch disciplines for your product development, the main concepts are

  • long lived master/develop branch existing on central repository, it is similar to one branch concept to force every develop teams to work together. master branch is used for official only, and mainly develop branch is for teams
  • supporting branch (feature/hotfixs) exists short-live only, they probably should be controlled not so much to mess the central repo.

image

Since we use gitolite now, therefore, I try to map it to rules in gitolite, the use case are

  • master branch and tags are managed by special team (like configration management team) with all permisson
  • team members (like gear team) work towards develop branch.
  • everyone (except admins) have no permission to create other branch.

I take a look at the document in gitolite http://github.com/sitaramc/gitolite/blob/master/doc/3-faq-tips-etc.mkd#security_access_control_and_auditing, and have below in hands (part of conf/gitolite.conf)

@gearteam = alice bob charlie dave
@cmteam   = euler
@admins   = user
repo    app
    RW      master$         = @cmteam
    RW      refs/tags       = @cmteam
    RW      develop$        = @gearteam
    RW+                     = @admins @cmteam

And I made a quick test using alice and euler account, seems working ;-) , I am checking with gitolite google group to get support to see whether it fullfils my needs.

[updated: corrected by sitaram, originally I treat the supporting branches exist in local only]
[updated: corrected by sitaram, it should be develop$ instead of develop to avoid develop1, develop2..]

git, gitolite
image.png

Why people select github/google code instead of sourceforge

Aug 27th

Posted by larrycai in Agile

No comments

I am big fans of opensource development, and sourceforge.net is my favorite before, not now.

When sourceforge is started, it opens the door for lots of designers to share codes, and most of popular tools are host there, now you can notice most of projects are started to host in http://github.com and http://code.google.com , (not touch http://bitbucket.org now), what is the reason ?

Is it because github provides git and google code provides mercurial (hg) ? No, I don’t think so, one reason is that github, google code provides wanted features quickly and nicely.

Let’s start a project

Normally you need request the project and fill something (category) and start to introduce the project (since it is where user will access).

  • In github, most people will use README or README.mk (better) to describe what it is, see http://github.com/nvie/gitflow
  • In google code, people will use wiki to describe it, see http://code.google.com/p/msysgit/
  • In sourceforge, either small sentence or create own webpage, see http://sourceforge.net/projects/sevenzip/ , if create own-webpage, then you need lots of time to make it nicely.

clean homepage and fast access, it is more like iPhone and other phone, yes functionality is almost the same, but the user experience is total difference.

Other features

Let’s show other nice features in github, every feature you can find it in sourceforge, just slow and not user friend.

online edit: When I browse code in github, sometimes I want to make small changes, I can do it in github and it is treated as one commit

online comments: it is kind of quick code review function

support markdown format: show the document easily, it can avoid write information in seperate place, this is a reason most project in github don’t use wiki, see http://github.com/progit/progit/blob/master/en/01-introduction/01-chapter1.markdown

issue track: this is embedded into github, but most of people select google groups

Networkimage feature

This is a most excellent feature in github to encourage sharing codes but still keep the relation and credits to the origin, this feature is quite unique, it exist in github only and based on git.

All the forks in github are related into one network, you can clearly see where it comes from and what’s  change in other place.

bitbucket, git, github, mercurial
image.png

CSS – small tips

Aug 25th

Posted by larrycai in tool

2 comments

I have one document white in markdown format, and when it is converted into HTML, it is quite long (>20 pages), I need to print it out to read it . (I am not used to read e-paper before I got iPad).

Then I meet several problems

Width of some pictures is too long

image It is so wide (>1024px), after print it out, it make the normal paragraph narrow, it looks urgy.

Surely I can using my favorite gimp to change the size, but it means I need to change a lot of files, I can also set the <img “width=640px”> like to push to this size, but I also have pictures in small size, I don’t want them to grow as well.

Can we handle this in CSS, my CSS expert JiHao say yes, after google, the correct way is using “max-width”, simple but it works.

img { float: none; max-width:640px; display:block;}

Show difference in printer and web

There is a media tag in css, and screen is for browser, projection is for projector and print is for printer, and there are other media, it more depends on browser.


<link rel="stylesheet" href="css/blueprint/screen.css" type="text/css" media="screen, projection">
<link rel="stylesheet" href="css/blueprint/print.css" type="text/css" media="print">
How to make page break

In M$ Word, there is page break, and it is similar one (page-break-before in CSS, but when I try it, it seems available for IE only

<style type="text/css" media="print">

        p img { float: none; max-width:640px; display:block;}

        h1 { page-break-before: always; }

</style>

Then it in printed out document, it is well formatted.

One thing left, how to make sure the image is not acrossed into two pages ?

css

git – manage your different git account from different access

Aug 20th

Posted by larrycai in tool

No comments

When you are using git, you need work towards public and private git repository (if u r open source fans), then you need configure different account for this.

And also you may have different account for git repository, which you don’t want to share the same private key, like user in virtual machine with windows machines.

Different git account

This is simple, just remember there are two level account configuration, one is in ~/.gitconfig, which is set like

git config --global user.name “Larry Cai (company id)”

git config --global user.email larry.caiyu@company.com

And in each git repository, you can also overwrite the global config
git config user.name “larry cai”

git config user.email larry.cai@privatemail.com

and this data is stored in <repo>/.git/config
 

You just need to judge which is preferred in global, simple and very useful, normally company doesn’t recommed to use company email in public.

Different key prase for different access

One user for many keys, it may depend on your git server tool, in gitolite, I simple create my key prase pair in virtual machine (same account like larrycai), and send the public key and saved as larrycai@virtual.pub then gitolite will treat them as same user to my normal larrycai.pub

See http://github.com/sitaramc/gitolite/blob/master/doc/3-faq-tips-etc.mkd for more

git
image.png

CSS – sprites, manage images

Aug 18th

Posted by larrycai in tool

1 comment

Nowadays, most of webpages are powered by CSS, you seldom see “<table><tr>” those HTML tags, instead, use “div” and control the display in CSS. I don’t want to repeat CSS basic, instead give some small tips on this area.

For the image in CSS, besides normal set like

   1:     background:url("../images/ebottomgrad.jpg") repeat-x scroll 0 0 transparent;


Typically there are lots of small pictures are installed under “images” directory, it also decrease the performance.

“sprites” method is used to solve this problem, let’s see example:

image

This is a menu image used for gitorious, it contains all item including different color (usage) for them, then in CSS, you can get them like below.

   1: #top #menu li a {

   2:     background: url(../img/external/menu.png) no-repeat;

   3: }

   4:  

   5: #top #menu li.home a { 

   6:     background-position: 0px -22px; width: 40px; 

   7: } 

   8: #top #menu li.home.active a { 

   9:     background-position: 0px -11px; 

  10: } 

  11: #top #menu li.home a:hover { 

  12:     background-position: 0px 2px; 

  13: }

quite simple and powerful, isn’t it ?

It is also good for UI designer to draw those kind of pictures in one place.

Reference (just google)

- http://www.svidgen.com/sprites

- http://www.alistapart.com/articles/sprites2

And remember this technology exists for long time (>5 years), but still some designers don’t notice this

css

git – how to backup feature branch ? – 1

Aug 16th

Posted by larrycai in tool

No comments

imageIn Vircent’s A successful Git branching model, he recommends to create master/develop branch in central repository only. This is very useful for git in enterpreise to control the branches in central especial in the beginning.

It also means the feature and other supporting branches are short-alive branch and located in person notebook only, it is risky for feature branch because if the PC is dead or lost, the work disappears.

Vircent didn’t discuss this a lot, and one way that gitolite provides is person branch (see http://github.com/sitaramc/gitolite/blob/master/doc/3-faq-tips-etc.mkd#personal_branches)

In gitolite.conf, we can define like below

   1: repo    myphone

   2:         RW+                     = larrycai

   3:         RW+ personal/USER/      = @userlist

Then for larrycai, some work are done in feature1 branch and backup to private repo in central

   1: $ git checkout -b feature1

   2: # develop feature1

   3: $ git commit -am "test feature branch"

   4: $ git push origin feature1:refs/personal/larrycai/feature1

For other user then can do below for get this branch

   1: $ git clone git@gitserver:myphone

   2: $ cd myphone/

   3: $ git fetch origin refs/personal/larrycai/feature1:feature1_from_larry

   4: $ git branch -a

   5:   feature1_from_larry

   6: * master

   7:   remotes/origin/HEAD -> origin/master

   8:   remotes/origin/master

   9: $ git checkout feature1_from_larry

  10: # yes, we get it.

See details in http://www.kernel.org/pub/software/scm/git/docs/git-push.html to understand more for git push command.

There are two issues I need to think about besides understanding git push command

  1. How to cooperate with feature branch in the team ? via extra repo ? or this personal repo ?
  2. How to know whether there is person branch existing in gitolite
git, gitolite

my old text2html tool – htmlpp, who knows it ?

Aug 4th

Posted by larrycai in tool

No comments

After quickly writing the draft of “Git deployment guideline” which will be my major task in this month, i start to play with markdown (Markdown – another format to write document) again. (editor, converter..)

And I notice actually I am super fans of text2html, I found my old homepage since 19xx ;-)

The webpages are written in plain text (mix some html tag) like below and generated with scripts

   1: .H3 Internet & WWW

   2: <UL>

   3: <LI>$(*htmlpp=Htmlpp) is a pre-processor for HTML documents , 

   4: this homepage is generated from this tool. Its purpose is to 

   5: simplify the work of writing and packaging large numbers of 

   6: HTML documents. I just write <TT>$(*filehtp=rdccaiy.htp)</TT>. 

   7: and use htmlpp to generate all the homepages . You can 

   8: download the unix version from $(*imatix=Imatix web site) .

   9: </UL>  

It is very interesting that the htmlpp application (http://legacy.imatix.com/html/htmlpp/) still existing, though I can notice it is not updated any more after my usage.

htmlpp, markdown
image.png

Markdown – another format to write document

Aug 3rd

Posted by larrycai in tool

1 comment

imageDuring the git-svn study, I notice there are lots of document in github are in markdown format, and showing in html looks very concise like wiki page.

Wikipedia gives excellent definition for markdown, see http://en.wikipedia.org/wiki/Markdown

Markdown is a lightweight markup language, originally created by John Gruber and Aaron Swartz to help maximum readability and "publishability" of both its input and output forms. The language takes many cues from existing conventions for marking up plain text in email.

Let’s compare it to other my used document format

Compare to M$ Word, it is plain text, easy to write and controlled by version control system, and best of all, it lets me focus on content instead of format

Compare to Wiki, the format is quite similar, and markdown is a file, it means, I can easily put into svn/git and publish in other place, wiki system force in most of time to write online

image Compare to Docbook (http://www.docbook.org/) it is a plain text instead of xml format, it can help me to focus on the contents I am writting and reach to “publishability”, since it is more readability from the source, for docbook, mostly I need to generate html to see what it looks like, or rely on my software like

Compare to apt (http://maven.apache.org/doxia/references/apt-format.html), the format is quite similar, markdown seems more popular and well acceptable by community and it is better for publishability.

And always remind myself, “how to write the information is more important than choosing tools” ;-)

apt, docbook, markdown, wiki
image.png

svn-git integration (6), handle one repo with multi projects

Jul 23rd

Posted by larrycai in tool

No comments

In software development, the most challenge thing is when you solve one problem another new problem comes out quickly, it demands you to find the solution in smart way.

image

Like my svn-git study

In normal standard product setup, it seems most of problems solved, yesterday when I look into the real svn repository, Wooh, it is different, it use multi projects in one repository, and in svn, probably this is also “standard”, but this is not friendly to git.

Since git is designed to be one repo, one project, and all the study I did before is try to map master branch (git repo) to svn trunk (svn repo), now we have several (more than 30) projects, then it is tricky.

One possible solution is to create git repo for every project, and for local git repository, I can create the scripts to rebase and initialize them easily, but it will be difficult to commit back and push to git main repository, managing so many repos is also a complex tasks.

The good things is normally one designer only face to 5 projects.

Another possible solution is treat them as one big repo, then every designer will see trunk, tags, branch directly in file directory, this is not nice.

So what ?

Probably I need to give up git-svn integration transition phase and cut to git directly, since for this kind svn repo, it goes to complicated,  when it is complex, more problems will pop up when implement them.

See reference:
* http://stackoverflow.com/questions/2732020/git-repository-layout-for-server-with-multiple-projects
* http://stackoverflow.com/questions/3075171/importing-subversion-to-git-problem-with-subpaths

git, svn
image.png

svn-git integration (5) , usage for seperate server

Jul 22nd

Posted by larrycai in tool

No comments

In old blog, I asked myself why to use seperate git server, and got nice ideas today, see architecture

image

For CI system

Originally we use svn to remote access the server, and it will be nice to let hudson or sonar (also trigged by hudson) to talk to git server directly, it will be much fast.

And it is also the step to later switch to git system directly.

Collaborate on other branch

To be clear, the git master branch is always sync with svn trunk branch, and people (Larry, Peter) can use Git repo to collaborate on other branch like develop.

From the figure above, larry’s local master branch is always sync with “remotes/trunk” (svn repo), “remotes/local/master” (git repo), and Peter’s master is sync with “remotes/origin/master” (git repo) only, And both of them work on develop branch (link to git repo).

So Larry and Peter normally work on develop branch (clone from master) towards git repo, when it reachs to some level, larry will be responsible to rebase back master branch and commit back to svn repo, after that, it is sync back to git repo, therefore Peter’s master repo is up to date as well

If we have other branch from svn (i.e. demo) , in order to not confuse people, we can name demo-svn when clone to git repo, so everyone will notice this is from svn, no one should collaborate on it

Hope you can follow this ;-)

git, svn
1234»
  • Tags

    Agile agileway balsamiq book build CI css docbook document doxia FindBUGS gathering git github gitolite gitosis gitweb hudson Installation izPack Java knowledge management linux live writer markdown maven new comer Nexus Package platform PMD scrum scrumalliance Sonar ssh svn TDD training ubuntu virtualbox virtualization vmware web hosting webhostingpad wrapper
  • Agile

    • Agileway @ CN
    • Daniel Teng's blog
    • Xu Yi's blog
  • Blogroll

    • JiHao's thinking
  • Archive

    September 2010
    M T W T F S S
    « Aug    
     12345
    6789101112
    13141516171819
    20212223242526
    27282930  
  • Recent Posts

    • implement git-model in gitolite – 1
    • Why people select github/google code instead of sourceforge
    • CSS – small tips
    • git – manage your different git account from different access
    • CSS – sprites, manage images
  • Recent Comments

    • larrycai on Let’s play with git – gitolite & gitweb
    • Sitaram Chamarty on Let’s play with git – gitolite & gitweb
    • larrycai on Let’s play with git – gitolite & gitweb
    • Sitaram Chamarty on Let’s play with git – gitolite & gitweb
    • link的地址以斜线开头完全没有道理啊 | haojii on CSS – sprites, manage images
Mystique theme by digitalnature | Powered by WordPress
RSS Feeds XHTML 1.1 Top