Show More
@@ -1,124 +1,124 | |||||
1 | MERCURIAL QUICK-START |
|
1 | MERCURIAL QUICK-START | |
2 |
|
2 | |||
3 | Setting up Mercurial: |
|
3 | Setting up Mercurial: | |
4 |
|
4 | |||
5 | Note: some distributions fails to include bits of distutils by |
|
5 | Note: some distributions fails to include bits of distutils by | |
6 | default, you'll need python-dev to install. You'll also need a C |
|
6 | default, you'll need python-dev to install. You'll also need a C | |
7 | compiler and a 3-way merge tool like merge, tkdiff, or kdiff3. |
|
7 | compiler and a 3-way merge tool like merge, tkdiff, or kdiff3. | |
8 |
|
8 | |||
9 | First, unpack the source: |
|
9 | First, unpack the source: | |
10 |
|
10 | |||
11 | $ tar xvzf mercurial-<ver>.tar.gz |
|
11 | $ tar xvzf mercurial-<ver>.tar.gz | |
12 | $ cd mercurial-<ver> |
|
12 | $ cd mercurial-<ver> | |
13 |
|
13 | |||
14 | To install system-wide: |
|
14 | To install system-wide: | |
15 |
|
15 | |||
16 | $ python setup.py install # change python to python2.3 if 2.2 is default |
|
16 | $ python setup.py install # change python to python2.3 if 2.2 is default | |
17 |
|
17 | |||
18 | To install in your home directory (~/bin and ~/lib, actually), run: |
|
18 | To install in your home directory (~/bin and ~/lib, actually), run: | |
19 |
|
19 | |||
20 | $ python2.3 setup.py install --home=~ |
|
20 | $ python2.3 setup.py install --home=~ | |
21 |
$ export PYTHONPATH=${HOME}/lib/python # |
|
21 | $ export PYTHONPATH=${HOME}/lib/python # (or lib64/ on some systems) | |
22 | $ export PATH=${HOME}/bin:$PATH # |
|
22 | $ export PATH=${HOME}/bin:$PATH # add these to your .bashrc | |
23 |
|
23 | |||
24 | And finally: |
|
24 | And finally: | |
25 |
|
25 | |||
26 | $ hg # test installation, show help |
|
26 | $ hg # test installation, show help | |
27 |
|
27 | |||
28 | If you get complaints about missing modules, you probably haven't set |
|
28 | If you get complaints about missing modules, you probably haven't set | |
29 | PYTHONPATH correctly. |
|
29 | PYTHONPATH correctly. | |
30 |
|
30 | |||
31 | Setting up a Mercurial project: |
|
31 | Setting up a Mercurial project: | |
32 |
|
32 | |||
33 | $ cd project/ |
|
33 | $ cd project/ | |
34 | $ hg init # creates .hg |
|
34 | $ hg init # creates .hg | |
35 | $ hg status # show changes between repo and working dir |
|
35 | $ hg status # show changes between repo and working dir | |
36 | $ hg diff # generate a unidiff |
|
36 | $ hg diff # generate a unidiff | |
37 | $ hg addremove # add all unknown files and remove all missing files |
|
37 | $ hg addremove # add all unknown files and remove all missing files | |
38 | $ hg commit # commit all changes, edit changelog entry |
|
38 | $ hg commit # commit all changes, edit changelog entry | |
39 | $ hg export <rev> # export a changeset as a diff |
|
39 | $ hg export <rev> # export a changeset as a diff | |
40 |
|
40 | |||
41 | Mercurial will look for a file named .hgignore in the root of your |
|
41 | Mercurial will look for a file named .hgignore in the root of your | |
42 | repository contains a set of regular expressions to ignore in file |
|
42 | repository contains a set of regular expressions to ignore in file | |
43 | paths. |
|
43 | paths. | |
44 |
|
44 | |||
45 | Mercurial commands: |
|
45 | Mercurial commands: | |
46 |
|
46 | |||
47 | $ hg help [command] # get online help |
|
47 | $ hg help [command] # get online help | |
48 | $ hg history # show changesets |
|
48 | $ hg history # show changesets | |
49 | $ hg log Makefile # show commits per file |
|
49 | $ hg log Makefile # show commits per file | |
50 | $ hg update # check out the tip revision |
|
50 | $ hg update # check out the tip revision | |
51 | $ hg update <id> # check out a specified changeset |
|
51 | $ hg update <id> # check out a specified changeset | |
52 | # IDs can be tags, revision numbers, or unique |
|
52 | # IDs can be tags, revision numbers, or unique | |
53 | # subsets of changeset hash numbers |
|
53 | # subsets of changeset hash numbers | |
54 | $ hg add foo # add a new file for the next commit |
|
54 | $ hg add foo # add a new file for the next commit | |
55 | $ hg remove bar # mark a file as removed |
|
55 | $ hg remove bar # mark a file as removed | |
56 | $ hg verify # check repo integrity |
|
56 | $ hg verify # check repo integrity | |
57 | $ hg tags # show current tags |
|
57 | $ hg tags # show current tags | |
58 | $ hg annotate [files] # show changeset numbers for each file line |
|
58 | $ hg annotate [files] # show changeset numbers for each file line | |
59 |
|
59 | |||
60 | Branching and merging: |
|
60 | Branching and merging: | |
61 |
|
61 | |||
62 | $ cd .. |
|
62 | $ cd .. | |
63 | $ mkdir linux-work |
|
63 | $ mkdir linux-work | |
64 | $ cd linux-work |
|
64 | $ cd linux-work | |
65 | $ hg init ../linux # create a new branch |
|
65 | $ hg init ../linux # create a new branch | |
66 | $ hg update # populate the working directory |
|
66 | $ hg update # populate the working directory | |
67 | $ <make changes> |
|
67 | $ <make changes> | |
68 | $ hg commit |
|
68 | $ hg commit | |
69 | $ cd ../linux |
|
69 | $ cd ../linux | |
70 | $ hg pull ../linux-work # pull changesets from linux-work |
|
70 | $ hg pull ../linux-work # pull changesets from linux-work | |
71 | $ hg update -m # merge the new tip from linux-work into |
|
71 | $ hg update -m # merge the new tip from linux-work into | |
72 | # our working directory |
|
72 | # our working directory | |
73 |
|
73 | |||
74 | Importing patches: |
|
74 | Importing patches: | |
75 |
|
75 | |||
76 | Fast: |
|
76 | Fast: | |
77 | $ patch < ../p/foo.patch |
|
77 | $ patch < ../p/foo.patch | |
78 | $ hg addremove |
|
78 | $ hg addremove | |
79 | $ hg commit |
|
79 | $ hg commit | |
80 |
|
80 | |||
81 | Faster: |
|
81 | Faster: | |
82 | $ patch < ../p/foo.patch |
|
82 | $ patch < ../p/foo.patch | |
83 | $ hg commit `lsdiff -p1 ../p/foo.patch` |
|
83 | $ hg commit `lsdiff -p1 ../p/foo.patch` | |
84 |
|
84 | |||
85 | Fastest: |
|
85 | Fastest: | |
86 | $ cat ../p/patchlist | xargs hg import -p1 -b ../p |
|
86 | $ cat ../p/patchlist | xargs hg import -p1 -b ../p | |
87 |
|
87 | |||
88 | Exporting a patch: |
|
88 | Exporting a patch: | |
89 |
|
89 | |||
90 | (make changes) |
|
90 | (make changes) | |
91 | $ hg commit |
|
91 | $ hg commit | |
92 | $ hg tip |
|
92 | $ hg tip | |
93 | 28237:747a537bd090880c29eae861df4d81b245aa0190 |
|
93 | 28237:747a537bd090880c29eae861df4d81b245aa0190 | |
94 | $ hg export 28237 > foo.patch # export changeset 28237 |
|
94 | $ hg export 28237 > foo.patch # export changeset 28237 | |
95 |
|
95 | |||
96 | Network support: |
|
96 | Network support: | |
97 |
|
97 | |||
98 | # pull from the primary Mercurial repo |
|
98 | # pull from the primary Mercurial repo | |
99 | foo$ hg init |
|
99 | foo$ hg init | |
100 | foo$ hg pull http://selenic.com/hg/ |
|
100 | foo$ hg pull http://selenic.com/hg/ | |
101 | foo$ hg update # hg co works too |
|
101 | foo$ hg update # hg co works too | |
102 |
|
102 | |||
103 | # export your current repo via HTTP with browsable interface |
|
103 | # export your current repo via HTTP with browsable interface | |
104 | foo$ hg serve -n "My repo" -p 80 |
|
104 | foo$ hg serve -n "My repo" -p 80 | |
105 |
|
105 | |||
106 | # pushing changes to a remote repo with SSH |
|
106 | # pushing changes to a remote repo with SSH | |
107 | foo$ hg push ssh://user@example.com/~/hg/ |
|
107 | foo$ hg push ssh://user@example.com/~/hg/ | |
108 |
|
108 | |||
109 | # merge changes from a remote machine |
|
109 | # merge changes from a remote machine | |
110 | bar$ hg pull http://foo/ |
|
110 | bar$ hg pull http://foo/ | |
111 | bar$ hg update -m # merge changes into your working directory |
|
111 | bar$ hg update -m # merge changes into your working directory | |
112 |
|
112 | |||
113 | # Set up a CGI server on your webserver |
|
113 | # Set up a CGI server on your webserver | |
114 | foo$ cp hgweb.cgi ~/public_html/hg/index.cgi |
|
114 | foo$ cp hgweb.cgi ~/public_html/hg/index.cgi | |
115 | foo$ emacs ~/public_html/hg/index.cgi # adjust the defaults |
|
115 | foo$ emacs ~/public_html/hg/index.cgi # adjust the defaults | |
116 |
|
116 | |||
117 | Symbolic repository names: |
|
117 | Symbolic repository names: | |
118 |
|
118 | |||
119 | Mercurial uses an options file called ~/.hgrc. To track locations |
|
119 | Mercurial uses an options file called ~/.hgrc. To track locations | |
120 | symbolically, add a section to it like this: |
|
120 | symbolically, add a section to it like this: | |
121 |
|
121 | |||
122 | [paths] |
|
122 | [paths] | |
123 | main = http://selenic.com/hg |
|
123 | main = http://selenic.com/hg | |
124 | linux = http://www.kernel.org/hg/ |
|
124 | linux = http://www.kernel.org/hg/ |
General Comments 0
You need to be logged in to leave comments.
Login now