Thursday, October 27, 2011

meet git-p4

For some reasons, in recent works I have to use Perforce, the revision control system used by Perl core team before 2008. Unfortunately, perforce lacks of distributed features and leads to heavy branching. In this developing, these two problems often interrupted programmers with conflicts hardly to solve. Bad workflow design also makes members forget to check out before editing randomly. A git subcommand git-p4 lets you use the great tool git locally with the smooth integration to perforce server.

The steps to configure on are currently unavailable. The official site of Perforce saved a copy. Following normal steps to write .p4config to setup p4client and install p4 and git-p4 into $PATH, $ git p4 clone //depos/path /local/path would just work. After local commit of git, $ git p4 rebase && git p4 submit works just like $ git pull --rebase && git push to remote git repository.

By the way, if you use Mercurial there is also a perforce extension can enable hg to clone perforce repository directly with a few of setup.

However, I strongly recommend perforce users migrating to modern distributed revision control system. After all, all the best companies and organizations have given Git / Mercurial a big hug, such as Github, BitBucket, Apple, Google Code, Perl, Rails, Gnome, Debian, Android and Linux Kernel. The git-p4 is a good transformer.

2012-04-26 update:
The git-p4 is now part of the git distribution and the version on github is no longer updated and doesn't work.

Saturday, April 9, 2011

Arrange bashrc

A simple recursive function can have aid on arranging bashrc files in a clear structure.

Add a line to source it in ~/.bashrc first, and then collect similar rc files into directories respectively.

If a bunch of bash completions were put inside ~/.bash_completion/, like
|-- hg
|-- git
| |-- git
| |-- gitk
| `-- git-common
`-- svk
just one more line
  load $HOME/.bash_completion
would load whole completions.

You may also have many aliases, environment variables, function definitions for different OS like this
|-- linux
| |-- aliases
| |-- env
| `-- functions
|-- freebsd
| |-- aliases
| |-- env
| `-- functions
`-- darwin
|-- aliases
|-- env
`-- functions

Just one another line
  load "$HOME/.bashrc.d/$(lower $(uname))"
can load correct system-specified rc files.

Friday, March 25, 2011

MySQL 5.5.10 homebrew install issue

Coming after the mysql 5.1.52 homebrew install issue, the just released mysql 5.5.10, which solved the previous problem, has another issue.

When starting mysql daemon with mysql.server script, it showed error message like
ERROR! The server quit without updating PID file (/usr/local/var/mysql/data/*********.pid).
The new homebrew instruction to install mysql makes its default $datadir to be $basedir/data but the setting of $datadir in mysql.server line 70 didn't be fixed to corresponded to the change.

Adjust $datadir in script or just use boot parameter --data-dir=/usr/local/Cellar/mysql/5.5.10/data/ makes mysql.server work.