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