Export files changed at revision from mercurial

Sometimes (more precisely - rarely) you need to export files changed at given revision as directory tree instead of patch file. Mercurial vcs has archive command which let you to export selected files at given revision: hg archive --type files --rev $REVISION -I list_of_files To list files changed at revision: hg log -r $REVISION --template '{files}\n' | sed 's/\n / -I /g' Here end of line character is used to handle the case of using space character in filename.

Church numerals

Church numerals is a great example of introducing abstraction in terms of composition of functions. This concept demonstrates that “data” (naturals numbers in particular) and operations on data can be defined in the same way - using higher-order functions. Summary: type Church a = (a -> a) -> a -> a zero, cone, ctwo :: Church a zero s z = z one s z = s z two s = s .

Programmable completion for git and mercurial

Some time ago i read excellent post about emacs library pcomplete. The author described implementation of completion for git, mercurial version control system using this library. Article is really usefull, i used code as is, its easy and provides all you need, but later i have some problem with it. First problem - eager evaluation. General commands for git and mercurial are calculated once. Great, there is no reason to call external process like git or hg multiple times but precalculation occured at script evaluation.

PATH variable for gui programs (Mac Os)

Foreword: Sometimes you need to edit PATH variable. Of course you edit .bash_profile, .bashrc, .profile or other scripts and this works fine only in terminal. GUI apps at Mac Os use its own PATH variable (moreover has its own environment), which can be set using ’launchctl setenv PATH <PATH_VALUE>’. So you need to setup PATH for GUI apps correctly, and do not forget about PATH var for terminal. Moreover, after update to Mac Os X 10.

Git rerere

There is some usefull git command rerere (reuse recorded resolution). Sometimes especially for long lived branch you need to resolve same conflicts again and again. This command let you save the results of conflict resolution and apply it again when needed. Let see how its works: # create test repo git init rerere # move to it cd rerere # enable rerere - reuse recorded resolution (its disabled by default) git config rerere.