Show More
@@ -1,624 +1,624 | |||
|
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; see |
|
37 | 37 | "FILE NAME PATTERNS" for information on pattern matching |
|
38 | 38 | |
|
39 | 39 | path:: |
|
40 | 40 | indicates a path on the local machine |
|
41 | 41 | |
|
42 | 42 | revision:: |
|
43 | 43 | indicates a changeset which can be specified as a changeset revision |
|
44 | 44 | number, a tag, or a unique substring of the changeset hash value |
|
45 | 45 | |
|
46 | 46 | repository path:: |
|
47 | 47 | either the pathname of a local repository or the URI of a remote |
|
48 | 48 | repository. There are two available URI protocols, http:// which is |
|
49 | 49 | fast and the old-http:// protocol which is much slower but does not |
|
50 | 50 | require a special server on the web host. |
|
51 | 51 | |
|
52 | 52 | COMMANDS |
|
53 | 53 | -------- |
|
54 | 54 | |
|
55 | 55 | add [options] [files ...]:: |
|
56 | 56 | Schedule files to be version controlled and added to the repository. |
|
57 | 57 | |
|
58 | 58 | The files will be added to the repository at the next commit. |
|
59 | 59 | |
|
60 | 60 | If no names are given, add all files in the current directory and |
|
61 | 61 | its subdirectories. |
|
62 | 62 | |
|
63 | 63 | addremove [options] [files ...]:: |
|
64 | 64 | Add all new files and remove all missing files from the repository. |
|
65 | 65 | |
|
66 | 66 | New files are ignored if they match any of the patterns in .hgignore. As |
|
67 | 67 | with add, these changes take effect at the next commit. |
|
68 | 68 | |
|
69 | 69 | annotate [-r <rev> -u -n -c] [files ...]:: |
|
70 | 70 | List changes in files, showing the revision id responsible for each line |
|
71 | 71 | |
|
72 | 72 | This command is useful to discover who did a change or when a change took |
|
73 | 73 | place. |
|
74 | 74 | |
|
75 | 75 | options: |
|
76 | 76 | -I, --include <pat> include names matching the given patterns |
|
77 | 77 | -X, --exclude <pat> exclude names matching the given patterns |
|
78 | 78 | -r, --revision <rev> annotate the specified revision |
|
79 | 79 | -u, --user list the author |
|
80 | 80 | -c, --changeset list the changeset |
|
81 | 81 | -n, --number list the revision number (default) |
|
82 | 82 | |
|
83 | 83 | cat <file> [revision]:: |
|
84 | 84 | Output to stdout the given revision for the specified file. |
|
85 | 85 | |
|
86 | 86 | If no revision is given then the tip is used. |
|
87 | 87 | |
|
88 | 88 | clone [-U] <source> [dest]:: |
|
89 | 89 | Create a copy of an existing repository in a new directory. |
|
90 | 90 | |
|
91 | 91 | If no destination directory name is specified, it defaults to the |
|
92 | 92 | basename of the source. |
|
93 | 93 | |
|
94 | 94 | The source is added to the new repository's .hg/hgrc file to be used in |
|
95 | 95 | future pulls. |
|
96 | 96 | |
|
97 | 97 | For efficiency, hardlinks are used for cloning whenever the |
|
98 | 98 | source and destination are on the same filesystem. |
|
99 | 99 | |
|
100 | 100 | options: |
|
101 | 101 | -U, --noupdate do not update the new working directory |
|
102 | 102 | |
|
103 | 103 | commit [options] [files...]:: |
|
104 | 104 | Commit changes to the given files into the repository. |
|
105 | 105 | |
|
106 | 106 | If a list of files is omitted, all changes reported by "hg status" |
|
107 | 107 | from the root of the repository will be commited. |
|
108 | 108 | |
|
109 | 109 | The HGEDITOR or EDITOR environment variables are used to start an |
|
110 | 110 | editor to add a commit comment. |
|
111 | 111 | |
|
112 | 112 | Options: |
|
113 | 113 | |
|
114 | 114 | -A, --addremove run addremove during commit |
|
115 | 115 | -I, --include <pat> include names matching the given patterns |
|
116 | 116 | -X, --exclude <pat> exclude names matching the given patterns |
|
117 | 117 | -m, --message <text> use <text> as commit message |
|
118 | 118 | -l, --logfile <file> show the commit message for the given file |
|
119 | 119 | -d, --date <datecode> record datecode as commit date |
|
120 | 120 | -u, --user <user> record user as commiter |
|
121 | 121 | |
|
122 | 122 | aliases: ci |
|
123 | 123 | |
|
124 | 124 | copy <source> <dest>:: |
|
125 | 125 | Mark <dest> file as a copy or rename of a <source> one |
|
126 | 126 | |
|
127 | 127 | This command takes effect for the next commit. |
|
128 | 128 | |
|
129 | 129 | diff [-r revision] [-r revision] [files ...]:: |
|
130 | 130 | Show differences between revisions for the specified files. |
|
131 | 131 | |
|
132 | 132 | Differences between files are shown using the unified diff format. |
|
133 | 133 | |
|
134 | 134 | When two revision arguments are given, then changes are shown |
|
135 | 135 | between those revisions. If only one revision is specified then |
|
136 | 136 | that revision is compared to the working directory, and, when no |
|
137 | 137 | revisions are specified, the working directory files are compared |
|
138 | 138 | to its parent. |
|
139 | 139 | |
|
140 | 140 | options: |
|
141 | 141 | -I, --include <pat> include names matching the given patterns |
|
142 | 142 | -X, --exclude <pat> exclude names matching the given patterns |
|
143 | 143 | |
|
144 | 144 | export [-o filespec] [revision] ...:: |
|
145 | 145 | Print the changeset header and diffs for one or more revisions. |
|
146 | 146 | |
|
147 | 147 | The information shown in the changeset header is: author, |
|
148 | 148 | changeset hash, parent and commit comment. |
|
149 | 149 | |
|
150 | 150 | Output may be to a file, in which case the name of the file is |
|
151 | 151 | given using a format string. The formatting rules are as follows: |
|
152 | 152 | |
|
153 | 153 | %% literal "%" character |
|
154 | 154 | %H changeset hash (40 bytes of hexadecimal) |
|
155 | 155 | %N number of patches being generated |
|
156 | 156 | %R changeset revision number |
|
157 | 157 | %b basename of the exporting repository |
|
158 | 158 | %h short-form changeset hash (12 bytes of hexadecimal) |
|
159 | 159 | %n zero-padded sequence number, starting at 1 |
|
160 | 160 | %r zero-padded changeset revision number |
|
161 | 161 | |
|
162 | 162 | Options: |
|
163 | 163 | |
|
164 | 164 | -o, --output <filespec> print output to file with formatted named |
|
165 | 165 | |
|
166 | 166 | forget [options] [files]:: |
|
167 | 167 | Undo an 'hg add' scheduled for the next commit. |
|
168 | 168 | |
|
169 | 169 | options: |
|
170 | 170 | -I, --include <pat> include names matching the given patterns |
|
171 | 171 | -X, --exclude <pat> exclude names matching the given patterns |
|
172 | 172 | |
|
173 | 173 | heads:: |
|
174 | 174 | Show all repository head changesets. |
|
175 | 175 | |
|
176 | 176 | Repository "heads" are changesets that don't have children |
|
177 | 177 | changesets. They are where development generally takes place and |
|
178 | 178 | are the usual targets for update and merge operations. |
|
179 | 179 | |
|
180 | 180 | identify:: |
|
181 | 181 | Print a short summary of the current state of the repo. |
|
182 | 182 | |
|
183 | 183 | This summary identifies the repository state using one or two parent |
|
184 | 184 | hash identifiers, followed by a "+" if there are uncommitted changes |
|
185 | 185 | in the working directory, followed by a list of tags for this revision. |
|
186 | 186 | |
|
187 | 187 | aliases: id |
|
188 | 188 | |
|
189 | 189 | import [-p <n> -b <base> -q] <patches>:: |
|
190 | 190 | Import a list of patches and commit them individually. |
|
191 | 191 | |
|
192 | 192 | options: |
|
193 | 193 | -p, --strip <n> directory strip option for patch. This has the same |
|
194 | 194 | meaning as the correnponding patch option |
|
195 | 195 | -b <path> base directory to read patches from |
|
196 | 196 | |
|
197 | 197 | aliases: patch |
|
198 | 198 | |
|
199 | 199 | incoming [source]:: |
|
200 | 200 | Show new changesets found in the specified repo or the default |
|
201 | 201 | pull repo. These are the changesets that would be pulled if a pull |
|
202 | 202 | was requested. |
|
203 | 203 | |
|
204 | 204 | Currently only local repositories are supported. |
|
205 | 205 | |
|
206 | 206 | aliases: in |
|
207 | 207 | |
|
208 | 208 | init [dest]:: |
|
209 | 209 | Initialize a new repository in the given directory. If the given |
|
210 | 210 | directory does not exist, it is created. |
|
211 | 211 | |
|
212 | 212 | If no directory is given, the current directory is used. |
|
213 | 213 | |
|
214 | 214 | locate [options] [files]:: |
|
215 | 215 | Print all files under Mercurial control whose names match the |
|
216 | 216 | given patterns. |
|
217 | 217 | |
|
218 | 218 | This command searches the current directory and its |
|
219 | 219 | subdirectories. To search an entire repository, move to the root |
|
220 | 220 | of the repository. |
|
221 | 221 | |
|
222 | 222 | If no patterns are given to match, this command prints all file |
|
223 | 223 | names. |
|
224 | 224 | |
|
225 | 225 | If you want to feed the output of this command into the "xargs" |
|
226 | 226 | command, use the "-0" option to both this command and "xargs". |
|
227 | 227 | This will avoid the problem of "xargs" treating single filenames |
|
228 | 228 | that contain white space as multiple file names. |
|
229 | 229 | |
|
230 | 230 | options: |
|
231 | 231 | |
|
232 | 232 | -0, --print0 end filenames with NUL, for use with xargs |
|
233 | 233 | -f, --fullpath print complete paths from the filesystem root |
|
234 | 234 | -I, --include <pat> include names matching the given patterns |
|
235 | 235 | -r, --rev <rev> search the repository as it stood at rev |
|
236 | 236 | -X, --exclude <pat> exclude names matching the given patterns |
|
237 | 237 | |
|
238 | 238 | log [-r revision ...] [-p] [file]:: |
|
239 | 239 | Print the revision history of the specified file or the entire project. |
|
240 | 240 | |
|
241 | 241 | By default this command outputs: changeset id and hash, tags, |
|
242 | 242 | parents, user, date and time, and a summary for each commit. The |
|
243 | 243 | -v switch adds some more detail, such as changed files, manifest |
|
244 | 244 | hashes or message signatures. |
|
245 | 245 | |
|
246 | 246 | options: |
|
247 | 247 | -r, --rev <A>, ... When a revision argument is given, only this file or |
|
248 | 248 | changelog revision is displayed. With two revision |
|
249 | 249 | arguments all revisions in this range are listed. |
|
250 | 250 | Additional revision arguments may be given repeating |
|
251 | 251 | the above cycle. |
|
252 | 252 | -p, --patch show patch |
|
253 | 253 | |
|
254 | 254 | aliases: history |
|
255 | 255 | |
|
256 | 256 | manifest [revision]:: |
|
257 | 257 | Print a list of version controlled files for the given revision. |
|
258 | 258 | |
|
259 | 259 | The manifest is the list of files being version controlled. If no revision |
|
260 | 260 | is given then the tip is used. |
|
261 | 261 | |
|
262 | 262 | outgoing [dest]:: |
|
263 | 263 | Show changesets not found in the specified destination repo or the |
|
264 | 264 | default push repo. These are the changesets that would be pushed |
|
265 | 265 | if a push was requested. |
|
266 | 266 | |
|
267 | 267 | aliases: out |
|
268 | 268 | |
|
269 | 269 | parents:: |
|
270 | 270 | Print the working directory's parent revisions. |
|
271 | 271 | |
|
272 | 272 | paths [NAME]:: |
|
273 | 273 | Show definition of symbolic path name NAME. If no name is given, show |
|
274 | 274 | definition of available names. |
|
275 | 275 | |
|
276 |
Path names are defined in the [paths] section of |
|
|
277 | <repo>/.hg/hgrc configuration files. If run outside a repo, 'paths' | |
|
278 | queries only $HOME/.hgrc. | |
|
276 | Path names are defined in the [paths] section of /etc/mercurial/hgrc | |
|
277 | and $HOME/.hgrc. If run inside a repository, .hg/hgrc is used, too. | |
|
279 | 278 | |
|
280 | 279 | pull <repository path>:: |
|
281 | 280 | Pull changes from a remote repository to a local one. |
|
282 | 281 | |
|
283 | 282 | This finds all changes from the repository at the specified path |
|
284 | 283 | or URL and adds them to the local repository. By default, this |
|
285 | 284 | does not update the copy of the project in the working directory. |
|
286 | 285 | |
|
287 | 286 | options: |
|
288 | 287 | -u, --update update the working directory to tip after pull |
|
289 | 288 | |
|
290 | 289 | push <destination>:: |
|
291 | 290 | Push changes from the local repository to the given destination. |
|
292 | 291 | |
|
293 | 292 | This is the symmetrical operation for pull. It helps to move |
|
294 | 293 | changes from the current repository to a different one. If the |
|
295 | 294 | destination is local this is identical to a pull in that directory |
|
296 | 295 | from the current one. |
|
297 | 296 | |
|
298 | 297 | The other currently available push method is SSH. This requires an |
|
299 | 298 | accessible shell account on the destination machine and a copy of |
|
300 | 299 | hg in the remote path. Destinations are specified in the following |
|
301 | 300 | form: |
|
302 | 301 | |
|
303 | 302 | ssh://[user@]host[:port]/path |
|
304 | 303 | |
|
305 | 304 | rawcommit [-p -d -u -F -m -l]:: |
|
306 | 305 | Lowlevel commit, for use in helper scripts. |
|
307 | 306 | |
|
308 | 307 | This command is not intended to be used by normal users, as it is |
|
309 | 308 | primarily useful for importing from other SCMs. |
|
310 | 309 | |
|
311 | 310 | recover:: |
|
312 | 311 | Recover from an interrupted commit or pull. |
|
313 | 312 | |
|
314 | 313 | This command tries to fix the repository status after an interrupted |
|
315 | 314 | operation. It should only be necessary when Mercurial suggests it. |
|
316 | 315 | |
|
317 | 316 | remove [files ...]:: |
|
318 | 317 | Schedule the indicated files for removal from the repository. |
|
319 | 318 | |
|
320 | 319 | This command shedules the files to be removed at the next commit. |
|
321 | 320 | This only removes files from the current branch, not from the |
|
322 | 321 | entire project history. |
|
323 | 322 | |
|
324 | 323 | aliases: rm |
|
325 | 324 | |
|
326 | 325 | revert [names ...]:: |
|
327 | 326 | Revert any uncommitted modifications made to the named files or |
|
328 | 327 | directories. This restores the contents of the affected files to |
|
329 | 328 | an unmodified state. |
|
330 | 329 | |
|
331 | 330 | If a file has been deleted, it is recreated. If the executable |
|
332 | 331 | mode of a file was changed, it is reset. |
|
333 | 332 | |
|
334 | 333 | If a directory is given, all files in that directory and its |
|
335 | 334 | subdirectories are reverted. |
|
336 | 335 | |
|
337 | 336 | If no arguments are given, all files in the current directory and |
|
338 | 337 | its subdirectories are reverted. |
|
339 | 338 | |
|
340 | 339 | options: |
|
341 | 340 | -r, --rev <rev> revision to revert to |
|
342 | 341 | -n, --nonrecursive do not recurse into subdirectories |
|
343 | 342 | |
|
344 | 343 | root:: |
|
345 | 344 | Print the root directory of the current repository. |
|
346 | 345 | |
|
347 | 346 | serve [options]:: |
|
348 | 347 | Start a local HTTP repository browser and pull server. |
|
349 | 348 | |
|
350 | 349 | By default, the server logs accesses to stdout and errors to |
|
351 | 350 | stderr. Use the "-A" and "-E" options to log to files. |
|
352 | 351 | |
|
353 | 352 | options: |
|
354 | 353 | -A, --accesslog <file> name of access log file to write to |
|
355 | 354 | -E, --errorlog <file> name of error log file to write to |
|
356 | 355 | -a, --address <addr> address to use |
|
357 | 356 | -p, --port <n> port to use (default: 8000) |
|
358 | 357 | -n, --name <name> name to show in web pages (default: working dir) |
|
359 | 358 | -t, --templatedir <path> web templates to use |
|
360 | 359 | -6, --ipv6 use IPv6 in addition to IPv4 |
|
361 | 360 | |
|
362 | 361 | status [options] [files]:: |
|
363 | 362 | Show changed files in the working directory. If no names are |
|
364 | 363 | given, all files are shown. Otherwise, only files matching the |
|
365 | 364 | given names are shown. |
|
366 | 365 | |
|
367 | 366 | The codes used to show the status of files are: |
|
368 | 367 | |
|
369 | 368 | M = changed |
|
370 | 369 | A = added |
|
371 | 370 | R = removed |
|
372 | 371 | ? = not tracked |
|
373 | 372 | |
|
374 | 373 | options: |
|
375 | 374 | |
|
376 | 375 | -m, --modified show only modified files |
|
377 | 376 | -a, --added show only added files |
|
378 | 377 | -r, --removed show only removed files |
|
379 | 378 | -u, --unknown show only unknown (not tracked) files |
|
380 | 379 | -I, --include <pat> include names matching the given patterns |
|
381 | 380 | -X, --exclude <pat> exclude names matching the given patterns |
|
382 | 381 | |
|
383 | 382 | tag [-l -m <text> -d <datecode> -u <user>] <name> [revision]:: |
|
384 | 383 | Name a particular revision using <name>. |
|
385 | 384 | |
|
386 | 385 | Tags are used to name particular revisions of the repository and are |
|
387 | 386 | very useful to compare different revision, to go back to significant |
|
388 | 387 | earlier versions or to mark branch points as releases, etc. |
|
389 | 388 | |
|
390 | 389 | If no revision is given, the tip is used. |
|
391 | 390 | |
|
392 | 391 | To facilitate version control, distribution, and merging of tags, |
|
393 | 392 | they are stored as a file named ".hgtags" which is managed |
|
394 | 393 | similarly to other project files and can be hand-edited if |
|
395 | 394 | necessary. |
|
396 | 395 | |
|
397 | 396 | options: |
|
398 | 397 | -l, --local make the tag local |
|
399 | 398 | -m, --message <text> message for tag commit log entry |
|
400 | 399 | -d, --date <datecode> datecode for commit |
|
401 | 400 | -u, --user <user> user for commit |
|
402 | 401 | |
|
403 | 402 | Note: Local tags are not version-controlled or distributed and are |
|
404 | 403 | stored in the .hg/localtags file. If there exists a local tag and |
|
405 | 404 | a public tag with the same name, local tag is used. |
|
406 | 405 | |
|
407 | 406 | tags:: |
|
408 | 407 | List the repository tags. |
|
409 | 408 | |
|
410 | 409 | This lists both regular and local tags. |
|
411 | 410 | |
|
412 | 411 | tip:: |
|
413 | 412 | Show the tip revision. |
|
414 | 413 | |
|
415 | 414 | undo:: |
|
416 | 415 | Undo the last commit or pull transaction. |
|
417 | 416 | |
|
418 | 417 | Roll back the last pull or commit transaction on the |
|
419 | 418 | repository, restoring the project to its earlier state. |
|
420 | 419 | |
|
421 | 420 | This command should be used with care. There is only one level of |
|
422 | 421 | undo and there is no redo. |
|
423 | 422 | |
|
424 | 423 | This command is not intended for use on public repositories. Once |
|
425 | 424 | a change is visible for pull by other users, undoing it locally is |
|
426 | 425 | ineffective. |
|
427 | 426 | |
|
428 | 427 | update [-m -C] [revision]:: |
|
429 | 428 | Update the working directory to the specified revision. |
|
430 | 429 | |
|
431 | 430 | By default, update will refuse to run if doing so would require |
|
432 | 431 | merging or discarding local changes. |
|
433 | 432 | |
|
434 | 433 | With the -m option, a merge will be performed. |
|
435 | 434 | |
|
436 | 435 | With the -C option, local changes will be lost. |
|
437 | 436 | |
|
438 | 437 | options: |
|
439 | 438 | -m, --merge allow merging of branches |
|
440 | 439 | -C, --clean overwrite locally modified files |
|
441 | 440 | |
|
442 | 441 | aliases: up checkout co |
|
443 | 442 | |
|
444 | 443 | verify:: |
|
445 | 444 | Verify the integrity of the current repository. |
|
446 | 445 | |
|
447 | 446 | This will perform an extensive check of the repository's |
|
448 | 447 | integrity, validating the hashes and checksums of each entry in |
|
449 | 448 | the changelog, manifest, and tracked files, as well as the |
|
450 | 449 | integrity of their crosslinks and indices. |
|
451 | 450 | |
|
452 | 451 | FILE NAME PATTERNS |
|
453 | 452 | ------------------ |
|
454 | 453 | |
|
455 | 454 | Mercurial accepts several notations for identifying one or more |
|
456 | 455 | file at a time. |
|
457 | 456 | |
|
458 | 457 | By default, Mercurial treats file names as shell-style extended |
|
459 | 458 | glob patterns. |
|
460 | 459 | |
|
461 | 460 | Alternate pattern notations must be specified explicitly. |
|
462 | 461 | |
|
463 | 462 | To use a plain path name without any pattern matching, start a |
|
464 | 463 | name with "path:". These path names must match completely, from |
|
465 | 464 | the root of the current repository. |
|
466 | 465 | |
|
467 | 466 | To use an extended glob, start a name with "glob:". Globs are |
|
468 | 467 | rooted at the current directory; a glob such as "*.c" will match |
|
469 | 468 | files ending in ".c" in the current directory only. |
|
470 | 469 | |
|
471 | 470 | The supported glob syntax extensions are "**" to match any string |
|
472 | 471 | across path separators, and "{a,b}" to mean "a or b". |
|
473 | 472 | |
|
474 | 473 | To use a Perl/Python regular expression, start a name with "re:". |
|
475 | 474 | Regexp pattern matching is anchored at the root of the repository. |
|
476 | 475 | |
|
477 | 476 | Plain examples: |
|
478 | 477 | |
|
479 | 478 | path:foo/bar a name bar in a directory named foo in the root of |
|
480 | 479 | the repository |
|
481 | 480 | path:path:name a file or directory named "path:name" |
|
482 | 481 | |
|
483 | 482 | Glob examples: |
|
484 | 483 | |
|
485 | 484 | glob:*.c any name ending in ".c" in the current directory |
|
486 | 485 | *.c any name ending in ".c" in the current directory |
|
487 | 486 | **.c any name ending in ".c" in the current directory, or |
|
488 | 487 | any subdirectory |
|
489 | 488 | foo/*.c any name ending in ".c" in the directory foo |
|
490 | 489 | foo/**.c any name ending in ".c" in the directory foo, or any |
|
491 | 490 | subdirectory |
|
492 | 491 | |
|
493 | 492 | Regexp examples: |
|
494 | 493 | |
|
495 | 494 | re:.*\.c$ any name ending in ".c", anywhere in the repsitory |
|
496 | 495 | |
|
497 | 496 | |
|
498 | 497 | SPECIFYING SINGLE REVISIONS |
|
499 | 498 | --------------------------- |
|
500 | 499 | |
|
501 | 500 | Mercurial accepts several notations for identifying individual |
|
502 | 501 | revisions. |
|
503 | 502 | |
|
504 | 503 | A plain integer is treated as a revision number. Negative |
|
505 | 504 | integers are treated as offsets from the tip, with -1 denoting the |
|
506 | 505 | tip. |
|
507 | 506 | |
|
508 | 507 | A 40-digit hexadecimal string is treated as a unique revision |
|
509 | 508 | identifier. |
|
510 | 509 | |
|
511 | 510 | A hexadecimal string less than 40 characters long is treated as a |
|
512 | 511 | unique revision identifier, and referred to as a short-form |
|
513 | 512 | identifier. A short-form identifier is only valid if it is the |
|
514 | 513 | prefix of one full-length identifier. |
|
515 | 514 | |
|
516 | 515 | Any other string is treated as a tag name, which is a symbolic |
|
517 | 516 | name associated with a revision identifier. Tag names may not |
|
518 | 517 | contain the ":" character. |
|
519 | 518 | |
|
520 | 519 | The reserved name "tip" is a special tag that always identifies |
|
521 | 520 | the most recent revision. |
|
522 | 521 | |
|
523 | 522 | SPECIFYING MULTIPLE REVISIONS |
|
524 | 523 | ----------------------------- |
|
525 | 524 | |
|
526 | 525 | When Mercurial accepts more than one revision, they may be |
|
527 | 526 | specified individually, or provided as a continuous range, |
|
528 | 527 | separated by the ":" character. |
|
529 | 528 | |
|
530 | 529 | The syntax of range notation is [BEGIN]:[END], where BEGIN and END |
|
531 | 530 | are revision identifiers. Both BEGIN and END are optional. If |
|
532 | 531 | BEGIN is not specified, it defaults to revision number 0. If END |
|
533 | 532 | is not specified, it defaults to the tip. The range ":" thus |
|
534 | 533 | means "all revisions". |
|
535 | 534 | |
|
536 | 535 | If BEGIN is greater than END, revisions are treated in reverse |
|
537 | 536 | order. |
|
538 | 537 | |
|
539 | 538 | A range acts as a closed interval. This means that a range of 3:5 |
|
540 | 539 | gives 3, 4 and 5. Similarly, a range of 4:2 gives 4, 3, and 2. |
|
541 | 540 | |
|
542 | 541 | ENVIRONMENT VARIABLES |
|
543 | 542 | --------------------- |
|
544 | 543 | |
|
545 | 544 | HGEDITOR:: |
|
546 | 545 | This is the name of the editor to use when committing. Defaults to the |
|
547 | 546 | value of EDITOR. |
|
548 | 547 | |
|
549 | 548 | (deprecated, use .hgrc) |
|
550 | 549 | |
|
551 | 550 | HGMERGE:: |
|
552 | 551 | An executable to use for resolving merge conflicts. The program |
|
553 | 552 | will be executed with three arguments: local file, remote file, |
|
554 | 553 | ancestor file. |
|
555 | 554 | |
|
556 | 555 | The default program is "hgmerge", which is a shell script provided |
|
557 | 556 | by Mercurial with some sensible defaults. |
|
558 | 557 | |
|
559 | 558 | (deprecated, use .hgrc) |
|
560 | 559 | |
|
561 | 560 | HGUSER:: |
|
562 | 561 | This is the string used for the author of a commit. |
|
563 | 562 | |
|
564 | 563 | (deprecated, use .hgrc) |
|
565 | 564 | |
|
566 | 565 | EMAIL:: |
|
567 | 566 | If HGUSER is not set, this will be used as the author for a commit. |
|
568 | 567 | |
|
569 | 568 | LOGNAME:: |
|
570 | 569 | If neither HGUSER nor EMAIL is set, LOGNAME will be used (with |
|
571 | 570 | '@hostname' appended) as the author value for a commit. |
|
572 | 571 | |
|
573 | 572 | EDITOR:: |
|
574 | 573 | This is the name of the editor used in the hgmerge script. It will be |
|
575 | 574 | used for commit messages if HGEDITOR isn't set. Defaults to 'vi'. |
|
576 | 575 | |
|
577 | 576 | PYTHONPATH:: |
|
578 | 577 | This is used by Python to find imported modules and may need to be set |
|
579 | 578 | appropriately if Mercurial is not installed system-wide. |
|
580 | 579 | |
|
581 | 580 | FILES |
|
582 | 581 | ----- |
|
583 | 582 | .hgignore:: |
|
584 | 583 | This file contains regular expressions (one per line) that describe file |
|
585 | 584 | names that should be ignored by hg. |
|
586 | 585 | |
|
587 | 586 | .hgtags:: |
|
588 | 587 | This file contains changeset hash values and text tag names (one of each |
|
589 | 588 | seperated by spaces) that correspond to tagged versions of the repository |
|
590 | 589 | contents. |
|
591 | 590 | |
|
592 | $HOME/.hgrc, .hg/hgrc:: | |
|
591 | /etc/mercurial/hgrc, $HOME/.hgrc, .hg/hgrc:: | |
|
593 | 592 | This file contains defaults and configuration. Values in .hg/hgrc |
|
594 | override those in .hgrc. See hgrc(5) for details of the contents | |
|
595 | and format of these files. | |
|
593 | override those in $HOME/.hgrc, and these override settings made in the | |
|
594 | global /etc/mercurial/hgrc configuration. See hgrc(5) for details of | |
|
595 | the contents and format of these files. | |
|
596 | 596 | |
|
597 | 597 | BUGS |
|
598 | 598 | ---- |
|
599 | 599 | Probably lots, please post them to the mailing list (See Resources below) |
|
600 | 600 | when you find them. |
|
601 | 601 | |
|
602 | 602 | SEE ALSO |
|
603 | 603 | -------- |
|
604 | 604 | hgrc(5) |
|
605 | 605 | |
|
606 | 606 | AUTHOR |
|
607 | 607 | ------ |
|
608 | 608 | Written by Matt Mackall <mpm@selenic.com> |
|
609 | 609 | |
|
610 | 610 | RESOURCES |
|
611 | 611 | --------- |
|
612 | 612 | http://selenic.com/mercurial[Main Web Site] |
|
613 | 613 | |
|
614 | 614 | http://www.serpentine.com/mercurial[Wiki site] |
|
615 | 615 | |
|
616 | 616 | http://selenic.com/hg[Source code repository] |
|
617 | 617 | |
|
618 | 618 | http://selenic.com/mailman/listinfo/mercurial[Mailing list] |
|
619 | 619 | |
|
620 | 620 | COPYING |
|
621 | 621 | ------- |
|
622 | 622 | Copyright (C) 2005 Matt Mackall. |
|
623 | 623 | Free use of this software is granted under the terms of the GNU General |
|
624 | 624 | Public License (GPL). |
@@ -1,146 +1,151 | |||
|
1 | 1 | HGRC(5) |
|
2 | 2 | ======= |
|
3 | 3 | Bryan O'Sullivan <bos@serpentine.com> |
|
4 | 4 | |
|
5 | 5 | NAME |
|
6 | 6 | ---- |
|
7 | 7 | hgrc - configuration files for Mercurial |
|
8 | 8 | |
|
9 | 9 | SYNOPSIS |
|
10 | 10 | -------- |
|
11 | 11 | |
|
12 | 12 | The Mercurial system uses a set of configuration files to control |
|
13 | 13 | aspects of its behaviour. |
|
14 | 14 | |
|
15 | 15 | FILES |
|
16 | 16 | ----- |
|
17 | 17 | |
|
18 |
Mercurial reads configuration data from t |
|
|
18 | Mercurial reads configuration data from three files: | |
|
19 | ||
|
20 | /etc/mercurial/hgrc:: | |
|
21 | Options in this global configuration file apply to all Mercurial | |
|
22 | commands executed by any user in any directory. | |
|
19 | 23 | |
|
20 | 24 | $HOME/.hgrc:: |
|
21 |
|
|
|
22 |
no matter |
|
|
25 | Per-user configuration options that apply to all Mercurial commands, | |
|
26 | no matter from which directory they are run. Values in this file | |
|
27 | override global settings. | |
|
23 | 28 | |
|
24 | 29 | <repo>/.hg/hgrc:: |
|
25 | 30 | Per-repository configuration options that only apply in a |
|
26 | 31 | particular repository. This file is not version-controlled, and |
|
27 | 32 | will not get transferred during a "clone" operation. Values in |
|
28 |
this file override global |
|
|
33 | this file override global and per-user settings. | |
|
29 | 34 | |
|
30 | 35 | SYNTAX |
|
31 | 36 | ------ |
|
32 | 37 | |
|
33 | 38 | A configuration file consists of sections, led by a "[section]" header |
|
34 | 39 | and followed by "name: value" entries; "name=value" is also accepted. |
|
35 | 40 | |
|
36 | 41 | [spam] |
|
37 | 42 | eggs=ham |
|
38 | 43 | green= |
|
39 | 44 | eggs |
|
40 | 45 | |
|
41 | 46 | Each line contains one entry. If the lines that follow are indented, |
|
42 | 47 | they are treated as continuations of that entry. |
|
43 | 48 | |
|
44 | 49 | Leading whitespace is removed from values. Empty lines are skipped. |
|
45 | 50 | |
|
46 | 51 | The optional values can contain format strings which refer to other |
|
47 | 52 | values in the same section, or values in a special DEFAULT section. |
|
48 | 53 | |
|
49 | 54 | Lines beginning with "#" or ";" are ignored and may be used to provide |
|
50 | 55 | comments. |
|
51 | 56 | |
|
52 | 57 | SECTIONS |
|
53 | 58 | -------- |
|
54 | 59 | |
|
55 | 60 | This section describes the different sections that may appear in a |
|
56 | 61 | Mercurial "hgrc" file, the purpose of each section, its possible |
|
57 | 62 | keys, and their possible values. |
|
58 | 63 | |
|
59 | 64 | hooks:: |
|
60 | 65 | Commands that get automatically executed by various actions such as |
|
61 | 66 | starting or finishing a commit. |
|
62 | 67 | precommit;; |
|
63 | 68 | Run before starting a commit. Exit status 0 allows the commit to |
|
64 | 69 | proceed. Non-zero status will cause the commit to fail. |
|
65 | 70 | commit;; |
|
66 | 71 | Run after a changeset has been created. Passed the ID of the newly |
|
67 | 72 | created changeset. |
|
68 | 73 | |
|
69 | 74 | http_proxy:: |
|
70 | 75 | Used to access web-based Mercurial repositories through a HTTP |
|
71 | 76 | proxy. |
|
72 | 77 | host;; |
|
73 | 78 | Host name and (optional) port of the proxy server, for example |
|
74 | 79 | "myproxy:8000". |
|
75 | 80 | user;; |
|
76 | 81 | Optional. User name to authenticate with at the proxy server. |
|
77 | 82 | passwd;; |
|
78 | 83 | Optional. Password to authenticate with at the proxy server. |
|
79 | 84 | no;; |
|
80 | 85 | Optional. Comma-separated list of host names that should bypass |
|
81 | 86 | the proxy. |
|
82 | 87 | |
|
83 | 88 | paths:: |
|
84 | 89 | Assigns symbolic names to repositories. The left side is the |
|
85 | 90 | symbolic name, and the right gives the directory or URL that is the |
|
86 | 91 | location of the repository. |
|
87 | 92 | |
|
88 | 93 | tags:: |
|
89 | 94 | Tags that are local to a repository and not distributed or version |
|
90 | 95 | controlled. The left side is the tag name, and the right is the |
|
91 | 96 | ID of the changeset to identify. |
|
92 | 97 | |
|
93 | 98 | ui:: |
|
94 | 99 | User interface controls. |
|
95 | 100 | debug;; |
|
96 | 101 | Print debugging information. True or False. Default is False. |
|
97 | 102 | editor;; |
|
98 | 103 | The editor to use during a commit. Default is $EDITOR or "vi". |
|
99 | 104 | interactive;; |
|
100 | 105 | Allow to prompt the user. True or False. Default is True. |
|
101 | 106 | merge;; |
|
102 | 107 | The conflict resolution program to use during a manual merge. |
|
103 | 108 | Default is "hgmerge". |
|
104 | 109 | quiet;; |
|
105 | 110 | Reduce the amount of output printed. True or False. Default is False. |
|
106 | 111 | username;; |
|
107 | 112 | The committer of a changeset created when running "commit". |
|
108 | 113 | Typically a person's name and email address, e.g. "Fred Widget |
|
109 | 114 | <fred@example.com>". Default is $EMAIL or username@hostname. |
|
110 | 115 | verbose;; |
|
111 | 116 | Increase the amount of output printed. True or False. Default is False. |
|
112 | 117 | |
|
113 | 118 | web:: |
|
114 | 119 | Web interface configuration. |
|
115 | 120 | name;; |
|
116 | 121 | Repository name to use in the web interface. Default is current |
|
117 | 122 | working directory. |
|
118 | 123 | address;; |
|
119 | 124 | Interface address to bind to. Default is all. |
|
120 | 125 | port;; |
|
121 | 126 | Port to listen on. Default is 8000. |
|
122 | 127 | ipv6;; |
|
123 | 128 | Whether to use IPv6. Default is false. |
|
124 | 129 | accesslog;; |
|
125 | 130 | Where to output the access log. Default is stdout. |
|
126 | 131 | errorlog;; |
|
127 | 132 | Where to output the error log. Default is stderr. |
|
128 | 133 | templates;; |
|
129 | 134 | Where to find the HTML templates. Default is install path. |
|
130 | 135 | |
|
131 | 136 | AUTHOR |
|
132 | 137 | ------ |
|
133 | 138 | Bryan O'Sullivan <bos@serpentine.com>. |
|
134 | 139 | |
|
135 | 140 | Mercurial was written by Matt Mackall <mpm@selenic.com>. |
|
136 | 141 | |
|
137 | 142 | SEE ALSO |
|
138 | 143 | -------- |
|
139 | 144 | hg(1) |
|
140 | 145 | |
|
141 | 146 | COPYING |
|
142 | 147 | ------- |
|
143 | 148 | This manual page is copyright 2005 Bryan O'Sullivan. |
|
144 | 149 | Mercurial is copyright 2005 Matt Mackall. |
|
145 | 150 | Free use of this software is granted under the terms of the GNU General |
|
146 | 151 | Public License (GPL). |
@@ -1,108 +1,109 | |||
|
1 | 1 | # ui.py - user interface bits for mercurial |
|
2 | 2 | # |
|
3 | 3 | # Copyright 2005 Matt Mackall <mpm@selenic.com> |
|
4 | 4 | # |
|
5 | 5 | # This software may be used and distributed according to the terms |
|
6 | 6 | # of the GNU General Public License, incorporated herein by reference. |
|
7 | 7 | |
|
8 | 8 | import os, ConfigParser |
|
9 | 9 | from demandload import * |
|
10 | 10 | demandload(globals(), "re socket sys util") |
|
11 | 11 | |
|
12 | 12 | class ui: |
|
13 | 13 | def __init__(self, verbose=False, debug=False, quiet=False, |
|
14 | 14 | interactive=True): |
|
15 | 15 | self.cdata = ConfigParser.SafeConfigParser() |
|
16 |
self.cdata.read(os.path. |
|
|
16 | self.cdata.read([os.path.normpath(hgrc) for hgrc in | |
|
17 | "/etc/mercurial/hgrc", os.path.expanduser("~/.hgrc")]) | |
|
17 | 18 | |
|
18 | 19 | self.quiet = self.configbool("ui", "quiet") |
|
19 | 20 | self.verbose = self.configbool("ui", "verbose") |
|
20 | 21 | self.debugflag = self.configbool("ui", "debug") |
|
21 | 22 | self.interactive = self.configbool("ui", "interactive", True) |
|
22 | 23 | |
|
23 | 24 | self.quiet = (self.quiet or quiet) and not verbose and not debug |
|
24 | 25 | self.verbose = (self.verbose or verbose) or debug |
|
25 | 26 | self.debugflag = (self.debugflag or debug) |
|
26 | 27 | self.interactive = (self.interactive and interactive) |
|
27 | 28 | |
|
28 | 29 | def readconfig(self, fp): |
|
29 | 30 | self.cdata.readfp(fp) |
|
30 | 31 | |
|
31 | 32 | def config(self, section, val, default=None): |
|
32 | 33 | if self.cdata.has_option(section, val): |
|
33 | 34 | return self.cdata.get(section, val) |
|
34 | 35 | return default |
|
35 | 36 | |
|
36 | 37 | def configbool(self, section, val, default=False): |
|
37 | 38 | if self.cdata.has_option(section, val): |
|
38 | 39 | return self.cdata.getboolean(section, val) |
|
39 | 40 | return default |
|
40 | 41 | |
|
41 | 42 | def configitems(self, section): |
|
42 | 43 | if self.cdata.has_section(section): |
|
43 | 44 | return self.cdata.items(section) |
|
44 | 45 | return [] |
|
45 | 46 | |
|
46 | 47 | def username(self): |
|
47 | 48 | return (os.environ.get("HGUSER") or |
|
48 | 49 | self.config("ui", "username") or |
|
49 | 50 | os.environ.get("EMAIL") or |
|
50 | 51 | (os.environ.get("LOGNAME", |
|
51 | 52 | os.environ.get("USERNAME", "unknown")) |
|
52 | 53 | + '@' + socket.getfqdn())) |
|
53 | 54 | |
|
54 | 55 | def expandpath(self, loc): |
|
55 | 56 | paths = {} |
|
56 | 57 | for name, path in self.configitems("paths"): |
|
57 | 58 | paths[name] = path |
|
58 | 59 | |
|
59 | 60 | return paths.get(loc, loc) |
|
60 | 61 | |
|
61 | 62 | def write(self, *args): |
|
62 | 63 | for a in args: |
|
63 | 64 | sys.stdout.write(str(a)) |
|
64 | 65 | |
|
65 | 66 | def write_err(self, *args): |
|
66 | 67 | sys.stdout.flush() |
|
67 | 68 | for a in args: |
|
68 | 69 | sys.stderr.write(str(a)) |
|
69 | 70 | |
|
70 | 71 | def readline(self): |
|
71 | 72 | return sys.stdin.readline()[:-1] |
|
72 | 73 | def prompt(self, msg, pat, default = "y"): |
|
73 | 74 | if not self.interactive: return default |
|
74 | 75 | while 1: |
|
75 | 76 | self.write(msg, " ") |
|
76 | 77 | r = self.readline() |
|
77 | 78 | if re.match(pat, r): |
|
78 | 79 | return r |
|
79 | 80 | else: |
|
80 | 81 | self.write("unrecognized response\n") |
|
81 | 82 | def status(self, *msg): |
|
82 | 83 | if not self.quiet: self.write(*msg) |
|
83 | 84 | def warn(self, *msg): |
|
84 | 85 | self.write_err(*msg) |
|
85 | 86 | def note(self, *msg): |
|
86 | 87 | if self.verbose: self.write(*msg) |
|
87 | 88 | def debug(self, *msg): |
|
88 | 89 | if self.debugflag: self.write(*msg) |
|
89 | 90 | def edit(self, text): |
|
90 | 91 | import tempfile |
|
91 | 92 | (fd, name) = tempfile.mkstemp("hg") |
|
92 | 93 | f = os.fdopen(fd, "w") |
|
93 | 94 | f.write(text) |
|
94 | 95 | f.close() |
|
95 | 96 | |
|
96 | 97 | editor = (os.environ.get("HGEDITOR") or |
|
97 | 98 | self.config("ui", "editor") or |
|
98 | 99 | os.environ.get("EDITOR", "vi")) |
|
99 | 100 | |
|
100 | 101 | os.environ["HGUSER"] = self.username() |
|
101 | 102 | util.system("%s %s" % (editor, name), errprefix = "edit failed") |
|
102 | 103 | |
|
103 | 104 | t = open(name).read() |
|
104 | 105 | t = re.sub("(?m)^HG:.*\n", "", t) |
|
105 | 106 | |
|
106 | 107 | os.unlink(name) |
|
107 | 108 | |
|
108 | 109 | return t |
General Comments 0
You need to be logged in to leave comments.
Login now