こんなコードはよいコード
- 読みやすいことはよいことだ
- 見た目が単純だと読みやすい
- 皆がよく知っている構成は読みやすい (標準に従う。すでに知っているもの (Unix のコマンドとか) に従う。すでにあるものに従う)
- 書かないことはよいことだ
$ python | |
Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit (Intel)] on | |
win32 | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> | |
>>> | |
>>> import sys | |
>>> | |
>>> sys.path | |
['', 'c:\\Python26\\lib\\site-packages\\setuptools-0.6c11-py2.6.egg', 'c:\\Python26\\lib\\site-packages\\nose-0.11.0.dev-py2.6.egg', 'c:\\Python26\\lib\\site-packages\\coverage-3.5.1-py2.6-win32.egg', 'C:\\Windows\\system32\\python26.zip', |
$ java -version | |
java version "1.6.0_31" | |
Java(TM) SE Runtime Environment (build 1.6.0_31-b05) | |
Java HotSpot(TM) Client VM (build 20.6-b01, mixed mode, sharing) |
REM hg heads on hook | |
hg version | |
hg init tmphook | |
REM ----- Setup hooks ----- | |
cd tmphook | |
echo hg heads > .hg\heads.bat | |
echo [hooks] > .hg\hgrc |
REM subrepo test script | |
hg version | |
rmdir /s /q tmp | |
mkdir tmp\main | |
cd tmp\main | |
REM ----- initial repositories | |
hg init |
{{{ | |
#!python | |
** Mercurial version (2.2.2). TortoiseHg version (2.4.1) | |
** Command: | |
** CWD: C:\windows\system32 | |
** Encoding: cp932 | |
** Extensions loaded: graphlog, mq, rebase, svn, purge, win32mbcs, convert, record, info | |
** Python version: 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit (Intel)] | |
** Windows version: (6, 1, 7601, 2, 'Service Pack 1') | |
** Processor architecture: x86 |
#!/bin/sh -e | |
HGROOT="$HOME/work/hghacks/mercurial" | |
HG="$HGROOT/hg" | |
LANG=C | |
TESTTMP="/tmp/subrepo+mq.d" | |
make -C "$HGROOT" local > /dev/null | |
"$HG" --version -q |
#!/bin/sh -e | |
# Windows batch command | |
# - tested on msysgit on Windows | |
export LANGUAGE=C | |
hg version -q | |
reporoot=temp #temp directory | |
centrepo=$reporoot/centrepo |
#!/bin/bash | |
if [[ -z $1 ]]; then | |
echo "Usage: $0 repository" | |
exit 1; | |
fi | |
function getFirstRev # $1: Repository path | |
{ | |
if [[ $(uname -s) = MINGW* ]]; then |
{{{ | |
#!python | |
** Mercurial version (2.3). TortoiseHg version (2.4.3) | |
** Command: | |
** CWD: C:\windows\system32 | |
** Encoding: cp932 | |
** Extensions loaded: graphlog, mq, rebase, purge, win32mbcs, convert, record, hgsubversion, info, transplant | |
** Python version: 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] | |
** Windows version: sys.getwindowsversion(major=6, minor=1, build=7601, platform=2, service_pack='Service Pack 1') | |
** Processor architecture: x86 |