|
1 Setting up Mercurial in your home directory: |
|
2 |
|
3 Note: Debian fails to include bits of distutils, you'll need |
|
4 python-dev to install. Alternately, shove everything somewhere in |
|
5 your path. |
|
6 |
|
7 $ tar xvzf mercurial-<ver>.tar.gz |
|
8 $ cd mercurial-<ver> |
|
9 $ python setup.py install --home ~ |
|
10 $ export PYTHONPATH=${HOME}/lib/python # add this to your .bashrc |
|
11 $ export HGMERGE=tkmerge # customize this |
|
12 $ hg # test installation, show help |
|
13 |
|
14 If you get complaints about missing modules, you probably haven't set |
|
15 PYTHONPATH correctly. |
|
16 |
|
17 You may also want to install psyco, the python specializing compiler. |
|
18 It makes commits more than twice as fast. The relevant Debian package |
|
19 is python-psyco |
|
20 |
|
21 Setting up a Mercurial project: |
|
22 |
|
23 $ cd linux/ |
|
24 $ hg init # creates .hg |
|
25 $ hg status # show changes between repo and working dir |
|
26 $ hg diff # generate a unidiff |
|
27 $ hg addremove # add all unknown files and remove all missing files |
|
28 $ hg commit # commit all changes, edit changelog entry |
|
29 |
|
30 Mercurial will look for a file named .hgignore in the root of your |
|
31 repository contains a set of regular expressions to ignore in file |
|
32 paths. |
|
33 |
|
34 Mercurial commands: |
|
35 |
|
36 $ hg history # show changesets |
|
37 $ hg log Makefile # show commits per file |
|
38 $ hg checkout # check out the tip revision |
|
39 $ hg checkout <hash> # check out a specified changeset |
|
40 $ hg add foo # add a new file for the next commit |
|
41 $ hg remove bar # mark a file as removed |
|
42 $ hg verify # check repo integrity |
|
43 |
|
44 Branching and merging: |
|
45 |
|
46 $ cd .. |
|
47 $ mkdir linux-work |
|
48 $ cd linux-work |
|
49 $ hg branch ../linux # create a new branch |
|
50 $ hg checkout # populate the working directory |
|
51 $ <make changes> |
|
52 $ hg commit |
|
53 $ cd ../linux |
|
54 $ hg merge ../linux-work # pull changesets from linux-work |
|
55 |
|
56 Importing patches: |
|
57 |
|
58 Fast: |
|
59 $ patch < ../p/foo.patch |
|
60 $ hg addremove |
|
61 $ hg commit |
|
62 |
|
63 Faster: |
|
64 $ patch < ../p/foo.patch |
|
65 $ hg commit `lsdiff -p1 ../p/foo.patch` |
|
66 |
|
67 Fastest: |
|
68 $ cat ../p/patchlist | xargs hg import -p1 -b ../p |
|
69 |
|
70 Network support (highly experimental): |
|
71 |
|
72 # export your .hg directory as a directory on your webserver |
|
73 foo$ ln -s .hg ~/public_html/hg-linux |
|
74 |
|
75 # merge changes from a remote machine |
|
76 bar$ hg merge http://foo/~user/hg-linux |
|
77 |
|
78 This is just a proof of concept of grabbing byte ranges, and is not |
|
79 expected to perform well. |
|
80 |