mercurial snippets

Display the change log (revision history) for a Mercurial repository

Tagged mercurial, diff  Languages bash

Use the following command to print a list of changes (revision history) for a Mercurial repository:

$ hg log

The output looks like this:

changeset:   35:5a17500addb5
tag:         tip
user:        christian@localhost
date:        Fri Jun 29 23:33:59 2007 +0300
summary:     Changed mongrel_cluster configuration

changeset:   34:a73ee17923fe
user:        christian@localhost
date:        Fri Jun 29 23:28:36 2007 +0300
summary:     Fixed bugs.

In the example there are two revisions 35 and 34. Use the following command to display the details for revision 34:

$ hg log -p -r34

The output is a unified diff for the changeset and looks like this:

changeset:   34:a73ee17923fe
user:        christian@localhost
date:        Fri Jun 29 23:28:36 2007 +0300
summary:     Fixed bugs.

diff -r 4c44552841af -r 4e57a76f51d9 lib/daemons/deleted_unused_tags.rb
--- a/lib/daemons/deleted_unused_tags.rb        Sat Jun 23 23:58:38 2007 +0300
+++ b/lib/daemons/deleted_unused_tags.rb        Sun Jun 24 00:03:43 2007 +0300
@@ -11,10 +11,7 @@ end
 end

Jump start a Rails project with Rails Edge, Capistrano, Mongrel and Mercurial

Tagged rails, capistrano, mercurial, mongrel  Languages bash
# Create a Rails project
rails project -d sqlite3
cd project
# Delete index file
rm public/index.html
# Use Rails edge. Use  rake rails:freeze:edge TAG=rel_1-2-3 to get a specific version.
rake rails:freeze:edge
# Add Capistrano configuration file
capify .
# Add Mongrel cluster configuration file
sudo mongrel_rails cluster::configure -e production \
    --user mongrel --group mongrel \
    -c /var/www/project-xxx/current \
    -a 127.0.0.1 \
    -p 8000  \
    -N 3
# Create a Mercurial repository
hg init
# Add project to repository
hg commit -A --message "Project started"
# Push changes to a remote repository
hg push ssh://user@ip:port//var/mercurial/xxx

Cloning is done with hg clone:

hg clone ssh://user@ip:port//var/mercurial/xxx