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