Show More
@@ -1,454 +1,449 b'' | |||
|
1 | 1 | HG(1) |
|
2 | 2 | ===== |
|
3 | 3 | Matt Mackall <mpm@selenic.com> |
|
4 | v0.6, 24 Jun 2005 | |
|
5 | 4 | |
|
6 | 5 | NAME |
|
7 | 6 | ---- |
|
8 | 7 | hg - Mercurial source code management system |
|
9 | 8 | |
|
10 | 9 | SYNOPSIS |
|
11 | 10 | -------- |
|
12 | 11 | 'hg' [-v -d -q -y] <command> [command options] [files] |
|
13 | 12 | |
|
14 | 13 | DESCRIPTION |
|
15 | 14 | ----------- |
|
16 | 15 | The hg(1) command provides a command line interface to the Mercurial system. |
|
17 | 16 | |
|
18 | 17 | OPTIONS |
|
19 | 18 | ------- |
|
20 | 19 | |
|
21 | 20 | --debug, -d:: |
|
22 | 21 | enable debugging output |
|
23 | 22 | |
|
24 | 23 | --quiet, -q:: |
|
25 | 24 | suppress output |
|
26 | 25 | |
|
27 | 26 | --verbose, -v:: |
|
28 | 27 | enable additional output |
|
29 | 28 | |
|
30 | 29 | --noninteractive, -y:: |
|
31 | 30 | do not prompt, assume 'yes' for any required answers |
|
32 | 31 | |
|
33 | 32 | COMMAND ELEMENTS |
|
34 | 33 | ---------------- |
|
35 | 34 | |
|
36 | 35 | files ...:: |
|
37 | 36 | indicates one or more filename or relative path filenames |
|
38 | 37 | |
|
39 | 38 | path:: |
|
40 | 39 | indicates a path on the local machine |
|
41 | 40 | |
|
42 | 41 | revision:: |
|
43 | 42 | indicates a changeset which can be specified as a changeset revision |
|
44 | 43 | number, a tag, or a unique substring of the changeset hash value |
|
45 | 44 | |
|
46 | 45 | repository path:: |
|
47 |
|
|
|
46 | either the pathname of a local repository or the URI of a remote | |
|
48 | 47 | repository. There are two available URI protocols, http:// which is |
|
49 | 48 | fast and the old-http:// protocol which is much slower but does not |
|
50 | 49 | require a special server on the web host. |
|
51 | 50 | |
|
52 | 51 | COMMANDS |
|
53 | 52 | -------- |
|
54 | 53 | |
|
55 | 54 | add [files ...]:: |
|
56 | 55 | Schedule files to be version controlled and added to the repository. |
|
57 | 56 | |
|
58 |
The files |
|
|
57 | The files will be added to the repository at the next commit. | |
|
59 | 58 | |
|
60 | 59 | addremove:: |
|
61 | 60 | Add all new files and remove all missing files from the repository. |
|
62 | 61 | |
|
63 | 62 | New files are ignored if they match any of the patterns in .hgignore. As |
|
64 |
with add, the |
|
|
63 | with add, these changes take effect at the next commit. | |
|
65 | 64 | |
|
66 | 65 | annotate [-r <rev> -u -n -c] [files ...]:: |
|
67 | 66 | List changes in files, showing the revision id responsible for each line |
|
68 | 67 | |
|
69 | 68 | This command is useful to discover who did a change or when a change took |
|
70 | 69 | place. |
|
71 | 70 | |
|
72 | 71 | options: |
|
73 | 72 | -r, --revision <rev> annotate the specified revision |
|
74 | 73 | -u, --user list the author |
|
75 | 74 | -c, --changeset list the changeset |
|
76 | 75 | -n, --number list the revision number (default) |
|
77 | 76 | |
|
78 | 77 | cat <file> [revision]:: |
|
79 | 78 | Output to stdout the given revision for the specified file. |
|
80 | 79 | |
|
81 |
I |
|
|
80 | If no revision is given then the tip is used. | |
|
82 | 81 | |
|
83 | 82 | clone [-U] <source> [dest]:: |
|
84 | 83 | Create a copy of an existing repository in a new directory. |
|
85 | 84 | |
|
86 |
If the destination directory is specified |
|
|
85 | If the destination directory is specified but doesn't exist, it is | |
|
87 | 86 | created. If no destination directory is specified, it defaults to the |
|
88 | 87 | current directory. |
|
89 | 88 | |
|
90 |
The source is added to the new |
|
|
89 | The source is added to the new repository's .hg/hgrc file to be used in | |
|
91 | 90 | future pulls. |
|
92 | 91 | |
|
93 |
For |
|
|
94 |
|
|
|
92 | For efficiency, hardlinks are used for cloning whenever the | |
|
93 | source and destination are on the same filesystem. | |
|
95 | 94 | |
|
96 | 95 | options: |
|
97 | 96 | -U, --no-update do not update the new working directory |
|
98 | 97 | |
|
99 | 98 | commit [-A -t -l <file> -t <text> -u <user> -d <datecode>] [files...]:: |
|
100 |
|
|
|
99 | Commit changes to the given files into the repository. | |
|
101 | 100 | |
|
102 |
If a list of files is om |
|
|
103 | be commited. | |
|
101 | If a list of files is omitted, all changes reported by "hg status" | |
|
102 | will be commited. | |
|
104 | 103 | |
|
105 |
The EDITOR environment variable |
|
|
106 | a commit comment. | |
|
104 | The HGEDITOR or EDITOR environment variables are used to start an | |
|
105 | editor to add a commit comment. | |
|
107 | 106 | |
|
108 | 107 | Options: |
|
109 | 108 | |
|
110 | 109 | -A, --addremove run addremove during commit |
|
111 | 110 | -t, --text <text> use <text> as commit message |
|
112 | 111 | -l, --logfile <file> show the commit message for the given file |
|
113 | 112 | -d, --date <datecode> record datecode as commit date |
|
114 | 113 | -u, --user <user> record user as commiter |
|
115 | 114 | |
|
116 | 115 | aliases: ci |
|
117 | 116 | |
|
118 | 117 | copy <source> <dest>:: |
|
119 | 118 | Mark <dest> file as a copy or rename of a <source> one |
|
120 | 119 | |
|
121 | 120 | This command takes effect for the next commit. |
|
122 | 121 | |
|
123 | 122 | diff [-r revision] [-r revision] [files ...]:: |
|
124 | 123 | Show differences between revisions for the specified files. |
|
125 | 124 | |
|
126 | 125 | Differences between files are shown using the unified diff format. |
|
127 | 126 | |
|
128 |
When two revision arguments are given, then changes are shown |
|
|
129 |
|
|
|
130 | compared to the tip, and, when no revisions are specified, the working | |
|
131 | directory files are compared to the tip. | |
|
127 | When two revision arguments are given, then changes are shown | |
|
128 | between those revisions. If only one revision is specified then | |
|
129 | that revision is compared to the working directory, and, when no | |
|
130 | revisions are specified, the working directory files are compared | |
|
131 | to its parent. | |
|
132 | 132 | |
|
133 | 133 | export [revision]:: |
|
134 | 134 | Print the changeset header and diffs for a particular revision. |
|
135 | 135 | |
|
136 | 136 | The information shown in the changeset header is: author, changeset hash, |
|
137 | 137 | parent and commit comment. |
|
138 | 138 | |
|
139 | 139 | forget [files]:: |
|
140 | 140 | Undo an 'hg add' scheduled for the next commit. |
|
141 | 141 | |
|
142 | 142 | heads:: |
|
143 | 143 | Show all repository head changesets. |
|
144 | 144 | |
|
145 |
Repository "heads" are changesets that don't have children |
|
|
146 |
They are where development generally takes place and |
|
|
147 | for update and merge operations. | |
|
145 | Repository "heads" are changesets that don't have children | |
|
146 | changesets. They are where development generally takes place and | |
|
147 | are the usual targets for update and merge operations. | |
|
148 | 148 | |
|
149 | 149 | history:: |
|
150 | 150 | Print a log of the revision history of the repository. |
|
151 | 151 | |
|
152 |
By default this command outputs: changeset id and hash, tags, |
|
|
153 | user, date and time, and a summary for each commit. | |
|
154 |
|
|
|
152 | By default this command outputs: changeset id and hash, tags, | |
|
153 | parents, user, date and time, and a summary for each commit. The | |
|
154 | -v switch adds some more detail, such as changed files, manifest | |
|
155 | 155 | hashes or message signatures. |
|
156 | 156 | |
|
157 | 157 | To display the history of a given file, see the log command. |
|
158 | 158 | |
|
159 | 159 | identify:: |
|
160 | 160 | Print a short summary of the current state of the repo. |
|
161 | 161 | |
|
162 | 162 | This summary identifies the repository state using one or two parent |
|
163 | 163 | hash identifiers, followed by a "+" if there are uncommitted changes |
|
164 | 164 | in the working directory, followed by a list of tags for this revision. |
|
165 | 165 | |
|
166 | 166 | aliases: id |
|
167 | 167 | |
|
168 | 168 | import [-p <n> -b <base> -q] <patches>:: |
|
169 | 169 | Import a list of patches and commit them individually. |
|
170 | 170 | |
|
171 | 171 | options: |
|
172 | 172 | -p, --strip <n> directory strip option for patch. This has the same |
|
173 | 173 | meaning as the correnponding patch option |
|
174 | 174 | -b <path> base directory to read patches from |
|
175 | 175 | |
|
176 | 176 | aliases: patch |
|
177 | 177 | |
|
178 | ||
|
179 | If the specified source is on the same filesystem, the repository | |
|
180 | will be copied via hardlinks. This is the fastest and most | |
|
181 | space-efficient mode of operation. | |
|
182 | ||
|
183 | If the destination directory is not specified, it defaults to the | |
|
184 | current directory. | |
|
185 | ||
|
186 | If the destination is specified, but does not exist, it is created. | |
|
187 | ||
|
188 | The source is added to .hg/hgrc in the new copy as the default for | |
|
189 | future pulls. | |
|
190 | ||
|
191 | options: | |
|
192 | -U, --no-update do not update the new working directory | |
|
193 | ||
|
194 | 178 | init:: |
|
195 | 179 | Initialize a new repository in the current directory. |
|
196 | 180 | |
|
197 | 181 | log <file>:: |
|
198 | 182 | Print the revision history of the specified file. |
|
199 | 183 | |
|
200 | 184 | To display the revision history for the whole repository, use the history |
|
201 | 185 | command. |
|
202 | 186 | |
|
203 | 187 | manifest [revision]:: |
|
204 | 188 | Print a list of version controlled files for the given revision. |
|
205 | 189 | |
|
206 | 190 | The manifest is the list of files being version controlled. If no revision |
|
207 | 191 | is given then the tip is used. |
|
208 | 192 | |
|
209 | 193 | parents:: |
|
210 | 194 | Print the working directory's parent revisions. |
|
211 | 195 | |
|
212 | 196 | pull <repository path>:: |
|
213 |
Pull |
|
|
197 | Pull changes from a remote repository to a local one. | |
|
214 | 198 | |
|
215 | Pulling is a fundamental operation in a distributed version control system, | |
|
216 | as it eases handling changes from different branches, both local and | |
|
217 | remote, into the current repository. | |
|
199 | This finds all changes from the repository at the specified path | |
|
200 | or URL and adds them to the local repository. By default, this | |
|
201 | does not update the copy of the project in the working directory. | |
|
218 | 202 | |
|
219 | 203 | options: |
|
220 | 204 | -u, --update update the working directory to tip after pull |
|
221 | 205 | |
|
222 | 206 | push <destination>:: |
|
223 | 207 | Push changes from the local repository to the given destination. |
|
224 | 208 | |
|
225 |
This is the symmetrical operation for pull. It helps to move |
|
|
226 |
the current repository to a different one. If the |
|
|
227 |
this is identical to a pull in that directory |
|
|
209 | This is the symmetrical operation for pull. It helps to move | |
|
210 | changes from the current repository to a different one. If the | |
|
211 | destination is local this is identical to a pull in that directory | |
|
212 | from the current one. | |
|
228 | 213 | |
|
229 | 214 | The other currently available push method is SSH. This requires an |
|
230 | 215 | accessible shell account on the destination machine and a copy of |
|
231 | 216 | hg in the remote path. Destinations are specified in the following |
|
232 | 217 | form: |
|
233 | 218 | |
|
234 | 219 | ssh://[user@]host[:port]/path |
|
235 | 220 | |
|
236 | 221 | rawcommit [-p -d -u -F -t -l]:: |
|
237 | 222 | Lowlevel commit, for use in helper scripts. |
|
238 | 223 | |
|
239 | 224 | This command is not intended to be used by normal users, as it is |
|
240 | 225 | primarily useful for importing from other SCMs. |
|
241 | 226 | |
|
242 | 227 | recover:: |
|
243 | 228 | Recover from an interrupted commit or pull. |
|
244 | 229 | |
|
245 | 230 | This command tries to fix the repository status after an interrupted |
|
246 | 231 | operation. It should only be necessary when Mercurial suggests it. |
|
247 | 232 | |
|
248 | 233 | remove [files ...]:: |
|
249 | 234 | Schedule the indicated files for removal from the repository. |
|
250 | 235 | |
|
251 |
This command shedules the files to be removed |
|
|
252 | takes place at the next commit. | |
|
236 | This command shedules the files to be removed at the next commit. | |
|
237 | This only removes files from the current branch, not from the | |
|
238 | entire project history. | |
|
253 | 239 | |
|
254 | 240 | aliases: rm |
|
255 | 241 | |
|
256 | 242 | root:: |
|
257 | 243 | Print the root directory of the current repository. |
|
258 | 244 | |
|
259 | 245 | serve [-a addr -n name -p port -t templatedir]:: |
|
260 | 246 | Start a local HTTP repository browser and pull server. |
|
261 | 247 | |
|
262 | 248 | options: |
|
263 | 249 | -a, --address <addr> address to use |
|
264 | 250 | -p, --port <n> port to use (default: 8000) |
|
265 | 251 | -n, --name <name> name to show in web pages (default: working dir) |
|
266 | 252 | -t, --templatedir <path> web templates to use |
|
267 | 253 | |
|
268 | 254 | status:: |
|
269 | 255 | Show changed files in the working directory. |
|
270 | 256 | |
|
271 | 257 | The codes used to show the status of files are: |
|
272 | 258 | |
|
273 | 259 | C = changed |
|
274 | 260 | A = added |
|
275 | 261 | R = removed |
|
276 | 262 | ? = not tracked |
|
277 | 263 | |
|
278 | 264 | tag [-t <text> -d <datecode> -u <user>] <name> [revision]:: |
|
279 | 265 | Name a particular revision using <name>. |
|
280 | 266 | |
|
281 | 267 | Tags are used to name particular revisions of the repository and are |
|
282 | 268 | very useful to compare different revision, to go back to significant |
|
283 |
earlier versions or to |
|
|
269 | earlier versions or to mark branch points as releases, etc. | |
|
284 | 270 | |
|
285 |
If no revision is given |
|
|
271 | If no revision is given, the tip is used. | |
|
286 | 272 | |
|
287 | This tags are versioned, and kept along with the repository metadata. But | |
|
288 | Mercurial has support for other type of tags that can be used locally for | |
|
289 | convenience and that are created adding lines with a changeset hash value | |
|
290 | and a name or names to name the revision in a .hgtags file | |
|
291 | ||
|
273 | To facilitate version control, distribution, and merging of tags, | |
|
274 | they are stored as a file named ".hgtags" which is managed | |
|
275 | similarly to other project files and can be hand-edited if | |
|
276 | necessary. | |
|
277 | ||
|
292 | 278 | options: |
|
293 | 279 | -t, --text <text> message for tag commit log entry |
|
294 | 280 | -d, --date <datecode> datecode for commit |
|
295 | 281 | -u, --user <user> user for commit |
|
296 | 282 | |
|
283 | Note: Mercurial also has support for "local tags" that are not | |
|
284 | version-controlled or distributed which are stored in the .hg/hgrc | |
|
285 | file. | |
|
286 | ||
|
297 | 287 | tags:: |
|
298 | 288 | List the repository tags. |
|
299 | 289 | |
|
300 | Local tags in the .hgtags don't get listed when using this command. | |
|
290 | This lists both regular and local tags. | |
|
301 | 291 | |
|
302 | 292 | tip:: |
|
303 | 293 | Show the tip revision. |
|
304 | 294 | |
|
305 | 295 | undo:: |
|
306 | 296 | Undo the last commit or pull transaction. |
|
307 | 297 | |
|
308 | 298 | update [-m -C] [revision]:: |
|
309 |
|
|
|
299 | Update the working directory to the specified revision. | |
|
310 | 300 | |
|
311 | After running this command the current directory will have the contents | |
|
312 | of the specified revision. | |
|
313 | ||
|
314 | If there were outstanding changes in the current directory and a merge | |
|
315 | would be needed, the -m option can be used to merge those changes with | |
|
316 | the target revision. Without the -m or --merge option, no merge | |
|
317 | will happen. | |
|
318 | ||
|
319 | The -C or --clean option must be used in case a pristine version is | |
|
320 | desired. In this case, existing changes will be discarded and lost. If | |
|
321 | these changes should be kept, then a commit prior updating, or a merge | |
|
322 | is due. | |
|
301 | By default, update will refuse to run if doing so would require | |
|
302 | merging or discarding local changes. | |
|
303 | ||
|
304 | With the -m option, a merge will be performed. | |
|
305 | ||
|
306 | With the -C option, local changes will be lost. | |
|
323 | 307 | |
|
324 | 308 | options: |
|
325 | 309 | -m, --merge allow merging of branches |
|
326 | 310 | -C, --clean overwrite locally modified files |
|
327 | 311 | |
|
328 | 312 | aliases: up checkout co |
|
329 | 313 | |
|
330 | 314 | verify:: |
|
331 | 315 | Verify the integrity of the current repository. |
|
332 | 316 | |
|
333 | 317 | This will perform an extensive check of the repository's |
|
334 | 318 | integrity, validating the hashes and checksums of each entry in |
|
335 | 319 | the changelog, manifest, and tracked files, as well as the |
|
336 | 320 | integrity of their crosslinks and indices. |
|
337 | 321 | |
|
338 | 322 | |
|
339 | 323 | ENVIRONMENT VARIABLES |
|
340 | 324 | --------------------- |
|
341 | 325 | |
|
342 | 326 | HGEDITOR:: |
|
343 | 327 | This is the name of the editor to use when committing. Defaults to the |
|
344 | 328 | value of EDITOR. |
|
345 | 329 | |
|
346 | 330 | HGMERGE:: |
|
347 |
An executable to use for resolving merge conflicts. The program |
|
|
331 | An executable to use for resolving merge conflicts. The program | |
|
348 | 332 | will be executed with three arguments: local file, remote file, |
|
349 | 333 | ancestor file. |
|
350 | 334 | |
|
351 | 335 | The default program is "hgmerge", which is a shell script provided |
|
352 | 336 | by Mercurial with some sensible defaults. |
|
353 | 337 | |
|
354 | 338 | HGUSER:: |
|
355 | 339 | This is the string used for the author of a commit. |
|
356 | 340 | |
|
357 | 341 | EMAIL:: |
|
358 | 342 | If HGUSER is not set, this will be used as the author for a commit. |
|
359 | 343 | |
|
360 | 344 | LOGNAME:: |
|
361 | 345 | If neither HGUSER nor EMAIL is set, LOGNAME will be used (with |
|
362 | 346 | '@hostname' appended) as the author value for a commit. |
|
363 | 347 | |
|
364 | 348 | EDITOR:: |
|
365 | 349 | This is the name of the editor used in the hgmerge script. It will be |
|
366 |
used for commit messages |
|
|
350 | used for commit messages if HGEDITOR isn't set. Defaults to 'vi'. | |
|
367 | 351 | |
|
368 | 352 | PYTHONPATH:: |
|
369 | 353 | This is used by Python to find imported modules and may need to be set |
|
370 | 354 | appropriately if Mercurial is not installed system-wide. |
|
371 | 355 | |
|
372 | 356 | FILES |
|
373 | 357 | ----- |
|
374 | 358 | .hgignore:: |
|
375 | 359 | This file contains regular expressions (one per line) that describe file |
|
376 | 360 | names that should be ignored by hg. |
|
377 | 361 | |
|
378 | 362 | .hgtags:: |
|
379 | 363 | This file contains changeset hash values and text tag names (one of each |
|
380 | 364 | seperated by spaces) that correspond to tagged versions of the repository |
|
381 | 365 | contents. |
|
382 | 366 | |
|
383 | 367 | $HOME/.hgrc, .hg/hgrc:: |
|
384 | 368 | This file contains defaults and configuration. Values in .hg/hgrc |
|
385 | 369 | override those in .hgrc. |
|
386 | 370 | |
|
387 | 371 | NAMED REPOSITORIES |
|
388 | 372 | ------------------ |
|
389 | 373 | |
|
390 | 374 | To give symbolic names to a repository, create a section in .hgrc |
|
391 | 375 | or .hg/hgrc containing assignments of names to paths. Example: |
|
392 | 376 | |
|
393 | 377 | ----------------- |
|
394 | 378 | [paths] |
|
395 | 379 | hg = http://selenic.com/hg |
|
396 | 380 | tah = http://hg.intevation.org/mercurial-tah/ |
|
397 | 381 | ----------------- |
|
398 | 382 | |
|
399 | 383 | |
|
384 | LOCAL TAGS | |
|
385 | ---------- | |
|
386 | ||
|
387 | To create tags that are local to the repository and not distributed or | |
|
388 | version-controlled, create an hgrc section like the following: | |
|
389 | ||
|
390 | ---------------- | |
|
391 | [tags] | |
|
392 | working = 2dcced388cab3677a8f543c3c47a0ad34ac9d435 | |
|
393 | tested = 12e0fdbc57a0be78f0e817fd1d170a3615cd35da | |
|
394 | ---------------- | |
|
395 | ||
|
396 | ||
|
400 | 397 | HOOKS |
|
401 | 398 | ----- |
|
402 | 399 | |
|
403 | 400 | Mercurial supports a set of 'hook', commands that get automatically |
|
404 | 401 | executed by various actions such as starting or finishing a commit. To |
|
405 | 402 | specify a hook, simply create an hgrc section like the following: |
|
406 | 403 | |
|
407 | 404 | ----------------- |
|
408 | 405 | [hooks] |
|
409 | 406 | precommit = echo "this hook gets executed immediately before a commit" |
|
410 | 407 | commit = hg export $NODE | mail -s "new commit $NODE" commit-list |
|
411 | 408 | ----------------- |
|
412 | 409 | |
|
413 | 410 | |
|
414 | 411 | NON_TRANSPARENT PROXY SUPPORT |
|
415 | 412 | ----------------------------- |
|
416 | 413 | |
|
417 | 414 | To access a Mercurial repository through a proxy, create a file |
|
418 | 415 | $HOME/.hgrc in the following format: |
|
419 | 416 | |
|
420 | 417 | -------------- |
|
421 | 418 | [http_proxy] |
|
422 | 419 | host=myproxy:8080 |
|
423 | 420 | user=<username> |
|
424 | 421 | passwd=<password> |
|
425 | 422 | no=<localhost1>,<localhost2>,<localhost3>,... |
|
426 | 423 | -------------- |
|
427 | 424 | |
|
428 |
"user" |
|
|
429 |
comma-separated list of local host names |
|
|
430 | bypassed. | |
|
431 | ||
|
425 | "user" and "passwd" fields are used for authenticating proxies, "no" is a | |
|
426 | comma-separated list of local host names to not proxy. | |
|
432 | 427 | |
|
433 | 428 | BUGS |
|
434 | 429 | ---- |
|
435 | 430 | Probably lots, please post them to the mailing list (See Resources below) |
|
436 | 431 | when you find them. |
|
437 | 432 | |
|
438 | 433 | AUTHOR |
|
439 | 434 | ------ |
|
440 | 435 | Written by Matt Mackall <mpm@selenic.com> |
|
441 | 436 | |
|
442 | 437 | RESOURCES |
|
443 | 438 | --------- |
|
444 | 439 | http://selenic.com/mercurial[Main Web Site] |
|
445 | 440 | |
|
446 | 441 | http://selenic.com/hg[Source code repository] |
|
447 | 442 | |
|
448 | 443 | http://selenic.com/mailman/listinfo/mercurial[Mailing list] |
|
449 | 444 | |
|
450 | 445 | COPYING |
|
451 | 446 | ------- |
|
452 | 447 | Copyright (C) 2005 Matt Mackall. |
|
453 | 448 | Free use of this software is granted under the terms of the GNU General |
|
454 | 449 | Public License (GPL). |
General Comments 0
You need to be logged in to leave comments.
Login now