##// END OF EJS Templates
commands: update help for "unbundle"...
Gregory Szorc -
r31795:2b130e26 default
parent child Browse files
Show More
@@ -1,5467 +1,5466 b''
1 # commands.py - command processing for mercurial
1 # commands.py - command processing for mercurial
2 #
2 #
3 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
3 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 from __future__ import absolute_import
8 from __future__ import absolute_import
9
9
10 import difflib
10 import difflib
11 import errno
11 import errno
12 import os
12 import os
13 import re
13 import re
14
14
15 from .i18n import _
15 from .i18n import _
16 from .node import (
16 from .node import (
17 hex,
17 hex,
18 nullid,
18 nullid,
19 nullrev,
19 nullrev,
20 short,
20 short,
21 )
21 )
22 from . import (
22 from . import (
23 archival,
23 archival,
24 bookmarks,
24 bookmarks,
25 bundle2,
25 bundle2,
26 changegroup,
26 changegroup,
27 cmdutil,
27 cmdutil,
28 copies,
28 copies,
29 destutil,
29 destutil,
30 dirstateguard,
30 dirstateguard,
31 discovery,
31 discovery,
32 encoding,
32 encoding,
33 error,
33 error,
34 exchange,
34 exchange,
35 extensions,
35 extensions,
36 graphmod,
36 graphmod,
37 hbisect,
37 hbisect,
38 help,
38 help,
39 hg,
39 hg,
40 lock as lockmod,
40 lock as lockmod,
41 merge as mergemod,
41 merge as mergemod,
42 obsolete,
42 obsolete,
43 patch,
43 patch,
44 phases,
44 phases,
45 pycompat,
45 pycompat,
46 rcutil,
46 rcutil,
47 revsetlang,
47 revsetlang,
48 scmutil,
48 scmutil,
49 server,
49 server,
50 sshserver,
50 sshserver,
51 streamclone,
51 streamclone,
52 tags as tagsmod,
52 tags as tagsmod,
53 templatekw,
53 templatekw,
54 ui as uimod,
54 ui as uimod,
55 util,
55 util,
56 )
56 )
57
57
58 release = lockmod.release
58 release = lockmod.release
59
59
60 table = {}
60 table = {}
61
61
62 command = cmdutil.command(table)
62 command = cmdutil.command(table)
63
63
64 # label constants
64 # label constants
65 # until 3.5, bookmarks.current was the advertised name, not
65 # until 3.5, bookmarks.current was the advertised name, not
66 # bookmarks.active, so we must use both to avoid breaking old
66 # bookmarks.active, so we must use both to avoid breaking old
67 # custom styles
67 # custom styles
68 activebookmarklabel = 'bookmarks.active bookmarks.current'
68 activebookmarklabel = 'bookmarks.active bookmarks.current'
69
69
70 # common command options
70 # common command options
71
71
72 globalopts = [
72 globalopts = [
73 ('R', 'repository', '',
73 ('R', 'repository', '',
74 _('repository root directory or name of overlay bundle file'),
74 _('repository root directory or name of overlay bundle file'),
75 _('REPO')),
75 _('REPO')),
76 ('', 'cwd', '',
76 ('', 'cwd', '',
77 _('change working directory'), _('DIR')),
77 _('change working directory'), _('DIR')),
78 ('y', 'noninteractive', None,
78 ('y', 'noninteractive', None,
79 _('do not prompt, automatically pick the first choice for all prompts')),
79 _('do not prompt, automatically pick the first choice for all prompts')),
80 ('q', 'quiet', None, _('suppress output')),
80 ('q', 'quiet', None, _('suppress output')),
81 ('v', 'verbose', None, _('enable additional output')),
81 ('v', 'verbose', None, _('enable additional output')),
82 ('', 'color', '',
82 ('', 'color', '',
83 # i18n: 'always', 'auto', 'never', and 'debug' are keywords
83 # i18n: 'always', 'auto', 'never', and 'debug' are keywords
84 # and should not be translated
84 # and should not be translated
85 _("when to colorize (boolean, always, auto, never, or debug)"),
85 _("when to colorize (boolean, always, auto, never, or debug)"),
86 _('TYPE')),
86 _('TYPE')),
87 ('', 'config', [],
87 ('', 'config', [],
88 _('set/override config option (use \'section.name=value\')'),
88 _('set/override config option (use \'section.name=value\')'),
89 _('CONFIG')),
89 _('CONFIG')),
90 ('', 'debug', None, _('enable debugging output')),
90 ('', 'debug', None, _('enable debugging output')),
91 ('', 'debugger', None, _('start debugger')),
91 ('', 'debugger', None, _('start debugger')),
92 ('', 'encoding', encoding.encoding, _('set the charset encoding'),
92 ('', 'encoding', encoding.encoding, _('set the charset encoding'),
93 _('ENCODE')),
93 _('ENCODE')),
94 ('', 'encodingmode', encoding.encodingmode,
94 ('', 'encodingmode', encoding.encodingmode,
95 _('set the charset encoding mode'), _('MODE')),
95 _('set the charset encoding mode'), _('MODE')),
96 ('', 'traceback', None, _('always print a traceback on exception')),
96 ('', 'traceback', None, _('always print a traceback on exception')),
97 ('', 'time', None, _('time how long the command takes')),
97 ('', 'time', None, _('time how long the command takes')),
98 ('', 'profile', None, _('print command execution profile')),
98 ('', 'profile', None, _('print command execution profile')),
99 ('', 'version', None, _('output version information and exit')),
99 ('', 'version', None, _('output version information and exit')),
100 ('h', 'help', None, _('display help and exit')),
100 ('h', 'help', None, _('display help and exit')),
101 ('', 'hidden', False, _('consider hidden changesets')),
101 ('', 'hidden', False, _('consider hidden changesets')),
102 ('', 'pager', 'auto',
102 ('', 'pager', 'auto',
103 _("when to paginate (boolean, always, auto, or never)"), _('TYPE')),
103 _("when to paginate (boolean, always, auto, or never)"), _('TYPE')),
104 ]
104 ]
105
105
106 dryrunopts = [('n', 'dry-run', None,
106 dryrunopts = [('n', 'dry-run', None,
107 _('do not perform actions, just print output'))]
107 _('do not perform actions, just print output'))]
108
108
109 remoteopts = [
109 remoteopts = [
110 ('e', 'ssh', '',
110 ('e', 'ssh', '',
111 _('specify ssh command to use'), _('CMD')),
111 _('specify ssh command to use'), _('CMD')),
112 ('', 'remotecmd', '',
112 ('', 'remotecmd', '',
113 _('specify hg command to run on the remote side'), _('CMD')),
113 _('specify hg command to run on the remote side'), _('CMD')),
114 ('', 'insecure', None,
114 ('', 'insecure', None,
115 _('do not verify server certificate (ignoring web.cacerts config)')),
115 _('do not verify server certificate (ignoring web.cacerts config)')),
116 ]
116 ]
117
117
118 walkopts = [
118 walkopts = [
119 ('I', 'include', [],
119 ('I', 'include', [],
120 _('include names matching the given patterns'), _('PATTERN')),
120 _('include names matching the given patterns'), _('PATTERN')),
121 ('X', 'exclude', [],
121 ('X', 'exclude', [],
122 _('exclude names matching the given patterns'), _('PATTERN')),
122 _('exclude names matching the given patterns'), _('PATTERN')),
123 ]
123 ]
124
124
125 commitopts = [
125 commitopts = [
126 ('m', 'message', '',
126 ('m', 'message', '',
127 _('use text as commit message'), _('TEXT')),
127 _('use text as commit message'), _('TEXT')),
128 ('l', 'logfile', '',
128 ('l', 'logfile', '',
129 _('read commit message from file'), _('FILE')),
129 _('read commit message from file'), _('FILE')),
130 ]
130 ]
131
131
132 commitopts2 = [
132 commitopts2 = [
133 ('d', 'date', '',
133 ('d', 'date', '',
134 _('record the specified date as commit date'), _('DATE')),
134 _('record the specified date as commit date'), _('DATE')),
135 ('u', 'user', '',
135 ('u', 'user', '',
136 _('record the specified user as committer'), _('USER')),
136 _('record the specified user as committer'), _('USER')),
137 ]
137 ]
138
138
139 # hidden for now
139 # hidden for now
140 formatteropts = [
140 formatteropts = [
141 ('T', 'template', '',
141 ('T', 'template', '',
142 _('display with template (EXPERIMENTAL)'), _('TEMPLATE')),
142 _('display with template (EXPERIMENTAL)'), _('TEMPLATE')),
143 ]
143 ]
144
144
145 templateopts = [
145 templateopts = [
146 ('', 'style', '',
146 ('', 'style', '',
147 _('display using template map file (DEPRECATED)'), _('STYLE')),
147 _('display using template map file (DEPRECATED)'), _('STYLE')),
148 ('T', 'template', '',
148 ('T', 'template', '',
149 _('display with template'), _('TEMPLATE')),
149 _('display with template'), _('TEMPLATE')),
150 ]
150 ]
151
151
152 logopts = [
152 logopts = [
153 ('p', 'patch', None, _('show patch')),
153 ('p', 'patch', None, _('show patch')),
154 ('g', 'git', None, _('use git extended diff format')),
154 ('g', 'git', None, _('use git extended diff format')),
155 ('l', 'limit', '',
155 ('l', 'limit', '',
156 _('limit number of changes displayed'), _('NUM')),
156 _('limit number of changes displayed'), _('NUM')),
157 ('M', 'no-merges', None, _('do not show merges')),
157 ('M', 'no-merges', None, _('do not show merges')),
158 ('', 'stat', None, _('output diffstat-style summary of changes')),
158 ('', 'stat', None, _('output diffstat-style summary of changes')),
159 ('G', 'graph', None, _("show the revision DAG")),
159 ('G', 'graph', None, _("show the revision DAG")),
160 ] + templateopts
160 ] + templateopts
161
161
162 diffopts = [
162 diffopts = [
163 ('a', 'text', None, _('treat all files as text')),
163 ('a', 'text', None, _('treat all files as text')),
164 ('g', 'git', None, _('use git extended diff format')),
164 ('g', 'git', None, _('use git extended diff format')),
165 ('', 'nodates', None, _('omit dates from diff headers'))
165 ('', 'nodates', None, _('omit dates from diff headers'))
166 ]
166 ]
167
167
168 diffwsopts = [
168 diffwsopts = [
169 ('w', 'ignore-all-space', None,
169 ('w', 'ignore-all-space', None,
170 _('ignore white space when comparing lines')),
170 _('ignore white space when comparing lines')),
171 ('b', 'ignore-space-change', None,
171 ('b', 'ignore-space-change', None,
172 _('ignore changes in the amount of white space')),
172 _('ignore changes in the amount of white space')),
173 ('B', 'ignore-blank-lines', None,
173 ('B', 'ignore-blank-lines', None,
174 _('ignore changes whose lines are all blank')),
174 _('ignore changes whose lines are all blank')),
175 ]
175 ]
176
176
177 diffopts2 = [
177 diffopts2 = [
178 ('', 'noprefix', None, _('omit a/ and b/ prefixes from filenames')),
178 ('', 'noprefix', None, _('omit a/ and b/ prefixes from filenames')),
179 ('p', 'show-function', None, _('show which function each change is in')),
179 ('p', 'show-function', None, _('show which function each change is in')),
180 ('', 'reverse', None, _('produce a diff that undoes the changes')),
180 ('', 'reverse', None, _('produce a diff that undoes the changes')),
181 ] + diffwsopts + [
181 ] + diffwsopts + [
182 ('U', 'unified', '',
182 ('U', 'unified', '',
183 _('number of lines of context to show'), _('NUM')),
183 _('number of lines of context to show'), _('NUM')),
184 ('', 'stat', None, _('output diffstat-style summary of changes')),
184 ('', 'stat', None, _('output diffstat-style summary of changes')),
185 ('', 'root', '', _('produce diffs relative to subdirectory'), _('DIR')),
185 ('', 'root', '', _('produce diffs relative to subdirectory'), _('DIR')),
186 ]
186 ]
187
187
188 mergetoolopts = [
188 mergetoolopts = [
189 ('t', 'tool', '', _('specify merge tool')),
189 ('t', 'tool', '', _('specify merge tool')),
190 ]
190 ]
191
191
192 similarityopts = [
192 similarityopts = [
193 ('s', 'similarity', '',
193 ('s', 'similarity', '',
194 _('guess renamed files by similarity (0<=s<=100)'), _('SIMILARITY'))
194 _('guess renamed files by similarity (0<=s<=100)'), _('SIMILARITY'))
195 ]
195 ]
196
196
197 subrepoopts = [
197 subrepoopts = [
198 ('S', 'subrepos', None,
198 ('S', 'subrepos', None,
199 _('recurse into subrepositories'))
199 _('recurse into subrepositories'))
200 ]
200 ]
201
201
202 debugrevlogopts = [
202 debugrevlogopts = [
203 ('c', 'changelog', False, _('open changelog')),
203 ('c', 'changelog', False, _('open changelog')),
204 ('m', 'manifest', False, _('open manifest')),
204 ('m', 'manifest', False, _('open manifest')),
205 ('', 'dir', '', _('open directory manifest')),
205 ('', 'dir', '', _('open directory manifest')),
206 ]
206 ]
207
207
208 # Commands start here, listed alphabetically
208 # Commands start here, listed alphabetically
209
209
210 @command('^add',
210 @command('^add',
211 walkopts + subrepoopts + dryrunopts,
211 walkopts + subrepoopts + dryrunopts,
212 _('[OPTION]... [FILE]...'),
212 _('[OPTION]... [FILE]...'),
213 inferrepo=True)
213 inferrepo=True)
214 def add(ui, repo, *pats, **opts):
214 def add(ui, repo, *pats, **opts):
215 """add the specified files on the next commit
215 """add the specified files on the next commit
216
216
217 Schedule files to be version controlled and added to the
217 Schedule files to be version controlled and added to the
218 repository.
218 repository.
219
219
220 The files will be added to the repository at the next commit. To
220 The files will be added to the repository at the next commit. To
221 undo an add before that, see :hg:`forget`.
221 undo an add before that, see :hg:`forget`.
222
222
223 If no names are given, add all files to the repository (except
223 If no names are given, add all files to the repository (except
224 files matching ``.hgignore``).
224 files matching ``.hgignore``).
225
225
226 .. container:: verbose
226 .. container:: verbose
227
227
228 Examples:
228 Examples:
229
229
230 - New (unknown) files are added
230 - New (unknown) files are added
231 automatically by :hg:`add`::
231 automatically by :hg:`add`::
232
232
233 $ ls
233 $ ls
234 foo.c
234 foo.c
235 $ hg status
235 $ hg status
236 ? foo.c
236 ? foo.c
237 $ hg add
237 $ hg add
238 adding foo.c
238 adding foo.c
239 $ hg status
239 $ hg status
240 A foo.c
240 A foo.c
241
241
242 - Specific files to be added can be specified::
242 - Specific files to be added can be specified::
243
243
244 $ ls
244 $ ls
245 bar.c foo.c
245 bar.c foo.c
246 $ hg status
246 $ hg status
247 ? bar.c
247 ? bar.c
248 ? foo.c
248 ? foo.c
249 $ hg add bar.c
249 $ hg add bar.c
250 $ hg status
250 $ hg status
251 A bar.c
251 A bar.c
252 ? foo.c
252 ? foo.c
253
253
254 Returns 0 if all files are successfully added.
254 Returns 0 if all files are successfully added.
255 """
255 """
256
256
257 m = scmutil.match(repo[None], pats, opts)
257 m = scmutil.match(repo[None], pats, opts)
258 rejected = cmdutil.add(ui, repo, m, "", False, **opts)
258 rejected = cmdutil.add(ui, repo, m, "", False, **opts)
259 return rejected and 1 or 0
259 return rejected and 1 or 0
260
260
261 @command('addremove',
261 @command('addremove',
262 similarityopts + subrepoopts + walkopts + dryrunopts,
262 similarityopts + subrepoopts + walkopts + dryrunopts,
263 _('[OPTION]... [FILE]...'),
263 _('[OPTION]... [FILE]...'),
264 inferrepo=True)
264 inferrepo=True)
265 def addremove(ui, repo, *pats, **opts):
265 def addremove(ui, repo, *pats, **opts):
266 """add all new files, delete all missing files
266 """add all new files, delete all missing files
267
267
268 Add all new files and remove all missing files from the
268 Add all new files and remove all missing files from the
269 repository.
269 repository.
270
270
271 Unless names are given, new files are ignored if they match any of
271 Unless names are given, new files are ignored if they match any of
272 the patterns in ``.hgignore``. As with add, these changes take
272 the patterns in ``.hgignore``. As with add, these changes take
273 effect at the next commit.
273 effect at the next commit.
274
274
275 Use the -s/--similarity option to detect renamed files. This
275 Use the -s/--similarity option to detect renamed files. This
276 option takes a percentage between 0 (disabled) and 100 (files must
276 option takes a percentage between 0 (disabled) and 100 (files must
277 be identical) as its parameter. With a parameter greater than 0,
277 be identical) as its parameter. With a parameter greater than 0,
278 this compares every removed file with every added file and records
278 this compares every removed file with every added file and records
279 those similar enough as renames. Detecting renamed files this way
279 those similar enough as renames. Detecting renamed files this way
280 can be expensive. After using this option, :hg:`status -C` can be
280 can be expensive. After using this option, :hg:`status -C` can be
281 used to check which files were identified as moved or renamed. If
281 used to check which files were identified as moved or renamed. If
282 not specified, -s/--similarity defaults to 100 and only renames of
282 not specified, -s/--similarity defaults to 100 and only renames of
283 identical files are detected.
283 identical files are detected.
284
284
285 .. container:: verbose
285 .. container:: verbose
286
286
287 Examples:
287 Examples:
288
288
289 - A number of files (bar.c and foo.c) are new,
289 - A number of files (bar.c and foo.c) are new,
290 while foobar.c has been removed (without using :hg:`remove`)
290 while foobar.c has been removed (without using :hg:`remove`)
291 from the repository::
291 from the repository::
292
292
293 $ ls
293 $ ls
294 bar.c foo.c
294 bar.c foo.c
295 $ hg status
295 $ hg status
296 ! foobar.c
296 ! foobar.c
297 ? bar.c
297 ? bar.c
298 ? foo.c
298 ? foo.c
299 $ hg addremove
299 $ hg addremove
300 adding bar.c
300 adding bar.c
301 adding foo.c
301 adding foo.c
302 removing foobar.c
302 removing foobar.c
303 $ hg status
303 $ hg status
304 A bar.c
304 A bar.c
305 A foo.c
305 A foo.c
306 R foobar.c
306 R foobar.c
307
307
308 - A file foobar.c was moved to foo.c without using :hg:`rename`.
308 - A file foobar.c was moved to foo.c without using :hg:`rename`.
309 Afterwards, it was edited slightly::
309 Afterwards, it was edited slightly::
310
310
311 $ ls
311 $ ls
312 foo.c
312 foo.c
313 $ hg status
313 $ hg status
314 ! foobar.c
314 ! foobar.c
315 ? foo.c
315 ? foo.c
316 $ hg addremove --similarity 90
316 $ hg addremove --similarity 90
317 removing foobar.c
317 removing foobar.c
318 adding foo.c
318 adding foo.c
319 recording removal of foobar.c as rename to foo.c (94% similar)
319 recording removal of foobar.c as rename to foo.c (94% similar)
320 $ hg status -C
320 $ hg status -C
321 A foo.c
321 A foo.c
322 foobar.c
322 foobar.c
323 R foobar.c
323 R foobar.c
324
324
325 Returns 0 if all files are successfully added.
325 Returns 0 if all files are successfully added.
326 """
326 """
327 try:
327 try:
328 sim = float(opts.get('similarity') or 100)
328 sim = float(opts.get('similarity') or 100)
329 except ValueError:
329 except ValueError:
330 raise error.Abort(_('similarity must be a number'))
330 raise error.Abort(_('similarity must be a number'))
331 if sim < 0 or sim > 100:
331 if sim < 0 or sim > 100:
332 raise error.Abort(_('similarity must be between 0 and 100'))
332 raise error.Abort(_('similarity must be between 0 and 100'))
333 matcher = scmutil.match(repo[None], pats, opts)
333 matcher = scmutil.match(repo[None], pats, opts)
334 return scmutil.addremove(repo, matcher, "", opts, similarity=sim / 100.0)
334 return scmutil.addremove(repo, matcher, "", opts, similarity=sim / 100.0)
335
335
336 @command('^annotate|blame',
336 @command('^annotate|blame',
337 [('r', 'rev', '', _('annotate the specified revision'), _('REV')),
337 [('r', 'rev', '', _('annotate the specified revision'), _('REV')),
338 ('', 'follow', None,
338 ('', 'follow', None,
339 _('follow copies/renames and list the filename (DEPRECATED)')),
339 _('follow copies/renames and list the filename (DEPRECATED)')),
340 ('', 'no-follow', None, _("don't follow copies and renames")),
340 ('', 'no-follow', None, _("don't follow copies and renames")),
341 ('a', 'text', None, _('treat all files as text')),
341 ('a', 'text', None, _('treat all files as text')),
342 ('u', 'user', None, _('list the author (long with -v)')),
342 ('u', 'user', None, _('list the author (long with -v)')),
343 ('f', 'file', None, _('list the filename')),
343 ('f', 'file', None, _('list the filename')),
344 ('d', 'date', None, _('list the date (short with -q)')),
344 ('d', 'date', None, _('list the date (short with -q)')),
345 ('n', 'number', None, _('list the revision number (default)')),
345 ('n', 'number', None, _('list the revision number (default)')),
346 ('c', 'changeset', None, _('list the changeset')),
346 ('c', 'changeset', None, _('list the changeset')),
347 ('l', 'line-number', None, _('show line number at the first appearance'))
347 ('l', 'line-number', None, _('show line number at the first appearance'))
348 ] + diffwsopts + walkopts + formatteropts,
348 ] + diffwsopts + walkopts + formatteropts,
349 _('[-r REV] [-f] [-a] [-u] [-d] [-n] [-c] [-l] FILE...'),
349 _('[-r REV] [-f] [-a] [-u] [-d] [-n] [-c] [-l] FILE...'),
350 inferrepo=True)
350 inferrepo=True)
351 def annotate(ui, repo, *pats, **opts):
351 def annotate(ui, repo, *pats, **opts):
352 """show changeset information by line for each file
352 """show changeset information by line for each file
353
353
354 List changes in files, showing the revision id responsible for
354 List changes in files, showing the revision id responsible for
355 each line.
355 each line.
356
356
357 This command is useful for discovering when a change was made and
357 This command is useful for discovering when a change was made and
358 by whom.
358 by whom.
359
359
360 If you include --file, --user, or --date, the revision number is
360 If you include --file, --user, or --date, the revision number is
361 suppressed unless you also include --number.
361 suppressed unless you also include --number.
362
362
363 Without the -a/--text option, annotate will avoid processing files
363 Without the -a/--text option, annotate will avoid processing files
364 it detects as binary. With -a, annotate will annotate the file
364 it detects as binary. With -a, annotate will annotate the file
365 anyway, although the results will probably be neither useful
365 anyway, although the results will probably be neither useful
366 nor desirable.
366 nor desirable.
367
367
368 Returns 0 on success.
368 Returns 0 on success.
369 """
369 """
370 if not pats:
370 if not pats:
371 raise error.Abort(_('at least one filename or pattern is required'))
371 raise error.Abort(_('at least one filename or pattern is required'))
372
372
373 if opts.get('follow'):
373 if opts.get('follow'):
374 # --follow is deprecated and now just an alias for -f/--file
374 # --follow is deprecated and now just an alias for -f/--file
375 # to mimic the behavior of Mercurial before version 1.5
375 # to mimic the behavior of Mercurial before version 1.5
376 opts['file'] = True
376 opts['file'] = True
377
377
378 ctx = scmutil.revsingle(repo, opts.get('rev'))
378 ctx = scmutil.revsingle(repo, opts.get('rev'))
379
379
380 fm = ui.formatter('annotate', opts)
380 fm = ui.formatter('annotate', opts)
381 if ui.quiet:
381 if ui.quiet:
382 datefunc = util.shortdate
382 datefunc = util.shortdate
383 else:
383 else:
384 datefunc = util.datestr
384 datefunc = util.datestr
385 if ctx.rev() is None:
385 if ctx.rev() is None:
386 def hexfn(node):
386 def hexfn(node):
387 if node is None:
387 if node is None:
388 return None
388 return None
389 else:
389 else:
390 return fm.hexfunc(node)
390 return fm.hexfunc(node)
391 if opts.get('changeset'):
391 if opts.get('changeset'):
392 # omit "+" suffix which is appended to node hex
392 # omit "+" suffix which is appended to node hex
393 def formatrev(rev):
393 def formatrev(rev):
394 if rev is None:
394 if rev is None:
395 return '%d' % ctx.p1().rev()
395 return '%d' % ctx.p1().rev()
396 else:
396 else:
397 return '%d' % rev
397 return '%d' % rev
398 else:
398 else:
399 def formatrev(rev):
399 def formatrev(rev):
400 if rev is None:
400 if rev is None:
401 return '%d+' % ctx.p1().rev()
401 return '%d+' % ctx.p1().rev()
402 else:
402 else:
403 return '%d ' % rev
403 return '%d ' % rev
404 def formathex(hex):
404 def formathex(hex):
405 if hex is None:
405 if hex is None:
406 return '%s+' % fm.hexfunc(ctx.p1().node())
406 return '%s+' % fm.hexfunc(ctx.p1().node())
407 else:
407 else:
408 return '%s ' % hex
408 return '%s ' % hex
409 else:
409 else:
410 hexfn = fm.hexfunc
410 hexfn = fm.hexfunc
411 formatrev = formathex = str
411 formatrev = formathex = str
412
412
413 opmap = [('user', ' ', lambda x: x[0].user(), ui.shortuser),
413 opmap = [('user', ' ', lambda x: x[0].user(), ui.shortuser),
414 ('number', ' ', lambda x: x[0].rev(), formatrev),
414 ('number', ' ', lambda x: x[0].rev(), formatrev),
415 ('changeset', ' ', lambda x: hexfn(x[0].node()), formathex),
415 ('changeset', ' ', lambda x: hexfn(x[0].node()), formathex),
416 ('date', ' ', lambda x: x[0].date(), util.cachefunc(datefunc)),
416 ('date', ' ', lambda x: x[0].date(), util.cachefunc(datefunc)),
417 ('file', ' ', lambda x: x[0].path(), str),
417 ('file', ' ', lambda x: x[0].path(), str),
418 ('line_number', ':', lambda x: x[1], str),
418 ('line_number', ':', lambda x: x[1], str),
419 ]
419 ]
420 fieldnamemap = {'number': 'rev', 'changeset': 'node'}
420 fieldnamemap = {'number': 'rev', 'changeset': 'node'}
421
421
422 if (not opts.get('user') and not opts.get('changeset')
422 if (not opts.get('user') and not opts.get('changeset')
423 and not opts.get('date') and not opts.get('file')):
423 and not opts.get('date') and not opts.get('file')):
424 opts['number'] = True
424 opts['number'] = True
425
425
426 linenumber = opts.get('line_number') is not None
426 linenumber = opts.get('line_number') is not None
427 if linenumber and (not opts.get('changeset')) and (not opts.get('number')):
427 if linenumber and (not opts.get('changeset')) and (not opts.get('number')):
428 raise error.Abort(_('at least one of -n/-c is required for -l'))
428 raise error.Abort(_('at least one of -n/-c is required for -l'))
429
429
430 ui.pager('annotate')
430 ui.pager('annotate')
431
431
432 if fm.isplain():
432 if fm.isplain():
433 def makefunc(get, fmt):
433 def makefunc(get, fmt):
434 return lambda x: fmt(get(x))
434 return lambda x: fmt(get(x))
435 else:
435 else:
436 def makefunc(get, fmt):
436 def makefunc(get, fmt):
437 return get
437 return get
438 funcmap = [(makefunc(get, fmt), sep) for op, sep, get, fmt in opmap
438 funcmap = [(makefunc(get, fmt), sep) for op, sep, get, fmt in opmap
439 if opts.get(op)]
439 if opts.get(op)]
440 funcmap[0] = (funcmap[0][0], '') # no separator in front of first column
440 funcmap[0] = (funcmap[0][0], '') # no separator in front of first column
441 fields = ' '.join(fieldnamemap.get(op, op) for op, sep, get, fmt in opmap
441 fields = ' '.join(fieldnamemap.get(op, op) for op, sep, get, fmt in opmap
442 if opts.get(op))
442 if opts.get(op))
443
443
444 def bad(x, y):
444 def bad(x, y):
445 raise error.Abort("%s: %s" % (x, y))
445 raise error.Abort("%s: %s" % (x, y))
446
446
447 m = scmutil.match(ctx, pats, opts, badfn=bad)
447 m = scmutil.match(ctx, pats, opts, badfn=bad)
448
448
449 follow = not opts.get('no_follow')
449 follow = not opts.get('no_follow')
450 diffopts = patch.difffeatureopts(ui, opts, section='annotate',
450 diffopts = patch.difffeatureopts(ui, opts, section='annotate',
451 whitespace=True)
451 whitespace=True)
452 for abs in ctx.walk(m):
452 for abs in ctx.walk(m):
453 fctx = ctx[abs]
453 fctx = ctx[abs]
454 if not opts.get('text') and util.binary(fctx.data()):
454 if not opts.get('text') and util.binary(fctx.data()):
455 fm.plain(_("%s: binary file\n") % ((pats and m.rel(abs)) or abs))
455 fm.plain(_("%s: binary file\n") % ((pats and m.rel(abs)) or abs))
456 continue
456 continue
457
457
458 lines = fctx.annotate(follow=follow, linenumber=linenumber,
458 lines = fctx.annotate(follow=follow, linenumber=linenumber,
459 diffopts=diffopts)
459 diffopts=diffopts)
460 if not lines:
460 if not lines:
461 continue
461 continue
462 formats = []
462 formats = []
463 pieces = []
463 pieces = []
464
464
465 for f, sep in funcmap:
465 for f, sep in funcmap:
466 l = [f(n) for n, dummy in lines]
466 l = [f(n) for n, dummy in lines]
467 if fm.isplain():
467 if fm.isplain():
468 sizes = [encoding.colwidth(x) for x in l]
468 sizes = [encoding.colwidth(x) for x in l]
469 ml = max(sizes)
469 ml = max(sizes)
470 formats.append([sep + ' ' * (ml - w) + '%s' for w in sizes])
470 formats.append([sep + ' ' * (ml - w) + '%s' for w in sizes])
471 else:
471 else:
472 formats.append(['%s' for x in l])
472 formats.append(['%s' for x in l])
473 pieces.append(l)
473 pieces.append(l)
474
474
475 for f, p, l in zip(zip(*formats), zip(*pieces), lines):
475 for f, p, l in zip(zip(*formats), zip(*pieces), lines):
476 fm.startitem()
476 fm.startitem()
477 fm.write(fields, "".join(f), *p)
477 fm.write(fields, "".join(f), *p)
478 fm.write('line', ": %s", l[1])
478 fm.write('line', ": %s", l[1])
479
479
480 if not lines[-1][1].endswith('\n'):
480 if not lines[-1][1].endswith('\n'):
481 fm.plain('\n')
481 fm.plain('\n')
482
482
483 fm.end()
483 fm.end()
484
484
485 @command('archive',
485 @command('archive',
486 [('', 'no-decode', None, _('do not pass files through decoders')),
486 [('', 'no-decode', None, _('do not pass files through decoders')),
487 ('p', 'prefix', '', _('directory prefix for files in archive'),
487 ('p', 'prefix', '', _('directory prefix for files in archive'),
488 _('PREFIX')),
488 _('PREFIX')),
489 ('r', 'rev', '', _('revision to distribute'), _('REV')),
489 ('r', 'rev', '', _('revision to distribute'), _('REV')),
490 ('t', 'type', '', _('type of distribution to create'), _('TYPE')),
490 ('t', 'type', '', _('type of distribution to create'), _('TYPE')),
491 ] + subrepoopts + walkopts,
491 ] + subrepoopts + walkopts,
492 _('[OPTION]... DEST'))
492 _('[OPTION]... DEST'))
493 def archive(ui, repo, dest, **opts):
493 def archive(ui, repo, dest, **opts):
494 '''create an unversioned archive of a repository revision
494 '''create an unversioned archive of a repository revision
495
495
496 By default, the revision used is the parent of the working
496 By default, the revision used is the parent of the working
497 directory; use -r/--rev to specify a different revision.
497 directory; use -r/--rev to specify a different revision.
498
498
499 The archive type is automatically detected based on file
499 The archive type is automatically detected based on file
500 extension (to override, use -t/--type).
500 extension (to override, use -t/--type).
501
501
502 .. container:: verbose
502 .. container:: verbose
503
503
504 Examples:
504 Examples:
505
505
506 - create a zip file containing the 1.0 release::
506 - create a zip file containing the 1.0 release::
507
507
508 hg archive -r 1.0 project-1.0.zip
508 hg archive -r 1.0 project-1.0.zip
509
509
510 - create a tarball excluding .hg files::
510 - create a tarball excluding .hg files::
511
511
512 hg archive project.tar.gz -X ".hg*"
512 hg archive project.tar.gz -X ".hg*"
513
513
514 Valid types are:
514 Valid types are:
515
515
516 :``files``: a directory full of files (default)
516 :``files``: a directory full of files (default)
517 :``tar``: tar archive, uncompressed
517 :``tar``: tar archive, uncompressed
518 :``tbz2``: tar archive, compressed using bzip2
518 :``tbz2``: tar archive, compressed using bzip2
519 :``tgz``: tar archive, compressed using gzip
519 :``tgz``: tar archive, compressed using gzip
520 :``uzip``: zip archive, uncompressed
520 :``uzip``: zip archive, uncompressed
521 :``zip``: zip archive, compressed using deflate
521 :``zip``: zip archive, compressed using deflate
522
522
523 The exact name of the destination archive or directory is given
523 The exact name of the destination archive or directory is given
524 using a format string; see :hg:`help export` for details.
524 using a format string; see :hg:`help export` for details.
525
525
526 Each member added to an archive file has a directory prefix
526 Each member added to an archive file has a directory prefix
527 prepended. Use -p/--prefix to specify a format string for the
527 prepended. Use -p/--prefix to specify a format string for the
528 prefix. The default is the basename of the archive, with suffixes
528 prefix. The default is the basename of the archive, with suffixes
529 removed.
529 removed.
530
530
531 Returns 0 on success.
531 Returns 0 on success.
532 '''
532 '''
533
533
534 ctx = scmutil.revsingle(repo, opts.get('rev'))
534 ctx = scmutil.revsingle(repo, opts.get('rev'))
535 if not ctx:
535 if not ctx:
536 raise error.Abort(_('no working directory: please specify a revision'))
536 raise error.Abort(_('no working directory: please specify a revision'))
537 node = ctx.node()
537 node = ctx.node()
538 dest = cmdutil.makefilename(repo, dest, node)
538 dest = cmdutil.makefilename(repo, dest, node)
539 if os.path.realpath(dest) == repo.root:
539 if os.path.realpath(dest) == repo.root:
540 raise error.Abort(_('repository root cannot be destination'))
540 raise error.Abort(_('repository root cannot be destination'))
541
541
542 kind = opts.get('type') or archival.guesskind(dest) or 'files'
542 kind = opts.get('type') or archival.guesskind(dest) or 'files'
543 prefix = opts.get('prefix')
543 prefix = opts.get('prefix')
544
544
545 if dest == '-':
545 if dest == '-':
546 if kind == 'files':
546 if kind == 'files':
547 raise error.Abort(_('cannot archive plain files to stdout'))
547 raise error.Abort(_('cannot archive plain files to stdout'))
548 dest = cmdutil.makefileobj(repo, dest)
548 dest = cmdutil.makefileobj(repo, dest)
549 if not prefix:
549 if not prefix:
550 prefix = os.path.basename(repo.root) + '-%h'
550 prefix = os.path.basename(repo.root) + '-%h'
551
551
552 prefix = cmdutil.makefilename(repo, prefix, node)
552 prefix = cmdutil.makefilename(repo, prefix, node)
553 matchfn = scmutil.match(ctx, [], opts)
553 matchfn = scmutil.match(ctx, [], opts)
554 archival.archive(repo, dest, node, kind, not opts.get('no_decode'),
554 archival.archive(repo, dest, node, kind, not opts.get('no_decode'),
555 matchfn, prefix, subrepos=opts.get('subrepos'))
555 matchfn, prefix, subrepos=opts.get('subrepos'))
556
556
557 @command('backout',
557 @command('backout',
558 [('', 'merge', None, _('merge with old dirstate parent after backout')),
558 [('', 'merge', None, _('merge with old dirstate parent after backout')),
559 ('', 'commit', None,
559 ('', 'commit', None,
560 _('commit if no conflicts were encountered (DEPRECATED)')),
560 _('commit if no conflicts were encountered (DEPRECATED)')),
561 ('', 'no-commit', None, _('do not commit')),
561 ('', 'no-commit', None, _('do not commit')),
562 ('', 'parent', '',
562 ('', 'parent', '',
563 _('parent to choose when backing out merge (DEPRECATED)'), _('REV')),
563 _('parent to choose when backing out merge (DEPRECATED)'), _('REV')),
564 ('r', 'rev', '', _('revision to backout'), _('REV')),
564 ('r', 'rev', '', _('revision to backout'), _('REV')),
565 ('e', 'edit', False, _('invoke editor on commit messages')),
565 ('e', 'edit', False, _('invoke editor on commit messages')),
566 ] + mergetoolopts + walkopts + commitopts + commitopts2,
566 ] + mergetoolopts + walkopts + commitopts + commitopts2,
567 _('[OPTION]... [-r] REV'))
567 _('[OPTION]... [-r] REV'))
568 def backout(ui, repo, node=None, rev=None, **opts):
568 def backout(ui, repo, node=None, rev=None, **opts):
569 '''reverse effect of earlier changeset
569 '''reverse effect of earlier changeset
570
570
571 Prepare a new changeset with the effect of REV undone in the
571 Prepare a new changeset with the effect of REV undone in the
572 current working directory. If no conflicts were encountered,
572 current working directory. If no conflicts were encountered,
573 it will be committed immediately.
573 it will be committed immediately.
574
574
575 If REV is the parent of the working directory, then this new changeset
575 If REV is the parent of the working directory, then this new changeset
576 is committed automatically (unless --no-commit is specified).
576 is committed automatically (unless --no-commit is specified).
577
577
578 .. note::
578 .. note::
579
579
580 :hg:`backout` cannot be used to fix either an unwanted or
580 :hg:`backout` cannot be used to fix either an unwanted or
581 incorrect merge.
581 incorrect merge.
582
582
583 .. container:: verbose
583 .. container:: verbose
584
584
585 Examples:
585 Examples:
586
586
587 - Reverse the effect of the parent of the working directory.
587 - Reverse the effect of the parent of the working directory.
588 This backout will be committed immediately::
588 This backout will be committed immediately::
589
589
590 hg backout -r .
590 hg backout -r .
591
591
592 - Reverse the effect of previous bad revision 23::
592 - Reverse the effect of previous bad revision 23::
593
593
594 hg backout -r 23
594 hg backout -r 23
595
595
596 - Reverse the effect of previous bad revision 23 and
596 - Reverse the effect of previous bad revision 23 and
597 leave changes uncommitted::
597 leave changes uncommitted::
598
598
599 hg backout -r 23 --no-commit
599 hg backout -r 23 --no-commit
600 hg commit -m "Backout revision 23"
600 hg commit -m "Backout revision 23"
601
601
602 By default, the pending changeset will have one parent,
602 By default, the pending changeset will have one parent,
603 maintaining a linear history. With --merge, the pending
603 maintaining a linear history. With --merge, the pending
604 changeset will instead have two parents: the old parent of the
604 changeset will instead have two parents: the old parent of the
605 working directory and a new child of REV that simply undoes REV.
605 working directory and a new child of REV that simply undoes REV.
606
606
607 Before version 1.7, the behavior without --merge was equivalent
607 Before version 1.7, the behavior without --merge was equivalent
608 to specifying --merge followed by :hg:`update --clean .` to
608 to specifying --merge followed by :hg:`update --clean .` to
609 cancel the merge and leave the child of REV as a head to be
609 cancel the merge and leave the child of REV as a head to be
610 merged separately.
610 merged separately.
611
611
612 See :hg:`help dates` for a list of formats valid for -d/--date.
612 See :hg:`help dates` for a list of formats valid for -d/--date.
613
613
614 See :hg:`help revert` for a way to restore files to the state
614 See :hg:`help revert` for a way to restore files to the state
615 of another revision.
615 of another revision.
616
616
617 Returns 0 on success, 1 if nothing to backout or there are unresolved
617 Returns 0 on success, 1 if nothing to backout or there are unresolved
618 files.
618 files.
619 '''
619 '''
620 wlock = lock = None
620 wlock = lock = None
621 try:
621 try:
622 wlock = repo.wlock()
622 wlock = repo.wlock()
623 lock = repo.lock()
623 lock = repo.lock()
624 return _dobackout(ui, repo, node, rev, **opts)
624 return _dobackout(ui, repo, node, rev, **opts)
625 finally:
625 finally:
626 release(lock, wlock)
626 release(lock, wlock)
627
627
628 def _dobackout(ui, repo, node=None, rev=None, **opts):
628 def _dobackout(ui, repo, node=None, rev=None, **opts):
629 if opts.get('commit') and opts.get('no_commit'):
629 if opts.get('commit') and opts.get('no_commit'):
630 raise error.Abort(_("cannot use --commit with --no-commit"))
630 raise error.Abort(_("cannot use --commit with --no-commit"))
631 if opts.get('merge') and opts.get('no_commit'):
631 if opts.get('merge') and opts.get('no_commit'):
632 raise error.Abort(_("cannot use --merge with --no-commit"))
632 raise error.Abort(_("cannot use --merge with --no-commit"))
633
633
634 if rev and node:
634 if rev and node:
635 raise error.Abort(_("please specify just one revision"))
635 raise error.Abort(_("please specify just one revision"))
636
636
637 if not rev:
637 if not rev:
638 rev = node
638 rev = node
639
639
640 if not rev:
640 if not rev:
641 raise error.Abort(_("please specify a revision to backout"))
641 raise error.Abort(_("please specify a revision to backout"))
642
642
643 date = opts.get('date')
643 date = opts.get('date')
644 if date:
644 if date:
645 opts['date'] = util.parsedate(date)
645 opts['date'] = util.parsedate(date)
646
646
647 cmdutil.checkunfinished(repo)
647 cmdutil.checkunfinished(repo)
648 cmdutil.bailifchanged(repo)
648 cmdutil.bailifchanged(repo)
649 node = scmutil.revsingle(repo, rev).node()
649 node = scmutil.revsingle(repo, rev).node()
650
650
651 op1, op2 = repo.dirstate.parents()
651 op1, op2 = repo.dirstate.parents()
652 if not repo.changelog.isancestor(node, op1):
652 if not repo.changelog.isancestor(node, op1):
653 raise error.Abort(_('cannot backout change that is not an ancestor'))
653 raise error.Abort(_('cannot backout change that is not an ancestor'))
654
654
655 p1, p2 = repo.changelog.parents(node)
655 p1, p2 = repo.changelog.parents(node)
656 if p1 == nullid:
656 if p1 == nullid:
657 raise error.Abort(_('cannot backout a change with no parents'))
657 raise error.Abort(_('cannot backout a change with no parents'))
658 if p2 != nullid:
658 if p2 != nullid:
659 if not opts.get('parent'):
659 if not opts.get('parent'):
660 raise error.Abort(_('cannot backout a merge changeset'))
660 raise error.Abort(_('cannot backout a merge changeset'))
661 p = repo.lookup(opts['parent'])
661 p = repo.lookup(opts['parent'])
662 if p not in (p1, p2):
662 if p not in (p1, p2):
663 raise error.Abort(_('%s is not a parent of %s') %
663 raise error.Abort(_('%s is not a parent of %s') %
664 (short(p), short(node)))
664 (short(p), short(node)))
665 parent = p
665 parent = p
666 else:
666 else:
667 if opts.get('parent'):
667 if opts.get('parent'):
668 raise error.Abort(_('cannot use --parent on non-merge changeset'))
668 raise error.Abort(_('cannot use --parent on non-merge changeset'))
669 parent = p1
669 parent = p1
670
670
671 # the backout should appear on the same branch
671 # the backout should appear on the same branch
672 branch = repo.dirstate.branch()
672 branch = repo.dirstate.branch()
673 bheads = repo.branchheads(branch)
673 bheads = repo.branchheads(branch)
674 rctx = scmutil.revsingle(repo, hex(parent))
674 rctx = scmutil.revsingle(repo, hex(parent))
675 if not opts.get('merge') and op1 != node:
675 if not opts.get('merge') and op1 != node:
676 dsguard = dirstateguard.dirstateguard(repo, 'backout')
676 dsguard = dirstateguard.dirstateguard(repo, 'backout')
677 try:
677 try:
678 ui.setconfig('ui', 'forcemerge', opts.get('tool', ''),
678 ui.setconfig('ui', 'forcemerge', opts.get('tool', ''),
679 'backout')
679 'backout')
680 stats = mergemod.update(repo, parent, True, True, node, False)
680 stats = mergemod.update(repo, parent, True, True, node, False)
681 repo.setparents(op1, op2)
681 repo.setparents(op1, op2)
682 dsguard.close()
682 dsguard.close()
683 hg._showstats(repo, stats)
683 hg._showstats(repo, stats)
684 if stats[3]:
684 if stats[3]:
685 repo.ui.status(_("use 'hg resolve' to retry unresolved "
685 repo.ui.status(_("use 'hg resolve' to retry unresolved "
686 "file merges\n"))
686 "file merges\n"))
687 return 1
687 return 1
688 finally:
688 finally:
689 ui.setconfig('ui', 'forcemerge', '', '')
689 ui.setconfig('ui', 'forcemerge', '', '')
690 lockmod.release(dsguard)
690 lockmod.release(dsguard)
691 else:
691 else:
692 hg.clean(repo, node, show_stats=False)
692 hg.clean(repo, node, show_stats=False)
693 repo.dirstate.setbranch(branch)
693 repo.dirstate.setbranch(branch)
694 cmdutil.revert(ui, repo, rctx, repo.dirstate.parents())
694 cmdutil.revert(ui, repo, rctx, repo.dirstate.parents())
695
695
696 if opts.get('no_commit'):
696 if opts.get('no_commit'):
697 msg = _("changeset %s backed out, "
697 msg = _("changeset %s backed out, "
698 "don't forget to commit.\n")
698 "don't forget to commit.\n")
699 ui.status(msg % short(node))
699 ui.status(msg % short(node))
700 return 0
700 return 0
701
701
702 def commitfunc(ui, repo, message, match, opts):
702 def commitfunc(ui, repo, message, match, opts):
703 editform = 'backout'
703 editform = 'backout'
704 e = cmdutil.getcommiteditor(editform=editform, **opts)
704 e = cmdutil.getcommiteditor(editform=editform, **opts)
705 if not message:
705 if not message:
706 # we don't translate commit messages
706 # we don't translate commit messages
707 message = "Backed out changeset %s" % short(node)
707 message = "Backed out changeset %s" % short(node)
708 e = cmdutil.getcommiteditor(edit=True, editform=editform)
708 e = cmdutil.getcommiteditor(edit=True, editform=editform)
709 return repo.commit(message, opts.get('user'), opts.get('date'),
709 return repo.commit(message, opts.get('user'), opts.get('date'),
710 match, editor=e)
710 match, editor=e)
711 newnode = cmdutil.commit(ui, repo, commitfunc, [], opts)
711 newnode = cmdutil.commit(ui, repo, commitfunc, [], opts)
712 if not newnode:
712 if not newnode:
713 ui.status(_("nothing changed\n"))
713 ui.status(_("nothing changed\n"))
714 return 1
714 return 1
715 cmdutil.commitstatus(repo, newnode, branch, bheads)
715 cmdutil.commitstatus(repo, newnode, branch, bheads)
716
716
717 def nice(node):
717 def nice(node):
718 return '%d:%s' % (repo.changelog.rev(node), short(node))
718 return '%d:%s' % (repo.changelog.rev(node), short(node))
719 ui.status(_('changeset %s backs out changeset %s\n') %
719 ui.status(_('changeset %s backs out changeset %s\n') %
720 (nice(repo.changelog.tip()), nice(node)))
720 (nice(repo.changelog.tip()), nice(node)))
721 if opts.get('merge') and op1 != node:
721 if opts.get('merge') and op1 != node:
722 hg.clean(repo, op1, show_stats=False)
722 hg.clean(repo, op1, show_stats=False)
723 ui.status(_('merging with changeset %s\n')
723 ui.status(_('merging with changeset %s\n')
724 % nice(repo.changelog.tip()))
724 % nice(repo.changelog.tip()))
725 try:
725 try:
726 ui.setconfig('ui', 'forcemerge', opts.get('tool', ''),
726 ui.setconfig('ui', 'forcemerge', opts.get('tool', ''),
727 'backout')
727 'backout')
728 return hg.merge(repo, hex(repo.changelog.tip()))
728 return hg.merge(repo, hex(repo.changelog.tip()))
729 finally:
729 finally:
730 ui.setconfig('ui', 'forcemerge', '', '')
730 ui.setconfig('ui', 'forcemerge', '', '')
731 return 0
731 return 0
732
732
733 @command('bisect',
733 @command('bisect',
734 [('r', 'reset', False, _('reset bisect state')),
734 [('r', 'reset', False, _('reset bisect state')),
735 ('g', 'good', False, _('mark changeset good')),
735 ('g', 'good', False, _('mark changeset good')),
736 ('b', 'bad', False, _('mark changeset bad')),
736 ('b', 'bad', False, _('mark changeset bad')),
737 ('s', 'skip', False, _('skip testing changeset')),
737 ('s', 'skip', False, _('skip testing changeset')),
738 ('e', 'extend', False, _('extend the bisect range')),
738 ('e', 'extend', False, _('extend the bisect range')),
739 ('c', 'command', '', _('use command to check changeset state'), _('CMD')),
739 ('c', 'command', '', _('use command to check changeset state'), _('CMD')),
740 ('U', 'noupdate', False, _('do not update to target'))],
740 ('U', 'noupdate', False, _('do not update to target'))],
741 _("[-gbsr] [-U] [-c CMD] [REV]"))
741 _("[-gbsr] [-U] [-c CMD] [REV]"))
742 def bisect(ui, repo, rev=None, extra=None, command=None,
742 def bisect(ui, repo, rev=None, extra=None, command=None,
743 reset=None, good=None, bad=None, skip=None, extend=None,
743 reset=None, good=None, bad=None, skip=None, extend=None,
744 noupdate=None):
744 noupdate=None):
745 """subdivision search of changesets
745 """subdivision search of changesets
746
746
747 This command helps to find changesets which introduce problems. To
747 This command helps to find changesets which introduce problems. To
748 use, mark the earliest changeset you know exhibits the problem as
748 use, mark the earliest changeset you know exhibits the problem as
749 bad, then mark the latest changeset which is free from the problem
749 bad, then mark the latest changeset which is free from the problem
750 as good. Bisect will update your working directory to a revision
750 as good. Bisect will update your working directory to a revision
751 for testing (unless the -U/--noupdate option is specified). Once
751 for testing (unless the -U/--noupdate option is specified). Once
752 you have performed tests, mark the working directory as good or
752 you have performed tests, mark the working directory as good or
753 bad, and bisect will either update to another candidate changeset
753 bad, and bisect will either update to another candidate changeset
754 or announce that it has found the bad revision.
754 or announce that it has found the bad revision.
755
755
756 As a shortcut, you can also use the revision argument to mark a
756 As a shortcut, you can also use the revision argument to mark a
757 revision as good or bad without checking it out first.
757 revision as good or bad without checking it out first.
758
758
759 If you supply a command, it will be used for automatic bisection.
759 If you supply a command, it will be used for automatic bisection.
760 The environment variable HG_NODE will contain the ID of the
760 The environment variable HG_NODE will contain the ID of the
761 changeset being tested. The exit status of the command will be
761 changeset being tested. The exit status of the command will be
762 used to mark revisions as good or bad: status 0 means good, 125
762 used to mark revisions as good or bad: status 0 means good, 125
763 means to skip the revision, 127 (command not found) will abort the
763 means to skip the revision, 127 (command not found) will abort the
764 bisection, and any other non-zero exit status means the revision
764 bisection, and any other non-zero exit status means the revision
765 is bad.
765 is bad.
766
766
767 .. container:: verbose
767 .. container:: verbose
768
768
769 Some examples:
769 Some examples:
770
770
771 - start a bisection with known bad revision 34, and good revision 12::
771 - start a bisection with known bad revision 34, and good revision 12::
772
772
773 hg bisect --bad 34
773 hg bisect --bad 34
774 hg bisect --good 12
774 hg bisect --good 12
775
775
776 - advance the current bisection by marking current revision as good or
776 - advance the current bisection by marking current revision as good or
777 bad::
777 bad::
778
778
779 hg bisect --good
779 hg bisect --good
780 hg bisect --bad
780 hg bisect --bad
781
781
782 - mark the current revision, or a known revision, to be skipped (e.g. if
782 - mark the current revision, or a known revision, to be skipped (e.g. if
783 that revision is not usable because of another issue)::
783 that revision is not usable because of another issue)::
784
784
785 hg bisect --skip
785 hg bisect --skip
786 hg bisect --skip 23
786 hg bisect --skip 23
787
787
788 - skip all revisions that do not touch directories ``foo`` or ``bar``::
788 - skip all revisions that do not touch directories ``foo`` or ``bar``::
789
789
790 hg bisect --skip "!( file('path:foo') & file('path:bar') )"
790 hg bisect --skip "!( file('path:foo') & file('path:bar') )"
791
791
792 - forget the current bisection::
792 - forget the current bisection::
793
793
794 hg bisect --reset
794 hg bisect --reset
795
795
796 - use 'make && make tests' to automatically find the first broken
796 - use 'make && make tests' to automatically find the first broken
797 revision::
797 revision::
798
798
799 hg bisect --reset
799 hg bisect --reset
800 hg bisect --bad 34
800 hg bisect --bad 34
801 hg bisect --good 12
801 hg bisect --good 12
802 hg bisect --command "make && make tests"
802 hg bisect --command "make && make tests"
803
803
804 - see all changesets whose states are already known in the current
804 - see all changesets whose states are already known in the current
805 bisection::
805 bisection::
806
806
807 hg log -r "bisect(pruned)"
807 hg log -r "bisect(pruned)"
808
808
809 - see the changeset currently being bisected (especially useful
809 - see the changeset currently being bisected (especially useful
810 if running with -U/--noupdate)::
810 if running with -U/--noupdate)::
811
811
812 hg log -r "bisect(current)"
812 hg log -r "bisect(current)"
813
813
814 - see all changesets that took part in the current bisection::
814 - see all changesets that took part in the current bisection::
815
815
816 hg log -r "bisect(range)"
816 hg log -r "bisect(range)"
817
817
818 - you can even get a nice graph::
818 - you can even get a nice graph::
819
819
820 hg log --graph -r "bisect(range)"
820 hg log --graph -r "bisect(range)"
821
821
822 See :hg:`help revisions.bisect` for more about the `bisect()` predicate.
822 See :hg:`help revisions.bisect` for more about the `bisect()` predicate.
823
823
824 Returns 0 on success.
824 Returns 0 on success.
825 """
825 """
826 # backward compatibility
826 # backward compatibility
827 if rev in "good bad reset init".split():
827 if rev in "good bad reset init".split():
828 ui.warn(_("(use of 'hg bisect <cmd>' is deprecated)\n"))
828 ui.warn(_("(use of 'hg bisect <cmd>' is deprecated)\n"))
829 cmd, rev, extra = rev, extra, None
829 cmd, rev, extra = rev, extra, None
830 if cmd == "good":
830 if cmd == "good":
831 good = True
831 good = True
832 elif cmd == "bad":
832 elif cmd == "bad":
833 bad = True
833 bad = True
834 else:
834 else:
835 reset = True
835 reset = True
836 elif extra or good + bad + skip + reset + extend + bool(command) > 1:
836 elif extra or good + bad + skip + reset + extend + bool(command) > 1:
837 raise error.Abort(_('incompatible arguments'))
837 raise error.Abort(_('incompatible arguments'))
838
838
839 cmdutil.checkunfinished(repo)
839 cmdutil.checkunfinished(repo)
840
840
841 if reset:
841 if reset:
842 hbisect.resetstate(repo)
842 hbisect.resetstate(repo)
843 return
843 return
844
844
845 state = hbisect.load_state(repo)
845 state = hbisect.load_state(repo)
846
846
847 # update state
847 # update state
848 if good or bad or skip:
848 if good or bad or skip:
849 if rev:
849 if rev:
850 nodes = [repo.lookup(i) for i in scmutil.revrange(repo, [rev])]
850 nodes = [repo.lookup(i) for i in scmutil.revrange(repo, [rev])]
851 else:
851 else:
852 nodes = [repo.lookup('.')]
852 nodes = [repo.lookup('.')]
853 if good:
853 if good:
854 state['good'] += nodes
854 state['good'] += nodes
855 elif bad:
855 elif bad:
856 state['bad'] += nodes
856 state['bad'] += nodes
857 elif skip:
857 elif skip:
858 state['skip'] += nodes
858 state['skip'] += nodes
859 hbisect.save_state(repo, state)
859 hbisect.save_state(repo, state)
860 if not (state['good'] and state['bad']):
860 if not (state['good'] and state['bad']):
861 return
861 return
862
862
863 def mayupdate(repo, node, show_stats=True):
863 def mayupdate(repo, node, show_stats=True):
864 """common used update sequence"""
864 """common used update sequence"""
865 if noupdate:
865 if noupdate:
866 return
866 return
867 cmdutil.bailifchanged(repo)
867 cmdutil.bailifchanged(repo)
868 return hg.clean(repo, node, show_stats=show_stats)
868 return hg.clean(repo, node, show_stats=show_stats)
869
869
870 displayer = cmdutil.show_changeset(ui, repo, {})
870 displayer = cmdutil.show_changeset(ui, repo, {})
871
871
872 if command:
872 if command:
873 changesets = 1
873 changesets = 1
874 if noupdate:
874 if noupdate:
875 try:
875 try:
876 node = state['current'][0]
876 node = state['current'][0]
877 except LookupError:
877 except LookupError:
878 raise error.Abort(_('current bisect revision is unknown - '
878 raise error.Abort(_('current bisect revision is unknown - '
879 'start a new bisect to fix'))
879 'start a new bisect to fix'))
880 else:
880 else:
881 node, p2 = repo.dirstate.parents()
881 node, p2 = repo.dirstate.parents()
882 if p2 != nullid:
882 if p2 != nullid:
883 raise error.Abort(_('current bisect revision is a merge'))
883 raise error.Abort(_('current bisect revision is a merge'))
884 if rev:
884 if rev:
885 node = repo[scmutil.revsingle(repo, rev, node)].node()
885 node = repo[scmutil.revsingle(repo, rev, node)].node()
886 try:
886 try:
887 while changesets:
887 while changesets:
888 # update state
888 # update state
889 state['current'] = [node]
889 state['current'] = [node]
890 hbisect.save_state(repo, state)
890 hbisect.save_state(repo, state)
891 status = ui.system(command, environ={'HG_NODE': hex(node)},
891 status = ui.system(command, environ={'HG_NODE': hex(node)},
892 blockedtag='bisect_check')
892 blockedtag='bisect_check')
893 if status == 125:
893 if status == 125:
894 transition = "skip"
894 transition = "skip"
895 elif status == 0:
895 elif status == 0:
896 transition = "good"
896 transition = "good"
897 # status < 0 means process was killed
897 # status < 0 means process was killed
898 elif status == 127:
898 elif status == 127:
899 raise error.Abort(_("failed to execute %s") % command)
899 raise error.Abort(_("failed to execute %s") % command)
900 elif status < 0:
900 elif status < 0:
901 raise error.Abort(_("%s killed") % command)
901 raise error.Abort(_("%s killed") % command)
902 else:
902 else:
903 transition = "bad"
903 transition = "bad"
904 state[transition].append(node)
904 state[transition].append(node)
905 ctx = repo[node]
905 ctx = repo[node]
906 ui.status(_('changeset %d:%s: %s\n') % (ctx, ctx, transition))
906 ui.status(_('changeset %d:%s: %s\n') % (ctx, ctx, transition))
907 hbisect.checkstate(state)
907 hbisect.checkstate(state)
908 # bisect
908 # bisect
909 nodes, changesets, bgood = hbisect.bisect(repo.changelog, state)
909 nodes, changesets, bgood = hbisect.bisect(repo.changelog, state)
910 # update to next check
910 # update to next check
911 node = nodes[0]
911 node = nodes[0]
912 mayupdate(repo, node, show_stats=False)
912 mayupdate(repo, node, show_stats=False)
913 finally:
913 finally:
914 state['current'] = [node]
914 state['current'] = [node]
915 hbisect.save_state(repo, state)
915 hbisect.save_state(repo, state)
916 hbisect.printresult(ui, repo, state, displayer, nodes, bgood)
916 hbisect.printresult(ui, repo, state, displayer, nodes, bgood)
917 return
917 return
918
918
919 hbisect.checkstate(state)
919 hbisect.checkstate(state)
920
920
921 # actually bisect
921 # actually bisect
922 nodes, changesets, good = hbisect.bisect(repo.changelog, state)
922 nodes, changesets, good = hbisect.bisect(repo.changelog, state)
923 if extend:
923 if extend:
924 if not changesets:
924 if not changesets:
925 extendnode = hbisect.extendrange(repo, state, nodes, good)
925 extendnode = hbisect.extendrange(repo, state, nodes, good)
926 if extendnode is not None:
926 if extendnode is not None:
927 ui.write(_("Extending search to changeset %d:%s\n")
927 ui.write(_("Extending search to changeset %d:%s\n")
928 % (extendnode.rev(), extendnode))
928 % (extendnode.rev(), extendnode))
929 state['current'] = [extendnode.node()]
929 state['current'] = [extendnode.node()]
930 hbisect.save_state(repo, state)
930 hbisect.save_state(repo, state)
931 return mayupdate(repo, extendnode.node())
931 return mayupdate(repo, extendnode.node())
932 raise error.Abort(_("nothing to extend"))
932 raise error.Abort(_("nothing to extend"))
933
933
934 if changesets == 0:
934 if changesets == 0:
935 hbisect.printresult(ui, repo, state, displayer, nodes, good)
935 hbisect.printresult(ui, repo, state, displayer, nodes, good)
936 else:
936 else:
937 assert len(nodes) == 1 # only a single node can be tested next
937 assert len(nodes) == 1 # only a single node can be tested next
938 node = nodes[0]
938 node = nodes[0]
939 # compute the approximate number of remaining tests
939 # compute the approximate number of remaining tests
940 tests, size = 0, 2
940 tests, size = 0, 2
941 while size <= changesets:
941 while size <= changesets:
942 tests, size = tests + 1, size * 2
942 tests, size = tests + 1, size * 2
943 rev = repo.changelog.rev(node)
943 rev = repo.changelog.rev(node)
944 ui.write(_("Testing changeset %d:%s "
944 ui.write(_("Testing changeset %d:%s "
945 "(%d changesets remaining, ~%d tests)\n")
945 "(%d changesets remaining, ~%d tests)\n")
946 % (rev, short(node), changesets, tests))
946 % (rev, short(node), changesets, tests))
947 state['current'] = [node]
947 state['current'] = [node]
948 hbisect.save_state(repo, state)
948 hbisect.save_state(repo, state)
949 return mayupdate(repo, node)
949 return mayupdate(repo, node)
950
950
951 @command('bookmarks|bookmark',
951 @command('bookmarks|bookmark',
952 [('f', 'force', False, _('force')),
952 [('f', 'force', False, _('force')),
953 ('r', 'rev', '', _('revision for bookmark action'), _('REV')),
953 ('r', 'rev', '', _('revision for bookmark action'), _('REV')),
954 ('d', 'delete', False, _('delete a given bookmark')),
954 ('d', 'delete', False, _('delete a given bookmark')),
955 ('m', 'rename', '', _('rename a given bookmark'), _('OLD')),
955 ('m', 'rename', '', _('rename a given bookmark'), _('OLD')),
956 ('i', 'inactive', False, _('mark a bookmark inactive')),
956 ('i', 'inactive', False, _('mark a bookmark inactive')),
957 ] + formatteropts,
957 ] + formatteropts,
958 _('hg bookmarks [OPTIONS]... [NAME]...'))
958 _('hg bookmarks [OPTIONS]... [NAME]...'))
959 def bookmark(ui, repo, *names, **opts):
959 def bookmark(ui, repo, *names, **opts):
960 '''create a new bookmark or list existing bookmarks
960 '''create a new bookmark or list existing bookmarks
961
961
962 Bookmarks are labels on changesets to help track lines of development.
962 Bookmarks are labels on changesets to help track lines of development.
963 Bookmarks are unversioned and can be moved, renamed and deleted.
963 Bookmarks are unversioned and can be moved, renamed and deleted.
964 Deleting or moving a bookmark has no effect on the associated changesets.
964 Deleting or moving a bookmark has no effect on the associated changesets.
965
965
966 Creating or updating to a bookmark causes it to be marked as 'active'.
966 Creating or updating to a bookmark causes it to be marked as 'active'.
967 The active bookmark is indicated with a '*'.
967 The active bookmark is indicated with a '*'.
968 When a commit is made, the active bookmark will advance to the new commit.
968 When a commit is made, the active bookmark will advance to the new commit.
969 A plain :hg:`update` will also advance an active bookmark, if possible.
969 A plain :hg:`update` will also advance an active bookmark, if possible.
970 Updating away from a bookmark will cause it to be deactivated.
970 Updating away from a bookmark will cause it to be deactivated.
971
971
972 Bookmarks can be pushed and pulled between repositories (see
972 Bookmarks can be pushed and pulled between repositories (see
973 :hg:`help push` and :hg:`help pull`). If a shared bookmark has
973 :hg:`help push` and :hg:`help pull`). If a shared bookmark has
974 diverged, a new 'divergent bookmark' of the form 'name@path' will
974 diverged, a new 'divergent bookmark' of the form 'name@path' will
975 be created. Using :hg:`merge` will resolve the divergence.
975 be created. Using :hg:`merge` will resolve the divergence.
976
976
977 A bookmark named '@' has the special property that :hg:`clone` will
977 A bookmark named '@' has the special property that :hg:`clone` will
978 check it out by default if it exists.
978 check it out by default if it exists.
979
979
980 .. container:: verbose
980 .. container:: verbose
981
981
982 Examples:
982 Examples:
983
983
984 - create an active bookmark for a new line of development::
984 - create an active bookmark for a new line of development::
985
985
986 hg book new-feature
986 hg book new-feature
987
987
988 - create an inactive bookmark as a place marker::
988 - create an inactive bookmark as a place marker::
989
989
990 hg book -i reviewed
990 hg book -i reviewed
991
991
992 - create an inactive bookmark on another changeset::
992 - create an inactive bookmark on another changeset::
993
993
994 hg book -r .^ tested
994 hg book -r .^ tested
995
995
996 - rename bookmark turkey to dinner::
996 - rename bookmark turkey to dinner::
997
997
998 hg book -m turkey dinner
998 hg book -m turkey dinner
999
999
1000 - move the '@' bookmark from another branch::
1000 - move the '@' bookmark from another branch::
1001
1001
1002 hg book -f @
1002 hg book -f @
1003 '''
1003 '''
1004 force = opts.get('force')
1004 force = opts.get('force')
1005 rev = opts.get('rev')
1005 rev = opts.get('rev')
1006 delete = opts.get('delete')
1006 delete = opts.get('delete')
1007 rename = opts.get('rename')
1007 rename = opts.get('rename')
1008 inactive = opts.get('inactive')
1008 inactive = opts.get('inactive')
1009
1009
1010 def checkformat(mark):
1010 def checkformat(mark):
1011 mark = mark.strip()
1011 mark = mark.strip()
1012 if not mark:
1012 if not mark:
1013 raise error.Abort(_("bookmark names cannot consist entirely of "
1013 raise error.Abort(_("bookmark names cannot consist entirely of "
1014 "whitespace"))
1014 "whitespace"))
1015 scmutil.checknewlabel(repo, mark, 'bookmark')
1015 scmutil.checknewlabel(repo, mark, 'bookmark')
1016 return mark
1016 return mark
1017
1017
1018 def checkconflict(repo, mark, cur, force=False, target=None):
1018 def checkconflict(repo, mark, cur, force=False, target=None):
1019 if mark in marks and not force:
1019 if mark in marks and not force:
1020 if target:
1020 if target:
1021 if marks[mark] == target and target == cur:
1021 if marks[mark] == target and target == cur:
1022 # re-activating a bookmark
1022 # re-activating a bookmark
1023 return
1023 return
1024 anc = repo.changelog.ancestors([repo[target].rev()])
1024 anc = repo.changelog.ancestors([repo[target].rev()])
1025 bmctx = repo[marks[mark]]
1025 bmctx = repo[marks[mark]]
1026 divs = [repo[b].node() for b in marks
1026 divs = [repo[b].node() for b in marks
1027 if b.split('@', 1)[0] == mark.split('@', 1)[0]]
1027 if b.split('@', 1)[0] == mark.split('@', 1)[0]]
1028
1028
1029 # allow resolving a single divergent bookmark even if moving
1029 # allow resolving a single divergent bookmark even if moving
1030 # the bookmark across branches when a revision is specified
1030 # the bookmark across branches when a revision is specified
1031 # that contains a divergent bookmark
1031 # that contains a divergent bookmark
1032 if bmctx.rev() not in anc and target in divs:
1032 if bmctx.rev() not in anc and target in divs:
1033 bookmarks.deletedivergent(repo, [target], mark)
1033 bookmarks.deletedivergent(repo, [target], mark)
1034 return
1034 return
1035
1035
1036 deletefrom = [b for b in divs
1036 deletefrom = [b for b in divs
1037 if repo[b].rev() in anc or b == target]
1037 if repo[b].rev() in anc or b == target]
1038 bookmarks.deletedivergent(repo, deletefrom, mark)
1038 bookmarks.deletedivergent(repo, deletefrom, mark)
1039 if bookmarks.validdest(repo, bmctx, repo[target]):
1039 if bookmarks.validdest(repo, bmctx, repo[target]):
1040 ui.status(_("moving bookmark '%s' forward from %s\n") %
1040 ui.status(_("moving bookmark '%s' forward from %s\n") %
1041 (mark, short(bmctx.node())))
1041 (mark, short(bmctx.node())))
1042 return
1042 return
1043 raise error.Abort(_("bookmark '%s' already exists "
1043 raise error.Abort(_("bookmark '%s' already exists "
1044 "(use -f to force)") % mark)
1044 "(use -f to force)") % mark)
1045 if ((mark in repo.branchmap() or mark == repo.dirstate.branch())
1045 if ((mark in repo.branchmap() or mark == repo.dirstate.branch())
1046 and not force):
1046 and not force):
1047 raise error.Abort(
1047 raise error.Abort(
1048 _("a bookmark cannot have the name of an existing branch"))
1048 _("a bookmark cannot have the name of an existing branch"))
1049
1049
1050 if delete and rename:
1050 if delete and rename:
1051 raise error.Abort(_("--delete and --rename are incompatible"))
1051 raise error.Abort(_("--delete and --rename are incompatible"))
1052 if delete and rev:
1052 if delete and rev:
1053 raise error.Abort(_("--rev is incompatible with --delete"))
1053 raise error.Abort(_("--rev is incompatible with --delete"))
1054 if rename and rev:
1054 if rename and rev:
1055 raise error.Abort(_("--rev is incompatible with --rename"))
1055 raise error.Abort(_("--rev is incompatible with --rename"))
1056 if not names and (delete or rev):
1056 if not names and (delete or rev):
1057 raise error.Abort(_("bookmark name required"))
1057 raise error.Abort(_("bookmark name required"))
1058
1058
1059 if delete or rename or names or inactive:
1059 if delete or rename or names or inactive:
1060 wlock = lock = tr = None
1060 wlock = lock = tr = None
1061 try:
1061 try:
1062 wlock = repo.wlock()
1062 wlock = repo.wlock()
1063 lock = repo.lock()
1063 lock = repo.lock()
1064 cur = repo.changectx('.').node()
1064 cur = repo.changectx('.').node()
1065 marks = repo._bookmarks
1065 marks = repo._bookmarks
1066 if delete:
1066 if delete:
1067 tr = repo.transaction('bookmark')
1067 tr = repo.transaction('bookmark')
1068 for mark in names:
1068 for mark in names:
1069 if mark not in marks:
1069 if mark not in marks:
1070 raise error.Abort(_("bookmark '%s' does not exist") %
1070 raise error.Abort(_("bookmark '%s' does not exist") %
1071 mark)
1071 mark)
1072 if mark == repo._activebookmark:
1072 if mark == repo._activebookmark:
1073 bookmarks.deactivate(repo)
1073 bookmarks.deactivate(repo)
1074 del marks[mark]
1074 del marks[mark]
1075
1075
1076 elif rename:
1076 elif rename:
1077 tr = repo.transaction('bookmark')
1077 tr = repo.transaction('bookmark')
1078 if not names:
1078 if not names:
1079 raise error.Abort(_("new bookmark name required"))
1079 raise error.Abort(_("new bookmark name required"))
1080 elif len(names) > 1:
1080 elif len(names) > 1:
1081 raise error.Abort(_("only one new bookmark name allowed"))
1081 raise error.Abort(_("only one new bookmark name allowed"))
1082 mark = checkformat(names[0])
1082 mark = checkformat(names[0])
1083 if rename not in marks:
1083 if rename not in marks:
1084 raise error.Abort(_("bookmark '%s' does not exist")
1084 raise error.Abort(_("bookmark '%s' does not exist")
1085 % rename)
1085 % rename)
1086 checkconflict(repo, mark, cur, force)
1086 checkconflict(repo, mark, cur, force)
1087 marks[mark] = marks[rename]
1087 marks[mark] = marks[rename]
1088 if repo._activebookmark == rename and not inactive:
1088 if repo._activebookmark == rename and not inactive:
1089 bookmarks.activate(repo, mark)
1089 bookmarks.activate(repo, mark)
1090 del marks[rename]
1090 del marks[rename]
1091 elif names:
1091 elif names:
1092 tr = repo.transaction('bookmark')
1092 tr = repo.transaction('bookmark')
1093 newact = None
1093 newact = None
1094 for mark in names:
1094 for mark in names:
1095 mark = checkformat(mark)
1095 mark = checkformat(mark)
1096 if newact is None:
1096 if newact is None:
1097 newact = mark
1097 newact = mark
1098 if inactive and mark == repo._activebookmark:
1098 if inactive and mark == repo._activebookmark:
1099 bookmarks.deactivate(repo)
1099 bookmarks.deactivate(repo)
1100 return
1100 return
1101 tgt = cur
1101 tgt = cur
1102 if rev:
1102 if rev:
1103 tgt = scmutil.revsingle(repo, rev).node()
1103 tgt = scmutil.revsingle(repo, rev).node()
1104 checkconflict(repo, mark, cur, force, tgt)
1104 checkconflict(repo, mark, cur, force, tgt)
1105 marks[mark] = tgt
1105 marks[mark] = tgt
1106 if not inactive and cur == marks[newact] and not rev:
1106 if not inactive and cur == marks[newact] and not rev:
1107 bookmarks.activate(repo, newact)
1107 bookmarks.activate(repo, newact)
1108 elif cur != tgt and newact == repo._activebookmark:
1108 elif cur != tgt and newact == repo._activebookmark:
1109 bookmarks.deactivate(repo)
1109 bookmarks.deactivate(repo)
1110 elif inactive:
1110 elif inactive:
1111 if len(marks) == 0:
1111 if len(marks) == 0:
1112 ui.status(_("no bookmarks set\n"))
1112 ui.status(_("no bookmarks set\n"))
1113 elif not repo._activebookmark:
1113 elif not repo._activebookmark:
1114 ui.status(_("no active bookmark\n"))
1114 ui.status(_("no active bookmark\n"))
1115 else:
1115 else:
1116 bookmarks.deactivate(repo)
1116 bookmarks.deactivate(repo)
1117 if tr is not None:
1117 if tr is not None:
1118 marks.recordchange(tr)
1118 marks.recordchange(tr)
1119 tr.close()
1119 tr.close()
1120 finally:
1120 finally:
1121 lockmod.release(tr, lock, wlock)
1121 lockmod.release(tr, lock, wlock)
1122 else: # show bookmarks
1122 else: # show bookmarks
1123 fm = ui.formatter('bookmarks', opts)
1123 fm = ui.formatter('bookmarks', opts)
1124 hexfn = fm.hexfunc
1124 hexfn = fm.hexfunc
1125 marks = repo._bookmarks
1125 marks = repo._bookmarks
1126 if len(marks) == 0 and fm.isplain():
1126 if len(marks) == 0 and fm.isplain():
1127 ui.status(_("no bookmarks set\n"))
1127 ui.status(_("no bookmarks set\n"))
1128 for bmark, n in sorted(marks.iteritems()):
1128 for bmark, n in sorted(marks.iteritems()):
1129 active = repo._activebookmark
1129 active = repo._activebookmark
1130 if bmark == active:
1130 if bmark == active:
1131 prefix, label = '*', activebookmarklabel
1131 prefix, label = '*', activebookmarklabel
1132 else:
1132 else:
1133 prefix, label = ' ', ''
1133 prefix, label = ' ', ''
1134
1134
1135 fm.startitem()
1135 fm.startitem()
1136 if not ui.quiet:
1136 if not ui.quiet:
1137 fm.plain(' %s ' % prefix, label=label)
1137 fm.plain(' %s ' % prefix, label=label)
1138 fm.write('bookmark', '%s', bmark, label=label)
1138 fm.write('bookmark', '%s', bmark, label=label)
1139 pad = " " * (25 - encoding.colwidth(bmark))
1139 pad = " " * (25 - encoding.colwidth(bmark))
1140 fm.condwrite(not ui.quiet, 'rev node', pad + ' %d:%s',
1140 fm.condwrite(not ui.quiet, 'rev node', pad + ' %d:%s',
1141 repo.changelog.rev(n), hexfn(n), label=label)
1141 repo.changelog.rev(n), hexfn(n), label=label)
1142 fm.data(active=(bmark == active))
1142 fm.data(active=(bmark == active))
1143 fm.plain('\n')
1143 fm.plain('\n')
1144 fm.end()
1144 fm.end()
1145
1145
1146 @command('branch',
1146 @command('branch',
1147 [('f', 'force', None,
1147 [('f', 'force', None,
1148 _('set branch name even if it shadows an existing branch')),
1148 _('set branch name even if it shadows an existing branch')),
1149 ('C', 'clean', None, _('reset branch name to parent branch name'))],
1149 ('C', 'clean', None, _('reset branch name to parent branch name'))],
1150 _('[-fC] [NAME]'))
1150 _('[-fC] [NAME]'))
1151 def branch(ui, repo, label=None, **opts):
1151 def branch(ui, repo, label=None, **opts):
1152 """set or show the current branch name
1152 """set or show the current branch name
1153
1153
1154 .. note::
1154 .. note::
1155
1155
1156 Branch names are permanent and global. Use :hg:`bookmark` to create a
1156 Branch names are permanent and global. Use :hg:`bookmark` to create a
1157 light-weight bookmark instead. See :hg:`help glossary` for more
1157 light-weight bookmark instead. See :hg:`help glossary` for more
1158 information about named branches and bookmarks.
1158 information about named branches and bookmarks.
1159
1159
1160 With no argument, show the current branch name. With one argument,
1160 With no argument, show the current branch name. With one argument,
1161 set the working directory branch name (the branch will not exist
1161 set the working directory branch name (the branch will not exist
1162 in the repository until the next commit). Standard practice
1162 in the repository until the next commit). Standard practice
1163 recommends that primary development take place on the 'default'
1163 recommends that primary development take place on the 'default'
1164 branch.
1164 branch.
1165
1165
1166 Unless -f/--force is specified, branch will not let you set a
1166 Unless -f/--force is specified, branch will not let you set a
1167 branch name that already exists.
1167 branch name that already exists.
1168
1168
1169 Use -C/--clean to reset the working directory branch to that of
1169 Use -C/--clean to reset the working directory branch to that of
1170 the parent of the working directory, negating a previous branch
1170 the parent of the working directory, negating a previous branch
1171 change.
1171 change.
1172
1172
1173 Use the command :hg:`update` to switch to an existing branch. Use
1173 Use the command :hg:`update` to switch to an existing branch. Use
1174 :hg:`commit --close-branch` to mark this branch head as closed.
1174 :hg:`commit --close-branch` to mark this branch head as closed.
1175 When all heads of a branch are closed, the branch will be
1175 When all heads of a branch are closed, the branch will be
1176 considered closed.
1176 considered closed.
1177
1177
1178 Returns 0 on success.
1178 Returns 0 on success.
1179 """
1179 """
1180 if label:
1180 if label:
1181 label = label.strip()
1181 label = label.strip()
1182
1182
1183 if not opts.get('clean') and not label:
1183 if not opts.get('clean') and not label:
1184 ui.write("%s\n" % repo.dirstate.branch())
1184 ui.write("%s\n" % repo.dirstate.branch())
1185 return
1185 return
1186
1186
1187 with repo.wlock():
1187 with repo.wlock():
1188 if opts.get('clean'):
1188 if opts.get('clean'):
1189 label = repo[None].p1().branch()
1189 label = repo[None].p1().branch()
1190 repo.dirstate.setbranch(label)
1190 repo.dirstate.setbranch(label)
1191 ui.status(_('reset working directory to branch %s\n') % label)
1191 ui.status(_('reset working directory to branch %s\n') % label)
1192 elif label:
1192 elif label:
1193 if not opts.get('force') and label in repo.branchmap():
1193 if not opts.get('force') and label in repo.branchmap():
1194 if label not in [p.branch() for p in repo[None].parents()]:
1194 if label not in [p.branch() for p in repo[None].parents()]:
1195 raise error.Abort(_('a branch of the same name already'
1195 raise error.Abort(_('a branch of the same name already'
1196 ' exists'),
1196 ' exists'),
1197 # i18n: "it" refers to an existing branch
1197 # i18n: "it" refers to an existing branch
1198 hint=_("use 'hg update' to switch to it"))
1198 hint=_("use 'hg update' to switch to it"))
1199 scmutil.checknewlabel(repo, label, 'branch')
1199 scmutil.checknewlabel(repo, label, 'branch')
1200 repo.dirstate.setbranch(label)
1200 repo.dirstate.setbranch(label)
1201 ui.status(_('marked working directory as branch %s\n') % label)
1201 ui.status(_('marked working directory as branch %s\n') % label)
1202
1202
1203 # find any open named branches aside from default
1203 # find any open named branches aside from default
1204 others = [n for n, h, t, c in repo.branchmap().iterbranches()
1204 others = [n for n, h, t, c in repo.branchmap().iterbranches()
1205 if n != "default" and not c]
1205 if n != "default" and not c]
1206 if not others:
1206 if not others:
1207 ui.status(_('(branches are permanent and global, '
1207 ui.status(_('(branches are permanent and global, '
1208 'did you want a bookmark?)\n'))
1208 'did you want a bookmark?)\n'))
1209
1209
1210 @command('branches',
1210 @command('branches',
1211 [('a', 'active', False,
1211 [('a', 'active', False,
1212 _('show only branches that have unmerged heads (DEPRECATED)')),
1212 _('show only branches that have unmerged heads (DEPRECATED)')),
1213 ('c', 'closed', False, _('show normal and closed branches')),
1213 ('c', 'closed', False, _('show normal and closed branches')),
1214 ] + formatteropts,
1214 ] + formatteropts,
1215 _('[-c]'))
1215 _('[-c]'))
1216 def branches(ui, repo, active=False, closed=False, **opts):
1216 def branches(ui, repo, active=False, closed=False, **opts):
1217 """list repository named branches
1217 """list repository named branches
1218
1218
1219 List the repository's named branches, indicating which ones are
1219 List the repository's named branches, indicating which ones are
1220 inactive. If -c/--closed is specified, also list branches which have
1220 inactive. If -c/--closed is specified, also list branches which have
1221 been marked closed (see :hg:`commit --close-branch`).
1221 been marked closed (see :hg:`commit --close-branch`).
1222
1222
1223 Use the command :hg:`update` to switch to an existing branch.
1223 Use the command :hg:`update` to switch to an existing branch.
1224
1224
1225 Returns 0.
1225 Returns 0.
1226 """
1226 """
1227
1227
1228 ui.pager('branches')
1228 ui.pager('branches')
1229 fm = ui.formatter('branches', opts)
1229 fm = ui.formatter('branches', opts)
1230 hexfunc = fm.hexfunc
1230 hexfunc = fm.hexfunc
1231
1231
1232 allheads = set(repo.heads())
1232 allheads = set(repo.heads())
1233 branches = []
1233 branches = []
1234 for tag, heads, tip, isclosed in repo.branchmap().iterbranches():
1234 for tag, heads, tip, isclosed in repo.branchmap().iterbranches():
1235 isactive = not isclosed and bool(set(heads) & allheads)
1235 isactive = not isclosed and bool(set(heads) & allheads)
1236 branches.append((tag, repo[tip], isactive, not isclosed))
1236 branches.append((tag, repo[tip], isactive, not isclosed))
1237 branches.sort(key=lambda i: (i[2], i[1].rev(), i[0], i[3]),
1237 branches.sort(key=lambda i: (i[2], i[1].rev(), i[0], i[3]),
1238 reverse=True)
1238 reverse=True)
1239
1239
1240 for tag, ctx, isactive, isopen in branches:
1240 for tag, ctx, isactive, isopen in branches:
1241 if active and not isactive:
1241 if active and not isactive:
1242 continue
1242 continue
1243 if isactive:
1243 if isactive:
1244 label = 'branches.active'
1244 label = 'branches.active'
1245 notice = ''
1245 notice = ''
1246 elif not isopen:
1246 elif not isopen:
1247 if not closed:
1247 if not closed:
1248 continue
1248 continue
1249 label = 'branches.closed'
1249 label = 'branches.closed'
1250 notice = _(' (closed)')
1250 notice = _(' (closed)')
1251 else:
1251 else:
1252 label = 'branches.inactive'
1252 label = 'branches.inactive'
1253 notice = _(' (inactive)')
1253 notice = _(' (inactive)')
1254 current = (tag == repo.dirstate.branch())
1254 current = (tag == repo.dirstate.branch())
1255 if current:
1255 if current:
1256 label = 'branches.current'
1256 label = 'branches.current'
1257
1257
1258 fm.startitem()
1258 fm.startitem()
1259 fm.write('branch', '%s', tag, label=label)
1259 fm.write('branch', '%s', tag, label=label)
1260 rev = ctx.rev()
1260 rev = ctx.rev()
1261 padsize = max(31 - len(str(rev)) - encoding.colwidth(tag), 0)
1261 padsize = max(31 - len(str(rev)) - encoding.colwidth(tag), 0)
1262 fmt = ' ' * padsize + ' %d:%s'
1262 fmt = ' ' * padsize + ' %d:%s'
1263 fm.condwrite(not ui.quiet, 'rev node', fmt, rev, hexfunc(ctx.node()),
1263 fm.condwrite(not ui.quiet, 'rev node', fmt, rev, hexfunc(ctx.node()),
1264 label='log.changeset changeset.%s' % ctx.phasestr())
1264 label='log.changeset changeset.%s' % ctx.phasestr())
1265 fm.context(ctx=ctx)
1265 fm.context(ctx=ctx)
1266 fm.data(active=isactive, closed=not isopen, current=current)
1266 fm.data(active=isactive, closed=not isopen, current=current)
1267 if not ui.quiet:
1267 if not ui.quiet:
1268 fm.plain(notice)
1268 fm.plain(notice)
1269 fm.plain('\n')
1269 fm.plain('\n')
1270 fm.end()
1270 fm.end()
1271
1271
1272 @command('bundle',
1272 @command('bundle',
1273 [('f', 'force', None, _('run even when the destination is unrelated')),
1273 [('f', 'force', None, _('run even when the destination is unrelated')),
1274 ('r', 'rev', [], _('a changeset intended to be added to the destination'),
1274 ('r', 'rev', [], _('a changeset intended to be added to the destination'),
1275 _('REV')),
1275 _('REV')),
1276 ('b', 'branch', [], _('a specific branch you would like to bundle'),
1276 ('b', 'branch', [], _('a specific branch you would like to bundle'),
1277 _('BRANCH')),
1277 _('BRANCH')),
1278 ('', 'base', [],
1278 ('', 'base', [],
1279 _('a base changeset assumed to be available at the destination'),
1279 _('a base changeset assumed to be available at the destination'),
1280 _('REV')),
1280 _('REV')),
1281 ('a', 'all', None, _('bundle all changesets in the repository')),
1281 ('a', 'all', None, _('bundle all changesets in the repository')),
1282 ('t', 'type', 'bzip2', _('bundle compression type to use'), _('TYPE')),
1282 ('t', 'type', 'bzip2', _('bundle compression type to use'), _('TYPE')),
1283 ] + remoteopts,
1283 ] + remoteopts,
1284 _('[-f] [-t BUNDLESPEC] [-a] [-r REV]... [--base REV]... FILE [DEST]'))
1284 _('[-f] [-t BUNDLESPEC] [-a] [-r REV]... [--base REV]... FILE [DEST]'))
1285 def bundle(ui, repo, fname, dest=None, **opts):
1285 def bundle(ui, repo, fname, dest=None, **opts):
1286 """create a bundle file
1286 """create a bundle file
1287
1287
1288 Generate a bundle file containing data to be added to a repository.
1288 Generate a bundle file containing data to be added to a repository.
1289
1289
1290 To create a bundle containing all changesets, use -a/--all
1290 To create a bundle containing all changesets, use -a/--all
1291 (or --base null). Otherwise, hg assumes the destination will have
1291 (or --base null). Otherwise, hg assumes the destination will have
1292 all the nodes you specify with --base parameters. Otherwise, hg
1292 all the nodes you specify with --base parameters. Otherwise, hg
1293 will assume the repository has all the nodes in destination, or
1293 will assume the repository has all the nodes in destination, or
1294 default-push/default if no destination is specified.
1294 default-push/default if no destination is specified.
1295
1295
1296 You can change bundle format with the -t/--type option. See
1296 You can change bundle format with the -t/--type option. See
1297 :hg:`help bundlespec` for documentation on this format. By default,
1297 :hg:`help bundlespec` for documentation on this format. By default,
1298 the most appropriate format is used and compression defaults to
1298 the most appropriate format is used and compression defaults to
1299 bzip2.
1299 bzip2.
1300
1300
1301 The bundle file can then be transferred using conventional means
1301 The bundle file can then be transferred using conventional means
1302 and applied to another repository with the unbundle or pull
1302 and applied to another repository with the unbundle or pull
1303 command. This is useful when direct push and pull are not
1303 command. This is useful when direct push and pull are not
1304 available or when exporting an entire repository is undesirable.
1304 available or when exporting an entire repository is undesirable.
1305
1305
1306 Applying bundles preserves all changeset contents including
1306 Applying bundles preserves all changeset contents including
1307 permissions, copy/rename information, and revision history.
1307 permissions, copy/rename information, and revision history.
1308
1308
1309 Returns 0 on success, 1 if no changes found.
1309 Returns 0 on success, 1 if no changes found.
1310 """
1310 """
1311 revs = None
1311 revs = None
1312 if 'rev' in opts:
1312 if 'rev' in opts:
1313 revstrings = opts['rev']
1313 revstrings = opts['rev']
1314 revs = scmutil.revrange(repo, revstrings)
1314 revs = scmutil.revrange(repo, revstrings)
1315 if revstrings and not revs:
1315 if revstrings and not revs:
1316 raise error.Abort(_('no commits to bundle'))
1316 raise error.Abort(_('no commits to bundle'))
1317
1317
1318 bundletype = opts.get('type', 'bzip2').lower()
1318 bundletype = opts.get('type', 'bzip2').lower()
1319 try:
1319 try:
1320 bcompression, cgversion, params = exchange.parsebundlespec(
1320 bcompression, cgversion, params = exchange.parsebundlespec(
1321 repo, bundletype, strict=False)
1321 repo, bundletype, strict=False)
1322 except error.UnsupportedBundleSpecification as e:
1322 except error.UnsupportedBundleSpecification as e:
1323 raise error.Abort(str(e),
1323 raise error.Abort(str(e),
1324 hint=_("see 'hg help bundlespec' for supported "
1324 hint=_("see 'hg help bundlespec' for supported "
1325 "values for --type"))
1325 "values for --type"))
1326
1326
1327 # Packed bundles are a pseudo bundle format for now.
1327 # Packed bundles are a pseudo bundle format for now.
1328 if cgversion == 's1':
1328 if cgversion == 's1':
1329 raise error.Abort(_('packed bundles cannot be produced by "hg bundle"'),
1329 raise error.Abort(_('packed bundles cannot be produced by "hg bundle"'),
1330 hint=_("use 'hg debugcreatestreamclonebundle'"))
1330 hint=_("use 'hg debugcreatestreamclonebundle'"))
1331
1331
1332 if opts.get('all'):
1332 if opts.get('all'):
1333 if dest:
1333 if dest:
1334 raise error.Abort(_("--all is incompatible with specifying "
1334 raise error.Abort(_("--all is incompatible with specifying "
1335 "a destination"))
1335 "a destination"))
1336 if opts.get('base'):
1336 if opts.get('base'):
1337 ui.warn(_("ignoring --base because --all was specified\n"))
1337 ui.warn(_("ignoring --base because --all was specified\n"))
1338 base = ['null']
1338 base = ['null']
1339 else:
1339 else:
1340 base = scmutil.revrange(repo, opts.get('base'))
1340 base = scmutil.revrange(repo, opts.get('base'))
1341 # TODO: get desired bundlecaps from command line.
1341 # TODO: get desired bundlecaps from command line.
1342 bundlecaps = None
1342 bundlecaps = None
1343 if cgversion not in changegroup.supportedoutgoingversions(repo):
1343 if cgversion not in changegroup.supportedoutgoingversions(repo):
1344 raise error.Abort(_("repository does not support bundle version %s") %
1344 raise error.Abort(_("repository does not support bundle version %s") %
1345 cgversion)
1345 cgversion)
1346
1346
1347 if base:
1347 if base:
1348 if dest:
1348 if dest:
1349 raise error.Abort(_("--base is incompatible with specifying "
1349 raise error.Abort(_("--base is incompatible with specifying "
1350 "a destination"))
1350 "a destination"))
1351 common = [repo.lookup(rev) for rev in base]
1351 common = [repo.lookup(rev) for rev in base]
1352 heads = revs and map(repo.lookup, revs) or None
1352 heads = revs and map(repo.lookup, revs) or None
1353 outgoing = discovery.outgoing(repo, common, heads)
1353 outgoing = discovery.outgoing(repo, common, heads)
1354 cg = changegroup.getchangegroup(repo, 'bundle', outgoing,
1354 cg = changegroup.getchangegroup(repo, 'bundle', outgoing,
1355 bundlecaps=bundlecaps,
1355 bundlecaps=bundlecaps,
1356 version=cgversion)
1356 version=cgversion)
1357 outgoing = None
1357 outgoing = None
1358 else:
1358 else:
1359 dest = ui.expandpath(dest or 'default-push', dest or 'default')
1359 dest = ui.expandpath(dest or 'default-push', dest or 'default')
1360 dest, branches = hg.parseurl(dest, opts.get('branch'))
1360 dest, branches = hg.parseurl(dest, opts.get('branch'))
1361 other = hg.peer(repo, opts, dest)
1361 other = hg.peer(repo, opts, dest)
1362 revs, checkout = hg.addbranchrevs(repo, repo, branches, revs)
1362 revs, checkout = hg.addbranchrevs(repo, repo, branches, revs)
1363 heads = revs and map(repo.lookup, revs) or revs
1363 heads = revs and map(repo.lookup, revs) or revs
1364 outgoing = discovery.findcommonoutgoing(repo, other,
1364 outgoing = discovery.findcommonoutgoing(repo, other,
1365 onlyheads=heads,
1365 onlyheads=heads,
1366 force=opts.get('force'),
1366 force=opts.get('force'),
1367 portable=True)
1367 portable=True)
1368 cg = changegroup.getlocalchangegroup(repo, 'bundle', outgoing,
1368 cg = changegroup.getlocalchangegroup(repo, 'bundle', outgoing,
1369 bundlecaps, version=cgversion)
1369 bundlecaps, version=cgversion)
1370 if not cg:
1370 if not cg:
1371 scmutil.nochangesfound(ui, repo, outgoing and outgoing.excluded)
1371 scmutil.nochangesfound(ui, repo, outgoing and outgoing.excluded)
1372 return 1
1372 return 1
1373
1373
1374 if cgversion == '01': #bundle1
1374 if cgversion == '01': #bundle1
1375 if bcompression is None:
1375 if bcompression is None:
1376 bcompression = 'UN'
1376 bcompression = 'UN'
1377 bversion = 'HG10' + bcompression
1377 bversion = 'HG10' + bcompression
1378 bcompression = None
1378 bcompression = None
1379 else:
1379 else:
1380 assert cgversion == '02'
1380 assert cgversion == '02'
1381 bversion = 'HG20'
1381 bversion = 'HG20'
1382
1382
1383 # TODO compression options should be derived from bundlespec parsing.
1383 # TODO compression options should be derived from bundlespec parsing.
1384 # This is a temporary hack to allow adjusting bundle compression
1384 # This is a temporary hack to allow adjusting bundle compression
1385 # level without a) formalizing the bundlespec changes to declare it
1385 # level without a) formalizing the bundlespec changes to declare it
1386 # b) introducing a command flag.
1386 # b) introducing a command flag.
1387 compopts = {}
1387 compopts = {}
1388 complevel = ui.configint('experimental', 'bundlecomplevel')
1388 complevel = ui.configint('experimental', 'bundlecomplevel')
1389 if complevel is not None:
1389 if complevel is not None:
1390 compopts['level'] = complevel
1390 compopts['level'] = complevel
1391
1391
1392 bundle2.writebundle(ui, cg, fname, bversion, compression=bcompression,
1392 bundle2.writebundle(ui, cg, fname, bversion, compression=bcompression,
1393 compopts=compopts)
1393 compopts=compopts)
1394
1394
1395 @command('cat',
1395 @command('cat',
1396 [('o', 'output', '',
1396 [('o', 'output', '',
1397 _('print output to file with formatted name'), _('FORMAT')),
1397 _('print output to file with formatted name'), _('FORMAT')),
1398 ('r', 'rev', '', _('print the given revision'), _('REV')),
1398 ('r', 'rev', '', _('print the given revision'), _('REV')),
1399 ('', 'decode', None, _('apply any matching decode filter')),
1399 ('', 'decode', None, _('apply any matching decode filter')),
1400 ] + walkopts,
1400 ] + walkopts,
1401 _('[OPTION]... FILE...'),
1401 _('[OPTION]... FILE...'),
1402 inferrepo=True)
1402 inferrepo=True)
1403 def cat(ui, repo, file1, *pats, **opts):
1403 def cat(ui, repo, file1, *pats, **opts):
1404 """output the current or given revision of files
1404 """output the current or given revision of files
1405
1405
1406 Print the specified files as they were at the given revision. If
1406 Print the specified files as they were at the given revision. If
1407 no revision is given, the parent of the working directory is used.
1407 no revision is given, the parent of the working directory is used.
1408
1408
1409 Output may be to a file, in which case the name of the file is
1409 Output may be to a file, in which case the name of the file is
1410 given using a format string. The formatting rules as follows:
1410 given using a format string. The formatting rules as follows:
1411
1411
1412 :``%%``: literal "%" character
1412 :``%%``: literal "%" character
1413 :``%s``: basename of file being printed
1413 :``%s``: basename of file being printed
1414 :``%d``: dirname of file being printed, or '.' if in repository root
1414 :``%d``: dirname of file being printed, or '.' if in repository root
1415 :``%p``: root-relative path name of file being printed
1415 :``%p``: root-relative path name of file being printed
1416 :``%H``: changeset hash (40 hexadecimal digits)
1416 :``%H``: changeset hash (40 hexadecimal digits)
1417 :``%R``: changeset revision number
1417 :``%R``: changeset revision number
1418 :``%h``: short-form changeset hash (12 hexadecimal digits)
1418 :``%h``: short-form changeset hash (12 hexadecimal digits)
1419 :``%r``: zero-padded changeset revision number
1419 :``%r``: zero-padded changeset revision number
1420 :``%b``: basename of the exporting repository
1420 :``%b``: basename of the exporting repository
1421
1421
1422 Returns 0 on success.
1422 Returns 0 on success.
1423 """
1423 """
1424 ctx = scmutil.revsingle(repo, opts.get('rev'))
1424 ctx = scmutil.revsingle(repo, opts.get('rev'))
1425 m = scmutil.match(ctx, (file1,) + pats, opts)
1425 m = scmutil.match(ctx, (file1,) + pats, opts)
1426
1426
1427 ui.pager('cat')
1427 ui.pager('cat')
1428 return cmdutil.cat(ui, repo, ctx, m, '', **opts)
1428 return cmdutil.cat(ui, repo, ctx, m, '', **opts)
1429
1429
1430 @command('^clone',
1430 @command('^clone',
1431 [('U', 'noupdate', None, _('the clone will include an empty working '
1431 [('U', 'noupdate', None, _('the clone will include an empty working '
1432 'directory (only a repository)')),
1432 'directory (only a repository)')),
1433 ('u', 'updaterev', '', _('revision, tag, or branch to check out'),
1433 ('u', 'updaterev', '', _('revision, tag, or branch to check out'),
1434 _('REV')),
1434 _('REV')),
1435 ('r', 'rev', [], _('include the specified changeset'), _('REV')),
1435 ('r', 'rev', [], _('include the specified changeset'), _('REV')),
1436 ('b', 'branch', [], _('clone only the specified branch'), _('BRANCH')),
1436 ('b', 'branch', [], _('clone only the specified branch'), _('BRANCH')),
1437 ('', 'pull', None, _('use pull protocol to copy metadata')),
1437 ('', 'pull', None, _('use pull protocol to copy metadata')),
1438 ('', 'uncompressed', None, _('use uncompressed transfer (fast over LAN)')),
1438 ('', 'uncompressed', None, _('use uncompressed transfer (fast over LAN)')),
1439 ] + remoteopts,
1439 ] + remoteopts,
1440 _('[OPTION]... SOURCE [DEST]'),
1440 _('[OPTION]... SOURCE [DEST]'),
1441 norepo=True)
1441 norepo=True)
1442 def clone(ui, source, dest=None, **opts):
1442 def clone(ui, source, dest=None, **opts):
1443 """make a copy of an existing repository
1443 """make a copy of an existing repository
1444
1444
1445 Create a copy of an existing repository in a new directory.
1445 Create a copy of an existing repository in a new directory.
1446
1446
1447 If no destination directory name is specified, it defaults to the
1447 If no destination directory name is specified, it defaults to the
1448 basename of the source.
1448 basename of the source.
1449
1449
1450 The location of the source is added to the new repository's
1450 The location of the source is added to the new repository's
1451 ``.hg/hgrc`` file, as the default to be used for future pulls.
1451 ``.hg/hgrc`` file, as the default to be used for future pulls.
1452
1452
1453 Only local paths and ``ssh://`` URLs are supported as
1453 Only local paths and ``ssh://`` URLs are supported as
1454 destinations. For ``ssh://`` destinations, no working directory or
1454 destinations. For ``ssh://`` destinations, no working directory or
1455 ``.hg/hgrc`` will be created on the remote side.
1455 ``.hg/hgrc`` will be created on the remote side.
1456
1456
1457 If the source repository has a bookmark called '@' set, that
1457 If the source repository has a bookmark called '@' set, that
1458 revision will be checked out in the new repository by default.
1458 revision will be checked out in the new repository by default.
1459
1459
1460 To check out a particular version, use -u/--update, or
1460 To check out a particular version, use -u/--update, or
1461 -U/--noupdate to create a clone with no working directory.
1461 -U/--noupdate to create a clone with no working directory.
1462
1462
1463 To pull only a subset of changesets, specify one or more revisions
1463 To pull only a subset of changesets, specify one or more revisions
1464 identifiers with -r/--rev or branches with -b/--branch. The
1464 identifiers with -r/--rev or branches with -b/--branch. The
1465 resulting clone will contain only the specified changesets and
1465 resulting clone will contain only the specified changesets and
1466 their ancestors. These options (or 'clone src#rev dest') imply
1466 their ancestors. These options (or 'clone src#rev dest') imply
1467 --pull, even for local source repositories.
1467 --pull, even for local source repositories.
1468
1468
1469 .. note::
1469 .. note::
1470
1470
1471 Specifying a tag will include the tagged changeset but not the
1471 Specifying a tag will include the tagged changeset but not the
1472 changeset containing the tag.
1472 changeset containing the tag.
1473
1473
1474 .. container:: verbose
1474 .. container:: verbose
1475
1475
1476 For efficiency, hardlinks are used for cloning whenever the
1476 For efficiency, hardlinks are used for cloning whenever the
1477 source and destination are on the same filesystem (note this
1477 source and destination are on the same filesystem (note this
1478 applies only to the repository data, not to the working
1478 applies only to the repository data, not to the working
1479 directory). Some filesystems, such as AFS, implement hardlinking
1479 directory). Some filesystems, such as AFS, implement hardlinking
1480 incorrectly, but do not report errors. In these cases, use the
1480 incorrectly, but do not report errors. In these cases, use the
1481 --pull option to avoid hardlinking.
1481 --pull option to avoid hardlinking.
1482
1482
1483 In some cases, you can clone repositories and the working
1483 In some cases, you can clone repositories and the working
1484 directory using full hardlinks with ::
1484 directory using full hardlinks with ::
1485
1485
1486 $ cp -al REPO REPOCLONE
1486 $ cp -al REPO REPOCLONE
1487
1487
1488 This is the fastest way to clone, but it is not always safe. The
1488 This is the fastest way to clone, but it is not always safe. The
1489 operation is not atomic (making sure REPO is not modified during
1489 operation is not atomic (making sure REPO is not modified during
1490 the operation is up to you) and you have to make sure your
1490 the operation is up to you) and you have to make sure your
1491 editor breaks hardlinks (Emacs and most Linux Kernel tools do
1491 editor breaks hardlinks (Emacs and most Linux Kernel tools do
1492 so). Also, this is not compatible with certain extensions that
1492 so). Also, this is not compatible with certain extensions that
1493 place their metadata under the .hg directory, such as mq.
1493 place their metadata under the .hg directory, such as mq.
1494
1494
1495 Mercurial will update the working directory to the first applicable
1495 Mercurial will update the working directory to the first applicable
1496 revision from this list:
1496 revision from this list:
1497
1497
1498 a) null if -U or the source repository has no changesets
1498 a) null if -U or the source repository has no changesets
1499 b) if -u . and the source repository is local, the first parent of
1499 b) if -u . and the source repository is local, the first parent of
1500 the source repository's working directory
1500 the source repository's working directory
1501 c) the changeset specified with -u (if a branch name, this means the
1501 c) the changeset specified with -u (if a branch name, this means the
1502 latest head of that branch)
1502 latest head of that branch)
1503 d) the changeset specified with -r
1503 d) the changeset specified with -r
1504 e) the tipmost head specified with -b
1504 e) the tipmost head specified with -b
1505 f) the tipmost head specified with the url#branch source syntax
1505 f) the tipmost head specified with the url#branch source syntax
1506 g) the revision marked with the '@' bookmark, if present
1506 g) the revision marked with the '@' bookmark, if present
1507 h) the tipmost head of the default branch
1507 h) the tipmost head of the default branch
1508 i) tip
1508 i) tip
1509
1509
1510 When cloning from servers that support it, Mercurial may fetch
1510 When cloning from servers that support it, Mercurial may fetch
1511 pre-generated data from a server-advertised URL. When this is done,
1511 pre-generated data from a server-advertised URL. When this is done,
1512 hooks operating on incoming changesets and changegroups may fire twice,
1512 hooks operating on incoming changesets and changegroups may fire twice,
1513 once for the bundle fetched from the URL and another for any additional
1513 once for the bundle fetched from the URL and another for any additional
1514 data not fetched from this URL. In addition, if an error occurs, the
1514 data not fetched from this URL. In addition, if an error occurs, the
1515 repository may be rolled back to a partial clone. This behavior may
1515 repository may be rolled back to a partial clone. This behavior may
1516 change in future releases. See :hg:`help -e clonebundles` for more.
1516 change in future releases. See :hg:`help -e clonebundles` for more.
1517
1517
1518 Examples:
1518 Examples:
1519
1519
1520 - clone a remote repository to a new directory named hg/::
1520 - clone a remote repository to a new directory named hg/::
1521
1521
1522 hg clone https://www.mercurial-scm.org/repo/hg/
1522 hg clone https://www.mercurial-scm.org/repo/hg/
1523
1523
1524 - create a lightweight local clone::
1524 - create a lightweight local clone::
1525
1525
1526 hg clone project/ project-feature/
1526 hg clone project/ project-feature/
1527
1527
1528 - clone from an absolute path on an ssh server (note double-slash)::
1528 - clone from an absolute path on an ssh server (note double-slash)::
1529
1529
1530 hg clone ssh://user@server//home/projects/alpha/
1530 hg clone ssh://user@server//home/projects/alpha/
1531
1531
1532 - do a high-speed clone over a LAN while checking out a
1532 - do a high-speed clone over a LAN while checking out a
1533 specified version::
1533 specified version::
1534
1534
1535 hg clone --uncompressed http://server/repo -u 1.5
1535 hg clone --uncompressed http://server/repo -u 1.5
1536
1536
1537 - create a repository without changesets after a particular revision::
1537 - create a repository without changesets after a particular revision::
1538
1538
1539 hg clone -r 04e544 experimental/ good/
1539 hg clone -r 04e544 experimental/ good/
1540
1540
1541 - clone (and track) a particular named branch::
1541 - clone (and track) a particular named branch::
1542
1542
1543 hg clone https://www.mercurial-scm.org/repo/hg/#stable
1543 hg clone https://www.mercurial-scm.org/repo/hg/#stable
1544
1544
1545 See :hg:`help urls` for details on specifying URLs.
1545 See :hg:`help urls` for details on specifying URLs.
1546
1546
1547 Returns 0 on success.
1547 Returns 0 on success.
1548 """
1548 """
1549 if opts.get('noupdate') and opts.get('updaterev'):
1549 if opts.get('noupdate') and opts.get('updaterev'):
1550 raise error.Abort(_("cannot specify both --noupdate and --updaterev"))
1550 raise error.Abort(_("cannot specify both --noupdate and --updaterev"))
1551
1551
1552 r = hg.clone(ui, opts, source, dest,
1552 r = hg.clone(ui, opts, source, dest,
1553 pull=opts.get('pull'),
1553 pull=opts.get('pull'),
1554 stream=opts.get('uncompressed'),
1554 stream=opts.get('uncompressed'),
1555 rev=opts.get('rev'),
1555 rev=opts.get('rev'),
1556 update=opts.get('updaterev') or not opts.get('noupdate'),
1556 update=opts.get('updaterev') or not opts.get('noupdate'),
1557 branch=opts.get('branch'),
1557 branch=opts.get('branch'),
1558 shareopts=opts.get('shareopts'))
1558 shareopts=opts.get('shareopts'))
1559
1559
1560 return r is None
1560 return r is None
1561
1561
1562 @command('^commit|ci',
1562 @command('^commit|ci',
1563 [('A', 'addremove', None,
1563 [('A', 'addremove', None,
1564 _('mark new/missing files as added/removed before committing')),
1564 _('mark new/missing files as added/removed before committing')),
1565 ('', 'close-branch', None,
1565 ('', 'close-branch', None,
1566 _('mark a branch head as closed')),
1566 _('mark a branch head as closed')),
1567 ('', 'amend', None, _('amend the parent of the working directory')),
1567 ('', 'amend', None, _('amend the parent of the working directory')),
1568 ('s', 'secret', None, _('use the secret phase for committing')),
1568 ('s', 'secret', None, _('use the secret phase for committing')),
1569 ('e', 'edit', None, _('invoke editor on commit messages')),
1569 ('e', 'edit', None, _('invoke editor on commit messages')),
1570 ('i', 'interactive', None, _('use interactive mode')),
1570 ('i', 'interactive', None, _('use interactive mode')),
1571 ] + walkopts + commitopts + commitopts2 + subrepoopts,
1571 ] + walkopts + commitopts + commitopts2 + subrepoopts,
1572 _('[OPTION]... [FILE]...'),
1572 _('[OPTION]... [FILE]...'),
1573 inferrepo=True)
1573 inferrepo=True)
1574 def commit(ui, repo, *pats, **opts):
1574 def commit(ui, repo, *pats, **opts):
1575 """commit the specified files or all outstanding changes
1575 """commit the specified files or all outstanding changes
1576
1576
1577 Commit changes to the given files into the repository. Unlike a
1577 Commit changes to the given files into the repository. Unlike a
1578 centralized SCM, this operation is a local operation. See
1578 centralized SCM, this operation is a local operation. See
1579 :hg:`push` for a way to actively distribute your changes.
1579 :hg:`push` for a way to actively distribute your changes.
1580
1580
1581 If a list of files is omitted, all changes reported by :hg:`status`
1581 If a list of files is omitted, all changes reported by :hg:`status`
1582 will be committed.
1582 will be committed.
1583
1583
1584 If you are committing the result of a merge, do not provide any
1584 If you are committing the result of a merge, do not provide any
1585 filenames or -I/-X filters.
1585 filenames or -I/-X filters.
1586
1586
1587 If no commit message is specified, Mercurial starts your
1587 If no commit message is specified, Mercurial starts your
1588 configured editor where you can enter a message. In case your
1588 configured editor where you can enter a message. In case your
1589 commit fails, you will find a backup of your message in
1589 commit fails, you will find a backup of your message in
1590 ``.hg/last-message.txt``.
1590 ``.hg/last-message.txt``.
1591
1591
1592 The --close-branch flag can be used to mark the current branch
1592 The --close-branch flag can be used to mark the current branch
1593 head closed. When all heads of a branch are closed, the branch
1593 head closed. When all heads of a branch are closed, the branch
1594 will be considered closed and no longer listed.
1594 will be considered closed and no longer listed.
1595
1595
1596 The --amend flag can be used to amend the parent of the
1596 The --amend flag can be used to amend the parent of the
1597 working directory with a new commit that contains the changes
1597 working directory with a new commit that contains the changes
1598 in the parent in addition to those currently reported by :hg:`status`,
1598 in the parent in addition to those currently reported by :hg:`status`,
1599 if there are any. The old commit is stored in a backup bundle in
1599 if there are any. The old commit is stored in a backup bundle in
1600 ``.hg/strip-backup`` (see :hg:`help bundle` and :hg:`help unbundle`
1600 ``.hg/strip-backup`` (see :hg:`help bundle` and :hg:`help unbundle`
1601 on how to restore it).
1601 on how to restore it).
1602
1602
1603 Message, user and date are taken from the amended commit unless
1603 Message, user and date are taken from the amended commit unless
1604 specified. When a message isn't specified on the command line,
1604 specified. When a message isn't specified on the command line,
1605 the editor will open with the message of the amended commit.
1605 the editor will open with the message of the amended commit.
1606
1606
1607 It is not possible to amend public changesets (see :hg:`help phases`)
1607 It is not possible to amend public changesets (see :hg:`help phases`)
1608 or changesets that have children.
1608 or changesets that have children.
1609
1609
1610 See :hg:`help dates` for a list of formats valid for -d/--date.
1610 See :hg:`help dates` for a list of formats valid for -d/--date.
1611
1611
1612 Returns 0 on success, 1 if nothing changed.
1612 Returns 0 on success, 1 if nothing changed.
1613
1613
1614 .. container:: verbose
1614 .. container:: verbose
1615
1615
1616 Examples:
1616 Examples:
1617
1617
1618 - commit all files ending in .py::
1618 - commit all files ending in .py::
1619
1619
1620 hg commit --include "set:**.py"
1620 hg commit --include "set:**.py"
1621
1621
1622 - commit all non-binary files::
1622 - commit all non-binary files::
1623
1623
1624 hg commit --exclude "set:binary()"
1624 hg commit --exclude "set:binary()"
1625
1625
1626 - amend the current commit and set the date to now::
1626 - amend the current commit and set the date to now::
1627
1627
1628 hg commit --amend --date now
1628 hg commit --amend --date now
1629 """
1629 """
1630 wlock = lock = None
1630 wlock = lock = None
1631 try:
1631 try:
1632 wlock = repo.wlock()
1632 wlock = repo.wlock()
1633 lock = repo.lock()
1633 lock = repo.lock()
1634 return _docommit(ui, repo, *pats, **opts)
1634 return _docommit(ui, repo, *pats, **opts)
1635 finally:
1635 finally:
1636 release(lock, wlock)
1636 release(lock, wlock)
1637
1637
1638 def _docommit(ui, repo, *pats, **opts):
1638 def _docommit(ui, repo, *pats, **opts):
1639 opts = pycompat.byteskwargs(opts)
1639 opts = pycompat.byteskwargs(opts)
1640 if opts.get('interactive'):
1640 if opts.get('interactive'):
1641 opts.pop('interactive')
1641 opts.pop('interactive')
1642 ret = cmdutil.dorecord(ui, repo, commit, None, False,
1642 ret = cmdutil.dorecord(ui, repo, commit, None, False,
1643 cmdutil.recordfilter, *pats,
1643 cmdutil.recordfilter, *pats,
1644 **pycompat.strkwargs(opts))
1644 **pycompat.strkwargs(opts))
1645 # ret can be 0 (no changes to record) or the value returned by
1645 # ret can be 0 (no changes to record) or the value returned by
1646 # commit(), 1 if nothing changed or None on success.
1646 # commit(), 1 if nothing changed or None on success.
1647 return 1 if ret == 0 else ret
1647 return 1 if ret == 0 else ret
1648
1648
1649 if opts.get('subrepos'):
1649 if opts.get('subrepos'):
1650 if opts.get('amend'):
1650 if opts.get('amend'):
1651 raise error.Abort(_('cannot amend with --subrepos'))
1651 raise error.Abort(_('cannot amend with --subrepos'))
1652 # Let --subrepos on the command line override config setting.
1652 # Let --subrepos on the command line override config setting.
1653 ui.setconfig('ui', 'commitsubrepos', True, 'commit')
1653 ui.setconfig('ui', 'commitsubrepos', True, 'commit')
1654
1654
1655 cmdutil.checkunfinished(repo, commit=True)
1655 cmdutil.checkunfinished(repo, commit=True)
1656
1656
1657 branch = repo[None].branch()
1657 branch = repo[None].branch()
1658 bheads = repo.branchheads(branch)
1658 bheads = repo.branchheads(branch)
1659
1659
1660 extra = {}
1660 extra = {}
1661 if opts.get('close_branch'):
1661 if opts.get('close_branch'):
1662 extra['close'] = 1
1662 extra['close'] = 1
1663
1663
1664 if not bheads:
1664 if not bheads:
1665 raise error.Abort(_('can only close branch heads'))
1665 raise error.Abort(_('can only close branch heads'))
1666 elif opts.get('amend'):
1666 elif opts.get('amend'):
1667 if repo[None].parents()[0].p1().branch() != branch and \
1667 if repo[None].parents()[0].p1().branch() != branch and \
1668 repo[None].parents()[0].p2().branch() != branch:
1668 repo[None].parents()[0].p2().branch() != branch:
1669 raise error.Abort(_('can only close branch heads'))
1669 raise error.Abort(_('can only close branch heads'))
1670
1670
1671 if opts.get('amend'):
1671 if opts.get('amend'):
1672 if ui.configbool('ui', 'commitsubrepos'):
1672 if ui.configbool('ui', 'commitsubrepos'):
1673 raise error.Abort(_('cannot amend with ui.commitsubrepos enabled'))
1673 raise error.Abort(_('cannot amend with ui.commitsubrepos enabled'))
1674
1674
1675 old = repo['.']
1675 old = repo['.']
1676 if not old.mutable():
1676 if not old.mutable():
1677 raise error.Abort(_('cannot amend public changesets'))
1677 raise error.Abort(_('cannot amend public changesets'))
1678 if len(repo[None].parents()) > 1:
1678 if len(repo[None].parents()) > 1:
1679 raise error.Abort(_('cannot amend while merging'))
1679 raise error.Abort(_('cannot amend while merging'))
1680 allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt)
1680 allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt)
1681 if not allowunstable and old.children():
1681 if not allowunstable and old.children():
1682 raise error.Abort(_('cannot amend changeset with children'))
1682 raise error.Abort(_('cannot amend changeset with children'))
1683
1683
1684 # Currently histedit gets confused if an amend happens while histedit
1684 # Currently histedit gets confused if an amend happens while histedit
1685 # is in progress. Since we have a checkunfinished command, we are
1685 # is in progress. Since we have a checkunfinished command, we are
1686 # temporarily honoring it.
1686 # temporarily honoring it.
1687 #
1687 #
1688 # Note: eventually this guard will be removed. Please do not expect
1688 # Note: eventually this guard will be removed. Please do not expect
1689 # this behavior to remain.
1689 # this behavior to remain.
1690 if not obsolete.isenabled(repo, obsolete.createmarkersopt):
1690 if not obsolete.isenabled(repo, obsolete.createmarkersopt):
1691 cmdutil.checkunfinished(repo)
1691 cmdutil.checkunfinished(repo)
1692
1692
1693 # commitfunc is used only for temporary amend commit by cmdutil.amend
1693 # commitfunc is used only for temporary amend commit by cmdutil.amend
1694 def commitfunc(ui, repo, message, match, opts):
1694 def commitfunc(ui, repo, message, match, opts):
1695 return repo.commit(message,
1695 return repo.commit(message,
1696 opts.get('user') or old.user(),
1696 opts.get('user') or old.user(),
1697 opts.get('date') or old.date(),
1697 opts.get('date') or old.date(),
1698 match,
1698 match,
1699 extra=extra)
1699 extra=extra)
1700
1700
1701 node = cmdutil.amend(ui, repo, commitfunc, old, extra, pats, opts)
1701 node = cmdutil.amend(ui, repo, commitfunc, old, extra, pats, opts)
1702 if node == old.node():
1702 if node == old.node():
1703 ui.status(_("nothing changed\n"))
1703 ui.status(_("nothing changed\n"))
1704 return 1
1704 return 1
1705 else:
1705 else:
1706 def commitfunc(ui, repo, message, match, opts):
1706 def commitfunc(ui, repo, message, match, opts):
1707 overrides = {}
1707 overrides = {}
1708 if opts.get('secret'):
1708 if opts.get('secret'):
1709 overrides[('phases', 'new-commit')] = 'secret'
1709 overrides[('phases', 'new-commit')] = 'secret'
1710
1710
1711 baseui = repo.baseui
1711 baseui = repo.baseui
1712 with baseui.configoverride(overrides, 'commit'):
1712 with baseui.configoverride(overrides, 'commit'):
1713 with ui.configoverride(overrides, 'commit'):
1713 with ui.configoverride(overrides, 'commit'):
1714 editform = cmdutil.mergeeditform(repo[None],
1714 editform = cmdutil.mergeeditform(repo[None],
1715 'commit.normal')
1715 'commit.normal')
1716 editor = cmdutil.getcommiteditor(
1716 editor = cmdutil.getcommiteditor(
1717 editform=editform, **pycompat.strkwargs(opts))
1717 editform=editform, **pycompat.strkwargs(opts))
1718 return repo.commit(message,
1718 return repo.commit(message,
1719 opts.get('user'),
1719 opts.get('user'),
1720 opts.get('date'),
1720 opts.get('date'),
1721 match,
1721 match,
1722 editor=editor,
1722 editor=editor,
1723 extra=extra)
1723 extra=extra)
1724
1724
1725 node = cmdutil.commit(ui, repo, commitfunc, pats, opts)
1725 node = cmdutil.commit(ui, repo, commitfunc, pats, opts)
1726
1726
1727 if not node:
1727 if not node:
1728 stat = cmdutil.postcommitstatus(repo, pats, opts)
1728 stat = cmdutil.postcommitstatus(repo, pats, opts)
1729 if stat[3]:
1729 if stat[3]:
1730 ui.status(_("nothing changed (%d missing files, see "
1730 ui.status(_("nothing changed (%d missing files, see "
1731 "'hg status')\n") % len(stat[3]))
1731 "'hg status')\n") % len(stat[3]))
1732 else:
1732 else:
1733 ui.status(_("nothing changed\n"))
1733 ui.status(_("nothing changed\n"))
1734 return 1
1734 return 1
1735
1735
1736 cmdutil.commitstatus(repo, node, branch, bheads, opts)
1736 cmdutil.commitstatus(repo, node, branch, bheads, opts)
1737
1737
1738 @command('config|showconfig|debugconfig',
1738 @command('config|showconfig|debugconfig',
1739 [('u', 'untrusted', None, _('show untrusted configuration options')),
1739 [('u', 'untrusted', None, _('show untrusted configuration options')),
1740 ('e', 'edit', None, _('edit user config')),
1740 ('e', 'edit', None, _('edit user config')),
1741 ('l', 'local', None, _('edit repository config')),
1741 ('l', 'local', None, _('edit repository config')),
1742 ('g', 'global', None, _('edit global config'))] + formatteropts,
1742 ('g', 'global', None, _('edit global config'))] + formatteropts,
1743 _('[-u] [NAME]...'),
1743 _('[-u] [NAME]...'),
1744 optionalrepo=True)
1744 optionalrepo=True)
1745 def config(ui, repo, *values, **opts):
1745 def config(ui, repo, *values, **opts):
1746 """show combined config settings from all hgrc files
1746 """show combined config settings from all hgrc files
1747
1747
1748 With no arguments, print names and values of all config items.
1748 With no arguments, print names and values of all config items.
1749
1749
1750 With one argument of the form section.name, print just the value
1750 With one argument of the form section.name, print just the value
1751 of that config item.
1751 of that config item.
1752
1752
1753 With multiple arguments, print names and values of all config
1753 With multiple arguments, print names and values of all config
1754 items with matching section names.
1754 items with matching section names.
1755
1755
1756 With --edit, start an editor on the user-level config file. With
1756 With --edit, start an editor on the user-level config file. With
1757 --global, edit the system-wide config file. With --local, edit the
1757 --global, edit the system-wide config file. With --local, edit the
1758 repository-level config file.
1758 repository-level config file.
1759
1759
1760 With --debug, the source (filename and line number) is printed
1760 With --debug, the source (filename and line number) is printed
1761 for each config item.
1761 for each config item.
1762
1762
1763 See :hg:`help config` for more information about config files.
1763 See :hg:`help config` for more information about config files.
1764
1764
1765 Returns 0 on success, 1 if NAME does not exist.
1765 Returns 0 on success, 1 if NAME does not exist.
1766
1766
1767 """
1767 """
1768
1768
1769 if opts.get('edit') or opts.get('local') or opts.get('global'):
1769 if opts.get('edit') or opts.get('local') or opts.get('global'):
1770 if opts.get('local') and opts.get('global'):
1770 if opts.get('local') and opts.get('global'):
1771 raise error.Abort(_("can't use --local and --global together"))
1771 raise error.Abort(_("can't use --local and --global together"))
1772
1772
1773 if opts.get('local'):
1773 if opts.get('local'):
1774 if not repo:
1774 if not repo:
1775 raise error.Abort(_("can't use --local outside a repository"))
1775 raise error.Abort(_("can't use --local outside a repository"))
1776 paths = [repo.vfs.join('hgrc')]
1776 paths = [repo.vfs.join('hgrc')]
1777 elif opts.get('global'):
1777 elif opts.get('global'):
1778 paths = rcutil.systemrcpath()
1778 paths = rcutil.systemrcpath()
1779 else:
1779 else:
1780 paths = rcutil.userrcpath()
1780 paths = rcutil.userrcpath()
1781
1781
1782 for f in paths:
1782 for f in paths:
1783 if os.path.exists(f):
1783 if os.path.exists(f):
1784 break
1784 break
1785 else:
1785 else:
1786 if opts.get('global'):
1786 if opts.get('global'):
1787 samplehgrc = uimod.samplehgrcs['global']
1787 samplehgrc = uimod.samplehgrcs['global']
1788 elif opts.get('local'):
1788 elif opts.get('local'):
1789 samplehgrc = uimod.samplehgrcs['local']
1789 samplehgrc = uimod.samplehgrcs['local']
1790 else:
1790 else:
1791 samplehgrc = uimod.samplehgrcs['user']
1791 samplehgrc = uimod.samplehgrcs['user']
1792
1792
1793 f = paths[0]
1793 f = paths[0]
1794 fp = open(f, "w")
1794 fp = open(f, "w")
1795 fp.write(samplehgrc)
1795 fp.write(samplehgrc)
1796 fp.close()
1796 fp.close()
1797
1797
1798 editor = ui.geteditor()
1798 editor = ui.geteditor()
1799 ui.system("%s \"%s\"" % (editor, f),
1799 ui.system("%s \"%s\"" % (editor, f),
1800 onerr=error.Abort, errprefix=_("edit failed"),
1800 onerr=error.Abort, errprefix=_("edit failed"),
1801 blockedtag='config_edit')
1801 blockedtag='config_edit')
1802 return
1802 return
1803 ui.pager('config')
1803 ui.pager('config')
1804 fm = ui.formatter('config', opts)
1804 fm = ui.formatter('config', opts)
1805 for t, f in rcutil.rccomponents():
1805 for t, f in rcutil.rccomponents():
1806 if t == 'path':
1806 if t == 'path':
1807 ui.debug('read config from: %s\n' % f)
1807 ui.debug('read config from: %s\n' % f)
1808 elif t == 'items':
1808 elif t == 'items':
1809 for section, name, value, source in f:
1809 for section, name, value, source in f:
1810 ui.debug('set config by: %s\n' % source)
1810 ui.debug('set config by: %s\n' % source)
1811 else:
1811 else:
1812 raise error.ProgrammingError('unknown rctype: %s' % t)
1812 raise error.ProgrammingError('unknown rctype: %s' % t)
1813 untrusted = bool(opts.get('untrusted'))
1813 untrusted = bool(opts.get('untrusted'))
1814 if values:
1814 if values:
1815 sections = [v for v in values if '.' not in v]
1815 sections = [v for v in values if '.' not in v]
1816 items = [v for v in values if '.' in v]
1816 items = [v for v in values if '.' in v]
1817 if len(items) > 1 or items and sections:
1817 if len(items) > 1 or items and sections:
1818 raise error.Abort(_('only one config item permitted'))
1818 raise error.Abort(_('only one config item permitted'))
1819 matched = False
1819 matched = False
1820 for section, name, value in ui.walkconfig(untrusted=untrusted):
1820 for section, name, value in ui.walkconfig(untrusted=untrusted):
1821 source = ui.configsource(section, name, untrusted)
1821 source = ui.configsource(section, name, untrusted)
1822 value = pycompat.bytestr(value)
1822 value = pycompat.bytestr(value)
1823 if fm.isplain():
1823 if fm.isplain():
1824 source = source or 'none'
1824 source = source or 'none'
1825 value = value.replace('\n', '\\n')
1825 value = value.replace('\n', '\\n')
1826 entryname = section + '.' + name
1826 entryname = section + '.' + name
1827 if values:
1827 if values:
1828 for v in values:
1828 for v in values:
1829 if v == section:
1829 if v == section:
1830 fm.startitem()
1830 fm.startitem()
1831 fm.condwrite(ui.debugflag, 'source', '%s: ', source)
1831 fm.condwrite(ui.debugflag, 'source', '%s: ', source)
1832 fm.write('name value', '%s=%s\n', entryname, value)
1832 fm.write('name value', '%s=%s\n', entryname, value)
1833 matched = True
1833 matched = True
1834 elif v == entryname:
1834 elif v == entryname:
1835 fm.startitem()
1835 fm.startitem()
1836 fm.condwrite(ui.debugflag, 'source', '%s: ', source)
1836 fm.condwrite(ui.debugflag, 'source', '%s: ', source)
1837 fm.write('value', '%s\n', value)
1837 fm.write('value', '%s\n', value)
1838 fm.data(name=entryname)
1838 fm.data(name=entryname)
1839 matched = True
1839 matched = True
1840 else:
1840 else:
1841 fm.startitem()
1841 fm.startitem()
1842 fm.condwrite(ui.debugflag, 'source', '%s: ', source)
1842 fm.condwrite(ui.debugflag, 'source', '%s: ', source)
1843 fm.write('name value', '%s=%s\n', entryname, value)
1843 fm.write('name value', '%s=%s\n', entryname, value)
1844 matched = True
1844 matched = True
1845 fm.end()
1845 fm.end()
1846 if matched:
1846 if matched:
1847 return 0
1847 return 0
1848 return 1
1848 return 1
1849
1849
1850 @command('copy|cp',
1850 @command('copy|cp',
1851 [('A', 'after', None, _('record a copy that has already occurred')),
1851 [('A', 'after', None, _('record a copy that has already occurred')),
1852 ('f', 'force', None, _('forcibly copy over an existing managed file')),
1852 ('f', 'force', None, _('forcibly copy over an existing managed file')),
1853 ] + walkopts + dryrunopts,
1853 ] + walkopts + dryrunopts,
1854 _('[OPTION]... [SOURCE]... DEST'))
1854 _('[OPTION]... [SOURCE]... DEST'))
1855 def copy(ui, repo, *pats, **opts):
1855 def copy(ui, repo, *pats, **opts):
1856 """mark files as copied for the next commit
1856 """mark files as copied for the next commit
1857
1857
1858 Mark dest as having copies of source files. If dest is a
1858 Mark dest as having copies of source files. If dest is a
1859 directory, copies are put in that directory. If dest is a file,
1859 directory, copies are put in that directory. If dest is a file,
1860 the source must be a single file.
1860 the source must be a single file.
1861
1861
1862 By default, this command copies the contents of files as they
1862 By default, this command copies the contents of files as they
1863 exist in the working directory. If invoked with -A/--after, the
1863 exist in the working directory. If invoked with -A/--after, the
1864 operation is recorded, but no copying is performed.
1864 operation is recorded, but no copying is performed.
1865
1865
1866 This command takes effect with the next commit. To undo a copy
1866 This command takes effect with the next commit. To undo a copy
1867 before that, see :hg:`revert`.
1867 before that, see :hg:`revert`.
1868
1868
1869 Returns 0 on success, 1 if errors are encountered.
1869 Returns 0 on success, 1 if errors are encountered.
1870 """
1870 """
1871 with repo.wlock(False):
1871 with repo.wlock(False):
1872 return cmdutil.copy(ui, repo, pats, opts)
1872 return cmdutil.copy(ui, repo, pats, opts)
1873
1873
1874 @command('^diff',
1874 @command('^diff',
1875 [('r', 'rev', [], _('revision'), _('REV')),
1875 [('r', 'rev', [], _('revision'), _('REV')),
1876 ('c', 'change', '', _('change made by revision'), _('REV'))
1876 ('c', 'change', '', _('change made by revision'), _('REV'))
1877 ] + diffopts + diffopts2 + walkopts + subrepoopts,
1877 ] + diffopts + diffopts2 + walkopts + subrepoopts,
1878 _('[OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...'),
1878 _('[OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...'),
1879 inferrepo=True)
1879 inferrepo=True)
1880 def diff(ui, repo, *pats, **opts):
1880 def diff(ui, repo, *pats, **opts):
1881 """diff repository (or selected files)
1881 """diff repository (or selected files)
1882
1882
1883 Show differences between revisions for the specified files.
1883 Show differences between revisions for the specified files.
1884
1884
1885 Differences between files are shown using the unified diff format.
1885 Differences between files are shown using the unified diff format.
1886
1886
1887 .. note::
1887 .. note::
1888
1888
1889 :hg:`diff` may generate unexpected results for merges, as it will
1889 :hg:`diff` may generate unexpected results for merges, as it will
1890 default to comparing against the working directory's first
1890 default to comparing against the working directory's first
1891 parent changeset if no revisions are specified.
1891 parent changeset if no revisions are specified.
1892
1892
1893 When two revision arguments are given, then changes are shown
1893 When two revision arguments are given, then changes are shown
1894 between those revisions. If only one revision is specified then
1894 between those revisions. If only one revision is specified then
1895 that revision is compared to the working directory, and, when no
1895 that revision is compared to the working directory, and, when no
1896 revisions are specified, the working directory files are compared
1896 revisions are specified, the working directory files are compared
1897 to its first parent.
1897 to its first parent.
1898
1898
1899 Alternatively you can specify -c/--change with a revision to see
1899 Alternatively you can specify -c/--change with a revision to see
1900 the changes in that changeset relative to its first parent.
1900 the changes in that changeset relative to its first parent.
1901
1901
1902 Without the -a/--text option, diff will avoid generating diffs of
1902 Without the -a/--text option, diff will avoid generating diffs of
1903 files it detects as binary. With -a, diff will generate a diff
1903 files it detects as binary. With -a, diff will generate a diff
1904 anyway, probably with undesirable results.
1904 anyway, probably with undesirable results.
1905
1905
1906 Use the -g/--git option to generate diffs in the git extended diff
1906 Use the -g/--git option to generate diffs in the git extended diff
1907 format. For more information, read :hg:`help diffs`.
1907 format. For more information, read :hg:`help diffs`.
1908
1908
1909 .. container:: verbose
1909 .. container:: verbose
1910
1910
1911 Examples:
1911 Examples:
1912
1912
1913 - compare a file in the current working directory to its parent::
1913 - compare a file in the current working directory to its parent::
1914
1914
1915 hg diff foo.c
1915 hg diff foo.c
1916
1916
1917 - compare two historical versions of a directory, with rename info::
1917 - compare two historical versions of a directory, with rename info::
1918
1918
1919 hg diff --git -r 1.0:1.2 lib/
1919 hg diff --git -r 1.0:1.2 lib/
1920
1920
1921 - get change stats relative to the last change on some date::
1921 - get change stats relative to the last change on some date::
1922
1922
1923 hg diff --stat -r "date('may 2')"
1923 hg diff --stat -r "date('may 2')"
1924
1924
1925 - diff all newly-added files that contain a keyword::
1925 - diff all newly-added files that contain a keyword::
1926
1926
1927 hg diff "set:added() and grep(GNU)"
1927 hg diff "set:added() and grep(GNU)"
1928
1928
1929 - compare a revision and its parents::
1929 - compare a revision and its parents::
1930
1930
1931 hg diff -c 9353 # compare against first parent
1931 hg diff -c 9353 # compare against first parent
1932 hg diff -r 9353^:9353 # same using revset syntax
1932 hg diff -r 9353^:9353 # same using revset syntax
1933 hg diff -r 9353^2:9353 # compare against the second parent
1933 hg diff -r 9353^2:9353 # compare against the second parent
1934
1934
1935 Returns 0 on success.
1935 Returns 0 on success.
1936 """
1936 """
1937
1937
1938 revs = opts.get('rev')
1938 revs = opts.get('rev')
1939 change = opts.get('change')
1939 change = opts.get('change')
1940 stat = opts.get('stat')
1940 stat = opts.get('stat')
1941 reverse = opts.get('reverse')
1941 reverse = opts.get('reverse')
1942
1942
1943 if revs and change:
1943 if revs and change:
1944 msg = _('cannot specify --rev and --change at the same time')
1944 msg = _('cannot specify --rev and --change at the same time')
1945 raise error.Abort(msg)
1945 raise error.Abort(msg)
1946 elif change:
1946 elif change:
1947 node2 = scmutil.revsingle(repo, change, None).node()
1947 node2 = scmutil.revsingle(repo, change, None).node()
1948 node1 = repo[node2].p1().node()
1948 node1 = repo[node2].p1().node()
1949 else:
1949 else:
1950 node1, node2 = scmutil.revpair(repo, revs)
1950 node1, node2 = scmutil.revpair(repo, revs)
1951
1951
1952 if reverse:
1952 if reverse:
1953 node1, node2 = node2, node1
1953 node1, node2 = node2, node1
1954
1954
1955 diffopts = patch.diffallopts(ui, opts)
1955 diffopts = patch.diffallopts(ui, opts)
1956 m = scmutil.match(repo[node2], pats, opts)
1956 m = scmutil.match(repo[node2], pats, opts)
1957 ui.pager('diff')
1957 ui.pager('diff')
1958 cmdutil.diffordiffstat(ui, repo, diffopts, node1, node2, m, stat=stat,
1958 cmdutil.diffordiffstat(ui, repo, diffopts, node1, node2, m, stat=stat,
1959 listsubrepos=opts.get('subrepos'),
1959 listsubrepos=opts.get('subrepos'),
1960 root=opts.get('root'))
1960 root=opts.get('root'))
1961
1961
1962 @command('^export',
1962 @command('^export',
1963 [('o', 'output', '',
1963 [('o', 'output', '',
1964 _('print output to file with formatted name'), _('FORMAT')),
1964 _('print output to file with formatted name'), _('FORMAT')),
1965 ('', 'switch-parent', None, _('diff against the second parent')),
1965 ('', 'switch-parent', None, _('diff against the second parent')),
1966 ('r', 'rev', [], _('revisions to export'), _('REV')),
1966 ('r', 'rev', [], _('revisions to export'), _('REV')),
1967 ] + diffopts,
1967 ] + diffopts,
1968 _('[OPTION]... [-o OUTFILESPEC] [-r] [REV]...'))
1968 _('[OPTION]... [-o OUTFILESPEC] [-r] [REV]...'))
1969 def export(ui, repo, *changesets, **opts):
1969 def export(ui, repo, *changesets, **opts):
1970 """dump the header and diffs for one or more changesets
1970 """dump the header and diffs for one or more changesets
1971
1971
1972 Print the changeset header and diffs for one or more revisions.
1972 Print the changeset header and diffs for one or more revisions.
1973 If no revision is given, the parent of the working directory is used.
1973 If no revision is given, the parent of the working directory is used.
1974
1974
1975 The information shown in the changeset header is: author, date,
1975 The information shown in the changeset header is: author, date,
1976 branch name (if non-default), changeset hash, parent(s) and commit
1976 branch name (if non-default), changeset hash, parent(s) and commit
1977 comment.
1977 comment.
1978
1978
1979 .. note::
1979 .. note::
1980
1980
1981 :hg:`export` may generate unexpected diff output for merge
1981 :hg:`export` may generate unexpected diff output for merge
1982 changesets, as it will compare the merge changeset against its
1982 changesets, as it will compare the merge changeset against its
1983 first parent only.
1983 first parent only.
1984
1984
1985 Output may be to a file, in which case the name of the file is
1985 Output may be to a file, in which case the name of the file is
1986 given using a format string. The formatting rules are as follows:
1986 given using a format string. The formatting rules are as follows:
1987
1987
1988 :``%%``: literal "%" character
1988 :``%%``: literal "%" character
1989 :``%H``: changeset hash (40 hexadecimal digits)
1989 :``%H``: changeset hash (40 hexadecimal digits)
1990 :``%N``: number of patches being generated
1990 :``%N``: number of patches being generated
1991 :``%R``: changeset revision number
1991 :``%R``: changeset revision number
1992 :``%b``: basename of the exporting repository
1992 :``%b``: basename of the exporting repository
1993 :``%h``: short-form changeset hash (12 hexadecimal digits)
1993 :``%h``: short-form changeset hash (12 hexadecimal digits)
1994 :``%m``: first line of the commit message (only alphanumeric characters)
1994 :``%m``: first line of the commit message (only alphanumeric characters)
1995 :``%n``: zero-padded sequence number, starting at 1
1995 :``%n``: zero-padded sequence number, starting at 1
1996 :``%r``: zero-padded changeset revision number
1996 :``%r``: zero-padded changeset revision number
1997
1997
1998 Without the -a/--text option, export will avoid generating diffs
1998 Without the -a/--text option, export will avoid generating diffs
1999 of files it detects as binary. With -a, export will generate a
1999 of files it detects as binary. With -a, export will generate a
2000 diff anyway, probably with undesirable results.
2000 diff anyway, probably with undesirable results.
2001
2001
2002 Use the -g/--git option to generate diffs in the git extended diff
2002 Use the -g/--git option to generate diffs in the git extended diff
2003 format. See :hg:`help diffs` for more information.
2003 format. See :hg:`help diffs` for more information.
2004
2004
2005 With the --switch-parent option, the diff will be against the
2005 With the --switch-parent option, the diff will be against the
2006 second parent. It can be useful to review a merge.
2006 second parent. It can be useful to review a merge.
2007
2007
2008 .. container:: verbose
2008 .. container:: verbose
2009
2009
2010 Examples:
2010 Examples:
2011
2011
2012 - use export and import to transplant a bugfix to the current
2012 - use export and import to transplant a bugfix to the current
2013 branch::
2013 branch::
2014
2014
2015 hg export -r 9353 | hg import -
2015 hg export -r 9353 | hg import -
2016
2016
2017 - export all the changesets between two revisions to a file with
2017 - export all the changesets between two revisions to a file with
2018 rename information::
2018 rename information::
2019
2019
2020 hg export --git -r 123:150 > changes.txt
2020 hg export --git -r 123:150 > changes.txt
2021
2021
2022 - split outgoing changes into a series of patches with
2022 - split outgoing changes into a series of patches with
2023 descriptive names::
2023 descriptive names::
2024
2024
2025 hg export -r "outgoing()" -o "%n-%m.patch"
2025 hg export -r "outgoing()" -o "%n-%m.patch"
2026
2026
2027 Returns 0 on success.
2027 Returns 0 on success.
2028 """
2028 """
2029 changesets += tuple(opts.get('rev', []))
2029 changesets += tuple(opts.get('rev', []))
2030 if not changesets:
2030 if not changesets:
2031 changesets = ['.']
2031 changesets = ['.']
2032 revs = scmutil.revrange(repo, changesets)
2032 revs = scmutil.revrange(repo, changesets)
2033 if not revs:
2033 if not revs:
2034 raise error.Abort(_("export requires at least one changeset"))
2034 raise error.Abort(_("export requires at least one changeset"))
2035 if len(revs) > 1:
2035 if len(revs) > 1:
2036 ui.note(_('exporting patches:\n'))
2036 ui.note(_('exporting patches:\n'))
2037 else:
2037 else:
2038 ui.note(_('exporting patch:\n'))
2038 ui.note(_('exporting patch:\n'))
2039 ui.pager('export')
2039 ui.pager('export')
2040 cmdutil.export(repo, revs, template=opts.get('output'),
2040 cmdutil.export(repo, revs, template=opts.get('output'),
2041 switch_parent=opts.get('switch_parent'),
2041 switch_parent=opts.get('switch_parent'),
2042 opts=patch.diffallopts(ui, opts))
2042 opts=patch.diffallopts(ui, opts))
2043
2043
2044 @command('files',
2044 @command('files',
2045 [('r', 'rev', '', _('search the repository as it is in REV'), _('REV')),
2045 [('r', 'rev', '', _('search the repository as it is in REV'), _('REV')),
2046 ('0', 'print0', None, _('end filenames with NUL, for use with xargs')),
2046 ('0', 'print0', None, _('end filenames with NUL, for use with xargs')),
2047 ] + walkopts + formatteropts + subrepoopts,
2047 ] + walkopts + formatteropts + subrepoopts,
2048 _('[OPTION]... [FILE]...'))
2048 _('[OPTION]... [FILE]...'))
2049 def files(ui, repo, *pats, **opts):
2049 def files(ui, repo, *pats, **opts):
2050 """list tracked files
2050 """list tracked files
2051
2051
2052 Print files under Mercurial control in the working directory or
2052 Print files under Mercurial control in the working directory or
2053 specified revision for given files (excluding removed files).
2053 specified revision for given files (excluding removed files).
2054 Files can be specified as filenames or filesets.
2054 Files can be specified as filenames or filesets.
2055
2055
2056 If no files are given to match, this command prints the names
2056 If no files are given to match, this command prints the names
2057 of all files under Mercurial control.
2057 of all files under Mercurial control.
2058
2058
2059 .. container:: verbose
2059 .. container:: verbose
2060
2060
2061 Examples:
2061 Examples:
2062
2062
2063 - list all files under the current directory::
2063 - list all files under the current directory::
2064
2064
2065 hg files .
2065 hg files .
2066
2066
2067 - shows sizes and flags for current revision::
2067 - shows sizes and flags for current revision::
2068
2068
2069 hg files -vr .
2069 hg files -vr .
2070
2070
2071 - list all files named README::
2071 - list all files named README::
2072
2072
2073 hg files -I "**/README"
2073 hg files -I "**/README"
2074
2074
2075 - list all binary files::
2075 - list all binary files::
2076
2076
2077 hg files "set:binary()"
2077 hg files "set:binary()"
2078
2078
2079 - find files containing a regular expression::
2079 - find files containing a regular expression::
2080
2080
2081 hg files "set:grep('bob')"
2081 hg files "set:grep('bob')"
2082
2082
2083 - search tracked file contents with xargs and grep::
2083 - search tracked file contents with xargs and grep::
2084
2084
2085 hg files -0 | xargs -0 grep foo
2085 hg files -0 | xargs -0 grep foo
2086
2086
2087 See :hg:`help patterns` and :hg:`help filesets` for more information
2087 See :hg:`help patterns` and :hg:`help filesets` for more information
2088 on specifying file patterns.
2088 on specifying file patterns.
2089
2089
2090 Returns 0 if a match is found, 1 otherwise.
2090 Returns 0 if a match is found, 1 otherwise.
2091
2091
2092 """
2092 """
2093 ctx = scmutil.revsingle(repo, opts.get(r'rev'), None)
2093 ctx = scmutil.revsingle(repo, opts.get(r'rev'), None)
2094
2094
2095 end = '\n'
2095 end = '\n'
2096 if opts.get('print0'):
2096 if opts.get('print0'):
2097 end = '\0'
2097 end = '\0'
2098 fmt = '%s' + end
2098 fmt = '%s' + end
2099
2099
2100 m = scmutil.match(ctx, pats, opts)
2100 m = scmutil.match(ctx, pats, opts)
2101 ui.pager('files')
2101 ui.pager('files')
2102 with ui.formatter('files', opts) as fm:
2102 with ui.formatter('files', opts) as fm:
2103 return cmdutil.files(ui, ctx, m, fm, fmt, opts.get('subrepos'))
2103 return cmdutil.files(ui, ctx, m, fm, fmt, opts.get('subrepos'))
2104
2104
2105 @command('^forget', walkopts, _('[OPTION]... FILE...'), inferrepo=True)
2105 @command('^forget', walkopts, _('[OPTION]... FILE...'), inferrepo=True)
2106 def forget(ui, repo, *pats, **opts):
2106 def forget(ui, repo, *pats, **opts):
2107 """forget the specified files on the next commit
2107 """forget the specified files on the next commit
2108
2108
2109 Mark the specified files so they will no longer be tracked
2109 Mark the specified files so they will no longer be tracked
2110 after the next commit.
2110 after the next commit.
2111
2111
2112 This only removes files from the current branch, not from the
2112 This only removes files from the current branch, not from the
2113 entire project history, and it does not delete them from the
2113 entire project history, and it does not delete them from the
2114 working directory.
2114 working directory.
2115
2115
2116 To delete the file from the working directory, see :hg:`remove`.
2116 To delete the file from the working directory, see :hg:`remove`.
2117
2117
2118 To undo a forget before the next commit, see :hg:`add`.
2118 To undo a forget before the next commit, see :hg:`add`.
2119
2119
2120 .. container:: verbose
2120 .. container:: verbose
2121
2121
2122 Examples:
2122 Examples:
2123
2123
2124 - forget newly-added binary files::
2124 - forget newly-added binary files::
2125
2125
2126 hg forget "set:added() and binary()"
2126 hg forget "set:added() and binary()"
2127
2127
2128 - forget files that would be excluded by .hgignore::
2128 - forget files that would be excluded by .hgignore::
2129
2129
2130 hg forget "set:hgignore()"
2130 hg forget "set:hgignore()"
2131
2131
2132 Returns 0 on success.
2132 Returns 0 on success.
2133 """
2133 """
2134
2134
2135 if not pats:
2135 if not pats:
2136 raise error.Abort(_('no files specified'))
2136 raise error.Abort(_('no files specified'))
2137
2137
2138 m = scmutil.match(repo[None], pats, opts)
2138 m = scmutil.match(repo[None], pats, opts)
2139 rejected = cmdutil.forget(ui, repo, m, prefix="", explicitonly=False)[0]
2139 rejected = cmdutil.forget(ui, repo, m, prefix="", explicitonly=False)[0]
2140 return rejected and 1 or 0
2140 return rejected and 1 or 0
2141
2141
2142 @command(
2142 @command(
2143 'graft',
2143 'graft',
2144 [('r', 'rev', [], _('revisions to graft'), _('REV')),
2144 [('r', 'rev', [], _('revisions to graft'), _('REV')),
2145 ('c', 'continue', False, _('resume interrupted graft')),
2145 ('c', 'continue', False, _('resume interrupted graft')),
2146 ('e', 'edit', False, _('invoke editor on commit messages')),
2146 ('e', 'edit', False, _('invoke editor on commit messages')),
2147 ('', 'log', None, _('append graft info to log message')),
2147 ('', 'log', None, _('append graft info to log message')),
2148 ('f', 'force', False, _('force graft')),
2148 ('f', 'force', False, _('force graft')),
2149 ('D', 'currentdate', False,
2149 ('D', 'currentdate', False,
2150 _('record the current date as commit date')),
2150 _('record the current date as commit date')),
2151 ('U', 'currentuser', False,
2151 ('U', 'currentuser', False,
2152 _('record the current user as committer'), _('DATE'))]
2152 _('record the current user as committer'), _('DATE'))]
2153 + commitopts2 + mergetoolopts + dryrunopts,
2153 + commitopts2 + mergetoolopts + dryrunopts,
2154 _('[OPTION]... [-r REV]... REV...'))
2154 _('[OPTION]... [-r REV]... REV...'))
2155 def graft(ui, repo, *revs, **opts):
2155 def graft(ui, repo, *revs, **opts):
2156 '''copy changes from other branches onto the current branch
2156 '''copy changes from other branches onto the current branch
2157
2157
2158 This command uses Mercurial's merge logic to copy individual
2158 This command uses Mercurial's merge logic to copy individual
2159 changes from other branches without merging branches in the
2159 changes from other branches without merging branches in the
2160 history graph. This is sometimes known as 'backporting' or
2160 history graph. This is sometimes known as 'backporting' or
2161 'cherry-picking'. By default, graft will copy user, date, and
2161 'cherry-picking'. By default, graft will copy user, date, and
2162 description from the source changesets.
2162 description from the source changesets.
2163
2163
2164 Changesets that are ancestors of the current revision, that have
2164 Changesets that are ancestors of the current revision, that have
2165 already been grafted, or that are merges will be skipped.
2165 already been grafted, or that are merges will be skipped.
2166
2166
2167 If --log is specified, log messages will have a comment appended
2167 If --log is specified, log messages will have a comment appended
2168 of the form::
2168 of the form::
2169
2169
2170 (grafted from CHANGESETHASH)
2170 (grafted from CHANGESETHASH)
2171
2171
2172 If --force is specified, revisions will be grafted even if they
2172 If --force is specified, revisions will be grafted even if they
2173 are already ancestors of or have been grafted to the destination.
2173 are already ancestors of or have been grafted to the destination.
2174 This is useful when the revisions have since been backed out.
2174 This is useful when the revisions have since been backed out.
2175
2175
2176 If a graft merge results in conflicts, the graft process is
2176 If a graft merge results in conflicts, the graft process is
2177 interrupted so that the current merge can be manually resolved.
2177 interrupted so that the current merge can be manually resolved.
2178 Once all conflicts are addressed, the graft process can be
2178 Once all conflicts are addressed, the graft process can be
2179 continued with the -c/--continue option.
2179 continued with the -c/--continue option.
2180
2180
2181 .. note::
2181 .. note::
2182
2182
2183 The -c/--continue option does not reapply earlier options, except
2183 The -c/--continue option does not reapply earlier options, except
2184 for --force.
2184 for --force.
2185
2185
2186 .. container:: verbose
2186 .. container:: verbose
2187
2187
2188 Examples:
2188 Examples:
2189
2189
2190 - copy a single change to the stable branch and edit its description::
2190 - copy a single change to the stable branch and edit its description::
2191
2191
2192 hg update stable
2192 hg update stable
2193 hg graft --edit 9393
2193 hg graft --edit 9393
2194
2194
2195 - graft a range of changesets with one exception, updating dates::
2195 - graft a range of changesets with one exception, updating dates::
2196
2196
2197 hg graft -D "2085::2093 and not 2091"
2197 hg graft -D "2085::2093 and not 2091"
2198
2198
2199 - continue a graft after resolving conflicts::
2199 - continue a graft after resolving conflicts::
2200
2200
2201 hg graft -c
2201 hg graft -c
2202
2202
2203 - show the source of a grafted changeset::
2203 - show the source of a grafted changeset::
2204
2204
2205 hg log --debug -r .
2205 hg log --debug -r .
2206
2206
2207 - show revisions sorted by date::
2207 - show revisions sorted by date::
2208
2208
2209 hg log -r "sort(all(), date)"
2209 hg log -r "sort(all(), date)"
2210
2210
2211 See :hg:`help revisions` for more about specifying revisions.
2211 See :hg:`help revisions` for more about specifying revisions.
2212
2212
2213 Returns 0 on successful completion.
2213 Returns 0 on successful completion.
2214 '''
2214 '''
2215 with repo.wlock():
2215 with repo.wlock():
2216 return _dograft(ui, repo, *revs, **opts)
2216 return _dograft(ui, repo, *revs, **opts)
2217
2217
2218 def _dograft(ui, repo, *revs, **opts):
2218 def _dograft(ui, repo, *revs, **opts):
2219 if revs and opts.get('rev'):
2219 if revs and opts.get('rev'):
2220 ui.warn(_('warning: inconsistent use of --rev might give unexpected '
2220 ui.warn(_('warning: inconsistent use of --rev might give unexpected '
2221 'revision ordering!\n'))
2221 'revision ordering!\n'))
2222
2222
2223 revs = list(revs)
2223 revs = list(revs)
2224 revs.extend(opts.get('rev'))
2224 revs.extend(opts.get('rev'))
2225
2225
2226 if not opts.get('user') and opts.get('currentuser'):
2226 if not opts.get('user') and opts.get('currentuser'):
2227 opts['user'] = ui.username()
2227 opts['user'] = ui.username()
2228 if not opts.get('date') and opts.get('currentdate'):
2228 if not opts.get('date') and opts.get('currentdate'):
2229 opts['date'] = "%d %d" % util.makedate()
2229 opts['date'] = "%d %d" % util.makedate()
2230
2230
2231 editor = cmdutil.getcommiteditor(editform='graft', **opts)
2231 editor = cmdutil.getcommiteditor(editform='graft', **opts)
2232
2232
2233 cont = False
2233 cont = False
2234 if opts.get('continue'):
2234 if opts.get('continue'):
2235 cont = True
2235 cont = True
2236 if revs:
2236 if revs:
2237 raise error.Abort(_("can't specify --continue and revisions"))
2237 raise error.Abort(_("can't specify --continue and revisions"))
2238 # read in unfinished revisions
2238 # read in unfinished revisions
2239 try:
2239 try:
2240 nodes = repo.vfs.read('graftstate').splitlines()
2240 nodes = repo.vfs.read('graftstate').splitlines()
2241 revs = [repo[node].rev() for node in nodes]
2241 revs = [repo[node].rev() for node in nodes]
2242 except IOError as inst:
2242 except IOError as inst:
2243 if inst.errno != errno.ENOENT:
2243 if inst.errno != errno.ENOENT:
2244 raise
2244 raise
2245 cmdutil.wrongtooltocontinue(repo, _('graft'))
2245 cmdutil.wrongtooltocontinue(repo, _('graft'))
2246 else:
2246 else:
2247 cmdutil.checkunfinished(repo)
2247 cmdutil.checkunfinished(repo)
2248 cmdutil.bailifchanged(repo)
2248 cmdutil.bailifchanged(repo)
2249 if not revs:
2249 if not revs:
2250 raise error.Abort(_('no revisions specified'))
2250 raise error.Abort(_('no revisions specified'))
2251 revs = scmutil.revrange(repo, revs)
2251 revs = scmutil.revrange(repo, revs)
2252
2252
2253 skipped = set()
2253 skipped = set()
2254 # check for merges
2254 # check for merges
2255 for rev in repo.revs('%ld and merge()', revs):
2255 for rev in repo.revs('%ld and merge()', revs):
2256 ui.warn(_('skipping ungraftable merge revision %s\n') % rev)
2256 ui.warn(_('skipping ungraftable merge revision %s\n') % rev)
2257 skipped.add(rev)
2257 skipped.add(rev)
2258 revs = [r for r in revs if r not in skipped]
2258 revs = [r for r in revs if r not in skipped]
2259 if not revs:
2259 if not revs:
2260 return -1
2260 return -1
2261
2261
2262 # Don't check in the --continue case, in effect retaining --force across
2262 # Don't check in the --continue case, in effect retaining --force across
2263 # --continues. That's because without --force, any revisions we decided to
2263 # --continues. That's because without --force, any revisions we decided to
2264 # skip would have been filtered out here, so they wouldn't have made their
2264 # skip would have been filtered out here, so they wouldn't have made their
2265 # way to the graftstate. With --force, any revisions we would have otherwise
2265 # way to the graftstate. With --force, any revisions we would have otherwise
2266 # skipped would not have been filtered out, and if they hadn't been applied
2266 # skipped would not have been filtered out, and if they hadn't been applied
2267 # already, they'd have been in the graftstate.
2267 # already, they'd have been in the graftstate.
2268 if not (cont or opts.get('force')):
2268 if not (cont or opts.get('force')):
2269 # check for ancestors of dest branch
2269 # check for ancestors of dest branch
2270 crev = repo['.'].rev()
2270 crev = repo['.'].rev()
2271 ancestors = repo.changelog.ancestors([crev], inclusive=True)
2271 ancestors = repo.changelog.ancestors([crev], inclusive=True)
2272 # XXX make this lazy in the future
2272 # XXX make this lazy in the future
2273 # don't mutate while iterating, create a copy
2273 # don't mutate while iterating, create a copy
2274 for rev in list(revs):
2274 for rev in list(revs):
2275 if rev in ancestors:
2275 if rev in ancestors:
2276 ui.warn(_('skipping ancestor revision %d:%s\n') %
2276 ui.warn(_('skipping ancestor revision %d:%s\n') %
2277 (rev, repo[rev]))
2277 (rev, repo[rev]))
2278 # XXX remove on list is slow
2278 # XXX remove on list is slow
2279 revs.remove(rev)
2279 revs.remove(rev)
2280 if not revs:
2280 if not revs:
2281 return -1
2281 return -1
2282
2282
2283 # analyze revs for earlier grafts
2283 # analyze revs for earlier grafts
2284 ids = {}
2284 ids = {}
2285 for ctx in repo.set("%ld", revs):
2285 for ctx in repo.set("%ld", revs):
2286 ids[ctx.hex()] = ctx.rev()
2286 ids[ctx.hex()] = ctx.rev()
2287 n = ctx.extra().get('source')
2287 n = ctx.extra().get('source')
2288 if n:
2288 if n:
2289 ids[n] = ctx.rev()
2289 ids[n] = ctx.rev()
2290
2290
2291 # check ancestors for earlier grafts
2291 # check ancestors for earlier grafts
2292 ui.debug('scanning for duplicate grafts\n')
2292 ui.debug('scanning for duplicate grafts\n')
2293
2293
2294 for rev in repo.changelog.findmissingrevs(revs, [crev]):
2294 for rev in repo.changelog.findmissingrevs(revs, [crev]):
2295 ctx = repo[rev]
2295 ctx = repo[rev]
2296 n = ctx.extra().get('source')
2296 n = ctx.extra().get('source')
2297 if n in ids:
2297 if n in ids:
2298 try:
2298 try:
2299 r = repo[n].rev()
2299 r = repo[n].rev()
2300 except error.RepoLookupError:
2300 except error.RepoLookupError:
2301 r = None
2301 r = None
2302 if r in revs:
2302 if r in revs:
2303 ui.warn(_('skipping revision %d:%s '
2303 ui.warn(_('skipping revision %d:%s '
2304 '(already grafted to %d:%s)\n')
2304 '(already grafted to %d:%s)\n')
2305 % (r, repo[r], rev, ctx))
2305 % (r, repo[r], rev, ctx))
2306 revs.remove(r)
2306 revs.remove(r)
2307 elif ids[n] in revs:
2307 elif ids[n] in revs:
2308 if r is None:
2308 if r is None:
2309 ui.warn(_('skipping already grafted revision %d:%s '
2309 ui.warn(_('skipping already grafted revision %d:%s '
2310 '(%d:%s also has unknown origin %s)\n')
2310 '(%d:%s also has unknown origin %s)\n')
2311 % (ids[n], repo[ids[n]], rev, ctx, n[:12]))
2311 % (ids[n], repo[ids[n]], rev, ctx, n[:12]))
2312 else:
2312 else:
2313 ui.warn(_('skipping already grafted revision %d:%s '
2313 ui.warn(_('skipping already grafted revision %d:%s '
2314 '(%d:%s also has origin %d:%s)\n')
2314 '(%d:%s also has origin %d:%s)\n')
2315 % (ids[n], repo[ids[n]], rev, ctx, r, n[:12]))
2315 % (ids[n], repo[ids[n]], rev, ctx, r, n[:12]))
2316 revs.remove(ids[n])
2316 revs.remove(ids[n])
2317 elif ctx.hex() in ids:
2317 elif ctx.hex() in ids:
2318 r = ids[ctx.hex()]
2318 r = ids[ctx.hex()]
2319 ui.warn(_('skipping already grafted revision %d:%s '
2319 ui.warn(_('skipping already grafted revision %d:%s '
2320 '(was grafted from %d:%s)\n') %
2320 '(was grafted from %d:%s)\n') %
2321 (r, repo[r], rev, ctx))
2321 (r, repo[r], rev, ctx))
2322 revs.remove(r)
2322 revs.remove(r)
2323 if not revs:
2323 if not revs:
2324 return -1
2324 return -1
2325
2325
2326 for pos, ctx in enumerate(repo.set("%ld", revs)):
2326 for pos, ctx in enumerate(repo.set("%ld", revs)):
2327 desc = '%d:%s "%s"' % (ctx.rev(), ctx,
2327 desc = '%d:%s "%s"' % (ctx.rev(), ctx,
2328 ctx.description().split('\n', 1)[0])
2328 ctx.description().split('\n', 1)[0])
2329 names = repo.nodetags(ctx.node()) + repo.nodebookmarks(ctx.node())
2329 names = repo.nodetags(ctx.node()) + repo.nodebookmarks(ctx.node())
2330 if names:
2330 if names:
2331 desc += ' (%s)' % ' '.join(names)
2331 desc += ' (%s)' % ' '.join(names)
2332 ui.status(_('grafting %s\n') % desc)
2332 ui.status(_('grafting %s\n') % desc)
2333 if opts.get('dry_run'):
2333 if opts.get('dry_run'):
2334 continue
2334 continue
2335
2335
2336 source = ctx.extra().get('source')
2336 source = ctx.extra().get('source')
2337 extra = {}
2337 extra = {}
2338 if source:
2338 if source:
2339 extra['source'] = source
2339 extra['source'] = source
2340 extra['intermediate-source'] = ctx.hex()
2340 extra['intermediate-source'] = ctx.hex()
2341 else:
2341 else:
2342 extra['source'] = ctx.hex()
2342 extra['source'] = ctx.hex()
2343 user = ctx.user()
2343 user = ctx.user()
2344 if opts.get('user'):
2344 if opts.get('user'):
2345 user = opts['user']
2345 user = opts['user']
2346 date = ctx.date()
2346 date = ctx.date()
2347 if opts.get('date'):
2347 if opts.get('date'):
2348 date = opts['date']
2348 date = opts['date']
2349 message = ctx.description()
2349 message = ctx.description()
2350 if opts.get('log'):
2350 if opts.get('log'):
2351 message += '\n(grafted from %s)' % ctx.hex()
2351 message += '\n(grafted from %s)' % ctx.hex()
2352
2352
2353 # we don't merge the first commit when continuing
2353 # we don't merge the first commit when continuing
2354 if not cont:
2354 if not cont:
2355 # perform the graft merge with p1(rev) as 'ancestor'
2355 # perform the graft merge with p1(rev) as 'ancestor'
2356 try:
2356 try:
2357 # ui.forcemerge is an internal variable, do not document
2357 # ui.forcemerge is an internal variable, do not document
2358 repo.ui.setconfig('ui', 'forcemerge', opts.get('tool', ''),
2358 repo.ui.setconfig('ui', 'forcemerge', opts.get('tool', ''),
2359 'graft')
2359 'graft')
2360 stats = mergemod.graft(repo, ctx, ctx.p1(),
2360 stats = mergemod.graft(repo, ctx, ctx.p1(),
2361 ['local', 'graft'])
2361 ['local', 'graft'])
2362 finally:
2362 finally:
2363 repo.ui.setconfig('ui', 'forcemerge', '', 'graft')
2363 repo.ui.setconfig('ui', 'forcemerge', '', 'graft')
2364 # report any conflicts
2364 # report any conflicts
2365 if stats and stats[3] > 0:
2365 if stats and stats[3] > 0:
2366 # write out state for --continue
2366 # write out state for --continue
2367 nodelines = [repo[rev].hex() + "\n" for rev in revs[pos:]]
2367 nodelines = [repo[rev].hex() + "\n" for rev in revs[pos:]]
2368 repo.vfs.write('graftstate', ''.join(nodelines))
2368 repo.vfs.write('graftstate', ''.join(nodelines))
2369 extra = ''
2369 extra = ''
2370 if opts.get('user'):
2370 if opts.get('user'):
2371 extra += ' --user %s' % util.shellquote(opts['user'])
2371 extra += ' --user %s' % util.shellquote(opts['user'])
2372 if opts.get('date'):
2372 if opts.get('date'):
2373 extra += ' --date %s' % util.shellquote(opts['date'])
2373 extra += ' --date %s' % util.shellquote(opts['date'])
2374 if opts.get('log'):
2374 if opts.get('log'):
2375 extra += ' --log'
2375 extra += ' --log'
2376 hint=_("use 'hg resolve' and 'hg graft --continue%s'") % extra
2376 hint=_("use 'hg resolve' and 'hg graft --continue%s'") % extra
2377 raise error.Abort(
2377 raise error.Abort(
2378 _("unresolved conflicts, can't continue"),
2378 _("unresolved conflicts, can't continue"),
2379 hint=hint)
2379 hint=hint)
2380 else:
2380 else:
2381 cont = False
2381 cont = False
2382
2382
2383 # commit
2383 # commit
2384 node = repo.commit(text=message, user=user,
2384 node = repo.commit(text=message, user=user,
2385 date=date, extra=extra, editor=editor)
2385 date=date, extra=extra, editor=editor)
2386 if node is None:
2386 if node is None:
2387 ui.warn(
2387 ui.warn(
2388 _('note: graft of %d:%s created no changes to commit\n') %
2388 _('note: graft of %d:%s created no changes to commit\n') %
2389 (ctx.rev(), ctx))
2389 (ctx.rev(), ctx))
2390
2390
2391 # remove state when we complete successfully
2391 # remove state when we complete successfully
2392 if not opts.get('dry_run'):
2392 if not opts.get('dry_run'):
2393 repo.vfs.unlinkpath('graftstate', ignoremissing=True)
2393 repo.vfs.unlinkpath('graftstate', ignoremissing=True)
2394
2394
2395 return 0
2395 return 0
2396
2396
2397 @command('grep',
2397 @command('grep',
2398 [('0', 'print0', None, _('end fields with NUL')),
2398 [('0', 'print0', None, _('end fields with NUL')),
2399 ('', 'all', None, _('print all revisions that match')),
2399 ('', 'all', None, _('print all revisions that match')),
2400 ('a', 'text', None, _('treat all files as text')),
2400 ('a', 'text', None, _('treat all files as text')),
2401 ('f', 'follow', None,
2401 ('f', 'follow', None,
2402 _('follow changeset history,'
2402 _('follow changeset history,'
2403 ' or file history across copies and renames')),
2403 ' or file history across copies and renames')),
2404 ('i', 'ignore-case', None, _('ignore case when matching')),
2404 ('i', 'ignore-case', None, _('ignore case when matching')),
2405 ('l', 'files-with-matches', None,
2405 ('l', 'files-with-matches', None,
2406 _('print only filenames and revisions that match')),
2406 _('print only filenames and revisions that match')),
2407 ('n', 'line-number', None, _('print matching line numbers')),
2407 ('n', 'line-number', None, _('print matching line numbers')),
2408 ('r', 'rev', [],
2408 ('r', 'rev', [],
2409 _('only search files changed within revision range'), _('REV')),
2409 _('only search files changed within revision range'), _('REV')),
2410 ('u', 'user', None, _('list the author (long with -v)')),
2410 ('u', 'user', None, _('list the author (long with -v)')),
2411 ('d', 'date', None, _('list the date (short with -q)')),
2411 ('d', 'date', None, _('list the date (short with -q)')),
2412 ] + formatteropts + walkopts,
2412 ] + formatteropts + walkopts,
2413 _('[OPTION]... PATTERN [FILE]...'),
2413 _('[OPTION]... PATTERN [FILE]...'),
2414 inferrepo=True)
2414 inferrepo=True)
2415 def grep(ui, repo, pattern, *pats, **opts):
2415 def grep(ui, repo, pattern, *pats, **opts):
2416 """search revision history for a pattern in specified files
2416 """search revision history for a pattern in specified files
2417
2417
2418 Search revision history for a regular expression in the specified
2418 Search revision history for a regular expression in the specified
2419 files or the entire project.
2419 files or the entire project.
2420
2420
2421 By default, grep prints the most recent revision number for each
2421 By default, grep prints the most recent revision number for each
2422 file in which it finds a match. To get it to print every revision
2422 file in which it finds a match. To get it to print every revision
2423 that contains a change in match status ("-" for a match that becomes
2423 that contains a change in match status ("-" for a match that becomes
2424 a non-match, or "+" for a non-match that becomes a match), use the
2424 a non-match, or "+" for a non-match that becomes a match), use the
2425 --all flag.
2425 --all flag.
2426
2426
2427 PATTERN can be any Python (roughly Perl-compatible) regular
2427 PATTERN can be any Python (roughly Perl-compatible) regular
2428 expression.
2428 expression.
2429
2429
2430 If no FILEs are specified (and -f/--follow isn't set), all files in
2430 If no FILEs are specified (and -f/--follow isn't set), all files in
2431 the repository are searched, including those that don't exist in the
2431 the repository are searched, including those that don't exist in the
2432 current branch or have been deleted in a prior changeset.
2432 current branch or have been deleted in a prior changeset.
2433
2433
2434 Returns 0 if a match is found, 1 otherwise.
2434 Returns 0 if a match is found, 1 otherwise.
2435 """
2435 """
2436 reflags = re.M
2436 reflags = re.M
2437 if opts.get('ignore_case'):
2437 if opts.get('ignore_case'):
2438 reflags |= re.I
2438 reflags |= re.I
2439 try:
2439 try:
2440 regexp = util.re.compile(pattern, reflags)
2440 regexp = util.re.compile(pattern, reflags)
2441 except re.error as inst:
2441 except re.error as inst:
2442 ui.warn(_("grep: invalid match pattern: %s\n") % inst)
2442 ui.warn(_("grep: invalid match pattern: %s\n") % inst)
2443 return 1
2443 return 1
2444 sep, eol = ':', '\n'
2444 sep, eol = ':', '\n'
2445 if opts.get('print0'):
2445 if opts.get('print0'):
2446 sep = eol = '\0'
2446 sep = eol = '\0'
2447
2447
2448 getfile = util.lrucachefunc(repo.file)
2448 getfile = util.lrucachefunc(repo.file)
2449
2449
2450 def matchlines(body):
2450 def matchlines(body):
2451 begin = 0
2451 begin = 0
2452 linenum = 0
2452 linenum = 0
2453 while begin < len(body):
2453 while begin < len(body):
2454 match = regexp.search(body, begin)
2454 match = regexp.search(body, begin)
2455 if not match:
2455 if not match:
2456 break
2456 break
2457 mstart, mend = match.span()
2457 mstart, mend = match.span()
2458 linenum += body.count('\n', begin, mstart) + 1
2458 linenum += body.count('\n', begin, mstart) + 1
2459 lstart = body.rfind('\n', begin, mstart) + 1 or begin
2459 lstart = body.rfind('\n', begin, mstart) + 1 or begin
2460 begin = body.find('\n', mend) + 1 or len(body) + 1
2460 begin = body.find('\n', mend) + 1 or len(body) + 1
2461 lend = begin - 1
2461 lend = begin - 1
2462 yield linenum, mstart - lstart, mend - lstart, body[lstart:lend]
2462 yield linenum, mstart - lstart, mend - lstart, body[lstart:lend]
2463
2463
2464 class linestate(object):
2464 class linestate(object):
2465 def __init__(self, line, linenum, colstart, colend):
2465 def __init__(self, line, linenum, colstart, colend):
2466 self.line = line
2466 self.line = line
2467 self.linenum = linenum
2467 self.linenum = linenum
2468 self.colstart = colstart
2468 self.colstart = colstart
2469 self.colend = colend
2469 self.colend = colend
2470
2470
2471 def __hash__(self):
2471 def __hash__(self):
2472 return hash((self.linenum, self.line))
2472 return hash((self.linenum, self.line))
2473
2473
2474 def __eq__(self, other):
2474 def __eq__(self, other):
2475 return self.line == other.line
2475 return self.line == other.line
2476
2476
2477 def findpos(self):
2477 def findpos(self):
2478 """Iterate all (start, end) indices of matches"""
2478 """Iterate all (start, end) indices of matches"""
2479 yield self.colstart, self.colend
2479 yield self.colstart, self.colend
2480 p = self.colend
2480 p = self.colend
2481 while p < len(self.line):
2481 while p < len(self.line):
2482 m = regexp.search(self.line, p)
2482 m = regexp.search(self.line, p)
2483 if not m:
2483 if not m:
2484 break
2484 break
2485 yield m.span()
2485 yield m.span()
2486 p = m.end()
2486 p = m.end()
2487
2487
2488 matches = {}
2488 matches = {}
2489 copies = {}
2489 copies = {}
2490 def grepbody(fn, rev, body):
2490 def grepbody(fn, rev, body):
2491 matches[rev].setdefault(fn, [])
2491 matches[rev].setdefault(fn, [])
2492 m = matches[rev][fn]
2492 m = matches[rev][fn]
2493 for lnum, cstart, cend, line in matchlines(body):
2493 for lnum, cstart, cend, line in matchlines(body):
2494 s = linestate(line, lnum, cstart, cend)
2494 s = linestate(line, lnum, cstart, cend)
2495 m.append(s)
2495 m.append(s)
2496
2496
2497 def difflinestates(a, b):
2497 def difflinestates(a, b):
2498 sm = difflib.SequenceMatcher(None, a, b)
2498 sm = difflib.SequenceMatcher(None, a, b)
2499 for tag, alo, ahi, blo, bhi in sm.get_opcodes():
2499 for tag, alo, ahi, blo, bhi in sm.get_opcodes():
2500 if tag == 'insert':
2500 if tag == 'insert':
2501 for i in xrange(blo, bhi):
2501 for i in xrange(blo, bhi):
2502 yield ('+', b[i])
2502 yield ('+', b[i])
2503 elif tag == 'delete':
2503 elif tag == 'delete':
2504 for i in xrange(alo, ahi):
2504 for i in xrange(alo, ahi):
2505 yield ('-', a[i])
2505 yield ('-', a[i])
2506 elif tag == 'replace':
2506 elif tag == 'replace':
2507 for i in xrange(alo, ahi):
2507 for i in xrange(alo, ahi):
2508 yield ('-', a[i])
2508 yield ('-', a[i])
2509 for i in xrange(blo, bhi):
2509 for i in xrange(blo, bhi):
2510 yield ('+', b[i])
2510 yield ('+', b[i])
2511
2511
2512 def display(fm, fn, ctx, pstates, states):
2512 def display(fm, fn, ctx, pstates, states):
2513 rev = ctx.rev()
2513 rev = ctx.rev()
2514 if fm.isplain():
2514 if fm.isplain():
2515 formatuser = ui.shortuser
2515 formatuser = ui.shortuser
2516 else:
2516 else:
2517 formatuser = str
2517 formatuser = str
2518 if ui.quiet:
2518 if ui.quiet:
2519 datefmt = '%Y-%m-%d'
2519 datefmt = '%Y-%m-%d'
2520 else:
2520 else:
2521 datefmt = '%a %b %d %H:%M:%S %Y %1%2'
2521 datefmt = '%a %b %d %H:%M:%S %Y %1%2'
2522 found = False
2522 found = False
2523 @util.cachefunc
2523 @util.cachefunc
2524 def binary():
2524 def binary():
2525 flog = getfile(fn)
2525 flog = getfile(fn)
2526 return util.binary(flog.read(ctx.filenode(fn)))
2526 return util.binary(flog.read(ctx.filenode(fn)))
2527
2527
2528 fieldnamemap = {'filename': 'file', 'linenumber': 'line_number'}
2528 fieldnamemap = {'filename': 'file', 'linenumber': 'line_number'}
2529 if opts.get('all'):
2529 if opts.get('all'):
2530 iter = difflinestates(pstates, states)
2530 iter = difflinestates(pstates, states)
2531 else:
2531 else:
2532 iter = [('', l) for l in states]
2532 iter = [('', l) for l in states]
2533 for change, l in iter:
2533 for change, l in iter:
2534 fm.startitem()
2534 fm.startitem()
2535 fm.data(node=fm.hexfunc(ctx.node()))
2535 fm.data(node=fm.hexfunc(ctx.node()))
2536 cols = [
2536 cols = [
2537 ('filename', fn, True),
2537 ('filename', fn, True),
2538 ('rev', rev, True),
2538 ('rev', rev, True),
2539 ('linenumber', l.linenum, opts.get('line_number')),
2539 ('linenumber', l.linenum, opts.get('line_number')),
2540 ]
2540 ]
2541 if opts.get('all'):
2541 if opts.get('all'):
2542 cols.append(('change', change, True))
2542 cols.append(('change', change, True))
2543 cols.extend([
2543 cols.extend([
2544 ('user', formatuser(ctx.user()), opts.get('user')),
2544 ('user', formatuser(ctx.user()), opts.get('user')),
2545 ('date', fm.formatdate(ctx.date(), datefmt), opts.get('date')),
2545 ('date', fm.formatdate(ctx.date(), datefmt), opts.get('date')),
2546 ])
2546 ])
2547 lastcol = next(name for name, data, cond in reversed(cols) if cond)
2547 lastcol = next(name for name, data, cond in reversed(cols) if cond)
2548 for name, data, cond in cols:
2548 for name, data, cond in cols:
2549 field = fieldnamemap.get(name, name)
2549 field = fieldnamemap.get(name, name)
2550 fm.condwrite(cond, field, '%s', data, label='grep.%s' % name)
2550 fm.condwrite(cond, field, '%s', data, label='grep.%s' % name)
2551 if cond and name != lastcol:
2551 if cond and name != lastcol:
2552 fm.plain(sep, label='grep.sep')
2552 fm.plain(sep, label='grep.sep')
2553 if not opts.get('files_with_matches'):
2553 if not opts.get('files_with_matches'):
2554 fm.plain(sep, label='grep.sep')
2554 fm.plain(sep, label='grep.sep')
2555 if not opts.get('text') and binary():
2555 if not opts.get('text') and binary():
2556 fm.plain(_(" Binary file matches"))
2556 fm.plain(_(" Binary file matches"))
2557 else:
2557 else:
2558 displaymatches(fm.nested('texts'), l)
2558 displaymatches(fm.nested('texts'), l)
2559 fm.plain(eol)
2559 fm.plain(eol)
2560 found = True
2560 found = True
2561 if opts.get('files_with_matches'):
2561 if opts.get('files_with_matches'):
2562 break
2562 break
2563 return found
2563 return found
2564
2564
2565 def displaymatches(fm, l):
2565 def displaymatches(fm, l):
2566 p = 0
2566 p = 0
2567 for s, e in l.findpos():
2567 for s, e in l.findpos():
2568 if p < s:
2568 if p < s:
2569 fm.startitem()
2569 fm.startitem()
2570 fm.write('text', '%s', l.line[p:s])
2570 fm.write('text', '%s', l.line[p:s])
2571 fm.data(matched=False)
2571 fm.data(matched=False)
2572 fm.startitem()
2572 fm.startitem()
2573 fm.write('text', '%s', l.line[s:e], label='grep.match')
2573 fm.write('text', '%s', l.line[s:e], label='grep.match')
2574 fm.data(matched=True)
2574 fm.data(matched=True)
2575 p = e
2575 p = e
2576 if p < len(l.line):
2576 if p < len(l.line):
2577 fm.startitem()
2577 fm.startitem()
2578 fm.write('text', '%s', l.line[p:])
2578 fm.write('text', '%s', l.line[p:])
2579 fm.data(matched=False)
2579 fm.data(matched=False)
2580 fm.end()
2580 fm.end()
2581
2581
2582 skip = {}
2582 skip = {}
2583 revfiles = {}
2583 revfiles = {}
2584 matchfn = scmutil.match(repo[None], pats, opts)
2584 matchfn = scmutil.match(repo[None], pats, opts)
2585 found = False
2585 found = False
2586 follow = opts.get('follow')
2586 follow = opts.get('follow')
2587
2587
2588 def prep(ctx, fns):
2588 def prep(ctx, fns):
2589 rev = ctx.rev()
2589 rev = ctx.rev()
2590 pctx = ctx.p1()
2590 pctx = ctx.p1()
2591 parent = pctx.rev()
2591 parent = pctx.rev()
2592 matches.setdefault(rev, {})
2592 matches.setdefault(rev, {})
2593 matches.setdefault(parent, {})
2593 matches.setdefault(parent, {})
2594 files = revfiles.setdefault(rev, [])
2594 files = revfiles.setdefault(rev, [])
2595 for fn in fns:
2595 for fn in fns:
2596 flog = getfile(fn)
2596 flog = getfile(fn)
2597 try:
2597 try:
2598 fnode = ctx.filenode(fn)
2598 fnode = ctx.filenode(fn)
2599 except error.LookupError:
2599 except error.LookupError:
2600 continue
2600 continue
2601
2601
2602 copied = flog.renamed(fnode)
2602 copied = flog.renamed(fnode)
2603 copy = follow and copied and copied[0]
2603 copy = follow and copied and copied[0]
2604 if copy:
2604 if copy:
2605 copies.setdefault(rev, {})[fn] = copy
2605 copies.setdefault(rev, {})[fn] = copy
2606 if fn in skip:
2606 if fn in skip:
2607 if copy:
2607 if copy:
2608 skip[copy] = True
2608 skip[copy] = True
2609 continue
2609 continue
2610 files.append(fn)
2610 files.append(fn)
2611
2611
2612 if fn not in matches[rev]:
2612 if fn not in matches[rev]:
2613 grepbody(fn, rev, flog.read(fnode))
2613 grepbody(fn, rev, flog.read(fnode))
2614
2614
2615 pfn = copy or fn
2615 pfn = copy or fn
2616 if pfn not in matches[parent]:
2616 if pfn not in matches[parent]:
2617 try:
2617 try:
2618 fnode = pctx.filenode(pfn)
2618 fnode = pctx.filenode(pfn)
2619 grepbody(pfn, parent, flog.read(fnode))
2619 grepbody(pfn, parent, flog.read(fnode))
2620 except error.LookupError:
2620 except error.LookupError:
2621 pass
2621 pass
2622
2622
2623 ui.pager('grep')
2623 ui.pager('grep')
2624 fm = ui.formatter('grep', opts)
2624 fm = ui.formatter('grep', opts)
2625 for ctx in cmdutil.walkchangerevs(repo, matchfn, opts, prep):
2625 for ctx in cmdutil.walkchangerevs(repo, matchfn, opts, prep):
2626 rev = ctx.rev()
2626 rev = ctx.rev()
2627 parent = ctx.p1().rev()
2627 parent = ctx.p1().rev()
2628 for fn in sorted(revfiles.get(rev, [])):
2628 for fn in sorted(revfiles.get(rev, [])):
2629 states = matches[rev][fn]
2629 states = matches[rev][fn]
2630 copy = copies.get(rev, {}).get(fn)
2630 copy = copies.get(rev, {}).get(fn)
2631 if fn in skip:
2631 if fn in skip:
2632 if copy:
2632 if copy:
2633 skip[copy] = True
2633 skip[copy] = True
2634 continue
2634 continue
2635 pstates = matches.get(parent, {}).get(copy or fn, [])
2635 pstates = matches.get(parent, {}).get(copy or fn, [])
2636 if pstates or states:
2636 if pstates or states:
2637 r = display(fm, fn, ctx, pstates, states)
2637 r = display(fm, fn, ctx, pstates, states)
2638 found = found or r
2638 found = found or r
2639 if r and not opts.get('all'):
2639 if r and not opts.get('all'):
2640 skip[fn] = True
2640 skip[fn] = True
2641 if copy:
2641 if copy:
2642 skip[copy] = True
2642 skip[copy] = True
2643 del matches[rev]
2643 del matches[rev]
2644 del revfiles[rev]
2644 del revfiles[rev]
2645 fm.end()
2645 fm.end()
2646
2646
2647 return not found
2647 return not found
2648
2648
2649 @command('heads',
2649 @command('heads',
2650 [('r', 'rev', '',
2650 [('r', 'rev', '',
2651 _('show only heads which are descendants of STARTREV'), _('STARTREV')),
2651 _('show only heads which are descendants of STARTREV'), _('STARTREV')),
2652 ('t', 'topo', False, _('show topological heads only')),
2652 ('t', 'topo', False, _('show topological heads only')),
2653 ('a', 'active', False, _('show active branchheads only (DEPRECATED)')),
2653 ('a', 'active', False, _('show active branchheads only (DEPRECATED)')),
2654 ('c', 'closed', False, _('show normal and closed branch heads')),
2654 ('c', 'closed', False, _('show normal and closed branch heads')),
2655 ] + templateopts,
2655 ] + templateopts,
2656 _('[-ct] [-r STARTREV] [REV]...'))
2656 _('[-ct] [-r STARTREV] [REV]...'))
2657 def heads(ui, repo, *branchrevs, **opts):
2657 def heads(ui, repo, *branchrevs, **opts):
2658 """show branch heads
2658 """show branch heads
2659
2659
2660 With no arguments, show all open branch heads in the repository.
2660 With no arguments, show all open branch heads in the repository.
2661 Branch heads are changesets that have no descendants on the
2661 Branch heads are changesets that have no descendants on the
2662 same branch. They are where development generally takes place and
2662 same branch. They are where development generally takes place and
2663 are the usual targets for update and merge operations.
2663 are the usual targets for update and merge operations.
2664
2664
2665 If one or more REVs are given, only open branch heads on the
2665 If one or more REVs are given, only open branch heads on the
2666 branches associated with the specified changesets are shown. This
2666 branches associated with the specified changesets are shown. This
2667 means that you can use :hg:`heads .` to see the heads on the
2667 means that you can use :hg:`heads .` to see the heads on the
2668 currently checked-out branch.
2668 currently checked-out branch.
2669
2669
2670 If -c/--closed is specified, also show branch heads marked closed
2670 If -c/--closed is specified, also show branch heads marked closed
2671 (see :hg:`commit --close-branch`).
2671 (see :hg:`commit --close-branch`).
2672
2672
2673 If STARTREV is specified, only those heads that are descendants of
2673 If STARTREV is specified, only those heads that are descendants of
2674 STARTREV will be displayed.
2674 STARTREV will be displayed.
2675
2675
2676 If -t/--topo is specified, named branch mechanics will be ignored and only
2676 If -t/--topo is specified, named branch mechanics will be ignored and only
2677 topological heads (changesets with no children) will be shown.
2677 topological heads (changesets with no children) will be shown.
2678
2678
2679 Returns 0 if matching heads are found, 1 if not.
2679 Returns 0 if matching heads are found, 1 if not.
2680 """
2680 """
2681
2681
2682 start = None
2682 start = None
2683 if 'rev' in opts:
2683 if 'rev' in opts:
2684 start = scmutil.revsingle(repo, opts['rev'], None).node()
2684 start = scmutil.revsingle(repo, opts['rev'], None).node()
2685
2685
2686 if opts.get('topo'):
2686 if opts.get('topo'):
2687 heads = [repo[h] for h in repo.heads(start)]
2687 heads = [repo[h] for h in repo.heads(start)]
2688 else:
2688 else:
2689 heads = []
2689 heads = []
2690 for branch in repo.branchmap():
2690 for branch in repo.branchmap():
2691 heads += repo.branchheads(branch, start, opts.get('closed'))
2691 heads += repo.branchheads(branch, start, opts.get('closed'))
2692 heads = [repo[h] for h in heads]
2692 heads = [repo[h] for h in heads]
2693
2693
2694 if branchrevs:
2694 if branchrevs:
2695 branches = set(repo[br].branch() for br in branchrevs)
2695 branches = set(repo[br].branch() for br in branchrevs)
2696 heads = [h for h in heads if h.branch() in branches]
2696 heads = [h for h in heads if h.branch() in branches]
2697
2697
2698 if opts.get('active') and branchrevs:
2698 if opts.get('active') and branchrevs:
2699 dagheads = repo.heads(start)
2699 dagheads = repo.heads(start)
2700 heads = [h for h in heads if h.node() in dagheads]
2700 heads = [h for h in heads if h.node() in dagheads]
2701
2701
2702 if branchrevs:
2702 if branchrevs:
2703 haveheads = set(h.branch() for h in heads)
2703 haveheads = set(h.branch() for h in heads)
2704 if branches - haveheads:
2704 if branches - haveheads:
2705 headless = ', '.join(b for b in branches - haveheads)
2705 headless = ', '.join(b for b in branches - haveheads)
2706 msg = _('no open branch heads found on branches %s')
2706 msg = _('no open branch heads found on branches %s')
2707 if opts.get('rev'):
2707 if opts.get('rev'):
2708 msg += _(' (started at %s)') % opts['rev']
2708 msg += _(' (started at %s)') % opts['rev']
2709 ui.warn((msg + '\n') % headless)
2709 ui.warn((msg + '\n') % headless)
2710
2710
2711 if not heads:
2711 if not heads:
2712 return 1
2712 return 1
2713
2713
2714 ui.pager('heads')
2714 ui.pager('heads')
2715 heads = sorted(heads, key=lambda x: -x.rev())
2715 heads = sorted(heads, key=lambda x: -x.rev())
2716 displayer = cmdutil.show_changeset(ui, repo, opts)
2716 displayer = cmdutil.show_changeset(ui, repo, opts)
2717 for ctx in heads:
2717 for ctx in heads:
2718 displayer.show(ctx)
2718 displayer.show(ctx)
2719 displayer.close()
2719 displayer.close()
2720
2720
2721 @command('help',
2721 @command('help',
2722 [('e', 'extension', None, _('show only help for extensions')),
2722 [('e', 'extension', None, _('show only help for extensions')),
2723 ('c', 'command', None, _('show only help for commands')),
2723 ('c', 'command', None, _('show only help for commands')),
2724 ('k', 'keyword', None, _('show topics matching keyword')),
2724 ('k', 'keyword', None, _('show topics matching keyword')),
2725 ('s', 'system', [], _('show help for specific platform(s)')),
2725 ('s', 'system', [], _('show help for specific platform(s)')),
2726 ],
2726 ],
2727 _('[-ecks] [TOPIC]'),
2727 _('[-ecks] [TOPIC]'),
2728 norepo=True)
2728 norepo=True)
2729 def help_(ui, name=None, **opts):
2729 def help_(ui, name=None, **opts):
2730 """show help for a given topic or a help overview
2730 """show help for a given topic or a help overview
2731
2731
2732 With no arguments, print a list of commands with short help messages.
2732 With no arguments, print a list of commands with short help messages.
2733
2733
2734 Given a topic, extension, or command name, print help for that
2734 Given a topic, extension, or command name, print help for that
2735 topic.
2735 topic.
2736
2736
2737 Returns 0 if successful.
2737 Returns 0 if successful.
2738 """
2738 """
2739
2739
2740 keep = opts.get('system') or []
2740 keep = opts.get('system') or []
2741 if len(keep) == 0:
2741 if len(keep) == 0:
2742 if pycompat.sysplatform.startswith('win'):
2742 if pycompat.sysplatform.startswith('win'):
2743 keep.append('windows')
2743 keep.append('windows')
2744 elif pycompat.sysplatform == 'OpenVMS':
2744 elif pycompat.sysplatform == 'OpenVMS':
2745 keep.append('vms')
2745 keep.append('vms')
2746 elif pycompat.sysplatform == 'plan9':
2746 elif pycompat.sysplatform == 'plan9':
2747 keep.append('plan9')
2747 keep.append('plan9')
2748 else:
2748 else:
2749 keep.append('unix')
2749 keep.append('unix')
2750 keep.append(pycompat.sysplatform.lower())
2750 keep.append(pycompat.sysplatform.lower())
2751 if ui.verbose:
2751 if ui.verbose:
2752 keep.append('verbose')
2752 keep.append('verbose')
2753
2753
2754 formatted = help.formattedhelp(ui, name, keep=keep, **opts)
2754 formatted = help.formattedhelp(ui, name, keep=keep, **opts)
2755 ui.pager('help')
2755 ui.pager('help')
2756 ui.write(formatted)
2756 ui.write(formatted)
2757
2757
2758
2758
2759 @command('identify|id',
2759 @command('identify|id',
2760 [('r', 'rev', '',
2760 [('r', 'rev', '',
2761 _('identify the specified revision'), _('REV')),
2761 _('identify the specified revision'), _('REV')),
2762 ('n', 'num', None, _('show local revision number')),
2762 ('n', 'num', None, _('show local revision number')),
2763 ('i', 'id', None, _('show global revision id')),
2763 ('i', 'id', None, _('show global revision id')),
2764 ('b', 'branch', None, _('show branch')),
2764 ('b', 'branch', None, _('show branch')),
2765 ('t', 'tags', None, _('show tags')),
2765 ('t', 'tags', None, _('show tags')),
2766 ('B', 'bookmarks', None, _('show bookmarks')),
2766 ('B', 'bookmarks', None, _('show bookmarks')),
2767 ] + remoteopts,
2767 ] + remoteopts,
2768 _('[-nibtB] [-r REV] [SOURCE]'),
2768 _('[-nibtB] [-r REV] [SOURCE]'),
2769 optionalrepo=True)
2769 optionalrepo=True)
2770 def identify(ui, repo, source=None, rev=None,
2770 def identify(ui, repo, source=None, rev=None,
2771 num=None, id=None, branch=None, tags=None, bookmarks=None, **opts):
2771 num=None, id=None, branch=None, tags=None, bookmarks=None, **opts):
2772 """identify the working directory or specified revision
2772 """identify the working directory or specified revision
2773
2773
2774 Print a summary identifying the repository state at REV using one or
2774 Print a summary identifying the repository state at REV using one or
2775 two parent hash identifiers, followed by a "+" if the working
2775 two parent hash identifiers, followed by a "+" if the working
2776 directory has uncommitted changes, the branch name (if not default),
2776 directory has uncommitted changes, the branch name (if not default),
2777 a list of tags, and a list of bookmarks.
2777 a list of tags, and a list of bookmarks.
2778
2778
2779 When REV is not given, print a summary of the current state of the
2779 When REV is not given, print a summary of the current state of the
2780 repository.
2780 repository.
2781
2781
2782 Specifying a path to a repository root or Mercurial bundle will
2782 Specifying a path to a repository root or Mercurial bundle will
2783 cause lookup to operate on that repository/bundle.
2783 cause lookup to operate on that repository/bundle.
2784
2784
2785 .. container:: verbose
2785 .. container:: verbose
2786
2786
2787 Examples:
2787 Examples:
2788
2788
2789 - generate a build identifier for the working directory::
2789 - generate a build identifier for the working directory::
2790
2790
2791 hg id --id > build-id.dat
2791 hg id --id > build-id.dat
2792
2792
2793 - find the revision corresponding to a tag::
2793 - find the revision corresponding to a tag::
2794
2794
2795 hg id -n -r 1.3
2795 hg id -n -r 1.3
2796
2796
2797 - check the most recent revision of a remote repository::
2797 - check the most recent revision of a remote repository::
2798
2798
2799 hg id -r tip https://www.mercurial-scm.org/repo/hg/
2799 hg id -r tip https://www.mercurial-scm.org/repo/hg/
2800
2800
2801 See :hg:`log` for generating more information about specific revisions,
2801 See :hg:`log` for generating more information about specific revisions,
2802 including full hash identifiers.
2802 including full hash identifiers.
2803
2803
2804 Returns 0 if successful.
2804 Returns 0 if successful.
2805 """
2805 """
2806
2806
2807 if not repo and not source:
2807 if not repo and not source:
2808 raise error.Abort(_("there is no Mercurial repository here "
2808 raise error.Abort(_("there is no Mercurial repository here "
2809 "(.hg not found)"))
2809 "(.hg not found)"))
2810
2810
2811 if ui.debugflag:
2811 if ui.debugflag:
2812 hexfunc = hex
2812 hexfunc = hex
2813 else:
2813 else:
2814 hexfunc = short
2814 hexfunc = short
2815 default = not (num or id or branch or tags or bookmarks)
2815 default = not (num or id or branch or tags or bookmarks)
2816 output = []
2816 output = []
2817 revs = []
2817 revs = []
2818
2818
2819 if source:
2819 if source:
2820 source, branches = hg.parseurl(ui.expandpath(source))
2820 source, branches = hg.parseurl(ui.expandpath(source))
2821 peer = hg.peer(repo or ui, opts, source) # only pass ui when no repo
2821 peer = hg.peer(repo or ui, opts, source) # only pass ui when no repo
2822 repo = peer.local()
2822 repo = peer.local()
2823 revs, checkout = hg.addbranchrevs(repo, peer, branches, None)
2823 revs, checkout = hg.addbranchrevs(repo, peer, branches, None)
2824
2824
2825 if not repo:
2825 if not repo:
2826 if num or branch or tags:
2826 if num or branch or tags:
2827 raise error.Abort(
2827 raise error.Abort(
2828 _("can't query remote revision number, branch, or tags"))
2828 _("can't query remote revision number, branch, or tags"))
2829 if not rev and revs:
2829 if not rev and revs:
2830 rev = revs[0]
2830 rev = revs[0]
2831 if not rev:
2831 if not rev:
2832 rev = "tip"
2832 rev = "tip"
2833
2833
2834 remoterev = peer.lookup(rev)
2834 remoterev = peer.lookup(rev)
2835 if default or id:
2835 if default or id:
2836 output = [hexfunc(remoterev)]
2836 output = [hexfunc(remoterev)]
2837
2837
2838 def getbms():
2838 def getbms():
2839 bms = []
2839 bms = []
2840
2840
2841 if 'bookmarks' in peer.listkeys('namespaces'):
2841 if 'bookmarks' in peer.listkeys('namespaces'):
2842 hexremoterev = hex(remoterev)
2842 hexremoterev = hex(remoterev)
2843 bms = [bm for bm, bmr in peer.listkeys('bookmarks').iteritems()
2843 bms = [bm for bm, bmr in peer.listkeys('bookmarks').iteritems()
2844 if bmr == hexremoterev]
2844 if bmr == hexremoterev]
2845
2845
2846 return sorted(bms)
2846 return sorted(bms)
2847
2847
2848 if bookmarks:
2848 if bookmarks:
2849 output.extend(getbms())
2849 output.extend(getbms())
2850 elif default and not ui.quiet:
2850 elif default and not ui.quiet:
2851 # multiple bookmarks for a single parent separated by '/'
2851 # multiple bookmarks for a single parent separated by '/'
2852 bm = '/'.join(getbms())
2852 bm = '/'.join(getbms())
2853 if bm:
2853 if bm:
2854 output.append(bm)
2854 output.append(bm)
2855 else:
2855 else:
2856 ctx = scmutil.revsingle(repo, rev, None)
2856 ctx = scmutil.revsingle(repo, rev, None)
2857
2857
2858 if ctx.rev() is None:
2858 if ctx.rev() is None:
2859 ctx = repo[None]
2859 ctx = repo[None]
2860 parents = ctx.parents()
2860 parents = ctx.parents()
2861 taglist = []
2861 taglist = []
2862 for p in parents:
2862 for p in parents:
2863 taglist.extend(p.tags())
2863 taglist.extend(p.tags())
2864
2864
2865 changed = ""
2865 changed = ""
2866 if default or id or num:
2866 if default or id or num:
2867 if (any(repo.status())
2867 if (any(repo.status())
2868 or any(ctx.sub(s).dirty() for s in ctx.substate)):
2868 or any(ctx.sub(s).dirty() for s in ctx.substate)):
2869 changed = '+'
2869 changed = '+'
2870 if default or id:
2870 if default or id:
2871 output = ["%s%s" %
2871 output = ["%s%s" %
2872 ('+'.join([hexfunc(p.node()) for p in parents]), changed)]
2872 ('+'.join([hexfunc(p.node()) for p in parents]), changed)]
2873 if num:
2873 if num:
2874 output.append("%s%s" %
2874 output.append("%s%s" %
2875 ('+'.join([str(p.rev()) for p in parents]), changed))
2875 ('+'.join([str(p.rev()) for p in parents]), changed))
2876 else:
2876 else:
2877 if default or id:
2877 if default or id:
2878 output = [hexfunc(ctx.node())]
2878 output = [hexfunc(ctx.node())]
2879 if num:
2879 if num:
2880 output.append(str(ctx.rev()))
2880 output.append(str(ctx.rev()))
2881 taglist = ctx.tags()
2881 taglist = ctx.tags()
2882
2882
2883 if default and not ui.quiet:
2883 if default and not ui.quiet:
2884 b = ctx.branch()
2884 b = ctx.branch()
2885 if b != 'default':
2885 if b != 'default':
2886 output.append("(%s)" % b)
2886 output.append("(%s)" % b)
2887
2887
2888 # multiple tags for a single parent separated by '/'
2888 # multiple tags for a single parent separated by '/'
2889 t = '/'.join(taglist)
2889 t = '/'.join(taglist)
2890 if t:
2890 if t:
2891 output.append(t)
2891 output.append(t)
2892
2892
2893 # multiple bookmarks for a single parent separated by '/'
2893 # multiple bookmarks for a single parent separated by '/'
2894 bm = '/'.join(ctx.bookmarks())
2894 bm = '/'.join(ctx.bookmarks())
2895 if bm:
2895 if bm:
2896 output.append(bm)
2896 output.append(bm)
2897 else:
2897 else:
2898 if branch:
2898 if branch:
2899 output.append(ctx.branch())
2899 output.append(ctx.branch())
2900
2900
2901 if tags:
2901 if tags:
2902 output.extend(taglist)
2902 output.extend(taglist)
2903
2903
2904 if bookmarks:
2904 if bookmarks:
2905 output.extend(ctx.bookmarks())
2905 output.extend(ctx.bookmarks())
2906
2906
2907 ui.write("%s\n" % ' '.join(output))
2907 ui.write("%s\n" % ' '.join(output))
2908
2908
2909 @command('import|patch',
2909 @command('import|patch',
2910 [('p', 'strip', 1,
2910 [('p', 'strip', 1,
2911 _('directory strip option for patch. This has the same '
2911 _('directory strip option for patch. This has the same '
2912 'meaning as the corresponding patch option'), _('NUM')),
2912 'meaning as the corresponding patch option'), _('NUM')),
2913 ('b', 'base', '', _('base path (DEPRECATED)'), _('PATH')),
2913 ('b', 'base', '', _('base path (DEPRECATED)'), _('PATH')),
2914 ('e', 'edit', False, _('invoke editor on commit messages')),
2914 ('e', 'edit', False, _('invoke editor on commit messages')),
2915 ('f', 'force', None,
2915 ('f', 'force', None,
2916 _('skip check for outstanding uncommitted changes (DEPRECATED)')),
2916 _('skip check for outstanding uncommitted changes (DEPRECATED)')),
2917 ('', 'no-commit', None,
2917 ('', 'no-commit', None,
2918 _("don't commit, just update the working directory")),
2918 _("don't commit, just update the working directory")),
2919 ('', 'bypass', None,
2919 ('', 'bypass', None,
2920 _("apply patch without touching the working directory")),
2920 _("apply patch without touching the working directory")),
2921 ('', 'partial', None,
2921 ('', 'partial', None,
2922 _('commit even if some hunks fail')),
2922 _('commit even if some hunks fail')),
2923 ('', 'exact', None,
2923 ('', 'exact', None,
2924 _('abort if patch would apply lossily')),
2924 _('abort if patch would apply lossily')),
2925 ('', 'prefix', '',
2925 ('', 'prefix', '',
2926 _('apply patch to subdirectory'), _('DIR')),
2926 _('apply patch to subdirectory'), _('DIR')),
2927 ('', 'import-branch', None,
2927 ('', 'import-branch', None,
2928 _('use any branch information in patch (implied by --exact)'))] +
2928 _('use any branch information in patch (implied by --exact)'))] +
2929 commitopts + commitopts2 + similarityopts,
2929 commitopts + commitopts2 + similarityopts,
2930 _('[OPTION]... PATCH...'))
2930 _('[OPTION]... PATCH...'))
2931 def import_(ui, repo, patch1=None, *patches, **opts):
2931 def import_(ui, repo, patch1=None, *patches, **opts):
2932 """import an ordered set of patches
2932 """import an ordered set of patches
2933
2933
2934 Import a list of patches and commit them individually (unless
2934 Import a list of patches and commit them individually (unless
2935 --no-commit is specified).
2935 --no-commit is specified).
2936
2936
2937 To read a patch from standard input (stdin), use "-" as the patch
2937 To read a patch from standard input (stdin), use "-" as the patch
2938 name. If a URL is specified, the patch will be downloaded from
2938 name. If a URL is specified, the patch will be downloaded from
2939 there.
2939 there.
2940
2940
2941 Import first applies changes to the working directory (unless
2941 Import first applies changes to the working directory (unless
2942 --bypass is specified), import will abort if there are outstanding
2942 --bypass is specified), import will abort if there are outstanding
2943 changes.
2943 changes.
2944
2944
2945 Use --bypass to apply and commit patches directly to the
2945 Use --bypass to apply and commit patches directly to the
2946 repository, without affecting the working directory. Without
2946 repository, without affecting the working directory. Without
2947 --exact, patches will be applied on top of the working directory
2947 --exact, patches will be applied on top of the working directory
2948 parent revision.
2948 parent revision.
2949
2949
2950 You can import a patch straight from a mail message. Even patches
2950 You can import a patch straight from a mail message. Even patches
2951 as attachments work (to use the body part, it must have type
2951 as attachments work (to use the body part, it must have type
2952 text/plain or text/x-patch). From and Subject headers of email
2952 text/plain or text/x-patch). From and Subject headers of email
2953 message are used as default committer and commit message. All
2953 message are used as default committer and commit message. All
2954 text/plain body parts before first diff are added to the commit
2954 text/plain body parts before first diff are added to the commit
2955 message.
2955 message.
2956
2956
2957 If the imported patch was generated by :hg:`export`, user and
2957 If the imported patch was generated by :hg:`export`, user and
2958 description from patch override values from message headers and
2958 description from patch override values from message headers and
2959 body. Values given on command line with -m/--message and -u/--user
2959 body. Values given on command line with -m/--message and -u/--user
2960 override these.
2960 override these.
2961
2961
2962 If --exact is specified, import will set the working directory to
2962 If --exact is specified, import will set the working directory to
2963 the parent of each patch before applying it, and will abort if the
2963 the parent of each patch before applying it, and will abort if the
2964 resulting changeset has a different ID than the one recorded in
2964 resulting changeset has a different ID than the one recorded in
2965 the patch. This will guard against various ways that portable
2965 the patch. This will guard against various ways that portable
2966 patch formats and mail systems might fail to transfer Mercurial
2966 patch formats and mail systems might fail to transfer Mercurial
2967 data or metadata. See :hg:`bundle` for lossless transmission.
2967 data or metadata. See :hg:`bundle` for lossless transmission.
2968
2968
2969 Use --partial to ensure a changeset will be created from the patch
2969 Use --partial to ensure a changeset will be created from the patch
2970 even if some hunks fail to apply. Hunks that fail to apply will be
2970 even if some hunks fail to apply. Hunks that fail to apply will be
2971 written to a <target-file>.rej file. Conflicts can then be resolved
2971 written to a <target-file>.rej file. Conflicts can then be resolved
2972 by hand before :hg:`commit --amend` is run to update the created
2972 by hand before :hg:`commit --amend` is run to update the created
2973 changeset. This flag exists to let people import patches that
2973 changeset. This flag exists to let people import patches that
2974 partially apply without losing the associated metadata (author,
2974 partially apply without losing the associated metadata (author,
2975 date, description, ...).
2975 date, description, ...).
2976
2976
2977 .. note::
2977 .. note::
2978
2978
2979 When no hunks apply cleanly, :hg:`import --partial` will create
2979 When no hunks apply cleanly, :hg:`import --partial` will create
2980 an empty changeset, importing only the patch metadata.
2980 an empty changeset, importing only the patch metadata.
2981
2981
2982 With -s/--similarity, hg will attempt to discover renames and
2982 With -s/--similarity, hg will attempt to discover renames and
2983 copies in the patch in the same way as :hg:`addremove`.
2983 copies in the patch in the same way as :hg:`addremove`.
2984
2984
2985 It is possible to use external patch programs to perform the patch
2985 It is possible to use external patch programs to perform the patch
2986 by setting the ``ui.patch`` configuration option. For the default
2986 by setting the ``ui.patch`` configuration option. For the default
2987 internal tool, the fuzz can also be configured via ``patch.fuzz``.
2987 internal tool, the fuzz can also be configured via ``patch.fuzz``.
2988 See :hg:`help config` for more information about configuration
2988 See :hg:`help config` for more information about configuration
2989 files and how to use these options.
2989 files and how to use these options.
2990
2990
2991 See :hg:`help dates` for a list of formats valid for -d/--date.
2991 See :hg:`help dates` for a list of formats valid for -d/--date.
2992
2992
2993 .. container:: verbose
2993 .. container:: verbose
2994
2994
2995 Examples:
2995 Examples:
2996
2996
2997 - import a traditional patch from a website and detect renames::
2997 - import a traditional patch from a website and detect renames::
2998
2998
2999 hg import -s 80 http://example.com/bugfix.patch
2999 hg import -s 80 http://example.com/bugfix.patch
3000
3000
3001 - import a changeset from an hgweb server::
3001 - import a changeset from an hgweb server::
3002
3002
3003 hg import https://www.mercurial-scm.org/repo/hg/rev/5ca8c111e9aa
3003 hg import https://www.mercurial-scm.org/repo/hg/rev/5ca8c111e9aa
3004
3004
3005 - import all the patches in an Unix-style mbox::
3005 - import all the patches in an Unix-style mbox::
3006
3006
3007 hg import incoming-patches.mbox
3007 hg import incoming-patches.mbox
3008
3008
3009 - import patches from stdin::
3009 - import patches from stdin::
3010
3010
3011 hg import -
3011 hg import -
3012
3012
3013 - attempt to exactly restore an exported changeset (not always
3013 - attempt to exactly restore an exported changeset (not always
3014 possible)::
3014 possible)::
3015
3015
3016 hg import --exact proposed-fix.patch
3016 hg import --exact proposed-fix.patch
3017
3017
3018 - use an external tool to apply a patch which is too fuzzy for
3018 - use an external tool to apply a patch which is too fuzzy for
3019 the default internal tool.
3019 the default internal tool.
3020
3020
3021 hg import --config ui.patch="patch --merge" fuzzy.patch
3021 hg import --config ui.patch="patch --merge" fuzzy.patch
3022
3022
3023 - change the default fuzzing from 2 to a less strict 7
3023 - change the default fuzzing from 2 to a less strict 7
3024
3024
3025 hg import --config ui.fuzz=7 fuzz.patch
3025 hg import --config ui.fuzz=7 fuzz.patch
3026
3026
3027 Returns 0 on success, 1 on partial success (see --partial).
3027 Returns 0 on success, 1 on partial success (see --partial).
3028 """
3028 """
3029
3029
3030 if not patch1:
3030 if not patch1:
3031 raise error.Abort(_('need at least one patch to import'))
3031 raise error.Abort(_('need at least one patch to import'))
3032
3032
3033 patches = (patch1,) + patches
3033 patches = (patch1,) + patches
3034
3034
3035 date = opts.get('date')
3035 date = opts.get('date')
3036 if date:
3036 if date:
3037 opts['date'] = util.parsedate(date)
3037 opts['date'] = util.parsedate(date)
3038
3038
3039 exact = opts.get('exact')
3039 exact = opts.get('exact')
3040 update = not opts.get('bypass')
3040 update = not opts.get('bypass')
3041 if not update and opts.get('no_commit'):
3041 if not update and opts.get('no_commit'):
3042 raise error.Abort(_('cannot use --no-commit with --bypass'))
3042 raise error.Abort(_('cannot use --no-commit with --bypass'))
3043 try:
3043 try:
3044 sim = float(opts.get('similarity') or 0)
3044 sim = float(opts.get('similarity') or 0)
3045 except ValueError:
3045 except ValueError:
3046 raise error.Abort(_('similarity must be a number'))
3046 raise error.Abort(_('similarity must be a number'))
3047 if sim < 0 or sim > 100:
3047 if sim < 0 or sim > 100:
3048 raise error.Abort(_('similarity must be between 0 and 100'))
3048 raise error.Abort(_('similarity must be between 0 and 100'))
3049 if sim and not update:
3049 if sim and not update:
3050 raise error.Abort(_('cannot use --similarity with --bypass'))
3050 raise error.Abort(_('cannot use --similarity with --bypass'))
3051 if exact:
3051 if exact:
3052 if opts.get('edit'):
3052 if opts.get('edit'):
3053 raise error.Abort(_('cannot use --exact with --edit'))
3053 raise error.Abort(_('cannot use --exact with --edit'))
3054 if opts.get('prefix'):
3054 if opts.get('prefix'):
3055 raise error.Abort(_('cannot use --exact with --prefix'))
3055 raise error.Abort(_('cannot use --exact with --prefix'))
3056
3056
3057 base = opts["base"]
3057 base = opts["base"]
3058 wlock = dsguard = lock = tr = None
3058 wlock = dsguard = lock = tr = None
3059 msgs = []
3059 msgs = []
3060 ret = 0
3060 ret = 0
3061
3061
3062
3062
3063 try:
3063 try:
3064 wlock = repo.wlock()
3064 wlock = repo.wlock()
3065
3065
3066 if update:
3066 if update:
3067 cmdutil.checkunfinished(repo)
3067 cmdutil.checkunfinished(repo)
3068 if (exact or not opts.get('force')):
3068 if (exact or not opts.get('force')):
3069 cmdutil.bailifchanged(repo)
3069 cmdutil.bailifchanged(repo)
3070
3070
3071 if not opts.get('no_commit'):
3071 if not opts.get('no_commit'):
3072 lock = repo.lock()
3072 lock = repo.lock()
3073 tr = repo.transaction('import')
3073 tr = repo.transaction('import')
3074 else:
3074 else:
3075 dsguard = dirstateguard.dirstateguard(repo, 'import')
3075 dsguard = dirstateguard.dirstateguard(repo, 'import')
3076 parents = repo[None].parents()
3076 parents = repo[None].parents()
3077 for patchurl in patches:
3077 for patchurl in patches:
3078 if patchurl == '-':
3078 if patchurl == '-':
3079 ui.status(_('applying patch from stdin\n'))
3079 ui.status(_('applying patch from stdin\n'))
3080 patchfile = ui.fin
3080 patchfile = ui.fin
3081 patchurl = 'stdin' # for error message
3081 patchurl = 'stdin' # for error message
3082 else:
3082 else:
3083 patchurl = os.path.join(base, patchurl)
3083 patchurl = os.path.join(base, patchurl)
3084 ui.status(_('applying %s\n') % patchurl)
3084 ui.status(_('applying %s\n') % patchurl)
3085 patchfile = hg.openpath(ui, patchurl)
3085 patchfile = hg.openpath(ui, patchurl)
3086
3086
3087 haspatch = False
3087 haspatch = False
3088 for hunk in patch.split(patchfile):
3088 for hunk in patch.split(patchfile):
3089 (msg, node, rej) = cmdutil.tryimportone(ui, repo, hunk,
3089 (msg, node, rej) = cmdutil.tryimportone(ui, repo, hunk,
3090 parents, opts,
3090 parents, opts,
3091 msgs, hg.clean)
3091 msgs, hg.clean)
3092 if msg:
3092 if msg:
3093 haspatch = True
3093 haspatch = True
3094 ui.note(msg + '\n')
3094 ui.note(msg + '\n')
3095 if update or exact:
3095 if update or exact:
3096 parents = repo[None].parents()
3096 parents = repo[None].parents()
3097 else:
3097 else:
3098 parents = [repo[node]]
3098 parents = [repo[node]]
3099 if rej:
3099 if rej:
3100 ui.write_err(_("patch applied partially\n"))
3100 ui.write_err(_("patch applied partially\n"))
3101 ui.write_err(_("(fix the .rej files and run "
3101 ui.write_err(_("(fix the .rej files and run "
3102 "`hg commit --amend`)\n"))
3102 "`hg commit --amend`)\n"))
3103 ret = 1
3103 ret = 1
3104 break
3104 break
3105
3105
3106 if not haspatch:
3106 if not haspatch:
3107 raise error.Abort(_('%s: no diffs found') % patchurl)
3107 raise error.Abort(_('%s: no diffs found') % patchurl)
3108
3108
3109 if tr:
3109 if tr:
3110 tr.close()
3110 tr.close()
3111 if msgs:
3111 if msgs:
3112 repo.savecommitmessage('\n* * *\n'.join(msgs))
3112 repo.savecommitmessage('\n* * *\n'.join(msgs))
3113 if dsguard:
3113 if dsguard:
3114 dsguard.close()
3114 dsguard.close()
3115 return ret
3115 return ret
3116 finally:
3116 finally:
3117 if tr:
3117 if tr:
3118 tr.release()
3118 tr.release()
3119 release(lock, dsguard, wlock)
3119 release(lock, dsguard, wlock)
3120
3120
3121 @command('incoming|in',
3121 @command('incoming|in',
3122 [('f', 'force', None,
3122 [('f', 'force', None,
3123 _('run even if remote repository is unrelated')),
3123 _('run even if remote repository is unrelated')),
3124 ('n', 'newest-first', None, _('show newest record first')),
3124 ('n', 'newest-first', None, _('show newest record first')),
3125 ('', 'bundle', '',
3125 ('', 'bundle', '',
3126 _('file to store the bundles into'), _('FILE')),
3126 _('file to store the bundles into'), _('FILE')),
3127 ('r', 'rev', [], _('a remote changeset intended to be added'), _('REV')),
3127 ('r', 'rev', [], _('a remote changeset intended to be added'), _('REV')),
3128 ('B', 'bookmarks', False, _("compare bookmarks")),
3128 ('B', 'bookmarks', False, _("compare bookmarks")),
3129 ('b', 'branch', [],
3129 ('b', 'branch', [],
3130 _('a specific branch you would like to pull'), _('BRANCH')),
3130 _('a specific branch you would like to pull'), _('BRANCH')),
3131 ] + logopts + remoteopts + subrepoopts,
3131 ] + logopts + remoteopts + subrepoopts,
3132 _('[-p] [-n] [-M] [-f] [-r REV]... [--bundle FILENAME] [SOURCE]'))
3132 _('[-p] [-n] [-M] [-f] [-r REV]... [--bundle FILENAME] [SOURCE]'))
3133 def incoming(ui, repo, source="default", **opts):
3133 def incoming(ui, repo, source="default", **opts):
3134 """show new changesets found in source
3134 """show new changesets found in source
3135
3135
3136 Show new changesets found in the specified path/URL or the default
3136 Show new changesets found in the specified path/URL or the default
3137 pull location. These are the changesets that would have been pulled
3137 pull location. These are the changesets that would have been pulled
3138 if a pull at the time you issued this command.
3138 if a pull at the time you issued this command.
3139
3139
3140 See pull for valid source format details.
3140 See pull for valid source format details.
3141
3141
3142 .. container:: verbose
3142 .. container:: verbose
3143
3143
3144 With -B/--bookmarks, the result of bookmark comparison between
3144 With -B/--bookmarks, the result of bookmark comparison between
3145 local and remote repositories is displayed. With -v/--verbose,
3145 local and remote repositories is displayed. With -v/--verbose,
3146 status is also displayed for each bookmark like below::
3146 status is also displayed for each bookmark like below::
3147
3147
3148 BM1 01234567890a added
3148 BM1 01234567890a added
3149 BM2 1234567890ab advanced
3149 BM2 1234567890ab advanced
3150 BM3 234567890abc diverged
3150 BM3 234567890abc diverged
3151 BM4 34567890abcd changed
3151 BM4 34567890abcd changed
3152
3152
3153 The action taken locally when pulling depends on the
3153 The action taken locally when pulling depends on the
3154 status of each bookmark:
3154 status of each bookmark:
3155
3155
3156 :``added``: pull will create it
3156 :``added``: pull will create it
3157 :``advanced``: pull will update it
3157 :``advanced``: pull will update it
3158 :``diverged``: pull will create a divergent bookmark
3158 :``diverged``: pull will create a divergent bookmark
3159 :``changed``: result depends on remote changesets
3159 :``changed``: result depends on remote changesets
3160
3160
3161 From the point of view of pulling behavior, bookmark
3161 From the point of view of pulling behavior, bookmark
3162 existing only in the remote repository are treated as ``added``,
3162 existing only in the remote repository are treated as ``added``,
3163 even if it is in fact locally deleted.
3163 even if it is in fact locally deleted.
3164
3164
3165 .. container:: verbose
3165 .. container:: verbose
3166
3166
3167 For remote repository, using --bundle avoids downloading the
3167 For remote repository, using --bundle avoids downloading the
3168 changesets twice if the incoming is followed by a pull.
3168 changesets twice if the incoming is followed by a pull.
3169
3169
3170 Examples:
3170 Examples:
3171
3171
3172 - show incoming changes with patches and full description::
3172 - show incoming changes with patches and full description::
3173
3173
3174 hg incoming -vp
3174 hg incoming -vp
3175
3175
3176 - show incoming changes excluding merges, store a bundle::
3176 - show incoming changes excluding merges, store a bundle::
3177
3177
3178 hg in -vpM --bundle incoming.hg
3178 hg in -vpM --bundle incoming.hg
3179 hg pull incoming.hg
3179 hg pull incoming.hg
3180
3180
3181 - briefly list changes inside a bundle::
3181 - briefly list changes inside a bundle::
3182
3182
3183 hg in changes.hg -T "{desc|firstline}\\n"
3183 hg in changes.hg -T "{desc|firstline}\\n"
3184
3184
3185 Returns 0 if there are incoming changes, 1 otherwise.
3185 Returns 0 if there are incoming changes, 1 otherwise.
3186 """
3186 """
3187 if opts.get('graph'):
3187 if opts.get('graph'):
3188 cmdutil.checkunsupportedgraphflags([], opts)
3188 cmdutil.checkunsupportedgraphflags([], opts)
3189 def display(other, chlist, displayer):
3189 def display(other, chlist, displayer):
3190 revdag = cmdutil.graphrevs(other, chlist, opts)
3190 revdag = cmdutil.graphrevs(other, chlist, opts)
3191 cmdutil.displaygraph(ui, repo, revdag, displayer,
3191 cmdutil.displaygraph(ui, repo, revdag, displayer,
3192 graphmod.asciiedges)
3192 graphmod.asciiedges)
3193
3193
3194 hg._incoming(display, lambda: 1, ui, repo, source, opts, buffered=True)
3194 hg._incoming(display, lambda: 1, ui, repo, source, opts, buffered=True)
3195 return 0
3195 return 0
3196
3196
3197 if opts.get('bundle') and opts.get('subrepos'):
3197 if opts.get('bundle') and opts.get('subrepos'):
3198 raise error.Abort(_('cannot combine --bundle and --subrepos'))
3198 raise error.Abort(_('cannot combine --bundle and --subrepos'))
3199
3199
3200 if opts.get('bookmarks'):
3200 if opts.get('bookmarks'):
3201 source, branches = hg.parseurl(ui.expandpath(source),
3201 source, branches = hg.parseurl(ui.expandpath(source),
3202 opts.get('branch'))
3202 opts.get('branch'))
3203 other = hg.peer(repo, opts, source)
3203 other = hg.peer(repo, opts, source)
3204 if 'bookmarks' not in other.listkeys('namespaces'):
3204 if 'bookmarks' not in other.listkeys('namespaces'):
3205 ui.warn(_("remote doesn't support bookmarks\n"))
3205 ui.warn(_("remote doesn't support bookmarks\n"))
3206 return 0
3206 return 0
3207 ui.pager('incoming')
3207 ui.pager('incoming')
3208 ui.status(_('comparing with %s\n') % util.hidepassword(source))
3208 ui.status(_('comparing with %s\n') % util.hidepassword(source))
3209 return bookmarks.incoming(ui, repo, other)
3209 return bookmarks.incoming(ui, repo, other)
3210
3210
3211 repo._subtoppath = ui.expandpath(source)
3211 repo._subtoppath = ui.expandpath(source)
3212 try:
3212 try:
3213 return hg.incoming(ui, repo, source, opts)
3213 return hg.incoming(ui, repo, source, opts)
3214 finally:
3214 finally:
3215 del repo._subtoppath
3215 del repo._subtoppath
3216
3216
3217
3217
3218 @command('^init', remoteopts, _('[-e CMD] [--remotecmd CMD] [DEST]'),
3218 @command('^init', remoteopts, _('[-e CMD] [--remotecmd CMD] [DEST]'),
3219 norepo=True)
3219 norepo=True)
3220 def init(ui, dest=".", **opts):
3220 def init(ui, dest=".", **opts):
3221 """create a new repository in the given directory
3221 """create a new repository in the given directory
3222
3222
3223 Initialize a new repository in the given directory. If the given
3223 Initialize a new repository in the given directory. If the given
3224 directory does not exist, it will be created.
3224 directory does not exist, it will be created.
3225
3225
3226 If no directory is given, the current directory is used.
3226 If no directory is given, the current directory is used.
3227
3227
3228 It is possible to specify an ``ssh://`` URL as the destination.
3228 It is possible to specify an ``ssh://`` URL as the destination.
3229 See :hg:`help urls` for more information.
3229 See :hg:`help urls` for more information.
3230
3230
3231 Returns 0 on success.
3231 Returns 0 on success.
3232 """
3232 """
3233 hg.peer(ui, opts, ui.expandpath(dest), create=True)
3233 hg.peer(ui, opts, ui.expandpath(dest), create=True)
3234
3234
3235 @command('locate',
3235 @command('locate',
3236 [('r', 'rev', '', _('search the repository as it is in REV'), _('REV')),
3236 [('r', 'rev', '', _('search the repository as it is in REV'), _('REV')),
3237 ('0', 'print0', None, _('end filenames with NUL, for use with xargs')),
3237 ('0', 'print0', None, _('end filenames with NUL, for use with xargs')),
3238 ('f', 'fullpath', None, _('print complete paths from the filesystem root')),
3238 ('f', 'fullpath', None, _('print complete paths from the filesystem root')),
3239 ] + walkopts,
3239 ] + walkopts,
3240 _('[OPTION]... [PATTERN]...'))
3240 _('[OPTION]... [PATTERN]...'))
3241 def locate(ui, repo, *pats, **opts):
3241 def locate(ui, repo, *pats, **opts):
3242 """locate files matching specific patterns (DEPRECATED)
3242 """locate files matching specific patterns (DEPRECATED)
3243
3243
3244 Print files under Mercurial control in the working directory whose
3244 Print files under Mercurial control in the working directory whose
3245 names match the given patterns.
3245 names match the given patterns.
3246
3246
3247 By default, this command searches all directories in the working
3247 By default, this command searches all directories in the working
3248 directory. To search just the current directory and its
3248 directory. To search just the current directory and its
3249 subdirectories, use "--include .".
3249 subdirectories, use "--include .".
3250
3250
3251 If no patterns are given to match, this command prints the names
3251 If no patterns are given to match, this command prints the names
3252 of all files under Mercurial control in the working directory.
3252 of all files under Mercurial control in the working directory.
3253
3253
3254 If you want to feed the output of this command into the "xargs"
3254 If you want to feed the output of this command into the "xargs"
3255 command, use the -0 option to both this command and "xargs". This
3255 command, use the -0 option to both this command and "xargs". This
3256 will avoid the problem of "xargs" treating single filenames that
3256 will avoid the problem of "xargs" treating single filenames that
3257 contain whitespace as multiple filenames.
3257 contain whitespace as multiple filenames.
3258
3258
3259 See :hg:`help files` for a more versatile command.
3259 See :hg:`help files` for a more versatile command.
3260
3260
3261 Returns 0 if a match is found, 1 otherwise.
3261 Returns 0 if a match is found, 1 otherwise.
3262 """
3262 """
3263 if opts.get('print0'):
3263 if opts.get('print0'):
3264 end = '\0'
3264 end = '\0'
3265 else:
3265 else:
3266 end = '\n'
3266 end = '\n'
3267 rev = scmutil.revsingle(repo, opts.get('rev'), None).node()
3267 rev = scmutil.revsingle(repo, opts.get('rev'), None).node()
3268
3268
3269 ret = 1
3269 ret = 1
3270 ctx = repo[rev]
3270 ctx = repo[rev]
3271 m = scmutil.match(ctx, pats, opts, default='relglob',
3271 m = scmutil.match(ctx, pats, opts, default='relglob',
3272 badfn=lambda x, y: False)
3272 badfn=lambda x, y: False)
3273
3273
3274 ui.pager('locate')
3274 ui.pager('locate')
3275 for abs in ctx.matches(m):
3275 for abs in ctx.matches(m):
3276 if opts.get('fullpath'):
3276 if opts.get('fullpath'):
3277 ui.write(repo.wjoin(abs), end)
3277 ui.write(repo.wjoin(abs), end)
3278 else:
3278 else:
3279 ui.write(((pats and m.rel(abs)) or abs), end)
3279 ui.write(((pats and m.rel(abs)) or abs), end)
3280 ret = 0
3280 ret = 0
3281
3281
3282 return ret
3282 return ret
3283
3283
3284 @command('^log|history',
3284 @command('^log|history',
3285 [('f', 'follow', None,
3285 [('f', 'follow', None,
3286 _('follow changeset history, or file history across copies and renames')),
3286 _('follow changeset history, or file history across copies and renames')),
3287 ('', 'follow-first', None,
3287 ('', 'follow-first', None,
3288 _('only follow the first parent of merge changesets (DEPRECATED)')),
3288 _('only follow the first parent of merge changesets (DEPRECATED)')),
3289 ('d', 'date', '', _('show revisions matching date spec'), _('DATE')),
3289 ('d', 'date', '', _('show revisions matching date spec'), _('DATE')),
3290 ('C', 'copies', None, _('show copied files')),
3290 ('C', 'copies', None, _('show copied files')),
3291 ('k', 'keyword', [],
3291 ('k', 'keyword', [],
3292 _('do case-insensitive search for a given text'), _('TEXT')),
3292 _('do case-insensitive search for a given text'), _('TEXT')),
3293 ('r', 'rev', [], _('show the specified revision or revset'), _('REV')),
3293 ('r', 'rev', [], _('show the specified revision or revset'), _('REV')),
3294 ('', 'removed', None, _('include revisions where files were removed')),
3294 ('', 'removed', None, _('include revisions where files were removed')),
3295 ('m', 'only-merges', None, _('show only merges (DEPRECATED)')),
3295 ('m', 'only-merges', None, _('show only merges (DEPRECATED)')),
3296 ('u', 'user', [], _('revisions committed by user'), _('USER')),
3296 ('u', 'user', [], _('revisions committed by user'), _('USER')),
3297 ('', 'only-branch', [],
3297 ('', 'only-branch', [],
3298 _('show only changesets within the given named branch (DEPRECATED)'),
3298 _('show only changesets within the given named branch (DEPRECATED)'),
3299 _('BRANCH')),
3299 _('BRANCH')),
3300 ('b', 'branch', [],
3300 ('b', 'branch', [],
3301 _('show changesets within the given named branch'), _('BRANCH')),
3301 _('show changesets within the given named branch'), _('BRANCH')),
3302 ('P', 'prune', [],
3302 ('P', 'prune', [],
3303 _('do not display revision or any of its ancestors'), _('REV')),
3303 _('do not display revision or any of its ancestors'), _('REV')),
3304 ] + logopts + walkopts,
3304 ] + logopts + walkopts,
3305 _('[OPTION]... [FILE]'),
3305 _('[OPTION]... [FILE]'),
3306 inferrepo=True)
3306 inferrepo=True)
3307 def log(ui, repo, *pats, **opts):
3307 def log(ui, repo, *pats, **opts):
3308 """show revision history of entire repository or files
3308 """show revision history of entire repository or files
3309
3309
3310 Print the revision history of the specified files or the entire
3310 Print the revision history of the specified files or the entire
3311 project.
3311 project.
3312
3312
3313 If no revision range is specified, the default is ``tip:0`` unless
3313 If no revision range is specified, the default is ``tip:0`` unless
3314 --follow is set, in which case the working directory parent is
3314 --follow is set, in which case the working directory parent is
3315 used as the starting revision.
3315 used as the starting revision.
3316
3316
3317 File history is shown without following rename or copy history of
3317 File history is shown without following rename or copy history of
3318 files. Use -f/--follow with a filename to follow history across
3318 files. Use -f/--follow with a filename to follow history across
3319 renames and copies. --follow without a filename will only show
3319 renames and copies. --follow without a filename will only show
3320 ancestors or descendants of the starting revision.
3320 ancestors or descendants of the starting revision.
3321
3321
3322 By default this command prints revision number and changeset id,
3322 By default this command prints revision number and changeset id,
3323 tags, non-trivial parents, user, date and time, and a summary for
3323 tags, non-trivial parents, user, date and time, and a summary for
3324 each commit. When the -v/--verbose switch is used, the list of
3324 each commit. When the -v/--verbose switch is used, the list of
3325 changed files and full commit message are shown.
3325 changed files and full commit message are shown.
3326
3326
3327 With --graph the revisions are shown as an ASCII art DAG with the most
3327 With --graph the revisions are shown as an ASCII art DAG with the most
3328 recent changeset at the top.
3328 recent changeset at the top.
3329 'o' is a changeset, '@' is a working directory parent, 'x' is obsolete,
3329 'o' is a changeset, '@' is a working directory parent, 'x' is obsolete,
3330 and '+' represents a fork where the changeset from the lines below is a
3330 and '+' represents a fork where the changeset from the lines below is a
3331 parent of the 'o' merge on the same line.
3331 parent of the 'o' merge on the same line.
3332
3332
3333 .. note::
3333 .. note::
3334
3334
3335 :hg:`log --patch` may generate unexpected diff output for merge
3335 :hg:`log --patch` may generate unexpected diff output for merge
3336 changesets, as it will only compare the merge changeset against
3336 changesets, as it will only compare the merge changeset against
3337 its first parent. Also, only files different from BOTH parents
3337 its first parent. Also, only files different from BOTH parents
3338 will appear in files:.
3338 will appear in files:.
3339
3339
3340 .. note::
3340 .. note::
3341
3341
3342 For performance reasons, :hg:`log FILE` may omit duplicate changes
3342 For performance reasons, :hg:`log FILE` may omit duplicate changes
3343 made on branches and will not show removals or mode changes. To
3343 made on branches and will not show removals or mode changes. To
3344 see all such changes, use the --removed switch.
3344 see all such changes, use the --removed switch.
3345
3345
3346 .. container:: verbose
3346 .. container:: verbose
3347
3347
3348 Some examples:
3348 Some examples:
3349
3349
3350 - changesets with full descriptions and file lists::
3350 - changesets with full descriptions and file lists::
3351
3351
3352 hg log -v
3352 hg log -v
3353
3353
3354 - changesets ancestral to the working directory::
3354 - changesets ancestral to the working directory::
3355
3355
3356 hg log -f
3356 hg log -f
3357
3357
3358 - last 10 commits on the current branch::
3358 - last 10 commits on the current branch::
3359
3359
3360 hg log -l 10 -b .
3360 hg log -l 10 -b .
3361
3361
3362 - changesets showing all modifications of a file, including removals::
3362 - changesets showing all modifications of a file, including removals::
3363
3363
3364 hg log --removed file.c
3364 hg log --removed file.c
3365
3365
3366 - all changesets that touch a directory, with diffs, excluding merges::
3366 - all changesets that touch a directory, with diffs, excluding merges::
3367
3367
3368 hg log -Mp lib/
3368 hg log -Mp lib/
3369
3369
3370 - all revision numbers that match a keyword::
3370 - all revision numbers that match a keyword::
3371
3371
3372 hg log -k bug --template "{rev}\\n"
3372 hg log -k bug --template "{rev}\\n"
3373
3373
3374 - the full hash identifier of the working directory parent::
3374 - the full hash identifier of the working directory parent::
3375
3375
3376 hg log -r . --template "{node}\\n"
3376 hg log -r . --template "{node}\\n"
3377
3377
3378 - list available log templates::
3378 - list available log templates::
3379
3379
3380 hg log -T list
3380 hg log -T list
3381
3381
3382 - check if a given changeset is included in a tagged release::
3382 - check if a given changeset is included in a tagged release::
3383
3383
3384 hg log -r "a21ccf and ancestor(1.9)"
3384 hg log -r "a21ccf and ancestor(1.9)"
3385
3385
3386 - find all changesets by some user in a date range::
3386 - find all changesets by some user in a date range::
3387
3387
3388 hg log -k alice -d "may 2008 to jul 2008"
3388 hg log -k alice -d "may 2008 to jul 2008"
3389
3389
3390 - summary of all changesets after the last tag::
3390 - summary of all changesets after the last tag::
3391
3391
3392 hg log -r "last(tagged())::" --template "{desc|firstline}\\n"
3392 hg log -r "last(tagged())::" --template "{desc|firstline}\\n"
3393
3393
3394 See :hg:`help dates` for a list of formats valid for -d/--date.
3394 See :hg:`help dates` for a list of formats valid for -d/--date.
3395
3395
3396 See :hg:`help revisions` for more about specifying and ordering
3396 See :hg:`help revisions` for more about specifying and ordering
3397 revisions.
3397 revisions.
3398
3398
3399 See :hg:`help templates` for more about pre-packaged styles and
3399 See :hg:`help templates` for more about pre-packaged styles and
3400 specifying custom templates.
3400 specifying custom templates.
3401
3401
3402 Returns 0 on success.
3402 Returns 0 on success.
3403
3403
3404 """
3404 """
3405 opts = pycompat.byteskwargs(opts)
3405 opts = pycompat.byteskwargs(opts)
3406 if opts.get('follow') and opts.get('rev'):
3406 if opts.get('follow') and opts.get('rev'):
3407 opts['rev'] = [revsetlang.formatspec('reverse(::%lr)', opts.get('rev'))]
3407 opts['rev'] = [revsetlang.formatspec('reverse(::%lr)', opts.get('rev'))]
3408 del opts['follow']
3408 del opts['follow']
3409
3409
3410 if opts.get('graph'):
3410 if opts.get('graph'):
3411 return cmdutil.graphlog(ui, repo, pats, opts)
3411 return cmdutil.graphlog(ui, repo, pats, opts)
3412
3412
3413 revs, expr, filematcher = cmdutil.getlogrevs(repo, pats, opts)
3413 revs, expr, filematcher = cmdutil.getlogrevs(repo, pats, opts)
3414 limit = cmdutil.loglimit(opts)
3414 limit = cmdutil.loglimit(opts)
3415 count = 0
3415 count = 0
3416
3416
3417 getrenamed = None
3417 getrenamed = None
3418 if opts.get('copies'):
3418 if opts.get('copies'):
3419 endrev = None
3419 endrev = None
3420 if opts.get('rev'):
3420 if opts.get('rev'):
3421 endrev = scmutil.revrange(repo, opts.get('rev')).max() + 1
3421 endrev = scmutil.revrange(repo, opts.get('rev')).max() + 1
3422 getrenamed = templatekw.getrenamedfn(repo, endrev=endrev)
3422 getrenamed = templatekw.getrenamedfn(repo, endrev=endrev)
3423
3423
3424 ui.pager('log')
3424 ui.pager('log')
3425 displayer = cmdutil.show_changeset(ui, repo, opts, buffered=True)
3425 displayer = cmdutil.show_changeset(ui, repo, opts, buffered=True)
3426 for rev in revs:
3426 for rev in revs:
3427 if count == limit:
3427 if count == limit:
3428 break
3428 break
3429 ctx = repo[rev]
3429 ctx = repo[rev]
3430 copies = None
3430 copies = None
3431 if getrenamed is not None and rev:
3431 if getrenamed is not None and rev:
3432 copies = []
3432 copies = []
3433 for fn in ctx.files():
3433 for fn in ctx.files():
3434 rename = getrenamed(fn, rev)
3434 rename = getrenamed(fn, rev)
3435 if rename:
3435 if rename:
3436 copies.append((fn, rename[0]))
3436 copies.append((fn, rename[0]))
3437 if filematcher:
3437 if filematcher:
3438 revmatchfn = filematcher(ctx.rev())
3438 revmatchfn = filematcher(ctx.rev())
3439 else:
3439 else:
3440 revmatchfn = None
3440 revmatchfn = None
3441 displayer.show(ctx, copies=copies, matchfn=revmatchfn)
3441 displayer.show(ctx, copies=copies, matchfn=revmatchfn)
3442 if displayer.flush(ctx):
3442 if displayer.flush(ctx):
3443 count += 1
3443 count += 1
3444
3444
3445 displayer.close()
3445 displayer.close()
3446
3446
3447 @command('manifest',
3447 @command('manifest',
3448 [('r', 'rev', '', _('revision to display'), _('REV')),
3448 [('r', 'rev', '', _('revision to display'), _('REV')),
3449 ('', 'all', False, _("list files from all revisions"))]
3449 ('', 'all', False, _("list files from all revisions"))]
3450 + formatteropts,
3450 + formatteropts,
3451 _('[-r REV]'))
3451 _('[-r REV]'))
3452 def manifest(ui, repo, node=None, rev=None, **opts):
3452 def manifest(ui, repo, node=None, rev=None, **opts):
3453 """output the current or given revision of the project manifest
3453 """output the current or given revision of the project manifest
3454
3454
3455 Print a list of version controlled files for the given revision.
3455 Print a list of version controlled files for the given revision.
3456 If no revision is given, the first parent of the working directory
3456 If no revision is given, the first parent of the working directory
3457 is used, or the null revision if no revision is checked out.
3457 is used, or the null revision if no revision is checked out.
3458
3458
3459 With -v, print file permissions, symlink and executable bits.
3459 With -v, print file permissions, symlink and executable bits.
3460 With --debug, print file revision hashes.
3460 With --debug, print file revision hashes.
3461
3461
3462 If option --all is specified, the list of all files from all revisions
3462 If option --all is specified, the list of all files from all revisions
3463 is printed. This includes deleted and renamed files.
3463 is printed. This includes deleted and renamed files.
3464
3464
3465 Returns 0 on success.
3465 Returns 0 on success.
3466 """
3466 """
3467 fm = ui.formatter('manifest', opts)
3467 fm = ui.formatter('manifest', opts)
3468
3468
3469 if opts.get('all'):
3469 if opts.get('all'):
3470 if rev or node:
3470 if rev or node:
3471 raise error.Abort(_("can't specify a revision with --all"))
3471 raise error.Abort(_("can't specify a revision with --all"))
3472
3472
3473 res = []
3473 res = []
3474 prefix = "data/"
3474 prefix = "data/"
3475 suffix = ".i"
3475 suffix = ".i"
3476 plen = len(prefix)
3476 plen = len(prefix)
3477 slen = len(suffix)
3477 slen = len(suffix)
3478 with repo.lock():
3478 with repo.lock():
3479 for fn, b, size in repo.store.datafiles():
3479 for fn, b, size in repo.store.datafiles():
3480 if size != 0 and fn[-slen:] == suffix and fn[:plen] == prefix:
3480 if size != 0 and fn[-slen:] == suffix and fn[:plen] == prefix:
3481 res.append(fn[plen:-slen])
3481 res.append(fn[plen:-slen])
3482 ui.pager('manifest')
3482 ui.pager('manifest')
3483 for f in res:
3483 for f in res:
3484 fm.startitem()
3484 fm.startitem()
3485 fm.write("path", '%s\n', f)
3485 fm.write("path", '%s\n', f)
3486 fm.end()
3486 fm.end()
3487 return
3487 return
3488
3488
3489 if rev and node:
3489 if rev and node:
3490 raise error.Abort(_("please specify just one revision"))
3490 raise error.Abort(_("please specify just one revision"))
3491
3491
3492 if not node:
3492 if not node:
3493 node = rev
3493 node = rev
3494
3494
3495 char = {'l': '@', 'x': '*', '': ''}
3495 char = {'l': '@', 'x': '*', '': ''}
3496 mode = {'l': '644', 'x': '755', '': '644'}
3496 mode = {'l': '644', 'x': '755', '': '644'}
3497 ctx = scmutil.revsingle(repo, node)
3497 ctx = scmutil.revsingle(repo, node)
3498 mf = ctx.manifest()
3498 mf = ctx.manifest()
3499 ui.pager('manifest')
3499 ui.pager('manifest')
3500 for f in ctx:
3500 for f in ctx:
3501 fm.startitem()
3501 fm.startitem()
3502 fl = ctx[f].flags()
3502 fl = ctx[f].flags()
3503 fm.condwrite(ui.debugflag, 'hash', '%s ', hex(mf[f]))
3503 fm.condwrite(ui.debugflag, 'hash', '%s ', hex(mf[f]))
3504 fm.condwrite(ui.verbose, 'mode type', '%s %1s ', mode[fl], char[fl])
3504 fm.condwrite(ui.verbose, 'mode type', '%s %1s ', mode[fl], char[fl])
3505 fm.write('path', '%s\n', f)
3505 fm.write('path', '%s\n', f)
3506 fm.end()
3506 fm.end()
3507
3507
3508 @command('^merge',
3508 @command('^merge',
3509 [('f', 'force', None,
3509 [('f', 'force', None,
3510 _('force a merge including outstanding changes (DEPRECATED)')),
3510 _('force a merge including outstanding changes (DEPRECATED)')),
3511 ('r', 'rev', '', _('revision to merge'), _('REV')),
3511 ('r', 'rev', '', _('revision to merge'), _('REV')),
3512 ('P', 'preview', None,
3512 ('P', 'preview', None,
3513 _('review revisions to merge (no merge is performed)'))
3513 _('review revisions to merge (no merge is performed)'))
3514 ] + mergetoolopts,
3514 ] + mergetoolopts,
3515 _('[-P] [[-r] REV]'))
3515 _('[-P] [[-r] REV]'))
3516 def merge(ui, repo, node=None, **opts):
3516 def merge(ui, repo, node=None, **opts):
3517 """merge another revision into working directory
3517 """merge another revision into working directory
3518
3518
3519 The current working directory is updated with all changes made in
3519 The current working directory is updated with all changes made in
3520 the requested revision since the last common predecessor revision.
3520 the requested revision since the last common predecessor revision.
3521
3521
3522 Files that changed between either parent are marked as changed for
3522 Files that changed between either parent are marked as changed for
3523 the next commit and a commit must be performed before any further
3523 the next commit and a commit must be performed before any further
3524 updates to the repository are allowed. The next commit will have
3524 updates to the repository are allowed. The next commit will have
3525 two parents.
3525 two parents.
3526
3526
3527 ``--tool`` can be used to specify the merge tool used for file
3527 ``--tool`` can be used to specify the merge tool used for file
3528 merges. It overrides the HGMERGE environment variable and your
3528 merges. It overrides the HGMERGE environment variable and your
3529 configuration files. See :hg:`help merge-tools` for options.
3529 configuration files. See :hg:`help merge-tools` for options.
3530
3530
3531 If no revision is specified, the working directory's parent is a
3531 If no revision is specified, the working directory's parent is a
3532 head revision, and the current branch contains exactly one other
3532 head revision, and the current branch contains exactly one other
3533 head, the other head is merged with by default. Otherwise, an
3533 head, the other head is merged with by default. Otherwise, an
3534 explicit revision with which to merge with must be provided.
3534 explicit revision with which to merge with must be provided.
3535
3535
3536 See :hg:`help resolve` for information on handling file conflicts.
3536 See :hg:`help resolve` for information on handling file conflicts.
3537
3537
3538 To undo an uncommitted merge, use :hg:`update --clean .` which
3538 To undo an uncommitted merge, use :hg:`update --clean .` which
3539 will check out a clean copy of the original merge parent, losing
3539 will check out a clean copy of the original merge parent, losing
3540 all changes.
3540 all changes.
3541
3541
3542 Returns 0 on success, 1 if there are unresolved files.
3542 Returns 0 on success, 1 if there are unresolved files.
3543 """
3543 """
3544
3544
3545 if opts.get('rev') and node:
3545 if opts.get('rev') and node:
3546 raise error.Abort(_("please specify just one revision"))
3546 raise error.Abort(_("please specify just one revision"))
3547 if not node:
3547 if not node:
3548 node = opts.get('rev')
3548 node = opts.get('rev')
3549
3549
3550 if node:
3550 if node:
3551 node = scmutil.revsingle(repo, node).node()
3551 node = scmutil.revsingle(repo, node).node()
3552
3552
3553 if not node:
3553 if not node:
3554 node = repo[destutil.destmerge(repo)].node()
3554 node = repo[destutil.destmerge(repo)].node()
3555
3555
3556 if opts.get('preview'):
3556 if opts.get('preview'):
3557 # find nodes that are ancestors of p2 but not of p1
3557 # find nodes that are ancestors of p2 but not of p1
3558 p1 = repo.lookup('.')
3558 p1 = repo.lookup('.')
3559 p2 = repo.lookup(node)
3559 p2 = repo.lookup(node)
3560 nodes = repo.changelog.findmissing(common=[p1], heads=[p2])
3560 nodes = repo.changelog.findmissing(common=[p1], heads=[p2])
3561
3561
3562 displayer = cmdutil.show_changeset(ui, repo, opts)
3562 displayer = cmdutil.show_changeset(ui, repo, opts)
3563 for node in nodes:
3563 for node in nodes:
3564 displayer.show(repo[node])
3564 displayer.show(repo[node])
3565 displayer.close()
3565 displayer.close()
3566 return 0
3566 return 0
3567
3567
3568 try:
3568 try:
3569 # ui.forcemerge is an internal variable, do not document
3569 # ui.forcemerge is an internal variable, do not document
3570 repo.ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), 'merge')
3570 repo.ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), 'merge')
3571 force = opts.get('force')
3571 force = opts.get('force')
3572 labels = ['working copy', 'merge rev']
3572 labels = ['working copy', 'merge rev']
3573 return hg.merge(repo, node, force=force, mergeforce=force,
3573 return hg.merge(repo, node, force=force, mergeforce=force,
3574 labels=labels)
3574 labels=labels)
3575 finally:
3575 finally:
3576 ui.setconfig('ui', 'forcemerge', '', 'merge')
3576 ui.setconfig('ui', 'forcemerge', '', 'merge')
3577
3577
3578 @command('outgoing|out',
3578 @command('outgoing|out',
3579 [('f', 'force', None, _('run even when the destination is unrelated')),
3579 [('f', 'force', None, _('run even when the destination is unrelated')),
3580 ('r', 'rev', [],
3580 ('r', 'rev', [],
3581 _('a changeset intended to be included in the destination'), _('REV')),
3581 _('a changeset intended to be included in the destination'), _('REV')),
3582 ('n', 'newest-first', None, _('show newest record first')),
3582 ('n', 'newest-first', None, _('show newest record first')),
3583 ('B', 'bookmarks', False, _('compare bookmarks')),
3583 ('B', 'bookmarks', False, _('compare bookmarks')),
3584 ('b', 'branch', [], _('a specific branch you would like to push'),
3584 ('b', 'branch', [], _('a specific branch you would like to push'),
3585 _('BRANCH')),
3585 _('BRANCH')),
3586 ] + logopts + remoteopts + subrepoopts,
3586 ] + logopts + remoteopts + subrepoopts,
3587 _('[-M] [-p] [-n] [-f] [-r REV]... [DEST]'))
3587 _('[-M] [-p] [-n] [-f] [-r REV]... [DEST]'))
3588 def outgoing(ui, repo, dest=None, **opts):
3588 def outgoing(ui, repo, dest=None, **opts):
3589 """show changesets not found in the destination
3589 """show changesets not found in the destination
3590
3590
3591 Show changesets not found in the specified destination repository
3591 Show changesets not found in the specified destination repository
3592 or the default push location. These are the changesets that would
3592 or the default push location. These are the changesets that would
3593 be pushed if a push was requested.
3593 be pushed if a push was requested.
3594
3594
3595 See pull for details of valid destination formats.
3595 See pull for details of valid destination formats.
3596
3596
3597 .. container:: verbose
3597 .. container:: verbose
3598
3598
3599 With -B/--bookmarks, the result of bookmark comparison between
3599 With -B/--bookmarks, the result of bookmark comparison between
3600 local and remote repositories is displayed. With -v/--verbose,
3600 local and remote repositories is displayed. With -v/--verbose,
3601 status is also displayed for each bookmark like below::
3601 status is also displayed for each bookmark like below::
3602
3602
3603 BM1 01234567890a added
3603 BM1 01234567890a added
3604 BM2 deleted
3604 BM2 deleted
3605 BM3 234567890abc advanced
3605 BM3 234567890abc advanced
3606 BM4 34567890abcd diverged
3606 BM4 34567890abcd diverged
3607 BM5 4567890abcde changed
3607 BM5 4567890abcde changed
3608
3608
3609 The action taken when pushing depends on the
3609 The action taken when pushing depends on the
3610 status of each bookmark:
3610 status of each bookmark:
3611
3611
3612 :``added``: push with ``-B`` will create it
3612 :``added``: push with ``-B`` will create it
3613 :``deleted``: push with ``-B`` will delete it
3613 :``deleted``: push with ``-B`` will delete it
3614 :``advanced``: push will update it
3614 :``advanced``: push will update it
3615 :``diverged``: push with ``-B`` will update it
3615 :``diverged``: push with ``-B`` will update it
3616 :``changed``: push with ``-B`` will update it
3616 :``changed``: push with ``-B`` will update it
3617
3617
3618 From the point of view of pushing behavior, bookmarks
3618 From the point of view of pushing behavior, bookmarks
3619 existing only in the remote repository are treated as
3619 existing only in the remote repository are treated as
3620 ``deleted``, even if it is in fact added remotely.
3620 ``deleted``, even if it is in fact added remotely.
3621
3621
3622 Returns 0 if there are outgoing changes, 1 otherwise.
3622 Returns 0 if there are outgoing changes, 1 otherwise.
3623 """
3623 """
3624 if opts.get('graph'):
3624 if opts.get('graph'):
3625 cmdutil.checkunsupportedgraphflags([], opts)
3625 cmdutil.checkunsupportedgraphflags([], opts)
3626 o, other = hg._outgoing(ui, repo, dest, opts)
3626 o, other = hg._outgoing(ui, repo, dest, opts)
3627 if not o:
3627 if not o:
3628 cmdutil.outgoinghooks(ui, repo, other, opts, o)
3628 cmdutil.outgoinghooks(ui, repo, other, opts, o)
3629 return
3629 return
3630
3630
3631 revdag = cmdutil.graphrevs(repo, o, opts)
3631 revdag = cmdutil.graphrevs(repo, o, opts)
3632 ui.pager('outgoing')
3632 ui.pager('outgoing')
3633 displayer = cmdutil.show_changeset(ui, repo, opts, buffered=True)
3633 displayer = cmdutil.show_changeset(ui, repo, opts, buffered=True)
3634 cmdutil.displaygraph(ui, repo, revdag, displayer, graphmod.asciiedges)
3634 cmdutil.displaygraph(ui, repo, revdag, displayer, graphmod.asciiedges)
3635 cmdutil.outgoinghooks(ui, repo, other, opts, o)
3635 cmdutil.outgoinghooks(ui, repo, other, opts, o)
3636 return 0
3636 return 0
3637
3637
3638 if opts.get('bookmarks'):
3638 if opts.get('bookmarks'):
3639 dest = ui.expandpath(dest or 'default-push', dest or 'default')
3639 dest = ui.expandpath(dest or 'default-push', dest or 'default')
3640 dest, branches = hg.parseurl(dest, opts.get('branch'))
3640 dest, branches = hg.parseurl(dest, opts.get('branch'))
3641 other = hg.peer(repo, opts, dest)
3641 other = hg.peer(repo, opts, dest)
3642 if 'bookmarks' not in other.listkeys('namespaces'):
3642 if 'bookmarks' not in other.listkeys('namespaces'):
3643 ui.warn(_("remote doesn't support bookmarks\n"))
3643 ui.warn(_("remote doesn't support bookmarks\n"))
3644 return 0
3644 return 0
3645 ui.status(_('comparing with %s\n') % util.hidepassword(dest))
3645 ui.status(_('comparing with %s\n') % util.hidepassword(dest))
3646 ui.pager('outgoing')
3646 ui.pager('outgoing')
3647 return bookmarks.outgoing(ui, repo, other)
3647 return bookmarks.outgoing(ui, repo, other)
3648
3648
3649 repo._subtoppath = ui.expandpath(dest or 'default-push', dest or 'default')
3649 repo._subtoppath = ui.expandpath(dest or 'default-push', dest or 'default')
3650 try:
3650 try:
3651 return hg.outgoing(ui, repo, dest, opts)
3651 return hg.outgoing(ui, repo, dest, opts)
3652 finally:
3652 finally:
3653 del repo._subtoppath
3653 del repo._subtoppath
3654
3654
3655 @command('parents',
3655 @command('parents',
3656 [('r', 'rev', '', _('show parents of the specified revision'), _('REV')),
3656 [('r', 'rev', '', _('show parents of the specified revision'), _('REV')),
3657 ] + templateopts,
3657 ] + templateopts,
3658 _('[-r REV] [FILE]'),
3658 _('[-r REV] [FILE]'),
3659 inferrepo=True)
3659 inferrepo=True)
3660 def parents(ui, repo, file_=None, **opts):
3660 def parents(ui, repo, file_=None, **opts):
3661 """show the parents of the working directory or revision (DEPRECATED)
3661 """show the parents of the working directory or revision (DEPRECATED)
3662
3662
3663 Print the working directory's parent revisions. If a revision is
3663 Print the working directory's parent revisions. If a revision is
3664 given via -r/--rev, the parent of that revision will be printed.
3664 given via -r/--rev, the parent of that revision will be printed.
3665 If a file argument is given, the revision in which the file was
3665 If a file argument is given, the revision in which the file was
3666 last changed (before the working directory revision or the
3666 last changed (before the working directory revision or the
3667 argument to --rev if given) is printed.
3667 argument to --rev if given) is printed.
3668
3668
3669 This command is equivalent to::
3669 This command is equivalent to::
3670
3670
3671 hg log -r "p1()+p2()" or
3671 hg log -r "p1()+p2()" or
3672 hg log -r "p1(REV)+p2(REV)" or
3672 hg log -r "p1(REV)+p2(REV)" or
3673 hg log -r "max(::p1() and file(FILE))+max(::p2() and file(FILE))" or
3673 hg log -r "max(::p1() and file(FILE))+max(::p2() and file(FILE))" or
3674 hg log -r "max(::p1(REV) and file(FILE))+max(::p2(REV) and file(FILE))"
3674 hg log -r "max(::p1(REV) and file(FILE))+max(::p2(REV) and file(FILE))"
3675
3675
3676 See :hg:`summary` and :hg:`help revsets` for related information.
3676 See :hg:`summary` and :hg:`help revsets` for related information.
3677
3677
3678 Returns 0 on success.
3678 Returns 0 on success.
3679 """
3679 """
3680
3680
3681 ctx = scmutil.revsingle(repo, opts.get('rev'), None)
3681 ctx = scmutil.revsingle(repo, opts.get('rev'), None)
3682
3682
3683 if file_:
3683 if file_:
3684 m = scmutil.match(ctx, (file_,), opts)
3684 m = scmutil.match(ctx, (file_,), opts)
3685 if m.anypats() or len(m.files()) != 1:
3685 if m.anypats() or len(m.files()) != 1:
3686 raise error.Abort(_('can only specify an explicit filename'))
3686 raise error.Abort(_('can only specify an explicit filename'))
3687 file_ = m.files()[0]
3687 file_ = m.files()[0]
3688 filenodes = []
3688 filenodes = []
3689 for cp in ctx.parents():
3689 for cp in ctx.parents():
3690 if not cp:
3690 if not cp:
3691 continue
3691 continue
3692 try:
3692 try:
3693 filenodes.append(cp.filenode(file_))
3693 filenodes.append(cp.filenode(file_))
3694 except error.LookupError:
3694 except error.LookupError:
3695 pass
3695 pass
3696 if not filenodes:
3696 if not filenodes:
3697 raise error.Abort(_("'%s' not found in manifest!") % file_)
3697 raise error.Abort(_("'%s' not found in manifest!") % file_)
3698 p = []
3698 p = []
3699 for fn in filenodes:
3699 for fn in filenodes:
3700 fctx = repo.filectx(file_, fileid=fn)
3700 fctx = repo.filectx(file_, fileid=fn)
3701 p.append(fctx.node())
3701 p.append(fctx.node())
3702 else:
3702 else:
3703 p = [cp.node() for cp in ctx.parents()]
3703 p = [cp.node() for cp in ctx.parents()]
3704
3704
3705 displayer = cmdutil.show_changeset(ui, repo, opts)
3705 displayer = cmdutil.show_changeset(ui, repo, opts)
3706 for n in p:
3706 for n in p:
3707 if n != nullid:
3707 if n != nullid:
3708 displayer.show(repo[n])
3708 displayer.show(repo[n])
3709 displayer.close()
3709 displayer.close()
3710
3710
3711 @command('paths', formatteropts, _('[NAME]'), optionalrepo=True)
3711 @command('paths', formatteropts, _('[NAME]'), optionalrepo=True)
3712 def paths(ui, repo, search=None, **opts):
3712 def paths(ui, repo, search=None, **opts):
3713 """show aliases for remote repositories
3713 """show aliases for remote repositories
3714
3714
3715 Show definition of symbolic path name NAME. If no name is given,
3715 Show definition of symbolic path name NAME. If no name is given,
3716 show definition of all available names.
3716 show definition of all available names.
3717
3717
3718 Option -q/--quiet suppresses all output when searching for NAME
3718 Option -q/--quiet suppresses all output when searching for NAME
3719 and shows only the path names when listing all definitions.
3719 and shows only the path names when listing all definitions.
3720
3720
3721 Path names are defined in the [paths] section of your
3721 Path names are defined in the [paths] section of your
3722 configuration file and in ``/etc/mercurial/hgrc``. If run inside a
3722 configuration file and in ``/etc/mercurial/hgrc``. If run inside a
3723 repository, ``.hg/hgrc`` is used, too.
3723 repository, ``.hg/hgrc`` is used, too.
3724
3724
3725 The path names ``default`` and ``default-push`` have a special
3725 The path names ``default`` and ``default-push`` have a special
3726 meaning. When performing a push or pull operation, they are used
3726 meaning. When performing a push or pull operation, they are used
3727 as fallbacks if no location is specified on the command-line.
3727 as fallbacks if no location is specified on the command-line.
3728 When ``default-push`` is set, it will be used for push and
3728 When ``default-push`` is set, it will be used for push and
3729 ``default`` will be used for pull; otherwise ``default`` is used
3729 ``default`` will be used for pull; otherwise ``default`` is used
3730 as the fallback for both. When cloning a repository, the clone
3730 as the fallback for both. When cloning a repository, the clone
3731 source is written as ``default`` in ``.hg/hgrc``.
3731 source is written as ``default`` in ``.hg/hgrc``.
3732
3732
3733 .. note::
3733 .. note::
3734
3734
3735 ``default`` and ``default-push`` apply to all inbound (e.g.
3735 ``default`` and ``default-push`` apply to all inbound (e.g.
3736 :hg:`incoming`) and outbound (e.g. :hg:`outgoing`, :hg:`email`
3736 :hg:`incoming`) and outbound (e.g. :hg:`outgoing`, :hg:`email`
3737 and :hg:`bundle`) operations.
3737 and :hg:`bundle`) operations.
3738
3738
3739 See :hg:`help urls` for more information.
3739 See :hg:`help urls` for more information.
3740
3740
3741 Returns 0 on success.
3741 Returns 0 on success.
3742 """
3742 """
3743 ui.pager('paths')
3743 ui.pager('paths')
3744 if search:
3744 if search:
3745 pathitems = [(name, path) for name, path in ui.paths.iteritems()
3745 pathitems = [(name, path) for name, path in ui.paths.iteritems()
3746 if name == search]
3746 if name == search]
3747 else:
3747 else:
3748 pathitems = sorted(ui.paths.iteritems())
3748 pathitems = sorted(ui.paths.iteritems())
3749
3749
3750 fm = ui.formatter('paths', opts)
3750 fm = ui.formatter('paths', opts)
3751 if fm.isplain():
3751 if fm.isplain():
3752 hidepassword = util.hidepassword
3752 hidepassword = util.hidepassword
3753 else:
3753 else:
3754 hidepassword = str
3754 hidepassword = str
3755 if ui.quiet:
3755 if ui.quiet:
3756 namefmt = '%s\n'
3756 namefmt = '%s\n'
3757 else:
3757 else:
3758 namefmt = '%s = '
3758 namefmt = '%s = '
3759 showsubopts = not search and not ui.quiet
3759 showsubopts = not search and not ui.quiet
3760
3760
3761 for name, path in pathitems:
3761 for name, path in pathitems:
3762 fm.startitem()
3762 fm.startitem()
3763 fm.condwrite(not search, 'name', namefmt, name)
3763 fm.condwrite(not search, 'name', namefmt, name)
3764 fm.condwrite(not ui.quiet, 'url', '%s\n', hidepassword(path.rawloc))
3764 fm.condwrite(not ui.quiet, 'url', '%s\n', hidepassword(path.rawloc))
3765 for subopt, value in sorted(path.suboptions.items()):
3765 for subopt, value in sorted(path.suboptions.items()):
3766 assert subopt not in ('name', 'url')
3766 assert subopt not in ('name', 'url')
3767 if showsubopts:
3767 if showsubopts:
3768 fm.plain('%s:%s = ' % (name, subopt))
3768 fm.plain('%s:%s = ' % (name, subopt))
3769 fm.condwrite(showsubopts, subopt, '%s\n', value)
3769 fm.condwrite(showsubopts, subopt, '%s\n', value)
3770
3770
3771 fm.end()
3771 fm.end()
3772
3772
3773 if search and not pathitems:
3773 if search and not pathitems:
3774 if not ui.quiet:
3774 if not ui.quiet:
3775 ui.warn(_("not found!\n"))
3775 ui.warn(_("not found!\n"))
3776 return 1
3776 return 1
3777 else:
3777 else:
3778 return 0
3778 return 0
3779
3779
3780 @command('phase',
3780 @command('phase',
3781 [('p', 'public', False, _('set changeset phase to public')),
3781 [('p', 'public', False, _('set changeset phase to public')),
3782 ('d', 'draft', False, _('set changeset phase to draft')),
3782 ('d', 'draft', False, _('set changeset phase to draft')),
3783 ('s', 'secret', False, _('set changeset phase to secret')),
3783 ('s', 'secret', False, _('set changeset phase to secret')),
3784 ('f', 'force', False, _('allow to move boundary backward')),
3784 ('f', 'force', False, _('allow to move boundary backward')),
3785 ('r', 'rev', [], _('target revision'), _('REV')),
3785 ('r', 'rev', [], _('target revision'), _('REV')),
3786 ],
3786 ],
3787 _('[-p|-d|-s] [-f] [-r] [REV...]'))
3787 _('[-p|-d|-s] [-f] [-r] [REV...]'))
3788 def phase(ui, repo, *revs, **opts):
3788 def phase(ui, repo, *revs, **opts):
3789 """set or show the current phase name
3789 """set or show the current phase name
3790
3790
3791 With no argument, show the phase name of the current revision(s).
3791 With no argument, show the phase name of the current revision(s).
3792
3792
3793 With one of -p/--public, -d/--draft or -s/--secret, change the
3793 With one of -p/--public, -d/--draft or -s/--secret, change the
3794 phase value of the specified revisions.
3794 phase value of the specified revisions.
3795
3795
3796 Unless -f/--force is specified, :hg:`phase` won't move changeset from a
3796 Unless -f/--force is specified, :hg:`phase` won't move changeset from a
3797 lower phase to an higher phase. Phases are ordered as follows::
3797 lower phase to an higher phase. Phases are ordered as follows::
3798
3798
3799 public < draft < secret
3799 public < draft < secret
3800
3800
3801 Returns 0 on success, 1 if some phases could not be changed.
3801 Returns 0 on success, 1 if some phases could not be changed.
3802
3802
3803 (For more information about the phases concept, see :hg:`help phases`.)
3803 (For more information about the phases concept, see :hg:`help phases`.)
3804 """
3804 """
3805 # search for a unique phase argument
3805 # search for a unique phase argument
3806 targetphase = None
3806 targetphase = None
3807 for idx, name in enumerate(phases.phasenames):
3807 for idx, name in enumerate(phases.phasenames):
3808 if opts[name]:
3808 if opts[name]:
3809 if targetphase is not None:
3809 if targetphase is not None:
3810 raise error.Abort(_('only one phase can be specified'))
3810 raise error.Abort(_('only one phase can be specified'))
3811 targetphase = idx
3811 targetphase = idx
3812
3812
3813 # look for specified revision
3813 # look for specified revision
3814 revs = list(revs)
3814 revs = list(revs)
3815 revs.extend(opts['rev'])
3815 revs.extend(opts['rev'])
3816 if not revs:
3816 if not revs:
3817 # display both parents as the second parent phase can influence
3817 # display both parents as the second parent phase can influence
3818 # the phase of a merge commit
3818 # the phase of a merge commit
3819 revs = [c.rev() for c in repo[None].parents()]
3819 revs = [c.rev() for c in repo[None].parents()]
3820
3820
3821 revs = scmutil.revrange(repo, revs)
3821 revs = scmutil.revrange(repo, revs)
3822
3822
3823 lock = None
3823 lock = None
3824 ret = 0
3824 ret = 0
3825 if targetphase is None:
3825 if targetphase is None:
3826 # display
3826 # display
3827 for r in revs:
3827 for r in revs:
3828 ctx = repo[r]
3828 ctx = repo[r]
3829 ui.write('%i: %s\n' % (ctx.rev(), ctx.phasestr()))
3829 ui.write('%i: %s\n' % (ctx.rev(), ctx.phasestr()))
3830 else:
3830 else:
3831 tr = None
3831 tr = None
3832 lock = repo.lock()
3832 lock = repo.lock()
3833 try:
3833 try:
3834 tr = repo.transaction("phase")
3834 tr = repo.transaction("phase")
3835 # set phase
3835 # set phase
3836 if not revs:
3836 if not revs:
3837 raise error.Abort(_('empty revision set'))
3837 raise error.Abort(_('empty revision set'))
3838 nodes = [repo[r].node() for r in revs]
3838 nodes = [repo[r].node() for r in revs]
3839 # moving revision from public to draft may hide them
3839 # moving revision from public to draft may hide them
3840 # We have to check result on an unfiltered repository
3840 # We have to check result on an unfiltered repository
3841 unfi = repo.unfiltered()
3841 unfi = repo.unfiltered()
3842 getphase = unfi._phasecache.phase
3842 getphase = unfi._phasecache.phase
3843 olddata = [getphase(unfi, r) for r in unfi]
3843 olddata = [getphase(unfi, r) for r in unfi]
3844 phases.advanceboundary(repo, tr, targetphase, nodes)
3844 phases.advanceboundary(repo, tr, targetphase, nodes)
3845 if opts['force']:
3845 if opts['force']:
3846 phases.retractboundary(repo, tr, targetphase, nodes)
3846 phases.retractboundary(repo, tr, targetphase, nodes)
3847 tr.close()
3847 tr.close()
3848 finally:
3848 finally:
3849 if tr is not None:
3849 if tr is not None:
3850 tr.release()
3850 tr.release()
3851 lock.release()
3851 lock.release()
3852 getphase = unfi._phasecache.phase
3852 getphase = unfi._phasecache.phase
3853 newdata = [getphase(unfi, r) for r in unfi]
3853 newdata = [getphase(unfi, r) for r in unfi]
3854 changes = sum(newdata[r] != olddata[r] for r in unfi)
3854 changes = sum(newdata[r] != olddata[r] for r in unfi)
3855 cl = unfi.changelog
3855 cl = unfi.changelog
3856 rejected = [n for n in nodes
3856 rejected = [n for n in nodes
3857 if newdata[cl.rev(n)] < targetphase]
3857 if newdata[cl.rev(n)] < targetphase]
3858 if rejected:
3858 if rejected:
3859 ui.warn(_('cannot move %i changesets to a higher '
3859 ui.warn(_('cannot move %i changesets to a higher '
3860 'phase, use --force\n') % len(rejected))
3860 'phase, use --force\n') % len(rejected))
3861 ret = 1
3861 ret = 1
3862 if changes:
3862 if changes:
3863 msg = _('phase changed for %i changesets\n') % changes
3863 msg = _('phase changed for %i changesets\n') % changes
3864 if ret:
3864 if ret:
3865 ui.status(msg)
3865 ui.status(msg)
3866 else:
3866 else:
3867 ui.note(msg)
3867 ui.note(msg)
3868 else:
3868 else:
3869 ui.warn(_('no phases changed\n'))
3869 ui.warn(_('no phases changed\n'))
3870 return ret
3870 return ret
3871
3871
3872 def postincoming(ui, repo, modheads, optupdate, checkout, brev):
3872 def postincoming(ui, repo, modheads, optupdate, checkout, brev):
3873 """Run after a changegroup has been added via pull/unbundle
3873 """Run after a changegroup has been added via pull/unbundle
3874
3874
3875 This takes arguments below:
3875 This takes arguments below:
3876
3876
3877 :modheads: change of heads by pull/unbundle
3877 :modheads: change of heads by pull/unbundle
3878 :optupdate: updating working directory is needed or not
3878 :optupdate: updating working directory is needed or not
3879 :checkout: update destination revision (or None to default destination)
3879 :checkout: update destination revision (or None to default destination)
3880 :brev: a name, which might be a bookmark to be activated after updating
3880 :brev: a name, which might be a bookmark to be activated after updating
3881 """
3881 """
3882 if modheads == 0:
3882 if modheads == 0:
3883 return
3883 return
3884 if optupdate:
3884 if optupdate:
3885 try:
3885 try:
3886 return hg.updatetotally(ui, repo, checkout, brev)
3886 return hg.updatetotally(ui, repo, checkout, brev)
3887 except error.UpdateAbort as inst:
3887 except error.UpdateAbort as inst:
3888 msg = _("not updating: %s") % str(inst)
3888 msg = _("not updating: %s") % str(inst)
3889 hint = inst.hint
3889 hint = inst.hint
3890 raise error.UpdateAbort(msg, hint=hint)
3890 raise error.UpdateAbort(msg, hint=hint)
3891 if modheads > 1:
3891 if modheads > 1:
3892 currentbranchheads = len(repo.branchheads())
3892 currentbranchheads = len(repo.branchheads())
3893 if currentbranchheads == modheads:
3893 if currentbranchheads == modheads:
3894 ui.status(_("(run 'hg heads' to see heads, 'hg merge' to merge)\n"))
3894 ui.status(_("(run 'hg heads' to see heads, 'hg merge' to merge)\n"))
3895 elif currentbranchheads > 1:
3895 elif currentbranchheads > 1:
3896 ui.status(_("(run 'hg heads .' to see heads, 'hg merge' to "
3896 ui.status(_("(run 'hg heads .' to see heads, 'hg merge' to "
3897 "merge)\n"))
3897 "merge)\n"))
3898 else:
3898 else:
3899 ui.status(_("(run 'hg heads' to see heads)\n"))
3899 ui.status(_("(run 'hg heads' to see heads)\n"))
3900 else:
3900 else:
3901 ui.status(_("(run 'hg update' to get a working copy)\n"))
3901 ui.status(_("(run 'hg update' to get a working copy)\n"))
3902
3902
3903 @command('^pull',
3903 @command('^pull',
3904 [('u', 'update', None,
3904 [('u', 'update', None,
3905 _('update to new branch head if changesets were pulled')),
3905 _('update to new branch head if changesets were pulled')),
3906 ('f', 'force', None, _('run even when remote repository is unrelated')),
3906 ('f', 'force', None, _('run even when remote repository is unrelated')),
3907 ('r', 'rev', [], _('a remote changeset intended to be added'), _('REV')),
3907 ('r', 'rev', [], _('a remote changeset intended to be added'), _('REV')),
3908 ('B', 'bookmark', [], _("bookmark to pull"), _('BOOKMARK')),
3908 ('B', 'bookmark', [], _("bookmark to pull"), _('BOOKMARK')),
3909 ('b', 'branch', [], _('a specific branch you would like to pull'),
3909 ('b', 'branch', [], _('a specific branch you would like to pull'),
3910 _('BRANCH')),
3910 _('BRANCH')),
3911 ] + remoteopts,
3911 ] + remoteopts,
3912 _('[-u] [-f] [-r REV]... [-e CMD] [--remotecmd CMD] [SOURCE]'))
3912 _('[-u] [-f] [-r REV]... [-e CMD] [--remotecmd CMD] [SOURCE]'))
3913 def pull(ui, repo, source="default", **opts):
3913 def pull(ui, repo, source="default", **opts):
3914 """pull changes from the specified source
3914 """pull changes from the specified source
3915
3915
3916 Pull changes from a remote repository to a local one.
3916 Pull changes from a remote repository to a local one.
3917
3917
3918 This finds all changes from the repository at the specified path
3918 This finds all changes from the repository at the specified path
3919 or URL and adds them to a local repository (the current one unless
3919 or URL and adds them to a local repository (the current one unless
3920 -R is specified). By default, this does not update the copy of the
3920 -R is specified). By default, this does not update the copy of the
3921 project in the working directory.
3921 project in the working directory.
3922
3922
3923 Use :hg:`incoming` if you want to see what would have been added
3923 Use :hg:`incoming` if you want to see what would have been added
3924 by a pull at the time you issued this command. If you then decide
3924 by a pull at the time you issued this command. If you then decide
3925 to add those changes to the repository, you should use :hg:`pull
3925 to add those changes to the repository, you should use :hg:`pull
3926 -r X` where ``X`` is the last changeset listed by :hg:`incoming`.
3926 -r X` where ``X`` is the last changeset listed by :hg:`incoming`.
3927
3927
3928 If SOURCE is omitted, the 'default' path will be used.
3928 If SOURCE is omitted, the 'default' path will be used.
3929 See :hg:`help urls` for more information.
3929 See :hg:`help urls` for more information.
3930
3930
3931 Specifying bookmark as ``.`` is equivalent to specifying the active
3931 Specifying bookmark as ``.`` is equivalent to specifying the active
3932 bookmark's name.
3932 bookmark's name.
3933
3933
3934 Returns 0 on success, 1 if an update had unresolved files.
3934 Returns 0 on success, 1 if an update had unresolved files.
3935 """
3935 """
3936 source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch'))
3936 source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch'))
3937 ui.status(_('pulling from %s\n') % util.hidepassword(source))
3937 ui.status(_('pulling from %s\n') % util.hidepassword(source))
3938 other = hg.peer(repo, opts, source)
3938 other = hg.peer(repo, opts, source)
3939 try:
3939 try:
3940 revs, checkout = hg.addbranchrevs(repo, other, branches,
3940 revs, checkout = hg.addbranchrevs(repo, other, branches,
3941 opts.get('rev'))
3941 opts.get('rev'))
3942
3942
3943
3943
3944 pullopargs = {}
3944 pullopargs = {}
3945 if opts.get('bookmark'):
3945 if opts.get('bookmark'):
3946 if not revs:
3946 if not revs:
3947 revs = []
3947 revs = []
3948 # The list of bookmark used here is not the one used to actually
3948 # The list of bookmark used here is not the one used to actually
3949 # update the bookmark name. This can result in the revision pulled
3949 # update the bookmark name. This can result in the revision pulled
3950 # not ending up with the name of the bookmark because of a race
3950 # not ending up with the name of the bookmark because of a race
3951 # condition on the server. (See issue 4689 for details)
3951 # condition on the server. (See issue 4689 for details)
3952 remotebookmarks = other.listkeys('bookmarks')
3952 remotebookmarks = other.listkeys('bookmarks')
3953 pullopargs['remotebookmarks'] = remotebookmarks
3953 pullopargs['remotebookmarks'] = remotebookmarks
3954 for b in opts['bookmark']:
3954 for b in opts['bookmark']:
3955 b = repo._bookmarks.expandname(b)
3955 b = repo._bookmarks.expandname(b)
3956 if b not in remotebookmarks:
3956 if b not in remotebookmarks:
3957 raise error.Abort(_('remote bookmark %s not found!') % b)
3957 raise error.Abort(_('remote bookmark %s not found!') % b)
3958 revs.append(remotebookmarks[b])
3958 revs.append(remotebookmarks[b])
3959
3959
3960 if revs:
3960 if revs:
3961 try:
3961 try:
3962 # When 'rev' is a bookmark name, we cannot guarantee that it
3962 # When 'rev' is a bookmark name, we cannot guarantee that it
3963 # will be updated with that name because of a race condition
3963 # will be updated with that name because of a race condition
3964 # server side. (See issue 4689 for details)
3964 # server side. (See issue 4689 for details)
3965 oldrevs = revs
3965 oldrevs = revs
3966 revs = [] # actually, nodes
3966 revs = [] # actually, nodes
3967 for r in oldrevs:
3967 for r in oldrevs:
3968 node = other.lookup(r)
3968 node = other.lookup(r)
3969 revs.append(node)
3969 revs.append(node)
3970 if r == checkout:
3970 if r == checkout:
3971 checkout = node
3971 checkout = node
3972 except error.CapabilityError:
3972 except error.CapabilityError:
3973 err = _("other repository doesn't support revision lookup, "
3973 err = _("other repository doesn't support revision lookup, "
3974 "so a rev cannot be specified.")
3974 "so a rev cannot be specified.")
3975 raise error.Abort(err)
3975 raise error.Abort(err)
3976
3976
3977 pullopargs.update(opts.get('opargs', {}))
3977 pullopargs.update(opts.get('opargs', {}))
3978 modheads = exchange.pull(repo, other, heads=revs,
3978 modheads = exchange.pull(repo, other, heads=revs,
3979 force=opts.get('force'),
3979 force=opts.get('force'),
3980 bookmarks=opts.get('bookmark', ()),
3980 bookmarks=opts.get('bookmark', ()),
3981 opargs=pullopargs).cgresult
3981 opargs=pullopargs).cgresult
3982
3982
3983 # brev is a name, which might be a bookmark to be activated at
3983 # brev is a name, which might be a bookmark to be activated at
3984 # the end of the update. In other words, it is an explicit
3984 # the end of the update. In other words, it is an explicit
3985 # destination of the update
3985 # destination of the update
3986 brev = None
3986 brev = None
3987
3987
3988 if checkout:
3988 if checkout:
3989 checkout = str(repo.changelog.rev(checkout))
3989 checkout = str(repo.changelog.rev(checkout))
3990
3990
3991 # order below depends on implementation of
3991 # order below depends on implementation of
3992 # hg.addbranchrevs(). opts['bookmark'] is ignored,
3992 # hg.addbranchrevs(). opts['bookmark'] is ignored,
3993 # because 'checkout' is determined without it.
3993 # because 'checkout' is determined without it.
3994 if opts.get('rev'):
3994 if opts.get('rev'):
3995 brev = opts['rev'][0]
3995 brev = opts['rev'][0]
3996 elif opts.get('branch'):
3996 elif opts.get('branch'):
3997 brev = opts['branch'][0]
3997 brev = opts['branch'][0]
3998 else:
3998 else:
3999 brev = branches[0]
3999 brev = branches[0]
4000 repo._subtoppath = source
4000 repo._subtoppath = source
4001 try:
4001 try:
4002 ret = postincoming(ui, repo, modheads, opts.get('update'),
4002 ret = postincoming(ui, repo, modheads, opts.get('update'),
4003 checkout, brev)
4003 checkout, brev)
4004
4004
4005 finally:
4005 finally:
4006 del repo._subtoppath
4006 del repo._subtoppath
4007
4007
4008 finally:
4008 finally:
4009 other.close()
4009 other.close()
4010 return ret
4010 return ret
4011
4011
4012 @command('^push',
4012 @command('^push',
4013 [('f', 'force', None, _('force push')),
4013 [('f', 'force', None, _('force push')),
4014 ('r', 'rev', [],
4014 ('r', 'rev', [],
4015 _('a changeset intended to be included in the destination'),
4015 _('a changeset intended to be included in the destination'),
4016 _('REV')),
4016 _('REV')),
4017 ('B', 'bookmark', [], _("bookmark to push"), _('BOOKMARK')),
4017 ('B', 'bookmark', [], _("bookmark to push"), _('BOOKMARK')),
4018 ('b', 'branch', [],
4018 ('b', 'branch', [],
4019 _('a specific branch you would like to push'), _('BRANCH')),
4019 _('a specific branch you would like to push'), _('BRANCH')),
4020 ('', 'new-branch', False, _('allow pushing a new branch')),
4020 ('', 'new-branch', False, _('allow pushing a new branch')),
4021 ] + remoteopts,
4021 ] + remoteopts,
4022 _('[-f] [-r REV]... [-e CMD] [--remotecmd CMD] [DEST]'))
4022 _('[-f] [-r REV]... [-e CMD] [--remotecmd CMD] [DEST]'))
4023 def push(ui, repo, dest=None, **opts):
4023 def push(ui, repo, dest=None, **opts):
4024 """push changes to the specified destination
4024 """push changes to the specified destination
4025
4025
4026 Push changesets from the local repository to the specified
4026 Push changesets from the local repository to the specified
4027 destination.
4027 destination.
4028
4028
4029 This operation is symmetrical to pull: it is identical to a pull
4029 This operation is symmetrical to pull: it is identical to a pull
4030 in the destination repository from the current one.
4030 in the destination repository from the current one.
4031
4031
4032 By default, push will not allow creation of new heads at the
4032 By default, push will not allow creation of new heads at the
4033 destination, since multiple heads would make it unclear which head
4033 destination, since multiple heads would make it unclear which head
4034 to use. In this situation, it is recommended to pull and merge
4034 to use. In this situation, it is recommended to pull and merge
4035 before pushing.
4035 before pushing.
4036
4036
4037 Use --new-branch if you want to allow push to create a new named
4037 Use --new-branch if you want to allow push to create a new named
4038 branch that is not present at the destination. This allows you to
4038 branch that is not present at the destination. This allows you to
4039 only create a new branch without forcing other changes.
4039 only create a new branch without forcing other changes.
4040
4040
4041 .. note::
4041 .. note::
4042
4042
4043 Extra care should be taken with the -f/--force option,
4043 Extra care should be taken with the -f/--force option,
4044 which will push all new heads on all branches, an action which will
4044 which will push all new heads on all branches, an action which will
4045 almost always cause confusion for collaborators.
4045 almost always cause confusion for collaborators.
4046
4046
4047 If -r/--rev is used, the specified revision and all its ancestors
4047 If -r/--rev is used, the specified revision and all its ancestors
4048 will be pushed to the remote repository.
4048 will be pushed to the remote repository.
4049
4049
4050 If -B/--bookmark is used, the specified bookmarked revision, its
4050 If -B/--bookmark is used, the specified bookmarked revision, its
4051 ancestors, and the bookmark will be pushed to the remote
4051 ancestors, and the bookmark will be pushed to the remote
4052 repository. Specifying ``.`` is equivalent to specifying the active
4052 repository. Specifying ``.`` is equivalent to specifying the active
4053 bookmark's name.
4053 bookmark's name.
4054
4054
4055 Please see :hg:`help urls` for important details about ``ssh://``
4055 Please see :hg:`help urls` for important details about ``ssh://``
4056 URLs. If DESTINATION is omitted, a default path will be used.
4056 URLs. If DESTINATION is omitted, a default path will be used.
4057
4057
4058 Returns 0 if push was successful, 1 if nothing to push.
4058 Returns 0 if push was successful, 1 if nothing to push.
4059 """
4059 """
4060
4060
4061 if opts.get('bookmark'):
4061 if opts.get('bookmark'):
4062 ui.setconfig('bookmarks', 'pushing', opts['bookmark'], 'push')
4062 ui.setconfig('bookmarks', 'pushing', opts['bookmark'], 'push')
4063 for b in opts['bookmark']:
4063 for b in opts['bookmark']:
4064 # translate -B options to -r so changesets get pushed
4064 # translate -B options to -r so changesets get pushed
4065 b = repo._bookmarks.expandname(b)
4065 b = repo._bookmarks.expandname(b)
4066 if b in repo._bookmarks:
4066 if b in repo._bookmarks:
4067 opts.setdefault('rev', []).append(b)
4067 opts.setdefault('rev', []).append(b)
4068 else:
4068 else:
4069 # if we try to push a deleted bookmark, translate it to null
4069 # if we try to push a deleted bookmark, translate it to null
4070 # this lets simultaneous -r, -b options continue working
4070 # this lets simultaneous -r, -b options continue working
4071 opts.setdefault('rev', []).append("null")
4071 opts.setdefault('rev', []).append("null")
4072
4072
4073 path = ui.paths.getpath(dest, default=('default-push', 'default'))
4073 path = ui.paths.getpath(dest, default=('default-push', 'default'))
4074 if not path:
4074 if not path:
4075 raise error.Abort(_('default repository not configured!'),
4075 raise error.Abort(_('default repository not configured!'),
4076 hint=_("see 'hg help config.paths'"))
4076 hint=_("see 'hg help config.paths'"))
4077 dest = path.pushloc or path.loc
4077 dest = path.pushloc or path.loc
4078 branches = (path.branch, opts.get('branch') or [])
4078 branches = (path.branch, opts.get('branch') or [])
4079 ui.status(_('pushing to %s\n') % util.hidepassword(dest))
4079 ui.status(_('pushing to %s\n') % util.hidepassword(dest))
4080 revs, checkout = hg.addbranchrevs(repo, repo, branches, opts.get('rev'))
4080 revs, checkout = hg.addbranchrevs(repo, repo, branches, opts.get('rev'))
4081 other = hg.peer(repo, opts, dest)
4081 other = hg.peer(repo, opts, dest)
4082
4082
4083 if revs:
4083 if revs:
4084 revs = [repo.lookup(r) for r in scmutil.revrange(repo, revs)]
4084 revs = [repo.lookup(r) for r in scmutil.revrange(repo, revs)]
4085 if not revs:
4085 if not revs:
4086 raise error.Abort(_("specified revisions evaluate to an empty set"),
4086 raise error.Abort(_("specified revisions evaluate to an empty set"),
4087 hint=_("use different revision arguments"))
4087 hint=_("use different revision arguments"))
4088 elif path.pushrev:
4088 elif path.pushrev:
4089 # It doesn't make any sense to specify ancestor revisions. So limit
4089 # It doesn't make any sense to specify ancestor revisions. So limit
4090 # to DAG heads to make discovery simpler.
4090 # to DAG heads to make discovery simpler.
4091 expr = revsetlang.formatspec('heads(%r)', path.pushrev)
4091 expr = revsetlang.formatspec('heads(%r)', path.pushrev)
4092 revs = scmutil.revrange(repo, [expr])
4092 revs = scmutil.revrange(repo, [expr])
4093 revs = [repo[rev].node() for rev in revs]
4093 revs = [repo[rev].node() for rev in revs]
4094 if not revs:
4094 if not revs:
4095 raise error.Abort(_('default push revset for path evaluates to an '
4095 raise error.Abort(_('default push revset for path evaluates to an '
4096 'empty set'))
4096 'empty set'))
4097
4097
4098 repo._subtoppath = dest
4098 repo._subtoppath = dest
4099 try:
4099 try:
4100 # push subrepos depth-first for coherent ordering
4100 # push subrepos depth-first for coherent ordering
4101 c = repo['']
4101 c = repo['']
4102 subs = c.substate # only repos that are committed
4102 subs = c.substate # only repos that are committed
4103 for s in sorted(subs):
4103 for s in sorted(subs):
4104 result = c.sub(s).push(opts)
4104 result = c.sub(s).push(opts)
4105 if result == 0:
4105 if result == 0:
4106 return not result
4106 return not result
4107 finally:
4107 finally:
4108 del repo._subtoppath
4108 del repo._subtoppath
4109 pushop = exchange.push(repo, other, opts.get('force'), revs=revs,
4109 pushop = exchange.push(repo, other, opts.get('force'), revs=revs,
4110 newbranch=opts.get('new_branch'),
4110 newbranch=opts.get('new_branch'),
4111 bookmarks=opts.get('bookmark', ()),
4111 bookmarks=opts.get('bookmark', ()),
4112 opargs=opts.get('opargs'))
4112 opargs=opts.get('opargs'))
4113
4113
4114 result = not pushop.cgresult
4114 result = not pushop.cgresult
4115
4115
4116 if pushop.bkresult is not None:
4116 if pushop.bkresult is not None:
4117 if pushop.bkresult == 2:
4117 if pushop.bkresult == 2:
4118 result = 2
4118 result = 2
4119 elif not result and pushop.bkresult:
4119 elif not result and pushop.bkresult:
4120 result = 2
4120 result = 2
4121
4121
4122 return result
4122 return result
4123
4123
4124 @command('recover', [])
4124 @command('recover', [])
4125 def recover(ui, repo):
4125 def recover(ui, repo):
4126 """roll back an interrupted transaction
4126 """roll back an interrupted transaction
4127
4127
4128 Recover from an interrupted commit or pull.
4128 Recover from an interrupted commit or pull.
4129
4129
4130 This command tries to fix the repository status after an
4130 This command tries to fix the repository status after an
4131 interrupted operation. It should only be necessary when Mercurial
4131 interrupted operation. It should only be necessary when Mercurial
4132 suggests it.
4132 suggests it.
4133
4133
4134 Returns 0 if successful, 1 if nothing to recover or verify fails.
4134 Returns 0 if successful, 1 if nothing to recover or verify fails.
4135 """
4135 """
4136 if repo.recover():
4136 if repo.recover():
4137 return hg.verify(repo)
4137 return hg.verify(repo)
4138 return 1
4138 return 1
4139
4139
4140 @command('^remove|rm',
4140 @command('^remove|rm',
4141 [('A', 'after', None, _('record delete for missing files')),
4141 [('A', 'after', None, _('record delete for missing files')),
4142 ('f', 'force', None,
4142 ('f', 'force', None,
4143 _('forget added files, delete modified files')),
4143 _('forget added files, delete modified files')),
4144 ] + subrepoopts + walkopts,
4144 ] + subrepoopts + walkopts,
4145 _('[OPTION]... FILE...'),
4145 _('[OPTION]... FILE...'),
4146 inferrepo=True)
4146 inferrepo=True)
4147 def remove(ui, repo, *pats, **opts):
4147 def remove(ui, repo, *pats, **opts):
4148 """remove the specified files on the next commit
4148 """remove the specified files on the next commit
4149
4149
4150 Schedule the indicated files for removal from the current branch.
4150 Schedule the indicated files for removal from the current branch.
4151
4151
4152 This command schedules the files to be removed at the next commit.
4152 This command schedules the files to be removed at the next commit.
4153 To undo a remove before that, see :hg:`revert`. To undo added
4153 To undo a remove before that, see :hg:`revert`. To undo added
4154 files, see :hg:`forget`.
4154 files, see :hg:`forget`.
4155
4155
4156 .. container:: verbose
4156 .. container:: verbose
4157
4157
4158 -A/--after can be used to remove only files that have already
4158 -A/--after can be used to remove only files that have already
4159 been deleted, -f/--force can be used to force deletion, and -Af
4159 been deleted, -f/--force can be used to force deletion, and -Af
4160 can be used to remove files from the next revision without
4160 can be used to remove files from the next revision without
4161 deleting them from the working directory.
4161 deleting them from the working directory.
4162
4162
4163 The following table details the behavior of remove for different
4163 The following table details the behavior of remove for different
4164 file states (columns) and option combinations (rows). The file
4164 file states (columns) and option combinations (rows). The file
4165 states are Added [A], Clean [C], Modified [M] and Missing [!]
4165 states are Added [A], Clean [C], Modified [M] and Missing [!]
4166 (as reported by :hg:`status`). The actions are Warn, Remove
4166 (as reported by :hg:`status`). The actions are Warn, Remove
4167 (from branch) and Delete (from disk):
4167 (from branch) and Delete (from disk):
4168
4168
4169 ========= == == == ==
4169 ========= == == == ==
4170 opt/state A C M !
4170 opt/state A C M !
4171 ========= == == == ==
4171 ========= == == == ==
4172 none W RD W R
4172 none W RD W R
4173 -f R RD RD R
4173 -f R RD RD R
4174 -A W W W R
4174 -A W W W R
4175 -Af R R R R
4175 -Af R R R R
4176 ========= == == == ==
4176 ========= == == == ==
4177
4177
4178 .. note::
4178 .. note::
4179
4179
4180 :hg:`remove` never deletes files in Added [A] state from the
4180 :hg:`remove` never deletes files in Added [A] state from the
4181 working directory, not even if ``--force`` is specified.
4181 working directory, not even if ``--force`` is specified.
4182
4182
4183 Returns 0 on success, 1 if any warnings encountered.
4183 Returns 0 on success, 1 if any warnings encountered.
4184 """
4184 """
4185
4185
4186 after, force = opts.get('after'), opts.get('force')
4186 after, force = opts.get('after'), opts.get('force')
4187 if not pats and not after:
4187 if not pats and not after:
4188 raise error.Abort(_('no files specified'))
4188 raise error.Abort(_('no files specified'))
4189
4189
4190 m = scmutil.match(repo[None], pats, opts)
4190 m = scmutil.match(repo[None], pats, opts)
4191 subrepos = opts.get('subrepos')
4191 subrepos = opts.get('subrepos')
4192 return cmdutil.remove(ui, repo, m, "", after, force, subrepos)
4192 return cmdutil.remove(ui, repo, m, "", after, force, subrepos)
4193
4193
4194 @command('rename|move|mv',
4194 @command('rename|move|mv',
4195 [('A', 'after', None, _('record a rename that has already occurred')),
4195 [('A', 'after', None, _('record a rename that has already occurred')),
4196 ('f', 'force', None, _('forcibly copy over an existing managed file')),
4196 ('f', 'force', None, _('forcibly copy over an existing managed file')),
4197 ] + walkopts + dryrunopts,
4197 ] + walkopts + dryrunopts,
4198 _('[OPTION]... SOURCE... DEST'))
4198 _('[OPTION]... SOURCE... DEST'))
4199 def rename(ui, repo, *pats, **opts):
4199 def rename(ui, repo, *pats, **opts):
4200 """rename files; equivalent of copy + remove
4200 """rename files; equivalent of copy + remove
4201
4201
4202 Mark dest as copies of sources; mark sources for deletion. If dest
4202 Mark dest as copies of sources; mark sources for deletion. If dest
4203 is a directory, copies are put in that directory. If dest is a
4203 is a directory, copies are put in that directory. If dest is a
4204 file, there can only be one source.
4204 file, there can only be one source.
4205
4205
4206 By default, this command copies the contents of files as they
4206 By default, this command copies the contents of files as they
4207 exist in the working directory. If invoked with -A/--after, the
4207 exist in the working directory. If invoked with -A/--after, the
4208 operation is recorded, but no copying is performed.
4208 operation is recorded, but no copying is performed.
4209
4209
4210 This command takes effect at the next commit. To undo a rename
4210 This command takes effect at the next commit. To undo a rename
4211 before that, see :hg:`revert`.
4211 before that, see :hg:`revert`.
4212
4212
4213 Returns 0 on success, 1 if errors are encountered.
4213 Returns 0 on success, 1 if errors are encountered.
4214 """
4214 """
4215 with repo.wlock(False):
4215 with repo.wlock(False):
4216 return cmdutil.copy(ui, repo, pats, opts, rename=True)
4216 return cmdutil.copy(ui, repo, pats, opts, rename=True)
4217
4217
4218 @command('resolve',
4218 @command('resolve',
4219 [('a', 'all', None, _('select all unresolved files')),
4219 [('a', 'all', None, _('select all unresolved files')),
4220 ('l', 'list', None, _('list state of files needing merge')),
4220 ('l', 'list', None, _('list state of files needing merge')),
4221 ('m', 'mark', None, _('mark files as resolved')),
4221 ('m', 'mark', None, _('mark files as resolved')),
4222 ('u', 'unmark', None, _('mark files as unresolved')),
4222 ('u', 'unmark', None, _('mark files as unresolved')),
4223 ('n', 'no-status', None, _('hide status prefix'))]
4223 ('n', 'no-status', None, _('hide status prefix'))]
4224 + mergetoolopts + walkopts + formatteropts,
4224 + mergetoolopts + walkopts + formatteropts,
4225 _('[OPTION]... [FILE]...'),
4225 _('[OPTION]... [FILE]...'),
4226 inferrepo=True)
4226 inferrepo=True)
4227 def resolve(ui, repo, *pats, **opts):
4227 def resolve(ui, repo, *pats, **opts):
4228 """redo merges or set/view the merge status of files
4228 """redo merges or set/view the merge status of files
4229
4229
4230 Merges with unresolved conflicts are often the result of
4230 Merges with unresolved conflicts are often the result of
4231 non-interactive merging using the ``internal:merge`` configuration
4231 non-interactive merging using the ``internal:merge`` configuration
4232 setting, or a command-line merge tool like ``diff3``. The resolve
4232 setting, or a command-line merge tool like ``diff3``. The resolve
4233 command is used to manage the files involved in a merge, after
4233 command is used to manage the files involved in a merge, after
4234 :hg:`merge` has been run, and before :hg:`commit` is run (i.e. the
4234 :hg:`merge` has been run, and before :hg:`commit` is run (i.e. the
4235 working directory must have two parents). See :hg:`help
4235 working directory must have two parents). See :hg:`help
4236 merge-tools` for information on configuring merge tools.
4236 merge-tools` for information on configuring merge tools.
4237
4237
4238 The resolve command can be used in the following ways:
4238 The resolve command can be used in the following ways:
4239
4239
4240 - :hg:`resolve [--tool TOOL] FILE...`: attempt to re-merge the specified
4240 - :hg:`resolve [--tool TOOL] FILE...`: attempt to re-merge the specified
4241 files, discarding any previous merge attempts. Re-merging is not
4241 files, discarding any previous merge attempts. Re-merging is not
4242 performed for files already marked as resolved. Use ``--all/-a``
4242 performed for files already marked as resolved. Use ``--all/-a``
4243 to select all unresolved files. ``--tool`` can be used to specify
4243 to select all unresolved files. ``--tool`` can be used to specify
4244 the merge tool used for the given files. It overrides the HGMERGE
4244 the merge tool used for the given files. It overrides the HGMERGE
4245 environment variable and your configuration files. Previous file
4245 environment variable and your configuration files. Previous file
4246 contents are saved with a ``.orig`` suffix.
4246 contents are saved with a ``.orig`` suffix.
4247
4247
4248 - :hg:`resolve -m [FILE]`: mark a file as having been resolved
4248 - :hg:`resolve -m [FILE]`: mark a file as having been resolved
4249 (e.g. after having manually fixed-up the files). The default is
4249 (e.g. after having manually fixed-up the files). The default is
4250 to mark all unresolved files.
4250 to mark all unresolved files.
4251
4251
4252 - :hg:`resolve -u [FILE]...`: mark a file as unresolved. The
4252 - :hg:`resolve -u [FILE]...`: mark a file as unresolved. The
4253 default is to mark all resolved files.
4253 default is to mark all resolved files.
4254
4254
4255 - :hg:`resolve -l`: list files which had or still have conflicts.
4255 - :hg:`resolve -l`: list files which had or still have conflicts.
4256 In the printed list, ``U`` = unresolved and ``R`` = resolved.
4256 In the printed list, ``U`` = unresolved and ``R`` = resolved.
4257 You can use ``set:unresolved()`` or ``set:resolved()`` to filter
4257 You can use ``set:unresolved()`` or ``set:resolved()`` to filter
4258 the list. See :hg:`help filesets` for details.
4258 the list. See :hg:`help filesets` for details.
4259
4259
4260 .. note::
4260 .. note::
4261
4261
4262 Mercurial will not let you commit files with unresolved merge
4262 Mercurial will not let you commit files with unresolved merge
4263 conflicts. You must use :hg:`resolve -m ...` before you can
4263 conflicts. You must use :hg:`resolve -m ...` before you can
4264 commit after a conflicting merge.
4264 commit after a conflicting merge.
4265
4265
4266 Returns 0 on success, 1 if any files fail a resolve attempt.
4266 Returns 0 on success, 1 if any files fail a resolve attempt.
4267 """
4267 """
4268
4268
4269 flaglist = 'all mark unmark list no_status'.split()
4269 flaglist = 'all mark unmark list no_status'.split()
4270 all, mark, unmark, show, nostatus = \
4270 all, mark, unmark, show, nostatus = \
4271 [opts.get(o) for o in flaglist]
4271 [opts.get(o) for o in flaglist]
4272
4272
4273 if (show and (mark or unmark)) or (mark and unmark):
4273 if (show and (mark or unmark)) or (mark and unmark):
4274 raise error.Abort(_("too many options specified"))
4274 raise error.Abort(_("too many options specified"))
4275 if pats and all:
4275 if pats and all:
4276 raise error.Abort(_("can't specify --all and patterns"))
4276 raise error.Abort(_("can't specify --all and patterns"))
4277 if not (all or pats or show or mark or unmark):
4277 if not (all or pats or show or mark or unmark):
4278 raise error.Abort(_('no files or directories specified'),
4278 raise error.Abort(_('no files or directories specified'),
4279 hint=('use --all to re-merge all unresolved files'))
4279 hint=('use --all to re-merge all unresolved files'))
4280
4280
4281 if show:
4281 if show:
4282 ui.pager('resolve')
4282 ui.pager('resolve')
4283 fm = ui.formatter('resolve', opts)
4283 fm = ui.formatter('resolve', opts)
4284 ms = mergemod.mergestate.read(repo)
4284 ms = mergemod.mergestate.read(repo)
4285 m = scmutil.match(repo[None], pats, opts)
4285 m = scmutil.match(repo[None], pats, opts)
4286 for f in ms:
4286 for f in ms:
4287 if not m(f):
4287 if not m(f):
4288 continue
4288 continue
4289 l = 'resolve.' + {'u': 'unresolved', 'r': 'resolved',
4289 l = 'resolve.' + {'u': 'unresolved', 'r': 'resolved',
4290 'd': 'driverresolved'}[ms[f]]
4290 'd': 'driverresolved'}[ms[f]]
4291 fm.startitem()
4291 fm.startitem()
4292 fm.condwrite(not nostatus, 'status', '%s ', ms[f].upper(), label=l)
4292 fm.condwrite(not nostatus, 'status', '%s ', ms[f].upper(), label=l)
4293 fm.write('path', '%s\n', f, label=l)
4293 fm.write('path', '%s\n', f, label=l)
4294 fm.end()
4294 fm.end()
4295 return 0
4295 return 0
4296
4296
4297 with repo.wlock():
4297 with repo.wlock():
4298 ms = mergemod.mergestate.read(repo)
4298 ms = mergemod.mergestate.read(repo)
4299
4299
4300 if not (ms.active() or repo.dirstate.p2() != nullid):
4300 if not (ms.active() or repo.dirstate.p2() != nullid):
4301 raise error.Abort(
4301 raise error.Abort(
4302 _('resolve command not applicable when not merging'))
4302 _('resolve command not applicable when not merging'))
4303
4303
4304 wctx = repo[None]
4304 wctx = repo[None]
4305
4305
4306 if ms.mergedriver and ms.mdstate() == 'u':
4306 if ms.mergedriver and ms.mdstate() == 'u':
4307 proceed = mergemod.driverpreprocess(repo, ms, wctx)
4307 proceed = mergemod.driverpreprocess(repo, ms, wctx)
4308 ms.commit()
4308 ms.commit()
4309 # allow mark and unmark to go through
4309 # allow mark and unmark to go through
4310 if not mark and not unmark and not proceed:
4310 if not mark and not unmark and not proceed:
4311 return 1
4311 return 1
4312
4312
4313 m = scmutil.match(wctx, pats, opts)
4313 m = scmutil.match(wctx, pats, opts)
4314 ret = 0
4314 ret = 0
4315 didwork = False
4315 didwork = False
4316 runconclude = False
4316 runconclude = False
4317
4317
4318 tocomplete = []
4318 tocomplete = []
4319 for f in ms:
4319 for f in ms:
4320 if not m(f):
4320 if not m(f):
4321 continue
4321 continue
4322
4322
4323 didwork = True
4323 didwork = True
4324
4324
4325 # don't let driver-resolved files be marked, and run the conclude
4325 # don't let driver-resolved files be marked, and run the conclude
4326 # step if asked to resolve
4326 # step if asked to resolve
4327 if ms[f] == "d":
4327 if ms[f] == "d":
4328 exact = m.exact(f)
4328 exact = m.exact(f)
4329 if mark:
4329 if mark:
4330 if exact:
4330 if exact:
4331 ui.warn(_('not marking %s as it is driver-resolved\n')
4331 ui.warn(_('not marking %s as it is driver-resolved\n')
4332 % f)
4332 % f)
4333 elif unmark:
4333 elif unmark:
4334 if exact:
4334 if exact:
4335 ui.warn(_('not unmarking %s as it is driver-resolved\n')
4335 ui.warn(_('not unmarking %s as it is driver-resolved\n')
4336 % f)
4336 % f)
4337 else:
4337 else:
4338 runconclude = True
4338 runconclude = True
4339 continue
4339 continue
4340
4340
4341 if mark:
4341 if mark:
4342 ms.mark(f, "r")
4342 ms.mark(f, "r")
4343 elif unmark:
4343 elif unmark:
4344 ms.mark(f, "u")
4344 ms.mark(f, "u")
4345 else:
4345 else:
4346 # backup pre-resolve (merge uses .orig for its own purposes)
4346 # backup pre-resolve (merge uses .orig for its own purposes)
4347 a = repo.wjoin(f)
4347 a = repo.wjoin(f)
4348 try:
4348 try:
4349 util.copyfile(a, a + ".resolve")
4349 util.copyfile(a, a + ".resolve")
4350 except (IOError, OSError) as inst:
4350 except (IOError, OSError) as inst:
4351 if inst.errno != errno.ENOENT:
4351 if inst.errno != errno.ENOENT:
4352 raise
4352 raise
4353
4353
4354 try:
4354 try:
4355 # preresolve file
4355 # preresolve file
4356 ui.setconfig('ui', 'forcemerge', opts.get('tool', ''),
4356 ui.setconfig('ui', 'forcemerge', opts.get('tool', ''),
4357 'resolve')
4357 'resolve')
4358 complete, r = ms.preresolve(f, wctx)
4358 complete, r = ms.preresolve(f, wctx)
4359 if not complete:
4359 if not complete:
4360 tocomplete.append(f)
4360 tocomplete.append(f)
4361 elif r:
4361 elif r:
4362 ret = 1
4362 ret = 1
4363 finally:
4363 finally:
4364 ui.setconfig('ui', 'forcemerge', '', 'resolve')
4364 ui.setconfig('ui', 'forcemerge', '', 'resolve')
4365 ms.commit()
4365 ms.commit()
4366
4366
4367 # replace filemerge's .orig file with our resolve file, but only
4367 # replace filemerge's .orig file with our resolve file, but only
4368 # for merges that are complete
4368 # for merges that are complete
4369 if complete:
4369 if complete:
4370 try:
4370 try:
4371 util.rename(a + ".resolve",
4371 util.rename(a + ".resolve",
4372 scmutil.origpath(ui, repo, a))
4372 scmutil.origpath(ui, repo, a))
4373 except OSError as inst:
4373 except OSError as inst:
4374 if inst.errno != errno.ENOENT:
4374 if inst.errno != errno.ENOENT:
4375 raise
4375 raise
4376
4376
4377 for f in tocomplete:
4377 for f in tocomplete:
4378 try:
4378 try:
4379 # resolve file
4379 # resolve file
4380 ui.setconfig('ui', 'forcemerge', opts.get('tool', ''),
4380 ui.setconfig('ui', 'forcemerge', opts.get('tool', ''),
4381 'resolve')
4381 'resolve')
4382 r = ms.resolve(f, wctx)
4382 r = ms.resolve(f, wctx)
4383 if r:
4383 if r:
4384 ret = 1
4384 ret = 1
4385 finally:
4385 finally:
4386 ui.setconfig('ui', 'forcemerge', '', 'resolve')
4386 ui.setconfig('ui', 'forcemerge', '', 'resolve')
4387 ms.commit()
4387 ms.commit()
4388
4388
4389 # replace filemerge's .orig file with our resolve file
4389 # replace filemerge's .orig file with our resolve file
4390 a = repo.wjoin(f)
4390 a = repo.wjoin(f)
4391 try:
4391 try:
4392 util.rename(a + ".resolve", scmutil.origpath(ui, repo, a))
4392 util.rename(a + ".resolve", scmutil.origpath(ui, repo, a))
4393 except OSError as inst:
4393 except OSError as inst:
4394 if inst.errno != errno.ENOENT:
4394 if inst.errno != errno.ENOENT:
4395 raise
4395 raise
4396
4396
4397 ms.commit()
4397 ms.commit()
4398 ms.recordactions()
4398 ms.recordactions()
4399
4399
4400 if not didwork and pats:
4400 if not didwork and pats:
4401 hint = None
4401 hint = None
4402 if not any([p for p in pats if p.find(':') >= 0]):
4402 if not any([p for p in pats if p.find(':') >= 0]):
4403 pats = ['path:%s' % p for p in pats]
4403 pats = ['path:%s' % p for p in pats]
4404 m = scmutil.match(wctx, pats, opts)
4404 m = scmutil.match(wctx, pats, opts)
4405 for f in ms:
4405 for f in ms:
4406 if not m(f):
4406 if not m(f):
4407 continue
4407 continue
4408 flags = ''.join(['-%s ' % o[0] for o in flaglist
4408 flags = ''.join(['-%s ' % o[0] for o in flaglist
4409 if opts.get(o)])
4409 if opts.get(o)])
4410 hint = _("(try: hg resolve %s%s)\n") % (
4410 hint = _("(try: hg resolve %s%s)\n") % (
4411 flags,
4411 flags,
4412 ' '.join(pats))
4412 ' '.join(pats))
4413 break
4413 break
4414 ui.warn(_("arguments do not match paths that need resolving\n"))
4414 ui.warn(_("arguments do not match paths that need resolving\n"))
4415 if hint:
4415 if hint:
4416 ui.warn(hint)
4416 ui.warn(hint)
4417 elif ms.mergedriver and ms.mdstate() != 's':
4417 elif ms.mergedriver and ms.mdstate() != 's':
4418 # run conclude step when either a driver-resolved file is requested
4418 # run conclude step when either a driver-resolved file is requested
4419 # or there are no driver-resolved files
4419 # or there are no driver-resolved files
4420 # we can't use 'ret' to determine whether any files are unresolved
4420 # we can't use 'ret' to determine whether any files are unresolved
4421 # because we might not have tried to resolve some
4421 # because we might not have tried to resolve some
4422 if ((runconclude or not list(ms.driverresolved()))
4422 if ((runconclude or not list(ms.driverresolved()))
4423 and not list(ms.unresolved())):
4423 and not list(ms.unresolved())):
4424 proceed = mergemod.driverconclude(repo, ms, wctx)
4424 proceed = mergemod.driverconclude(repo, ms, wctx)
4425 ms.commit()
4425 ms.commit()
4426 if not proceed:
4426 if not proceed:
4427 return 1
4427 return 1
4428
4428
4429 # Nudge users into finishing an unfinished operation
4429 # Nudge users into finishing an unfinished operation
4430 unresolvedf = list(ms.unresolved())
4430 unresolvedf = list(ms.unresolved())
4431 driverresolvedf = list(ms.driverresolved())
4431 driverresolvedf = list(ms.driverresolved())
4432 if not unresolvedf and not driverresolvedf:
4432 if not unresolvedf and not driverresolvedf:
4433 ui.status(_('(no more unresolved files)\n'))
4433 ui.status(_('(no more unresolved files)\n'))
4434 cmdutil.checkafterresolved(repo)
4434 cmdutil.checkafterresolved(repo)
4435 elif not unresolvedf:
4435 elif not unresolvedf:
4436 ui.status(_('(no more unresolved files -- '
4436 ui.status(_('(no more unresolved files -- '
4437 'run "hg resolve --all" to conclude)\n'))
4437 'run "hg resolve --all" to conclude)\n'))
4438
4438
4439 return ret
4439 return ret
4440
4440
4441 @command('revert',
4441 @command('revert',
4442 [('a', 'all', None, _('revert all changes when no arguments given')),
4442 [('a', 'all', None, _('revert all changes when no arguments given')),
4443 ('d', 'date', '', _('tipmost revision matching date'), _('DATE')),
4443 ('d', 'date', '', _('tipmost revision matching date'), _('DATE')),
4444 ('r', 'rev', '', _('revert to the specified revision'), _('REV')),
4444 ('r', 'rev', '', _('revert to the specified revision'), _('REV')),
4445 ('C', 'no-backup', None, _('do not save backup copies of files')),
4445 ('C', 'no-backup', None, _('do not save backup copies of files')),
4446 ('i', 'interactive', None,
4446 ('i', 'interactive', None,
4447 _('interactively select the changes (EXPERIMENTAL)')),
4447 _('interactively select the changes (EXPERIMENTAL)')),
4448 ] + walkopts + dryrunopts,
4448 ] + walkopts + dryrunopts,
4449 _('[OPTION]... [-r REV] [NAME]...'))
4449 _('[OPTION]... [-r REV] [NAME]...'))
4450 def revert(ui, repo, *pats, **opts):
4450 def revert(ui, repo, *pats, **opts):
4451 """restore files to their checkout state
4451 """restore files to their checkout state
4452
4452
4453 .. note::
4453 .. note::
4454
4454
4455 To check out earlier revisions, you should use :hg:`update REV`.
4455 To check out earlier revisions, you should use :hg:`update REV`.
4456 To cancel an uncommitted merge (and lose your changes),
4456 To cancel an uncommitted merge (and lose your changes),
4457 use :hg:`update --clean .`.
4457 use :hg:`update --clean .`.
4458
4458
4459 With no revision specified, revert the specified files or directories
4459 With no revision specified, revert the specified files or directories
4460 to the contents they had in the parent of the working directory.
4460 to the contents they had in the parent of the working directory.
4461 This restores the contents of files to an unmodified
4461 This restores the contents of files to an unmodified
4462 state and unschedules adds, removes, copies, and renames. If the
4462 state and unschedules adds, removes, copies, and renames. If the
4463 working directory has two parents, you must explicitly specify a
4463 working directory has two parents, you must explicitly specify a
4464 revision.
4464 revision.
4465
4465
4466 Using the -r/--rev or -d/--date options, revert the given files or
4466 Using the -r/--rev or -d/--date options, revert the given files or
4467 directories to their states as of a specific revision. Because
4467 directories to their states as of a specific revision. Because
4468 revert does not change the working directory parents, this will
4468 revert does not change the working directory parents, this will
4469 cause these files to appear modified. This can be helpful to "back
4469 cause these files to appear modified. This can be helpful to "back
4470 out" some or all of an earlier change. See :hg:`backout` for a
4470 out" some or all of an earlier change. See :hg:`backout` for a
4471 related method.
4471 related method.
4472
4472
4473 Modified files are saved with a .orig suffix before reverting.
4473 Modified files are saved with a .orig suffix before reverting.
4474 To disable these backups, use --no-backup. It is possible to store
4474 To disable these backups, use --no-backup. It is possible to store
4475 the backup files in a custom directory relative to the root of the
4475 the backup files in a custom directory relative to the root of the
4476 repository by setting the ``ui.origbackuppath`` configuration
4476 repository by setting the ``ui.origbackuppath`` configuration
4477 option.
4477 option.
4478
4478
4479 See :hg:`help dates` for a list of formats valid for -d/--date.
4479 See :hg:`help dates` for a list of formats valid for -d/--date.
4480
4480
4481 See :hg:`help backout` for a way to reverse the effect of an
4481 See :hg:`help backout` for a way to reverse the effect of an
4482 earlier changeset.
4482 earlier changeset.
4483
4483
4484 Returns 0 on success.
4484 Returns 0 on success.
4485 """
4485 """
4486
4486
4487 if opts.get("date"):
4487 if opts.get("date"):
4488 if opts.get("rev"):
4488 if opts.get("rev"):
4489 raise error.Abort(_("you can't specify a revision and a date"))
4489 raise error.Abort(_("you can't specify a revision and a date"))
4490 opts["rev"] = cmdutil.finddate(ui, repo, opts["date"])
4490 opts["rev"] = cmdutil.finddate(ui, repo, opts["date"])
4491
4491
4492 parent, p2 = repo.dirstate.parents()
4492 parent, p2 = repo.dirstate.parents()
4493 if not opts.get('rev') and p2 != nullid:
4493 if not opts.get('rev') and p2 != nullid:
4494 # revert after merge is a trap for new users (issue2915)
4494 # revert after merge is a trap for new users (issue2915)
4495 raise error.Abort(_('uncommitted merge with no revision specified'),
4495 raise error.Abort(_('uncommitted merge with no revision specified'),
4496 hint=_("use 'hg update' or see 'hg help revert'"))
4496 hint=_("use 'hg update' or see 'hg help revert'"))
4497
4497
4498 ctx = scmutil.revsingle(repo, opts.get('rev'))
4498 ctx = scmutil.revsingle(repo, opts.get('rev'))
4499
4499
4500 if (not (pats or opts.get('include') or opts.get('exclude') or
4500 if (not (pats or opts.get('include') or opts.get('exclude') or
4501 opts.get('all') or opts.get('interactive'))):
4501 opts.get('all') or opts.get('interactive'))):
4502 msg = _("no files or directories specified")
4502 msg = _("no files or directories specified")
4503 if p2 != nullid:
4503 if p2 != nullid:
4504 hint = _("uncommitted merge, use --all to discard all changes,"
4504 hint = _("uncommitted merge, use --all to discard all changes,"
4505 " or 'hg update -C .' to abort the merge")
4505 " or 'hg update -C .' to abort the merge")
4506 raise error.Abort(msg, hint=hint)
4506 raise error.Abort(msg, hint=hint)
4507 dirty = any(repo.status())
4507 dirty = any(repo.status())
4508 node = ctx.node()
4508 node = ctx.node()
4509 if node != parent:
4509 if node != parent:
4510 if dirty:
4510 if dirty:
4511 hint = _("uncommitted changes, use --all to discard all"
4511 hint = _("uncommitted changes, use --all to discard all"
4512 " changes, or 'hg update %s' to update") % ctx.rev()
4512 " changes, or 'hg update %s' to update") % ctx.rev()
4513 else:
4513 else:
4514 hint = _("use --all to revert all files,"
4514 hint = _("use --all to revert all files,"
4515 " or 'hg update %s' to update") % ctx.rev()
4515 " or 'hg update %s' to update") % ctx.rev()
4516 elif dirty:
4516 elif dirty:
4517 hint = _("uncommitted changes, use --all to discard all changes")
4517 hint = _("uncommitted changes, use --all to discard all changes")
4518 else:
4518 else:
4519 hint = _("use --all to revert all files")
4519 hint = _("use --all to revert all files")
4520 raise error.Abort(msg, hint=hint)
4520 raise error.Abort(msg, hint=hint)
4521
4521
4522 return cmdutil.revert(ui, repo, ctx, (parent, p2), *pats, **opts)
4522 return cmdutil.revert(ui, repo, ctx, (parent, p2), *pats, **opts)
4523
4523
4524 @command('rollback', dryrunopts +
4524 @command('rollback', dryrunopts +
4525 [('f', 'force', False, _('ignore safety measures'))])
4525 [('f', 'force', False, _('ignore safety measures'))])
4526 def rollback(ui, repo, **opts):
4526 def rollback(ui, repo, **opts):
4527 """roll back the last transaction (DANGEROUS) (DEPRECATED)
4527 """roll back the last transaction (DANGEROUS) (DEPRECATED)
4528
4528
4529 Please use :hg:`commit --amend` instead of rollback to correct
4529 Please use :hg:`commit --amend` instead of rollback to correct
4530 mistakes in the last commit.
4530 mistakes in the last commit.
4531
4531
4532 This command should be used with care. There is only one level of
4532 This command should be used with care. There is only one level of
4533 rollback, and there is no way to undo a rollback. It will also
4533 rollback, and there is no way to undo a rollback. It will also
4534 restore the dirstate at the time of the last transaction, losing
4534 restore the dirstate at the time of the last transaction, losing
4535 any dirstate changes since that time. This command does not alter
4535 any dirstate changes since that time. This command does not alter
4536 the working directory.
4536 the working directory.
4537
4537
4538 Transactions are used to encapsulate the effects of all commands
4538 Transactions are used to encapsulate the effects of all commands
4539 that create new changesets or propagate existing changesets into a
4539 that create new changesets or propagate existing changesets into a
4540 repository.
4540 repository.
4541
4541
4542 .. container:: verbose
4542 .. container:: verbose
4543
4543
4544 For example, the following commands are transactional, and their
4544 For example, the following commands are transactional, and their
4545 effects can be rolled back:
4545 effects can be rolled back:
4546
4546
4547 - commit
4547 - commit
4548 - import
4548 - import
4549 - pull
4549 - pull
4550 - push (with this repository as the destination)
4550 - push (with this repository as the destination)
4551 - unbundle
4551 - unbundle
4552
4552
4553 To avoid permanent data loss, rollback will refuse to rollback a
4553 To avoid permanent data loss, rollback will refuse to rollback a
4554 commit transaction if it isn't checked out. Use --force to
4554 commit transaction if it isn't checked out. Use --force to
4555 override this protection.
4555 override this protection.
4556
4556
4557 The rollback command can be entirely disabled by setting the
4557 The rollback command can be entirely disabled by setting the
4558 ``ui.rollback`` configuration setting to false. If you're here
4558 ``ui.rollback`` configuration setting to false. If you're here
4559 because you want to use rollback and it's disabled, you can
4559 because you want to use rollback and it's disabled, you can
4560 re-enable the command by setting ``ui.rollback`` to true.
4560 re-enable the command by setting ``ui.rollback`` to true.
4561
4561
4562 This command is not intended for use on public repositories. Once
4562 This command is not intended for use on public repositories. Once
4563 changes are visible for pull by other users, rolling a transaction
4563 changes are visible for pull by other users, rolling a transaction
4564 back locally is ineffective (someone else may already have pulled
4564 back locally is ineffective (someone else may already have pulled
4565 the changes). Furthermore, a race is possible with readers of the
4565 the changes). Furthermore, a race is possible with readers of the
4566 repository; for example an in-progress pull from the repository
4566 repository; for example an in-progress pull from the repository
4567 may fail if a rollback is performed.
4567 may fail if a rollback is performed.
4568
4568
4569 Returns 0 on success, 1 if no rollback data is available.
4569 Returns 0 on success, 1 if no rollback data is available.
4570 """
4570 """
4571 if not ui.configbool('ui', 'rollback', True):
4571 if not ui.configbool('ui', 'rollback', True):
4572 raise error.Abort(_('rollback is disabled because it is unsafe'),
4572 raise error.Abort(_('rollback is disabled because it is unsafe'),
4573 hint=('see `hg help -v rollback` for information'))
4573 hint=('see `hg help -v rollback` for information'))
4574 return repo.rollback(dryrun=opts.get('dry_run'),
4574 return repo.rollback(dryrun=opts.get('dry_run'),
4575 force=opts.get('force'))
4575 force=opts.get('force'))
4576
4576
4577 @command('root', [])
4577 @command('root', [])
4578 def root(ui, repo):
4578 def root(ui, repo):
4579 """print the root (top) of the current working directory
4579 """print the root (top) of the current working directory
4580
4580
4581 Print the root directory of the current repository.
4581 Print the root directory of the current repository.
4582
4582
4583 Returns 0 on success.
4583 Returns 0 on success.
4584 """
4584 """
4585 ui.write(repo.root + "\n")
4585 ui.write(repo.root + "\n")
4586
4586
4587 @command('^serve',
4587 @command('^serve',
4588 [('A', 'accesslog', '', _('name of access log file to write to'),
4588 [('A', 'accesslog', '', _('name of access log file to write to'),
4589 _('FILE')),
4589 _('FILE')),
4590 ('d', 'daemon', None, _('run server in background')),
4590 ('d', 'daemon', None, _('run server in background')),
4591 ('', 'daemon-postexec', [], _('used internally by daemon mode')),
4591 ('', 'daemon-postexec', [], _('used internally by daemon mode')),
4592 ('E', 'errorlog', '', _('name of error log file to write to'), _('FILE')),
4592 ('E', 'errorlog', '', _('name of error log file to write to'), _('FILE')),
4593 # use string type, then we can check if something was passed
4593 # use string type, then we can check if something was passed
4594 ('p', 'port', '', _('port to listen on (default: 8000)'), _('PORT')),
4594 ('p', 'port', '', _('port to listen on (default: 8000)'), _('PORT')),
4595 ('a', 'address', '', _('address to listen on (default: all interfaces)'),
4595 ('a', 'address', '', _('address to listen on (default: all interfaces)'),
4596 _('ADDR')),
4596 _('ADDR')),
4597 ('', 'prefix', '', _('prefix path to serve from (default: server root)'),
4597 ('', 'prefix', '', _('prefix path to serve from (default: server root)'),
4598 _('PREFIX')),
4598 _('PREFIX')),
4599 ('n', 'name', '',
4599 ('n', 'name', '',
4600 _('name to show in web pages (default: working directory)'), _('NAME')),
4600 _('name to show in web pages (default: working directory)'), _('NAME')),
4601 ('', 'web-conf', '',
4601 ('', 'web-conf', '',
4602 _("name of the hgweb config file (see 'hg help hgweb')"), _('FILE')),
4602 _("name of the hgweb config file (see 'hg help hgweb')"), _('FILE')),
4603 ('', 'webdir-conf', '', _('name of the hgweb config file (DEPRECATED)'),
4603 ('', 'webdir-conf', '', _('name of the hgweb config file (DEPRECATED)'),
4604 _('FILE')),
4604 _('FILE')),
4605 ('', 'pid-file', '', _('name of file to write process ID to'), _('FILE')),
4605 ('', 'pid-file', '', _('name of file to write process ID to'), _('FILE')),
4606 ('', 'stdio', None, _('for remote clients (ADVANCED)')),
4606 ('', 'stdio', None, _('for remote clients (ADVANCED)')),
4607 ('', 'cmdserver', '', _('for remote clients (ADVANCED)'), _('MODE')),
4607 ('', 'cmdserver', '', _('for remote clients (ADVANCED)'), _('MODE')),
4608 ('t', 'templates', '', _('web templates to use'), _('TEMPLATE')),
4608 ('t', 'templates', '', _('web templates to use'), _('TEMPLATE')),
4609 ('', 'style', '', _('template style to use'), _('STYLE')),
4609 ('', 'style', '', _('template style to use'), _('STYLE')),
4610 ('6', 'ipv6', None, _('use IPv6 in addition to IPv4')),
4610 ('6', 'ipv6', None, _('use IPv6 in addition to IPv4')),
4611 ('', 'certificate', '', _('SSL certificate file'), _('FILE'))],
4611 ('', 'certificate', '', _('SSL certificate file'), _('FILE'))],
4612 _('[OPTION]...'),
4612 _('[OPTION]...'),
4613 optionalrepo=True)
4613 optionalrepo=True)
4614 def serve(ui, repo, **opts):
4614 def serve(ui, repo, **opts):
4615 """start stand-alone webserver
4615 """start stand-alone webserver
4616
4616
4617 Start a local HTTP repository browser and pull server. You can use
4617 Start a local HTTP repository browser and pull server. You can use
4618 this for ad-hoc sharing and browsing of repositories. It is
4618 this for ad-hoc sharing and browsing of repositories. It is
4619 recommended to use a real web server to serve a repository for
4619 recommended to use a real web server to serve a repository for
4620 longer periods of time.
4620 longer periods of time.
4621
4621
4622 Please note that the server does not implement access control.
4622 Please note that the server does not implement access control.
4623 This means that, by default, anybody can read from the server and
4623 This means that, by default, anybody can read from the server and
4624 nobody can write to it by default. Set the ``web.allow_push``
4624 nobody can write to it by default. Set the ``web.allow_push``
4625 option to ``*`` to allow everybody to push to the server. You
4625 option to ``*`` to allow everybody to push to the server. You
4626 should use a real web server if you need to authenticate users.
4626 should use a real web server if you need to authenticate users.
4627
4627
4628 By default, the server logs accesses to stdout and errors to
4628 By default, the server logs accesses to stdout and errors to
4629 stderr. Use the -A/--accesslog and -E/--errorlog options to log to
4629 stderr. Use the -A/--accesslog and -E/--errorlog options to log to
4630 files.
4630 files.
4631
4631
4632 To have the server choose a free port number to listen on, specify
4632 To have the server choose a free port number to listen on, specify
4633 a port number of 0; in this case, the server will print the port
4633 a port number of 0; in this case, the server will print the port
4634 number it uses.
4634 number it uses.
4635
4635
4636 Returns 0 on success.
4636 Returns 0 on success.
4637 """
4637 """
4638
4638
4639 if opts["stdio"] and opts["cmdserver"]:
4639 if opts["stdio"] and opts["cmdserver"]:
4640 raise error.Abort(_("cannot use --stdio with --cmdserver"))
4640 raise error.Abort(_("cannot use --stdio with --cmdserver"))
4641
4641
4642 if opts["stdio"]:
4642 if opts["stdio"]:
4643 if repo is None:
4643 if repo is None:
4644 raise error.RepoError(_("there is no Mercurial repository here"
4644 raise error.RepoError(_("there is no Mercurial repository here"
4645 " (.hg not found)"))
4645 " (.hg not found)"))
4646 s = sshserver.sshserver(ui, repo)
4646 s = sshserver.sshserver(ui, repo)
4647 s.serve_forever()
4647 s.serve_forever()
4648
4648
4649 service = server.createservice(ui, repo, opts)
4649 service = server.createservice(ui, repo, opts)
4650 return server.runservice(opts, initfn=service.init, runfn=service.run)
4650 return server.runservice(opts, initfn=service.init, runfn=service.run)
4651
4651
4652 @command('^status|st',
4652 @command('^status|st',
4653 [('A', 'all', None, _('show status of all files')),
4653 [('A', 'all', None, _('show status of all files')),
4654 ('m', 'modified', None, _('show only modified files')),
4654 ('m', 'modified', None, _('show only modified files')),
4655 ('a', 'added', None, _('show only added files')),
4655 ('a', 'added', None, _('show only added files')),
4656 ('r', 'removed', None, _('show only removed files')),
4656 ('r', 'removed', None, _('show only removed files')),
4657 ('d', 'deleted', None, _('show only deleted (but tracked) files')),
4657 ('d', 'deleted', None, _('show only deleted (but tracked) files')),
4658 ('c', 'clean', None, _('show only files without changes')),
4658 ('c', 'clean', None, _('show only files without changes')),
4659 ('u', 'unknown', None, _('show only unknown (not tracked) files')),
4659 ('u', 'unknown', None, _('show only unknown (not tracked) files')),
4660 ('i', 'ignored', None, _('show only ignored files')),
4660 ('i', 'ignored', None, _('show only ignored files')),
4661 ('n', 'no-status', None, _('hide status prefix')),
4661 ('n', 'no-status', None, _('hide status prefix')),
4662 ('C', 'copies', None, _('show source of copied files')),
4662 ('C', 'copies', None, _('show source of copied files')),
4663 ('0', 'print0', None, _('end filenames with NUL, for use with xargs')),
4663 ('0', 'print0', None, _('end filenames with NUL, for use with xargs')),
4664 ('', 'rev', [], _('show difference from revision'), _('REV')),
4664 ('', 'rev', [], _('show difference from revision'), _('REV')),
4665 ('', 'change', '', _('list the changed files of a revision'), _('REV')),
4665 ('', 'change', '', _('list the changed files of a revision'), _('REV')),
4666 ] + walkopts + subrepoopts + formatteropts,
4666 ] + walkopts + subrepoopts + formatteropts,
4667 _('[OPTION]... [FILE]...'),
4667 _('[OPTION]... [FILE]...'),
4668 inferrepo=True)
4668 inferrepo=True)
4669 def status(ui, repo, *pats, **opts):
4669 def status(ui, repo, *pats, **opts):
4670 """show changed files in the working directory
4670 """show changed files in the working directory
4671
4671
4672 Show status of files in the repository. If names are given, only
4672 Show status of files in the repository. If names are given, only
4673 files that match are shown. Files that are clean or ignored or
4673 files that match are shown. Files that are clean or ignored or
4674 the source of a copy/move operation, are not listed unless
4674 the source of a copy/move operation, are not listed unless
4675 -c/--clean, -i/--ignored, -C/--copies or -A/--all are given.
4675 -c/--clean, -i/--ignored, -C/--copies or -A/--all are given.
4676 Unless options described with "show only ..." are given, the
4676 Unless options described with "show only ..." are given, the
4677 options -mardu are used.
4677 options -mardu are used.
4678
4678
4679 Option -q/--quiet hides untracked (unknown and ignored) files
4679 Option -q/--quiet hides untracked (unknown and ignored) files
4680 unless explicitly requested with -u/--unknown or -i/--ignored.
4680 unless explicitly requested with -u/--unknown or -i/--ignored.
4681
4681
4682 .. note::
4682 .. note::
4683
4683
4684 :hg:`status` may appear to disagree with diff if permissions have
4684 :hg:`status` may appear to disagree with diff if permissions have
4685 changed or a merge has occurred. The standard diff format does
4685 changed or a merge has occurred. The standard diff format does
4686 not report permission changes and diff only reports changes
4686 not report permission changes and diff only reports changes
4687 relative to one merge parent.
4687 relative to one merge parent.
4688
4688
4689 If one revision is given, it is used as the base revision.
4689 If one revision is given, it is used as the base revision.
4690 If two revisions are given, the differences between them are
4690 If two revisions are given, the differences between them are
4691 shown. The --change option can also be used as a shortcut to list
4691 shown. The --change option can also be used as a shortcut to list
4692 the changed files of a revision from its first parent.
4692 the changed files of a revision from its first parent.
4693
4693
4694 The codes used to show the status of files are::
4694 The codes used to show the status of files are::
4695
4695
4696 M = modified
4696 M = modified
4697 A = added
4697 A = added
4698 R = removed
4698 R = removed
4699 C = clean
4699 C = clean
4700 ! = missing (deleted by non-hg command, but still tracked)
4700 ! = missing (deleted by non-hg command, but still tracked)
4701 ? = not tracked
4701 ? = not tracked
4702 I = ignored
4702 I = ignored
4703 = origin of the previous file (with --copies)
4703 = origin of the previous file (with --copies)
4704
4704
4705 .. container:: verbose
4705 .. container:: verbose
4706
4706
4707 Examples:
4707 Examples:
4708
4708
4709 - show changes in the working directory relative to a
4709 - show changes in the working directory relative to a
4710 changeset::
4710 changeset::
4711
4711
4712 hg status --rev 9353
4712 hg status --rev 9353
4713
4713
4714 - show changes in the working directory relative to the
4714 - show changes in the working directory relative to the
4715 current directory (see :hg:`help patterns` for more information)::
4715 current directory (see :hg:`help patterns` for more information)::
4716
4716
4717 hg status re:
4717 hg status re:
4718
4718
4719 - show all changes including copies in an existing changeset::
4719 - show all changes including copies in an existing changeset::
4720
4720
4721 hg status --copies --change 9353
4721 hg status --copies --change 9353
4722
4722
4723 - get a NUL separated list of added files, suitable for xargs::
4723 - get a NUL separated list of added files, suitable for xargs::
4724
4724
4725 hg status -an0
4725 hg status -an0
4726
4726
4727 Returns 0 on success.
4727 Returns 0 on success.
4728 """
4728 """
4729
4729
4730 opts = pycompat.byteskwargs(opts)
4730 opts = pycompat.byteskwargs(opts)
4731 revs = opts.get('rev')
4731 revs = opts.get('rev')
4732 change = opts.get('change')
4732 change = opts.get('change')
4733
4733
4734 if revs and change:
4734 if revs and change:
4735 msg = _('cannot specify --rev and --change at the same time')
4735 msg = _('cannot specify --rev and --change at the same time')
4736 raise error.Abort(msg)
4736 raise error.Abort(msg)
4737 elif change:
4737 elif change:
4738 node2 = scmutil.revsingle(repo, change, None).node()
4738 node2 = scmutil.revsingle(repo, change, None).node()
4739 node1 = repo[node2].p1().node()
4739 node1 = repo[node2].p1().node()
4740 else:
4740 else:
4741 node1, node2 = scmutil.revpair(repo, revs)
4741 node1, node2 = scmutil.revpair(repo, revs)
4742
4742
4743 if pats or ui.configbool('commands', 'status.relative'):
4743 if pats or ui.configbool('commands', 'status.relative'):
4744 cwd = repo.getcwd()
4744 cwd = repo.getcwd()
4745 else:
4745 else:
4746 cwd = ''
4746 cwd = ''
4747
4747
4748 if opts.get('print0'):
4748 if opts.get('print0'):
4749 end = '\0'
4749 end = '\0'
4750 else:
4750 else:
4751 end = '\n'
4751 end = '\n'
4752 copy = {}
4752 copy = {}
4753 states = 'modified added removed deleted unknown ignored clean'.split()
4753 states = 'modified added removed deleted unknown ignored clean'.split()
4754 show = [k for k in states if opts.get(k)]
4754 show = [k for k in states if opts.get(k)]
4755 if opts.get('all'):
4755 if opts.get('all'):
4756 show += ui.quiet and (states[:4] + ['clean']) or states
4756 show += ui.quiet and (states[:4] + ['clean']) or states
4757 if not show:
4757 if not show:
4758 if ui.quiet:
4758 if ui.quiet:
4759 show = states[:4]
4759 show = states[:4]
4760 else:
4760 else:
4761 show = states[:5]
4761 show = states[:5]
4762
4762
4763 m = scmutil.match(repo[node2], pats, opts)
4763 m = scmutil.match(repo[node2], pats, opts)
4764 stat = repo.status(node1, node2, m,
4764 stat = repo.status(node1, node2, m,
4765 'ignored' in show, 'clean' in show, 'unknown' in show,
4765 'ignored' in show, 'clean' in show, 'unknown' in show,
4766 opts.get('subrepos'))
4766 opts.get('subrepos'))
4767 changestates = zip(states, pycompat.iterbytestr('MAR!?IC'), stat)
4767 changestates = zip(states, pycompat.iterbytestr('MAR!?IC'), stat)
4768
4768
4769 if (opts.get('all') or opts.get('copies')
4769 if (opts.get('all') or opts.get('copies')
4770 or ui.configbool('ui', 'statuscopies')) and not opts.get('no_status'):
4770 or ui.configbool('ui', 'statuscopies')) and not opts.get('no_status'):
4771 copy = copies.pathcopies(repo[node1], repo[node2], m)
4771 copy = copies.pathcopies(repo[node1], repo[node2], m)
4772
4772
4773 ui.pager('status')
4773 ui.pager('status')
4774 fm = ui.formatter('status', opts)
4774 fm = ui.formatter('status', opts)
4775 fmt = '%s' + end
4775 fmt = '%s' + end
4776 showchar = not opts.get('no_status')
4776 showchar = not opts.get('no_status')
4777
4777
4778 for state, char, files in changestates:
4778 for state, char, files in changestates:
4779 if state in show:
4779 if state in show:
4780 label = 'status.' + state
4780 label = 'status.' + state
4781 for f in files:
4781 for f in files:
4782 fm.startitem()
4782 fm.startitem()
4783 fm.condwrite(showchar, 'status', '%s ', char, label=label)
4783 fm.condwrite(showchar, 'status', '%s ', char, label=label)
4784 fm.write('path', fmt, repo.pathto(f, cwd), label=label)
4784 fm.write('path', fmt, repo.pathto(f, cwd), label=label)
4785 if f in copy:
4785 if f in copy:
4786 fm.write("copy", ' %s' + end, repo.pathto(copy[f], cwd),
4786 fm.write("copy", ' %s' + end, repo.pathto(copy[f], cwd),
4787 label='status.copied')
4787 label='status.copied')
4788 fm.end()
4788 fm.end()
4789
4789
4790 @command('^summary|sum',
4790 @command('^summary|sum',
4791 [('', 'remote', None, _('check for push and pull'))], '[--remote]')
4791 [('', 'remote', None, _('check for push and pull'))], '[--remote]')
4792 def summary(ui, repo, **opts):
4792 def summary(ui, repo, **opts):
4793 """summarize working directory state
4793 """summarize working directory state
4794
4794
4795 This generates a brief summary of the working directory state,
4795 This generates a brief summary of the working directory state,
4796 including parents, branch, commit status, phase and available updates.
4796 including parents, branch, commit status, phase and available updates.
4797
4797
4798 With the --remote option, this will check the default paths for
4798 With the --remote option, this will check the default paths for
4799 incoming and outgoing changes. This can be time-consuming.
4799 incoming and outgoing changes. This can be time-consuming.
4800
4800
4801 Returns 0 on success.
4801 Returns 0 on success.
4802 """
4802 """
4803
4803
4804 ui.pager('summary')
4804 ui.pager('summary')
4805 ctx = repo[None]
4805 ctx = repo[None]
4806 parents = ctx.parents()
4806 parents = ctx.parents()
4807 pnode = parents[0].node()
4807 pnode = parents[0].node()
4808 marks = []
4808 marks = []
4809
4809
4810 ms = None
4810 ms = None
4811 try:
4811 try:
4812 ms = mergemod.mergestate.read(repo)
4812 ms = mergemod.mergestate.read(repo)
4813 except error.UnsupportedMergeRecords as e:
4813 except error.UnsupportedMergeRecords as e:
4814 s = ' '.join(e.recordtypes)
4814 s = ' '.join(e.recordtypes)
4815 ui.warn(
4815 ui.warn(
4816 _('warning: merge state has unsupported record types: %s\n') % s)
4816 _('warning: merge state has unsupported record types: %s\n') % s)
4817 unresolved = 0
4817 unresolved = 0
4818 else:
4818 else:
4819 unresolved = [f for f in ms if ms[f] == 'u']
4819 unresolved = [f for f in ms if ms[f] == 'u']
4820
4820
4821 for p in parents:
4821 for p in parents:
4822 # label with log.changeset (instead of log.parent) since this
4822 # label with log.changeset (instead of log.parent) since this
4823 # shows a working directory parent *changeset*:
4823 # shows a working directory parent *changeset*:
4824 # i18n: column positioning for "hg summary"
4824 # i18n: column positioning for "hg summary"
4825 ui.write(_('parent: %d:%s ') % (p.rev(), p),
4825 ui.write(_('parent: %d:%s ') % (p.rev(), p),
4826 label=cmdutil._changesetlabels(p))
4826 label=cmdutil._changesetlabels(p))
4827 ui.write(' '.join(p.tags()), label='log.tag')
4827 ui.write(' '.join(p.tags()), label='log.tag')
4828 if p.bookmarks():
4828 if p.bookmarks():
4829 marks.extend(p.bookmarks())
4829 marks.extend(p.bookmarks())
4830 if p.rev() == -1:
4830 if p.rev() == -1:
4831 if not len(repo):
4831 if not len(repo):
4832 ui.write(_(' (empty repository)'))
4832 ui.write(_(' (empty repository)'))
4833 else:
4833 else:
4834 ui.write(_(' (no revision checked out)'))
4834 ui.write(_(' (no revision checked out)'))
4835 if p.obsolete():
4835 if p.obsolete():
4836 ui.write(_(' (obsolete)'))
4836 ui.write(_(' (obsolete)'))
4837 if p.troubled():
4837 if p.troubled():
4838 ui.write(' ('
4838 ui.write(' ('
4839 + ', '.join(ui.label(trouble, 'trouble.%s' % trouble)
4839 + ', '.join(ui.label(trouble, 'trouble.%s' % trouble)
4840 for trouble in p.troubles())
4840 for trouble in p.troubles())
4841 + ')')
4841 + ')')
4842 ui.write('\n')
4842 ui.write('\n')
4843 if p.description():
4843 if p.description():
4844 ui.status(' ' + p.description().splitlines()[0].strip() + '\n',
4844 ui.status(' ' + p.description().splitlines()[0].strip() + '\n',
4845 label='log.summary')
4845 label='log.summary')
4846
4846
4847 branch = ctx.branch()
4847 branch = ctx.branch()
4848 bheads = repo.branchheads(branch)
4848 bheads = repo.branchheads(branch)
4849 # i18n: column positioning for "hg summary"
4849 # i18n: column positioning for "hg summary"
4850 m = _('branch: %s\n') % branch
4850 m = _('branch: %s\n') % branch
4851 if branch != 'default':
4851 if branch != 'default':
4852 ui.write(m, label='log.branch')
4852 ui.write(m, label='log.branch')
4853 else:
4853 else:
4854 ui.status(m, label='log.branch')
4854 ui.status(m, label='log.branch')
4855
4855
4856 if marks:
4856 if marks:
4857 active = repo._activebookmark
4857 active = repo._activebookmark
4858 # i18n: column positioning for "hg summary"
4858 # i18n: column positioning for "hg summary"
4859 ui.write(_('bookmarks:'), label='log.bookmark')
4859 ui.write(_('bookmarks:'), label='log.bookmark')
4860 if active is not None:
4860 if active is not None:
4861 if active in marks:
4861 if active in marks:
4862 ui.write(' *' + active, label=activebookmarklabel)
4862 ui.write(' *' + active, label=activebookmarklabel)
4863 marks.remove(active)
4863 marks.remove(active)
4864 else:
4864 else:
4865 ui.write(' [%s]' % active, label=activebookmarklabel)
4865 ui.write(' [%s]' % active, label=activebookmarklabel)
4866 for m in marks:
4866 for m in marks:
4867 ui.write(' ' + m, label='log.bookmark')
4867 ui.write(' ' + m, label='log.bookmark')
4868 ui.write('\n', label='log.bookmark')
4868 ui.write('\n', label='log.bookmark')
4869
4869
4870 status = repo.status(unknown=True)
4870 status = repo.status(unknown=True)
4871
4871
4872 c = repo.dirstate.copies()
4872 c = repo.dirstate.copies()
4873 copied, renamed = [], []
4873 copied, renamed = [], []
4874 for d, s in c.iteritems():
4874 for d, s in c.iteritems():
4875 if s in status.removed:
4875 if s in status.removed:
4876 status.removed.remove(s)
4876 status.removed.remove(s)
4877 renamed.append(d)
4877 renamed.append(d)
4878 else:
4878 else:
4879 copied.append(d)
4879 copied.append(d)
4880 if d in status.added:
4880 if d in status.added:
4881 status.added.remove(d)
4881 status.added.remove(d)
4882
4882
4883 subs = [s for s in ctx.substate if ctx.sub(s).dirty()]
4883 subs = [s for s in ctx.substate if ctx.sub(s).dirty()]
4884
4884
4885 labels = [(ui.label(_('%d modified'), 'status.modified'), status.modified),
4885 labels = [(ui.label(_('%d modified'), 'status.modified'), status.modified),
4886 (ui.label(_('%d added'), 'status.added'), status.added),
4886 (ui.label(_('%d added'), 'status.added'), status.added),
4887 (ui.label(_('%d removed'), 'status.removed'), status.removed),
4887 (ui.label(_('%d removed'), 'status.removed'), status.removed),
4888 (ui.label(_('%d renamed'), 'status.copied'), renamed),
4888 (ui.label(_('%d renamed'), 'status.copied'), renamed),
4889 (ui.label(_('%d copied'), 'status.copied'), copied),
4889 (ui.label(_('%d copied'), 'status.copied'), copied),
4890 (ui.label(_('%d deleted'), 'status.deleted'), status.deleted),
4890 (ui.label(_('%d deleted'), 'status.deleted'), status.deleted),
4891 (ui.label(_('%d unknown'), 'status.unknown'), status.unknown),
4891 (ui.label(_('%d unknown'), 'status.unknown'), status.unknown),
4892 (ui.label(_('%d unresolved'), 'resolve.unresolved'), unresolved),
4892 (ui.label(_('%d unresolved'), 'resolve.unresolved'), unresolved),
4893 (ui.label(_('%d subrepos'), 'status.modified'), subs)]
4893 (ui.label(_('%d subrepos'), 'status.modified'), subs)]
4894 t = []
4894 t = []
4895 for l, s in labels:
4895 for l, s in labels:
4896 if s:
4896 if s:
4897 t.append(l % len(s))
4897 t.append(l % len(s))
4898
4898
4899 t = ', '.join(t)
4899 t = ', '.join(t)
4900 cleanworkdir = False
4900 cleanworkdir = False
4901
4901
4902 if repo.vfs.exists('graftstate'):
4902 if repo.vfs.exists('graftstate'):
4903 t += _(' (graft in progress)')
4903 t += _(' (graft in progress)')
4904 if repo.vfs.exists('updatestate'):
4904 if repo.vfs.exists('updatestate'):
4905 t += _(' (interrupted update)')
4905 t += _(' (interrupted update)')
4906 elif len(parents) > 1:
4906 elif len(parents) > 1:
4907 t += _(' (merge)')
4907 t += _(' (merge)')
4908 elif branch != parents[0].branch():
4908 elif branch != parents[0].branch():
4909 t += _(' (new branch)')
4909 t += _(' (new branch)')
4910 elif (parents[0].closesbranch() and
4910 elif (parents[0].closesbranch() and
4911 pnode in repo.branchheads(branch, closed=True)):
4911 pnode in repo.branchheads(branch, closed=True)):
4912 t += _(' (head closed)')
4912 t += _(' (head closed)')
4913 elif not (status.modified or status.added or status.removed or renamed or
4913 elif not (status.modified or status.added or status.removed or renamed or
4914 copied or subs):
4914 copied or subs):
4915 t += _(' (clean)')
4915 t += _(' (clean)')
4916 cleanworkdir = True
4916 cleanworkdir = True
4917 elif pnode not in bheads:
4917 elif pnode not in bheads:
4918 t += _(' (new branch head)')
4918 t += _(' (new branch head)')
4919
4919
4920 if parents:
4920 if parents:
4921 pendingphase = max(p.phase() for p in parents)
4921 pendingphase = max(p.phase() for p in parents)
4922 else:
4922 else:
4923 pendingphase = phases.public
4923 pendingphase = phases.public
4924
4924
4925 if pendingphase > phases.newcommitphase(ui):
4925 if pendingphase > phases.newcommitphase(ui):
4926 t += ' (%s)' % phases.phasenames[pendingphase]
4926 t += ' (%s)' % phases.phasenames[pendingphase]
4927
4927
4928 if cleanworkdir:
4928 if cleanworkdir:
4929 # i18n: column positioning for "hg summary"
4929 # i18n: column positioning for "hg summary"
4930 ui.status(_('commit: %s\n') % t.strip())
4930 ui.status(_('commit: %s\n') % t.strip())
4931 else:
4931 else:
4932 # i18n: column positioning for "hg summary"
4932 # i18n: column positioning for "hg summary"
4933 ui.write(_('commit: %s\n') % t.strip())
4933 ui.write(_('commit: %s\n') % t.strip())
4934
4934
4935 # all ancestors of branch heads - all ancestors of parent = new csets
4935 # all ancestors of branch heads - all ancestors of parent = new csets
4936 new = len(repo.changelog.findmissing([pctx.node() for pctx in parents],
4936 new = len(repo.changelog.findmissing([pctx.node() for pctx in parents],
4937 bheads))
4937 bheads))
4938
4938
4939 if new == 0:
4939 if new == 0:
4940 # i18n: column positioning for "hg summary"
4940 # i18n: column positioning for "hg summary"
4941 ui.status(_('update: (current)\n'))
4941 ui.status(_('update: (current)\n'))
4942 elif pnode not in bheads:
4942 elif pnode not in bheads:
4943 # i18n: column positioning for "hg summary"
4943 # i18n: column positioning for "hg summary"
4944 ui.write(_('update: %d new changesets (update)\n') % new)
4944 ui.write(_('update: %d new changesets (update)\n') % new)
4945 else:
4945 else:
4946 # i18n: column positioning for "hg summary"
4946 # i18n: column positioning for "hg summary"
4947 ui.write(_('update: %d new changesets, %d branch heads (merge)\n') %
4947 ui.write(_('update: %d new changesets, %d branch heads (merge)\n') %
4948 (new, len(bheads)))
4948 (new, len(bheads)))
4949
4949
4950 t = []
4950 t = []
4951 draft = len(repo.revs('draft()'))
4951 draft = len(repo.revs('draft()'))
4952 if draft:
4952 if draft:
4953 t.append(_('%d draft') % draft)
4953 t.append(_('%d draft') % draft)
4954 secret = len(repo.revs('secret()'))
4954 secret = len(repo.revs('secret()'))
4955 if secret:
4955 if secret:
4956 t.append(_('%d secret') % secret)
4956 t.append(_('%d secret') % secret)
4957
4957
4958 if draft or secret:
4958 if draft or secret:
4959 ui.status(_('phases: %s\n') % ', '.join(t))
4959 ui.status(_('phases: %s\n') % ', '.join(t))
4960
4960
4961 if obsolete.isenabled(repo, obsolete.createmarkersopt):
4961 if obsolete.isenabled(repo, obsolete.createmarkersopt):
4962 for trouble in ("unstable", "divergent", "bumped"):
4962 for trouble in ("unstable", "divergent", "bumped"):
4963 numtrouble = len(repo.revs(trouble + "()"))
4963 numtrouble = len(repo.revs(trouble + "()"))
4964 # We write all the possibilities to ease translation
4964 # We write all the possibilities to ease translation
4965 troublemsg = {
4965 troublemsg = {
4966 "unstable": _("unstable: %d changesets"),
4966 "unstable": _("unstable: %d changesets"),
4967 "divergent": _("divergent: %d changesets"),
4967 "divergent": _("divergent: %d changesets"),
4968 "bumped": _("bumped: %d changesets"),
4968 "bumped": _("bumped: %d changesets"),
4969 }
4969 }
4970 if numtrouble > 0:
4970 if numtrouble > 0:
4971 ui.status(troublemsg[trouble] % numtrouble + "\n")
4971 ui.status(troublemsg[trouble] % numtrouble + "\n")
4972
4972
4973 cmdutil.summaryhooks(ui, repo)
4973 cmdutil.summaryhooks(ui, repo)
4974
4974
4975 if opts.get('remote'):
4975 if opts.get('remote'):
4976 needsincoming, needsoutgoing = True, True
4976 needsincoming, needsoutgoing = True, True
4977 else:
4977 else:
4978 needsincoming, needsoutgoing = False, False
4978 needsincoming, needsoutgoing = False, False
4979 for i, o in cmdutil.summaryremotehooks(ui, repo, opts, None):
4979 for i, o in cmdutil.summaryremotehooks(ui, repo, opts, None):
4980 if i:
4980 if i:
4981 needsincoming = True
4981 needsincoming = True
4982 if o:
4982 if o:
4983 needsoutgoing = True
4983 needsoutgoing = True
4984 if not needsincoming and not needsoutgoing:
4984 if not needsincoming and not needsoutgoing:
4985 return
4985 return
4986
4986
4987 def getincoming():
4987 def getincoming():
4988 source, branches = hg.parseurl(ui.expandpath('default'))
4988 source, branches = hg.parseurl(ui.expandpath('default'))
4989 sbranch = branches[0]
4989 sbranch = branches[0]
4990 try:
4990 try:
4991 other = hg.peer(repo, {}, source)
4991 other = hg.peer(repo, {}, source)
4992 except error.RepoError:
4992 except error.RepoError:
4993 if opts.get('remote'):
4993 if opts.get('remote'):
4994 raise
4994 raise
4995 return source, sbranch, None, None, None
4995 return source, sbranch, None, None, None
4996 revs, checkout = hg.addbranchrevs(repo, other, branches, None)
4996 revs, checkout = hg.addbranchrevs(repo, other, branches, None)
4997 if revs:
4997 if revs:
4998 revs = [other.lookup(rev) for rev in revs]
4998 revs = [other.lookup(rev) for rev in revs]
4999 ui.debug('comparing with %s\n' % util.hidepassword(source))
4999 ui.debug('comparing with %s\n' % util.hidepassword(source))
5000 repo.ui.pushbuffer()
5000 repo.ui.pushbuffer()
5001 commoninc = discovery.findcommonincoming(repo, other, heads=revs)
5001 commoninc = discovery.findcommonincoming(repo, other, heads=revs)
5002 repo.ui.popbuffer()
5002 repo.ui.popbuffer()
5003 return source, sbranch, other, commoninc, commoninc[1]
5003 return source, sbranch, other, commoninc, commoninc[1]
5004
5004
5005 if needsincoming:
5005 if needsincoming:
5006 source, sbranch, sother, commoninc, incoming = getincoming()
5006 source, sbranch, sother, commoninc, incoming = getincoming()
5007 else:
5007 else:
5008 source = sbranch = sother = commoninc = incoming = None
5008 source = sbranch = sother = commoninc = incoming = None
5009
5009
5010 def getoutgoing():
5010 def getoutgoing():
5011 dest, branches = hg.parseurl(ui.expandpath('default-push', 'default'))
5011 dest, branches = hg.parseurl(ui.expandpath('default-push', 'default'))
5012 dbranch = branches[0]
5012 dbranch = branches[0]
5013 revs, checkout = hg.addbranchrevs(repo, repo, branches, None)
5013 revs, checkout = hg.addbranchrevs(repo, repo, branches, None)
5014 if source != dest:
5014 if source != dest:
5015 try:
5015 try:
5016 dother = hg.peer(repo, {}, dest)
5016 dother = hg.peer(repo, {}, dest)
5017 except error.RepoError:
5017 except error.RepoError:
5018 if opts.get('remote'):
5018 if opts.get('remote'):
5019 raise
5019 raise
5020 return dest, dbranch, None, None
5020 return dest, dbranch, None, None
5021 ui.debug('comparing with %s\n' % util.hidepassword(dest))
5021 ui.debug('comparing with %s\n' % util.hidepassword(dest))
5022 elif sother is None:
5022 elif sother is None:
5023 # there is no explicit destination peer, but source one is invalid
5023 # there is no explicit destination peer, but source one is invalid
5024 return dest, dbranch, None, None
5024 return dest, dbranch, None, None
5025 else:
5025 else:
5026 dother = sother
5026 dother = sother
5027 if (source != dest or (sbranch is not None and sbranch != dbranch)):
5027 if (source != dest or (sbranch is not None and sbranch != dbranch)):
5028 common = None
5028 common = None
5029 else:
5029 else:
5030 common = commoninc
5030 common = commoninc
5031 if revs:
5031 if revs:
5032 revs = [repo.lookup(rev) for rev in revs]
5032 revs = [repo.lookup(rev) for rev in revs]
5033 repo.ui.pushbuffer()
5033 repo.ui.pushbuffer()
5034 outgoing = discovery.findcommonoutgoing(repo, dother, onlyheads=revs,
5034 outgoing = discovery.findcommonoutgoing(repo, dother, onlyheads=revs,
5035 commoninc=common)
5035 commoninc=common)
5036 repo.ui.popbuffer()
5036 repo.ui.popbuffer()
5037 return dest, dbranch, dother, outgoing
5037 return dest, dbranch, dother, outgoing
5038
5038
5039 if needsoutgoing:
5039 if needsoutgoing:
5040 dest, dbranch, dother, outgoing = getoutgoing()
5040 dest, dbranch, dother, outgoing = getoutgoing()
5041 else:
5041 else:
5042 dest = dbranch = dother = outgoing = None
5042 dest = dbranch = dother = outgoing = None
5043
5043
5044 if opts.get('remote'):
5044 if opts.get('remote'):
5045 t = []
5045 t = []
5046 if incoming:
5046 if incoming:
5047 t.append(_('1 or more incoming'))
5047 t.append(_('1 or more incoming'))
5048 o = outgoing.missing
5048 o = outgoing.missing
5049 if o:
5049 if o:
5050 t.append(_('%d outgoing') % len(o))
5050 t.append(_('%d outgoing') % len(o))
5051 other = dother or sother
5051 other = dother or sother
5052 if 'bookmarks' in other.listkeys('namespaces'):
5052 if 'bookmarks' in other.listkeys('namespaces'):
5053 counts = bookmarks.summary(repo, other)
5053 counts = bookmarks.summary(repo, other)
5054 if counts[0] > 0:
5054 if counts[0] > 0:
5055 t.append(_('%d incoming bookmarks') % counts[0])
5055 t.append(_('%d incoming bookmarks') % counts[0])
5056 if counts[1] > 0:
5056 if counts[1] > 0:
5057 t.append(_('%d outgoing bookmarks') % counts[1])
5057 t.append(_('%d outgoing bookmarks') % counts[1])
5058
5058
5059 if t:
5059 if t:
5060 # i18n: column positioning for "hg summary"
5060 # i18n: column positioning for "hg summary"
5061 ui.write(_('remote: %s\n') % (', '.join(t)))
5061 ui.write(_('remote: %s\n') % (', '.join(t)))
5062 else:
5062 else:
5063 # i18n: column positioning for "hg summary"
5063 # i18n: column positioning for "hg summary"
5064 ui.status(_('remote: (synced)\n'))
5064 ui.status(_('remote: (synced)\n'))
5065
5065
5066 cmdutil.summaryremotehooks(ui, repo, opts,
5066 cmdutil.summaryremotehooks(ui, repo, opts,
5067 ((source, sbranch, sother, commoninc),
5067 ((source, sbranch, sother, commoninc),
5068 (dest, dbranch, dother, outgoing)))
5068 (dest, dbranch, dother, outgoing)))
5069
5069
5070 @command('tag',
5070 @command('tag',
5071 [('f', 'force', None, _('force tag')),
5071 [('f', 'force', None, _('force tag')),
5072 ('l', 'local', None, _('make the tag local')),
5072 ('l', 'local', None, _('make the tag local')),
5073 ('r', 'rev', '', _('revision to tag'), _('REV')),
5073 ('r', 'rev', '', _('revision to tag'), _('REV')),
5074 ('', 'remove', None, _('remove a tag')),
5074 ('', 'remove', None, _('remove a tag')),
5075 # -l/--local is already there, commitopts cannot be used
5075 # -l/--local is already there, commitopts cannot be used
5076 ('e', 'edit', None, _('invoke editor on commit messages')),
5076 ('e', 'edit', None, _('invoke editor on commit messages')),
5077 ('m', 'message', '', _('use text as commit message'), _('TEXT')),
5077 ('m', 'message', '', _('use text as commit message'), _('TEXT')),
5078 ] + commitopts2,
5078 ] + commitopts2,
5079 _('[-f] [-l] [-m TEXT] [-d DATE] [-u USER] [-r REV] NAME...'))
5079 _('[-f] [-l] [-m TEXT] [-d DATE] [-u USER] [-r REV] NAME...'))
5080 def tag(ui, repo, name1, *names, **opts):
5080 def tag(ui, repo, name1, *names, **opts):
5081 """add one or more tags for the current or given revision
5081 """add one or more tags for the current or given revision
5082
5082
5083 Name a particular revision using <name>.
5083 Name a particular revision using <name>.
5084
5084
5085 Tags are used to name particular revisions of the repository and are
5085 Tags are used to name particular revisions of the repository and are
5086 very useful to compare different revisions, to go back to significant
5086 very useful to compare different revisions, to go back to significant
5087 earlier versions or to mark branch points as releases, etc. Changing
5087 earlier versions or to mark branch points as releases, etc. Changing
5088 an existing tag is normally disallowed; use -f/--force to override.
5088 an existing tag is normally disallowed; use -f/--force to override.
5089
5089
5090 If no revision is given, the parent of the working directory is
5090 If no revision is given, the parent of the working directory is
5091 used.
5091 used.
5092
5092
5093 To facilitate version control, distribution, and merging of tags,
5093 To facilitate version control, distribution, and merging of tags,
5094 they are stored as a file named ".hgtags" which is managed similarly
5094 they are stored as a file named ".hgtags" which is managed similarly
5095 to other project files and can be hand-edited if necessary. This
5095 to other project files and can be hand-edited if necessary. This
5096 also means that tagging creates a new commit. The file
5096 also means that tagging creates a new commit. The file
5097 ".hg/localtags" is used for local tags (not shared among
5097 ".hg/localtags" is used for local tags (not shared among
5098 repositories).
5098 repositories).
5099
5099
5100 Tag commits are usually made at the head of a branch. If the parent
5100 Tag commits are usually made at the head of a branch. If the parent
5101 of the working directory is not a branch head, :hg:`tag` aborts; use
5101 of the working directory is not a branch head, :hg:`tag` aborts; use
5102 -f/--force to force the tag commit to be based on a non-head
5102 -f/--force to force the tag commit to be based on a non-head
5103 changeset.
5103 changeset.
5104
5104
5105 See :hg:`help dates` for a list of formats valid for -d/--date.
5105 See :hg:`help dates` for a list of formats valid for -d/--date.
5106
5106
5107 Since tag names have priority over branch names during revision
5107 Since tag names have priority over branch names during revision
5108 lookup, using an existing branch name as a tag name is discouraged.
5108 lookup, using an existing branch name as a tag name is discouraged.
5109
5109
5110 Returns 0 on success.
5110 Returns 0 on success.
5111 """
5111 """
5112 wlock = lock = None
5112 wlock = lock = None
5113 try:
5113 try:
5114 wlock = repo.wlock()
5114 wlock = repo.wlock()
5115 lock = repo.lock()
5115 lock = repo.lock()
5116 rev_ = "."
5116 rev_ = "."
5117 names = [t.strip() for t in (name1,) + names]
5117 names = [t.strip() for t in (name1,) + names]
5118 if len(names) != len(set(names)):
5118 if len(names) != len(set(names)):
5119 raise error.Abort(_('tag names must be unique'))
5119 raise error.Abort(_('tag names must be unique'))
5120 for n in names:
5120 for n in names:
5121 scmutil.checknewlabel(repo, n, 'tag')
5121 scmutil.checknewlabel(repo, n, 'tag')
5122 if not n:
5122 if not n:
5123 raise error.Abort(_('tag names cannot consist entirely of '
5123 raise error.Abort(_('tag names cannot consist entirely of '
5124 'whitespace'))
5124 'whitespace'))
5125 if opts.get('rev') and opts.get('remove'):
5125 if opts.get('rev') and opts.get('remove'):
5126 raise error.Abort(_("--rev and --remove are incompatible"))
5126 raise error.Abort(_("--rev and --remove are incompatible"))
5127 if opts.get('rev'):
5127 if opts.get('rev'):
5128 rev_ = opts['rev']
5128 rev_ = opts['rev']
5129 message = opts.get('message')
5129 message = opts.get('message')
5130 if opts.get('remove'):
5130 if opts.get('remove'):
5131 if opts.get('local'):
5131 if opts.get('local'):
5132 expectedtype = 'local'
5132 expectedtype = 'local'
5133 else:
5133 else:
5134 expectedtype = 'global'
5134 expectedtype = 'global'
5135
5135
5136 for n in names:
5136 for n in names:
5137 if not repo.tagtype(n):
5137 if not repo.tagtype(n):
5138 raise error.Abort(_("tag '%s' does not exist") % n)
5138 raise error.Abort(_("tag '%s' does not exist") % n)
5139 if repo.tagtype(n) != expectedtype:
5139 if repo.tagtype(n) != expectedtype:
5140 if expectedtype == 'global':
5140 if expectedtype == 'global':
5141 raise error.Abort(_("tag '%s' is not a global tag") % n)
5141 raise error.Abort(_("tag '%s' is not a global tag") % n)
5142 else:
5142 else:
5143 raise error.Abort(_("tag '%s' is not a local tag") % n)
5143 raise error.Abort(_("tag '%s' is not a local tag") % n)
5144 rev_ = 'null'
5144 rev_ = 'null'
5145 if not message:
5145 if not message:
5146 # we don't translate commit messages
5146 # we don't translate commit messages
5147 message = 'Removed tag %s' % ', '.join(names)
5147 message = 'Removed tag %s' % ', '.join(names)
5148 elif not opts.get('force'):
5148 elif not opts.get('force'):
5149 for n in names:
5149 for n in names:
5150 if n in repo.tags():
5150 if n in repo.tags():
5151 raise error.Abort(_("tag '%s' already exists "
5151 raise error.Abort(_("tag '%s' already exists "
5152 "(use -f to force)") % n)
5152 "(use -f to force)") % n)
5153 if not opts.get('local'):
5153 if not opts.get('local'):
5154 p1, p2 = repo.dirstate.parents()
5154 p1, p2 = repo.dirstate.parents()
5155 if p2 != nullid:
5155 if p2 != nullid:
5156 raise error.Abort(_('uncommitted merge'))
5156 raise error.Abort(_('uncommitted merge'))
5157 bheads = repo.branchheads()
5157 bheads = repo.branchheads()
5158 if not opts.get('force') and bheads and p1 not in bheads:
5158 if not opts.get('force') and bheads and p1 not in bheads:
5159 raise error.Abort(_('working directory is not at a branch head '
5159 raise error.Abort(_('working directory is not at a branch head '
5160 '(use -f to force)'))
5160 '(use -f to force)'))
5161 r = scmutil.revsingle(repo, rev_).node()
5161 r = scmutil.revsingle(repo, rev_).node()
5162
5162
5163 if not message:
5163 if not message:
5164 # we don't translate commit messages
5164 # we don't translate commit messages
5165 message = ('Added tag %s for changeset %s' %
5165 message = ('Added tag %s for changeset %s' %
5166 (', '.join(names), short(r)))
5166 (', '.join(names), short(r)))
5167
5167
5168 date = opts.get('date')
5168 date = opts.get('date')
5169 if date:
5169 if date:
5170 date = util.parsedate(date)
5170 date = util.parsedate(date)
5171
5171
5172 if opts.get('remove'):
5172 if opts.get('remove'):
5173 editform = 'tag.remove'
5173 editform = 'tag.remove'
5174 else:
5174 else:
5175 editform = 'tag.add'
5175 editform = 'tag.add'
5176 editor = cmdutil.getcommiteditor(editform=editform, **opts)
5176 editor = cmdutil.getcommiteditor(editform=editform, **opts)
5177
5177
5178 # don't allow tagging the null rev
5178 # don't allow tagging the null rev
5179 if (not opts.get('remove') and
5179 if (not opts.get('remove') and
5180 scmutil.revsingle(repo, rev_).rev() == nullrev):
5180 scmutil.revsingle(repo, rev_).rev() == nullrev):
5181 raise error.Abort(_("cannot tag null revision"))
5181 raise error.Abort(_("cannot tag null revision"))
5182
5182
5183 tagsmod.tag(repo, names, r, message, opts.get('local'),
5183 tagsmod.tag(repo, names, r, message, opts.get('local'),
5184 opts.get('user'), date, editor=editor)
5184 opts.get('user'), date, editor=editor)
5185 finally:
5185 finally:
5186 release(lock, wlock)
5186 release(lock, wlock)
5187
5187
5188 @command('tags', formatteropts, '')
5188 @command('tags', formatteropts, '')
5189 def tags(ui, repo, **opts):
5189 def tags(ui, repo, **opts):
5190 """list repository tags
5190 """list repository tags
5191
5191
5192 This lists both regular and local tags. When the -v/--verbose
5192 This lists both regular and local tags. When the -v/--verbose
5193 switch is used, a third column "local" is printed for local tags.
5193 switch is used, a third column "local" is printed for local tags.
5194 When the -q/--quiet switch is used, only the tag name is printed.
5194 When the -q/--quiet switch is used, only the tag name is printed.
5195
5195
5196 Returns 0 on success.
5196 Returns 0 on success.
5197 """
5197 """
5198
5198
5199 ui.pager('tags')
5199 ui.pager('tags')
5200 fm = ui.formatter('tags', opts)
5200 fm = ui.formatter('tags', opts)
5201 hexfunc = fm.hexfunc
5201 hexfunc = fm.hexfunc
5202 tagtype = ""
5202 tagtype = ""
5203
5203
5204 for t, n in reversed(repo.tagslist()):
5204 for t, n in reversed(repo.tagslist()):
5205 hn = hexfunc(n)
5205 hn = hexfunc(n)
5206 label = 'tags.normal'
5206 label = 'tags.normal'
5207 tagtype = ''
5207 tagtype = ''
5208 if repo.tagtype(t) == 'local':
5208 if repo.tagtype(t) == 'local':
5209 label = 'tags.local'
5209 label = 'tags.local'
5210 tagtype = 'local'
5210 tagtype = 'local'
5211
5211
5212 fm.startitem()
5212 fm.startitem()
5213 fm.write('tag', '%s', t, label=label)
5213 fm.write('tag', '%s', t, label=label)
5214 fmt = " " * (30 - encoding.colwidth(t)) + ' %5d:%s'
5214 fmt = " " * (30 - encoding.colwidth(t)) + ' %5d:%s'
5215 fm.condwrite(not ui.quiet, 'rev node', fmt,
5215 fm.condwrite(not ui.quiet, 'rev node', fmt,
5216 repo.changelog.rev(n), hn, label=label)
5216 repo.changelog.rev(n), hn, label=label)
5217 fm.condwrite(ui.verbose and tagtype, 'type', ' %s',
5217 fm.condwrite(ui.verbose and tagtype, 'type', ' %s',
5218 tagtype, label=label)
5218 tagtype, label=label)
5219 fm.plain('\n')
5219 fm.plain('\n')
5220 fm.end()
5220 fm.end()
5221
5221
5222 @command('tip',
5222 @command('tip',
5223 [('p', 'patch', None, _('show patch')),
5223 [('p', 'patch', None, _('show patch')),
5224 ('g', 'git', None, _('use git extended diff format')),
5224 ('g', 'git', None, _('use git extended diff format')),
5225 ] + templateopts,
5225 ] + templateopts,
5226 _('[-p] [-g]'))
5226 _('[-p] [-g]'))
5227 def tip(ui, repo, **opts):
5227 def tip(ui, repo, **opts):
5228 """show the tip revision (DEPRECATED)
5228 """show the tip revision (DEPRECATED)
5229
5229
5230 The tip revision (usually just called the tip) is the changeset
5230 The tip revision (usually just called the tip) is the changeset
5231 most recently added to the repository (and therefore the most
5231 most recently added to the repository (and therefore the most
5232 recently changed head).
5232 recently changed head).
5233
5233
5234 If you have just made a commit, that commit will be the tip. If
5234 If you have just made a commit, that commit will be the tip. If
5235 you have just pulled changes from another repository, the tip of
5235 you have just pulled changes from another repository, the tip of
5236 that repository becomes the current tip. The "tip" tag is special
5236 that repository becomes the current tip. The "tip" tag is special
5237 and cannot be renamed or assigned to a different changeset.
5237 and cannot be renamed or assigned to a different changeset.
5238
5238
5239 This command is deprecated, please use :hg:`heads` instead.
5239 This command is deprecated, please use :hg:`heads` instead.
5240
5240
5241 Returns 0 on success.
5241 Returns 0 on success.
5242 """
5242 """
5243 displayer = cmdutil.show_changeset(ui, repo, opts)
5243 displayer = cmdutil.show_changeset(ui, repo, opts)
5244 displayer.show(repo['tip'])
5244 displayer.show(repo['tip'])
5245 displayer.close()
5245 displayer.close()
5246
5246
5247 @command('unbundle',
5247 @command('unbundle',
5248 [('u', 'update', None,
5248 [('u', 'update', None,
5249 _('update to new branch head if changesets were unbundled'))],
5249 _('update to new branch head if changesets were unbundled'))],
5250 _('[-u] FILE...'))
5250 _('[-u] FILE...'))
5251 def unbundle(ui, repo, fname1, *fnames, **opts):
5251 def unbundle(ui, repo, fname1, *fnames, **opts):
5252 """apply one or more changegroup files
5252 """apply one or more bundle files
5253
5253
5254 Apply one or more compressed changegroup files generated by the
5254 Apply one or more bundle files generated by :hg:`bundle`.
5255 bundle command.
5256
5255
5257 Returns 0 on success, 1 if an update has unresolved files.
5256 Returns 0 on success, 1 if an update has unresolved files.
5258 """
5257 """
5259 fnames = (fname1,) + fnames
5258 fnames = (fname1,) + fnames
5260
5259
5261 with repo.lock():
5260 with repo.lock():
5262 for fname in fnames:
5261 for fname in fnames:
5263 f = hg.openpath(ui, fname)
5262 f = hg.openpath(ui, fname)
5264 gen = exchange.readbundle(ui, f, fname)
5263 gen = exchange.readbundle(ui, f, fname)
5265 if isinstance(gen, bundle2.unbundle20):
5264 if isinstance(gen, bundle2.unbundle20):
5266 tr = repo.transaction('unbundle')
5265 tr = repo.transaction('unbundle')
5267 try:
5266 try:
5268 op = bundle2.applybundle(repo, gen, tr, source='unbundle',
5267 op = bundle2.applybundle(repo, gen, tr, source='unbundle',
5269 url='bundle:' + fname)
5268 url='bundle:' + fname)
5270 tr.close()
5269 tr.close()
5271 except error.BundleUnknownFeatureError as exc:
5270 except error.BundleUnknownFeatureError as exc:
5272 raise error.Abort(_('%s: unknown bundle feature, %s')
5271 raise error.Abort(_('%s: unknown bundle feature, %s')
5273 % (fname, exc),
5272 % (fname, exc),
5274 hint=_("see https://mercurial-scm.org/"
5273 hint=_("see https://mercurial-scm.org/"
5275 "wiki/BundleFeature for more "
5274 "wiki/BundleFeature for more "
5276 "information"))
5275 "information"))
5277 finally:
5276 finally:
5278 if tr:
5277 if tr:
5279 tr.release()
5278 tr.release()
5280 changes = [r.get('return', 0)
5279 changes = [r.get('return', 0)
5281 for r in op.records['changegroup']]
5280 for r in op.records['changegroup']]
5282 modheads = changegroup.combineresults(changes)
5281 modheads = changegroup.combineresults(changes)
5283 elif isinstance(gen, streamclone.streamcloneapplier):
5282 elif isinstance(gen, streamclone.streamcloneapplier):
5284 raise error.Abort(
5283 raise error.Abort(
5285 _('packed bundles cannot be applied with '
5284 _('packed bundles cannot be applied with '
5286 '"hg unbundle"'),
5285 '"hg unbundle"'),
5287 hint=_('use "hg debugapplystreamclonebundle"'))
5286 hint=_('use "hg debugapplystreamclonebundle"'))
5288 else:
5287 else:
5289 modheads = gen.apply(repo, 'unbundle', 'bundle:' + fname)
5288 modheads = gen.apply(repo, 'unbundle', 'bundle:' + fname)
5290
5289
5291 return postincoming(ui, repo, modheads, opts.get('update'), None, None)
5290 return postincoming(ui, repo, modheads, opts.get('update'), None, None)
5292
5291
5293 @command('^update|up|checkout|co',
5292 @command('^update|up|checkout|co',
5294 [('C', 'clean', None, _('discard uncommitted changes (no backup)')),
5293 [('C', 'clean', None, _('discard uncommitted changes (no backup)')),
5295 ('c', 'check', None, _('require clean working directory')),
5294 ('c', 'check', None, _('require clean working directory')),
5296 ('m', 'merge', None, _('merge uncommitted changes')),
5295 ('m', 'merge', None, _('merge uncommitted changes')),
5297 ('d', 'date', '', _('tipmost revision matching date'), _('DATE')),
5296 ('d', 'date', '', _('tipmost revision matching date'), _('DATE')),
5298 ('r', 'rev', '', _('revision'), _('REV'))
5297 ('r', 'rev', '', _('revision'), _('REV'))
5299 ] + mergetoolopts,
5298 ] + mergetoolopts,
5300 _('[-C|-c|-m] [-d DATE] [[-r] REV]'))
5299 _('[-C|-c|-m] [-d DATE] [[-r] REV]'))
5301 def update(ui, repo, node=None, rev=None, clean=False, date=None, check=False,
5300 def update(ui, repo, node=None, rev=None, clean=False, date=None, check=False,
5302 merge=None, tool=None):
5301 merge=None, tool=None):
5303 """update working directory (or switch revisions)
5302 """update working directory (or switch revisions)
5304
5303
5305 Update the repository's working directory to the specified
5304 Update the repository's working directory to the specified
5306 changeset. If no changeset is specified, update to the tip of the
5305 changeset. If no changeset is specified, update to the tip of the
5307 current named branch and move the active bookmark (see :hg:`help
5306 current named branch and move the active bookmark (see :hg:`help
5308 bookmarks`).
5307 bookmarks`).
5309
5308
5310 Update sets the working directory's parent revision to the specified
5309 Update sets the working directory's parent revision to the specified
5311 changeset (see :hg:`help parents`).
5310 changeset (see :hg:`help parents`).
5312
5311
5313 If the changeset is not a descendant or ancestor of the working
5312 If the changeset is not a descendant or ancestor of the working
5314 directory's parent and there are uncommitted changes, the update is
5313 directory's parent and there are uncommitted changes, the update is
5315 aborted. With the -c/--check option, the working directory is checked
5314 aborted. With the -c/--check option, the working directory is checked
5316 for uncommitted changes; if none are found, the working directory is
5315 for uncommitted changes; if none are found, the working directory is
5317 updated to the specified changeset.
5316 updated to the specified changeset.
5318
5317
5319 .. container:: verbose
5318 .. container:: verbose
5320
5319
5321 The -C/--clean, -c/--check, and -m/--merge options control what
5320 The -C/--clean, -c/--check, and -m/--merge options control what
5322 happens if the working directory contains uncommitted changes.
5321 happens if the working directory contains uncommitted changes.
5323 At most of one of them can be specified.
5322 At most of one of them can be specified.
5324
5323
5325 1. If no option is specified, and if
5324 1. If no option is specified, and if
5326 the requested changeset is an ancestor or descendant of
5325 the requested changeset is an ancestor or descendant of
5327 the working directory's parent, the uncommitted changes
5326 the working directory's parent, the uncommitted changes
5328 are merged into the requested changeset and the merged
5327 are merged into the requested changeset and the merged
5329 result is left uncommitted. If the requested changeset is
5328 result is left uncommitted. If the requested changeset is
5330 not an ancestor or descendant (that is, it is on another
5329 not an ancestor or descendant (that is, it is on another
5331 branch), the update is aborted and the uncommitted changes
5330 branch), the update is aborted and the uncommitted changes
5332 are preserved.
5331 are preserved.
5333
5332
5334 2. With the -m/--merge option, the update is allowed even if the
5333 2. With the -m/--merge option, the update is allowed even if the
5335 requested changeset is not an ancestor or descendant of
5334 requested changeset is not an ancestor or descendant of
5336 the working directory's parent.
5335 the working directory's parent.
5337
5336
5338 3. With the -c/--check option, the update is aborted and the
5337 3. With the -c/--check option, the update is aborted and the
5339 uncommitted changes are preserved.
5338 uncommitted changes are preserved.
5340
5339
5341 4. With the -C/--clean option, uncommitted changes are discarded and
5340 4. With the -C/--clean option, uncommitted changes are discarded and
5342 the working directory is updated to the requested changeset.
5341 the working directory is updated to the requested changeset.
5343
5342
5344 To cancel an uncommitted merge (and lose your changes), use
5343 To cancel an uncommitted merge (and lose your changes), use
5345 :hg:`update --clean .`.
5344 :hg:`update --clean .`.
5346
5345
5347 Use null as the changeset to remove the working directory (like
5346 Use null as the changeset to remove the working directory (like
5348 :hg:`clone -U`).
5347 :hg:`clone -U`).
5349
5348
5350 If you want to revert just one file to an older revision, use
5349 If you want to revert just one file to an older revision, use
5351 :hg:`revert [-r REV] NAME`.
5350 :hg:`revert [-r REV] NAME`.
5352
5351
5353 See :hg:`help dates` for a list of formats valid for -d/--date.
5352 See :hg:`help dates` for a list of formats valid for -d/--date.
5354
5353
5355 Returns 0 on success, 1 if there are unresolved files.
5354 Returns 0 on success, 1 if there are unresolved files.
5356 """
5355 """
5357 if rev and node:
5356 if rev and node:
5358 raise error.Abort(_("please specify just one revision"))
5357 raise error.Abort(_("please specify just one revision"))
5359
5358
5360 if ui.configbool('commands', 'update.requiredest'):
5359 if ui.configbool('commands', 'update.requiredest'):
5361 if not node and not rev and not date:
5360 if not node and not rev and not date:
5362 raise error.Abort(_('you must specify a destination'),
5361 raise error.Abort(_('you must specify a destination'),
5363 hint=_('for example: hg update ".::"'))
5362 hint=_('for example: hg update ".::"'))
5364
5363
5365 if rev is None or rev == '':
5364 if rev is None or rev == '':
5366 rev = node
5365 rev = node
5367
5366
5368 if date and rev is not None:
5367 if date and rev is not None:
5369 raise error.Abort(_("you can't specify a revision and a date"))
5368 raise error.Abort(_("you can't specify a revision and a date"))
5370
5369
5371 if len([x for x in (clean, check, merge) if x]) > 1:
5370 if len([x for x in (clean, check, merge) if x]) > 1:
5372 raise error.Abort(_("can only specify one of -C/--clean, -c/--check, "
5371 raise error.Abort(_("can only specify one of -C/--clean, -c/--check, "
5373 "or -m/merge"))
5372 "or -m/merge"))
5374
5373
5375 updatecheck = None
5374 updatecheck = None
5376 if check:
5375 if check:
5377 updatecheck = 'abort'
5376 updatecheck = 'abort'
5378 elif merge:
5377 elif merge:
5379 updatecheck = 'none'
5378 updatecheck = 'none'
5380
5379
5381 with repo.wlock():
5380 with repo.wlock():
5382 cmdutil.clearunfinished(repo)
5381 cmdutil.clearunfinished(repo)
5383
5382
5384 if date:
5383 if date:
5385 rev = cmdutil.finddate(ui, repo, date)
5384 rev = cmdutil.finddate(ui, repo, date)
5386
5385
5387 # if we defined a bookmark, we have to remember the original name
5386 # if we defined a bookmark, we have to remember the original name
5388 brev = rev
5387 brev = rev
5389 rev = scmutil.revsingle(repo, rev, rev).rev()
5388 rev = scmutil.revsingle(repo, rev, rev).rev()
5390
5389
5391 repo.ui.setconfig('ui', 'forcemerge', tool, 'update')
5390 repo.ui.setconfig('ui', 'forcemerge', tool, 'update')
5392
5391
5393 return hg.updatetotally(ui, repo, rev, brev, clean=clean,
5392 return hg.updatetotally(ui, repo, rev, brev, clean=clean,
5394 updatecheck=updatecheck)
5393 updatecheck=updatecheck)
5395
5394
5396 @command('verify', [])
5395 @command('verify', [])
5397 def verify(ui, repo):
5396 def verify(ui, repo):
5398 """verify the integrity of the repository
5397 """verify the integrity of the repository
5399
5398
5400 Verify the integrity of the current repository.
5399 Verify the integrity of the current repository.
5401
5400
5402 This will perform an extensive check of the repository's
5401 This will perform an extensive check of the repository's
5403 integrity, validating the hashes and checksums of each entry in
5402 integrity, validating the hashes and checksums of each entry in
5404 the changelog, manifest, and tracked files, as well as the
5403 the changelog, manifest, and tracked files, as well as the
5405 integrity of their crosslinks and indices.
5404 integrity of their crosslinks and indices.
5406
5405
5407 Please see https://mercurial-scm.org/wiki/RepositoryCorruption
5406 Please see https://mercurial-scm.org/wiki/RepositoryCorruption
5408 for more information about recovery from corruption of the
5407 for more information about recovery from corruption of the
5409 repository.
5408 repository.
5410
5409
5411 Returns 0 on success, 1 if errors are encountered.
5410 Returns 0 on success, 1 if errors are encountered.
5412 """
5411 """
5413 return hg.verify(repo)
5412 return hg.verify(repo)
5414
5413
5415 @command('version', [] + formatteropts, norepo=True)
5414 @command('version', [] + formatteropts, norepo=True)
5416 def version_(ui, **opts):
5415 def version_(ui, **opts):
5417 """output version and copyright information"""
5416 """output version and copyright information"""
5418 if ui.verbose:
5417 if ui.verbose:
5419 ui.pager('version')
5418 ui.pager('version')
5420 fm = ui.formatter("version", opts)
5419 fm = ui.formatter("version", opts)
5421 fm.startitem()
5420 fm.startitem()
5422 fm.write("ver", _("Mercurial Distributed SCM (version %s)\n"),
5421 fm.write("ver", _("Mercurial Distributed SCM (version %s)\n"),
5423 util.version())
5422 util.version())
5424 license = _(
5423 license = _(
5425 "(see https://mercurial-scm.org for more information)\n"
5424 "(see https://mercurial-scm.org for more information)\n"
5426 "\nCopyright (C) 2005-2017 Matt Mackall and others\n"
5425 "\nCopyright (C) 2005-2017 Matt Mackall and others\n"
5427 "This is free software; see the source for copying conditions. "
5426 "This is free software; see the source for copying conditions. "
5428 "There is NO\nwarranty; "
5427 "There is NO\nwarranty; "
5429 "not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
5428 "not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
5430 )
5429 )
5431 if not ui.quiet:
5430 if not ui.quiet:
5432 fm.plain(license)
5431 fm.plain(license)
5433
5432
5434 if ui.verbose:
5433 if ui.verbose:
5435 fm.plain(_("\nEnabled extensions:\n\n"))
5434 fm.plain(_("\nEnabled extensions:\n\n"))
5436 # format names and versions into columns
5435 # format names and versions into columns
5437 names = []
5436 names = []
5438 vers = []
5437 vers = []
5439 isinternals = []
5438 isinternals = []
5440 for name, module in extensions.extensions():
5439 for name, module in extensions.extensions():
5441 names.append(name)
5440 names.append(name)
5442 vers.append(extensions.moduleversion(module) or None)
5441 vers.append(extensions.moduleversion(module) or None)
5443 isinternals.append(extensions.ismoduleinternal(module))
5442 isinternals.append(extensions.ismoduleinternal(module))
5444 fn = fm.nested("extensions")
5443 fn = fm.nested("extensions")
5445 if names:
5444 if names:
5446 namefmt = " %%-%ds " % max(len(n) for n in names)
5445 namefmt = " %%-%ds " % max(len(n) for n in names)
5447 places = [_("external"), _("internal")]
5446 places = [_("external"), _("internal")]
5448 for n, v, p in zip(names, vers, isinternals):
5447 for n, v, p in zip(names, vers, isinternals):
5449 fn.startitem()
5448 fn.startitem()
5450 fn.condwrite(ui.verbose, "name", namefmt, n)
5449 fn.condwrite(ui.verbose, "name", namefmt, n)
5451 if ui.verbose:
5450 if ui.verbose:
5452 fn.plain("%s " % places[p])
5451 fn.plain("%s " % places[p])
5453 fn.data(bundled=p)
5452 fn.data(bundled=p)
5454 fn.condwrite(ui.verbose and v, "ver", "%s", v)
5453 fn.condwrite(ui.verbose and v, "ver", "%s", v)
5455 if ui.verbose:
5454 if ui.verbose:
5456 fn.plain("\n")
5455 fn.plain("\n")
5457 fn.end()
5456 fn.end()
5458 fm.end()
5457 fm.end()
5459
5458
5460 def loadcmdtable(ui, name, cmdtable):
5459 def loadcmdtable(ui, name, cmdtable):
5461 """Load command functions from specified cmdtable
5460 """Load command functions from specified cmdtable
5462 """
5461 """
5463 overrides = [cmd for cmd in cmdtable if cmd in table]
5462 overrides = [cmd for cmd in cmdtable if cmd in table]
5464 if overrides:
5463 if overrides:
5465 ui.warn(_("extension '%s' overrides commands: %s\n")
5464 ui.warn(_("extension '%s' overrides commands: %s\n")
5466 % (name, " ".join(overrides)))
5465 % (name, " ".join(overrides)))
5467 table.update(cmdtable)
5466 table.update(cmdtable)
@@ -1,452 +1,452 b''
1 $ hg init a
1 $ hg init a
2 $ cd a
2 $ cd a
3 $ echo a > a
3 $ echo a > a
4 $ hg ci -A -d'1 0' -m a
4 $ hg ci -A -d'1 0' -m a
5 adding a
5 adding a
6
6
7 $ cd ..
7 $ cd ..
8
8
9 $ hg init b
9 $ hg init b
10 $ cd b
10 $ cd b
11 $ echo b > b
11 $ echo b > b
12 $ hg ci -A -d'1 0' -m b
12 $ hg ci -A -d'1 0' -m b
13 adding b
13 adding b
14
14
15 $ cd ..
15 $ cd ..
16
16
17 $ hg clone a c
17 $ hg clone a c
18 updating to branch default
18 updating to branch default
19 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
19 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
20 $ cd c
20 $ cd c
21 $ cat >> .hg/hgrc <<EOF
21 $ cat >> .hg/hgrc <<EOF
22 > [paths]
22 > [paths]
23 > relative = ../a
23 > relative = ../a
24 > EOF
24 > EOF
25 $ hg pull -f ../b
25 $ hg pull -f ../b
26 pulling from ../b
26 pulling from ../b
27 searching for changes
27 searching for changes
28 warning: repository is unrelated
28 warning: repository is unrelated
29 requesting all changes
29 requesting all changes
30 adding changesets
30 adding changesets
31 adding manifests
31 adding manifests
32 adding file changes
32 adding file changes
33 added 1 changesets with 1 changes to 1 files (+1 heads)
33 added 1 changesets with 1 changes to 1 files (+1 heads)
34 (run 'hg heads' to see heads, 'hg merge' to merge)
34 (run 'hg heads' to see heads, 'hg merge' to merge)
35 $ hg merge
35 $ hg merge
36 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
36 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
37 (branch merge, don't forget to commit)
37 (branch merge, don't forget to commit)
38
38
39 $ cd ..
39 $ cd ..
40
40
41 Testing -R/--repository:
41 Testing -R/--repository:
42
42
43 $ hg -R a tip
43 $ hg -R a tip
44 changeset: 0:8580ff50825a
44 changeset: 0:8580ff50825a
45 tag: tip
45 tag: tip
46 user: test
46 user: test
47 date: Thu Jan 01 00:00:01 1970 +0000
47 date: Thu Jan 01 00:00:01 1970 +0000
48 summary: a
48 summary: a
49
49
50 $ hg --repository b tip
50 $ hg --repository b tip
51 changeset: 0:b6c483daf290
51 changeset: 0:b6c483daf290
52 tag: tip
52 tag: tip
53 user: test
53 user: test
54 date: Thu Jan 01 00:00:01 1970 +0000
54 date: Thu Jan 01 00:00:01 1970 +0000
55 summary: b
55 summary: b
56
56
57
57
58 -R with a URL:
58 -R with a URL:
59
59
60 $ hg -R file:a identify
60 $ hg -R file:a identify
61 8580ff50825a tip
61 8580ff50825a tip
62 $ hg -R file://localhost/`pwd`/a/ identify
62 $ hg -R file://localhost/`pwd`/a/ identify
63 8580ff50825a tip
63 8580ff50825a tip
64
64
65 -R with path aliases:
65 -R with path aliases:
66
66
67 $ cd c
67 $ cd c
68 $ hg -R default identify
68 $ hg -R default identify
69 8580ff50825a tip
69 8580ff50825a tip
70 $ hg -R relative identify
70 $ hg -R relative identify
71 8580ff50825a tip
71 8580ff50825a tip
72 $ echo '[paths]' >> $HGRCPATH
72 $ echo '[paths]' >> $HGRCPATH
73 $ echo 'relativetohome = a' >> $HGRCPATH
73 $ echo 'relativetohome = a' >> $HGRCPATH
74 $ HOME=`pwd`/../ hg -R relativetohome identify
74 $ HOME=`pwd`/../ hg -R relativetohome identify
75 8580ff50825a tip
75 8580ff50825a tip
76 $ cd ..
76 $ cd ..
77
77
78 #if no-outer-repo
78 #if no-outer-repo
79
79
80 Implicit -R:
80 Implicit -R:
81
81
82 $ hg ann a/a
82 $ hg ann a/a
83 0: a
83 0: a
84 $ hg ann a/a a/a
84 $ hg ann a/a a/a
85 0: a
85 0: a
86 $ hg ann a/a b/b
86 $ hg ann a/a b/b
87 abort: no repository found in '$TESTTMP' (.hg not found)!
87 abort: no repository found in '$TESTTMP' (.hg not found)!
88 [255]
88 [255]
89 $ hg -R b ann a/a
89 $ hg -R b ann a/a
90 abort: a/a not under root '$TESTTMP/b' (glob)
90 abort: a/a not under root '$TESTTMP/b' (glob)
91 (consider using '--cwd b')
91 (consider using '--cwd b')
92 [255]
92 [255]
93 $ hg log
93 $ hg log
94 abort: no repository found in '$TESTTMP' (.hg not found)!
94 abort: no repository found in '$TESTTMP' (.hg not found)!
95 [255]
95 [255]
96
96
97 #endif
97 #endif
98
98
99 Abbreviation of long option:
99 Abbreviation of long option:
100
100
101 $ hg --repo c tip
101 $ hg --repo c tip
102 changeset: 1:b6c483daf290
102 changeset: 1:b6c483daf290
103 tag: tip
103 tag: tip
104 parent: -1:000000000000
104 parent: -1:000000000000
105 user: test
105 user: test
106 date: Thu Jan 01 00:00:01 1970 +0000
106 date: Thu Jan 01 00:00:01 1970 +0000
107 summary: b
107 summary: b
108
108
109
109
110 earlygetopt with duplicate options (36d23de02da1):
110 earlygetopt with duplicate options (36d23de02da1):
111
111
112 $ hg --cwd a --cwd b --cwd c tip
112 $ hg --cwd a --cwd b --cwd c tip
113 changeset: 1:b6c483daf290
113 changeset: 1:b6c483daf290
114 tag: tip
114 tag: tip
115 parent: -1:000000000000
115 parent: -1:000000000000
116 user: test
116 user: test
117 date: Thu Jan 01 00:00:01 1970 +0000
117 date: Thu Jan 01 00:00:01 1970 +0000
118 summary: b
118 summary: b
119
119
120 $ hg --repo c --repository b -R a tip
120 $ hg --repo c --repository b -R a tip
121 changeset: 0:8580ff50825a
121 changeset: 0:8580ff50825a
122 tag: tip
122 tag: tip
123 user: test
123 user: test
124 date: Thu Jan 01 00:00:01 1970 +0000
124 date: Thu Jan 01 00:00:01 1970 +0000
125 summary: a
125 summary: a
126
126
127
127
128 earlygetopt short option without following space:
128 earlygetopt short option without following space:
129
129
130 $ hg -q -Rb tip
130 $ hg -q -Rb tip
131 0:b6c483daf290
131 0:b6c483daf290
132
132
133 earlygetopt with illegal abbreviations:
133 earlygetopt with illegal abbreviations:
134
134
135 $ hg --confi "foo.bar=baz"
135 $ hg --confi "foo.bar=baz"
136 abort: option --config may not be abbreviated!
136 abort: option --config may not be abbreviated!
137 [255]
137 [255]
138 $ hg --cw a tip
138 $ hg --cw a tip
139 abort: option --cwd may not be abbreviated!
139 abort: option --cwd may not be abbreviated!
140 [255]
140 [255]
141 $ hg --rep a tip
141 $ hg --rep a tip
142 abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo!
142 abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo!
143 [255]
143 [255]
144 $ hg --repositor a tip
144 $ hg --repositor a tip
145 abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo!
145 abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo!
146 [255]
146 [255]
147 $ hg -qR a tip
147 $ hg -qR a tip
148 abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo!
148 abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo!
149 [255]
149 [255]
150 $ hg -qRa tip
150 $ hg -qRa tip
151 abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo!
151 abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo!
152 [255]
152 [255]
153
153
154 Testing --cwd:
154 Testing --cwd:
155
155
156 $ hg --cwd a parents
156 $ hg --cwd a parents
157 changeset: 0:8580ff50825a
157 changeset: 0:8580ff50825a
158 tag: tip
158 tag: tip
159 user: test
159 user: test
160 date: Thu Jan 01 00:00:01 1970 +0000
160 date: Thu Jan 01 00:00:01 1970 +0000
161 summary: a
161 summary: a
162
162
163
163
164 Testing -y/--noninteractive - just be sure it is parsed:
164 Testing -y/--noninteractive - just be sure it is parsed:
165
165
166 $ hg --cwd a tip -q --noninteractive
166 $ hg --cwd a tip -q --noninteractive
167 0:8580ff50825a
167 0:8580ff50825a
168 $ hg --cwd a tip -q -y
168 $ hg --cwd a tip -q -y
169 0:8580ff50825a
169 0:8580ff50825a
170
170
171 Testing -q/--quiet:
171 Testing -q/--quiet:
172
172
173 $ hg -R a -q tip
173 $ hg -R a -q tip
174 0:8580ff50825a
174 0:8580ff50825a
175 $ hg -R b -q tip
175 $ hg -R b -q tip
176 0:b6c483daf290
176 0:b6c483daf290
177 $ hg -R c --quiet parents
177 $ hg -R c --quiet parents
178 0:8580ff50825a
178 0:8580ff50825a
179 1:b6c483daf290
179 1:b6c483daf290
180
180
181 Testing -v/--verbose:
181 Testing -v/--verbose:
182
182
183 $ hg --cwd c head -v
183 $ hg --cwd c head -v
184 changeset: 1:b6c483daf290
184 changeset: 1:b6c483daf290
185 tag: tip
185 tag: tip
186 parent: -1:000000000000
186 parent: -1:000000000000
187 user: test
187 user: test
188 date: Thu Jan 01 00:00:01 1970 +0000
188 date: Thu Jan 01 00:00:01 1970 +0000
189 files: b
189 files: b
190 description:
190 description:
191 b
191 b
192
192
193
193
194 changeset: 0:8580ff50825a
194 changeset: 0:8580ff50825a
195 user: test
195 user: test
196 date: Thu Jan 01 00:00:01 1970 +0000
196 date: Thu Jan 01 00:00:01 1970 +0000
197 files: a
197 files: a
198 description:
198 description:
199 a
199 a
200
200
201
201
202 $ hg --cwd b tip --verbose
202 $ hg --cwd b tip --verbose
203 changeset: 0:b6c483daf290
203 changeset: 0:b6c483daf290
204 tag: tip
204 tag: tip
205 user: test
205 user: test
206 date: Thu Jan 01 00:00:01 1970 +0000
206 date: Thu Jan 01 00:00:01 1970 +0000
207 files: b
207 files: b
208 description:
208 description:
209 b
209 b
210
210
211
211
212
212
213 Testing --config:
213 Testing --config:
214
214
215 $ hg --cwd c --config paths.quuxfoo=bar paths | grep quuxfoo > /dev/null && echo quuxfoo
215 $ hg --cwd c --config paths.quuxfoo=bar paths | grep quuxfoo > /dev/null && echo quuxfoo
216 quuxfoo
216 quuxfoo
217 $ hg --cwd c --config '' tip -q
217 $ hg --cwd c --config '' tip -q
218 abort: malformed --config option: '' (use --config section.name=value)
218 abort: malformed --config option: '' (use --config section.name=value)
219 [255]
219 [255]
220 $ hg --cwd c --config a.b tip -q
220 $ hg --cwd c --config a.b tip -q
221 abort: malformed --config option: 'a.b' (use --config section.name=value)
221 abort: malformed --config option: 'a.b' (use --config section.name=value)
222 [255]
222 [255]
223 $ hg --cwd c --config a tip -q
223 $ hg --cwd c --config a tip -q
224 abort: malformed --config option: 'a' (use --config section.name=value)
224 abort: malformed --config option: 'a' (use --config section.name=value)
225 [255]
225 [255]
226 $ hg --cwd c --config a.= tip -q
226 $ hg --cwd c --config a.= tip -q
227 abort: malformed --config option: 'a.=' (use --config section.name=value)
227 abort: malformed --config option: 'a.=' (use --config section.name=value)
228 [255]
228 [255]
229 $ hg --cwd c --config .b= tip -q
229 $ hg --cwd c --config .b= tip -q
230 abort: malformed --config option: '.b=' (use --config section.name=value)
230 abort: malformed --config option: '.b=' (use --config section.name=value)
231 [255]
231 [255]
232
232
233 Testing --debug:
233 Testing --debug:
234
234
235 $ hg --cwd c log --debug
235 $ hg --cwd c log --debug
236 changeset: 1:b6c483daf2907ce5825c0bb50f5716226281cc1a
236 changeset: 1:b6c483daf2907ce5825c0bb50f5716226281cc1a
237 tag: tip
237 tag: tip
238 phase: public
238 phase: public
239 parent: -1:0000000000000000000000000000000000000000
239 parent: -1:0000000000000000000000000000000000000000
240 parent: -1:0000000000000000000000000000000000000000
240 parent: -1:0000000000000000000000000000000000000000
241 manifest: 1:23226e7a252cacdc2d99e4fbdc3653441056de49
241 manifest: 1:23226e7a252cacdc2d99e4fbdc3653441056de49
242 user: test
242 user: test
243 date: Thu Jan 01 00:00:01 1970 +0000
243 date: Thu Jan 01 00:00:01 1970 +0000
244 files+: b
244 files+: b
245 extra: branch=default
245 extra: branch=default
246 description:
246 description:
247 b
247 b
248
248
249
249
250 changeset: 0:8580ff50825a50c8f716709acdf8de0deddcd6ab
250 changeset: 0:8580ff50825a50c8f716709acdf8de0deddcd6ab
251 phase: public
251 phase: public
252 parent: -1:0000000000000000000000000000000000000000
252 parent: -1:0000000000000000000000000000000000000000
253 parent: -1:0000000000000000000000000000000000000000
253 parent: -1:0000000000000000000000000000000000000000
254 manifest: 0:a0c8bcbbb45c63b90b70ad007bf38961f64f2af0
254 manifest: 0:a0c8bcbbb45c63b90b70ad007bf38961f64f2af0
255 user: test
255 user: test
256 date: Thu Jan 01 00:00:01 1970 +0000
256 date: Thu Jan 01 00:00:01 1970 +0000
257 files+: a
257 files+: a
258 extra: branch=default
258 extra: branch=default
259 description:
259 description:
260 a
260 a
261
261
262
262
263
263
264 Testing --traceback:
264 Testing --traceback:
265
265
266 $ hg --cwd c --config x --traceback id 2>&1 | grep -i 'traceback'
266 $ hg --cwd c --config x --traceback id 2>&1 | grep -i 'traceback'
267 Traceback (most recent call last):
267 Traceback (most recent call last):
268
268
269 Testing --time:
269 Testing --time:
270
270
271 $ hg --cwd a --time id
271 $ hg --cwd a --time id
272 8580ff50825a tip
272 8580ff50825a tip
273 time: real * (glob)
273 time: real * (glob)
274
274
275 Testing --version:
275 Testing --version:
276
276
277 $ hg --version -q
277 $ hg --version -q
278 Mercurial Distributed SCM * (glob)
278 Mercurial Distributed SCM * (glob)
279
279
280 hide outer repo
280 hide outer repo
281 $ hg init
281 $ hg init
282
282
283 Testing -h/--help:
283 Testing -h/--help:
284
284
285 $ hg -h
285 $ hg -h
286 Mercurial Distributed SCM
286 Mercurial Distributed SCM
287
287
288 list of commands:
288 list of commands:
289
289
290 add add the specified files on the next commit
290 add add the specified files on the next commit
291 addremove add all new files, delete all missing files
291 addremove add all new files, delete all missing files
292 annotate show changeset information by line for each file
292 annotate show changeset information by line for each file
293 archive create an unversioned archive of a repository revision
293 archive create an unversioned archive of a repository revision
294 backout reverse effect of earlier changeset
294 backout reverse effect of earlier changeset
295 bisect subdivision search of changesets
295 bisect subdivision search of changesets
296 bookmarks create a new bookmark or list existing bookmarks
296 bookmarks create a new bookmark or list existing bookmarks
297 branch set or show the current branch name
297 branch set or show the current branch name
298 branches list repository named branches
298 branches list repository named branches
299 bundle create a bundle file
299 bundle create a bundle file
300 cat output the current or given revision of files
300 cat output the current or given revision of files
301 clone make a copy of an existing repository
301 clone make a copy of an existing repository
302 commit commit the specified files or all outstanding changes
302 commit commit the specified files or all outstanding changes
303 config show combined config settings from all hgrc files
303 config show combined config settings from all hgrc files
304 copy mark files as copied for the next commit
304 copy mark files as copied for the next commit
305 diff diff repository (or selected files)
305 diff diff repository (or selected files)
306 export dump the header and diffs for one or more changesets
306 export dump the header and diffs for one or more changesets
307 files list tracked files
307 files list tracked files
308 forget forget the specified files on the next commit
308 forget forget the specified files on the next commit
309 graft copy changes from other branches onto the current branch
309 graft copy changes from other branches onto the current branch
310 grep search revision history for a pattern in specified files
310 grep search revision history for a pattern in specified files
311 heads show branch heads
311 heads show branch heads
312 help show help for a given topic or a help overview
312 help show help for a given topic or a help overview
313 identify identify the working directory or specified revision
313 identify identify the working directory or specified revision
314 import import an ordered set of patches
314 import import an ordered set of patches
315 incoming show new changesets found in source
315 incoming show new changesets found in source
316 init create a new repository in the given directory
316 init create a new repository in the given directory
317 log show revision history of entire repository or files
317 log show revision history of entire repository or files
318 manifest output the current or given revision of the project manifest
318 manifest output the current or given revision of the project manifest
319 merge merge another revision into working directory
319 merge merge another revision into working directory
320 outgoing show changesets not found in the destination
320 outgoing show changesets not found in the destination
321 paths show aliases for remote repositories
321 paths show aliases for remote repositories
322 phase set or show the current phase name
322 phase set or show the current phase name
323 pull pull changes from the specified source
323 pull pull changes from the specified source
324 push push changes to the specified destination
324 push push changes to the specified destination
325 recover roll back an interrupted transaction
325 recover roll back an interrupted transaction
326 remove remove the specified files on the next commit
326 remove remove the specified files on the next commit
327 rename rename files; equivalent of copy + remove
327 rename rename files; equivalent of copy + remove
328 resolve redo merges or set/view the merge status of files
328 resolve redo merges or set/view the merge status of files
329 revert restore files to their checkout state
329 revert restore files to their checkout state
330 root print the root (top) of the current working directory
330 root print the root (top) of the current working directory
331 serve start stand-alone webserver
331 serve start stand-alone webserver
332 status show changed files in the working directory
332 status show changed files in the working directory
333 summary summarize working directory state
333 summary summarize working directory state
334 tag add one or more tags for the current or given revision
334 tag add one or more tags for the current or given revision
335 tags list repository tags
335 tags list repository tags
336 unbundle apply one or more changegroup files
336 unbundle apply one or more bundle files
337 update update working directory (or switch revisions)
337 update update working directory (or switch revisions)
338 verify verify the integrity of the repository
338 verify verify the integrity of the repository
339 version output version and copyright information
339 version output version and copyright information
340
340
341 additional help topics:
341 additional help topics:
342
342
343 bundlespec Bundle File Formats
343 bundlespec Bundle File Formats
344 color Colorizing Outputs
344 color Colorizing Outputs
345 config Configuration Files
345 config Configuration Files
346 dates Date Formats
346 dates Date Formats
347 diffs Diff Formats
347 diffs Diff Formats
348 environment Environment Variables
348 environment Environment Variables
349 extensions Using Additional Features
349 extensions Using Additional Features
350 filesets Specifying File Sets
350 filesets Specifying File Sets
351 glossary Glossary
351 glossary Glossary
352 hgignore Syntax for Mercurial Ignore Files
352 hgignore Syntax for Mercurial Ignore Files
353 hgweb Configuring hgweb
353 hgweb Configuring hgweb
354 internals Technical implementation topics
354 internals Technical implementation topics
355 merge-tools Merge Tools
355 merge-tools Merge Tools
356 pager Pager Support
356 pager Pager Support
357 patterns File Name Patterns
357 patterns File Name Patterns
358 phases Working with Phases
358 phases Working with Phases
359 revisions Specifying Revisions
359 revisions Specifying Revisions
360 scripting Using Mercurial from scripts and automation
360 scripting Using Mercurial from scripts and automation
361 subrepos Subrepositories
361 subrepos Subrepositories
362 templating Template Usage
362 templating Template Usage
363 urls URL Paths
363 urls URL Paths
364
364
365 (use 'hg help -v' to show built-in aliases and global options)
365 (use 'hg help -v' to show built-in aliases and global options)
366
366
367
367
368
368
369 $ hg --help
369 $ hg --help
370 Mercurial Distributed SCM
370 Mercurial Distributed SCM
371
371
372 list of commands:
372 list of commands:
373
373
374 add add the specified files on the next commit
374 add add the specified files on the next commit
375 addremove add all new files, delete all missing files
375 addremove add all new files, delete all missing files
376 annotate show changeset information by line for each file
376 annotate show changeset information by line for each file
377 archive create an unversioned archive of a repository revision
377 archive create an unversioned archive of a repository revision
378 backout reverse effect of earlier changeset
378 backout reverse effect of earlier changeset
379 bisect subdivision search of changesets
379 bisect subdivision search of changesets
380 bookmarks create a new bookmark or list existing bookmarks
380 bookmarks create a new bookmark or list existing bookmarks
381 branch set or show the current branch name
381 branch set or show the current branch name
382 branches list repository named branches
382 branches list repository named branches
383 bundle create a bundle file
383 bundle create a bundle file
384 cat output the current or given revision of files
384 cat output the current or given revision of files
385 clone make a copy of an existing repository
385 clone make a copy of an existing repository
386 commit commit the specified files or all outstanding changes
386 commit commit the specified files or all outstanding changes
387 config show combined config settings from all hgrc files
387 config show combined config settings from all hgrc files
388 copy mark files as copied for the next commit
388 copy mark files as copied for the next commit
389 diff diff repository (or selected files)
389 diff diff repository (or selected files)
390 export dump the header and diffs for one or more changesets
390 export dump the header and diffs for one or more changesets
391 files list tracked files
391 files list tracked files
392 forget forget the specified files on the next commit
392 forget forget the specified files on the next commit
393 graft copy changes from other branches onto the current branch
393 graft copy changes from other branches onto the current branch
394 grep search revision history for a pattern in specified files
394 grep search revision history for a pattern in specified files
395 heads show branch heads
395 heads show branch heads
396 help show help for a given topic or a help overview
396 help show help for a given topic or a help overview
397 identify identify the working directory or specified revision
397 identify identify the working directory or specified revision
398 import import an ordered set of patches
398 import import an ordered set of patches
399 incoming show new changesets found in source
399 incoming show new changesets found in source
400 init create a new repository in the given directory
400 init create a new repository in the given directory
401 log show revision history of entire repository or files
401 log show revision history of entire repository or files
402 manifest output the current or given revision of the project manifest
402 manifest output the current or given revision of the project manifest
403 merge merge another revision into working directory
403 merge merge another revision into working directory
404 outgoing show changesets not found in the destination
404 outgoing show changesets not found in the destination
405 paths show aliases for remote repositories
405 paths show aliases for remote repositories
406 phase set or show the current phase name
406 phase set or show the current phase name
407 pull pull changes from the specified source
407 pull pull changes from the specified source
408 push push changes to the specified destination
408 push push changes to the specified destination
409 recover roll back an interrupted transaction
409 recover roll back an interrupted transaction
410 remove remove the specified files on the next commit
410 remove remove the specified files on the next commit
411 rename rename files; equivalent of copy + remove
411 rename rename files; equivalent of copy + remove
412 resolve redo merges or set/view the merge status of files
412 resolve redo merges or set/view the merge status of files
413 revert restore files to their checkout state
413 revert restore files to their checkout state
414 root print the root (top) of the current working directory
414 root print the root (top) of the current working directory
415 serve start stand-alone webserver
415 serve start stand-alone webserver
416 status show changed files in the working directory
416 status show changed files in the working directory
417 summary summarize working directory state
417 summary summarize working directory state
418 tag add one or more tags for the current or given revision
418 tag add one or more tags for the current or given revision
419 tags list repository tags
419 tags list repository tags
420 unbundle apply one or more changegroup files
420 unbundle apply one or more bundle files
421 update update working directory (or switch revisions)
421 update update working directory (or switch revisions)
422 verify verify the integrity of the repository
422 verify verify the integrity of the repository
423 version output version and copyright information
423 version output version and copyright information
424
424
425 additional help topics:
425 additional help topics:
426
426
427 bundlespec Bundle File Formats
427 bundlespec Bundle File Formats
428 color Colorizing Outputs
428 color Colorizing Outputs
429 config Configuration Files
429 config Configuration Files
430 dates Date Formats
430 dates Date Formats
431 diffs Diff Formats
431 diffs Diff Formats
432 environment Environment Variables
432 environment Environment Variables
433 extensions Using Additional Features
433 extensions Using Additional Features
434 filesets Specifying File Sets
434 filesets Specifying File Sets
435 glossary Glossary
435 glossary Glossary
436 hgignore Syntax for Mercurial Ignore Files
436 hgignore Syntax for Mercurial Ignore Files
437 hgweb Configuring hgweb
437 hgweb Configuring hgweb
438 internals Technical implementation topics
438 internals Technical implementation topics
439 merge-tools Merge Tools
439 merge-tools Merge Tools
440 pager Pager Support
440 pager Pager Support
441 patterns File Name Patterns
441 patterns File Name Patterns
442 phases Working with Phases
442 phases Working with Phases
443 revisions Specifying Revisions
443 revisions Specifying Revisions
444 scripting Using Mercurial from scripts and automation
444 scripting Using Mercurial from scripts and automation
445 subrepos Subrepositories
445 subrepos Subrepositories
446 templating Template Usage
446 templating Template Usage
447 urls URL Paths
447 urls URL Paths
448
448
449 (use 'hg help -v' to show built-in aliases and global options)
449 (use 'hg help -v' to show built-in aliases and global options)
450
450
451 Not tested: --debugger
451 Not tested: --debugger
452
452
@@ -1,3324 +1,3324 b''
1 Short help:
1 Short help:
2
2
3 $ hg
3 $ hg
4 Mercurial Distributed SCM
4 Mercurial Distributed SCM
5
5
6 basic commands:
6 basic commands:
7
7
8 add add the specified files on the next commit
8 add add the specified files on the next commit
9 annotate show changeset information by line for each file
9 annotate show changeset information by line for each file
10 clone make a copy of an existing repository
10 clone make a copy of an existing repository
11 commit commit the specified files or all outstanding changes
11 commit commit the specified files or all outstanding changes
12 diff diff repository (or selected files)
12 diff diff repository (or selected files)
13 export dump the header and diffs for one or more changesets
13 export dump the header and diffs for one or more changesets
14 forget forget the specified files on the next commit
14 forget forget the specified files on the next commit
15 init create a new repository in the given directory
15 init create a new repository in the given directory
16 log show revision history of entire repository or files
16 log show revision history of entire repository or files
17 merge merge another revision into working directory
17 merge merge another revision into working directory
18 pull pull changes from the specified source
18 pull pull changes from the specified source
19 push push changes to the specified destination
19 push push changes to the specified destination
20 remove remove the specified files on the next commit
20 remove remove the specified files on the next commit
21 serve start stand-alone webserver
21 serve start stand-alone webserver
22 status show changed files in the working directory
22 status show changed files in the working directory
23 summary summarize working directory state
23 summary summarize working directory state
24 update update working directory (or switch revisions)
24 update update working directory (or switch revisions)
25
25
26 (use 'hg help' for the full list of commands or 'hg -v' for details)
26 (use 'hg help' for the full list of commands or 'hg -v' for details)
27
27
28 $ hg -q
28 $ hg -q
29 add add the specified files on the next commit
29 add add the specified files on the next commit
30 annotate show changeset information by line for each file
30 annotate show changeset information by line for each file
31 clone make a copy of an existing repository
31 clone make a copy of an existing repository
32 commit commit the specified files or all outstanding changes
32 commit commit the specified files or all outstanding changes
33 diff diff repository (or selected files)
33 diff diff repository (or selected files)
34 export dump the header and diffs for one or more changesets
34 export dump the header and diffs for one or more changesets
35 forget forget the specified files on the next commit
35 forget forget the specified files on the next commit
36 init create a new repository in the given directory
36 init create a new repository in the given directory
37 log show revision history of entire repository or files
37 log show revision history of entire repository or files
38 merge merge another revision into working directory
38 merge merge another revision into working directory
39 pull pull changes from the specified source
39 pull pull changes from the specified source
40 push push changes to the specified destination
40 push push changes to the specified destination
41 remove remove the specified files on the next commit
41 remove remove the specified files on the next commit
42 serve start stand-alone webserver
42 serve start stand-alone webserver
43 status show changed files in the working directory
43 status show changed files in the working directory
44 summary summarize working directory state
44 summary summarize working directory state
45 update update working directory (or switch revisions)
45 update update working directory (or switch revisions)
46
46
47 $ hg help
47 $ hg help
48 Mercurial Distributed SCM
48 Mercurial Distributed SCM
49
49
50 list of commands:
50 list of commands:
51
51
52 add add the specified files on the next commit
52 add add the specified files on the next commit
53 addremove add all new files, delete all missing files
53 addremove add all new files, delete all missing files
54 annotate show changeset information by line for each file
54 annotate show changeset information by line for each file
55 archive create an unversioned archive of a repository revision
55 archive create an unversioned archive of a repository revision
56 backout reverse effect of earlier changeset
56 backout reverse effect of earlier changeset
57 bisect subdivision search of changesets
57 bisect subdivision search of changesets
58 bookmarks create a new bookmark or list existing bookmarks
58 bookmarks create a new bookmark or list existing bookmarks
59 branch set or show the current branch name
59 branch set or show the current branch name
60 branches list repository named branches
60 branches list repository named branches
61 bundle create a bundle file
61 bundle create a bundle file
62 cat output the current or given revision of files
62 cat output the current or given revision of files
63 clone make a copy of an existing repository
63 clone make a copy of an existing repository
64 commit commit the specified files or all outstanding changes
64 commit commit the specified files or all outstanding changes
65 config show combined config settings from all hgrc files
65 config show combined config settings from all hgrc files
66 copy mark files as copied for the next commit
66 copy mark files as copied for the next commit
67 diff diff repository (or selected files)
67 diff diff repository (or selected files)
68 export dump the header and diffs for one or more changesets
68 export dump the header and diffs for one or more changesets
69 files list tracked files
69 files list tracked files
70 forget forget the specified files on the next commit
70 forget forget the specified files on the next commit
71 graft copy changes from other branches onto the current branch
71 graft copy changes from other branches onto the current branch
72 grep search revision history for a pattern in specified files
72 grep search revision history for a pattern in specified files
73 heads show branch heads
73 heads show branch heads
74 help show help for a given topic or a help overview
74 help show help for a given topic or a help overview
75 identify identify the working directory or specified revision
75 identify identify the working directory or specified revision
76 import import an ordered set of patches
76 import import an ordered set of patches
77 incoming show new changesets found in source
77 incoming show new changesets found in source
78 init create a new repository in the given directory
78 init create a new repository in the given directory
79 log show revision history of entire repository or files
79 log show revision history of entire repository or files
80 manifest output the current or given revision of the project manifest
80 manifest output the current or given revision of the project manifest
81 merge merge another revision into working directory
81 merge merge another revision into working directory
82 outgoing show changesets not found in the destination
82 outgoing show changesets not found in the destination
83 paths show aliases for remote repositories
83 paths show aliases for remote repositories
84 phase set or show the current phase name
84 phase set or show the current phase name
85 pull pull changes from the specified source
85 pull pull changes from the specified source
86 push push changes to the specified destination
86 push push changes to the specified destination
87 recover roll back an interrupted transaction
87 recover roll back an interrupted transaction
88 remove remove the specified files on the next commit
88 remove remove the specified files on the next commit
89 rename rename files; equivalent of copy + remove
89 rename rename files; equivalent of copy + remove
90 resolve redo merges or set/view the merge status of files
90 resolve redo merges or set/view the merge status of files
91 revert restore files to their checkout state
91 revert restore files to their checkout state
92 root print the root (top) of the current working directory
92 root print the root (top) of the current working directory
93 serve start stand-alone webserver
93 serve start stand-alone webserver
94 status show changed files in the working directory
94 status show changed files in the working directory
95 summary summarize working directory state
95 summary summarize working directory state
96 tag add one or more tags for the current or given revision
96 tag add one or more tags for the current or given revision
97 tags list repository tags
97 tags list repository tags
98 unbundle apply one or more changegroup files
98 unbundle apply one or more bundle files
99 update update working directory (or switch revisions)
99 update update working directory (or switch revisions)
100 verify verify the integrity of the repository
100 verify verify the integrity of the repository
101 version output version and copyright information
101 version output version and copyright information
102
102
103 additional help topics:
103 additional help topics:
104
104
105 bundlespec Bundle File Formats
105 bundlespec Bundle File Formats
106 color Colorizing Outputs
106 color Colorizing Outputs
107 config Configuration Files
107 config Configuration Files
108 dates Date Formats
108 dates Date Formats
109 diffs Diff Formats
109 diffs Diff Formats
110 environment Environment Variables
110 environment Environment Variables
111 extensions Using Additional Features
111 extensions Using Additional Features
112 filesets Specifying File Sets
112 filesets Specifying File Sets
113 glossary Glossary
113 glossary Glossary
114 hgignore Syntax for Mercurial Ignore Files
114 hgignore Syntax for Mercurial Ignore Files
115 hgweb Configuring hgweb
115 hgweb Configuring hgweb
116 internals Technical implementation topics
116 internals Technical implementation topics
117 merge-tools Merge Tools
117 merge-tools Merge Tools
118 pager Pager Support
118 pager Pager Support
119 patterns File Name Patterns
119 patterns File Name Patterns
120 phases Working with Phases
120 phases Working with Phases
121 revisions Specifying Revisions
121 revisions Specifying Revisions
122 scripting Using Mercurial from scripts and automation
122 scripting Using Mercurial from scripts and automation
123 subrepos Subrepositories
123 subrepos Subrepositories
124 templating Template Usage
124 templating Template Usage
125 urls URL Paths
125 urls URL Paths
126
126
127 (use 'hg help -v' to show built-in aliases and global options)
127 (use 'hg help -v' to show built-in aliases and global options)
128
128
129 $ hg -q help
129 $ hg -q help
130 add add the specified files on the next commit
130 add add the specified files on the next commit
131 addremove add all new files, delete all missing files
131 addremove add all new files, delete all missing files
132 annotate show changeset information by line for each file
132 annotate show changeset information by line for each file
133 archive create an unversioned archive of a repository revision
133 archive create an unversioned archive of a repository revision
134 backout reverse effect of earlier changeset
134 backout reverse effect of earlier changeset
135 bisect subdivision search of changesets
135 bisect subdivision search of changesets
136 bookmarks create a new bookmark or list existing bookmarks
136 bookmarks create a new bookmark or list existing bookmarks
137 branch set or show the current branch name
137 branch set or show the current branch name
138 branches list repository named branches
138 branches list repository named branches
139 bundle create a bundle file
139 bundle create a bundle file
140 cat output the current or given revision of files
140 cat output the current or given revision of files
141 clone make a copy of an existing repository
141 clone make a copy of an existing repository
142 commit commit the specified files or all outstanding changes
142 commit commit the specified files or all outstanding changes
143 config show combined config settings from all hgrc files
143 config show combined config settings from all hgrc files
144 copy mark files as copied for the next commit
144 copy mark files as copied for the next commit
145 diff diff repository (or selected files)
145 diff diff repository (or selected files)
146 export dump the header and diffs for one or more changesets
146 export dump the header and diffs for one or more changesets
147 files list tracked files
147 files list tracked files
148 forget forget the specified files on the next commit
148 forget forget the specified files on the next commit
149 graft copy changes from other branches onto the current branch
149 graft copy changes from other branches onto the current branch
150 grep search revision history for a pattern in specified files
150 grep search revision history for a pattern in specified files
151 heads show branch heads
151 heads show branch heads
152 help show help for a given topic or a help overview
152 help show help for a given topic or a help overview
153 identify identify the working directory or specified revision
153 identify identify the working directory or specified revision
154 import import an ordered set of patches
154 import import an ordered set of patches
155 incoming show new changesets found in source
155 incoming show new changesets found in source
156 init create a new repository in the given directory
156 init create a new repository in the given directory
157 log show revision history of entire repository or files
157 log show revision history of entire repository or files
158 manifest output the current or given revision of the project manifest
158 manifest output the current or given revision of the project manifest
159 merge merge another revision into working directory
159 merge merge another revision into working directory
160 outgoing show changesets not found in the destination
160 outgoing show changesets not found in the destination
161 paths show aliases for remote repositories
161 paths show aliases for remote repositories
162 phase set or show the current phase name
162 phase set or show the current phase name
163 pull pull changes from the specified source
163 pull pull changes from the specified source
164 push push changes to the specified destination
164 push push changes to the specified destination
165 recover roll back an interrupted transaction
165 recover roll back an interrupted transaction
166 remove remove the specified files on the next commit
166 remove remove the specified files on the next commit
167 rename rename files; equivalent of copy + remove
167 rename rename files; equivalent of copy + remove
168 resolve redo merges or set/view the merge status of files
168 resolve redo merges or set/view the merge status of files
169 revert restore files to their checkout state
169 revert restore files to their checkout state
170 root print the root (top) of the current working directory
170 root print the root (top) of the current working directory
171 serve start stand-alone webserver
171 serve start stand-alone webserver
172 status show changed files in the working directory
172 status show changed files in the working directory
173 summary summarize working directory state
173 summary summarize working directory state
174 tag add one or more tags for the current or given revision
174 tag add one or more tags for the current or given revision
175 tags list repository tags
175 tags list repository tags
176 unbundle apply one or more changegroup files
176 unbundle apply one or more bundle files
177 update update working directory (or switch revisions)
177 update update working directory (or switch revisions)
178 verify verify the integrity of the repository
178 verify verify the integrity of the repository
179 version output version and copyright information
179 version output version and copyright information
180
180
181 additional help topics:
181 additional help topics:
182
182
183 bundlespec Bundle File Formats
183 bundlespec Bundle File Formats
184 color Colorizing Outputs
184 color Colorizing Outputs
185 config Configuration Files
185 config Configuration Files
186 dates Date Formats
186 dates Date Formats
187 diffs Diff Formats
187 diffs Diff Formats
188 environment Environment Variables
188 environment Environment Variables
189 extensions Using Additional Features
189 extensions Using Additional Features
190 filesets Specifying File Sets
190 filesets Specifying File Sets
191 glossary Glossary
191 glossary Glossary
192 hgignore Syntax for Mercurial Ignore Files
192 hgignore Syntax for Mercurial Ignore Files
193 hgweb Configuring hgweb
193 hgweb Configuring hgweb
194 internals Technical implementation topics
194 internals Technical implementation topics
195 merge-tools Merge Tools
195 merge-tools Merge Tools
196 pager Pager Support
196 pager Pager Support
197 patterns File Name Patterns
197 patterns File Name Patterns
198 phases Working with Phases
198 phases Working with Phases
199 revisions Specifying Revisions
199 revisions Specifying Revisions
200 scripting Using Mercurial from scripts and automation
200 scripting Using Mercurial from scripts and automation
201 subrepos Subrepositories
201 subrepos Subrepositories
202 templating Template Usage
202 templating Template Usage
203 urls URL Paths
203 urls URL Paths
204
204
205 Test extension help:
205 Test extension help:
206 $ hg help extensions --config extensions.rebase= --config extensions.children=
206 $ hg help extensions --config extensions.rebase= --config extensions.children=
207 Using Additional Features
207 Using Additional Features
208 """""""""""""""""""""""""
208 """""""""""""""""""""""""
209
209
210 Mercurial has the ability to add new features through the use of
210 Mercurial has the ability to add new features through the use of
211 extensions. Extensions may add new commands, add options to existing
211 extensions. Extensions may add new commands, add options to existing
212 commands, change the default behavior of commands, or implement hooks.
212 commands, change the default behavior of commands, or implement hooks.
213
213
214 To enable the "foo" extension, either shipped with Mercurial or in the
214 To enable the "foo" extension, either shipped with Mercurial or in the
215 Python search path, create an entry for it in your configuration file,
215 Python search path, create an entry for it in your configuration file,
216 like this:
216 like this:
217
217
218 [extensions]
218 [extensions]
219 foo =
219 foo =
220
220
221 You may also specify the full path to an extension:
221 You may also specify the full path to an extension:
222
222
223 [extensions]
223 [extensions]
224 myfeature = ~/.hgext/myfeature.py
224 myfeature = ~/.hgext/myfeature.py
225
225
226 See 'hg help config' for more information on configuration files.
226 See 'hg help config' for more information on configuration files.
227
227
228 Extensions are not loaded by default for a variety of reasons: they can
228 Extensions are not loaded by default for a variety of reasons: they can
229 increase startup overhead; they may be meant for advanced usage only; they
229 increase startup overhead; they may be meant for advanced usage only; they
230 may provide potentially dangerous abilities (such as letting you destroy
230 may provide potentially dangerous abilities (such as letting you destroy
231 or modify history); they might not be ready for prime time; or they may
231 or modify history); they might not be ready for prime time; or they may
232 alter some usual behaviors of stock Mercurial. It is thus up to the user
232 alter some usual behaviors of stock Mercurial. It is thus up to the user
233 to activate extensions as needed.
233 to activate extensions as needed.
234
234
235 To explicitly disable an extension enabled in a configuration file of
235 To explicitly disable an extension enabled in a configuration file of
236 broader scope, prepend its path with !:
236 broader scope, prepend its path with !:
237
237
238 [extensions]
238 [extensions]
239 # disabling extension bar residing in /path/to/extension/bar.py
239 # disabling extension bar residing in /path/to/extension/bar.py
240 bar = !/path/to/extension/bar.py
240 bar = !/path/to/extension/bar.py
241 # ditto, but no path was supplied for extension baz
241 # ditto, but no path was supplied for extension baz
242 baz = !
242 baz = !
243
243
244 enabled extensions:
244 enabled extensions:
245
245
246 children command to display child changesets (DEPRECATED)
246 children command to display child changesets (DEPRECATED)
247 rebase command to move sets of revisions to a different ancestor
247 rebase command to move sets of revisions to a different ancestor
248
248
249 disabled extensions:
249 disabled extensions:
250
250
251 acl hooks for controlling repository access
251 acl hooks for controlling repository access
252 blackbox log repository events to a blackbox for debugging
252 blackbox log repository events to a blackbox for debugging
253 bugzilla hooks for integrating with the Bugzilla bug tracker
253 bugzilla hooks for integrating with the Bugzilla bug tracker
254 censor erase file content at a given revision
254 censor erase file content at a given revision
255 churn command to display statistics about repository history
255 churn command to display statistics about repository history
256 clonebundles advertise pre-generated bundles to seed clones
256 clonebundles advertise pre-generated bundles to seed clones
257 convert import revisions from foreign VCS repositories into
257 convert import revisions from foreign VCS repositories into
258 Mercurial
258 Mercurial
259 eol automatically manage newlines in repository files
259 eol automatically manage newlines in repository files
260 extdiff command to allow external programs to compare revisions
260 extdiff command to allow external programs to compare revisions
261 factotum http authentication with factotum
261 factotum http authentication with factotum
262 gpg commands to sign and verify changesets
262 gpg commands to sign and verify changesets
263 hgk browse the repository in a graphical way
263 hgk browse the repository in a graphical way
264 highlight syntax highlighting for hgweb (requires Pygments)
264 highlight syntax highlighting for hgweb (requires Pygments)
265 histedit interactive history editing
265 histedit interactive history editing
266 keyword expand keywords in tracked files
266 keyword expand keywords in tracked files
267 largefiles track large binary files
267 largefiles track large binary files
268 mq manage a stack of patches
268 mq manage a stack of patches
269 notify hooks for sending email push notifications
269 notify hooks for sending email push notifications
270 patchbomb command to send changesets as (a series of) patch emails
270 patchbomb command to send changesets as (a series of) patch emails
271 purge command to delete untracked files from the working
271 purge command to delete untracked files from the working
272 directory
272 directory
273 relink recreates hardlinks between repository clones
273 relink recreates hardlinks between repository clones
274 schemes extend schemes with shortcuts to repository swarms
274 schemes extend schemes with shortcuts to repository swarms
275 share share a common history between several working directories
275 share share a common history between several working directories
276 shelve save and restore changes to the working directory
276 shelve save and restore changes to the working directory
277 strip strip changesets and their descendants from history
277 strip strip changesets and their descendants from history
278 transplant command to transplant changesets from another branch
278 transplant command to transplant changesets from another branch
279 win32mbcs allow the use of MBCS paths with problematic encodings
279 win32mbcs allow the use of MBCS paths with problematic encodings
280 zeroconf discover and advertise repositories on the local network
280 zeroconf discover and advertise repositories on the local network
281
281
282 Verify that extension keywords appear in help templates
282 Verify that extension keywords appear in help templates
283
283
284 $ hg help --config extensions.transplant= templating|grep transplant > /dev/null
284 $ hg help --config extensions.transplant= templating|grep transplant > /dev/null
285
285
286 Test short command list with verbose option
286 Test short command list with verbose option
287
287
288 $ hg -v help shortlist
288 $ hg -v help shortlist
289 Mercurial Distributed SCM
289 Mercurial Distributed SCM
290
290
291 basic commands:
291 basic commands:
292
292
293 add add the specified files on the next commit
293 add add the specified files on the next commit
294 annotate, blame
294 annotate, blame
295 show changeset information by line for each file
295 show changeset information by line for each file
296 clone make a copy of an existing repository
296 clone make a copy of an existing repository
297 commit, ci commit the specified files or all outstanding changes
297 commit, ci commit the specified files or all outstanding changes
298 diff diff repository (or selected files)
298 diff diff repository (or selected files)
299 export dump the header and diffs for one or more changesets
299 export dump the header and diffs for one or more changesets
300 forget forget the specified files on the next commit
300 forget forget the specified files on the next commit
301 init create a new repository in the given directory
301 init create a new repository in the given directory
302 log, history show revision history of entire repository or files
302 log, history show revision history of entire repository or files
303 merge merge another revision into working directory
303 merge merge another revision into working directory
304 pull pull changes from the specified source
304 pull pull changes from the specified source
305 push push changes to the specified destination
305 push push changes to the specified destination
306 remove, rm remove the specified files on the next commit
306 remove, rm remove the specified files on the next commit
307 serve start stand-alone webserver
307 serve start stand-alone webserver
308 status, st show changed files in the working directory
308 status, st show changed files in the working directory
309 summary, sum summarize working directory state
309 summary, sum summarize working directory state
310 update, up, checkout, co
310 update, up, checkout, co
311 update working directory (or switch revisions)
311 update working directory (or switch revisions)
312
312
313 global options ([+] can be repeated):
313 global options ([+] can be repeated):
314
314
315 -R --repository REPO repository root directory or name of overlay bundle
315 -R --repository REPO repository root directory or name of overlay bundle
316 file
316 file
317 --cwd DIR change working directory
317 --cwd DIR change working directory
318 -y --noninteractive do not prompt, automatically pick the first choice for
318 -y --noninteractive do not prompt, automatically pick the first choice for
319 all prompts
319 all prompts
320 -q --quiet suppress output
320 -q --quiet suppress output
321 -v --verbose enable additional output
321 -v --verbose enable additional output
322 --color TYPE when to colorize (boolean, always, auto, never, or
322 --color TYPE when to colorize (boolean, always, auto, never, or
323 debug)
323 debug)
324 --config CONFIG [+] set/override config option (use 'section.name=value')
324 --config CONFIG [+] set/override config option (use 'section.name=value')
325 --debug enable debugging output
325 --debug enable debugging output
326 --debugger start debugger
326 --debugger start debugger
327 --encoding ENCODE set the charset encoding (default: ascii)
327 --encoding ENCODE set the charset encoding (default: ascii)
328 --encodingmode MODE set the charset encoding mode (default: strict)
328 --encodingmode MODE set the charset encoding mode (default: strict)
329 --traceback always print a traceback on exception
329 --traceback always print a traceback on exception
330 --time time how long the command takes
330 --time time how long the command takes
331 --profile print command execution profile
331 --profile print command execution profile
332 --version output version information and exit
332 --version output version information and exit
333 -h --help display help and exit
333 -h --help display help and exit
334 --hidden consider hidden changesets
334 --hidden consider hidden changesets
335 --pager TYPE when to paginate (boolean, always, auto, or never)
335 --pager TYPE when to paginate (boolean, always, auto, or never)
336 (default: auto)
336 (default: auto)
337
337
338 (use 'hg help' for the full list of commands)
338 (use 'hg help' for the full list of commands)
339
339
340 $ hg add -h
340 $ hg add -h
341 hg add [OPTION]... [FILE]...
341 hg add [OPTION]... [FILE]...
342
342
343 add the specified files on the next commit
343 add the specified files on the next commit
344
344
345 Schedule files to be version controlled and added to the repository.
345 Schedule files to be version controlled and added to the repository.
346
346
347 The files will be added to the repository at the next commit. To undo an
347 The files will be added to the repository at the next commit. To undo an
348 add before that, see 'hg forget'.
348 add before that, see 'hg forget'.
349
349
350 If no names are given, add all files to the repository (except files
350 If no names are given, add all files to the repository (except files
351 matching ".hgignore").
351 matching ".hgignore").
352
352
353 Returns 0 if all files are successfully added.
353 Returns 0 if all files are successfully added.
354
354
355 options ([+] can be repeated):
355 options ([+] can be repeated):
356
356
357 -I --include PATTERN [+] include names matching the given patterns
357 -I --include PATTERN [+] include names matching the given patterns
358 -X --exclude PATTERN [+] exclude names matching the given patterns
358 -X --exclude PATTERN [+] exclude names matching the given patterns
359 -S --subrepos recurse into subrepositories
359 -S --subrepos recurse into subrepositories
360 -n --dry-run do not perform actions, just print output
360 -n --dry-run do not perform actions, just print output
361
361
362 (some details hidden, use --verbose to show complete help)
362 (some details hidden, use --verbose to show complete help)
363
363
364 Verbose help for add
364 Verbose help for add
365
365
366 $ hg add -hv
366 $ hg add -hv
367 hg add [OPTION]... [FILE]...
367 hg add [OPTION]... [FILE]...
368
368
369 add the specified files on the next commit
369 add the specified files on the next commit
370
370
371 Schedule files to be version controlled and added to the repository.
371 Schedule files to be version controlled and added to the repository.
372
372
373 The files will be added to the repository at the next commit. To undo an
373 The files will be added to the repository at the next commit. To undo an
374 add before that, see 'hg forget'.
374 add before that, see 'hg forget'.
375
375
376 If no names are given, add all files to the repository (except files
376 If no names are given, add all files to the repository (except files
377 matching ".hgignore").
377 matching ".hgignore").
378
378
379 Examples:
379 Examples:
380
380
381 - New (unknown) files are added automatically by 'hg add':
381 - New (unknown) files are added automatically by 'hg add':
382
382
383 $ ls
383 $ ls
384 foo.c
384 foo.c
385 $ hg status
385 $ hg status
386 ? foo.c
386 ? foo.c
387 $ hg add
387 $ hg add
388 adding foo.c
388 adding foo.c
389 $ hg status
389 $ hg status
390 A foo.c
390 A foo.c
391
391
392 - Specific files to be added can be specified:
392 - Specific files to be added can be specified:
393
393
394 $ ls
394 $ ls
395 bar.c foo.c
395 bar.c foo.c
396 $ hg status
396 $ hg status
397 ? bar.c
397 ? bar.c
398 ? foo.c
398 ? foo.c
399 $ hg add bar.c
399 $ hg add bar.c
400 $ hg status
400 $ hg status
401 A bar.c
401 A bar.c
402 ? foo.c
402 ? foo.c
403
403
404 Returns 0 if all files are successfully added.
404 Returns 0 if all files are successfully added.
405
405
406 options ([+] can be repeated):
406 options ([+] can be repeated):
407
407
408 -I --include PATTERN [+] include names matching the given patterns
408 -I --include PATTERN [+] include names matching the given patterns
409 -X --exclude PATTERN [+] exclude names matching the given patterns
409 -X --exclude PATTERN [+] exclude names matching the given patterns
410 -S --subrepos recurse into subrepositories
410 -S --subrepos recurse into subrepositories
411 -n --dry-run do not perform actions, just print output
411 -n --dry-run do not perform actions, just print output
412
412
413 global options ([+] can be repeated):
413 global options ([+] can be repeated):
414
414
415 -R --repository REPO repository root directory or name of overlay bundle
415 -R --repository REPO repository root directory or name of overlay bundle
416 file
416 file
417 --cwd DIR change working directory
417 --cwd DIR change working directory
418 -y --noninteractive do not prompt, automatically pick the first choice for
418 -y --noninteractive do not prompt, automatically pick the first choice for
419 all prompts
419 all prompts
420 -q --quiet suppress output
420 -q --quiet suppress output
421 -v --verbose enable additional output
421 -v --verbose enable additional output
422 --color TYPE when to colorize (boolean, always, auto, never, or
422 --color TYPE when to colorize (boolean, always, auto, never, or
423 debug)
423 debug)
424 --config CONFIG [+] set/override config option (use 'section.name=value')
424 --config CONFIG [+] set/override config option (use 'section.name=value')
425 --debug enable debugging output
425 --debug enable debugging output
426 --debugger start debugger
426 --debugger start debugger
427 --encoding ENCODE set the charset encoding (default: ascii)
427 --encoding ENCODE set the charset encoding (default: ascii)
428 --encodingmode MODE set the charset encoding mode (default: strict)
428 --encodingmode MODE set the charset encoding mode (default: strict)
429 --traceback always print a traceback on exception
429 --traceback always print a traceback on exception
430 --time time how long the command takes
430 --time time how long the command takes
431 --profile print command execution profile
431 --profile print command execution profile
432 --version output version information and exit
432 --version output version information and exit
433 -h --help display help and exit
433 -h --help display help and exit
434 --hidden consider hidden changesets
434 --hidden consider hidden changesets
435 --pager TYPE when to paginate (boolean, always, auto, or never)
435 --pager TYPE when to paginate (boolean, always, auto, or never)
436 (default: auto)
436 (default: auto)
437
437
438 Test the textwidth config option
438 Test the textwidth config option
439
439
440 $ hg root -h --config ui.textwidth=50
440 $ hg root -h --config ui.textwidth=50
441 hg root
441 hg root
442
442
443 print the root (top) of the current working
443 print the root (top) of the current working
444 directory
444 directory
445
445
446 Print the root directory of the current
446 Print the root directory of the current
447 repository.
447 repository.
448
448
449 Returns 0 on success.
449 Returns 0 on success.
450
450
451 (some details hidden, use --verbose to show
451 (some details hidden, use --verbose to show
452 complete help)
452 complete help)
453
453
454 Test help option with version option
454 Test help option with version option
455
455
456 $ hg add -h --version
456 $ hg add -h --version
457 Mercurial Distributed SCM (version *) (glob)
457 Mercurial Distributed SCM (version *) (glob)
458 (see https://mercurial-scm.org for more information)
458 (see https://mercurial-scm.org for more information)
459
459
460 Copyright (C) 2005-* Matt Mackall and others (glob)
460 Copyright (C) 2005-* Matt Mackall and others (glob)
461 This is free software; see the source for copying conditions. There is NO
461 This is free software; see the source for copying conditions. There is NO
462 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
462 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
463
463
464 $ hg add --skjdfks
464 $ hg add --skjdfks
465 hg add: option --skjdfks not recognized
465 hg add: option --skjdfks not recognized
466 hg add [OPTION]... [FILE]...
466 hg add [OPTION]... [FILE]...
467
467
468 add the specified files on the next commit
468 add the specified files on the next commit
469
469
470 options ([+] can be repeated):
470 options ([+] can be repeated):
471
471
472 -I --include PATTERN [+] include names matching the given patterns
472 -I --include PATTERN [+] include names matching the given patterns
473 -X --exclude PATTERN [+] exclude names matching the given patterns
473 -X --exclude PATTERN [+] exclude names matching the given patterns
474 -S --subrepos recurse into subrepositories
474 -S --subrepos recurse into subrepositories
475 -n --dry-run do not perform actions, just print output
475 -n --dry-run do not perform actions, just print output
476
476
477 (use 'hg add -h' to show more help)
477 (use 'hg add -h' to show more help)
478 [255]
478 [255]
479
479
480 Test ambiguous command help
480 Test ambiguous command help
481
481
482 $ hg help ad
482 $ hg help ad
483 list of commands:
483 list of commands:
484
484
485 add add the specified files on the next commit
485 add add the specified files on the next commit
486 addremove add all new files, delete all missing files
486 addremove add all new files, delete all missing files
487
487
488 (use 'hg help -v ad' to show built-in aliases and global options)
488 (use 'hg help -v ad' to show built-in aliases and global options)
489
489
490 Test command without options
490 Test command without options
491
491
492 $ hg help verify
492 $ hg help verify
493 hg verify
493 hg verify
494
494
495 verify the integrity of the repository
495 verify the integrity of the repository
496
496
497 Verify the integrity of the current repository.
497 Verify the integrity of the current repository.
498
498
499 This will perform an extensive check of the repository's integrity,
499 This will perform an extensive check of the repository's integrity,
500 validating the hashes and checksums of each entry in the changelog,
500 validating the hashes and checksums of each entry in the changelog,
501 manifest, and tracked files, as well as the integrity of their crosslinks
501 manifest, and tracked files, as well as the integrity of their crosslinks
502 and indices.
502 and indices.
503
503
504 Please see https://mercurial-scm.org/wiki/RepositoryCorruption for more
504 Please see https://mercurial-scm.org/wiki/RepositoryCorruption for more
505 information about recovery from corruption of the repository.
505 information about recovery from corruption of the repository.
506
506
507 Returns 0 on success, 1 if errors are encountered.
507 Returns 0 on success, 1 if errors are encountered.
508
508
509 (some details hidden, use --verbose to show complete help)
509 (some details hidden, use --verbose to show complete help)
510
510
511 $ hg help diff
511 $ hg help diff
512 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
512 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
513
513
514 diff repository (or selected files)
514 diff repository (or selected files)
515
515
516 Show differences between revisions for the specified files.
516 Show differences between revisions for the specified files.
517
517
518 Differences between files are shown using the unified diff format.
518 Differences between files are shown using the unified diff format.
519
519
520 Note:
520 Note:
521 'hg diff' may generate unexpected results for merges, as it will
521 'hg diff' may generate unexpected results for merges, as it will
522 default to comparing against the working directory's first parent
522 default to comparing against the working directory's first parent
523 changeset if no revisions are specified.
523 changeset if no revisions are specified.
524
524
525 When two revision arguments are given, then changes are shown between
525 When two revision arguments are given, then changes are shown between
526 those revisions. If only one revision is specified then that revision is
526 those revisions. If only one revision is specified then that revision is
527 compared to the working directory, and, when no revisions are specified,
527 compared to the working directory, and, when no revisions are specified,
528 the working directory files are compared to its first parent.
528 the working directory files are compared to its first parent.
529
529
530 Alternatively you can specify -c/--change with a revision to see the
530 Alternatively you can specify -c/--change with a revision to see the
531 changes in that changeset relative to its first parent.
531 changes in that changeset relative to its first parent.
532
532
533 Without the -a/--text option, diff will avoid generating diffs of files it
533 Without the -a/--text option, diff will avoid generating diffs of files it
534 detects as binary. With -a, diff will generate a diff anyway, probably
534 detects as binary. With -a, diff will generate a diff anyway, probably
535 with undesirable results.
535 with undesirable results.
536
536
537 Use the -g/--git option to generate diffs in the git extended diff format.
537 Use the -g/--git option to generate diffs in the git extended diff format.
538 For more information, read 'hg help diffs'.
538 For more information, read 'hg help diffs'.
539
539
540 Returns 0 on success.
540 Returns 0 on success.
541
541
542 options ([+] can be repeated):
542 options ([+] can be repeated):
543
543
544 -r --rev REV [+] revision
544 -r --rev REV [+] revision
545 -c --change REV change made by revision
545 -c --change REV change made by revision
546 -a --text treat all files as text
546 -a --text treat all files as text
547 -g --git use git extended diff format
547 -g --git use git extended diff format
548 --nodates omit dates from diff headers
548 --nodates omit dates from diff headers
549 --noprefix omit a/ and b/ prefixes from filenames
549 --noprefix omit a/ and b/ prefixes from filenames
550 -p --show-function show which function each change is in
550 -p --show-function show which function each change is in
551 --reverse produce a diff that undoes the changes
551 --reverse produce a diff that undoes the changes
552 -w --ignore-all-space ignore white space when comparing lines
552 -w --ignore-all-space ignore white space when comparing lines
553 -b --ignore-space-change ignore changes in the amount of white space
553 -b --ignore-space-change ignore changes in the amount of white space
554 -B --ignore-blank-lines ignore changes whose lines are all blank
554 -B --ignore-blank-lines ignore changes whose lines are all blank
555 -U --unified NUM number of lines of context to show
555 -U --unified NUM number of lines of context to show
556 --stat output diffstat-style summary of changes
556 --stat output diffstat-style summary of changes
557 --root DIR produce diffs relative to subdirectory
557 --root DIR produce diffs relative to subdirectory
558 -I --include PATTERN [+] include names matching the given patterns
558 -I --include PATTERN [+] include names matching the given patterns
559 -X --exclude PATTERN [+] exclude names matching the given patterns
559 -X --exclude PATTERN [+] exclude names matching the given patterns
560 -S --subrepos recurse into subrepositories
560 -S --subrepos recurse into subrepositories
561
561
562 (some details hidden, use --verbose to show complete help)
562 (some details hidden, use --verbose to show complete help)
563
563
564 $ hg help status
564 $ hg help status
565 hg status [OPTION]... [FILE]...
565 hg status [OPTION]... [FILE]...
566
566
567 aliases: st
567 aliases: st
568
568
569 show changed files in the working directory
569 show changed files in the working directory
570
570
571 Show status of files in the repository. If names are given, only files
571 Show status of files in the repository. If names are given, only files
572 that match are shown. Files that are clean or ignored or the source of a
572 that match are shown. Files that are clean or ignored or the source of a
573 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
573 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
574 -C/--copies or -A/--all are given. Unless options described with "show
574 -C/--copies or -A/--all are given. Unless options described with "show
575 only ..." are given, the options -mardu are used.
575 only ..." are given, the options -mardu are used.
576
576
577 Option -q/--quiet hides untracked (unknown and ignored) files unless
577 Option -q/--quiet hides untracked (unknown and ignored) files unless
578 explicitly requested with -u/--unknown or -i/--ignored.
578 explicitly requested with -u/--unknown or -i/--ignored.
579
579
580 Note:
580 Note:
581 'hg status' may appear to disagree with diff if permissions have
581 'hg status' may appear to disagree with diff if permissions have
582 changed or a merge has occurred. The standard diff format does not
582 changed or a merge has occurred. The standard diff format does not
583 report permission changes and diff only reports changes relative to one
583 report permission changes and diff only reports changes relative to one
584 merge parent.
584 merge parent.
585
585
586 If one revision is given, it is used as the base revision. If two
586 If one revision is given, it is used as the base revision. If two
587 revisions are given, the differences between them are shown. The --change
587 revisions are given, the differences between them are shown. The --change
588 option can also be used as a shortcut to list the changed files of a
588 option can also be used as a shortcut to list the changed files of a
589 revision from its first parent.
589 revision from its first parent.
590
590
591 The codes used to show the status of files are:
591 The codes used to show the status of files are:
592
592
593 M = modified
593 M = modified
594 A = added
594 A = added
595 R = removed
595 R = removed
596 C = clean
596 C = clean
597 ! = missing (deleted by non-hg command, but still tracked)
597 ! = missing (deleted by non-hg command, but still tracked)
598 ? = not tracked
598 ? = not tracked
599 I = ignored
599 I = ignored
600 = origin of the previous file (with --copies)
600 = origin of the previous file (with --copies)
601
601
602 Returns 0 on success.
602 Returns 0 on success.
603
603
604 options ([+] can be repeated):
604 options ([+] can be repeated):
605
605
606 -A --all show status of all files
606 -A --all show status of all files
607 -m --modified show only modified files
607 -m --modified show only modified files
608 -a --added show only added files
608 -a --added show only added files
609 -r --removed show only removed files
609 -r --removed show only removed files
610 -d --deleted show only deleted (but tracked) files
610 -d --deleted show only deleted (but tracked) files
611 -c --clean show only files without changes
611 -c --clean show only files without changes
612 -u --unknown show only unknown (not tracked) files
612 -u --unknown show only unknown (not tracked) files
613 -i --ignored show only ignored files
613 -i --ignored show only ignored files
614 -n --no-status hide status prefix
614 -n --no-status hide status prefix
615 -C --copies show source of copied files
615 -C --copies show source of copied files
616 -0 --print0 end filenames with NUL, for use with xargs
616 -0 --print0 end filenames with NUL, for use with xargs
617 --rev REV [+] show difference from revision
617 --rev REV [+] show difference from revision
618 --change REV list the changed files of a revision
618 --change REV list the changed files of a revision
619 -I --include PATTERN [+] include names matching the given patterns
619 -I --include PATTERN [+] include names matching the given patterns
620 -X --exclude PATTERN [+] exclude names matching the given patterns
620 -X --exclude PATTERN [+] exclude names matching the given patterns
621 -S --subrepos recurse into subrepositories
621 -S --subrepos recurse into subrepositories
622
622
623 (some details hidden, use --verbose to show complete help)
623 (some details hidden, use --verbose to show complete help)
624
624
625 $ hg -q help status
625 $ hg -q help status
626 hg status [OPTION]... [FILE]...
626 hg status [OPTION]... [FILE]...
627
627
628 show changed files in the working directory
628 show changed files in the working directory
629
629
630 $ hg help foo
630 $ hg help foo
631 abort: no such help topic: foo
631 abort: no such help topic: foo
632 (try 'hg help --keyword foo')
632 (try 'hg help --keyword foo')
633 [255]
633 [255]
634
634
635 $ hg skjdfks
635 $ hg skjdfks
636 hg: unknown command 'skjdfks'
636 hg: unknown command 'skjdfks'
637 Mercurial Distributed SCM
637 Mercurial Distributed SCM
638
638
639 basic commands:
639 basic commands:
640
640
641 add add the specified files on the next commit
641 add add the specified files on the next commit
642 annotate show changeset information by line for each file
642 annotate show changeset information by line for each file
643 clone make a copy of an existing repository
643 clone make a copy of an existing repository
644 commit commit the specified files or all outstanding changes
644 commit commit the specified files or all outstanding changes
645 diff diff repository (or selected files)
645 diff diff repository (or selected files)
646 export dump the header and diffs for one or more changesets
646 export dump the header and diffs for one or more changesets
647 forget forget the specified files on the next commit
647 forget forget the specified files on the next commit
648 init create a new repository in the given directory
648 init create a new repository in the given directory
649 log show revision history of entire repository or files
649 log show revision history of entire repository or files
650 merge merge another revision into working directory
650 merge merge another revision into working directory
651 pull pull changes from the specified source
651 pull pull changes from the specified source
652 push push changes to the specified destination
652 push push changes to the specified destination
653 remove remove the specified files on the next commit
653 remove remove the specified files on the next commit
654 serve start stand-alone webserver
654 serve start stand-alone webserver
655 status show changed files in the working directory
655 status show changed files in the working directory
656 summary summarize working directory state
656 summary summarize working directory state
657 update update working directory (or switch revisions)
657 update update working directory (or switch revisions)
658
658
659 (use 'hg help' for the full list of commands or 'hg -v' for details)
659 (use 'hg help' for the full list of commands or 'hg -v' for details)
660 [255]
660 [255]
661
661
662
662
663 Make sure that we don't run afoul of the help system thinking that
663 Make sure that we don't run afoul of the help system thinking that
664 this is a section and erroring out weirdly.
664 this is a section and erroring out weirdly.
665
665
666 $ hg .log
666 $ hg .log
667 hg: unknown command '.log'
667 hg: unknown command '.log'
668 (did you mean log?)
668 (did you mean log?)
669 [255]
669 [255]
670
670
671 $ hg log.
671 $ hg log.
672 hg: unknown command 'log.'
672 hg: unknown command 'log.'
673 (did you mean log?)
673 (did you mean log?)
674 [255]
674 [255]
675 $ hg pu.lh
675 $ hg pu.lh
676 hg: unknown command 'pu.lh'
676 hg: unknown command 'pu.lh'
677 (did you mean one of pull, push?)
677 (did you mean one of pull, push?)
678 [255]
678 [255]
679
679
680 $ cat > helpext.py <<EOF
680 $ cat > helpext.py <<EOF
681 > import os
681 > import os
682 > from mercurial import cmdutil, commands
682 > from mercurial import cmdutil, commands
683 >
683 >
684 > cmdtable = {}
684 > cmdtable = {}
685 > command = cmdutil.command(cmdtable)
685 > command = cmdutil.command(cmdtable)
686 >
686 >
687 > @command('nohelp',
687 > @command('nohelp',
688 > [('', 'longdesc', 3, 'x'*90),
688 > [('', 'longdesc', 3, 'x'*90),
689 > ('n', '', None, 'normal desc'),
689 > ('n', '', None, 'normal desc'),
690 > ('', 'newline', '', 'line1\nline2')],
690 > ('', 'newline', '', 'line1\nline2')],
691 > 'hg nohelp',
691 > 'hg nohelp',
692 > norepo=True)
692 > norepo=True)
693 > @command('debugoptADV', [('', 'aopt', None, 'option is (ADVANCED)')])
693 > @command('debugoptADV', [('', 'aopt', None, 'option is (ADVANCED)')])
694 > @command('debugoptDEP', [('', 'dopt', None, 'option is (DEPRECATED)')])
694 > @command('debugoptDEP', [('', 'dopt', None, 'option is (DEPRECATED)')])
695 > @command('debugoptEXP', [('', 'eopt', None, 'option is (EXPERIMENTAL)')])
695 > @command('debugoptEXP', [('', 'eopt', None, 'option is (EXPERIMENTAL)')])
696 > def nohelp(ui, *args, **kwargs):
696 > def nohelp(ui, *args, **kwargs):
697 > pass
697 > pass
698 >
698 >
699 > def uisetup(ui):
699 > def uisetup(ui):
700 > ui.setconfig('alias', 'shellalias', '!echo hi', 'helpext')
700 > ui.setconfig('alias', 'shellalias', '!echo hi', 'helpext')
701 > ui.setconfig('alias', 'hgalias', 'summary', 'helpext')
701 > ui.setconfig('alias', 'hgalias', 'summary', 'helpext')
702 >
702 >
703 > EOF
703 > EOF
704 $ echo '[extensions]' >> $HGRCPATH
704 $ echo '[extensions]' >> $HGRCPATH
705 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
705 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
706
706
707 Test for aliases
707 Test for aliases
708
708
709 $ hg help hgalias
709 $ hg help hgalias
710 hg hgalias [--remote]
710 hg hgalias [--remote]
711
711
712 alias for: hg summary
712 alias for: hg summary
713
713
714 summarize working directory state
714 summarize working directory state
715
715
716 This generates a brief summary of the working directory state, including
716 This generates a brief summary of the working directory state, including
717 parents, branch, commit status, phase and available updates.
717 parents, branch, commit status, phase and available updates.
718
718
719 With the --remote option, this will check the default paths for incoming
719 With the --remote option, this will check the default paths for incoming
720 and outgoing changes. This can be time-consuming.
720 and outgoing changes. This can be time-consuming.
721
721
722 Returns 0 on success.
722 Returns 0 on success.
723
723
724 defined by: helpext
724 defined by: helpext
725
725
726 options:
726 options:
727
727
728 --remote check for push and pull
728 --remote check for push and pull
729
729
730 (some details hidden, use --verbose to show complete help)
730 (some details hidden, use --verbose to show complete help)
731
731
732 $ hg help shellalias
732 $ hg help shellalias
733 hg shellalias
733 hg shellalias
734
734
735 shell alias for:
735 shell alias for:
736
736
737 echo hi
737 echo hi
738
738
739 defined by: helpext
739 defined by: helpext
740
740
741 (some details hidden, use --verbose to show complete help)
741 (some details hidden, use --verbose to show complete help)
742
742
743 Test command with no help text
743 Test command with no help text
744
744
745 $ hg help nohelp
745 $ hg help nohelp
746 hg nohelp
746 hg nohelp
747
747
748 (no help text available)
748 (no help text available)
749
749
750 options:
750 options:
751
751
752 --longdesc VALUE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
752 --longdesc VALUE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
753 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (default: 3)
753 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (default: 3)
754 -n -- normal desc
754 -n -- normal desc
755 --newline VALUE line1 line2
755 --newline VALUE line1 line2
756
756
757 (some details hidden, use --verbose to show complete help)
757 (some details hidden, use --verbose to show complete help)
758
758
759 $ hg help -k nohelp
759 $ hg help -k nohelp
760 Commands:
760 Commands:
761
761
762 nohelp hg nohelp
762 nohelp hg nohelp
763
763
764 Extension Commands:
764 Extension Commands:
765
765
766 nohelp (no help text available)
766 nohelp (no help text available)
767
767
768 Test that default list of commands omits extension commands
768 Test that default list of commands omits extension commands
769
769
770 $ hg help
770 $ hg help
771 Mercurial Distributed SCM
771 Mercurial Distributed SCM
772
772
773 list of commands:
773 list of commands:
774
774
775 add add the specified files on the next commit
775 add add the specified files on the next commit
776 addremove add all new files, delete all missing files
776 addremove add all new files, delete all missing files
777 annotate show changeset information by line for each file
777 annotate show changeset information by line for each file
778 archive create an unversioned archive of a repository revision
778 archive create an unversioned archive of a repository revision
779 backout reverse effect of earlier changeset
779 backout reverse effect of earlier changeset
780 bisect subdivision search of changesets
780 bisect subdivision search of changesets
781 bookmarks create a new bookmark or list existing bookmarks
781 bookmarks create a new bookmark or list existing bookmarks
782 branch set or show the current branch name
782 branch set or show the current branch name
783 branches list repository named branches
783 branches list repository named branches
784 bundle create a bundle file
784 bundle create a bundle file
785 cat output the current or given revision of files
785 cat output the current or given revision of files
786 clone make a copy of an existing repository
786 clone make a copy of an existing repository
787 commit commit the specified files or all outstanding changes
787 commit commit the specified files or all outstanding changes
788 config show combined config settings from all hgrc files
788 config show combined config settings from all hgrc files
789 copy mark files as copied for the next commit
789 copy mark files as copied for the next commit
790 diff diff repository (or selected files)
790 diff diff repository (or selected files)
791 export dump the header and diffs for one or more changesets
791 export dump the header and diffs for one or more changesets
792 files list tracked files
792 files list tracked files
793 forget forget the specified files on the next commit
793 forget forget the specified files on the next commit
794 graft copy changes from other branches onto the current branch
794 graft copy changes from other branches onto the current branch
795 grep search revision history for a pattern in specified files
795 grep search revision history for a pattern in specified files
796 heads show branch heads
796 heads show branch heads
797 help show help for a given topic or a help overview
797 help show help for a given topic or a help overview
798 identify identify the working directory or specified revision
798 identify identify the working directory or specified revision
799 import import an ordered set of patches
799 import import an ordered set of patches
800 incoming show new changesets found in source
800 incoming show new changesets found in source
801 init create a new repository in the given directory
801 init create a new repository in the given directory
802 log show revision history of entire repository or files
802 log show revision history of entire repository or files
803 manifest output the current or given revision of the project manifest
803 manifest output the current or given revision of the project manifest
804 merge merge another revision into working directory
804 merge merge another revision into working directory
805 outgoing show changesets not found in the destination
805 outgoing show changesets not found in the destination
806 paths show aliases for remote repositories
806 paths show aliases for remote repositories
807 phase set or show the current phase name
807 phase set or show the current phase name
808 pull pull changes from the specified source
808 pull pull changes from the specified source
809 push push changes to the specified destination
809 push push changes to the specified destination
810 recover roll back an interrupted transaction
810 recover roll back an interrupted transaction
811 remove remove the specified files on the next commit
811 remove remove the specified files on the next commit
812 rename rename files; equivalent of copy + remove
812 rename rename files; equivalent of copy + remove
813 resolve redo merges or set/view the merge status of files
813 resolve redo merges or set/view the merge status of files
814 revert restore files to their checkout state
814 revert restore files to their checkout state
815 root print the root (top) of the current working directory
815 root print the root (top) of the current working directory
816 serve start stand-alone webserver
816 serve start stand-alone webserver
817 status show changed files in the working directory
817 status show changed files in the working directory
818 summary summarize working directory state
818 summary summarize working directory state
819 tag add one or more tags for the current or given revision
819 tag add one or more tags for the current or given revision
820 tags list repository tags
820 tags list repository tags
821 unbundle apply one or more changegroup files
821 unbundle apply one or more bundle files
822 update update working directory (or switch revisions)
822 update update working directory (or switch revisions)
823 verify verify the integrity of the repository
823 verify verify the integrity of the repository
824 version output version and copyright information
824 version output version and copyright information
825
825
826 enabled extensions:
826 enabled extensions:
827
827
828 helpext (no help text available)
828 helpext (no help text available)
829
829
830 additional help topics:
830 additional help topics:
831
831
832 bundlespec Bundle File Formats
832 bundlespec Bundle File Formats
833 color Colorizing Outputs
833 color Colorizing Outputs
834 config Configuration Files
834 config Configuration Files
835 dates Date Formats
835 dates Date Formats
836 diffs Diff Formats
836 diffs Diff Formats
837 environment Environment Variables
837 environment Environment Variables
838 extensions Using Additional Features
838 extensions Using Additional Features
839 filesets Specifying File Sets
839 filesets Specifying File Sets
840 glossary Glossary
840 glossary Glossary
841 hgignore Syntax for Mercurial Ignore Files
841 hgignore Syntax for Mercurial Ignore Files
842 hgweb Configuring hgweb
842 hgweb Configuring hgweb
843 internals Technical implementation topics
843 internals Technical implementation topics
844 merge-tools Merge Tools
844 merge-tools Merge Tools
845 pager Pager Support
845 pager Pager Support
846 patterns File Name Patterns
846 patterns File Name Patterns
847 phases Working with Phases
847 phases Working with Phases
848 revisions Specifying Revisions
848 revisions Specifying Revisions
849 scripting Using Mercurial from scripts and automation
849 scripting Using Mercurial from scripts and automation
850 subrepos Subrepositories
850 subrepos Subrepositories
851 templating Template Usage
851 templating Template Usage
852 urls URL Paths
852 urls URL Paths
853
853
854 (use 'hg help -v' to show built-in aliases and global options)
854 (use 'hg help -v' to show built-in aliases and global options)
855
855
856
856
857 Test list of internal help commands
857 Test list of internal help commands
858
858
859 $ hg help debug
859 $ hg help debug
860 debug commands (internal and unsupported):
860 debug commands (internal and unsupported):
861
861
862 debugancestor
862 debugancestor
863 find the ancestor revision of two revisions in a given index
863 find the ancestor revision of two revisions in a given index
864 debugapplystreamclonebundle
864 debugapplystreamclonebundle
865 apply a stream clone bundle file
865 apply a stream clone bundle file
866 debugbuilddag
866 debugbuilddag
867 builds a repo with a given DAG from scratch in the current
867 builds a repo with a given DAG from scratch in the current
868 empty repo
868 empty repo
869 debugbundle lists the contents of a bundle
869 debugbundle lists the contents of a bundle
870 debugcheckstate
870 debugcheckstate
871 validate the correctness of the current dirstate
871 validate the correctness of the current dirstate
872 debugcolor show available color, effects or style
872 debugcolor show available color, effects or style
873 debugcommands
873 debugcommands
874 list all available commands and options
874 list all available commands and options
875 debugcomplete
875 debugcomplete
876 returns the completion list associated with the given command
876 returns the completion list associated with the given command
877 debugcreatestreamclonebundle
877 debugcreatestreamclonebundle
878 create a stream clone bundle file
878 create a stream clone bundle file
879 debugdag format the changelog or an index DAG as a concise textual
879 debugdag format the changelog or an index DAG as a concise textual
880 description
880 description
881 debugdata dump the contents of a data file revision
881 debugdata dump the contents of a data file revision
882 debugdate parse and display a date
882 debugdate parse and display a date
883 debugdeltachain
883 debugdeltachain
884 dump information about delta chains in a revlog
884 dump information about delta chains in a revlog
885 debugdirstate
885 debugdirstate
886 show the contents of the current dirstate
886 show the contents of the current dirstate
887 debugdiscovery
887 debugdiscovery
888 runs the changeset discovery protocol in isolation
888 runs the changeset discovery protocol in isolation
889 debugextensions
889 debugextensions
890 show information about active extensions
890 show information about active extensions
891 debugfileset parse and apply a fileset specification
891 debugfileset parse and apply a fileset specification
892 debugfsinfo show information detected about current filesystem
892 debugfsinfo show information detected about current filesystem
893 debuggetbundle
893 debuggetbundle
894 retrieves a bundle from a repo
894 retrieves a bundle from a repo
895 debugignore display the combined ignore pattern and information about
895 debugignore display the combined ignore pattern and information about
896 ignored files
896 ignored files
897 debugindex dump the contents of an index file
897 debugindex dump the contents of an index file
898 debugindexdot
898 debugindexdot
899 dump an index DAG as a graphviz dot file
899 dump an index DAG as a graphviz dot file
900 debuginstall test Mercurial installation
900 debuginstall test Mercurial installation
901 debugknown test whether node ids are known to a repo
901 debugknown test whether node ids are known to a repo
902 debuglocks show or modify state of locks
902 debuglocks show or modify state of locks
903 debugmergestate
903 debugmergestate
904 print merge state
904 print merge state
905 debugnamecomplete
905 debugnamecomplete
906 complete "names" - tags, open branch names, bookmark names
906 complete "names" - tags, open branch names, bookmark names
907 debugobsolete
907 debugobsolete
908 create arbitrary obsolete marker
908 create arbitrary obsolete marker
909 debugoptADV (no help text available)
909 debugoptADV (no help text available)
910 debugoptDEP (no help text available)
910 debugoptDEP (no help text available)
911 debugoptEXP (no help text available)
911 debugoptEXP (no help text available)
912 debugpathcomplete
912 debugpathcomplete
913 complete part or all of a tracked path
913 complete part or all of a tracked path
914 debugpushkey access the pushkey key/value protocol
914 debugpushkey access the pushkey key/value protocol
915 debugpvec (no help text available)
915 debugpvec (no help text available)
916 debugrebuilddirstate
916 debugrebuilddirstate
917 rebuild the dirstate as it would look like for the given
917 rebuild the dirstate as it would look like for the given
918 revision
918 revision
919 debugrebuildfncache
919 debugrebuildfncache
920 rebuild the fncache file
920 rebuild the fncache file
921 debugrename dump rename information
921 debugrename dump rename information
922 debugrevlog show data and statistics about a revlog
922 debugrevlog show data and statistics about a revlog
923 debugrevspec parse and apply a revision specification
923 debugrevspec parse and apply a revision specification
924 debugsetparents
924 debugsetparents
925 manually set the parents of the current working directory
925 manually set the parents of the current working directory
926 debugsub (no help text available)
926 debugsub (no help text available)
927 debugsuccessorssets
927 debugsuccessorssets
928 show set of successors for revision
928 show set of successors for revision
929 debugtemplate
929 debugtemplate
930 parse and apply a template
930 parse and apply a template
931 debugupgraderepo
931 debugupgraderepo
932 upgrade a repository to use different features
932 upgrade a repository to use different features
933 debugwalk show how files match on given patterns
933 debugwalk show how files match on given patterns
934 debugwireargs
934 debugwireargs
935 (no help text available)
935 (no help text available)
936
936
937 (use 'hg help -v debug' to show built-in aliases and global options)
937 (use 'hg help -v debug' to show built-in aliases and global options)
938
938
939 internals topic renders index of available sub-topics
939 internals topic renders index of available sub-topics
940
940
941 $ hg help internals
941 $ hg help internals
942 Technical implementation topics
942 Technical implementation topics
943 """""""""""""""""""""""""""""""
943 """""""""""""""""""""""""""""""
944
944
945 bundles Bundles
945 bundles Bundles
946 censor Censor
946 censor Censor
947 changegroups Changegroups
947 changegroups Changegroups
948 requirements Repository Requirements
948 requirements Repository Requirements
949 revlogs Revision Logs
949 revlogs Revision Logs
950 wireprotocol Wire Protocol
950 wireprotocol Wire Protocol
951
951
952 sub-topics can be accessed
952 sub-topics can be accessed
953
953
954 $ hg help internals.changegroups
954 $ hg help internals.changegroups
955 Changegroups
955 Changegroups
956 """"""""""""
956 """"""""""""
957
957
958 Changegroups are representations of repository revlog data, specifically
958 Changegroups are representations of repository revlog data, specifically
959 the changelog data, root/flat manifest data, treemanifest data, and
959 the changelog data, root/flat manifest data, treemanifest data, and
960 filelogs.
960 filelogs.
961
961
962 There are 3 versions of changegroups: "1", "2", and "3". From a high-
962 There are 3 versions of changegroups: "1", "2", and "3". From a high-
963 level, versions "1" and "2" are almost exactly the same, with the only
963 level, versions "1" and "2" are almost exactly the same, with the only
964 difference being an additional item in the *delta header*. Version "3"
964 difference being an additional item in the *delta header*. Version "3"
965 adds support for revlog flags in the *delta header* and optionally
965 adds support for revlog flags in the *delta header* and optionally
966 exchanging treemanifests (enabled by setting an option on the
966 exchanging treemanifests (enabled by setting an option on the
967 "changegroup" part in the bundle2).
967 "changegroup" part in the bundle2).
968
968
969 Changegroups when not exchanging treemanifests consist of 3 logical
969 Changegroups when not exchanging treemanifests consist of 3 logical
970 segments:
970 segments:
971
971
972 +---------------------------------+
972 +---------------------------------+
973 | | | |
973 | | | |
974 | changeset | manifest | filelogs |
974 | changeset | manifest | filelogs |
975 | | | |
975 | | | |
976 | | | |
976 | | | |
977 +---------------------------------+
977 +---------------------------------+
978
978
979 When exchanging treemanifests, there are 4 logical segments:
979 When exchanging treemanifests, there are 4 logical segments:
980
980
981 +-------------------------------------------------+
981 +-------------------------------------------------+
982 | | | | |
982 | | | | |
983 | changeset | root | treemanifests | filelogs |
983 | changeset | root | treemanifests | filelogs |
984 | | manifest | | |
984 | | manifest | | |
985 | | | | |
985 | | | | |
986 +-------------------------------------------------+
986 +-------------------------------------------------+
987
987
988 The principle building block of each segment is a *chunk*. A *chunk* is a
988 The principle building block of each segment is a *chunk*. A *chunk* is a
989 framed piece of data:
989 framed piece of data:
990
990
991 +---------------------------------------+
991 +---------------------------------------+
992 | | |
992 | | |
993 | length | data |
993 | length | data |
994 | (4 bytes) | (<length - 4> bytes) |
994 | (4 bytes) | (<length - 4> bytes) |
995 | | |
995 | | |
996 +---------------------------------------+
996 +---------------------------------------+
997
997
998 All integers are big-endian signed integers. Each chunk starts with a
998 All integers are big-endian signed integers. Each chunk starts with a
999 32-bit integer indicating the length of the entire chunk (including the
999 32-bit integer indicating the length of the entire chunk (including the
1000 length field itself).
1000 length field itself).
1001
1001
1002 There is a special case chunk that has a value of 0 for the length
1002 There is a special case chunk that has a value of 0 for the length
1003 ("0x00000000"). We call this an *empty chunk*.
1003 ("0x00000000"). We call this an *empty chunk*.
1004
1004
1005 Delta Groups
1005 Delta Groups
1006 ============
1006 ============
1007
1007
1008 A *delta group* expresses the content of a revlog as a series of deltas,
1008 A *delta group* expresses the content of a revlog as a series of deltas,
1009 or patches against previous revisions.
1009 or patches against previous revisions.
1010
1010
1011 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
1011 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
1012 to signal the end of the delta group:
1012 to signal the end of the delta group:
1013
1013
1014 +------------------------------------------------------------------------+
1014 +------------------------------------------------------------------------+
1015 | | | | | |
1015 | | | | | |
1016 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
1016 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
1017 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
1017 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
1018 | | | | | |
1018 | | | | | |
1019 +------------------------------------------------------------------------+
1019 +------------------------------------------------------------------------+
1020
1020
1021 Each *chunk*'s data consists of the following:
1021 Each *chunk*'s data consists of the following:
1022
1022
1023 +---------------------------------------+
1023 +---------------------------------------+
1024 | | |
1024 | | |
1025 | delta header | delta data |
1025 | delta header | delta data |
1026 | (various by version) | (various) |
1026 | (various by version) | (various) |
1027 | | |
1027 | | |
1028 +---------------------------------------+
1028 +---------------------------------------+
1029
1029
1030 The *delta data* is a series of *delta*s that describe a diff from an
1030 The *delta data* is a series of *delta*s that describe a diff from an
1031 existing entry (either that the recipient already has, or previously
1031 existing entry (either that the recipient already has, or previously
1032 specified in the bundlei/changegroup).
1032 specified in the bundlei/changegroup).
1033
1033
1034 The *delta header* is different between versions "1", "2", and "3" of the
1034 The *delta header* is different between versions "1", "2", and "3" of the
1035 changegroup format.
1035 changegroup format.
1036
1036
1037 Version 1 (headerlen=80):
1037 Version 1 (headerlen=80):
1038
1038
1039 +------------------------------------------------------+
1039 +------------------------------------------------------+
1040 | | | | |
1040 | | | | |
1041 | node | p1 node | p2 node | link node |
1041 | node | p1 node | p2 node | link node |
1042 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1042 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1043 | | | | |
1043 | | | | |
1044 +------------------------------------------------------+
1044 +------------------------------------------------------+
1045
1045
1046 Version 2 (headerlen=100):
1046 Version 2 (headerlen=100):
1047
1047
1048 +------------------------------------------------------------------+
1048 +------------------------------------------------------------------+
1049 | | | | | |
1049 | | | | | |
1050 | node | p1 node | p2 node | base node | link node |
1050 | node | p1 node | p2 node | base node | link node |
1051 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1051 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1052 | | | | | |
1052 | | | | | |
1053 +------------------------------------------------------------------+
1053 +------------------------------------------------------------------+
1054
1054
1055 Version 3 (headerlen=102):
1055 Version 3 (headerlen=102):
1056
1056
1057 +------------------------------------------------------------------------------+
1057 +------------------------------------------------------------------------------+
1058 | | | | | | |
1058 | | | | | | |
1059 | node | p1 node | p2 node | base node | link node | flags |
1059 | node | p1 node | p2 node | base node | link node | flags |
1060 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
1060 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
1061 | | | | | | |
1061 | | | | | | |
1062 +------------------------------------------------------------------------------+
1062 +------------------------------------------------------------------------------+
1063
1063
1064 The *delta data* consists of "chunklen - 4 - headerlen" bytes, which
1064 The *delta data* consists of "chunklen - 4 - headerlen" bytes, which
1065 contain a series of *delta*s, densely packed (no separators). These deltas
1065 contain a series of *delta*s, densely packed (no separators). These deltas
1066 describe a diff from an existing entry (either that the recipient already
1066 describe a diff from an existing entry (either that the recipient already
1067 has, or previously specified in the bundle/changegroup). The format is
1067 has, or previously specified in the bundle/changegroup). The format is
1068 described more fully in "hg help internals.bdiff", but briefly:
1068 described more fully in "hg help internals.bdiff", but briefly:
1069
1069
1070 +---------------------------------------------------------------+
1070 +---------------------------------------------------------------+
1071 | | | | |
1071 | | | | |
1072 | start offset | end offset | new length | content |
1072 | start offset | end offset | new length | content |
1073 | (4 bytes) | (4 bytes) | (4 bytes) | (<new length> bytes) |
1073 | (4 bytes) | (4 bytes) | (4 bytes) | (<new length> bytes) |
1074 | | | | |
1074 | | | | |
1075 +---------------------------------------------------------------+
1075 +---------------------------------------------------------------+
1076
1076
1077 Please note that the length field in the delta data does *not* include
1077 Please note that the length field in the delta data does *not* include
1078 itself.
1078 itself.
1079
1079
1080 In version 1, the delta is always applied against the previous node from
1080 In version 1, the delta is always applied against the previous node from
1081 the changegroup or the first parent if this is the first entry in the
1081 the changegroup or the first parent if this is the first entry in the
1082 changegroup.
1082 changegroup.
1083
1083
1084 In version 2 and up, the delta base node is encoded in the entry in the
1084 In version 2 and up, the delta base node is encoded in the entry in the
1085 changegroup. This allows the delta to be expressed against any parent,
1085 changegroup. This allows the delta to be expressed against any parent,
1086 which can result in smaller deltas and more efficient encoding of data.
1086 which can result in smaller deltas and more efficient encoding of data.
1087
1087
1088 Changeset Segment
1088 Changeset Segment
1089 =================
1089 =================
1090
1090
1091 The *changeset segment* consists of a single *delta group* holding
1091 The *changeset segment* consists of a single *delta group* holding
1092 changelog data. The *empty chunk* at the end of the *delta group* denotes
1092 changelog data. The *empty chunk* at the end of the *delta group* denotes
1093 the boundary to the *manifest segment*.
1093 the boundary to the *manifest segment*.
1094
1094
1095 Manifest Segment
1095 Manifest Segment
1096 ================
1096 ================
1097
1097
1098 The *manifest segment* consists of a single *delta group* holding manifest
1098 The *manifest segment* consists of a single *delta group* holding manifest
1099 data. If treemanifests are in use, it contains only the manifest for the
1099 data. If treemanifests are in use, it contains only the manifest for the
1100 root directory of the repository. Otherwise, it contains the entire
1100 root directory of the repository. Otherwise, it contains the entire
1101 manifest data. The *empty chunk* at the end of the *delta group* denotes
1101 manifest data. The *empty chunk* at the end of the *delta group* denotes
1102 the boundary to the next segment (either the *treemanifests segment* or
1102 the boundary to the next segment (either the *treemanifests segment* or
1103 the *filelogs segment*, depending on version and the request options).
1103 the *filelogs segment*, depending on version and the request options).
1104
1104
1105 Treemanifests Segment
1105 Treemanifests Segment
1106 ---------------------
1106 ---------------------
1107
1107
1108 The *treemanifests segment* only exists in changegroup version "3", and
1108 The *treemanifests segment* only exists in changegroup version "3", and
1109 only if the 'treemanifest' param is part of the bundle2 changegroup part
1109 only if the 'treemanifest' param is part of the bundle2 changegroup part
1110 (it is not possible to use changegroup version 3 outside of bundle2).
1110 (it is not possible to use changegroup version 3 outside of bundle2).
1111 Aside from the filenames in the *treemanifests segment* containing a
1111 Aside from the filenames in the *treemanifests segment* containing a
1112 trailing "/" character, it behaves identically to the *filelogs segment*
1112 trailing "/" character, it behaves identically to the *filelogs segment*
1113 (see below). The final sub-segment is followed by an *empty chunk*
1113 (see below). The final sub-segment is followed by an *empty chunk*
1114 (logically, a sub-segment with filename size 0). This denotes the boundary
1114 (logically, a sub-segment with filename size 0). This denotes the boundary
1115 to the *filelogs segment*.
1115 to the *filelogs segment*.
1116
1116
1117 Filelogs Segment
1117 Filelogs Segment
1118 ================
1118 ================
1119
1119
1120 The *filelogs segment* consists of multiple sub-segments, each
1120 The *filelogs segment* consists of multiple sub-segments, each
1121 corresponding to an individual file whose data is being described:
1121 corresponding to an individual file whose data is being described:
1122
1122
1123 +--------------------------------------------------+
1123 +--------------------------------------------------+
1124 | | | | | |
1124 | | | | | |
1125 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
1125 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
1126 | | | | | (4 bytes) |
1126 | | | | | (4 bytes) |
1127 | | | | | |
1127 | | | | | |
1128 +--------------------------------------------------+
1128 +--------------------------------------------------+
1129
1129
1130 The final filelog sub-segment is followed by an *empty chunk* (logically,
1130 The final filelog sub-segment is followed by an *empty chunk* (logically,
1131 a sub-segment with filename size 0). This denotes the end of the segment
1131 a sub-segment with filename size 0). This denotes the end of the segment
1132 and of the overall changegroup.
1132 and of the overall changegroup.
1133
1133
1134 Each filelog sub-segment consists of the following:
1134 Each filelog sub-segment consists of the following:
1135
1135
1136 +------------------------------------------------------+
1136 +------------------------------------------------------+
1137 | | | |
1137 | | | |
1138 | filename length | filename | delta group |
1138 | filename length | filename | delta group |
1139 | (4 bytes) | (<length - 4> bytes) | (various) |
1139 | (4 bytes) | (<length - 4> bytes) | (various) |
1140 | | | |
1140 | | | |
1141 +------------------------------------------------------+
1141 +------------------------------------------------------+
1142
1142
1143 That is, a *chunk* consisting of the filename (not terminated or padded)
1143 That is, a *chunk* consisting of the filename (not terminated or padded)
1144 followed by N chunks constituting the *delta group* for this file. The
1144 followed by N chunks constituting the *delta group* for this file. The
1145 *empty chunk* at the end of each *delta group* denotes the boundary to the
1145 *empty chunk* at the end of each *delta group* denotes the boundary to the
1146 next filelog sub-segment.
1146 next filelog sub-segment.
1147
1147
1148 Test list of commands with command with no help text
1148 Test list of commands with command with no help text
1149
1149
1150 $ hg help helpext
1150 $ hg help helpext
1151 helpext extension - no help text available
1151 helpext extension - no help text available
1152
1152
1153 list of commands:
1153 list of commands:
1154
1154
1155 nohelp (no help text available)
1155 nohelp (no help text available)
1156
1156
1157 (use 'hg help -v helpext' to show built-in aliases and global options)
1157 (use 'hg help -v helpext' to show built-in aliases and global options)
1158
1158
1159
1159
1160 test advanced, deprecated and experimental options are hidden in command help
1160 test advanced, deprecated and experimental options are hidden in command help
1161 $ hg help debugoptADV
1161 $ hg help debugoptADV
1162 hg debugoptADV
1162 hg debugoptADV
1163
1163
1164 (no help text available)
1164 (no help text available)
1165
1165
1166 options:
1166 options:
1167
1167
1168 (some details hidden, use --verbose to show complete help)
1168 (some details hidden, use --verbose to show complete help)
1169 $ hg help debugoptDEP
1169 $ hg help debugoptDEP
1170 hg debugoptDEP
1170 hg debugoptDEP
1171
1171
1172 (no help text available)
1172 (no help text available)
1173
1173
1174 options:
1174 options:
1175
1175
1176 (some details hidden, use --verbose to show complete help)
1176 (some details hidden, use --verbose to show complete help)
1177
1177
1178 $ hg help debugoptEXP
1178 $ hg help debugoptEXP
1179 hg debugoptEXP
1179 hg debugoptEXP
1180
1180
1181 (no help text available)
1181 (no help text available)
1182
1182
1183 options:
1183 options:
1184
1184
1185 (some details hidden, use --verbose to show complete help)
1185 (some details hidden, use --verbose to show complete help)
1186
1186
1187 test advanced, deprecated and experimental options are shown with -v
1187 test advanced, deprecated and experimental options are shown with -v
1188 $ hg help -v debugoptADV | grep aopt
1188 $ hg help -v debugoptADV | grep aopt
1189 --aopt option is (ADVANCED)
1189 --aopt option is (ADVANCED)
1190 $ hg help -v debugoptDEP | grep dopt
1190 $ hg help -v debugoptDEP | grep dopt
1191 --dopt option is (DEPRECATED)
1191 --dopt option is (DEPRECATED)
1192 $ hg help -v debugoptEXP | grep eopt
1192 $ hg help -v debugoptEXP | grep eopt
1193 --eopt option is (EXPERIMENTAL)
1193 --eopt option is (EXPERIMENTAL)
1194
1194
1195 #if gettext
1195 #if gettext
1196 test deprecated option is hidden with translation with untranslated description
1196 test deprecated option is hidden with translation with untranslated description
1197 (use many globy for not failing on changed transaction)
1197 (use many globy for not failing on changed transaction)
1198 $ LANGUAGE=sv hg help debugoptDEP
1198 $ LANGUAGE=sv hg help debugoptDEP
1199 hg debugoptDEP
1199 hg debugoptDEP
1200
1200
1201 (*) (glob)
1201 (*) (glob)
1202
1202
1203 options:
1203 options:
1204
1204
1205 (some details hidden, use --verbose to show complete help)
1205 (some details hidden, use --verbose to show complete help)
1206 #endif
1206 #endif
1207
1207
1208 Test commands that collide with topics (issue4240)
1208 Test commands that collide with topics (issue4240)
1209
1209
1210 $ hg config -hq
1210 $ hg config -hq
1211 hg config [-u] [NAME]...
1211 hg config [-u] [NAME]...
1212
1212
1213 show combined config settings from all hgrc files
1213 show combined config settings from all hgrc files
1214 $ hg showconfig -hq
1214 $ hg showconfig -hq
1215 hg config [-u] [NAME]...
1215 hg config [-u] [NAME]...
1216
1216
1217 show combined config settings from all hgrc files
1217 show combined config settings from all hgrc files
1218
1218
1219 Test a help topic
1219 Test a help topic
1220
1220
1221 $ hg help dates
1221 $ hg help dates
1222 Date Formats
1222 Date Formats
1223 """"""""""""
1223 """"""""""""
1224
1224
1225 Some commands allow the user to specify a date, e.g.:
1225 Some commands allow the user to specify a date, e.g.:
1226
1226
1227 - backout, commit, import, tag: Specify the commit date.
1227 - backout, commit, import, tag: Specify the commit date.
1228 - log, revert, update: Select revision(s) by date.
1228 - log, revert, update: Select revision(s) by date.
1229
1229
1230 Many date formats are valid. Here are some examples:
1230 Many date formats are valid. Here are some examples:
1231
1231
1232 - "Wed Dec 6 13:18:29 2006" (local timezone assumed)
1232 - "Wed Dec 6 13:18:29 2006" (local timezone assumed)
1233 - "Dec 6 13:18 -0600" (year assumed, time offset provided)
1233 - "Dec 6 13:18 -0600" (year assumed, time offset provided)
1234 - "Dec 6 13:18 UTC" (UTC and GMT are aliases for +0000)
1234 - "Dec 6 13:18 UTC" (UTC and GMT are aliases for +0000)
1235 - "Dec 6" (midnight)
1235 - "Dec 6" (midnight)
1236 - "13:18" (today assumed)
1236 - "13:18" (today assumed)
1237 - "3:39" (3:39AM assumed)
1237 - "3:39" (3:39AM assumed)
1238 - "3:39pm" (15:39)
1238 - "3:39pm" (15:39)
1239 - "2006-12-06 13:18:29" (ISO 8601 format)
1239 - "2006-12-06 13:18:29" (ISO 8601 format)
1240 - "2006-12-6 13:18"
1240 - "2006-12-6 13:18"
1241 - "2006-12-6"
1241 - "2006-12-6"
1242 - "12-6"
1242 - "12-6"
1243 - "12/6"
1243 - "12/6"
1244 - "12/6/6" (Dec 6 2006)
1244 - "12/6/6" (Dec 6 2006)
1245 - "today" (midnight)
1245 - "today" (midnight)
1246 - "yesterday" (midnight)
1246 - "yesterday" (midnight)
1247 - "now" - right now
1247 - "now" - right now
1248
1248
1249 Lastly, there is Mercurial's internal format:
1249 Lastly, there is Mercurial's internal format:
1250
1250
1251 - "1165411109 0" (Wed Dec 6 13:18:29 2006 UTC)
1251 - "1165411109 0" (Wed Dec 6 13:18:29 2006 UTC)
1252
1252
1253 This is the internal representation format for dates. The first number is
1253 This is the internal representation format for dates. The first number is
1254 the number of seconds since the epoch (1970-01-01 00:00 UTC). The second
1254 the number of seconds since the epoch (1970-01-01 00:00 UTC). The second
1255 is the offset of the local timezone, in seconds west of UTC (negative if
1255 is the offset of the local timezone, in seconds west of UTC (negative if
1256 the timezone is east of UTC).
1256 the timezone is east of UTC).
1257
1257
1258 The log command also accepts date ranges:
1258 The log command also accepts date ranges:
1259
1259
1260 - "<DATE" - at or before a given date/time
1260 - "<DATE" - at or before a given date/time
1261 - ">DATE" - on or after a given date/time
1261 - ">DATE" - on or after a given date/time
1262 - "DATE to DATE" - a date range, inclusive
1262 - "DATE to DATE" - a date range, inclusive
1263 - "-DAYS" - within a given number of days of today
1263 - "-DAYS" - within a given number of days of today
1264
1264
1265 Test repeated config section name
1265 Test repeated config section name
1266
1266
1267 $ hg help config.host
1267 $ hg help config.host
1268 "http_proxy.host"
1268 "http_proxy.host"
1269 Host name and (optional) port of the proxy server, for example
1269 Host name and (optional) port of the proxy server, for example
1270 "myproxy:8000".
1270 "myproxy:8000".
1271
1271
1272 "smtp.host"
1272 "smtp.host"
1273 Host name of mail server, e.g. "mail.example.com".
1273 Host name of mail server, e.g. "mail.example.com".
1274
1274
1275 Unrelated trailing paragraphs shouldn't be included
1275 Unrelated trailing paragraphs shouldn't be included
1276
1276
1277 $ hg help config.extramsg | grep '^$'
1277 $ hg help config.extramsg | grep '^$'
1278
1278
1279
1279
1280 Test capitalized section name
1280 Test capitalized section name
1281
1281
1282 $ hg help scripting.HGPLAIN > /dev/null
1282 $ hg help scripting.HGPLAIN > /dev/null
1283
1283
1284 Help subsection:
1284 Help subsection:
1285
1285
1286 $ hg help config.charsets |grep "Email example:" > /dev/null
1286 $ hg help config.charsets |grep "Email example:" > /dev/null
1287 [1]
1287 [1]
1288
1288
1289 Show nested definitions
1289 Show nested definitions
1290 ("profiling.type"[break]"ls"[break]"stat"[break])
1290 ("profiling.type"[break]"ls"[break]"stat"[break])
1291
1291
1292 $ hg help config.type | egrep '^$'|wc -l
1292 $ hg help config.type | egrep '^$'|wc -l
1293 \s*3 (re)
1293 \s*3 (re)
1294
1294
1295 Separate sections from subsections
1295 Separate sections from subsections
1296
1296
1297 $ hg help config.format | egrep '^ ("|-)|^\s*$' | uniq
1297 $ hg help config.format | egrep '^ ("|-)|^\s*$' | uniq
1298 "format"
1298 "format"
1299 --------
1299 --------
1300
1300
1301 "usegeneraldelta"
1301 "usegeneraldelta"
1302
1302
1303 "dotencode"
1303 "dotencode"
1304
1304
1305 "usefncache"
1305 "usefncache"
1306
1306
1307 "usestore"
1307 "usestore"
1308
1308
1309 "profiling"
1309 "profiling"
1310 -----------
1310 -----------
1311
1311
1312 "format"
1312 "format"
1313
1313
1314 "progress"
1314 "progress"
1315 ----------
1315 ----------
1316
1316
1317 "format"
1317 "format"
1318
1318
1319
1319
1320 Last item in help config.*:
1320 Last item in help config.*:
1321
1321
1322 $ hg help config.`hg help config|grep '^ "'| \
1322 $ hg help config.`hg help config|grep '^ "'| \
1323 > tail -1|sed 's![ "]*!!g'`| \
1323 > tail -1|sed 's![ "]*!!g'`| \
1324 > grep 'hg help -c config' > /dev/null
1324 > grep 'hg help -c config' > /dev/null
1325 [1]
1325 [1]
1326
1326
1327 note to use help -c for general hg help config:
1327 note to use help -c for general hg help config:
1328
1328
1329 $ hg help config |grep 'hg help -c config' > /dev/null
1329 $ hg help config |grep 'hg help -c config' > /dev/null
1330
1330
1331 Test templating help
1331 Test templating help
1332
1332
1333 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
1333 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
1334 desc String. The text of the changeset description.
1334 desc String. The text of the changeset description.
1335 diffstat String. Statistics of changes with the following format:
1335 diffstat String. Statistics of changes with the following format:
1336 firstline Any text. Returns the first line of text.
1336 firstline Any text. Returns the first line of text.
1337 nonempty Any text. Returns '(none)' if the string is empty.
1337 nonempty Any text. Returns '(none)' if the string is empty.
1338
1338
1339 Test deprecated items
1339 Test deprecated items
1340
1340
1341 $ hg help -v templating | grep currentbookmark
1341 $ hg help -v templating | grep currentbookmark
1342 currentbookmark
1342 currentbookmark
1343 $ hg help templating | (grep currentbookmark || true)
1343 $ hg help templating | (grep currentbookmark || true)
1344
1344
1345 Test help hooks
1345 Test help hooks
1346
1346
1347 $ cat > helphook1.py <<EOF
1347 $ cat > helphook1.py <<EOF
1348 > from mercurial import help
1348 > from mercurial import help
1349 >
1349 >
1350 > def rewrite(ui, topic, doc):
1350 > def rewrite(ui, topic, doc):
1351 > return doc + '\nhelphook1\n'
1351 > return doc + '\nhelphook1\n'
1352 >
1352 >
1353 > def extsetup(ui):
1353 > def extsetup(ui):
1354 > help.addtopichook('revisions', rewrite)
1354 > help.addtopichook('revisions', rewrite)
1355 > EOF
1355 > EOF
1356 $ cat > helphook2.py <<EOF
1356 $ cat > helphook2.py <<EOF
1357 > from mercurial import help
1357 > from mercurial import help
1358 >
1358 >
1359 > def rewrite(ui, topic, doc):
1359 > def rewrite(ui, topic, doc):
1360 > return doc + '\nhelphook2\n'
1360 > return doc + '\nhelphook2\n'
1361 >
1361 >
1362 > def extsetup(ui):
1362 > def extsetup(ui):
1363 > help.addtopichook('revisions', rewrite)
1363 > help.addtopichook('revisions', rewrite)
1364 > EOF
1364 > EOF
1365 $ echo '[extensions]' >> $HGRCPATH
1365 $ echo '[extensions]' >> $HGRCPATH
1366 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
1366 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
1367 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
1367 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
1368 $ hg help revsets | grep helphook
1368 $ hg help revsets | grep helphook
1369 helphook1
1369 helphook1
1370 helphook2
1370 helphook2
1371
1371
1372 help -c should only show debug --debug
1372 help -c should only show debug --debug
1373
1373
1374 $ hg help -c --debug|egrep debug|wc -l|egrep '^\s*0\s*$'
1374 $ hg help -c --debug|egrep debug|wc -l|egrep '^\s*0\s*$'
1375 [1]
1375 [1]
1376
1376
1377 help -c should only show deprecated for -v
1377 help -c should only show deprecated for -v
1378
1378
1379 $ hg help -c -v|egrep DEPRECATED|wc -l|egrep '^\s*0\s*$'
1379 $ hg help -c -v|egrep DEPRECATED|wc -l|egrep '^\s*0\s*$'
1380 [1]
1380 [1]
1381
1381
1382 Test -s / --system
1382 Test -s / --system
1383
1383
1384 $ hg help config.files -s windows |grep 'etc/mercurial' | \
1384 $ hg help config.files -s windows |grep 'etc/mercurial' | \
1385 > wc -l | sed -e 's/ //g'
1385 > wc -l | sed -e 's/ //g'
1386 0
1386 0
1387 $ hg help config.files --system unix | grep 'USER' | \
1387 $ hg help config.files --system unix | grep 'USER' | \
1388 > wc -l | sed -e 's/ //g'
1388 > wc -l | sed -e 's/ //g'
1389 0
1389 0
1390
1390
1391 Test -e / -c / -k combinations
1391 Test -e / -c / -k combinations
1392
1392
1393 $ hg help -c|egrep '^[A-Z].*:|^ debug'
1393 $ hg help -c|egrep '^[A-Z].*:|^ debug'
1394 Commands:
1394 Commands:
1395 $ hg help -e|egrep '^[A-Z].*:|^ debug'
1395 $ hg help -e|egrep '^[A-Z].*:|^ debug'
1396 Extensions:
1396 Extensions:
1397 $ hg help -k|egrep '^[A-Z].*:|^ debug'
1397 $ hg help -k|egrep '^[A-Z].*:|^ debug'
1398 Topics:
1398 Topics:
1399 Commands:
1399 Commands:
1400 Extensions:
1400 Extensions:
1401 Extension Commands:
1401 Extension Commands:
1402 $ hg help -c schemes
1402 $ hg help -c schemes
1403 abort: no such help topic: schemes
1403 abort: no such help topic: schemes
1404 (try 'hg help --keyword schemes')
1404 (try 'hg help --keyword schemes')
1405 [255]
1405 [255]
1406 $ hg help -e schemes |head -1
1406 $ hg help -e schemes |head -1
1407 schemes extension - extend schemes with shortcuts to repository swarms
1407 schemes extension - extend schemes with shortcuts to repository swarms
1408 $ hg help -c -k dates |egrep '^(Topics|Extensions|Commands):'
1408 $ hg help -c -k dates |egrep '^(Topics|Extensions|Commands):'
1409 Commands:
1409 Commands:
1410 $ hg help -e -k a |egrep '^(Topics|Extensions|Commands):'
1410 $ hg help -e -k a |egrep '^(Topics|Extensions|Commands):'
1411 Extensions:
1411 Extensions:
1412 $ hg help -e -c -k date |egrep '^(Topics|Extensions|Commands):'
1412 $ hg help -e -c -k date |egrep '^(Topics|Extensions|Commands):'
1413 Extensions:
1413 Extensions:
1414 Commands:
1414 Commands:
1415 $ hg help -c commit > /dev/null
1415 $ hg help -c commit > /dev/null
1416 $ hg help -e -c commit > /dev/null
1416 $ hg help -e -c commit > /dev/null
1417 $ hg help -e commit > /dev/null
1417 $ hg help -e commit > /dev/null
1418 abort: no such help topic: commit
1418 abort: no such help topic: commit
1419 (try 'hg help --keyword commit')
1419 (try 'hg help --keyword commit')
1420 [255]
1420 [255]
1421
1421
1422 Test keyword search help
1422 Test keyword search help
1423
1423
1424 $ cat > prefixedname.py <<EOF
1424 $ cat > prefixedname.py <<EOF
1425 > '''matched against word "clone"
1425 > '''matched against word "clone"
1426 > '''
1426 > '''
1427 > EOF
1427 > EOF
1428 $ echo '[extensions]' >> $HGRCPATH
1428 $ echo '[extensions]' >> $HGRCPATH
1429 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
1429 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
1430 $ hg help -k clone
1430 $ hg help -k clone
1431 Topics:
1431 Topics:
1432
1432
1433 config Configuration Files
1433 config Configuration Files
1434 extensions Using Additional Features
1434 extensions Using Additional Features
1435 glossary Glossary
1435 glossary Glossary
1436 phases Working with Phases
1436 phases Working with Phases
1437 subrepos Subrepositories
1437 subrepos Subrepositories
1438 urls URL Paths
1438 urls URL Paths
1439
1439
1440 Commands:
1440 Commands:
1441
1441
1442 bookmarks create a new bookmark or list existing bookmarks
1442 bookmarks create a new bookmark or list existing bookmarks
1443 clone make a copy of an existing repository
1443 clone make a copy of an existing repository
1444 paths show aliases for remote repositories
1444 paths show aliases for remote repositories
1445 update update working directory (or switch revisions)
1445 update update working directory (or switch revisions)
1446
1446
1447 Extensions:
1447 Extensions:
1448
1448
1449 clonebundles advertise pre-generated bundles to seed clones
1449 clonebundles advertise pre-generated bundles to seed clones
1450 prefixedname matched against word "clone"
1450 prefixedname matched against word "clone"
1451 relink recreates hardlinks between repository clones
1451 relink recreates hardlinks between repository clones
1452
1452
1453 Extension Commands:
1453 Extension Commands:
1454
1454
1455 qclone clone main and patch repository at same time
1455 qclone clone main and patch repository at same time
1456
1456
1457 Test unfound topic
1457 Test unfound topic
1458
1458
1459 $ hg help nonexistingtopicthatwillneverexisteverever
1459 $ hg help nonexistingtopicthatwillneverexisteverever
1460 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
1460 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
1461 (try 'hg help --keyword nonexistingtopicthatwillneverexisteverever')
1461 (try 'hg help --keyword nonexistingtopicthatwillneverexisteverever')
1462 [255]
1462 [255]
1463
1463
1464 Test unfound keyword
1464 Test unfound keyword
1465
1465
1466 $ hg help --keyword nonexistingwordthatwillneverexisteverever
1466 $ hg help --keyword nonexistingwordthatwillneverexisteverever
1467 abort: no matches
1467 abort: no matches
1468 (try 'hg help' for a list of topics)
1468 (try 'hg help' for a list of topics)
1469 [255]
1469 [255]
1470
1470
1471 Test omit indicating for help
1471 Test omit indicating for help
1472
1472
1473 $ cat > addverboseitems.py <<EOF
1473 $ cat > addverboseitems.py <<EOF
1474 > '''extension to test omit indicating.
1474 > '''extension to test omit indicating.
1475 >
1475 >
1476 > This paragraph is never omitted (for extension)
1476 > This paragraph is never omitted (for extension)
1477 >
1477 >
1478 > .. container:: verbose
1478 > .. container:: verbose
1479 >
1479 >
1480 > This paragraph is omitted,
1480 > This paragraph is omitted,
1481 > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension)
1481 > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension)
1482 >
1482 >
1483 > This paragraph is never omitted, too (for extension)
1483 > This paragraph is never omitted, too (for extension)
1484 > '''
1484 > '''
1485 >
1485 >
1486 > from mercurial import help, commands
1486 > from mercurial import help, commands
1487 > testtopic = """This paragraph is never omitted (for topic).
1487 > testtopic = """This paragraph is never omitted (for topic).
1488 >
1488 >
1489 > .. container:: verbose
1489 > .. container:: verbose
1490 >
1490 >
1491 > This paragraph is omitted,
1491 > This paragraph is omitted,
1492 > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic)
1492 > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic)
1493 >
1493 >
1494 > This paragraph is never omitted, too (for topic)
1494 > This paragraph is never omitted, too (for topic)
1495 > """
1495 > """
1496 > def extsetup(ui):
1496 > def extsetup(ui):
1497 > help.helptable.append((["topic-containing-verbose"],
1497 > help.helptable.append((["topic-containing-verbose"],
1498 > "This is the topic to test omit indicating.",
1498 > "This is the topic to test omit indicating.",
1499 > lambda ui: testtopic))
1499 > lambda ui: testtopic))
1500 > EOF
1500 > EOF
1501 $ echo '[extensions]' >> $HGRCPATH
1501 $ echo '[extensions]' >> $HGRCPATH
1502 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1502 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1503 $ hg help addverboseitems
1503 $ hg help addverboseitems
1504 addverboseitems extension - extension to test omit indicating.
1504 addverboseitems extension - extension to test omit indicating.
1505
1505
1506 This paragraph is never omitted (for extension)
1506 This paragraph is never omitted (for extension)
1507
1507
1508 This paragraph is never omitted, too (for extension)
1508 This paragraph is never omitted, too (for extension)
1509
1509
1510 (some details hidden, use --verbose to show complete help)
1510 (some details hidden, use --verbose to show complete help)
1511
1511
1512 no commands defined
1512 no commands defined
1513 $ hg help -v addverboseitems
1513 $ hg help -v addverboseitems
1514 addverboseitems extension - extension to test omit indicating.
1514 addverboseitems extension - extension to test omit indicating.
1515
1515
1516 This paragraph is never omitted (for extension)
1516 This paragraph is never omitted (for extension)
1517
1517
1518 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1518 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1519 extension)
1519 extension)
1520
1520
1521 This paragraph is never omitted, too (for extension)
1521 This paragraph is never omitted, too (for extension)
1522
1522
1523 no commands defined
1523 no commands defined
1524 $ hg help topic-containing-verbose
1524 $ hg help topic-containing-verbose
1525 This is the topic to test omit indicating.
1525 This is the topic to test omit indicating.
1526 """"""""""""""""""""""""""""""""""""""""""
1526 """"""""""""""""""""""""""""""""""""""""""
1527
1527
1528 This paragraph is never omitted (for topic).
1528 This paragraph is never omitted (for topic).
1529
1529
1530 This paragraph is never omitted, too (for topic)
1530 This paragraph is never omitted, too (for topic)
1531
1531
1532 (some details hidden, use --verbose to show complete help)
1532 (some details hidden, use --verbose to show complete help)
1533 $ hg help -v topic-containing-verbose
1533 $ hg help -v topic-containing-verbose
1534 This is the topic to test omit indicating.
1534 This is the topic to test omit indicating.
1535 """"""""""""""""""""""""""""""""""""""""""
1535 """"""""""""""""""""""""""""""""""""""""""
1536
1536
1537 This paragraph is never omitted (for topic).
1537 This paragraph is never omitted (for topic).
1538
1538
1539 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1539 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1540 topic)
1540 topic)
1541
1541
1542 This paragraph is never omitted, too (for topic)
1542 This paragraph is never omitted, too (for topic)
1543
1543
1544 Test section lookup
1544 Test section lookup
1545
1545
1546 $ hg help revset.merge
1546 $ hg help revset.merge
1547 "merge()"
1547 "merge()"
1548 Changeset is a merge changeset.
1548 Changeset is a merge changeset.
1549
1549
1550 $ hg help glossary.dag
1550 $ hg help glossary.dag
1551 DAG
1551 DAG
1552 The repository of changesets of a distributed version control system
1552 The repository of changesets of a distributed version control system
1553 (DVCS) can be described as a directed acyclic graph (DAG), consisting
1553 (DVCS) can be described as a directed acyclic graph (DAG), consisting
1554 of nodes and edges, where nodes correspond to changesets and edges
1554 of nodes and edges, where nodes correspond to changesets and edges
1555 imply a parent -> child relation. This graph can be visualized by
1555 imply a parent -> child relation. This graph can be visualized by
1556 graphical tools such as 'hg log --graph'. In Mercurial, the DAG is
1556 graphical tools such as 'hg log --graph'. In Mercurial, the DAG is
1557 limited by the requirement for children to have at most two parents.
1557 limited by the requirement for children to have at most two parents.
1558
1558
1559
1559
1560 $ hg help hgrc.paths
1560 $ hg help hgrc.paths
1561 "paths"
1561 "paths"
1562 -------
1562 -------
1563
1563
1564 Assigns symbolic names and behavior to repositories.
1564 Assigns symbolic names and behavior to repositories.
1565
1565
1566 Options are symbolic names defining the URL or directory that is the
1566 Options are symbolic names defining the URL or directory that is the
1567 location of the repository. Example:
1567 location of the repository. Example:
1568
1568
1569 [paths]
1569 [paths]
1570 my_server = https://example.com/my_repo
1570 my_server = https://example.com/my_repo
1571 local_path = /home/me/repo
1571 local_path = /home/me/repo
1572
1572
1573 These symbolic names can be used from the command line. To pull from
1573 These symbolic names can be used from the command line. To pull from
1574 "my_server": 'hg pull my_server'. To push to "local_path": 'hg push
1574 "my_server": 'hg pull my_server'. To push to "local_path": 'hg push
1575 local_path'.
1575 local_path'.
1576
1576
1577 Options containing colons (":") denote sub-options that can influence
1577 Options containing colons (":") denote sub-options that can influence
1578 behavior for that specific path. Example:
1578 behavior for that specific path. Example:
1579
1579
1580 [paths]
1580 [paths]
1581 my_server = https://example.com/my_path
1581 my_server = https://example.com/my_path
1582 my_server:pushurl = ssh://example.com/my_path
1582 my_server:pushurl = ssh://example.com/my_path
1583
1583
1584 The following sub-options can be defined:
1584 The following sub-options can be defined:
1585
1585
1586 "pushurl"
1586 "pushurl"
1587 The URL to use for push operations. If not defined, the location
1587 The URL to use for push operations. If not defined, the location
1588 defined by the path's main entry is used.
1588 defined by the path's main entry is used.
1589
1589
1590 "pushrev"
1590 "pushrev"
1591 A revset defining which revisions to push by default.
1591 A revset defining which revisions to push by default.
1592
1592
1593 When 'hg push' is executed without a "-r" argument, the revset defined
1593 When 'hg push' is executed without a "-r" argument, the revset defined
1594 by this sub-option is evaluated to determine what to push.
1594 by this sub-option is evaluated to determine what to push.
1595
1595
1596 For example, a value of "." will push the working directory's revision
1596 For example, a value of "." will push the working directory's revision
1597 by default.
1597 by default.
1598
1598
1599 Revsets specifying bookmarks will not result in the bookmark being
1599 Revsets specifying bookmarks will not result in the bookmark being
1600 pushed.
1600 pushed.
1601
1601
1602 The following special named paths exist:
1602 The following special named paths exist:
1603
1603
1604 "default"
1604 "default"
1605 The URL or directory to use when no source or remote is specified.
1605 The URL or directory to use when no source or remote is specified.
1606
1606
1607 'hg clone' will automatically define this path to the location the
1607 'hg clone' will automatically define this path to the location the
1608 repository was cloned from.
1608 repository was cloned from.
1609
1609
1610 "default-push"
1610 "default-push"
1611 (deprecated) The URL or directory for the default 'hg push' location.
1611 (deprecated) The URL or directory for the default 'hg push' location.
1612 "default:pushurl" should be used instead.
1612 "default:pushurl" should be used instead.
1613
1613
1614 $ hg help glossary.mcguffin
1614 $ hg help glossary.mcguffin
1615 abort: help section not found: glossary.mcguffin
1615 abort: help section not found: glossary.mcguffin
1616 [255]
1616 [255]
1617
1617
1618 $ hg help glossary.mc.guffin
1618 $ hg help glossary.mc.guffin
1619 abort: help section not found: glossary.mc.guffin
1619 abort: help section not found: glossary.mc.guffin
1620 [255]
1620 [255]
1621
1621
1622 $ hg help template.files
1622 $ hg help template.files
1623 files List of strings. All files modified, added, or removed by
1623 files List of strings. All files modified, added, or removed by
1624 this changeset.
1624 this changeset.
1625 files(pattern)
1625 files(pattern)
1626 All files of the current changeset matching the pattern. See
1626 All files of the current changeset matching the pattern. See
1627 'hg help patterns'.
1627 'hg help patterns'.
1628
1628
1629 Test section lookup by translated message
1629 Test section lookup by translated message
1630
1630
1631 str.lower() instead of encoding.lower(str) on translated message might
1631 str.lower() instead of encoding.lower(str) on translated message might
1632 make message meaningless, because some encoding uses 0x41(A) - 0x5a(Z)
1632 make message meaningless, because some encoding uses 0x41(A) - 0x5a(Z)
1633 as the second or later byte of multi-byte character.
1633 as the second or later byte of multi-byte character.
1634
1634
1635 For example, "\x8bL\x98^" (translation of "record" in ja_JP.cp932)
1635 For example, "\x8bL\x98^" (translation of "record" in ja_JP.cp932)
1636 contains 0x4c (L). str.lower() replaces 0x4c(L) by 0x6c(l) and this
1636 contains 0x4c (L). str.lower() replaces 0x4c(L) by 0x6c(l) and this
1637 replacement makes message meaningless.
1637 replacement makes message meaningless.
1638
1638
1639 This tests that section lookup by translated string isn't broken by
1639 This tests that section lookup by translated string isn't broken by
1640 such str.lower().
1640 such str.lower().
1641
1641
1642 $ python <<EOF
1642 $ python <<EOF
1643 > def escape(s):
1643 > def escape(s):
1644 > return ''.join('\u%x' % ord(uc) for uc in s.decode('cp932'))
1644 > return ''.join('\u%x' % ord(uc) for uc in s.decode('cp932'))
1645 > # translation of "record" in ja_JP.cp932
1645 > # translation of "record" in ja_JP.cp932
1646 > upper = "\x8bL\x98^"
1646 > upper = "\x8bL\x98^"
1647 > # str.lower()-ed section name should be treated as different one
1647 > # str.lower()-ed section name should be treated as different one
1648 > lower = "\x8bl\x98^"
1648 > lower = "\x8bl\x98^"
1649 > with open('ambiguous.py', 'w') as fp:
1649 > with open('ambiguous.py', 'w') as fp:
1650 > fp.write("""# ambiguous section names in ja_JP.cp932
1650 > fp.write("""# ambiguous section names in ja_JP.cp932
1651 > u'''summary of extension
1651 > u'''summary of extension
1652 >
1652 >
1653 > %s
1653 > %s
1654 > ----
1654 > ----
1655 >
1655 >
1656 > Upper name should show only this message
1656 > Upper name should show only this message
1657 >
1657 >
1658 > %s
1658 > %s
1659 > ----
1659 > ----
1660 >
1660 >
1661 > Lower name should show only this message
1661 > Lower name should show only this message
1662 >
1662 >
1663 > subsequent section
1663 > subsequent section
1664 > ------------------
1664 > ------------------
1665 >
1665 >
1666 > This should be hidden at 'hg help ambiguous' with section name.
1666 > This should be hidden at 'hg help ambiguous' with section name.
1667 > '''
1667 > '''
1668 > """ % (escape(upper), escape(lower)))
1668 > """ % (escape(upper), escape(lower)))
1669 > EOF
1669 > EOF
1670
1670
1671 $ cat >> $HGRCPATH <<EOF
1671 $ cat >> $HGRCPATH <<EOF
1672 > [extensions]
1672 > [extensions]
1673 > ambiguous = ./ambiguous.py
1673 > ambiguous = ./ambiguous.py
1674 > EOF
1674 > EOF
1675
1675
1676 $ python <<EOF | sh
1676 $ python <<EOF | sh
1677 > upper = "\x8bL\x98^"
1677 > upper = "\x8bL\x98^"
1678 > print "hg --encoding cp932 help -e ambiguous.%s" % upper
1678 > print "hg --encoding cp932 help -e ambiguous.%s" % upper
1679 > EOF
1679 > EOF
1680 \x8bL\x98^ (esc)
1680 \x8bL\x98^ (esc)
1681 ----
1681 ----
1682
1682
1683 Upper name should show only this message
1683 Upper name should show only this message
1684
1684
1685
1685
1686 $ python <<EOF | sh
1686 $ python <<EOF | sh
1687 > lower = "\x8bl\x98^"
1687 > lower = "\x8bl\x98^"
1688 > print "hg --encoding cp932 help -e ambiguous.%s" % lower
1688 > print "hg --encoding cp932 help -e ambiguous.%s" % lower
1689 > EOF
1689 > EOF
1690 \x8bl\x98^ (esc)
1690 \x8bl\x98^ (esc)
1691 ----
1691 ----
1692
1692
1693 Lower name should show only this message
1693 Lower name should show only this message
1694
1694
1695
1695
1696 $ cat >> $HGRCPATH <<EOF
1696 $ cat >> $HGRCPATH <<EOF
1697 > [extensions]
1697 > [extensions]
1698 > ambiguous = !
1698 > ambiguous = !
1699 > EOF
1699 > EOF
1700
1700
1701 Show help content of disabled extensions
1701 Show help content of disabled extensions
1702
1702
1703 $ cat >> $HGRCPATH <<EOF
1703 $ cat >> $HGRCPATH <<EOF
1704 > [extensions]
1704 > [extensions]
1705 > ambiguous = !./ambiguous.py
1705 > ambiguous = !./ambiguous.py
1706 > EOF
1706 > EOF
1707 $ hg help -e ambiguous
1707 $ hg help -e ambiguous
1708 ambiguous extension - (no help text available)
1708 ambiguous extension - (no help text available)
1709
1709
1710 (use 'hg help extensions' for information on enabling extensions)
1710 (use 'hg help extensions' for information on enabling extensions)
1711
1711
1712 Test dynamic list of merge tools only shows up once
1712 Test dynamic list of merge tools only shows up once
1713 $ hg help merge-tools
1713 $ hg help merge-tools
1714 Merge Tools
1714 Merge Tools
1715 """""""""""
1715 """""""""""
1716
1716
1717 To merge files Mercurial uses merge tools.
1717 To merge files Mercurial uses merge tools.
1718
1718
1719 A merge tool combines two different versions of a file into a merged file.
1719 A merge tool combines two different versions of a file into a merged file.
1720 Merge tools are given the two files and the greatest common ancestor of
1720 Merge tools are given the two files and the greatest common ancestor of
1721 the two file versions, so they can determine the changes made on both
1721 the two file versions, so they can determine the changes made on both
1722 branches.
1722 branches.
1723
1723
1724 Merge tools are used both for 'hg resolve', 'hg merge', 'hg update', 'hg
1724 Merge tools are used both for 'hg resolve', 'hg merge', 'hg update', 'hg
1725 backout' and in several extensions.
1725 backout' and in several extensions.
1726
1726
1727 Usually, the merge tool tries to automatically reconcile the files by
1727 Usually, the merge tool tries to automatically reconcile the files by
1728 combining all non-overlapping changes that occurred separately in the two
1728 combining all non-overlapping changes that occurred separately in the two
1729 different evolutions of the same initial base file. Furthermore, some
1729 different evolutions of the same initial base file. Furthermore, some
1730 interactive merge programs make it easier to manually resolve conflicting
1730 interactive merge programs make it easier to manually resolve conflicting
1731 merges, either in a graphical way, or by inserting some conflict markers.
1731 merges, either in a graphical way, or by inserting some conflict markers.
1732 Mercurial does not include any interactive merge programs but relies on
1732 Mercurial does not include any interactive merge programs but relies on
1733 external tools for that.
1733 external tools for that.
1734
1734
1735 Available merge tools
1735 Available merge tools
1736 =====================
1736 =====================
1737
1737
1738 External merge tools and their properties are configured in the merge-
1738 External merge tools and their properties are configured in the merge-
1739 tools configuration section - see hgrc(5) - but they can often just be
1739 tools configuration section - see hgrc(5) - but they can often just be
1740 named by their executable.
1740 named by their executable.
1741
1741
1742 A merge tool is generally usable if its executable can be found on the
1742 A merge tool is generally usable if its executable can be found on the
1743 system and if it can handle the merge. The executable is found if it is an
1743 system and if it can handle the merge. The executable is found if it is an
1744 absolute or relative executable path or the name of an application in the
1744 absolute or relative executable path or the name of an application in the
1745 executable search path. The tool is assumed to be able to handle the merge
1745 executable search path. The tool is assumed to be able to handle the merge
1746 if it can handle symlinks if the file is a symlink, if it can handle
1746 if it can handle symlinks if the file is a symlink, if it can handle
1747 binary files if the file is binary, and if a GUI is available if the tool
1747 binary files if the file is binary, and if a GUI is available if the tool
1748 requires a GUI.
1748 requires a GUI.
1749
1749
1750 There are some internal merge tools which can be used. The internal merge
1750 There are some internal merge tools which can be used. The internal merge
1751 tools are:
1751 tools are:
1752
1752
1753 ":dump"
1753 ":dump"
1754 Creates three versions of the files to merge, containing the contents of
1754 Creates three versions of the files to merge, containing the contents of
1755 local, other and base. These files can then be used to perform a merge
1755 local, other and base. These files can then be used to perform a merge
1756 manually. If the file to be merged is named "a.txt", these files will
1756 manually. If the file to be merged is named "a.txt", these files will
1757 accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and
1757 accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and
1758 they will be placed in the same directory as "a.txt".
1758 they will be placed in the same directory as "a.txt".
1759
1759
1760 ":fail"
1760 ":fail"
1761 Rather than attempting to merge files that were modified on both
1761 Rather than attempting to merge files that were modified on both
1762 branches, it marks them as unresolved. The resolve command must be used
1762 branches, it marks them as unresolved. The resolve command must be used
1763 to resolve these conflicts.
1763 to resolve these conflicts.
1764
1764
1765 ":local"
1765 ":local"
1766 Uses the local 'p1()' version of files as the merged version.
1766 Uses the local 'p1()' version of files as the merged version.
1767
1767
1768 ":merge"
1768 ":merge"
1769 Uses the internal non-interactive simple merge algorithm for merging
1769 Uses the internal non-interactive simple merge algorithm for merging
1770 files. It will fail if there are any conflicts and leave markers in the
1770 files. It will fail if there are any conflicts and leave markers in the
1771 partially merged file. Markers will have two sections, one for each side
1771 partially merged file. Markers will have two sections, one for each side
1772 of merge.
1772 of merge.
1773
1773
1774 ":merge-local"
1774 ":merge-local"
1775 Like :merge, but resolve all conflicts non-interactively in favor of the
1775 Like :merge, but resolve all conflicts non-interactively in favor of the
1776 local 'p1()' changes.
1776 local 'p1()' changes.
1777
1777
1778 ":merge-other"
1778 ":merge-other"
1779 Like :merge, but resolve all conflicts non-interactively in favor of the
1779 Like :merge, but resolve all conflicts non-interactively in favor of the
1780 other 'p2()' changes.
1780 other 'p2()' changes.
1781
1781
1782 ":merge3"
1782 ":merge3"
1783 Uses the internal non-interactive simple merge algorithm for merging
1783 Uses the internal non-interactive simple merge algorithm for merging
1784 files. It will fail if there are any conflicts and leave markers in the
1784 files. It will fail if there are any conflicts and leave markers in the
1785 partially merged file. Marker will have three sections, one from each
1785 partially merged file. Marker will have three sections, one from each
1786 side of the merge and one for the base content.
1786 side of the merge and one for the base content.
1787
1787
1788 ":other"
1788 ":other"
1789 Uses the other 'p2()' version of files as the merged version.
1789 Uses the other 'p2()' version of files as the merged version.
1790
1790
1791 ":prompt"
1791 ":prompt"
1792 Asks the user which of the local 'p1()' or the other 'p2()' version to
1792 Asks the user which of the local 'p1()' or the other 'p2()' version to
1793 keep as the merged version.
1793 keep as the merged version.
1794
1794
1795 ":tagmerge"
1795 ":tagmerge"
1796 Uses the internal tag merge algorithm (experimental).
1796 Uses the internal tag merge algorithm (experimental).
1797
1797
1798 ":union"
1798 ":union"
1799 Uses the internal non-interactive simple merge algorithm for merging
1799 Uses the internal non-interactive simple merge algorithm for merging
1800 files. It will use both left and right sides for conflict regions. No
1800 files. It will use both left and right sides for conflict regions. No
1801 markers are inserted.
1801 markers are inserted.
1802
1802
1803 Internal tools are always available and do not require a GUI but will by
1803 Internal tools are always available and do not require a GUI but will by
1804 default not handle symlinks or binary files.
1804 default not handle symlinks or binary files.
1805
1805
1806 Choosing a merge tool
1806 Choosing a merge tool
1807 =====================
1807 =====================
1808
1808
1809 Mercurial uses these rules when deciding which merge tool to use:
1809 Mercurial uses these rules when deciding which merge tool to use:
1810
1810
1811 1. If a tool has been specified with the --tool option to merge or
1811 1. If a tool has been specified with the --tool option to merge or
1812 resolve, it is used. If it is the name of a tool in the merge-tools
1812 resolve, it is used. If it is the name of a tool in the merge-tools
1813 configuration, its configuration is used. Otherwise the specified tool
1813 configuration, its configuration is used. Otherwise the specified tool
1814 must be executable by the shell.
1814 must be executable by the shell.
1815 2. If the "HGMERGE" environment variable is present, its value is used and
1815 2. If the "HGMERGE" environment variable is present, its value is used and
1816 must be executable by the shell.
1816 must be executable by the shell.
1817 3. If the filename of the file to be merged matches any of the patterns in
1817 3. If the filename of the file to be merged matches any of the patterns in
1818 the merge-patterns configuration section, the first usable merge tool
1818 the merge-patterns configuration section, the first usable merge tool
1819 corresponding to a matching pattern is used. Here, binary capabilities
1819 corresponding to a matching pattern is used. Here, binary capabilities
1820 of the merge tool are not considered.
1820 of the merge tool are not considered.
1821 4. If ui.merge is set it will be considered next. If the value is not the
1821 4. If ui.merge is set it will be considered next. If the value is not the
1822 name of a configured tool, the specified value is used and must be
1822 name of a configured tool, the specified value is used and must be
1823 executable by the shell. Otherwise the named tool is used if it is
1823 executable by the shell. Otherwise the named tool is used if it is
1824 usable.
1824 usable.
1825 5. If any usable merge tools are present in the merge-tools configuration
1825 5. If any usable merge tools are present in the merge-tools configuration
1826 section, the one with the highest priority is used.
1826 section, the one with the highest priority is used.
1827 6. If a program named "hgmerge" can be found on the system, it is used -
1827 6. If a program named "hgmerge" can be found on the system, it is used -
1828 but it will by default not be used for symlinks and binary files.
1828 but it will by default not be used for symlinks and binary files.
1829 7. If the file to be merged is not binary and is not a symlink, then
1829 7. If the file to be merged is not binary and is not a symlink, then
1830 internal ":merge" is used.
1830 internal ":merge" is used.
1831 8. The merge of the file fails and must be resolved before commit.
1831 8. The merge of the file fails and must be resolved before commit.
1832
1832
1833 Note:
1833 Note:
1834 After selecting a merge program, Mercurial will by default attempt to
1834 After selecting a merge program, Mercurial will by default attempt to
1835 merge the files using a simple merge algorithm first. Only if it
1835 merge the files using a simple merge algorithm first. Only if it
1836 doesn't succeed because of conflicting changes Mercurial will actually
1836 doesn't succeed because of conflicting changes Mercurial will actually
1837 execute the merge program. Whether to use the simple merge algorithm
1837 execute the merge program. Whether to use the simple merge algorithm
1838 first can be controlled by the premerge setting of the merge tool.
1838 first can be controlled by the premerge setting of the merge tool.
1839 Premerge is enabled by default unless the file is binary or a symlink.
1839 Premerge is enabled by default unless the file is binary or a symlink.
1840
1840
1841 See the merge-tools and ui sections of hgrc(5) for details on the
1841 See the merge-tools and ui sections of hgrc(5) for details on the
1842 configuration of merge tools.
1842 configuration of merge tools.
1843
1843
1844 Compression engines listed in `hg help bundlespec`
1844 Compression engines listed in `hg help bundlespec`
1845
1845
1846 $ hg help bundlespec | grep gzip
1846 $ hg help bundlespec | grep gzip
1847 "v1" bundles can only use the "gzip", "bzip2", and "none" compression
1847 "v1" bundles can only use the "gzip", "bzip2", and "none" compression
1848 An algorithm that produces smaller bundles than "gzip".
1848 An algorithm that produces smaller bundles than "gzip".
1849 This engine will likely produce smaller bundles than "gzip" but will be
1849 This engine will likely produce smaller bundles than "gzip" but will be
1850 "gzip"
1850 "gzip"
1851 better compression than "gzip". It also frequently yields better
1851 better compression than "gzip". It also frequently yields better
1852
1852
1853 Test usage of section marks in help documents
1853 Test usage of section marks in help documents
1854
1854
1855 $ cd "$TESTDIR"/../doc
1855 $ cd "$TESTDIR"/../doc
1856 $ python check-seclevel.py
1856 $ python check-seclevel.py
1857 $ cd $TESTTMP
1857 $ cd $TESTTMP
1858
1858
1859 #if serve
1859 #if serve
1860
1860
1861 Test the help pages in hgweb.
1861 Test the help pages in hgweb.
1862
1862
1863 Dish up an empty repo; serve it cold.
1863 Dish up an empty repo; serve it cold.
1864
1864
1865 $ hg init "$TESTTMP/test"
1865 $ hg init "$TESTTMP/test"
1866 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
1866 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
1867 $ cat hg.pid >> $DAEMON_PIDS
1867 $ cat hg.pid >> $DAEMON_PIDS
1868
1868
1869 $ get-with-headers.py $LOCALIP:$HGPORT "help"
1869 $ get-with-headers.py $LOCALIP:$HGPORT "help"
1870 200 Script output follows
1870 200 Script output follows
1871
1871
1872 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1872 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1873 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1873 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1874 <head>
1874 <head>
1875 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1875 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1876 <meta name="robots" content="index, nofollow" />
1876 <meta name="robots" content="index, nofollow" />
1877 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1877 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1878 <script type="text/javascript" src="/static/mercurial.js"></script>
1878 <script type="text/javascript" src="/static/mercurial.js"></script>
1879
1879
1880 <title>Help: Index</title>
1880 <title>Help: Index</title>
1881 </head>
1881 </head>
1882 <body>
1882 <body>
1883
1883
1884 <div class="container">
1884 <div class="container">
1885 <div class="menu">
1885 <div class="menu">
1886 <div class="logo">
1886 <div class="logo">
1887 <a href="https://mercurial-scm.org/">
1887 <a href="https://mercurial-scm.org/">
1888 <img src="/static/hglogo.png" alt="mercurial" /></a>
1888 <img src="/static/hglogo.png" alt="mercurial" /></a>
1889 </div>
1889 </div>
1890 <ul>
1890 <ul>
1891 <li><a href="/shortlog">log</a></li>
1891 <li><a href="/shortlog">log</a></li>
1892 <li><a href="/graph">graph</a></li>
1892 <li><a href="/graph">graph</a></li>
1893 <li><a href="/tags">tags</a></li>
1893 <li><a href="/tags">tags</a></li>
1894 <li><a href="/bookmarks">bookmarks</a></li>
1894 <li><a href="/bookmarks">bookmarks</a></li>
1895 <li><a href="/branches">branches</a></li>
1895 <li><a href="/branches">branches</a></li>
1896 </ul>
1896 </ul>
1897 <ul>
1897 <ul>
1898 <li class="active">help</li>
1898 <li class="active">help</li>
1899 </ul>
1899 </ul>
1900 </div>
1900 </div>
1901
1901
1902 <div class="main">
1902 <div class="main">
1903 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1903 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1904 <form class="search" action="/log">
1904 <form class="search" action="/log">
1905
1905
1906 <p><input name="rev" id="search1" type="text" size="30" /></p>
1906 <p><input name="rev" id="search1" type="text" size="30" /></p>
1907 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1907 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1908 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1908 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1909 </form>
1909 </form>
1910 <table class="bigtable">
1910 <table class="bigtable">
1911 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
1911 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
1912
1912
1913 <tr><td>
1913 <tr><td>
1914 <a href="/help/bundlespec">
1914 <a href="/help/bundlespec">
1915 bundlespec
1915 bundlespec
1916 </a>
1916 </a>
1917 </td><td>
1917 </td><td>
1918 Bundle File Formats
1918 Bundle File Formats
1919 </td></tr>
1919 </td></tr>
1920 <tr><td>
1920 <tr><td>
1921 <a href="/help/color">
1921 <a href="/help/color">
1922 color
1922 color
1923 </a>
1923 </a>
1924 </td><td>
1924 </td><td>
1925 Colorizing Outputs
1925 Colorizing Outputs
1926 </td></tr>
1926 </td></tr>
1927 <tr><td>
1927 <tr><td>
1928 <a href="/help/config">
1928 <a href="/help/config">
1929 config
1929 config
1930 </a>
1930 </a>
1931 </td><td>
1931 </td><td>
1932 Configuration Files
1932 Configuration Files
1933 </td></tr>
1933 </td></tr>
1934 <tr><td>
1934 <tr><td>
1935 <a href="/help/dates">
1935 <a href="/help/dates">
1936 dates
1936 dates
1937 </a>
1937 </a>
1938 </td><td>
1938 </td><td>
1939 Date Formats
1939 Date Formats
1940 </td></tr>
1940 </td></tr>
1941 <tr><td>
1941 <tr><td>
1942 <a href="/help/diffs">
1942 <a href="/help/diffs">
1943 diffs
1943 diffs
1944 </a>
1944 </a>
1945 </td><td>
1945 </td><td>
1946 Diff Formats
1946 Diff Formats
1947 </td></tr>
1947 </td></tr>
1948 <tr><td>
1948 <tr><td>
1949 <a href="/help/environment">
1949 <a href="/help/environment">
1950 environment
1950 environment
1951 </a>
1951 </a>
1952 </td><td>
1952 </td><td>
1953 Environment Variables
1953 Environment Variables
1954 </td></tr>
1954 </td></tr>
1955 <tr><td>
1955 <tr><td>
1956 <a href="/help/extensions">
1956 <a href="/help/extensions">
1957 extensions
1957 extensions
1958 </a>
1958 </a>
1959 </td><td>
1959 </td><td>
1960 Using Additional Features
1960 Using Additional Features
1961 </td></tr>
1961 </td></tr>
1962 <tr><td>
1962 <tr><td>
1963 <a href="/help/filesets">
1963 <a href="/help/filesets">
1964 filesets
1964 filesets
1965 </a>
1965 </a>
1966 </td><td>
1966 </td><td>
1967 Specifying File Sets
1967 Specifying File Sets
1968 </td></tr>
1968 </td></tr>
1969 <tr><td>
1969 <tr><td>
1970 <a href="/help/glossary">
1970 <a href="/help/glossary">
1971 glossary
1971 glossary
1972 </a>
1972 </a>
1973 </td><td>
1973 </td><td>
1974 Glossary
1974 Glossary
1975 </td></tr>
1975 </td></tr>
1976 <tr><td>
1976 <tr><td>
1977 <a href="/help/hgignore">
1977 <a href="/help/hgignore">
1978 hgignore
1978 hgignore
1979 </a>
1979 </a>
1980 </td><td>
1980 </td><td>
1981 Syntax for Mercurial Ignore Files
1981 Syntax for Mercurial Ignore Files
1982 </td></tr>
1982 </td></tr>
1983 <tr><td>
1983 <tr><td>
1984 <a href="/help/hgweb">
1984 <a href="/help/hgweb">
1985 hgweb
1985 hgweb
1986 </a>
1986 </a>
1987 </td><td>
1987 </td><td>
1988 Configuring hgweb
1988 Configuring hgweb
1989 </td></tr>
1989 </td></tr>
1990 <tr><td>
1990 <tr><td>
1991 <a href="/help/internals">
1991 <a href="/help/internals">
1992 internals
1992 internals
1993 </a>
1993 </a>
1994 </td><td>
1994 </td><td>
1995 Technical implementation topics
1995 Technical implementation topics
1996 </td></tr>
1996 </td></tr>
1997 <tr><td>
1997 <tr><td>
1998 <a href="/help/merge-tools">
1998 <a href="/help/merge-tools">
1999 merge-tools
1999 merge-tools
2000 </a>
2000 </a>
2001 </td><td>
2001 </td><td>
2002 Merge Tools
2002 Merge Tools
2003 </td></tr>
2003 </td></tr>
2004 <tr><td>
2004 <tr><td>
2005 <a href="/help/pager">
2005 <a href="/help/pager">
2006 pager
2006 pager
2007 </a>
2007 </a>
2008 </td><td>
2008 </td><td>
2009 Pager Support
2009 Pager Support
2010 </td></tr>
2010 </td></tr>
2011 <tr><td>
2011 <tr><td>
2012 <a href="/help/patterns">
2012 <a href="/help/patterns">
2013 patterns
2013 patterns
2014 </a>
2014 </a>
2015 </td><td>
2015 </td><td>
2016 File Name Patterns
2016 File Name Patterns
2017 </td></tr>
2017 </td></tr>
2018 <tr><td>
2018 <tr><td>
2019 <a href="/help/phases">
2019 <a href="/help/phases">
2020 phases
2020 phases
2021 </a>
2021 </a>
2022 </td><td>
2022 </td><td>
2023 Working with Phases
2023 Working with Phases
2024 </td></tr>
2024 </td></tr>
2025 <tr><td>
2025 <tr><td>
2026 <a href="/help/revisions">
2026 <a href="/help/revisions">
2027 revisions
2027 revisions
2028 </a>
2028 </a>
2029 </td><td>
2029 </td><td>
2030 Specifying Revisions
2030 Specifying Revisions
2031 </td></tr>
2031 </td></tr>
2032 <tr><td>
2032 <tr><td>
2033 <a href="/help/scripting">
2033 <a href="/help/scripting">
2034 scripting
2034 scripting
2035 </a>
2035 </a>
2036 </td><td>
2036 </td><td>
2037 Using Mercurial from scripts and automation
2037 Using Mercurial from scripts and automation
2038 </td></tr>
2038 </td></tr>
2039 <tr><td>
2039 <tr><td>
2040 <a href="/help/subrepos">
2040 <a href="/help/subrepos">
2041 subrepos
2041 subrepos
2042 </a>
2042 </a>
2043 </td><td>
2043 </td><td>
2044 Subrepositories
2044 Subrepositories
2045 </td></tr>
2045 </td></tr>
2046 <tr><td>
2046 <tr><td>
2047 <a href="/help/templating">
2047 <a href="/help/templating">
2048 templating
2048 templating
2049 </a>
2049 </a>
2050 </td><td>
2050 </td><td>
2051 Template Usage
2051 Template Usage
2052 </td></tr>
2052 </td></tr>
2053 <tr><td>
2053 <tr><td>
2054 <a href="/help/urls">
2054 <a href="/help/urls">
2055 urls
2055 urls
2056 </a>
2056 </a>
2057 </td><td>
2057 </td><td>
2058 URL Paths
2058 URL Paths
2059 </td></tr>
2059 </td></tr>
2060 <tr><td>
2060 <tr><td>
2061 <a href="/help/topic-containing-verbose">
2061 <a href="/help/topic-containing-verbose">
2062 topic-containing-verbose
2062 topic-containing-verbose
2063 </a>
2063 </a>
2064 </td><td>
2064 </td><td>
2065 This is the topic to test omit indicating.
2065 This is the topic to test omit indicating.
2066 </td></tr>
2066 </td></tr>
2067
2067
2068
2068
2069 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
2069 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
2070
2070
2071 <tr><td>
2071 <tr><td>
2072 <a href="/help/add">
2072 <a href="/help/add">
2073 add
2073 add
2074 </a>
2074 </a>
2075 </td><td>
2075 </td><td>
2076 add the specified files on the next commit
2076 add the specified files on the next commit
2077 </td></tr>
2077 </td></tr>
2078 <tr><td>
2078 <tr><td>
2079 <a href="/help/annotate">
2079 <a href="/help/annotate">
2080 annotate
2080 annotate
2081 </a>
2081 </a>
2082 </td><td>
2082 </td><td>
2083 show changeset information by line for each file
2083 show changeset information by line for each file
2084 </td></tr>
2084 </td></tr>
2085 <tr><td>
2085 <tr><td>
2086 <a href="/help/clone">
2086 <a href="/help/clone">
2087 clone
2087 clone
2088 </a>
2088 </a>
2089 </td><td>
2089 </td><td>
2090 make a copy of an existing repository
2090 make a copy of an existing repository
2091 </td></tr>
2091 </td></tr>
2092 <tr><td>
2092 <tr><td>
2093 <a href="/help/commit">
2093 <a href="/help/commit">
2094 commit
2094 commit
2095 </a>
2095 </a>
2096 </td><td>
2096 </td><td>
2097 commit the specified files or all outstanding changes
2097 commit the specified files or all outstanding changes
2098 </td></tr>
2098 </td></tr>
2099 <tr><td>
2099 <tr><td>
2100 <a href="/help/diff">
2100 <a href="/help/diff">
2101 diff
2101 diff
2102 </a>
2102 </a>
2103 </td><td>
2103 </td><td>
2104 diff repository (or selected files)
2104 diff repository (or selected files)
2105 </td></tr>
2105 </td></tr>
2106 <tr><td>
2106 <tr><td>
2107 <a href="/help/export">
2107 <a href="/help/export">
2108 export
2108 export
2109 </a>
2109 </a>
2110 </td><td>
2110 </td><td>
2111 dump the header and diffs for one or more changesets
2111 dump the header and diffs for one or more changesets
2112 </td></tr>
2112 </td></tr>
2113 <tr><td>
2113 <tr><td>
2114 <a href="/help/forget">
2114 <a href="/help/forget">
2115 forget
2115 forget
2116 </a>
2116 </a>
2117 </td><td>
2117 </td><td>
2118 forget the specified files on the next commit
2118 forget the specified files on the next commit
2119 </td></tr>
2119 </td></tr>
2120 <tr><td>
2120 <tr><td>
2121 <a href="/help/init">
2121 <a href="/help/init">
2122 init
2122 init
2123 </a>
2123 </a>
2124 </td><td>
2124 </td><td>
2125 create a new repository in the given directory
2125 create a new repository in the given directory
2126 </td></tr>
2126 </td></tr>
2127 <tr><td>
2127 <tr><td>
2128 <a href="/help/log">
2128 <a href="/help/log">
2129 log
2129 log
2130 </a>
2130 </a>
2131 </td><td>
2131 </td><td>
2132 show revision history of entire repository or files
2132 show revision history of entire repository or files
2133 </td></tr>
2133 </td></tr>
2134 <tr><td>
2134 <tr><td>
2135 <a href="/help/merge">
2135 <a href="/help/merge">
2136 merge
2136 merge
2137 </a>
2137 </a>
2138 </td><td>
2138 </td><td>
2139 merge another revision into working directory
2139 merge another revision into working directory
2140 </td></tr>
2140 </td></tr>
2141 <tr><td>
2141 <tr><td>
2142 <a href="/help/pull">
2142 <a href="/help/pull">
2143 pull
2143 pull
2144 </a>
2144 </a>
2145 </td><td>
2145 </td><td>
2146 pull changes from the specified source
2146 pull changes from the specified source
2147 </td></tr>
2147 </td></tr>
2148 <tr><td>
2148 <tr><td>
2149 <a href="/help/push">
2149 <a href="/help/push">
2150 push
2150 push
2151 </a>
2151 </a>
2152 </td><td>
2152 </td><td>
2153 push changes to the specified destination
2153 push changes to the specified destination
2154 </td></tr>
2154 </td></tr>
2155 <tr><td>
2155 <tr><td>
2156 <a href="/help/remove">
2156 <a href="/help/remove">
2157 remove
2157 remove
2158 </a>
2158 </a>
2159 </td><td>
2159 </td><td>
2160 remove the specified files on the next commit
2160 remove the specified files on the next commit
2161 </td></tr>
2161 </td></tr>
2162 <tr><td>
2162 <tr><td>
2163 <a href="/help/serve">
2163 <a href="/help/serve">
2164 serve
2164 serve
2165 </a>
2165 </a>
2166 </td><td>
2166 </td><td>
2167 start stand-alone webserver
2167 start stand-alone webserver
2168 </td></tr>
2168 </td></tr>
2169 <tr><td>
2169 <tr><td>
2170 <a href="/help/status">
2170 <a href="/help/status">
2171 status
2171 status
2172 </a>
2172 </a>
2173 </td><td>
2173 </td><td>
2174 show changed files in the working directory
2174 show changed files in the working directory
2175 </td></tr>
2175 </td></tr>
2176 <tr><td>
2176 <tr><td>
2177 <a href="/help/summary">
2177 <a href="/help/summary">
2178 summary
2178 summary
2179 </a>
2179 </a>
2180 </td><td>
2180 </td><td>
2181 summarize working directory state
2181 summarize working directory state
2182 </td></tr>
2182 </td></tr>
2183 <tr><td>
2183 <tr><td>
2184 <a href="/help/update">
2184 <a href="/help/update">
2185 update
2185 update
2186 </a>
2186 </a>
2187 </td><td>
2187 </td><td>
2188 update working directory (or switch revisions)
2188 update working directory (or switch revisions)
2189 </td></tr>
2189 </td></tr>
2190
2190
2191
2191
2192
2192
2193 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
2193 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
2194
2194
2195 <tr><td>
2195 <tr><td>
2196 <a href="/help/addremove">
2196 <a href="/help/addremove">
2197 addremove
2197 addremove
2198 </a>
2198 </a>
2199 </td><td>
2199 </td><td>
2200 add all new files, delete all missing files
2200 add all new files, delete all missing files
2201 </td></tr>
2201 </td></tr>
2202 <tr><td>
2202 <tr><td>
2203 <a href="/help/archive">
2203 <a href="/help/archive">
2204 archive
2204 archive
2205 </a>
2205 </a>
2206 </td><td>
2206 </td><td>
2207 create an unversioned archive of a repository revision
2207 create an unversioned archive of a repository revision
2208 </td></tr>
2208 </td></tr>
2209 <tr><td>
2209 <tr><td>
2210 <a href="/help/backout">
2210 <a href="/help/backout">
2211 backout
2211 backout
2212 </a>
2212 </a>
2213 </td><td>
2213 </td><td>
2214 reverse effect of earlier changeset
2214 reverse effect of earlier changeset
2215 </td></tr>
2215 </td></tr>
2216 <tr><td>
2216 <tr><td>
2217 <a href="/help/bisect">
2217 <a href="/help/bisect">
2218 bisect
2218 bisect
2219 </a>
2219 </a>
2220 </td><td>
2220 </td><td>
2221 subdivision search of changesets
2221 subdivision search of changesets
2222 </td></tr>
2222 </td></tr>
2223 <tr><td>
2223 <tr><td>
2224 <a href="/help/bookmarks">
2224 <a href="/help/bookmarks">
2225 bookmarks
2225 bookmarks
2226 </a>
2226 </a>
2227 </td><td>
2227 </td><td>
2228 create a new bookmark or list existing bookmarks
2228 create a new bookmark or list existing bookmarks
2229 </td></tr>
2229 </td></tr>
2230 <tr><td>
2230 <tr><td>
2231 <a href="/help/branch">
2231 <a href="/help/branch">
2232 branch
2232 branch
2233 </a>
2233 </a>
2234 </td><td>
2234 </td><td>
2235 set or show the current branch name
2235 set or show the current branch name
2236 </td></tr>
2236 </td></tr>
2237 <tr><td>
2237 <tr><td>
2238 <a href="/help/branches">
2238 <a href="/help/branches">
2239 branches
2239 branches
2240 </a>
2240 </a>
2241 </td><td>
2241 </td><td>
2242 list repository named branches
2242 list repository named branches
2243 </td></tr>
2243 </td></tr>
2244 <tr><td>
2244 <tr><td>
2245 <a href="/help/bundle">
2245 <a href="/help/bundle">
2246 bundle
2246 bundle
2247 </a>
2247 </a>
2248 </td><td>
2248 </td><td>
2249 create a bundle file
2249 create a bundle file
2250 </td></tr>
2250 </td></tr>
2251 <tr><td>
2251 <tr><td>
2252 <a href="/help/cat">
2252 <a href="/help/cat">
2253 cat
2253 cat
2254 </a>
2254 </a>
2255 </td><td>
2255 </td><td>
2256 output the current or given revision of files
2256 output the current or given revision of files
2257 </td></tr>
2257 </td></tr>
2258 <tr><td>
2258 <tr><td>
2259 <a href="/help/config">
2259 <a href="/help/config">
2260 config
2260 config
2261 </a>
2261 </a>
2262 </td><td>
2262 </td><td>
2263 show combined config settings from all hgrc files
2263 show combined config settings from all hgrc files
2264 </td></tr>
2264 </td></tr>
2265 <tr><td>
2265 <tr><td>
2266 <a href="/help/copy">
2266 <a href="/help/copy">
2267 copy
2267 copy
2268 </a>
2268 </a>
2269 </td><td>
2269 </td><td>
2270 mark files as copied for the next commit
2270 mark files as copied for the next commit
2271 </td></tr>
2271 </td></tr>
2272 <tr><td>
2272 <tr><td>
2273 <a href="/help/files">
2273 <a href="/help/files">
2274 files
2274 files
2275 </a>
2275 </a>
2276 </td><td>
2276 </td><td>
2277 list tracked files
2277 list tracked files
2278 </td></tr>
2278 </td></tr>
2279 <tr><td>
2279 <tr><td>
2280 <a href="/help/graft">
2280 <a href="/help/graft">
2281 graft
2281 graft
2282 </a>
2282 </a>
2283 </td><td>
2283 </td><td>
2284 copy changes from other branches onto the current branch
2284 copy changes from other branches onto the current branch
2285 </td></tr>
2285 </td></tr>
2286 <tr><td>
2286 <tr><td>
2287 <a href="/help/grep">
2287 <a href="/help/grep">
2288 grep
2288 grep
2289 </a>
2289 </a>
2290 </td><td>
2290 </td><td>
2291 search revision history for a pattern in specified files
2291 search revision history for a pattern in specified files
2292 </td></tr>
2292 </td></tr>
2293 <tr><td>
2293 <tr><td>
2294 <a href="/help/heads">
2294 <a href="/help/heads">
2295 heads
2295 heads
2296 </a>
2296 </a>
2297 </td><td>
2297 </td><td>
2298 show branch heads
2298 show branch heads
2299 </td></tr>
2299 </td></tr>
2300 <tr><td>
2300 <tr><td>
2301 <a href="/help/help">
2301 <a href="/help/help">
2302 help
2302 help
2303 </a>
2303 </a>
2304 </td><td>
2304 </td><td>
2305 show help for a given topic or a help overview
2305 show help for a given topic or a help overview
2306 </td></tr>
2306 </td></tr>
2307 <tr><td>
2307 <tr><td>
2308 <a href="/help/hgalias">
2308 <a href="/help/hgalias">
2309 hgalias
2309 hgalias
2310 </a>
2310 </a>
2311 </td><td>
2311 </td><td>
2312 summarize working directory state
2312 summarize working directory state
2313 </td></tr>
2313 </td></tr>
2314 <tr><td>
2314 <tr><td>
2315 <a href="/help/identify">
2315 <a href="/help/identify">
2316 identify
2316 identify
2317 </a>
2317 </a>
2318 </td><td>
2318 </td><td>
2319 identify the working directory or specified revision
2319 identify the working directory or specified revision
2320 </td></tr>
2320 </td></tr>
2321 <tr><td>
2321 <tr><td>
2322 <a href="/help/import">
2322 <a href="/help/import">
2323 import
2323 import
2324 </a>
2324 </a>
2325 </td><td>
2325 </td><td>
2326 import an ordered set of patches
2326 import an ordered set of patches
2327 </td></tr>
2327 </td></tr>
2328 <tr><td>
2328 <tr><td>
2329 <a href="/help/incoming">
2329 <a href="/help/incoming">
2330 incoming
2330 incoming
2331 </a>
2331 </a>
2332 </td><td>
2332 </td><td>
2333 show new changesets found in source
2333 show new changesets found in source
2334 </td></tr>
2334 </td></tr>
2335 <tr><td>
2335 <tr><td>
2336 <a href="/help/manifest">
2336 <a href="/help/manifest">
2337 manifest
2337 manifest
2338 </a>
2338 </a>
2339 </td><td>
2339 </td><td>
2340 output the current or given revision of the project manifest
2340 output the current or given revision of the project manifest
2341 </td></tr>
2341 </td></tr>
2342 <tr><td>
2342 <tr><td>
2343 <a href="/help/nohelp">
2343 <a href="/help/nohelp">
2344 nohelp
2344 nohelp
2345 </a>
2345 </a>
2346 </td><td>
2346 </td><td>
2347 (no help text available)
2347 (no help text available)
2348 </td></tr>
2348 </td></tr>
2349 <tr><td>
2349 <tr><td>
2350 <a href="/help/outgoing">
2350 <a href="/help/outgoing">
2351 outgoing
2351 outgoing
2352 </a>
2352 </a>
2353 </td><td>
2353 </td><td>
2354 show changesets not found in the destination
2354 show changesets not found in the destination
2355 </td></tr>
2355 </td></tr>
2356 <tr><td>
2356 <tr><td>
2357 <a href="/help/paths">
2357 <a href="/help/paths">
2358 paths
2358 paths
2359 </a>
2359 </a>
2360 </td><td>
2360 </td><td>
2361 show aliases for remote repositories
2361 show aliases for remote repositories
2362 </td></tr>
2362 </td></tr>
2363 <tr><td>
2363 <tr><td>
2364 <a href="/help/phase">
2364 <a href="/help/phase">
2365 phase
2365 phase
2366 </a>
2366 </a>
2367 </td><td>
2367 </td><td>
2368 set or show the current phase name
2368 set or show the current phase name
2369 </td></tr>
2369 </td></tr>
2370 <tr><td>
2370 <tr><td>
2371 <a href="/help/recover">
2371 <a href="/help/recover">
2372 recover
2372 recover
2373 </a>
2373 </a>
2374 </td><td>
2374 </td><td>
2375 roll back an interrupted transaction
2375 roll back an interrupted transaction
2376 </td></tr>
2376 </td></tr>
2377 <tr><td>
2377 <tr><td>
2378 <a href="/help/rename">
2378 <a href="/help/rename">
2379 rename
2379 rename
2380 </a>
2380 </a>
2381 </td><td>
2381 </td><td>
2382 rename files; equivalent of copy + remove
2382 rename files; equivalent of copy + remove
2383 </td></tr>
2383 </td></tr>
2384 <tr><td>
2384 <tr><td>
2385 <a href="/help/resolve">
2385 <a href="/help/resolve">
2386 resolve
2386 resolve
2387 </a>
2387 </a>
2388 </td><td>
2388 </td><td>
2389 redo merges or set/view the merge status of files
2389 redo merges or set/view the merge status of files
2390 </td></tr>
2390 </td></tr>
2391 <tr><td>
2391 <tr><td>
2392 <a href="/help/revert">
2392 <a href="/help/revert">
2393 revert
2393 revert
2394 </a>
2394 </a>
2395 </td><td>
2395 </td><td>
2396 restore files to their checkout state
2396 restore files to their checkout state
2397 </td></tr>
2397 </td></tr>
2398 <tr><td>
2398 <tr><td>
2399 <a href="/help/root">
2399 <a href="/help/root">
2400 root
2400 root
2401 </a>
2401 </a>
2402 </td><td>
2402 </td><td>
2403 print the root (top) of the current working directory
2403 print the root (top) of the current working directory
2404 </td></tr>
2404 </td></tr>
2405 <tr><td>
2405 <tr><td>
2406 <a href="/help/shellalias">
2406 <a href="/help/shellalias">
2407 shellalias
2407 shellalias
2408 </a>
2408 </a>
2409 </td><td>
2409 </td><td>
2410 (no help text available)
2410 (no help text available)
2411 </td></tr>
2411 </td></tr>
2412 <tr><td>
2412 <tr><td>
2413 <a href="/help/tag">
2413 <a href="/help/tag">
2414 tag
2414 tag
2415 </a>
2415 </a>
2416 </td><td>
2416 </td><td>
2417 add one or more tags for the current or given revision
2417 add one or more tags for the current or given revision
2418 </td></tr>
2418 </td></tr>
2419 <tr><td>
2419 <tr><td>
2420 <a href="/help/tags">
2420 <a href="/help/tags">
2421 tags
2421 tags
2422 </a>
2422 </a>
2423 </td><td>
2423 </td><td>
2424 list repository tags
2424 list repository tags
2425 </td></tr>
2425 </td></tr>
2426 <tr><td>
2426 <tr><td>
2427 <a href="/help/unbundle">
2427 <a href="/help/unbundle">
2428 unbundle
2428 unbundle
2429 </a>
2429 </a>
2430 </td><td>
2430 </td><td>
2431 apply one or more changegroup files
2431 apply one or more bundle files
2432 </td></tr>
2432 </td></tr>
2433 <tr><td>
2433 <tr><td>
2434 <a href="/help/verify">
2434 <a href="/help/verify">
2435 verify
2435 verify
2436 </a>
2436 </a>
2437 </td><td>
2437 </td><td>
2438 verify the integrity of the repository
2438 verify the integrity of the repository
2439 </td></tr>
2439 </td></tr>
2440 <tr><td>
2440 <tr><td>
2441 <a href="/help/version">
2441 <a href="/help/version">
2442 version
2442 version
2443 </a>
2443 </a>
2444 </td><td>
2444 </td><td>
2445 output version and copyright information
2445 output version and copyright information
2446 </td></tr>
2446 </td></tr>
2447
2447
2448
2448
2449 </table>
2449 </table>
2450 </div>
2450 </div>
2451 </div>
2451 </div>
2452
2452
2453
2453
2454
2454
2455 </body>
2455 </body>
2456 </html>
2456 </html>
2457
2457
2458
2458
2459 $ get-with-headers.py $LOCALIP:$HGPORT "help/add"
2459 $ get-with-headers.py $LOCALIP:$HGPORT "help/add"
2460 200 Script output follows
2460 200 Script output follows
2461
2461
2462 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2462 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2463 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2463 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2464 <head>
2464 <head>
2465 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2465 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2466 <meta name="robots" content="index, nofollow" />
2466 <meta name="robots" content="index, nofollow" />
2467 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2467 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2468 <script type="text/javascript" src="/static/mercurial.js"></script>
2468 <script type="text/javascript" src="/static/mercurial.js"></script>
2469
2469
2470 <title>Help: add</title>
2470 <title>Help: add</title>
2471 </head>
2471 </head>
2472 <body>
2472 <body>
2473
2473
2474 <div class="container">
2474 <div class="container">
2475 <div class="menu">
2475 <div class="menu">
2476 <div class="logo">
2476 <div class="logo">
2477 <a href="https://mercurial-scm.org/">
2477 <a href="https://mercurial-scm.org/">
2478 <img src="/static/hglogo.png" alt="mercurial" /></a>
2478 <img src="/static/hglogo.png" alt="mercurial" /></a>
2479 </div>
2479 </div>
2480 <ul>
2480 <ul>
2481 <li><a href="/shortlog">log</a></li>
2481 <li><a href="/shortlog">log</a></li>
2482 <li><a href="/graph">graph</a></li>
2482 <li><a href="/graph">graph</a></li>
2483 <li><a href="/tags">tags</a></li>
2483 <li><a href="/tags">tags</a></li>
2484 <li><a href="/bookmarks">bookmarks</a></li>
2484 <li><a href="/bookmarks">bookmarks</a></li>
2485 <li><a href="/branches">branches</a></li>
2485 <li><a href="/branches">branches</a></li>
2486 </ul>
2486 </ul>
2487 <ul>
2487 <ul>
2488 <li class="active"><a href="/help">help</a></li>
2488 <li class="active"><a href="/help">help</a></li>
2489 </ul>
2489 </ul>
2490 </div>
2490 </div>
2491
2491
2492 <div class="main">
2492 <div class="main">
2493 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2493 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2494 <h3>Help: add</h3>
2494 <h3>Help: add</h3>
2495
2495
2496 <form class="search" action="/log">
2496 <form class="search" action="/log">
2497
2497
2498 <p><input name="rev" id="search1" type="text" size="30" /></p>
2498 <p><input name="rev" id="search1" type="text" size="30" /></p>
2499 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2499 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2500 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2500 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2501 </form>
2501 </form>
2502 <div id="doc">
2502 <div id="doc">
2503 <p>
2503 <p>
2504 hg add [OPTION]... [FILE]...
2504 hg add [OPTION]... [FILE]...
2505 </p>
2505 </p>
2506 <p>
2506 <p>
2507 add the specified files on the next commit
2507 add the specified files on the next commit
2508 </p>
2508 </p>
2509 <p>
2509 <p>
2510 Schedule files to be version controlled and added to the
2510 Schedule files to be version controlled and added to the
2511 repository.
2511 repository.
2512 </p>
2512 </p>
2513 <p>
2513 <p>
2514 The files will be added to the repository at the next commit. To
2514 The files will be added to the repository at the next commit. To
2515 undo an add before that, see 'hg forget'.
2515 undo an add before that, see 'hg forget'.
2516 </p>
2516 </p>
2517 <p>
2517 <p>
2518 If no names are given, add all files to the repository (except
2518 If no names are given, add all files to the repository (except
2519 files matching &quot;.hgignore&quot;).
2519 files matching &quot;.hgignore&quot;).
2520 </p>
2520 </p>
2521 <p>
2521 <p>
2522 Examples:
2522 Examples:
2523 </p>
2523 </p>
2524 <ul>
2524 <ul>
2525 <li> New (unknown) files are added automatically by 'hg add':
2525 <li> New (unknown) files are added automatically by 'hg add':
2526 <pre>
2526 <pre>
2527 \$ ls (re)
2527 \$ ls (re)
2528 foo.c
2528 foo.c
2529 \$ hg status (re)
2529 \$ hg status (re)
2530 ? foo.c
2530 ? foo.c
2531 \$ hg add (re)
2531 \$ hg add (re)
2532 adding foo.c
2532 adding foo.c
2533 \$ hg status (re)
2533 \$ hg status (re)
2534 A foo.c
2534 A foo.c
2535 </pre>
2535 </pre>
2536 <li> Specific files to be added can be specified:
2536 <li> Specific files to be added can be specified:
2537 <pre>
2537 <pre>
2538 \$ ls (re)
2538 \$ ls (re)
2539 bar.c foo.c
2539 bar.c foo.c
2540 \$ hg status (re)
2540 \$ hg status (re)
2541 ? bar.c
2541 ? bar.c
2542 ? foo.c
2542 ? foo.c
2543 \$ hg add bar.c (re)
2543 \$ hg add bar.c (re)
2544 \$ hg status (re)
2544 \$ hg status (re)
2545 A bar.c
2545 A bar.c
2546 ? foo.c
2546 ? foo.c
2547 </pre>
2547 </pre>
2548 </ul>
2548 </ul>
2549 <p>
2549 <p>
2550 Returns 0 if all files are successfully added.
2550 Returns 0 if all files are successfully added.
2551 </p>
2551 </p>
2552 <p>
2552 <p>
2553 options ([+] can be repeated):
2553 options ([+] can be repeated):
2554 </p>
2554 </p>
2555 <table>
2555 <table>
2556 <tr><td>-I</td>
2556 <tr><td>-I</td>
2557 <td>--include PATTERN [+]</td>
2557 <td>--include PATTERN [+]</td>
2558 <td>include names matching the given patterns</td></tr>
2558 <td>include names matching the given patterns</td></tr>
2559 <tr><td>-X</td>
2559 <tr><td>-X</td>
2560 <td>--exclude PATTERN [+]</td>
2560 <td>--exclude PATTERN [+]</td>
2561 <td>exclude names matching the given patterns</td></tr>
2561 <td>exclude names matching the given patterns</td></tr>
2562 <tr><td>-S</td>
2562 <tr><td>-S</td>
2563 <td>--subrepos</td>
2563 <td>--subrepos</td>
2564 <td>recurse into subrepositories</td></tr>
2564 <td>recurse into subrepositories</td></tr>
2565 <tr><td>-n</td>
2565 <tr><td>-n</td>
2566 <td>--dry-run</td>
2566 <td>--dry-run</td>
2567 <td>do not perform actions, just print output</td></tr>
2567 <td>do not perform actions, just print output</td></tr>
2568 </table>
2568 </table>
2569 <p>
2569 <p>
2570 global options ([+] can be repeated):
2570 global options ([+] can be repeated):
2571 </p>
2571 </p>
2572 <table>
2572 <table>
2573 <tr><td>-R</td>
2573 <tr><td>-R</td>
2574 <td>--repository REPO</td>
2574 <td>--repository REPO</td>
2575 <td>repository root directory or name of overlay bundle file</td></tr>
2575 <td>repository root directory or name of overlay bundle file</td></tr>
2576 <tr><td></td>
2576 <tr><td></td>
2577 <td>--cwd DIR</td>
2577 <td>--cwd DIR</td>
2578 <td>change working directory</td></tr>
2578 <td>change working directory</td></tr>
2579 <tr><td>-y</td>
2579 <tr><td>-y</td>
2580 <td>--noninteractive</td>
2580 <td>--noninteractive</td>
2581 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2581 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2582 <tr><td>-q</td>
2582 <tr><td>-q</td>
2583 <td>--quiet</td>
2583 <td>--quiet</td>
2584 <td>suppress output</td></tr>
2584 <td>suppress output</td></tr>
2585 <tr><td>-v</td>
2585 <tr><td>-v</td>
2586 <td>--verbose</td>
2586 <td>--verbose</td>
2587 <td>enable additional output</td></tr>
2587 <td>enable additional output</td></tr>
2588 <tr><td></td>
2588 <tr><td></td>
2589 <td>--color TYPE</td>
2589 <td>--color TYPE</td>
2590 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2590 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2591 <tr><td></td>
2591 <tr><td></td>
2592 <td>--config CONFIG [+]</td>
2592 <td>--config CONFIG [+]</td>
2593 <td>set/override config option (use 'section.name=value')</td></tr>
2593 <td>set/override config option (use 'section.name=value')</td></tr>
2594 <tr><td></td>
2594 <tr><td></td>
2595 <td>--debug</td>
2595 <td>--debug</td>
2596 <td>enable debugging output</td></tr>
2596 <td>enable debugging output</td></tr>
2597 <tr><td></td>
2597 <tr><td></td>
2598 <td>--debugger</td>
2598 <td>--debugger</td>
2599 <td>start debugger</td></tr>
2599 <td>start debugger</td></tr>
2600 <tr><td></td>
2600 <tr><td></td>
2601 <td>--encoding ENCODE</td>
2601 <td>--encoding ENCODE</td>
2602 <td>set the charset encoding (default: ascii)</td></tr>
2602 <td>set the charset encoding (default: ascii)</td></tr>
2603 <tr><td></td>
2603 <tr><td></td>
2604 <td>--encodingmode MODE</td>
2604 <td>--encodingmode MODE</td>
2605 <td>set the charset encoding mode (default: strict)</td></tr>
2605 <td>set the charset encoding mode (default: strict)</td></tr>
2606 <tr><td></td>
2606 <tr><td></td>
2607 <td>--traceback</td>
2607 <td>--traceback</td>
2608 <td>always print a traceback on exception</td></tr>
2608 <td>always print a traceback on exception</td></tr>
2609 <tr><td></td>
2609 <tr><td></td>
2610 <td>--time</td>
2610 <td>--time</td>
2611 <td>time how long the command takes</td></tr>
2611 <td>time how long the command takes</td></tr>
2612 <tr><td></td>
2612 <tr><td></td>
2613 <td>--profile</td>
2613 <td>--profile</td>
2614 <td>print command execution profile</td></tr>
2614 <td>print command execution profile</td></tr>
2615 <tr><td></td>
2615 <tr><td></td>
2616 <td>--version</td>
2616 <td>--version</td>
2617 <td>output version information and exit</td></tr>
2617 <td>output version information and exit</td></tr>
2618 <tr><td>-h</td>
2618 <tr><td>-h</td>
2619 <td>--help</td>
2619 <td>--help</td>
2620 <td>display help and exit</td></tr>
2620 <td>display help and exit</td></tr>
2621 <tr><td></td>
2621 <tr><td></td>
2622 <td>--hidden</td>
2622 <td>--hidden</td>
2623 <td>consider hidden changesets</td></tr>
2623 <td>consider hidden changesets</td></tr>
2624 <tr><td></td>
2624 <tr><td></td>
2625 <td>--pager TYPE</td>
2625 <td>--pager TYPE</td>
2626 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2626 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2627 </table>
2627 </table>
2628
2628
2629 </div>
2629 </div>
2630 </div>
2630 </div>
2631 </div>
2631 </div>
2632
2632
2633
2633
2634
2634
2635 </body>
2635 </body>
2636 </html>
2636 </html>
2637
2637
2638
2638
2639 $ get-with-headers.py $LOCALIP:$HGPORT "help/remove"
2639 $ get-with-headers.py $LOCALIP:$HGPORT "help/remove"
2640 200 Script output follows
2640 200 Script output follows
2641
2641
2642 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2642 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2643 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2643 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2644 <head>
2644 <head>
2645 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2645 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2646 <meta name="robots" content="index, nofollow" />
2646 <meta name="robots" content="index, nofollow" />
2647 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2647 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2648 <script type="text/javascript" src="/static/mercurial.js"></script>
2648 <script type="text/javascript" src="/static/mercurial.js"></script>
2649
2649
2650 <title>Help: remove</title>
2650 <title>Help: remove</title>
2651 </head>
2651 </head>
2652 <body>
2652 <body>
2653
2653
2654 <div class="container">
2654 <div class="container">
2655 <div class="menu">
2655 <div class="menu">
2656 <div class="logo">
2656 <div class="logo">
2657 <a href="https://mercurial-scm.org/">
2657 <a href="https://mercurial-scm.org/">
2658 <img src="/static/hglogo.png" alt="mercurial" /></a>
2658 <img src="/static/hglogo.png" alt="mercurial" /></a>
2659 </div>
2659 </div>
2660 <ul>
2660 <ul>
2661 <li><a href="/shortlog">log</a></li>
2661 <li><a href="/shortlog">log</a></li>
2662 <li><a href="/graph">graph</a></li>
2662 <li><a href="/graph">graph</a></li>
2663 <li><a href="/tags">tags</a></li>
2663 <li><a href="/tags">tags</a></li>
2664 <li><a href="/bookmarks">bookmarks</a></li>
2664 <li><a href="/bookmarks">bookmarks</a></li>
2665 <li><a href="/branches">branches</a></li>
2665 <li><a href="/branches">branches</a></li>
2666 </ul>
2666 </ul>
2667 <ul>
2667 <ul>
2668 <li class="active"><a href="/help">help</a></li>
2668 <li class="active"><a href="/help">help</a></li>
2669 </ul>
2669 </ul>
2670 </div>
2670 </div>
2671
2671
2672 <div class="main">
2672 <div class="main">
2673 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2673 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2674 <h3>Help: remove</h3>
2674 <h3>Help: remove</h3>
2675
2675
2676 <form class="search" action="/log">
2676 <form class="search" action="/log">
2677
2677
2678 <p><input name="rev" id="search1" type="text" size="30" /></p>
2678 <p><input name="rev" id="search1" type="text" size="30" /></p>
2679 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2679 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2680 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2680 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2681 </form>
2681 </form>
2682 <div id="doc">
2682 <div id="doc">
2683 <p>
2683 <p>
2684 hg remove [OPTION]... FILE...
2684 hg remove [OPTION]... FILE...
2685 </p>
2685 </p>
2686 <p>
2686 <p>
2687 aliases: rm
2687 aliases: rm
2688 </p>
2688 </p>
2689 <p>
2689 <p>
2690 remove the specified files on the next commit
2690 remove the specified files on the next commit
2691 </p>
2691 </p>
2692 <p>
2692 <p>
2693 Schedule the indicated files for removal from the current branch.
2693 Schedule the indicated files for removal from the current branch.
2694 </p>
2694 </p>
2695 <p>
2695 <p>
2696 This command schedules the files to be removed at the next commit.
2696 This command schedules the files to be removed at the next commit.
2697 To undo a remove before that, see 'hg revert'. To undo added
2697 To undo a remove before that, see 'hg revert'. To undo added
2698 files, see 'hg forget'.
2698 files, see 'hg forget'.
2699 </p>
2699 </p>
2700 <p>
2700 <p>
2701 -A/--after can be used to remove only files that have already
2701 -A/--after can be used to remove only files that have already
2702 been deleted, -f/--force can be used to force deletion, and -Af
2702 been deleted, -f/--force can be used to force deletion, and -Af
2703 can be used to remove files from the next revision without
2703 can be used to remove files from the next revision without
2704 deleting them from the working directory.
2704 deleting them from the working directory.
2705 </p>
2705 </p>
2706 <p>
2706 <p>
2707 The following table details the behavior of remove for different
2707 The following table details the behavior of remove for different
2708 file states (columns) and option combinations (rows). The file
2708 file states (columns) and option combinations (rows). The file
2709 states are Added [A], Clean [C], Modified [M] and Missing [!]
2709 states are Added [A], Clean [C], Modified [M] and Missing [!]
2710 (as reported by 'hg status'). The actions are Warn, Remove
2710 (as reported by 'hg status'). The actions are Warn, Remove
2711 (from branch) and Delete (from disk):
2711 (from branch) and Delete (from disk):
2712 </p>
2712 </p>
2713 <table>
2713 <table>
2714 <tr><td>opt/state</td>
2714 <tr><td>opt/state</td>
2715 <td>A</td>
2715 <td>A</td>
2716 <td>C</td>
2716 <td>C</td>
2717 <td>M</td>
2717 <td>M</td>
2718 <td>!</td></tr>
2718 <td>!</td></tr>
2719 <tr><td>none</td>
2719 <tr><td>none</td>
2720 <td>W</td>
2720 <td>W</td>
2721 <td>RD</td>
2721 <td>RD</td>
2722 <td>W</td>
2722 <td>W</td>
2723 <td>R</td></tr>
2723 <td>R</td></tr>
2724 <tr><td>-f</td>
2724 <tr><td>-f</td>
2725 <td>R</td>
2725 <td>R</td>
2726 <td>RD</td>
2726 <td>RD</td>
2727 <td>RD</td>
2727 <td>RD</td>
2728 <td>R</td></tr>
2728 <td>R</td></tr>
2729 <tr><td>-A</td>
2729 <tr><td>-A</td>
2730 <td>W</td>
2730 <td>W</td>
2731 <td>W</td>
2731 <td>W</td>
2732 <td>W</td>
2732 <td>W</td>
2733 <td>R</td></tr>
2733 <td>R</td></tr>
2734 <tr><td>-Af</td>
2734 <tr><td>-Af</td>
2735 <td>R</td>
2735 <td>R</td>
2736 <td>R</td>
2736 <td>R</td>
2737 <td>R</td>
2737 <td>R</td>
2738 <td>R</td></tr>
2738 <td>R</td></tr>
2739 </table>
2739 </table>
2740 <p>
2740 <p>
2741 <b>Note:</b>
2741 <b>Note:</b>
2742 </p>
2742 </p>
2743 <p>
2743 <p>
2744 'hg remove' never deletes files in Added [A] state from the
2744 'hg remove' never deletes files in Added [A] state from the
2745 working directory, not even if &quot;--force&quot; is specified.
2745 working directory, not even if &quot;--force&quot; is specified.
2746 </p>
2746 </p>
2747 <p>
2747 <p>
2748 Returns 0 on success, 1 if any warnings encountered.
2748 Returns 0 on success, 1 if any warnings encountered.
2749 </p>
2749 </p>
2750 <p>
2750 <p>
2751 options ([+] can be repeated):
2751 options ([+] can be repeated):
2752 </p>
2752 </p>
2753 <table>
2753 <table>
2754 <tr><td>-A</td>
2754 <tr><td>-A</td>
2755 <td>--after</td>
2755 <td>--after</td>
2756 <td>record delete for missing files</td></tr>
2756 <td>record delete for missing files</td></tr>
2757 <tr><td>-f</td>
2757 <tr><td>-f</td>
2758 <td>--force</td>
2758 <td>--force</td>
2759 <td>forget added files, delete modified files</td></tr>
2759 <td>forget added files, delete modified files</td></tr>
2760 <tr><td>-S</td>
2760 <tr><td>-S</td>
2761 <td>--subrepos</td>
2761 <td>--subrepos</td>
2762 <td>recurse into subrepositories</td></tr>
2762 <td>recurse into subrepositories</td></tr>
2763 <tr><td>-I</td>
2763 <tr><td>-I</td>
2764 <td>--include PATTERN [+]</td>
2764 <td>--include PATTERN [+]</td>
2765 <td>include names matching the given patterns</td></tr>
2765 <td>include names matching the given patterns</td></tr>
2766 <tr><td>-X</td>
2766 <tr><td>-X</td>
2767 <td>--exclude PATTERN [+]</td>
2767 <td>--exclude PATTERN [+]</td>
2768 <td>exclude names matching the given patterns</td></tr>
2768 <td>exclude names matching the given patterns</td></tr>
2769 </table>
2769 </table>
2770 <p>
2770 <p>
2771 global options ([+] can be repeated):
2771 global options ([+] can be repeated):
2772 </p>
2772 </p>
2773 <table>
2773 <table>
2774 <tr><td>-R</td>
2774 <tr><td>-R</td>
2775 <td>--repository REPO</td>
2775 <td>--repository REPO</td>
2776 <td>repository root directory or name of overlay bundle file</td></tr>
2776 <td>repository root directory or name of overlay bundle file</td></tr>
2777 <tr><td></td>
2777 <tr><td></td>
2778 <td>--cwd DIR</td>
2778 <td>--cwd DIR</td>
2779 <td>change working directory</td></tr>
2779 <td>change working directory</td></tr>
2780 <tr><td>-y</td>
2780 <tr><td>-y</td>
2781 <td>--noninteractive</td>
2781 <td>--noninteractive</td>
2782 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2782 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2783 <tr><td>-q</td>
2783 <tr><td>-q</td>
2784 <td>--quiet</td>
2784 <td>--quiet</td>
2785 <td>suppress output</td></tr>
2785 <td>suppress output</td></tr>
2786 <tr><td>-v</td>
2786 <tr><td>-v</td>
2787 <td>--verbose</td>
2787 <td>--verbose</td>
2788 <td>enable additional output</td></tr>
2788 <td>enable additional output</td></tr>
2789 <tr><td></td>
2789 <tr><td></td>
2790 <td>--color TYPE</td>
2790 <td>--color TYPE</td>
2791 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2791 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2792 <tr><td></td>
2792 <tr><td></td>
2793 <td>--config CONFIG [+]</td>
2793 <td>--config CONFIG [+]</td>
2794 <td>set/override config option (use 'section.name=value')</td></tr>
2794 <td>set/override config option (use 'section.name=value')</td></tr>
2795 <tr><td></td>
2795 <tr><td></td>
2796 <td>--debug</td>
2796 <td>--debug</td>
2797 <td>enable debugging output</td></tr>
2797 <td>enable debugging output</td></tr>
2798 <tr><td></td>
2798 <tr><td></td>
2799 <td>--debugger</td>
2799 <td>--debugger</td>
2800 <td>start debugger</td></tr>
2800 <td>start debugger</td></tr>
2801 <tr><td></td>
2801 <tr><td></td>
2802 <td>--encoding ENCODE</td>
2802 <td>--encoding ENCODE</td>
2803 <td>set the charset encoding (default: ascii)</td></tr>
2803 <td>set the charset encoding (default: ascii)</td></tr>
2804 <tr><td></td>
2804 <tr><td></td>
2805 <td>--encodingmode MODE</td>
2805 <td>--encodingmode MODE</td>
2806 <td>set the charset encoding mode (default: strict)</td></tr>
2806 <td>set the charset encoding mode (default: strict)</td></tr>
2807 <tr><td></td>
2807 <tr><td></td>
2808 <td>--traceback</td>
2808 <td>--traceback</td>
2809 <td>always print a traceback on exception</td></tr>
2809 <td>always print a traceback on exception</td></tr>
2810 <tr><td></td>
2810 <tr><td></td>
2811 <td>--time</td>
2811 <td>--time</td>
2812 <td>time how long the command takes</td></tr>
2812 <td>time how long the command takes</td></tr>
2813 <tr><td></td>
2813 <tr><td></td>
2814 <td>--profile</td>
2814 <td>--profile</td>
2815 <td>print command execution profile</td></tr>
2815 <td>print command execution profile</td></tr>
2816 <tr><td></td>
2816 <tr><td></td>
2817 <td>--version</td>
2817 <td>--version</td>
2818 <td>output version information and exit</td></tr>
2818 <td>output version information and exit</td></tr>
2819 <tr><td>-h</td>
2819 <tr><td>-h</td>
2820 <td>--help</td>
2820 <td>--help</td>
2821 <td>display help and exit</td></tr>
2821 <td>display help and exit</td></tr>
2822 <tr><td></td>
2822 <tr><td></td>
2823 <td>--hidden</td>
2823 <td>--hidden</td>
2824 <td>consider hidden changesets</td></tr>
2824 <td>consider hidden changesets</td></tr>
2825 <tr><td></td>
2825 <tr><td></td>
2826 <td>--pager TYPE</td>
2826 <td>--pager TYPE</td>
2827 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2827 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2828 </table>
2828 </table>
2829
2829
2830 </div>
2830 </div>
2831 </div>
2831 </div>
2832 </div>
2832 </div>
2833
2833
2834
2834
2835
2835
2836 </body>
2836 </body>
2837 </html>
2837 </html>
2838
2838
2839
2839
2840 $ get-with-headers.py $LOCALIP:$HGPORT "help/dates"
2840 $ get-with-headers.py $LOCALIP:$HGPORT "help/dates"
2841 200 Script output follows
2841 200 Script output follows
2842
2842
2843 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2843 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2844 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2844 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2845 <head>
2845 <head>
2846 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2846 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2847 <meta name="robots" content="index, nofollow" />
2847 <meta name="robots" content="index, nofollow" />
2848 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2848 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2849 <script type="text/javascript" src="/static/mercurial.js"></script>
2849 <script type="text/javascript" src="/static/mercurial.js"></script>
2850
2850
2851 <title>Help: dates</title>
2851 <title>Help: dates</title>
2852 </head>
2852 </head>
2853 <body>
2853 <body>
2854
2854
2855 <div class="container">
2855 <div class="container">
2856 <div class="menu">
2856 <div class="menu">
2857 <div class="logo">
2857 <div class="logo">
2858 <a href="https://mercurial-scm.org/">
2858 <a href="https://mercurial-scm.org/">
2859 <img src="/static/hglogo.png" alt="mercurial" /></a>
2859 <img src="/static/hglogo.png" alt="mercurial" /></a>
2860 </div>
2860 </div>
2861 <ul>
2861 <ul>
2862 <li><a href="/shortlog">log</a></li>
2862 <li><a href="/shortlog">log</a></li>
2863 <li><a href="/graph">graph</a></li>
2863 <li><a href="/graph">graph</a></li>
2864 <li><a href="/tags">tags</a></li>
2864 <li><a href="/tags">tags</a></li>
2865 <li><a href="/bookmarks">bookmarks</a></li>
2865 <li><a href="/bookmarks">bookmarks</a></li>
2866 <li><a href="/branches">branches</a></li>
2866 <li><a href="/branches">branches</a></li>
2867 </ul>
2867 </ul>
2868 <ul>
2868 <ul>
2869 <li class="active"><a href="/help">help</a></li>
2869 <li class="active"><a href="/help">help</a></li>
2870 </ul>
2870 </ul>
2871 </div>
2871 </div>
2872
2872
2873 <div class="main">
2873 <div class="main">
2874 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2874 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2875 <h3>Help: dates</h3>
2875 <h3>Help: dates</h3>
2876
2876
2877 <form class="search" action="/log">
2877 <form class="search" action="/log">
2878
2878
2879 <p><input name="rev" id="search1" type="text" size="30" /></p>
2879 <p><input name="rev" id="search1" type="text" size="30" /></p>
2880 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2880 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2881 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2881 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2882 </form>
2882 </form>
2883 <div id="doc">
2883 <div id="doc">
2884 <h1>Date Formats</h1>
2884 <h1>Date Formats</h1>
2885 <p>
2885 <p>
2886 Some commands allow the user to specify a date, e.g.:
2886 Some commands allow the user to specify a date, e.g.:
2887 </p>
2887 </p>
2888 <ul>
2888 <ul>
2889 <li> backout, commit, import, tag: Specify the commit date.
2889 <li> backout, commit, import, tag: Specify the commit date.
2890 <li> log, revert, update: Select revision(s) by date.
2890 <li> log, revert, update: Select revision(s) by date.
2891 </ul>
2891 </ul>
2892 <p>
2892 <p>
2893 Many date formats are valid. Here are some examples:
2893 Many date formats are valid. Here are some examples:
2894 </p>
2894 </p>
2895 <ul>
2895 <ul>
2896 <li> &quot;Wed Dec 6 13:18:29 2006&quot; (local timezone assumed)
2896 <li> &quot;Wed Dec 6 13:18:29 2006&quot; (local timezone assumed)
2897 <li> &quot;Dec 6 13:18 -0600&quot; (year assumed, time offset provided)
2897 <li> &quot;Dec 6 13:18 -0600&quot; (year assumed, time offset provided)
2898 <li> &quot;Dec 6 13:18 UTC&quot; (UTC and GMT are aliases for +0000)
2898 <li> &quot;Dec 6 13:18 UTC&quot; (UTC and GMT are aliases for +0000)
2899 <li> &quot;Dec 6&quot; (midnight)
2899 <li> &quot;Dec 6&quot; (midnight)
2900 <li> &quot;13:18&quot; (today assumed)
2900 <li> &quot;13:18&quot; (today assumed)
2901 <li> &quot;3:39&quot; (3:39AM assumed)
2901 <li> &quot;3:39&quot; (3:39AM assumed)
2902 <li> &quot;3:39pm&quot; (15:39)
2902 <li> &quot;3:39pm&quot; (15:39)
2903 <li> &quot;2006-12-06 13:18:29&quot; (ISO 8601 format)
2903 <li> &quot;2006-12-06 13:18:29&quot; (ISO 8601 format)
2904 <li> &quot;2006-12-6 13:18&quot;
2904 <li> &quot;2006-12-6 13:18&quot;
2905 <li> &quot;2006-12-6&quot;
2905 <li> &quot;2006-12-6&quot;
2906 <li> &quot;12-6&quot;
2906 <li> &quot;12-6&quot;
2907 <li> &quot;12/6&quot;
2907 <li> &quot;12/6&quot;
2908 <li> &quot;12/6/6&quot; (Dec 6 2006)
2908 <li> &quot;12/6/6&quot; (Dec 6 2006)
2909 <li> &quot;today&quot; (midnight)
2909 <li> &quot;today&quot; (midnight)
2910 <li> &quot;yesterday&quot; (midnight)
2910 <li> &quot;yesterday&quot; (midnight)
2911 <li> &quot;now&quot; - right now
2911 <li> &quot;now&quot; - right now
2912 </ul>
2912 </ul>
2913 <p>
2913 <p>
2914 Lastly, there is Mercurial's internal format:
2914 Lastly, there is Mercurial's internal format:
2915 </p>
2915 </p>
2916 <ul>
2916 <ul>
2917 <li> &quot;1165411109 0&quot; (Wed Dec 6 13:18:29 2006 UTC)
2917 <li> &quot;1165411109 0&quot; (Wed Dec 6 13:18:29 2006 UTC)
2918 </ul>
2918 </ul>
2919 <p>
2919 <p>
2920 This is the internal representation format for dates. The first number
2920 This is the internal representation format for dates. The first number
2921 is the number of seconds since the epoch (1970-01-01 00:00 UTC). The
2921 is the number of seconds since the epoch (1970-01-01 00:00 UTC). The
2922 second is the offset of the local timezone, in seconds west of UTC
2922 second is the offset of the local timezone, in seconds west of UTC
2923 (negative if the timezone is east of UTC).
2923 (negative if the timezone is east of UTC).
2924 </p>
2924 </p>
2925 <p>
2925 <p>
2926 The log command also accepts date ranges:
2926 The log command also accepts date ranges:
2927 </p>
2927 </p>
2928 <ul>
2928 <ul>
2929 <li> &quot;&lt;DATE&quot; - at or before a given date/time
2929 <li> &quot;&lt;DATE&quot; - at or before a given date/time
2930 <li> &quot;&gt;DATE&quot; - on or after a given date/time
2930 <li> &quot;&gt;DATE&quot; - on or after a given date/time
2931 <li> &quot;DATE to DATE&quot; - a date range, inclusive
2931 <li> &quot;DATE to DATE&quot; - a date range, inclusive
2932 <li> &quot;-DAYS&quot; - within a given number of days of today
2932 <li> &quot;-DAYS&quot; - within a given number of days of today
2933 </ul>
2933 </ul>
2934
2934
2935 </div>
2935 </div>
2936 </div>
2936 </div>
2937 </div>
2937 </div>
2938
2938
2939
2939
2940
2940
2941 </body>
2941 </body>
2942 </html>
2942 </html>
2943
2943
2944
2944
2945 Sub-topic indexes rendered properly
2945 Sub-topic indexes rendered properly
2946
2946
2947 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals"
2947 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals"
2948 200 Script output follows
2948 200 Script output follows
2949
2949
2950 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2950 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2951 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2951 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2952 <head>
2952 <head>
2953 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2953 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2954 <meta name="robots" content="index, nofollow" />
2954 <meta name="robots" content="index, nofollow" />
2955 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2955 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2956 <script type="text/javascript" src="/static/mercurial.js"></script>
2956 <script type="text/javascript" src="/static/mercurial.js"></script>
2957
2957
2958 <title>Help: internals</title>
2958 <title>Help: internals</title>
2959 </head>
2959 </head>
2960 <body>
2960 <body>
2961
2961
2962 <div class="container">
2962 <div class="container">
2963 <div class="menu">
2963 <div class="menu">
2964 <div class="logo">
2964 <div class="logo">
2965 <a href="https://mercurial-scm.org/">
2965 <a href="https://mercurial-scm.org/">
2966 <img src="/static/hglogo.png" alt="mercurial" /></a>
2966 <img src="/static/hglogo.png" alt="mercurial" /></a>
2967 </div>
2967 </div>
2968 <ul>
2968 <ul>
2969 <li><a href="/shortlog">log</a></li>
2969 <li><a href="/shortlog">log</a></li>
2970 <li><a href="/graph">graph</a></li>
2970 <li><a href="/graph">graph</a></li>
2971 <li><a href="/tags">tags</a></li>
2971 <li><a href="/tags">tags</a></li>
2972 <li><a href="/bookmarks">bookmarks</a></li>
2972 <li><a href="/bookmarks">bookmarks</a></li>
2973 <li><a href="/branches">branches</a></li>
2973 <li><a href="/branches">branches</a></li>
2974 </ul>
2974 </ul>
2975 <ul>
2975 <ul>
2976 <li><a href="/help">help</a></li>
2976 <li><a href="/help">help</a></li>
2977 </ul>
2977 </ul>
2978 </div>
2978 </div>
2979
2979
2980 <div class="main">
2980 <div class="main">
2981 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2981 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2982 <form class="search" action="/log">
2982 <form class="search" action="/log">
2983
2983
2984 <p><input name="rev" id="search1" type="text" size="30" /></p>
2984 <p><input name="rev" id="search1" type="text" size="30" /></p>
2985 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2985 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2986 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2986 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2987 </form>
2987 </form>
2988 <table class="bigtable">
2988 <table class="bigtable">
2989 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
2989 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
2990
2990
2991 <tr><td>
2991 <tr><td>
2992 <a href="/help/internals.bundles">
2992 <a href="/help/internals.bundles">
2993 bundles
2993 bundles
2994 </a>
2994 </a>
2995 </td><td>
2995 </td><td>
2996 Bundles
2996 Bundles
2997 </td></tr>
2997 </td></tr>
2998 <tr><td>
2998 <tr><td>
2999 <a href="/help/internals.censor">
2999 <a href="/help/internals.censor">
3000 censor
3000 censor
3001 </a>
3001 </a>
3002 </td><td>
3002 </td><td>
3003 Censor
3003 Censor
3004 </td></tr>
3004 </td></tr>
3005 <tr><td>
3005 <tr><td>
3006 <a href="/help/internals.changegroups">
3006 <a href="/help/internals.changegroups">
3007 changegroups
3007 changegroups
3008 </a>
3008 </a>
3009 </td><td>
3009 </td><td>
3010 Changegroups
3010 Changegroups
3011 </td></tr>
3011 </td></tr>
3012 <tr><td>
3012 <tr><td>
3013 <a href="/help/internals.requirements">
3013 <a href="/help/internals.requirements">
3014 requirements
3014 requirements
3015 </a>
3015 </a>
3016 </td><td>
3016 </td><td>
3017 Repository Requirements
3017 Repository Requirements
3018 </td></tr>
3018 </td></tr>
3019 <tr><td>
3019 <tr><td>
3020 <a href="/help/internals.revlogs">
3020 <a href="/help/internals.revlogs">
3021 revlogs
3021 revlogs
3022 </a>
3022 </a>
3023 </td><td>
3023 </td><td>
3024 Revision Logs
3024 Revision Logs
3025 </td></tr>
3025 </td></tr>
3026 <tr><td>
3026 <tr><td>
3027 <a href="/help/internals.wireprotocol">
3027 <a href="/help/internals.wireprotocol">
3028 wireprotocol
3028 wireprotocol
3029 </a>
3029 </a>
3030 </td><td>
3030 </td><td>
3031 Wire Protocol
3031 Wire Protocol
3032 </td></tr>
3032 </td></tr>
3033
3033
3034
3034
3035
3035
3036
3036
3037
3037
3038 </table>
3038 </table>
3039 </div>
3039 </div>
3040 </div>
3040 </div>
3041
3041
3042
3042
3043
3043
3044 </body>
3044 </body>
3045 </html>
3045 </html>
3046
3046
3047
3047
3048 Sub-topic topics rendered properly
3048 Sub-topic topics rendered properly
3049
3049
3050 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals.changegroups"
3050 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals.changegroups"
3051 200 Script output follows
3051 200 Script output follows
3052
3052
3053 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3053 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3054 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3054 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3055 <head>
3055 <head>
3056 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3056 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3057 <meta name="robots" content="index, nofollow" />
3057 <meta name="robots" content="index, nofollow" />
3058 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3058 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3059 <script type="text/javascript" src="/static/mercurial.js"></script>
3059 <script type="text/javascript" src="/static/mercurial.js"></script>
3060
3060
3061 <title>Help: internals.changegroups</title>
3061 <title>Help: internals.changegroups</title>
3062 </head>
3062 </head>
3063 <body>
3063 <body>
3064
3064
3065 <div class="container">
3065 <div class="container">
3066 <div class="menu">
3066 <div class="menu">
3067 <div class="logo">
3067 <div class="logo">
3068 <a href="https://mercurial-scm.org/">
3068 <a href="https://mercurial-scm.org/">
3069 <img src="/static/hglogo.png" alt="mercurial" /></a>
3069 <img src="/static/hglogo.png" alt="mercurial" /></a>
3070 </div>
3070 </div>
3071 <ul>
3071 <ul>
3072 <li><a href="/shortlog">log</a></li>
3072 <li><a href="/shortlog">log</a></li>
3073 <li><a href="/graph">graph</a></li>
3073 <li><a href="/graph">graph</a></li>
3074 <li><a href="/tags">tags</a></li>
3074 <li><a href="/tags">tags</a></li>
3075 <li><a href="/bookmarks">bookmarks</a></li>
3075 <li><a href="/bookmarks">bookmarks</a></li>
3076 <li><a href="/branches">branches</a></li>
3076 <li><a href="/branches">branches</a></li>
3077 </ul>
3077 </ul>
3078 <ul>
3078 <ul>
3079 <li class="active"><a href="/help">help</a></li>
3079 <li class="active"><a href="/help">help</a></li>
3080 </ul>
3080 </ul>
3081 </div>
3081 </div>
3082
3082
3083 <div class="main">
3083 <div class="main">
3084 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3084 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3085 <h3>Help: internals.changegroups</h3>
3085 <h3>Help: internals.changegroups</h3>
3086
3086
3087 <form class="search" action="/log">
3087 <form class="search" action="/log">
3088
3088
3089 <p><input name="rev" id="search1" type="text" size="30" /></p>
3089 <p><input name="rev" id="search1" type="text" size="30" /></p>
3090 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3090 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3091 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3091 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3092 </form>
3092 </form>
3093 <div id="doc">
3093 <div id="doc">
3094 <h1>Changegroups</h1>
3094 <h1>Changegroups</h1>
3095 <p>
3095 <p>
3096 Changegroups are representations of repository revlog data, specifically
3096 Changegroups are representations of repository revlog data, specifically
3097 the changelog data, root/flat manifest data, treemanifest data, and
3097 the changelog data, root/flat manifest data, treemanifest data, and
3098 filelogs.
3098 filelogs.
3099 </p>
3099 </p>
3100 <p>
3100 <p>
3101 There are 3 versions of changegroups: &quot;1&quot;, &quot;2&quot;, and &quot;3&quot;. From a
3101 There are 3 versions of changegroups: &quot;1&quot;, &quot;2&quot;, and &quot;3&quot;. From a
3102 high-level, versions &quot;1&quot; and &quot;2&quot; are almost exactly the same, with the
3102 high-level, versions &quot;1&quot; and &quot;2&quot; are almost exactly the same, with the
3103 only difference being an additional item in the *delta header*. Version
3103 only difference being an additional item in the *delta header*. Version
3104 &quot;3&quot; adds support for revlog flags in the *delta header* and optionally
3104 &quot;3&quot; adds support for revlog flags in the *delta header* and optionally
3105 exchanging treemanifests (enabled by setting an option on the
3105 exchanging treemanifests (enabled by setting an option on the
3106 &quot;changegroup&quot; part in the bundle2).
3106 &quot;changegroup&quot; part in the bundle2).
3107 </p>
3107 </p>
3108 <p>
3108 <p>
3109 Changegroups when not exchanging treemanifests consist of 3 logical
3109 Changegroups when not exchanging treemanifests consist of 3 logical
3110 segments:
3110 segments:
3111 </p>
3111 </p>
3112 <pre>
3112 <pre>
3113 +---------------------------------+
3113 +---------------------------------+
3114 | | | |
3114 | | | |
3115 | changeset | manifest | filelogs |
3115 | changeset | manifest | filelogs |
3116 | | | |
3116 | | | |
3117 | | | |
3117 | | | |
3118 +---------------------------------+
3118 +---------------------------------+
3119 </pre>
3119 </pre>
3120 <p>
3120 <p>
3121 When exchanging treemanifests, there are 4 logical segments:
3121 When exchanging treemanifests, there are 4 logical segments:
3122 </p>
3122 </p>
3123 <pre>
3123 <pre>
3124 +-------------------------------------------------+
3124 +-------------------------------------------------+
3125 | | | | |
3125 | | | | |
3126 | changeset | root | treemanifests | filelogs |
3126 | changeset | root | treemanifests | filelogs |
3127 | | manifest | | |
3127 | | manifest | | |
3128 | | | | |
3128 | | | | |
3129 +-------------------------------------------------+
3129 +-------------------------------------------------+
3130 </pre>
3130 </pre>
3131 <p>
3131 <p>
3132 The principle building block of each segment is a *chunk*. A *chunk*
3132 The principle building block of each segment is a *chunk*. A *chunk*
3133 is a framed piece of data:
3133 is a framed piece of data:
3134 </p>
3134 </p>
3135 <pre>
3135 <pre>
3136 +---------------------------------------+
3136 +---------------------------------------+
3137 | | |
3137 | | |
3138 | length | data |
3138 | length | data |
3139 | (4 bytes) | (&lt;length - 4&gt; bytes) |
3139 | (4 bytes) | (&lt;length - 4&gt; bytes) |
3140 | | |
3140 | | |
3141 +---------------------------------------+
3141 +---------------------------------------+
3142 </pre>
3142 </pre>
3143 <p>
3143 <p>
3144 All integers are big-endian signed integers. Each chunk starts with a 32-bit
3144 All integers are big-endian signed integers. Each chunk starts with a 32-bit
3145 integer indicating the length of the entire chunk (including the length field
3145 integer indicating the length of the entire chunk (including the length field
3146 itself).
3146 itself).
3147 </p>
3147 </p>
3148 <p>
3148 <p>
3149 There is a special case chunk that has a value of 0 for the length
3149 There is a special case chunk that has a value of 0 for the length
3150 (&quot;0x00000000&quot;). We call this an *empty chunk*.
3150 (&quot;0x00000000&quot;). We call this an *empty chunk*.
3151 </p>
3151 </p>
3152 <h2>Delta Groups</h2>
3152 <h2>Delta Groups</h2>
3153 <p>
3153 <p>
3154 A *delta group* expresses the content of a revlog as a series of deltas,
3154 A *delta group* expresses the content of a revlog as a series of deltas,
3155 or patches against previous revisions.
3155 or patches against previous revisions.
3156 </p>
3156 </p>
3157 <p>
3157 <p>
3158 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
3158 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
3159 to signal the end of the delta group:
3159 to signal the end of the delta group:
3160 </p>
3160 </p>
3161 <pre>
3161 <pre>
3162 +------------------------------------------------------------------------+
3162 +------------------------------------------------------------------------+
3163 | | | | | |
3163 | | | | | |
3164 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
3164 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
3165 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
3165 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
3166 | | | | | |
3166 | | | | | |
3167 +------------------------------------------------------------------------+
3167 +------------------------------------------------------------------------+
3168 </pre>
3168 </pre>
3169 <p>
3169 <p>
3170 Each *chunk*'s data consists of the following:
3170 Each *chunk*'s data consists of the following:
3171 </p>
3171 </p>
3172 <pre>
3172 <pre>
3173 +---------------------------------------+
3173 +---------------------------------------+
3174 | | |
3174 | | |
3175 | delta header | delta data |
3175 | delta header | delta data |
3176 | (various by version) | (various) |
3176 | (various by version) | (various) |
3177 | | |
3177 | | |
3178 +---------------------------------------+
3178 +---------------------------------------+
3179 </pre>
3179 </pre>
3180 <p>
3180 <p>
3181 The *delta data* is a series of *delta*s that describe a diff from an existing
3181 The *delta data* is a series of *delta*s that describe a diff from an existing
3182 entry (either that the recipient already has, or previously specified in the
3182 entry (either that the recipient already has, or previously specified in the
3183 bundlei/changegroup).
3183 bundlei/changegroup).
3184 </p>
3184 </p>
3185 <p>
3185 <p>
3186 The *delta header* is different between versions &quot;1&quot;, &quot;2&quot;, and
3186 The *delta header* is different between versions &quot;1&quot;, &quot;2&quot;, and
3187 &quot;3&quot; of the changegroup format.
3187 &quot;3&quot; of the changegroup format.
3188 </p>
3188 </p>
3189 <p>
3189 <p>
3190 Version 1 (headerlen=80):
3190 Version 1 (headerlen=80):
3191 </p>
3191 </p>
3192 <pre>
3192 <pre>
3193 +------------------------------------------------------+
3193 +------------------------------------------------------+
3194 | | | | |
3194 | | | | |
3195 | node | p1 node | p2 node | link node |
3195 | node | p1 node | p2 node | link node |
3196 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3196 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3197 | | | | |
3197 | | | | |
3198 +------------------------------------------------------+
3198 +------------------------------------------------------+
3199 </pre>
3199 </pre>
3200 <p>
3200 <p>
3201 Version 2 (headerlen=100):
3201 Version 2 (headerlen=100):
3202 </p>
3202 </p>
3203 <pre>
3203 <pre>
3204 +------------------------------------------------------------------+
3204 +------------------------------------------------------------------+
3205 | | | | | |
3205 | | | | | |
3206 | node | p1 node | p2 node | base node | link node |
3206 | node | p1 node | p2 node | base node | link node |
3207 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3207 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3208 | | | | | |
3208 | | | | | |
3209 +------------------------------------------------------------------+
3209 +------------------------------------------------------------------+
3210 </pre>
3210 </pre>
3211 <p>
3211 <p>
3212 Version 3 (headerlen=102):
3212 Version 3 (headerlen=102):
3213 </p>
3213 </p>
3214 <pre>
3214 <pre>
3215 +------------------------------------------------------------------------------+
3215 +------------------------------------------------------------------------------+
3216 | | | | | | |
3216 | | | | | | |
3217 | node | p1 node | p2 node | base node | link node | flags |
3217 | node | p1 node | p2 node | base node | link node | flags |
3218 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
3218 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
3219 | | | | | | |
3219 | | | | | | |
3220 +------------------------------------------------------------------------------+
3220 +------------------------------------------------------------------------------+
3221 </pre>
3221 </pre>
3222 <p>
3222 <p>
3223 The *delta data* consists of &quot;chunklen - 4 - headerlen&quot; bytes, which contain a
3223 The *delta data* consists of &quot;chunklen - 4 - headerlen&quot; bytes, which contain a
3224 series of *delta*s, densely packed (no separators). These deltas describe a diff
3224 series of *delta*s, densely packed (no separators). These deltas describe a diff
3225 from an existing entry (either that the recipient already has, or previously
3225 from an existing entry (either that the recipient already has, or previously
3226 specified in the bundle/changegroup). The format is described more fully in
3226 specified in the bundle/changegroup). The format is described more fully in
3227 &quot;hg help internals.bdiff&quot;, but briefly:
3227 &quot;hg help internals.bdiff&quot;, but briefly:
3228 </p>
3228 </p>
3229 <pre>
3229 <pre>
3230 +---------------------------------------------------------------+
3230 +---------------------------------------------------------------+
3231 | | | | |
3231 | | | | |
3232 | start offset | end offset | new length | content |
3232 | start offset | end offset | new length | content |
3233 | (4 bytes) | (4 bytes) | (4 bytes) | (&lt;new length&gt; bytes) |
3233 | (4 bytes) | (4 bytes) | (4 bytes) | (&lt;new length&gt; bytes) |
3234 | | | | |
3234 | | | | |
3235 +---------------------------------------------------------------+
3235 +---------------------------------------------------------------+
3236 </pre>
3236 </pre>
3237 <p>
3237 <p>
3238 Please note that the length field in the delta data does *not* include itself.
3238 Please note that the length field in the delta data does *not* include itself.
3239 </p>
3239 </p>
3240 <p>
3240 <p>
3241 In version 1, the delta is always applied against the previous node from
3241 In version 1, the delta is always applied against the previous node from
3242 the changegroup or the first parent if this is the first entry in the
3242 the changegroup or the first parent if this is the first entry in the
3243 changegroup.
3243 changegroup.
3244 </p>
3244 </p>
3245 <p>
3245 <p>
3246 In version 2 and up, the delta base node is encoded in the entry in the
3246 In version 2 and up, the delta base node is encoded in the entry in the
3247 changegroup. This allows the delta to be expressed against any parent,
3247 changegroup. This allows the delta to be expressed against any parent,
3248 which can result in smaller deltas and more efficient encoding of data.
3248 which can result in smaller deltas and more efficient encoding of data.
3249 </p>
3249 </p>
3250 <h2>Changeset Segment</h2>
3250 <h2>Changeset Segment</h2>
3251 <p>
3251 <p>
3252 The *changeset segment* consists of a single *delta group* holding
3252 The *changeset segment* consists of a single *delta group* holding
3253 changelog data. The *empty chunk* at the end of the *delta group* denotes
3253 changelog data. The *empty chunk* at the end of the *delta group* denotes
3254 the boundary to the *manifest segment*.
3254 the boundary to the *manifest segment*.
3255 </p>
3255 </p>
3256 <h2>Manifest Segment</h2>
3256 <h2>Manifest Segment</h2>
3257 <p>
3257 <p>
3258 The *manifest segment* consists of a single *delta group* holding manifest
3258 The *manifest segment* consists of a single *delta group* holding manifest
3259 data. If treemanifests are in use, it contains only the manifest for the
3259 data. If treemanifests are in use, it contains only the manifest for the
3260 root directory of the repository. Otherwise, it contains the entire
3260 root directory of the repository. Otherwise, it contains the entire
3261 manifest data. The *empty chunk* at the end of the *delta group* denotes
3261 manifest data. The *empty chunk* at the end of the *delta group* denotes
3262 the boundary to the next segment (either the *treemanifests segment* or the
3262 the boundary to the next segment (either the *treemanifests segment* or the
3263 *filelogs segment*, depending on version and the request options).
3263 *filelogs segment*, depending on version and the request options).
3264 </p>
3264 </p>
3265 <h3>Treemanifests Segment</h3>
3265 <h3>Treemanifests Segment</h3>
3266 <p>
3266 <p>
3267 The *treemanifests segment* only exists in changegroup version &quot;3&quot;, and
3267 The *treemanifests segment* only exists in changegroup version &quot;3&quot;, and
3268 only if the 'treemanifest' param is part of the bundle2 changegroup part
3268 only if the 'treemanifest' param is part of the bundle2 changegroup part
3269 (it is not possible to use changegroup version 3 outside of bundle2).
3269 (it is not possible to use changegroup version 3 outside of bundle2).
3270 Aside from the filenames in the *treemanifests segment* containing a
3270 Aside from the filenames in the *treemanifests segment* containing a
3271 trailing &quot;/&quot; character, it behaves identically to the *filelogs segment*
3271 trailing &quot;/&quot; character, it behaves identically to the *filelogs segment*
3272 (see below). The final sub-segment is followed by an *empty chunk* (logically,
3272 (see below). The final sub-segment is followed by an *empty chunk* (logically,
3273 a sub-segment with filename size 0). This denotes the boundary to the
3273 a sub-segment with filename size 0). This denotes the boundary to the
3274 *filelogs segment*.
3274 *filelogs segment*.
3275 </p>
3275 </p>
3276 <h2>Filelogs Segment</h2>
3276 <h2>Filelogs Segment</h2>
3277 <p>
3277 <p>
3278 The *filelogs segment* consists of multiple sub-segments, each
3278 The *filelogs segment* consists of multiple sub-segments, each
3279 corresponding to an individual file whose data is being described:
3279 corresponding to an individual file whose data is being described:
3280 </p>
3280 </p>
3281 <pre>
3281 <pre>
3282 +--------------------------------------------------+
3282 +--------------------------------------------------+
3283 | | | | | |
3283 | | | | | |
3284 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
3284 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
3285 | | | | | (4 bytes) |
3285 | | | | | (4 bytes) |
3286 | | | | | |
3286 | | | | | |
3287 +--------------------------------------------------+
3287 +--------------------------------------------------+
3288 </pre>
3288 </pre>
3289 <p>
3289 <p>
3290 The final filelog sub-segment is followed by an *empty chunk* (logically,
3290 The final filelog sub-segment is followed by an *empty chunk* (logically,
3291 a sub-segment with filename size 0). This denotes the end of the segment
3291 a sub-segment with filename size 0). This denotes the end of the segment
3292 and of the overall changegroup.
3292 and of the overall changegroup.
3293 </p>
3293 </p>
3294 <p>
3294 <p>
3295 Each filelog sub-segment consists of the following:
3295 Each filelog sub-segment consists of the following:
3296 </p>
3296 </p>
3297 <pre>
3297 <pre>
3298 +------------------------------------------------------+
3298 +------------------------------------------------------+
3299 | | | |
3299 | | | |
3300 | filename length | filename | delta group |
3300 | filename length | filename | delta group |
3301 | (4 bytes) | (&lt;length - 4&gt; bytes) | (various) |
3301 | (4 bytes) | (&lt;length - 4&gt; bytes) | (various) |
3302 | | | |
3302 | | | |
3303 +------------------------------------------------------+
3303 +------------------------------------------------------+
3304 </pre>
3304 </pre>
3305 <p>
3305 <p>
3306 That is, a *chunk* consisting of the filename (not terminated or padded)
3306 That is, a *chunk* consisting of the filename (not terminated or padded)
3307 followed by N chunks constituting the *delta group* for this file. The
3307 followed by N chunks constituting the *delta group* for this file. The
3308 *empty chunk* at the end of each *delta group* denotes the boundary to the
3308 *empty chunk* at the end of each *delta group* denotes the boundary to the
3309 next filelog sub-segment.
3309 next filelog sub-segment.
3310 </p>
3310 </p>
3311
3311
3312 </div>
3312 </div>
3313 </div>
3313 </div>
3314 </div>
3314 </div>
3315
3315
3316
3316
3317
3317
3318 </body>
3318 </body>
3319 </html>
3319 </html>
3320
3320
3321
3321
3322 $ killdaemons.py
3322 $ killdaemons.py
3323
3323
3324 #endif
3324 #endif
@@ -1,1646 +1,1646 b''
1 #require serve
1 #require serve
2
2
3 $ request() {
3 $ request() {
4 > get-with-headers.py --json localhost:$HGPORT "$1"
4 > get-with-headers.py --json localhost:$HGPORT "$1"
5 > }
5 > }
6
6
7 $ hg init test
7 $ hg init test
8 $ cd test
8 $ cd test
9 $ mkdir da
9 $ mkdir da
10 $ echo foo > da/foo
10 $ echo foo > da/foo
11 $ echo foo > foo
11 $ echo foo > foo
12 $ hg -q ci -A -m initial
12 $ hg -q ci -A -m initial
13 $ echo bar > foo
13 $ echo bar > foo
14 $ hg ci -m 'modify foo'
14 $ hg ci -m 'modify foo'
15 $ echo bar > da/foo
15 $ echo bar > da/foo
16 $ hg ci -m 'modify da/foo'
16 $ hg ci -m 'modify da/foo'
17 $ hg bookmark bookmark1
17 $ hg bookmark bookmark1
18 $ hg up default
18 $ hg up default
19 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
19 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
20 (leaving bookmark bookmark1)
20 (leaving bookmark bookmark1)
21 $ hg mv foo foo-new
21 $ hg mv foo foo-new
22 $ hg commit -m 'move foo'
22 $ hg commit -m 'move foo'
23 $ hg tag -m 'create tag' tag1
23 $ hg tag -m 'create tag' tag1
24 $ hg phase --public -r .
24 $ hg phase --public -r .
25 $ echo baz > da/foo
25 $ echo baz > da/foo
26 $ hg commit -m 'another commit to da/foo'
26 $ hg commit -m 'another commit to da/foo'
27 $ hg tag -m 'create tag2' tag2
27 $ hg tag -m 'create tag2' tag2
28 $ hg bookmark bookmark2
28 $ hg bookmark bookmark2
29 $ hg -q up -r 0
29 $ hg -q up -r 0
30 $ hg -q branch test-branch
30 $ hg -q branch test-branch
31 $ echo branch > foo
31 $ echo branch > foo
32 $ hg commit -m 'create test branch'
32 $ hg commit -m 'create test branch'
33 $ echo branch_commit_2 > foo
33 $ echo branch_commit_2 > foo
34 $ hg commit -m 'another commit in test-branch'
34 $ hg commit -m 'another commit in test-branch'
35 $ hg -q up default
35 $ hg -q up default
36 $ hg merge --tool :local test-branch
36 $ hg merge --tool :local test-branch
37 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
37 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
38 (branch merge, don't forget to commit)
38 (branch merge, don't forget to commit)
39 $ hg commit -m 'merge test-branch into default'
39 $ hg commit -m 'merge test-branch into default'
40
40
41 $ hg log -G
41 $ hg log -G
42 @ changeset: 9:cc725e08502a
42 @ changeset: 9:cc725e08502a
43 |\ tag: tip
43 |\ tag: tip
44 | | parent: 6:ceed296fe500
44 | | parent: 6:ceed296fe500
45 | | parent: 8:ed66c30e87eb
45 | | parent: 8:ed66c30e87eb
46 | | user: test
46 | | user: test
47 | | date: Thu Jan 01 00:00:00 1970 +0000
47 | | date: Thu Jan 01 00:00:00 1970 +0000
48 | | summary: merge test-branch into default
48 | | summary: merge test-branch into default
49 | |
49 | |
50 | o changeset: 8:ed66c30e87eb
50 | o changeset: 8:ed66c30e87eb
51 | | branch: test-branch
51 | | branch: test-branch
52 | | user: test
52 | | user: test
53 | | date: Thu Jan 01 00:00:00 1970 +0000
53 | | date: Thu Jan 01 00:00:00 1970 +0000
54 | | summary: another commit in test-branch
54 | | summary: another commit in test-branch
55 | |
55 | |
56 | o changeset: 7:6ab967a8ab34
56 | o changeset: 7:6ab967a8ab34
57 | | branch: test-branch
57 | | branch: test-branch
58 | | parent: 0:06e557f3edf6
58 | | parent: 0:06e557f3edf6
59 | | user: test
59 | | user: test
60 | | date: Thu Jan 01 00:00:00 1970 +0000
60 | | date: Thu Jan 01 00:00:00 1970 +0000
61 | | summary: create test branch
61 | | summary: create test branch
62 | |
62 | |
63 o | changeset: 6:ceed296fe500
63 o | changeset: 6:ceed296fe500
64 | | bookmark: bookmark2
64 | | bookmark: bookmark2
65 | | user: test
65 | | user: test
66 | | date: Thu Jan 01 00:00:00 1970 +0000
66 | | date: Thu Jan 01 00:00:00 1970 +0000
67 | | summary: create tag2
67 | | summary: create tag2
68 | |
68 | |
69 o | changeset: 5:f2890a05fea4
69 o | changeset: 5:f2890a05fea4
70 | | tag: tag2
70 | | tag: tag2
71 | | user: test
71 | | user: test
72 | | date: Thu Jan 01 00:00:00 1970 +0000
72 | | date: Thu Jan 01 00:00:00 1970 +0000
73 | | summary: another commit to da/foo
73 | | summary: another commit to da/foo
74 | |
74 | |
75 o | changeset: 4:93a8ce14f891
75 o | changeset: 4:93a8ce14f891
76 | | user: test
76 | | user: test
77 | | date: Thu Jan 01 00:00:00 1970 +0000
77 | | date: Thu Jan 01 00:00:00 1970 +0000
78 | | summary: create tag
78 | | summary: create tag
79 | |
79 | |
80 o | changeset: 3:78896eb0e102
80 o | changeset: 3:78896eb0e102
81 | | tag: tag1
81 | | tag: tag1
82 | | user: test
82 | | user: test
83 | | date: Thu Jan 01 00:00:00 1970 +0000
83 | | date: Thu Jan 01 00:00:00 1970 +0000
84 | | summary: move foo
84 | | summary: move foo
85 | |
85 | |
86 o | changeset: 2:8d7c456572ac
86 o | changeset: 2:8d7c456572ac
87 | | bookmark: bookmark1
87 | | bookmark: bookmark1
88 | | user: test
88 | | user: test
89 | | date: Thu Jan 01 00:00:00 1970 +0000
89 | | date: Thu Jan 01 00:00:00 1970 +0000
90 | | summary: modify da/foo
90 | | summary: modify da/foo
91 | |
91 | |
92 o | changeset: 1:f8bbb9024b10
92 o | changeset: 1:f8bbb9024b10
93 |/ user: test
93 |/ user: test
94 | date: Thu Jan 01 00:00:00 1970 +0000
94 | date: Thu Jan 01 00:00:00 1970 +0000
95 | summary: modify foo
95 | summary: modify foo
96 |
96 |
97 o changeset: 0:06e557f3edf6
97 o changeset: 0:06e557f3edf6
98 user: test
98 user: test
99 date: Thu Jan 01 00:00:00 1970 +0000
99 date: Thu Jan 01 00:00:00 1970 +0000
100 summary: initial
100 summary: initial
101
101
102
102
103 $ echo '[web]' >> .hg/hgrc
103 $ echo '[web]' >> .hg/hgrc
104 $ echo 'allow_archive = bz2' >> .hg/hgrc
104 $ echo 'allow_archive = bz2' >> .hg/hgrc
105 $ hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log -E error.log
105 $ hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log -E error.log
106 $ cat hg.pid >> $DAEMON_PIDS
106 $ cat hg.pid >> $DAEMON_PIDS
107
107
108 (Try to keep these in roughly the order they are defined in webcommands.py)
108 (Try to keep these in roughly the order they are defined in webcommands.py)
109
109
110 (log is handled by filelog/ and changelog/ - ignore it)
110 (log is handled by filelog/ and changelog/ - ignore it)
111
111
112 (rawfile/ doesn't use templating - nothing to test)
112 (rawfile/ doesn't use templating - nothing to test)
113
113
114 file/{revision}/{path} shows file revision
114 file/{revision}/{path} shows file revision
115
115
116 $ request json-file/78896eb0e102/foo-new
116 $ request json-file/78896eb0e102/foo-new
117 200 Script output follows
117 200 Script output follows
118
118
119 {
119 {
120 "bookmarks": [],
120 "bookmarks": [],
121 "branch": "default",
121 "branch": "default",
122 "date": [
122 "date": [
123 0.0,
123 0.0,
124 0
124 0
125 ],
125 ],
126 "desc": "move foo",
126 "desc": "move foo",
127 "lines": [
127 "lines": [
128 {
128 {
129 "line": "bar\n"
129 "line": "bar\n"
130 }
130 }
131 ],
131 ],
132 "node": "78896eb0e102174ce9278438a95e12543e4367a7",
132 "node": "78896eb0e102174ce9278438a95e12543e4367a7",
133 "parents": [
133 "parents": [
134 "f8bbb9024b10f93cdbb8d940337398291d40dea8"
134 "f8bbb9024b10f93cdbb8d940337398291d40dea8"
135 ],
135 ],
136 "path": "foo-new",
136 "path": "foo-new",
137 "phase": "public",
137 "phase": "public",
138 "tags": [
138 "tags": [
139 "tag1"
139 "tag1"
140 ],
140 ],
141 "user": "test"
141 "user": "test"
142 }
142 }
143
143
144 file/{revision} shows root directory info
144 file/{revision} shows root directory info
145
145
146 $ request json-file/cc725e08502a
146 $ request json-file/cc725e08502a
147 200 Script output follows
147 200 Script output follows
148
148
149 {
149 {
150 "abspath": "/",
150 "abspath": "/",
151 "bookmarks": [],
151 "bookmarks": [],
152 "directories": [
152 "directories": [
153 {
153 {
154 "abspath": "/da",
154 "abspath": "/da",
155 "basename": "da",
155 "basename": "da",
156 "emptydirs": ""
156 "emptydirs": ""
157 }
157 }
158 ],
158 ],
159 "files": [
159 "files": [
160 {
160 {
161 "abspath": ".hgtags",
161 "abspath": ".hgtags",
162 "basename": ".hgtags",
162 "basename": ".hgtags",
163 "date": [
163 "date": [
164 0.0,
164 0.0,
165 0
165 0
166 ],
166 ],
167 "flags": "",
167 "flags": "",
168 "size": 92
168 "size": 92
169 },
169 },
170 {
170 {
171 "abspath": "foo-new",
171 "abspath": "foo-new",
172 "basename": "foo-new",
172 "basename": "foo-new",
173 "date": [
173 "date": [
174 0.0,
174 0.0,
175 0
175 0
176 ],
176 ],
177 "flags": "",
177 "flags": "",
178 "size": 4
178 "size": 4
179 }
179 }
180 ],
180 ],
181 "node": "cc725e08502a79dd1eda913760fbe06ed7a9abc7",
181 "node": "cc725e08502a79dd1eda913760fbe06ed7a9abc7",
182 "tags": [
182 "tags": [
183 "tip"
183 "tip"
184 ]
184 ]
185 }
185 }
186
186
187 changelog/ shows information about several changesets
187 changelog/ shows information about several changesets
188
188
189 $ request json-changelog
189 $ request json-changelog
190 200 Script output follows
190 200 Script output follows
191
191
192 {
192 {
193 "changeset_count": 10,
193 "changeset_count": 10,
194 "changesets": [
194 "changesets": [
195 {
195 {
196 "bookmarks": [],
196 "bookmarks": [],
197 "branch": "default",
197 "branch": "default",
198 "date": [
198 "date": [
199 0.0,
199 0.0,
200 0
200 0
201 ],
201 ],
202 "desc": "merge test-branch into default",
202 "desc": "merge test-branch into default",
203 "node": "cc725e08502a79dd1eda913760fbe06ed7a9abc7",
203 "node": "cc725e08502a79dd1eda913760fbe06ed7a9abc7",
204 "parents": [
204 "parents": [
205 "ceed296fe500c3fac9541e31dad860cb49c89e45",
205 "ceed296fe500c3fac9541e31dad860cb49c89e45",
206 "ed66c30e87eb65337c05a4229efaa5f1d5285a90"
206 "ed66c30e87eb65337c05a4229efaa5f1d5285a90"
207 ],
207 ],
208 "phase": "draft",
208 "phase": "draft",
209 "tags": [
209 "tags": [
210 "tip"
210 "tip"
211 ],
211 ],
212 "user": "test"
212 "user": "test"
213 },
213 },
214 {
214 {
215 "bookmarks": [],
215 "bookmarks": [],
216 "branch": "test-branch",
216 "branch": "test-branch",
217 "date": [
217 "date": [
218 0.0,
218 0.0,
219 0
219 0
220 ],
220 ],
221 "desc": "another commit in test-branch",
221 "desc": "another commit in test-branch",
222 "node": "ed66c30e87eb65337c05a4229efaa5f1d5285a90",
222 "node": "ed66c30e87eb65337c05a4229efaa5f1d5285a90",
223 "parents": [
223 "parents": [
224 "6ab967a8ab3489227a83f80e920faa039a71819f"
224 "6ab967a8ab3489227a83f80e920faa039a71819f"
225 ],
225 ],
226 "phase": "draft",
226 "phase": "draft",
227 "tags": [],
227 "tags": [],
228 "user": "test"
228 "user": "test"
229 },
229 },
230 {
230 {
231 "bookmarks": [],
231 "bookmarks": [],
232 "branch": "test-branch",
232 "branch": "test-branch",
233 "date": [
233 "date": [
234 0.0,
234 0.0,
235 0
235 0
236 ],
236 ],
237 "desc": "create test branch",
237 "desc": "create test branch",
238 "node": "6ab967a8ab3489227a83f80e920faa039a71819f",
238 "node": "6ab967a8ab3489227a83f80e920faa039a71819f",
239 "parents": [
239 "parents": [
240 "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e"
240 "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e"
241 ],
241 ],
242 "phase": "draft",
242 "phase": "draft",
243 "tags": [],
243 "tags": [],
244 "user": "test"
244 "user": "test"
245 },
245 },
246 {
246 {
247 "bookmarks": [
247 "bookmarks": [
248 "bookmark2"
248 "bookmark2"
249 ],
249 ],
250 "branch": "default",
250 "branch": "default",
251 "date": [
251 "date": [
252 0.0,
252 0.0,
253 0
253 0
254 ],
254 ],
255 "desc": "create tag2",
255 "desc": "create tag2",
256 "node": "ceed296fe500c3fac9541e31dad860cb49c89e45",
256 "node": "ceed296fe500c3fac9541e31dad860cb49c89e45",
257 "parents": [
257 "parents": [
258 "f2890a05fea49bfaf9fb27ed5490894eba32da78"
258 "f2890a05fea49bfaf9fb27ed5490894eba32da78"
259 ],
259 ],
260 "phase": "draft",
260 "phase": "draft",
261 "tags": [],
261 "tags": [],
262 "user": "test"
262 "user": "test"
263 },
263 },
264 {
264 {
265 "bookmarks": [],
265 "bookmarks": [],
266 "branch": "default",
266 "branch": "default",
267 "date": [
267 "date": [
268 0.0,
268 0.0,
269 0
269 0
270 ],
270 ],
271 "desc": "another commit to da/foo",
271 "desc": "another commit to da/foo",
272 "node": "f2890a05fea49bfaf9fb27ed5490894eba32da78",
272 "node": "f2890a05fea49bfaf9fb27ed5490894eba32da78",
273 "parents": [
273 "parents": [
274 "93a8ce14f89156426b7fa981af8042da53f03aa0"
274 "93a8ce14f89156426b7fa981af8042da53f03aa0"
275 ],
275 ],
276 "phase": "draft",
276 "phase": "draft",
277 "tags": [
277 "tags": [
278 "tag2"
278 "tag2"
279 ],
279 ],
280 "user": "test"
280 "user": "test"
281 },
281 },
282 {
282 {
283 "bookmarks": [],
283 "bookmarks": [],
284 "branch": "default",
284 "branch": "default",
285 "date": [
285 "date": [
286 0.0,
286 0.0,
287 0
287 0
288 ],
288 ],
289 "desc": "create tag",
289 "desc": "create tag",
290 "node": "93a8ce14f89156426b7fa981af8042da53f03aa0",
290 "node": "93a8ce14f89156426b7fa981af8042da53f03aa0",
291 "parents": [
291 "parents": [
292 "78896eb0e102174ce9278438a95e12543e4367a7"
292 "78896eb0e102174ce9278438a95e12543e4367a7"
293 ],
293 ],
294 "phase": "public",
294 "phase": "public",
295 "tags": [],
295 "tags": [],
296 "user": "test"
296 "user": "test"
297 },
297 },
298 {
298 {
299 "bookmarks": [],
299 "bookmarks": [],
300 "branch": "default",
300 "branch": "default",
301 "date": [
301 "date": [
302 0.0,
302 0.0,
303 0
303 0
304 ],
304 ],
305 "desc": "move foo",
305 "desc": "move foo",
306 "node": "78896eb0e102174ce9278438a95e12543e4367a7",
306 "node": "78896eb0e102174ce9278438a95e12543e4367a7",
307 "parents": [
307 "parents": [
308 "8d7c456572acf3557e8ed8a07286b10c408bcec5"
308 "8d7c456572acf3557e8ed8a07286b10c408bcec5"
309 ],
309 ],
310 "phase": "public",
310 "phase": "public",
311 "tags": [
311 "tags": [
312 "tag1"
312 "tag1"
313 ],
313 ],
314 "user": "test"
314 "user": "test"
315 },
315 },
316 {
316 {
317 "bookmarks": [
317 "bookmarks": [
318 "bookmark1"
318 "bookmark1"
319 ],
319 ],
320 "branch": "default",
320 "branch": "default",
321 "date": [
321 "date": [
322 0.0,
322 0.0,
323 0
323 0
324 ],
324 ],
325 "desc": "modify da/foo",
325 "desc": "modify da/foo",
326 "node": "8d7c456572acf3557e8ed8a07286b10c408bcec5",
326 "node": "8d7c456572acf3557e8ed8a07286b10c408bcec5",
327 "parents": [
327 "parents": [
328 "f8bbb9024b10f93cdbb8d940337398291d40dea8"
328 "f8bbb9024b10f93cdbb8d940337398291d40dea8"
329 ],
329 ],
330 "phase": "public",
330 "phase": "public",
331 "tags": [],
331 "tags": [],
332 "user": "test"
332 "user": "test"
333 },
333 },
334 {
334 {
335 "bookmarks": [],
335 "bookmarks": [],
336 "branch": "default",
336 "branch": "default",
337 "date": [
337 "date": [
338 0.0,
338 0.0,
339 0
339 0
340 ],
340 ],
341 "desc": "modify foo",
341 "desc": "modify foo",
342 "node": "f8bbb9024b10f93cdbb8d940337398291d40dea8",
342 "node": "f8bbb9024b10f93cdbb8d940337398291d40dea8",
343 "parents": [
343 "parents": [
344 "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e"
344 "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e"
345 ],
345 ],
346 "phase": "public",
346 "phase": "public",
347 "tags": [],
347 "tags": [],
348 "user": "test"
348 "user": "test"
349 },
349 },
350 {
350 {
351 "bookmarks": [],
351 "bookmarks": [],
352 "branch": "default",
352 "branch": "default",
353 "date": [
353 "date": [
354 0.0,
354 0.0,
355 0
355 0
356 ],
356 ],
357 "desc": "initial",
357 "desc": "initial",
358 "node": "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e",
358 "node": "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e",
359 "parents": [],
359 "parents": [],
360 "phase": "public",
360 "phase": "public",
361 "tags": [],
361 "tags": [],
362 "user": "test"
362 "user": "test"
363 }
363 }
364 ],
364 ],
365 "node": "cc725e08502a79dd1eda913760fbe06ed7a9abc7"
365 "node": "cc725e08502a79dd1eda913760fbe06ed7a9abc7"
366 }
366 }
367
367
368 changelog/{revision} shows information starting at a specific changeset
368 changelog/{revision} shows information starting at a specific changeset
369
369
370 $ request json-changelog/f8bbb9024b10
370 $ request json-changelog/f8bbb9024b10
371 200 Script output follows
371 200 Script output follows
372
372
373 {
373 {
374 "changeset_count": 10,
374 "changeset_count": 10,
375 "changesets": [
375 "changesets": [
376 {
376 {
377 "bookmarks": [],
377 "bookmarks": [],
378 "branch": "default",
378 "branch": "default",
379 "date": [
379 "date": [
380 0.0,
380 0.0,
381 0
381 0
382 ],
382 ],
383 "desc": "modify foo",
383 "desc": "modify foo",
384 "node": "f8bbb9024b10f93cdbb8d940337398291d40dea8",
384 "node": "f8bbb9024b10f93cdbb8d940337398291d40dea8",
385 "parents": [
385 "parents": [
386 "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e"
386 "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e"
387 ],
387 ],
388 "phase": "public",
388 "phase": "public",
389 "tags": [],
389 "tags": [],
390 "user": "test"
390 "user": "test"
391 },
391 },
392 {
392 {
393 "bookmarks": [],
393 "bookmarks": [],
394 "branch": "default",
394 "branch": "default",
395 "date": [
395 "date": [
396 0.0,
396 0.0,
397 0
397 0
398 ],
398 ],
399 "desc": "initial",
399 "desc": "initial",
400 "node": "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e",
400 "node": "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e",
401 "parents": [],
401 "parents": [],
402 "phase": "public",
402 "phase": "public",
403 "tags": [],
403 "tags": [],
404 "user": "test"
404 "user": "test"
405 }
405 }
406 ],
406 ],
407 "node": "f8bbb9024b10f93cdbb8d940337398291d40dea8"
407 "node": "f8bbb9024b10f93cdbb8d940337398291d40dea8"
408 }
408 }
409
409
410 shortlog/ shows information about a set of changesets
410 shortlog/ shows information about a set of changesets
411
411
412 $ request json-shortlog
412 $ request json-shortlog
413 200 Script output follows
413 200 Script output follows
414
414
415 {
415 {
416 "changeset_count": 10,
416 "changeset_count": 10,
417 "changesets": [
417 "changesets": [
418 {
418 {
419 "bookmarks": [],
419 "bookmarks": [],
420 "branch": "default",
420 "branch": "default",
421 "date": [
421 "date": [
422 0.0,
422 0.0,
423 0
423 0
424 ],
424 ],
425 "desc": "merge test-branch into default",
425 "desc": "merge test-branch into default",
426 "node": "cc725e08502a79dd1eda913760fbe06ed7a9abc7",
426 "node": "cc725e08502a79dd1eda913760fbe06ed7a9abc7",
427 "parents": [
427 "parents": [
428 "ceed296fe500c3fac9541e31dad860cb49c89e45",
428 "ceed296fe500c3fac9541e31dad860cb49c89e45",
429 "ed66c30e87eb65337c05a4229efaa5f1d5285a90"
429 "ed66c30e87eb65337c05a4229efaa5f1d5285a90"
430 ],
430 ],
431 "phase": "draft",
431 "phase": "draft",
432 "tags": [
432 "tags": [
433 "tip"
433 "tip"
434 ],
434 ],
435 "user": "test"
435 "user": "test"
436 },
436 },
437 {
437 {
438 "bookmarks": [],
438 "bookmarks": [],
439 "branch": "test-branch",
439 "branch": "test-branch",
440 "date": [
440 "date": [
441 0.0,
441 0.0,
442 0
442 0
443 ],
443 ],
444 "desc": "another commit in test-branch",
444 "desc": "another commit in test-branch",
445 "node": "ed66c30e87eb65337c05a4229efaa5f1d5285a90",
445 "node": "ed66c30e87eb65337c05a4229efaa5f1d5285a90",
446 "parents": [
446 "parents": [
447 "6ab967a8ab3489227a83f80e920faa039a71819f"
447 "6ab967a8ab3489227a83f80e920faa039a71819f"
448 ],
448 ],
449 "phase": "draft",
449 "phase": "draft",
450 "tags": [],
450 "tags": [],
451 "user": "test"
451 "user": "test"
452 },
452 },
453 {
453 {
454 "bookmarks": [],
454 "bookmarks": [],
455 "branch": "test-branch",
455 "branch": "test-branch",
456 "date": [
456 "date": [
457 0.0,
457 0.0,
458 0
458 0
459 ],
459 ],
460 "desc": "create test branch",
460 "desc": "create test branch",
461 "node": "6ab967a8ab3489227a83f80e920faa039a71819f",
461 "node": "6ab967a8ab3489227a83f80e920faa039a71819f",
462 "parents": [
462 "parents": [
463 "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e"
463 "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e"
464 ],
464 ],
465 "phase": "draft",
465 "phase": "draft",
466 "tags": [],
466 "tags": [],
467 "user": "test"
467 "user": "test"
468 },
468 },
469 {
469 {
470 "bookmarks": [
470 "bookmarks": [
471 "bookmark2"
471 "bookmark2"
472 ],
472 ],
473 "branch": "default",
473 "branch": "default",
474 "date": [
474 "date": [
475 0.0,
475 0.0,
476 0
476 0
477 ],
477 ],
478 "desc": "create tag2",
478 "desc": "create tag2",
479 "node": "ceed296fe500c3fac9541e31dad860cb49c89e45",
479 "node": "ceed296fe500c3fac9541e31dad860cb49c89e45",
480 "parents": [
480 "parents": [
481 "f2890a05fea49bfaf9fb27ed5490894eba32da78"
481 "f2890a05fea49bfaf9fb27ed5490894eba32da78"
482 ],
482 ],
483 "phase": "draft",
483 "phase": "draft",
484 "tags": [],
484 "tags": [],
485 "user": "test"
485 "user": "test"
486 },
486 },
487 {
487 {
488 "bookmarks": [],
488 "bookmarks": [],
489 "branch": "default",
489 "branch": "default",
490 "date": [
490 "date": [
491 0.0,
491 0.0,
492 0
492 0
493 ],
493 ],
494 "desc": "another commit to da/foo",
494 "desc": "another commit to da/foo",
495 "node": "f2890a05fea49bfaf9fb27ed5490894eba32da78",
495 "node": "f2890a05fea49bfaf9fb27ed5490894eba32da78",
496 "parents": [
496 "parents": [
497 "93a8ce14f89156426b7fa981af8042da53f03aa0"
497 "93a8ce14f89156426b7fa981af8042da53f03aa0"
498 ],
498 ],
499 "phase": "draft",
499 "phase": "draft",
500 "tags": [
500 "tags": [
501 "tag2"
501 "tag2"
502 ],
502 ],
503 "user": "test"
503 "user": "test"
504 },
504 },
505 {
505 {
506 "bookmarks": [],
506 "bookmarks": [],
507 "branch": "default",
507 "branch": "default",
508 "date": [
508 "date": [
509 0.0,
509 0.0,
510 0
510 0
511 ],
511 ],
512 "desc": "create tag",
512 "desc": "create tag",
513 "node": "93a8ce14f89156426b7fa981af8042da53f03aa0",
513 "node": "93a8ce14f89156426b7fa981af8042da53f03aa0",
514 "parents": [
514 "parents": [
515 "78896eb0e102174ce9278438a95e12543e4367a7"
515 "78896eb0e102174ce9278438a95e12543e4367a7"
516 ],
516 ],
517 "phase": "public",
517 "phase": "public",
518 "tags": [],
518 "tags": [],
519 "user": "test"
519 "user": "test"
520 },
520 },
521 {
521 {
522 "bookmarks": [],
522 "bookmarks": [],
523 "branch": "default",
523 "branch": "default",
524 "date": [
524 "date": [
525 0.0,
525 0.0,
526 0
526 0
527 ],
527 ],
528 "desc": "move foo",
528 "desc": "move foo",
529 "node": "78896eb0e102174ce9278438a95e12543e4367a7",
529 "node": "78896eb0e102174ce9278438a95e12543e4367a7",
530 "parents": [
530 "parents": [
531 "8d7c456572acf3557e8ed8a07286b10c408bcec5"
531 "8d7c456572acf3557e8ed8a07286b10c408bcec5"
532 ],
532 ],
533 "phase": "public",
533 "phase": "public",
534 "tags": [
534 "tags": [
535 "tag1"
535 "tag1"
536 ],
536 ],
537 "user": "test"
537 "user": "test"
538 },
538 },
539 {
539 {
540 "bookmarks": [
540 "bookmarks": [
541 "bookmark1"
541 "bookmark1"
542 ],
542 ],
543 "branch": "default",
543 "branch": "default",
544 "date": [
544 "date": [
545 0.0,
545 0.0,
546 0
546 0
547 ],
547 ],
548 "desc": "modify da/foo",
548 "desc": "modify da/foo",
549 "node": "8d7c456572acf3557e8ed8a07286b10c408bcec5",
549 "node": "8d7c456572acf3557e8ed8a07286b10c408bcec5",
550 "parents": [
550 "parents": [
551 "f8bbb9024b10f93cdbb8d940337398291d40dea8"
551 "f8bbb9024b10f93cdbb8d940337398291d40dea8"
552 ],
552 ],
553 "phase": "public",
553 "phase": "public",
554 "tags": [],
554 "tags": [],
555 "user": "test"
555 "user": "test"
556 },
556 },
557 {
557 {
558 "bookmarks": [],
558 "bookmarks": [],
559 "branch": "default",
559 "branch": "default",
560 "date": [
560 "date": [
561 0.0,
561 0.0,
562 0
562 0
563 ],
563 ],
564 "desc": "modify foo",
564 "desc": "modify foo",
565 "node": "f8bbb9024b10f93cdbb8d940337398291d40dea8",
565 "node": "f8bbb9024b10f93cdbb8d940337398291d40dea8",
566 "parents": [
566 "parents": [
567 "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e"
567 "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e"
568 ],
568 ],
569 "phase": "public",
569 "phase": "public",
570 "tags": [],
570 "tags": [],
571 "user": "test"
571 "user": "test"
572 },
572 },
573 {
573 {
574 "bookmarks": [],
574 "bookmarks": [],
575 "branch": "default",
575 "branch": "default",
576 "date": [
576 "date": [
577 0.0,
577 0.0,
578 0
578 0
579 ],
579 ],
580 "desc": "initial",
580 "desc": "initial",
581 "node": "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e",
581 "node": "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e",
582 "parents": [],
582 "parents": [],
583 "phase": "public",
583 "phase": "public",
584 "tags": [],
584 "tags": [],
585 "user": "test"
585 "user": "test"
586 }
586 }
587 ],
587 ],
588 "node": "cc725e08502a79dd1eda913760fbe06ed7a9abc7"
588 "node": "cc725e08502a79dd1eda913760fbe06ed7a9abc7"
589 }
589 }
590
590
591 changeset/ renders the tip changeset
591 changeset/ renders the tip changeset
592
592
593 $ request json-rev
593 $ request json-rev
594 200 Script output follows
594 200 Script output follows
595
595
596 {
596 {
597 "bookmarks": [],
597 "bookmarks": [],
598 "branch": "default",
598 "branch": "default",
599 "date": [
599 "date": [
600 0.0,
600 0.0,
601 0
601 0
602 ],
602 ],
603 "desc": "merge test-branch into default",
603 "desc": "merge test-branch into default",
604 "node": "cc725e08502a79dd1eda913760fbe06ed7a9abc7",
604 "node": "cc725e08502a79dd1eda913760fbe06ed7a9abc7",
605 "parents": [
605 "parents": [
606 "ceed296fe500c3fac9541e31dad860cb49c89e45",
606 "ceed296fe500c3fac9541e31dad860cb49c89e45",
607 "ed66c30e87eb65337c05a4229efaa5f1d5285a90"
607 "ed66c30e87eb65337c05a4229efaa5f1d5285a90"
608 ],
608 ],
609 "phase": "draft",
609 "phase": "draft",
610 "tags": [
610 "tags": [
611 "tip"
611 "tip"
612 ],
612 ],
613 "user": "test"
613 "user": "test"
614 }
614 }
615
615
616 changeset/{revision} shows tags
616 changeset/{revision} shows tags
617
617
618 $ request json-rev/78896eb0e102
618 $ request json-rev/78896eb0e102
619 200 Script output follows
619 200 Script output follows
620
620
621 {
621 {
622 "bookmarks": [],
622 "bookmarks": [],
623 "branch": "default",
623 "branch": "default",
624 "date": [
624 "date": [
625 0.0,
625 0.0,
626 0
626 0
627 ],
627 ],
628 "desc": "move foo",
628 "desc": "move foo",
629 "node": "78896eb0e102174ce9278438a95e12543e4367a7",
629 "node": "78896eb0e102174ce9278438a95e12543e4367a7",
630 "parents": [
630 "parents": [
631 "8d7c456572acf3557e8ed8a07286b10c408bcec5"
631 "8d7c456572acf3557e8ed8a07286b10c408bcec5"
632 ],
632 ],
633 "phase": "public",
633 "phase": "public",
634 "tags": [
634 "tags": [
635 "tag1"
635 "tag1"
636 ],
636 ],
637 "user": "test"
637 "user": "test"
638 }
638 }
639
639
640 changeset/{revision} shows bookmarks
640 changeset/{revision} shows bookmarks
641
641
642 $ request json-rev/8d7c456572ac
642 $ request json-rev/8d7c456572ac
643 200 Script output follows
643 200 Script output follows
644
644
645 {
645 {
646 "bookmarks": [
646 "bookmarks": [
647 "bookmark1"
647 "bookmark1"
648 ],
648 ],
649 "branch": "default",
649 "branch": "default",
650 "date": [
650 "date": [
651 0.0,
651 0.0,
652 0
652 0
653 ],
653 ],
654 "desc": "modify da/foo",
654 "desc": "modify da/foo",
655 "node": "8d7c456572acf3557e8ed8a07286b10c408bcec5",
655 "node": "8d7c456572acf3557e8ed8a07286b10c408bcec5",
656 "parents": [
656 "parents": [
657 "f8bbb9024b10f93cdbb8d940337398291d40dea8"
657 "f8bbb9024b10f93cdbb8d940337398291d40dea8"
658 ],
658 ],
659 "phase": "public",
659 "phase": "public",
660 "tags": [],
660 "tags": [],
661 "user": "test"
661 "user": "test"
662 }
662 }
663
663
664 changeset/{revision} shows branches
664 changeset/{revision} shows branches
665
665
666 $ request json-rev/6ab967a8ab34
666 $ request json-rev/6ab967a8ab34
667 200 Script output follows
667 200 Script output follows
668
668
669 {
669 {
670 "bookmarks": [],
670 "bookmarks": [],
671 "branch": "test-branch",
671 "branch": "test-branch",
672 "date": [
672 "date": [
673 0.0,
673 0.0,
674 0
674 0
675 ],
675 ],
676 "desc": "create test branch",
676 "desc": "create test branch",
677 "node": "6ab967a8ab3489227a83f80e920faa039a71819f",
677 "node": "6ab967a8ab3489227a83f80e920faa039a71819f",
678 "parents": [
678 "parents": [
679 "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e"
679 "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e"
680 ],
680 ],
681 "phase": "draft",
681 "phase": "draft",
682 "tags": [],
682 "tags": [],
683 "user": "test"
683 "user": "test"
684 }
684 }
685
685
686 manifest/{revision}/{path} shows info about a directory at a revision
686 manifest/{revision}/{path} shows info about a directory at a revision
687
687
688 $ request json-manifest/06e557f3edf6/
688 $ request json-manifest/06e557f3edf6/
689 200 Script output follows
689 200 Script output follows
690
690
691 {
691 {
692 "abspath": "/",
692 "abspath": "/",
693 "bookmarks": [],
693 "bookmarks": [],
694 "directories": [
694 "directories": [
695 {
695 {
696 "abspath": "/da",
696 "abspath": "/da",
697 "basename": "da",
697 "basename": "da",
698 "emptydirs": ""
698 "emptydirs": ""
699 }
699 }
700 ],
700 ],
701 "files": [
701 "files": [
702 {
702 {
703 "abspath": "foo",
703 "abspath": "foo",
704 "basename": "foo",
704 "basename": "foo",
705 "date": [
705 "date": [
706 0.0,
706 0.0,
707 0
707 0
708 ],
708 ],
709 "flags": "",
709 "flags": "",
710 "size": 4
710 "size": 4
711 }
711 }
712 ],
712 ],
713 "node": "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e",
713 "node": "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e",
714 "tags": []
714 "tags": []
715 }
715 }
716
716
717 tags/ shows tags info
717 tags/ shows tags info
718
718
719 $ request json-tags
719 $ request json-tags
720 200 Script output follows
720 200 Script output follows
721
721
722 {
722 {
723 "node": "cc725e08502a79dd1eda913760fbe06ed7a9abc7",
723 "node": "cc725e08502a79dd1eda913760fbe06ed7a9abc7",
724 "tags": [
724 "tags": [
725 {
725 {
726 "date": [
726 "date": [
727 0.0,
727 0.0,
728 0
728 0
729 ],
729 ],
730 "node": "f2890a05fea49bfaf9fb27ed5490894eba32da78",
730 "node": "f2890a05fea49bfaf9fb27ed5490894eba32da78",
731 "tag": "tag2"
731 "tag": "tag2"
732 },
732 },
733 {
733 {
734 "date": [
734 "date": [
735 0.0,
735 0.0,
736 0
736 0
737 ],
737 ],
738 "node": "78896eb0e102174ce9278438a95e12543e4367a7",
738 "node": "78896eb0e102174ce9278438a95e12543e4367a7",
739 "tag": "tag1"
739 "tag": "tag1"
740 }
740 }
741 ]
741 ]
742 }
742 }
743
743
744 bookmarks/ shows bookmarks info
744 bookmarks/ shows bookmarks info
745
745
746 $ request json-bookmarks
746 $ request json-bookmarks
747 200 Script output follows
747 200 Script output follows
748
748
749 {
749 {
750 "bookmarks": [
750 "bookmarks": [
751 {
751 {
752 "bookmark": "bookmark2",
752 "bookmark": "bookmark2",
753 "date": [
753 "date": [
754 0.0,
754 0.0,
755 0
755 0
756 ],
756 ],
757 "node": "ceed296fe500c3fac9541e31dad860cb49c89e45"
757 "node": "ceed296fe500c3fac9541e31dad860cb49c89e45"
758 },
758 },
759 {
759 {
760 "bookmark": "bookmark1",
760 "bookmark": "bookmark1",
761 "date": [
761 "date": [
762 0.0,
762 0.0,
763 0
763 0
764 ],
764 ],
765 "node": "8d7c456572acf3557e8ed8a07286b10c408bcec5"
765 "node": "8d7c456572acf3557e8ed8a07286b10c408bcec5"
766 }
766 }
767 ],
767 ],
768 "node": "cc725e08502a79dd1eda913760fbe06ed7a9abc7"
768 "node": "cc725e08502a79dd1eda913760fbe06ed7a9abc7"
769 }
769 }
770
770
771 branches/ shows branches info
771 branches/ shows branches info
772
772
773 $ request json-branches
773 $ request json-branches
774 200 Script output follows
774 200 Script output follows
775
775
776 {
776 {
777 "branches": [
777 "branches": [
778 {
778 {
779 "branch": "default",
779 "branch": "default",
780 "date": [
780 "date": [
781 0.0,
781 0.0,
782 0
782 0
783 ],
783 ],
784 "node": "cc725e08502a79dd1eda913760fbe06ed7a9abc7",
784 "node": "cc725e08502a79dd1eda913760fbe06ed7a9abc7",
785 "status": "open"
785 "status": "open"
786 },
786 },
787 {
787 {
788 "branch": "test-branch",
788 "branch": "test-branch",
789 "date": [
789 "date": [
790 0.0,
790 0.0,
791 0
791 0
792 ],
792 ],
793 "node": "ed66c30e87eb65337c05a4229efaa5f1d5285a90",
793 "node": "ed66c30e87eb65337c05a4229efaa5f1d5285a90",
794 "status": "inactive"
794 "status": "inactive"
795 }
795 }
796 ]
796 ]
797 }
797 }
798
798
799 summary/ shows a summary of repository state
799 summary/ shows a summary of repository state
800
800
801 $ request json-summary
801 $ request json-summary
802 200 Script output follows
802 200 Script output follows
803
803
804 {
804 {
805 "archives": [
805 "archives": [
806 {
806 {
807 "extension": ".tar.bz2",
807 "extension": ".tar.bz2",
808 "node": "tip",
808 "node": "tip",
809 "type": "bz2",
809 "type": "bz2",
810 "url": "http://*:$HGPORT/archive/tip.tar.bz2" (glob)
810 "url": "http://*:$HGPORT/archive/tip.tar.bz2" (glob)
811 }
811 }
812 ],
812 ],
813 "bookmarks": [
813 "bookmarks": [
814 {
814 {
815 "bookmark": "bookmark2",
815 "bookmark": "bookmark2",
816 "date": [
816 "date": [
817 0.0,
817 0.0,
818 0
818 0
819 ],
819 ],
820 "node": "ceed296fe500c3fac9541e31dad860cb49c89e45"
820 "node": "ceed296fe500c3fac9541e31dad860cb49c89e45"
821 },
821 },
822 {
822 {
823 "bookmark": "bookmark1",
823 "bookmark": "bookmark1",
824 "date": [
824 "date": [
825 0.0,
825 0.0,
826 0
826 0
827 ],
827 ],
828 "node": "8d7c456572acf3557e8ed8a07286b10c408bcec5"
828 "node": "8d7c456572acf3557e8ed8a07286b10c408bcec5"
829 }
829 }
830 ],
830 ],
831 "branches": [
831 "branches": [
832 {
832 {
833 "branch": "default",
833 "branch": "default",
834 "date": [
834 "date": [
835 0.0,
835 0.0,
836 0
836 0
837 ],
837 ],
838 "node": "cc725e08502a79dd1eda913760fbe06ed7a9abc7",
838 "node": "cc725e08502a79dd1eda913760fbe06ed7a9abc7",
839 "status": "open"
839 "status": "open"
840 },
840 },
841 {
841 {
842 "branch": "test-branch",
842 "branch": "test-branch",
843 "date": [
843 "date": [
844 0.0,
844 0.0,
845 0
845 0
846 ],
846 ],
847 "node": "ed66c30e87eb65337c05a4229efaa5f1d5285a90",
847 "node": "ed66c30e87eb65337c05a4229efaa5f1d5285a90",
848 "status": "inactive"
848 "status": "inactive"
849 }
849 }
850 ],
850 ],
851 "labels": [],
851 "labels": [],
852 "lastchange": [
852 "lastchange": [
853 0.0,
853 0.0,
854 0
854 0
855 ],
855 ],
856 "node": "cc725e08502a79dd1eda913760fbe06ed7a9abc7",
856 "node": "cc725e08502a79dd1eda913760fbe06ed7a9abc7",
857 "shortlog": [
857 "shortlog": [
858 {
858 {
859 "bookmarks": [],
859 "bookmarks": [],
860 "branch": "default",
860 "branch": "default",
861 "date": [
861 "date": [
862 0.0,
862 0.0,
863 0
863 0
864 ],
864 ],
865 "desc": "merge test-branch into default",
865 "desc": "merge test-branch into default",
866 "node": "cc725e08502a79dd1eda913760fbe06ed7a9abc7",
866 "node": "cc725e08502a79dd1eda913760fbe06ed7a9abc7",
867 "parents": [
867 "parents": [
868 "ceed296fe500c3fac9541e31dad860cb49c89e45",
868 "ceed296fe500c3fac9541e31dad860cb49c89e45",
869 "ed66c30e87eb65337c05a4229efaa5f1d5285a90"
869 "ed66c30e87eb65337c05a4229efaa5f1d5285a90"
870 ],
870 ],
871 "phase": "draft",
871 "phase": "draft",
872 "tags": [
872 "tags": [
873 "tip"
873 "tip"
874 ],
874 ],
875 "user": "test"
875 "user": "test"
876 },
876 },
877 {
877 {
878 "bookmarks": [],
878 "bookmarks": [],
879 "branch": "test-branch",
879 "branch": "test-branch",
880 "date": [
880 "date": [
881 0.0,
881 0.0,
882 0
882 0
883 ],
883 ],
884 "desc": "another commit in test-branch",
884 "desc": "another commit in test-branch",
885 "node": "ed66c30e87eb65337c05a4229efaa5f1d5285a90",
885 "node": "ed66c30e87eb65337c05a4229efaa5f1d5285a90",
886 "parents": [
886 "parents": [
887 "6ab967a8ab3489227a83f80e920faa039a71819f"
887 "6ab967a8ab3489227a83f80e920faa039a71819f"
888 ],
888 ],
889 "phase": "draft",
889 "phase": "draft",
890 "tags": [],
890 "tags": [],
891 "user": "test"
891 "user": "test"
892 },
892 },
893 {
893 {
894 "bookmarks": [],
894 "bookmarks": [],
895 "branch": "test-branch",
895 "branch": "test-branch",
896 "date": [
896 "date": [
897 0.0,
897 0.0,
898 0
898 0
899 ],
899 ],
900 "desc": "create test branch",
900 "desc": "create test branch",
901 "node": "6ab967a8ab3489227a83f80e920faa039a71819f",
901 "node": "6ab967a8ab3489227a83f80e920faa039a71819f",
902 "parents": [
902 "parents": [
903 "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e"
903 "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e"
904 ],
904 ],
905 "phase": "draft",
905 "phase": "draft",
906 "tags": [],
906 "tags": [],
907 "user": "test"
907 "user": "test"
908 },
908 },
909 {
909 {
910 "bookmarks": [
910 "bookmarks": [
911 "bookmark2"
911 "bookmark2"
912 ],
912 ],
913 "branch": "default",
913 "branch": "default",
914 "date": [
914 "date": [
915 0.0,
915 0.0,
916 0
916 0
917 ],
917 ],
918 "desc": "create tag2",
918 "desc": "create tag2",
919 "node": "ceed296fe500c3fac9541e31dad860cb49c89e45",
919 "node": "ceed296fe500c3fac9541e31dad860cb49c89e45",
920 "parents": [
920 "parents": [
921 "f2890a05fea49bfaf9fb27ed5490894eba32da78"
921 "f2890a05fea49bfaf9fb27ed5490894eba32da78"
922 ],
922 ],
923 "phase": "draft",
923 "phase": "draft",
924 "tags": [],
924 "tags": [],
925 "user": "test"
925 "user": "test"
926 },
926 },
927 {
927 {
928 "bookmarks": [],
928 "bookmarks": [],
929 "branch": "default",
929 "branch": "default",
930 "date": [
930 "date": [
931 0.0,
931 0.0,
932 0
932 0
933 ],
933 ],
934 "desc": "another commit to da/foo",
934 "desc": "another commit to da/foo",
935 "node": "f2890a05fea49bfaf9fb27ed5490894eba32da78",
935 "node": "f2890a05fea49bfaf9fb27ed5490894eba32da78",
936 "parents": [
936 "parents": [
937 "93a8ce14f89156426b7fa981af8042da53f03aa0"
937 "93a8ce14f89156426b7fa981af8042da53f03aa0"
938 ],
938 ],
939 "phase": "draft",
939 "phase": "draft",
940 "tags": [
940 "tags": [
941 "tag2"
941 "tag2"
942 ],
942 ],
943 "user": "test"
943 "user": "test"
944 },
944 },
945 {
945 {
946 "bookmarks": [],
946 "bookmarks": [],
947 "branch": "default",
947 "branch": "default",
948 "date": [
948 "date": [
949 0.0,
949 0.0,
950 0
950 0
951 ],
951 ],
952 "desc": "create tag",
952 "desc": "create tag",
953 "node": "93a8ce14f89156426b7fa981af8042da53f03aa0",
953 "node": "93a8ce14f89156426b7fa981af8042da53f03aa0",
954 "parents": [
954 "parents": [
955 "78896eb0e102174ce9278438a95e12543e4367a7"
955 "78896eb0e102174ce9278438a95e12543e4367a7"
956 ],
956 ],
957 "phase": "public",
957 "phase": "public",
958 "tags": [],
958 "tags": [],
959 "user": "test"
959 "user": "test"
960 },
960 },
961 {
961 {
962 "bookmarks": [],
962 "bookmarks": [],
963 "branch": "default",
963 "branch": "default",
964 "date": [
964 "date": [
965 0.0,
965 0.0,
966 0
966 0
967 ],
967 ],
968 "desc": "move foo",
968 "desc": "move foo",
969 "node": "78896eb0e102174ce9278438a95e12543e4367a7",
969 "node": "78896eb0e102174ce9278438a95e12543e4367a7",
970 "parents": [
970 "parents": [
971 "8d7c456572acf3557e8ed8a07286b10c408bcec5"
971 "8d7c456572acf3557e8ed8a07286b10c408bcec5"
972 ],
972 ],
973 "phase": "public",
973 "phase": "public",
974 "tags": [
974 "tags": [
975 "tag1"
975 "tag1"
976 ],
976 ],
977 "user": "test"
977 "user": "test"
978 },
978 },
979 {
979 {
980 "bookmarks": [
980 "bookmarks": [
981 "bookmark1"
981 "bookmark1"
982 ],
982 ],
983 "branch": "default",
983 "branch": "default",
984 "date": [
984 "date": [
985 0.0,
985 0.0,
986 0
986 0
987 ],
987 ],
988 "desc": "modify da/foo",
988 "desc": "modify da/foo",
989 "node": "8d7c456572acf3557e8ed8a07286b10c408bcec5",
989 "node": "8d7c456572acf3557e8ed8a07286b10c408bcec5",
990 "parents": [
990 "parents": [
991 "f8bbb9024b10f93cdbb8d940337398291d40dea8"
991 "f8bbb9024b10f93cdbb8d940337398291d40dea8"
992 ],
992 ],
993 "phase": "public",
993 "phase": "public",
994 "tags": [],
994 "tags": [],
995 "user": "test"
995 "user": "test"
996 },
996 },
997 {
997 {
998 "bookmarks": [],
998 "bookmarks": [],
999 "branch": "default",
999 "branch": "default",
1000 "date": [
1000 "date": [
1001 0.0,
1001 0.0,
1002 0
1002 0
1003 ],
1003 ],
1004 "desc": "modify foo",
1004 "desc": "modify foo",
1005 "node": "f8bbb9024b10f93cdbb8d940337398291d40dea8",
1005 "node": "f8bbb9024b10f93cdbb8d940337398291d40dea8",
1006 "parents": [
1006 "parents": [
1007 "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e"
1007 "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e"
1008 ],
1008 ],
1009 "phase": "public",
1009 "phase": "public",
1010 "tags": [],
1010 "tags": [],
1011 "user": "test"
1011 "user": "test"
1012 },
1012 },
1013 {
1013 {
1014 "bookmarks": [],
1014 "bookmarks": [],
1015 "branch": "default",
1015 "branch": "default",
1016 "date": [
1016 "date": [
1017 0.0,
1017 0.0,
1018 0
1018 0
1019 ],
1019 ],
1020 "desc": "initial",
1020 "desc": "initial",
1021 "node": "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e",
1021 "node": "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e",
1022 "parents": [],
1022 "parents": [],
1023 "phase": "public",
1023 "phase": "public",
1024 "tags": [],
1024 "tags": [],
1025 "user": "test"
1025 "user": "test"
1026 }
1026 }
1027 ],
1027 ],
1028 "tags": [
1028 "tags": [
1029 {
1029 {
1030 "date": [
1030 "date": [
1031 0.0,
1031 0.0,
1032 0
1032 0
1033 ],
1033 ],
1034 "node": "f2890a05fea49bfaf9fb27ed5490894eba32da78",
1034 "node": "f2890a05fea49bfaf9fb27ed5490894eba32da78",
1035 "tag": "tag2"
1035 "tag": "tag2"
1036 },
1036 },
1037 {
1037 {
1038 "date": [
1038 "date": [
1039 0.0,
1039 0.0,
1040 0
1040 0
1041 ],
1041 ],
1042 "node": "78896eb0e102174ce9278438a95e12543e4367a7",
1042 "node": "78896eb0e102174ce9278438a95e12543e4367a7",
1043 "tag": "tag1"
1043 "tag": "tag1"
1044 }
1044 }
1045 ]
1045 ]
1046 }
1046 }
1047
1047
1048 $ request json-changelog?rev=create
1048 $ request json-changelog?rev=create
1049 200 Script output follows
1049 200 Script output follows
1050
1050
1051 {
1051 {
1052 "entries": [
1052 "entries": [
1053 {
1053 {
1054 "bookmarks": [],
1054 "bookmarks": [],
1055 "branch": "test-branch",
1055 "branch": "test-branch",
1056 "date": [
1056 "date": [
1057 0.0,
1057 0.0,
1058 0
1058 0
1059 ],
1059 ],
1060 "desc": "create test branch",
1060 "desc": "create test branch",
1061 "node": "6ab967a8ab3489227a83f80e920faa039a71819f",
1061 "node": "6ab967a8ab3489227a83f80e920faa039a71819f",
1062 "parents": [
1062 "parents": [
1063 "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e"
1063 "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e"
1064 ],
1064 ],
1065 "phase": "draft",
1065 "phase": "draft",
1066 "tags": [],
1066 "tags": [],
1067 "user": "test"
1067 "user": "test"
1068 },
1068 },
1069 {
1069 {
1070 "bookmarks": [
1070 "bookmarks": [
1071 "bookmark2"
1071 "bookmark2"
1072 ],
1072 ],
1073 "branch": "default",
1073 "branch": "default",
1074 "date": [
1074 "date": [
1075 0.0,
1075 0.0,
1076 0
1076 0
1077 ],
1077 ],
1078 "desc": "create tag2",
1078 "desc": "create tag2",
1079 "node": "ceed296fe500c3fac9541e31dad860cb49c89e45",
1079 "node": "ceed296fe500c3fac9541e31dad860cb49c89e45",
1080 "parents": [
1080 "parents": [
1081 "f2890a05fea49bfaf9fb27ed5490894eba32da78"
1081 "f2890a05fea49bfaf9fb27ed5490894eba32da78"
1082 ],
1082 ],
1083 "phase": "draft",
1083 "phase": "draft",
1084 "tags": [],
1084 "tags": [],
1085 "user": "test"
1085 "user": "test"
1086 },
1086 },
1087 {
1087 {
1088 "bookmarks": [],
1088 "bookmarks": [],
1089 "branch": "default",
1089 "branch": "default",
1090 "date": [
1090 "date": [
1091 0.0,
1091 0.0,
1092 0
1092 0
1093 ],
1093 ],
1094 "desc": "create tag",
1094 "desc": "create tag",
1095 "node": "93a8ce14f89156426b7fa981af8042da53f03aa0",
1095 "node": "93a8ce14f89156426b7fa981af8042da53f03aa0",
1096 "parents": [
1096 "parents": [
1097 "78896eb0e102174ce9278438a95e12543e4367a7"
1097 "78896eb0e102174ce9278438a95e12543e4367a7"
1098 ],
1098 ],
1099 "phase": "public",
1099 "phase": "public",
1100 "tags": [],
1100 "tags": [],
1101 "user": "test"
1101 "user": "test"
1102 }
1102 }
1103 ],
1103 ],
1104 "node": "cc725e08502a79dd1eda913760fbe06ed7a9abc7",
1104 "node": "cc725e08502a79dd1eda913760fbe06ed7a9abc7",
1105 "query": "create"
1105 "query": "create"
1106 }
1106 }
1107
1107
1108 filediff/{revision}/{path} shows changes to a file in a revision
1108 filediff/{revision}/{path} shows changes to a file in a revision
1109
1109
1110 $ request json-diff/f8bbb9024b10/foo
1110 $ request json-diff/f8bbb9024b10/foo
1111 200 Script output follows
1111 200 Script output follows
1112
1112
1113 {
1113 {
1114 "author": "test",
1114 "author": "test",
1115 "children": [],
1115 "children": [],
1116 "date": [
1116 "date": [
1117 0.0,
1117 0.0,
1118 0
1118 0
1119 ],
1119 ],
1120 "desc": "modify foo",
1120 "desc": "modify foo",
1121 "diff": [
1121 "diff": [
1122 {
1122 {
1123 "blockno": 1,
1123 "blockno": 1,
1124 "lines": [
1124 "lines": [
1125 {
1125 {
1126 "l": "--- a/foo\tThu Jan 01 00:00:00 1970 +0000\n",
1126 "l": "--- a/foo\tThu Jan 01 00:00:00 1970 +0000\n",
1127 "n": 1,
1127 "n": 1,
1128 "t": "-"
1128 "t": "-"
1129 },
1129 },
1130 {
1130 {
1131 "l": "+++ b/foo\tThu Jan 01 00:00:00 1970 +0000\n",
1131 "l": "+++ b/foo\tThu Jan 01 00:00:00 1970 +0000\n",
1132 "n": 2,
1132 "n": 2,
1133 "t": "+"
1133 "t": "+"
1134 },
1134 },
1135 {
1135 {
1136 "l": "@@ -1,1 +1,1 @@\n",
1136 "l": "@@ -1,1 +1,1 @@\n",
1137 "n": 3,
1137 "n": 3,
1138 "t": "@"
1138 "t": "@"
1139 },
1139 },
1140 {
1140 {
1141 "l": "-foo\n",
1141 "l": "-foo\n",
1142 "n": 4,
1142 "n": 4,
1143 "t": "-"
1143 "t": "-"
1144 },
1144 },
1145 {
1145 {
1146 "l": "+bar\n",
1146 "l": "+bar\n",
1147 "n": 5,
1147 "n": 5,
1148 "t": "+"
1148 "t": "+"
1149 }
1149 }
1150 ]
1150 ]
1151 }
1151 }
1152 ],
1152 ],
1153 "node": "f8bbb9024b10f93cdbb8d940337398291d40dea8",
1153 "node": "f8bbb9024b10f93cdbb8d940337398291d40dea8",
1154 "parents": [
1154 "parents": [
1155 "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e"
1155 "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e"
1156 ],
1156 ],
1157 "path": "foo"
1157 "path": "foo"
1158 }
1158 }
1159
1159
1160 comparison/{revision}/{path} shows information about before and after for a file
1160 comparison/{revision}/{path} shows information about before and after for a file
1161
1161
1162 $ request json-comparison/f8bbb9024b10/foo
1162 $ request json-comparison/f8bbb9024b10/foo
1163 200 Script output follows
1163 200 Script output follows
1164
1164
1165 {
1165 {
1166 "author": "test",
1166 "author": "test",
1167 "children": [],
1167 "children": [],
1168 "comparison": [
1168 "comparison": [
1169 {
1169 {
1170 "lines": [
1170 "lines": [
1171 {
1171 {
1172 "ll": "foo",
1172 "ll": "foo",
1173 "ln": 1,
1173 "ln": 1,
1174 "rl": "bar",
1174 "rl": "bar",
1175 "rn": 1,
1175 "rn": 1,
1176 "t": "replace"
1176 "t": "replace"
1177 }
1177 }
1178 ]
1178 ]
1179 }
1179 }
1180 ],
1180 ],
1181 "date": [
1181 "date": [
1182 0.0,
1182 0.0,
1183 0
1183 0
1184 ],
1184 ],
1185 "desc": "modify foo",
1185 "desc": "modify foo",
1186 "leftnode": "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e",
1186 "leftnode": "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e",
1187 "node": "f8bbb9024b10f93cdbb8d940337398291d40dea8",
1187 "node": "f8bbb9024b10f93cdbb8d940337398291d40dea8",
1188 "parents": [
1188 "parents": [
1189 "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e"
1189 "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e"
1190 ],
1190 ],
1191 "path": "foo",
1191 "path": "foo",
1192 "rightnode": "f8bbb9024b10f93cdbb8d940337398291d40dea8"
1192 "rightnode": "f8bbb9024b10f93cdbb8d940337398291d40dea8"
1193 }
1193 }
1194
1194
1195 annotate/{revision}/{path} shows annotations for each line
1195 annotate/{revision}/{path} shows annotations for each line
1196
1196
1197 $ request json-annotate/f8bbb9024b10/foo
1197 $ request json-annotate/f8bbb9024b10/foo
1198 200 Script output follows
1198 200 Script output follows
1199
1199
1200 {
1200 {
1201 "abspath": "foo",
1201 "abspath": "foo",
1202 "annotate": [
1202 "annotate": [
1203 {
1203 {
1204 "abspath": "foo",
1204 "abspath": "foo",
1205 "author": "test",
1205 "author": "test",
1206 "desc": "modify foo",
1206 "desc": "modify foo",
1207 "line": "bar\n",
1207 "line": "bar\n",
1208 "lineno": 1,
1208 "lineno": 1,
1209 "node": "f8bbb9024b10f93cdbb8d940337398291d40dea8",
1209 "node": "f8bbb9024b10f93cdbb8d940337398291d40dea8",
1210 "revdate": [
1210 "revdate": [
1211 0.0,
1211 0.0,
1212 0
1212 0
1213 ],
1213 ],
1214 "targetline": 1
1214 "targetline": 1
1215 }
1215 }
1216 ],
1216 ],
1217 "author": "test",
1217 "author": "test",
1218 "children": [],
1218 "children": [],
1219 "date": [
1219 "date": [
1220 0.0,
1220 0.0,
1221 0
1221 0
1222 ],
1222 ],
1223 "desc": "modify foo",
1223 "desc": "modify foo",
1224 "node": "f8bbb9024b10f93cdbb8d940337398291d40dea8",
1224 "node": "f8bbb9024b10f93cdbb8d940337398291d40dea8",
1225 "parents": [
1225 "parents": [
1226 "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e"
1226 "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e"
1227 ],
1227 ],
1228 "permissions": ""
1228 "permissions": ""
1229 }
1229 }
1230
1230
1231 filelog/{revision}/{path} shows history of a single file
1231 filelog/{revision}/{path} shows history of a single file
1232
1232
1233 $ request json-filelog/f8bbb9024b10/foo
1233 $ request json-filelog/f8bbb9024b10/foo
1234 200 Script output follows
1234 200 Script output follows
1235
1235
1236 {
1236 {
1237 "entries": [
1237 "entries": [
1238 {
1238 {
1239 "bookmarks": [],
1239 "bookmarks": [],
1240 "branch": "default",
1240 "branch": "default",
1241 "date": [
1241 "date": [
1242 0.0,
1242 0.0,
1243 0
1243 0
1244 ],
1244 ],
1245 "desc": "modify foo",
1245 "desc": "modify foo",
1246 "node": "f8bbb9024b10f93cdbb8d940337398291d40dea8",
1246 "node": "f8bbb9024b10f93cdbb8d940337398291d40dea8",
1247 "parents": [
1247 "parents": [
1248 "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e"
1248 "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e"
1249 ],
1249 ],
1250 "phase": "public",
1250 "phase": "public",
1251 "tags": [],
1251 "tags": [],
1252 "user": "test"
1252 "user": "test"
1253 },
1253 },
1254 {
1254 {
1255 "bookmarks": [],
1255 "bookmarks": [],
1256 "branch": "default",
1256 "branch": "default",
1257 "date": [
1257 "date": [
1258 0.0,
1258 0.0,
1259 0
1259 0
1260 ],
1260 ],
1261 "desc": "initial",
1261 "desc": "initial",
1262 "node": "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e",
1262 "node": "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e",
1263 "parents": [],
1263 "parents": [],
1264 "phase": "public",
1264 "phase": "public",
1265 "tags": [],
1265 "tags": [],
1266 "user": "test"
1266 "user": "test"
1267 }
1267 }
1268 ]
1268 ]
1269 }
1269 }
1270
1270
1271 $ request json-filelog/cc725e08502a/da/foo
1271 $ request json-filelog/cc725e08502a/da/foo
1272 200 Script output follows
1272 200 Script output follows
1273
1273
1274 {
1274 {
1275 "entries": [
1275 "entries": [
1276 {
1276 {
1277 "bookmarks": [],
1277 "bookmarks": [],
1278 "branch": "default",
1278 "branch": "default",
1279 "date": [
1279 "date": [
1280 0.0,
1280 0.0,
1281 0
1281 0
1282 ],
1282 ],
1283 "desc": "another commit to da/foo",
1283 "desc": "another commit to da/foo",
1284 "node": "f2890a05fea49bfaf9fb27ed5490894eba32da78",
1284 "node": "f2890a05fea49bfaf9fb27ed5490894eba32da78",
1285 "parents": [
1285 "parents": [
1286 "8d7c456572acf3557e8ed8a07286b10c408bcec5"
1286 "8d7c456572acf3557e8ed8a07286b10c408bcec5"
1287 ],
1287 ],
1288 "phase": "draft",
1288 "phase": "draft",
1289 "tags": [
1289 "tags": [
1290 "tag2"
1290 "tag2"
1291 ],
1291 ],
1292 "user": "test"
1292 "user": "test"
1293 },
1293 },
1294 {
1294 {
1295 "bookmarks": [
1295 "bookmarks": [
1296 "bookmark1"
1296 "bookmark1"
1297 ],
1297 ],
1298 "branch": "default",
1298 "branch": "default",
1299 "date": [
1299 "date": [
1300 0.0,
1300 0.0,
1301 0
1301 0
1302 ],
1302 ],
1303 "desc": "modify da/foo",
1303 "desc": "modify da/foo",
1304 "node": "8d7c456572acf3557e8ed8a07286b10c408bcec5",
1304 "node": "8d7c456572acf3557e8ed8a07286b10c408bcec5",
1305 "parents": [
1305 "parents": [
1306 "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e"
1306 "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e"
1307 ],
1307 ],
1308 "phase": "public",
1308 "phase": "public",
1309 "tags": [],
1309 "tags": [],
1310 "user": "test"
1310 "user": "test"
1311 },
1311 },
1312 {
1312 {
1313 "bookmarks": [],
1313 "bookmarks": [],
1314 "branch": "default",
1314 "branch": "default",
1315 "date": [
1315 "date": [
1316 0.0,
1316 0.0,
1317 0
1317 0
1318 ],
1318 ],
1319 "desc": "initial",
1319 "desc": "initial",
1320 "node": "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e",
1320 "node": "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e",
1321 "parents": [],
1321 "parents": [],
1322 "phase": "public",
1322 "phase": "public",
1323 "tags": [],
1323 "tags": [],
1324 "user": "test"
1324 "user": "test"
1325 }
1325 }
1326 ]
1326 ]
1327 }
1327 }
1328
1328
1329 (archive/ doesn't use templating, so ignore it)
1329 (archive/ doesn't use templating, so ignore it)
1330
1330
1331 (static/ doesn't use templating, so ignore it)
1331 (static/ doesn't use templating, so ignore it)
1332
1332
1333 graph/ shows information that can be used to render a graph of the DAG
1333 graph/ shows information that can be used to render a graph of the DAG
1334
1334
1335 $ request json-graph
1335 $ request json-graph
1336 200 Script output follows
1336 200 Script output follows
1337
1337
1338 "not yet implemented"
1338 "not yet implemented"
1339
1339
1340 help/ shows help topics
1340 help/ shows help topics
1341
1341
1342 $ request json-help
1342 $ request json-help
1343 200 Script output follows
1343 200 Script output follows
1344
1344
1345 {
1345 {
1346 "earlycommands": [
1346 "earlycommands": [
1347 {
1347 {
1348 "summary": "add the specified files on the next commit",
1348 "summary": "add the specified files on the next commit",
1349 "topic": "add"
1349 "topic": "add"
1350 },
1350 },
1351 {
1351 {
1352 "summary": "show changeset information by line for each file",
1352 "summary": "show changeset information by line for each file",
1353 "topic": "annotate"
1353 "topic": "annotate"
1354 },
1354 },
1355 {
1355 {
1356 "summary": "make a copy of an existing repository",
1356 "summary": "make a copy of an existing repository",
1357 "topic": "clone"
1357 "topic": "clone"
1358 },
1358 },
1359 {
1359 {
1360 "summary": "commit the specified files or all outstanding changes",
1360 "summary": "commit the specified files or all outstanding changes",
1361 "topic": "commit"
1361 "topic": "commit"
1362 },
1362 },
1363 {
1363 {
1364 "summary": "diff repository (or selected files)",
1364 "summary": "diff repository (or selected files)",
1365 "topic": "diff"
1365 "topic": "diff"
1366 },
1366 },
1367 {
1367 {
1368 "summary": "dump the header and diffs for one or more changesets",
1368 "summary": "dump the header and diffs for one or more changesets",
1369 "topic": "export"
1369 "topic": "export"
1370 },
1370 },
1371 {
1371 {
1372 "summary": "forget the specified files on the next commit",
1372 "summary": "forget the specified files on the next commit",
1373 "topic": "forget"
1373 "topic": "forget"
1374 },
1374 },
1375 {
1375 {
1376 "summary": "create a new repository in the given directory",
1376 "summary": "create a new repository in the given directory",
1377 "topic": "init"
1377 "topic": "init"
1378 },
1378 },
1379 {
1379 {
1380 "summary": "show revision history of entire repository or files",
1380 "summary": "show revision history of entire repository or files",
1381 "topic": "log"
1381 "topic": "log"
1382 },
1382 },
1383 {
1383 {
1384 "summary": "merge another revision into working directory",
1384 "summary": "merge another revision into working directory",
1385 "topic": "merge"
1385 "topic": "merge"
1386 },
1386 },
1387 {
1387 {
1388 "summary": "pull changes from the specified source",
1388 "summary": "pull changes from the specified source",
1389 "topic": "pull"
1389 "topic": "pull"
1390 },
1390 },
1391 {
1391 {
1392 "summary": "push changes to the specified destination",
1392 "summary": "push changes to the specified destination",
1393 "topic": "push"
1393 "topic": "push"
1394 },
1394 },
1395 {
1395 {
1396 "summary": "remove the specified files on the next commit",
1396 "summary": "remove the specified files on the next commit",
1397 "topic": "remove"
1397 "topic": "remove"
1398 },
1398 },
1399 {
1399 {
1400 "summary": "start stand-alone webserver",
1400 "summary": "start stand-alone webserver",
1401 "topic": "serve"
1401 "topic": "serve"
1402 },
1402 },
1403 {
1403 {
1404 "summary": "show changed files in the working directory",
1404 "summary": "show changed files in the working directory",
1405 "topic": "status"
1405 "topic": "status"
1406 },
1406 },
1407 {
1407 {
1408 "summary": "summarize working directory state",
1408 "summary": "summarize working directory state",
1409 "topic": "summary"
1409 "topic": "summary"
1410 },
1410 },
1411 {
1411 {
1412 "summary": "update working directory (or switch revisions)",
1412 "summary": "update working directory (or switch revisions)",
1413 "topic": "update"
1413 "topic": "update"
1414 }
1414 }
1415 ],
1415 ],
1416 "othercommands": [
1416 "othercommands": [
1417 {
1417 {
1418 "summary": "add all new files, delete all missing files",
1418 "summary": "add all new files, delete all missing files",
1419 "topic": "addremove"
1419 "topic": "addremove"
1420 },
1420 },
1421 {
1421 {
1422 "summary": "create an unversioned archive of a repository revision",
1422 "summary": "create an unversioned archive of a repository revision",
1423 "topic": "archive"
1423 "topic": "archive"
1424 },
1424 },
1425 {
1425 {
1426 "summary": "reverse effect of earlier changeset",
1426 "summary": "reverse effect of earlier changeset",
1427 "topic": "backout"
1427 "topic": "backout"
1428 },
1428 },
1429 {
1429 {
1430 "summary": "subdivision search of changesets",
1430 "summary": "subdivision search of changesets",
1431 "topic": "bisect"
1431 "topic": "bisect"
1432 },
1432 },
1433 {
1433 {
1434 "summary": "create a new bookmark or list existing bookmarks",
1434 "summary": "create a new bookmark or list existing bookmarks",
1435 "topic": "bookmarks"
1435 "topic": "bookmarks"
1436 },
1436 },
1437 {
1437 {
1438 "summary": "set or show the current branch name",
1438 "summary": "set or show the current branch name",
1439 "topic": "branch"
1439 "topic": "branch"
1440 },
1440 },
1441 {
1441 {
1442 "summary": "list repository named branches",
1442 "summary": "list repository named branches",
1443 "topic": "branches"
1443 "topic": "branches"
1444 },
1444 },
1445 {
1445 {
1446 "summary": "create a bundle file",
1446 "summary": "create a bundle file",
1447 "topic": "bundle"
1447 "topic": "bundle"
1448 },
1448 },
1449 {
1449 {
1450 "summary": "output the current or given revision of files",
1450 "summary": "output the current or given revision of files",
1451 "topic": "cat"
1451 "topic": "cat"
1452 },
1452 },
1453 {
1453 {
1454 "summary": "show combined config settings from all hgrc files",
1454 "summary": "show combined config settings from all hgrc files",
1455 "topic": "config"
1455 "topic": "config"
1456 },
1456 },
1457 {
1457 {
1458 "summary": "mark files as copied for the next commit",
1458 "summary": "mark files as copied for the next commit",
1459 "topic": "copy"
1459 "topic": "copy"
1460 },
1460 },
1461 {
1461 {
1462 "summary": "list tracked files",
1462 "summary": "list tracked files",
1463 "topic": "files"
1463 "topic": "files"
1464 },
1464 },
1465 {
1465 {
1466 "summary": "copy changes from other branches onto the current branch",
1466 "summary": "copy changes from other branches onto the current branch",
1467 "topic": "graft"
1467 "topic": "graft"
1468 },
1468 },
1469 {
1469 {
1470 "summary": "search revision history for a pattern in specified files",
1470 "summary": "search revision history for a pattern in specified files",
1471 "topic": "grep"
1471 "topic": "grep"
1472 },
1472 },
1473 {
1473 {
1474 "summary": "show branch heads",
1474 "summary": "show branch heads",
1475 "topic": "heads"
1475 "topic": "heads"
1476 },
1476 },
1477 {
1477 {
1478 "summary": "show help for a given topic or a help overview",
1478 "summary": "show help for a given topic or a help overview",
1479 "topic": "help"
1479 "topic": "help"
1480 },
1480 },
1481 {
1481 {
1482 "summary": "identify the working directory or specified revision",
1482 "summary": "identify the working directory or specified revision",
1483 "topic": "identify"
1483 "topic": "identify"
1484 },
1484 },
1485 {
1485 {
1486 "summary": "import an ordered set of patches",
1486 "summary": "import an ordered set of patches",
1487 "topic": "import"
1487 "topic": "import"
1488 },
1488 },
1489 {
1489 {
1490 "summary": "show new changesets found in source",
1490 "summary": "show new changesets found in source",
1491 "topic": "incoming"
1491 "topic": "incoming"
1492 },
1492 },
1493 {
1493 {
1494 "summary": "output the current or given revision of the project manifest",
1494 "summary": "output the current or given revision of the project manifest",
1495 "topic": "manifest"
1495 "topic": "manifest"
1496 },
1496 },
1497 {
1497 {
1498 "summary": "show changesets not found in the destination",
1498 "summary": "show changesets not found in the destination",
1499 "topic": "outgoing"
1499 "topic": "outgoing"
1500 },
1500 },
1501 {
1501 {
1502 "summary": "show aliases for remote repositories",
1502 "summary": "show aliases for remote repositories",
1503 "topic": "paths"
1503 "topic": "paths"
1504 },
1504 },
1505 {
1505 {
1506 "summary": "set or show the current phase name",
1506 "summary": "set or show the current phase name",
1507 "topic": "phase"
1507 "topic": "phase"
1508 },
1508 },
1509 {
1509 {
1510 "summary": "roll back an interrupted transaction",
1510 "summary": "roll back an interrupted transaction",
1511 "topic": "recover"
1511 "topic": "recover"
1512 },
1512 },
1513 {
1513 {
1514 "summary": "rename files; equivalent of copy + remove",
1514 "summary": "rename files; equivalent of copy + remove",
1515 "topic": "rename"
1515 "topic": "rename"
1516 },
1516 },
1517 {
1517 {
1518 "summary": "redo merges or set/view the merge status of files",
1518 "summary": "redo merges or set/view the merge status of files",
1519 "topic": "resolve"
1519 "topic": "resolve"
1520 },
1520 },
1521 {
1521 {
1522 "summary": "restore files to their checkout state",
1522 "summary": "restore files to their checkout state",
1523 "topic": "revert"
1523 "topic": "revert"
1524 },
1524 },
1525 {
1525 {
1526 "summary": "print the root (top) of the current working directory",
1526 "summary": "print the root (top) of the current working directory",
1527 "topic": "root"
1527 "topic": "root"
1528 },
1528 },
1529 {
1529 {
1530 "summary": "add one or more tags for the current or given revision",
1530 "summary": "add one or more tags for the current or given revision",
1531 "topic": "tag"
1531 "topic": "tag"
1532 },
1532 },
1533 {
1533 {
1534 "summary": "list repository tags",
1534 "summary": "list repository tags",
1535 "topic": "tags"
1535 "topic": "tags"
1536 },
1536 },
1537 {
1537 {
1538 "summary": "apply one or more changegroup files",
1538 "summary": "apply one or more bundle files",
1539 "topic": "unbundle"
1539 "topic": "unbundle"
1540 },
1540 },
1541 {
1541 {
1542 "summary": "verify the integrity of the repository",
1542 "summary": "verify the integrity of the repository",
1543 "topic": "verify"
1543 "topic": "verify"
1544 },
1544 },
1545 {
1545 {
1546 "summary": "output version and copyright information",
1546 "summary": "output version and copyright information",
1547 "topic": "version"
1547 "topic": "version"
1548 }
1548 }
1549 ],
1549 ],
1550 "topics": [
1550 "topics": [
1551 {
1551 {
1552 "summary": "Bundle File Formats",
1552 "summary": "Bundle File Formats",
1553 "topic": "bundlespec"
1553 "topic": "bundlespec"
1554 },
1554 },
1555 {
1555 {
1556 "summary": "Colorizing Outputs",
1556 "summary": "Colorizing Outputs",
1557 "topic": "color"
1557 "topic": "color"
1558 },
1558 },
1559 {
1559 {
1560 "summary": "Configuration Files",
1560 "summary": "Configuration Files",
1561 "topic": "config"
1561 "topic": "config"
1562 },
1562 },
1563 {
1563 {
1564 "summary": "Date Formats",
1564 "summary": "Date Formats",
1565 "topic": "dates"
1565 "topic": "dates"
1566 },
1566 },
1567 {
1567 {
1568 "summary": "Diff Formats",
1568 "summary": "Diff Formats",
1569 "topic": "diffs"
1569 "topic": "diffs"
1570 },
1570 },
1571 {
1571 {
1572 "summary": "Environment Variables",
1572 "summary": "Environment Variables",
1573 "topic": "environment"
1573 "topic": "environment"
1574 },
1574 },
1575 {
1575 {
1576 "summary": "Using Additional Features",
1576 "summary": "Using Additional Features",
1577 "topic": "extensions"
1577 "topic": "extensions"
1578 },
1578 },
1579 {
1579 {
1580 "summary": "Specifying File Sets",
1580 "summary": "Specifying File Sets",
1581 "topic": "filesets"
1581 "topic": "filesets"
1582 },
1582 },
1583 {
1583 {
1584 "summary": "Glossary",
1584 "summary": "Glossary",
1585 "topic": "glossary"
1585 "topic": "glossary"
1586 },
1586 },
1587 {
1587 {
1588 "summary": "Syntax for Mercurial Ignore Files",
1588 "summary": "Syntax for Mercurial Ignore Files",
1589 "topic": "hgignore"
1589 "topic": "hgignore"
1590 },
1590 },
1591 {
1591 {
1592 "summary": "Configuring hgweb",
1592 "summary": "Configuring hgweb",
1593 "topic": "hgweb"
1593 "topic": "hgweb"
1594 },
1594 },
1595 {
1595 {
1596 "summary": "Technical implementation topics",
1596 "summary": "Technical implementation topics",
1597 "topic": "internals"
1597 "topic": "internals"
1598 },
1598 },
1599 {
1599 {
1600 "summary": "Merge Tools",
1600 "summary": "Merge Tools",
1601 "topic": "merge-tools"
1601 "topic": "merge-tools"
1602 },
1602 },
1603 {
1603 {
1604 "summary": "Pager Support",
1604 "summary": "Pager Support",
1605 "topic": "pager"
1605 "topic": "pager"
1606 },
1606 },
1607 {
1607 {
1608 "summary": "File Name Patterns",
1608 "summary": "File Name Patterns",
1609 "topic": "patterns"
1609 "topic": "patterns"
1610 },
1610 },
1611 {
1611 {
1612 "summary": "Working with Phases",
1612 "summary": "Working with Phases",
1613 "topic": "phases"
1613 "topic": "phases"
1614 },
1614 },
1615 {
1615 {
1616 "summary": "Specifying Revisions",
1616 "summary": "Specifying Revisions",
1617 "topic": "revisions"
1617 "topic": "revisions"
1618 },
1618 },
1619 {
1619 {
1620 "summary": "Using Mercurial from scripts and automation",
1620 "summary": "Using Mercurial from scripts and automation",
1621 "topic": "scripting"
1621 "topic": "scripting"
1622 },
1622 },
1623 {
1623 {
1624 "summary": "Subrepositories",
1624 "summary": "Subrepositories",
1625 "topic": "subrepos"
1625 "topic": "subrepos"
1626 },
1626 },
1627 {
1627 {
1628 "summary": "Template Usage",
1628 "summary": "Template Usage",
1629 "topic": "templating"
1629 "topic": "templating"
1630 },
1630 },
1631 {
1631 {
1632 "summary": "URL Paths",
1632 "summary": "URL Paths",
1633 "topic": "urls"
1633 "topic": "urls"
1634 }
1634 }
1635 ]
1635 ]
1636 }
1636 }
1637
1637
1638 help/{topic} shows an individual help topic
1638 help/{topic} shows an individual help topic
1639
1639
1640 $ request json-help/phases
1640 $ request json-help/phases
1641 200 Script output follows
1641 200 Script output follows
1642
1642
1643 {
1643 {
1644 "rawdoc": "Working with Phases\n*", (glob)
1644 "rawdoc": "Working with Phases\n*", (glob)
1645 "topic": "phases"
1645 "topic": "phases"
1646 }
1646 }
General Comments 0
You need to be logged in to leave comments. Login now