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