##// END OF EJS Templates
dispatch: report similar names consistently
Bryan O'Sullivan -
r27623:b3376fba default
parent child Browse files
Show More
@@ -1,1045 +1,1046
1 # dispatch.py - command dispatching for mercurial
1 # dispatch.py - command dispatching 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, print_function
8 from __future__ import absolute_import, print_function
9
9
10 import atexit
10 import atexit
11 import difflib
11 import difflib
12 import errno
12 import errno
13 import os
13 import os
14 import pdb
14 import pdb
15 import re
15 import re
16 import shlex
16 import shlex
17 import signal
17 import signal
18 import socket
18 import socket
19 import sys
19 import sys
20 import time
20 import time
21 import traceback
21 import traceback
22
22
23
23
24 from .i18n import _
24 from .i18n import _
25
25
26 from . import (
26 from . import (
27 cmdutil,
27 cmdutil,
28 commands,
28 commands,
29 demandimport,
29 demandimport,
30 encoding,
30 encoding,
31 error,
31 error,
32 extensions,
32 extensions,
33 fancyopts,
33 fancyopts,
34 hg,
34 hg,
35 hook,
35 hook,
36 ui as uimod,
36 ui as uimod,
37 util,
37 util,
38 )
38 )
39
39
40 class request(object):
40 class request(object):
41 def __init__(self, args, ui=None, repo=None, fin=None, fout=None,
41 def __init__(self, args, ui=None, repo=None, fin=None, fout=None,
42 ferr=None):
42 ferr=None):
43 self.args = args
43 self.args = args
44 self.ui = ui
44 self.ui = ui
45 self.repo = repo
45 self.repo = repo
46
46
47 # input/output/error streams
47 # input/output/error streams
48 self.fin = fin
48 self.fin = fin
49 self.fout = fout
49 self.fout = fout
50 self.ferr = ferr
50 self.ferr = ferr
51
51
52 def run():
52 def run():
53 "run the command in sys.argv"
53 "run the command in sys.argv"
54 sys.exit((dispatch(request(sys.argv[1:])) or 0) & 255)
54 sys.exit((dispatch(request(sys.argv[1:])) or 0) & 255)
55
55
56 def _getsimilar(symbols, value):
56 def _getsimilar(symbols, value):
57 sim = lambda x: difflib.SequenceMatcher(None, value, x).ratio()
57 sim = lambda x: difflib.SequenceMatcher(None, value, x).ratio()
58 # The cutoff for similarity here is pretty arbitrary. It should
58 # The cutoff for similarity here is pretty arbitrary. It should
59 # probably be investigated and tweaked.
59 # probably be investigated and tweaked.
60 return [s for s in symbols if sim(s) > 0.6]
60 return [s for s in symbols if sim(s) > 0.6]
61
61
62 def _reportsimilar(write, similar):
63 if len(similar) == 1:
64 write(_("(did you mean %s?)\n") % similar[0])
65 elif similar:
66 ss = ", ".join(sorted(similar))
67 write(_("(did you mean one of %s?)\n") % ss)
68
62 def _formatparse(write, inst):
69 def _formatparse(write, inst):
63 similar = []
70 similar = []
64 if isinstance(inst, error.UnknownIdentifier):
71 if isinstance(inst, error.UnknownIdentifier):
65 # make sure to check fileset first, as revset can invoke fileset
72 # make sure to check fileset first, as revset can invoke fileset
66 similar = _getsimilar(inst.symbols, inst.function)
73 similar = _getsimilar(inst.symbols, inst.function)
67 if len(inst.args) > 1:
74 if len(inst.args) > 1:
68 write(_("hg: parse error at %s: %s\n") %
75 write(_("hg: parse error at %s: %s\n") %
69 (inst.args[1], inst.args[0]))
76 (inst.args[1], inst.args[0]))
70 if (inst.args[0][0] == ' '):
77 if (inst.args[0][0] == ' '):
71 write(_("unexpected leading whitespace\n"))
78 write(_("unexpected leading whitespace\n"))
72 else:
79 else:
73 write(_("hg: parse error: %s\n") % inst.args[0])
80 write(_("hg: parse error: %s\n") % inst.args[0])
74 if similar:
81 _reportsimilar(write, similar)
75 if len(similar) == 1:
76 write(_("(did you mean %r?)\n") % similar[0])
77 else:
78 ss = ", ".join(sorted(similar))
79 write(_("(did you mean one of %s?)\n") % ss)
80
82
81 def dispatch(req):
83 def dispatch(req):
82 "run the command specified in req.args"
84 "run the command specified in req.args"
83 if req.ferr:
85 if req.ferr:
84 ferr = req.ferr
86 ferr = req.ferr
85 elif req.ui:
87 elif req.ui:
86 ferr = req.ui.ferr
88 ferr = req.ui.ferr
87 else:
89 else:
88 ferr = sys.stderr
90 ferr = sys.stderr
89
91
90 try:
92 try:
91 if not req.ui:
93 if not req.ui:
92 req.ui = uimod.ui()
94 req.ui = uimod.ui()
93 if '--traceback' in req.args:
95 if '--traceback' in req.args:
94 req.ui.setconfig('ui', 'traceback', 'on', '--traceback')
96 req.ui.setconfig('ui', 'traceback', 'on', '--traceback')
95
97
96 # set ui streams from the request
98 # set ui streams from the request
97 if req.fin:
99 if req.fin:
98 req.ui.fin = req.fin
100 req.ui.fin = req.fin
99 if req.fout:
101 if req.fout:
100 req.ui.fout = req.fout
102 req.ui.fout = req.fout
101 if req.ferr:
103 if req.ferr:
102 req.ui.ferr = req.ferr
104 req.ui.ferr = req.ferr
103 except error.Abort as inst:
105 except error.Abort as inst:
104 ferr.write(_("abort: %s\n") % inst)
106 ferr.write(_("abort: %s\n") % inst)
105 if inst.hint:
107 if inst.hint:
106 ferr.write(_("(%s)\n") % inst.hint)
108 ferr.write(_("(%s)\n") % inst.hint)
107 return -1
109 return -1
108 except error.ParseError as inst:
110 except error.ParseError as inst:
109 _formatparse(ferr.write, inst)
111 _formatparse(ferr.write, inst)
110 if inst.hint:
112 if inst.hint:
111 ferr.write(_("(%s)\n") % inst.hint)
113 ferr.write(_("(%s)\n") % inst.hint)
112 return -1
114 return -1
113
115
114 msg = ' '.join(' ' in a and repr(a) or a for a in req.args)
116 msg = ' '.join(' ' in a and repr(a) or a for a in req.args)
115 starttime = time.time()
117 starttime = time.time()
116 ret = None
118 ret = None
117 try:
119 try:
118 ret = _runcatch(req)
120 ret = _runcatch(req)
119 return ret
121 return ret
120 finally:
122 finally:
121 duration = time.time() - starttime
123 duration = time.time() - starttime
122 req.ui.log("commandfinish", "%s exited %s after %0.2f seconds\n",
124 req.ui.log("commandfinish", "%s exited %s after %0.2f seconds\n",
123 msg, ret or 0, duration)
125 msg, ret or 0, duration)
124
126
125 def _runcatch(req):
127 def _runcatch(req):
126 def catchterm(*args):
128 def catchterm(*args):
127 raise error.SignalInterrupt
129 raise error.SignalInterrupt
128
130
129 ui = req.ui
131 ui = req.ui
130 try:
132 try:
131 for name in 'SIGBREAK', 'SIGHUP', 'SIGTERM':
133 for name in 'SIGBREAK', 'SIGHUP', 'SIGTERM':
132 num = getattr(signal, name, None)
134 num = getattr(signal, name, None)
133 if num:
135 if num:
134 signal.signal(num, catchterm)
136 signal.signal(num, catchterm)
135 except ValueError:
137 except ValueError:
136 pass # happens if called in a thread
138 pass # happens if called in a thread
137
139
138 try:
140 try:
139 try:
141 try:
140 debugger = 'pdb'
142 debugger = 'pdb'
141 debugtrace = {
143 debugtrace = {
142 'pdb' : pdb.set_trace
144 'pdb' : pdb.set_trace
143 }
145 }
144 debugmortem = {
146 debugmortem = {
145 'pdb' : pdb.post_mortem
147 'pdb' : pdb.post_mortem
146 }
148 }
147
149
148 # read --config before doing anything else
150 # read --config before doing anything else
149 # (e.g. to change trust settings for reading .hg/hgrc)
151 # (e.g. to change trust settings for reading .hg/hgrc)
150 cfgs = _parseconfig(req.ui, _earlygetopt(['--config'], req.args))
152 cfgs = _parseconfig(req.ui, _earlygetopt(['--config'], req.args))
151
153
152 if req.repo:
154 if req.repo:
153 # copy configs that were passed on the cmdline (--config) to
155 # copy configs that were passed on the cmdline (--config) to
154 # the repo ui
156 # the repo ui
155 for sec, name, val in cfgs:
157 for sec, name, val in cfgs:
156 req.repo.ui.setconfig(sec, name, val, source='--config')
158 req.repo.ui.setconfig(sec, name, val, source='--config')
157
159
158 # developer config: ui.debugger
160 # developer config: ui.debugger
159 debugger = ui.config("ui", "debugger")
161 debugger = ui.config("ui", "debugger")
160 debugmod = pdb
162 debugmod = pdb
161 if not debugger or ui.plain():
163 if not debugger or ui.plain():
162 # if we are in HGPLAIN mode, then disable custom debugging
164 # if we are in HGPLAIN mode, then disable custom debugging
163 debugger = 'pdb'
165 debugger = 'pdb'
164 elif '--debugger' in req.args:
166 elif '--debugger' in req.args:
165 # This import can be slow for fancy debuggers, so only
167 # This import can be slow for fancy debuggers, so only
166 # do it when absolutely necessary, i.e. when actual
168 # do it when absolutely necessary, i.e. when actual
167 # debugging has been requested
169 # debugging has been requested
168 with demandimport.deactivated():
170 with demandimport.deactivated():
169 try:
171 try:
170 debugmod = __import__(debugger)
172 debugmod = __import__(debugger)
171 except ImportError:
173 except ImportError:
172 pass # Leave debugmod = pdb
174 pass # Leave debugmod = pdb
173
175
174 debugtrace[debugger] = debugmod.set_trace
176 debugtrace[debugger] = debugmod.set_trace
175 debugmortem[debugger] = debugmod.post_mortem
177 debugmortem[debugger] = debugmod.post_mortem
176
178
177 # enter the debugger before command execution
179 # enter the debugger before command execution
178 if '--debugger' in req.args:
180 if '--debugger' in req.args:
179 ui.warn(_("entering debugger - "
181 ui.warn(_("entering debugger - "
180 "type c to continue starting hg or h for help\n"))
182 "type c to continue starting hg or h for help\n"))
181
183
182 if (debugger != 'pdb' and
184 if (debugger != 'pdb' and
183 debugtrace[debugger] == debugtrace['pdb']):
185 debugtrace[debugger] == debugtrace['pdb']):
184 ui.warn(_("%s debugger specified "
186 ui.warn(_("%s debugger specified "
185 "but its module was not found\n") % debugger)
187 "but its module was not found\n") % debugger)
186 with demandimport.deactivated():
188 with demandimport.deactivated():
187 debugtrace[debugger]()
189 debugtrace[debugger]()
188 try:
190 try:
189 return _dispatch(req)
191 return _dispatch(req)
190 finally:
192 finally:
191 ui.flush()
193 ui.flush()
192 except: # re-raises
194 except: # re-raises
193 # enter the debugger when we hit an exception
195 # enter the debugger when we hit an exception
194 if '--debugger' in req.args:
196 if '--debugger' in req.args:
195 traceback.print_exc()
197 traceback.print_exc()
196 debugmortem[debugger](sys.exc_info()[2])
198 debugmortem[debugger](sys.exc_info()[2])
197 ui.traceback()
199 ui.traceback()
198 raise
200 raise
199
201
200 # Global exception handling, alphabetically
202 # Global exception handling, alphabetically
201 # Mercurial-specific first, followed by built-in and library exceptions
203 # Mercurial-specific first, followed by built-in and library exceptions
202 except error.AmbiguousCommand as inst:
204 except error.AmbiguousCommand as inst:
203 ui.warn(_("hg: command '%s' is ambiguous:\n %s\n") %
205 ui.warn(_("hg: command '%s' is ambiguous:\n %s\n") %
204 (inst.args[0], " ".join(inst.args[1])))
206 (inst.args[0], " ".join(inst.args[1])))
205 except error.ParseError as inst:
207 except error.ParseError as inst:
206 _formatparse(ui.warn, inst)
208 _formatparse(ui.warn, inst)
207 if inst.hint:
209 if inst.hint:
208 ui.warn(_("(%s)\n") % inst.hint)
210 ui.warn(_("(%s)\n") % inst.hint)
209 return -1
211 return -1
210 except error.LockHeld as inst:
212 except error.LockHeld as inst:
211 if inst.errno == errno.ETIMEDOUT:
213 if inst.errno == errno.ETIMEDOUT:
212 reason = _('timed out waiting for lock held by %s') % inst.locker
214 reason = _('timed out waiting for lock held by %s') % inst.locker
213 else:
215 else:
214 reason = _('lock held by %s') % inst.locker
216 reason = _('lock held by %s') % inst.locker
215 ui.warn(_("abort: %s: %s\n") % (inst.desc or inst.filename, reason))
217 ui.warn(_("abort: %s: %s\n") % (inst.desc or inst.filename, reason))
216 except error.LockUnavailable as inst:
218 except error.LockUnavailable as inst:
217 ui.warn(_("abort: could not lock %s: %s\n") %
219 ui.warn(_("abort: could not lock %s: %s\n") %
218 (inst.desc or inst.filename, inst.strerror))
220 (inst.desc or inst.filename, inst.strerror))
219 except error.CommandError as inst:
221 except error.CommandError as inst:
220 if inst.args[0]:
222 if inst.args[0]:
221 ui.warn(_("hg %s: %s\n") % (inst.args[0], inst.args[1]))
223 ui.warn(_("hg %s: %s\n") % (inst.args[0], inst.args[1]))
222 commands.help_(ui, inst.args[0], full=False, command=True)
224 commands.help_(ui, inst.args[0], full=False, command=True)
223 else:
225 else:
224 ui.warn(_("hg: %s\n") % inst.args[1])
226 ui.warn(_("hg: %s\n") % inst.args[1])
225 commands.help_(ui, 'shortlist')
227 commands.help_(ui, 'shortlist')
226 except error.OutOfBandError as inst:
228 except error.OutOfBandError as inst:
227 if inst.args:
229 if inst.args:
228 msg = _("abort: remote error:\n")
230 msg = _("abort: remote error:\n")
229 else:
231 else:
230 msg = _("abort: remote error\n")
232 msg = _("abort: remote error\n")
231 ui.warn(msg)
233 ui.warn(msg)
232 if inst.args:
234 if inst.args:
233 ui.warn(''.join(inst.args))
235 ui.warn(''.join(inst.args))
234 if inst.hint:
236 if inst.hint:
235 ui.warn('(%s)\n' % inst.hint)
237 ui.warn('(%s)\n' % inst.hint)
236 except error.RepoError as inst:
238 except error.RepoError as inst:
237 ui.warn(_("abort: %s!\n") % inst)
239 ui.warn(_("abort: %s!\n") % inst)
238 if inst.hint:
240 if inst.hint:
239 ui.warn(_("(%s)\n") % inst.hint)
241 ui.warn(_("(%s)\n") % inst.hint)
240 except error.ResponseError as inst:
242 except error.ResponseError as inst:
241 ui.warn(_("abort: %s") % inst.args[0])
243 ui.warn(_("abort: %s") % inst.args[0])
242 if not isinstance(inst.args[1], basestring):
244 if not isinstance(inst.args[1], basestring):
243 ui.warn(" %r\n" % (inst.args[1],))
245 ui.warn(" %r\n" % (inst.args[1],))
244 elif not inst.args[1]:
246 elif not inst.args[1]:
245 ui.warn(_(" empty string\n"))
247 ui.warn(_(" empty string\n"))
246 else:
248 else:
247 ui.warn("\n%r\n" % util.ellipsis(inst.args[1]))
249 ui.warn("\n%r\n" % util.ellipsis(inst.args[1]))
248 except error.CensoredNodeError as inst:
250 except error.CensoredNodeError as inst:
249 ui.warn(_("abort: file censored %s!\n") % inst)
251 ui.warn(_("abort: file censored %s!\n") % inst)
250 except error.RevlogError as inst:
252 except error.RevlogError as inst:
251 ui.warn(_("abort: %s!\n") % inst)
253 ui.warn(_("abort: %s!\n") % inst)
252 except error.SignalInterrupt:
254 except error.SignalInterrupt:
253 ui.warn(_("killed!\n"))
255 ui.warn(_("killed!\n"))
254 except error.UnknownCommand as inst:
256 except error.UnknownCommand as inst:
255 ui.warn(_("hg: unknown command '%s'\n") % inst.args[0])
257 ui.warn(_("hg: unknown command '%s'\n") % inst.args[0])
256 try:
258 try:
257 # check if the command is in a disabled extension
259 # check if the command is in a disabled extension
258 # (but don't check for extensions themselves)
260 # (but don't check for extensions themselves)
259 commands.help_(ui, inst.args[0], unknowncmd=True)
261 commands.help_(ui, inst.args[0], unknowncmd=True)
260 except (error.UnknownCommand, error.Abort):
262 except (error.UnknownCommand, error.Abort):
261 suggested = False
263 suggested = False
262 if len(inst.args) == 2:
264 if len(inst.args) == 2:
263 sim = _getsimilar(inst.args[1], inst.args[0])
265 sim = _getsimilar(inst.args[1], inst.args[0])
264 if sim:
266 if sim:
265 ui.warn(_('(did you mean one of %s?)\n') %
267 _reportsimilar(ui.warn, sim)
266 ', '.join(sorted(sim)))
267 suggested = True
268 suggested = True
268 if not suggested:
269 if not suggested:
269 commands.help_(ui, 'shortlist')
270 commands.help_(ui, 'shortlist')
270 except error.InterventionRequired as inst:
271 except error.InterventionRequired as inst:
271 ui.warn("%s\n" % inst)
272 ui.warn("%s\n" % inst)
272 return 1
273 return 1
273 except error.Abort as inst:
274 except error.Abort as inst:
274 ui.warn(_("abort: %s\n") % inst)
275 ui.warn(_("abort: %s\n") % inst)
275 if inst.hint:
276 if inst.hint:
276 ui.warn(_("(%s)\n") % inst.hint)
277 ui.warn(_("(%s)\n") % inst.hint)
277 except ImportError as inst:
278 except ImportError as inst:
278 ui.warn(_("abort: %s!\n") % inst)
279 ui.warn(_("abort: %s!\n") % inst)
279 m = str(inst).split()[-1]
280 m = str(inst).split()[-1]
280 if m in "mpatch bdiff".split():
281 if m in "mpatch bdiff".split():
281 ui.warn(_("(did you forget to compile extensions?)\n"))
282 ui.warn(_("(did you forget to compile extensions?)\n"))
282 elif m in "zlib".split():
283 elif m in "zlib".split():
283 ui.warn(_("(is your Python install correct?)\n"))
284 ui.warn(_("(is your Python install correct?)\n"))
284 except IOError as inst:
285 except IOError as inst:
285 if util.safehasattr(inst, "code"):
286 if util.safehasattr(inst, "code"):
286 ui.warn(_("abort: %s\n") % inst)
287 ui.warn(_("abort: %s\n") % inst)
287 elif util.safehasattr(inst, "reason"):
288 elif util.safehasattr(inst, "reason"):
288 try: # usually it is in the form (errno, strerror)
289 try: # usually it is in the form (errno, strerror)
289 reason = inst.reason.args[1]
290 reason = inst.reason.args[1]
290 except (AttributeError, IndexError):
291 except (AttributeError, IndexError):
291 # it might be anything, for example a string
292 # it might be anything, for example a string
292 reason = inst.reason
293 reason = inst.reason
293 if isinstance(reason, unicode):
294 if isinstance(reason, unicode):
294 # SSLError of Python 2.7.9 contains a unicode
295 # SSLError of Python 2.7.9 contains a unicode
295 reason = reason.encode(encoding.encoding, 'replace')
296 reason = reason.encode(encoding.encoding, 'replace')
296 ui.warn(_("abort: error: %s\n") % reason)
297 ui.warn(_("abort: error: %s\n") % reason)
297 elif (util.safehasattr(inst, "args")
298 elif (util.safehasattr(inst, "args")
298 and inst.args and inst.args[0] == errno.EPIPE):
299 and inst.args and inst.args[0] == errno.EPIPE):
299 pass
300 pass
300 elif getattr(inst, "strerror", None):
301 elif getattr(inst, "strerror", None):
301 if getattr(inst, "filename", None):
302 if getattr(inst, "filename", None):
302 ui.warn(_("abort: %s: %s\n") % (inst.strerror, inst.filename))
303 ui.warn(_("abort: %s: %s\n") % (inst.strerror, inst.filename))
303 else:
304 else:
304 ui.warn(_("abort: %s\n") % inst.strerror)
305 ui.warn(_("abort: %s\n") % inst.strerror)
305 else:
306 else:
306 raise
307 raise
307 except OSError as inst:
308 except OSError as inst:
308 if getattr(inst, "filename", None) is not None:
309 if getattr(inst, "filename", None) is not None:
309 ui.warn(_("abort: %s: '%s'\n") % (inst.strerror, inst.filename))
310 ui.warn(_("abort: %s: '%s'\n") % (inst.strerror, inst.filename))
310 else:
311 else:
311 ui.warn(_("abort: %s\n") % inst.strerror)
312 ui.warn(_("abort: %s\n") % inst.strerror)
312 except KeyboardInterrupt:
313 except KeyboardInterrupt:
313 try:
314 try:
314 ui.warn(_("interrupted!\n"))
315 ui.warn(_("interrupted!\n"))
315 except IOError as inst:
316 except IOError as inst:
316 if inst.errno != errno.EPIPE:
317 if inst.errno != errno.EPIPE:
317 raise
318 raise
318 except MemoryError:
319 except MemoryError:
319 ui.warn(_("abort: out of memory\n"))
320 ui.warn(_("abort: out of memory\n"))
320 except SystemExit as inst:
321 except SystemExit as inst:
321 # Commands shouldn't sys.exit directly, but give a return code.
322 # Commands shouldn't sys.exit directly, but give a return code.
322 # Just in case catch this and and pass exit code to caller.
323 # Just in case catch this and and pass exit code to caller.
323 return inst.code
324 return inst.code
324 except socket.error as inst:
325 except socket.error as inst:
325 ui.warn(_("abort: %s\n") % inst.args[-1])
326 ui.warn(_("abort: %s\n") % inst.args[-1])
326 except: # re-raises
327 except: # re-raises
327 # For compatibility checking, we discard the portion of the hg
328 # For compatibility checking, we discard the portion of the hg
328 # version after the + on the assumption that if a "normal
329 # version after the + on the assumption that if a "normal
329 # user" is running a build with a + in it the packager
330 # user" is running a build with a + in it the packager
330 # probably built from fairly close to a tag and anyone with a
331 # probably built from fairly close to a tag and anyone with a
331 # 'make local' copy of hg (where the version number can be out
332 # 'make local' copy of hg (where the version number can be out
332 # of date) will be clueful enough to notice the implausible
333 # of date) will be clueful enough to notice the implausible
333 # version number and try updating.
334 # version number and try updating.
334 ct = util.versiontuple(n=2)
335 ct = util.versiontuple(n=2)
335 worst = None, ct, ''
336 worst = None, ct, ''
336 if ui.config('ui', 'supportcontact', None) is None:
337 if ui.config('ui', 'supportcontact', None) is None:
337 for name, mod in extensions.extensions():
338 for name, mod in extensions.extensions():
338 testedwith = getattr(mod, 'testedwith', '')
339 testedwith = getattr(mod, 'testedwith', '')
339 report = getattr(mod, 'buglink', _('the extension author.'))
340 report = getattr(mod, 'buglink', _('the extension author.'))
340 if not testedwith.strip():
341 if not testedwith.strip():
341 # We found an untested extension. It's likely the culprit.
342 # We found an untested extension. It's likely the culprit.
342 worst = name, 'unknown', report
343 worst = name, 'unknown', report
343 break
344 break
344
345
345 # Never blame on extensions bundled with Mercurial.
346 # Never blame on extensions bundled with Mercurial.
346 if testedwith == 'internal':
347 if testedwith == 'internal':
347 continue
348 continue
348
349
349 tested = [util.versiontuple(t, 2) for t in testedwith.split()]
350 tested = [util.versiontuple(t, 2) for t in testedwith.split()]
350 if ct in tested:
351 if ct in tested:
351 continue
352 continue
352
353
353 lower = [t for t in tested if t < ct]
354 lower = [t for t in tested if t < ct]
354 nearest = max(lower or tested)
355 nearest = max(lower or tested)
355 if worst[0] is None or nearest < worst[1]:
356 if worst[0] is None or nearest < worst[1]:
356 worst = name, nearest, report
357 worst = name, nearest, report
357 if worst[0] is not None:
358 if worst[0] is not None:
358 name, testedwith, report = worst
359 name, testedwith, report = worst
359 if not isinstance(testedwith, str):
360 if not isinstance(testedwith, str):
360 testedwith = '.'.join([str(c) for c in testedwith])
361 testedwith = '.'.join([str(c) for c in testedwith])
361 warning = (_('** Unknown exception encountered with '
362 warning = (_('** Unknown exception encountered with '
362 'possibly-broken third-party extension %s\n'
363 'possibly-broken third-party extension %s\n'
363 '** which supports versions %s of Mercurial.\n'
364 '** which supports versions %s of Mercurial.\n'
364 '** Please disable %s and try your action again.\n'
365 '** Please disable %s and try your action again.\n'
365 '** If that fixes the bug please report it to %s\n')
366 '** If that fixes the bug please report it to %s\n')
366 % (name, testedwith, name, report))
367 % (name, testedwith, name, report))
367 else:
368 else:
368 bugtracker = ui.config('ui', 'supportcontact', None)
369 bugtracker = ui.config('ui', 'supportcontact', None)
369 if bugtracker is None:
370 if bugtracker is None:
370 bugtracker = _("https://mercurial-scm.org/wiki/BugTracker")
371 bugtracker = _("https://mercurial-scm.org/wiki/BugTracker")
371 warning = (_("** unknown exception encountered, "
372 warning = (_("** unknown exception encountered, "
372 "please report by visiting\n** ") + bugtracker + '\n')
373 "please report by visiting\n** ") + bugtracker + '\n')
373 warning += ((_("** Python %s\n") % sys.version.replace('\n', '')) +
374 warning += ((_("** Python %s\n") % sys.version.replace('\n', '')) +
374 (_("** Mercurial Distributed SCM (version %s)\n") %
375 (_("** Mercurial Distributed SCM (version %s)\n") %
375 util.version()) +
376 util.version()) +
376 (_("** Extensions loaded: %s\n") %
377 (_("** Extensions loaded: %s\n") %
377 ", ".join([x[0] for x in extensions.extensions()])))
378 ", ".join([x[0] for x in extensions.extensions()])))
378 ui.log("commandexception", "%s\n%s\n", warning, traceback.format_exc())
379 ui.log("commandexception", "%s\n%s\n", warning, traceback.format_exc())
379 ui.warn(warning)
380 ui.warn(warning)
380 raise
381 raise
381
382
382 return -1
383 return -1
383
384
384 def aliasargs(fn, givenargs):
385 def aliasargs(fn, givenargs):
385 args = getattr(fn, 'args', [])
386 args = getattr(fn, 'args', [])
386 if args:
387 if args:
387 cmd = ' '.join(map(util.shellquote, args))
388 cmd = ' '.join(map(util.shellquote, args))
388
389
389 nums = []
390 nums = []
390 def replacer(m):
391 def replacer(m):
391 num = int(m.group(1)) - 1
392 num = int(m.group(1)) - 1
392 nums.append(num)
393 nums.append(num)
393 if num < len(givenargs):
394 if num < len(givenargs):
394 return givenargs[num]
395 return givenargs[num]
395 raise error.Abort(_('too few arguments for command alias'))
396 raise error.Abort(_('too few arguments for command alias'))
396 cmd = re.sub(r'\$(\d+|\$)', replacer, cmd)
397 cmd = re.sub(r'\$(\d+|\$)', replacer, cmd)
397 givenargs = [x for i, x in enumerate(givenargs)
398 givenargs = [x for i, x in enumerate(givenargs)
398 if i not in nums]
399 if i not in nums]
399 args = shlex.split(cmd)
400 args = shlex.split(cmd)
400 return args + givenargs
401 return args + givenargs
401
402
402 def aliasinterpolate(name, args, cmd):
403 def aliasinterpolate(name, args, cmd):
403 '''interpolate args into cmd for shell aliases
404 '''interpolate args into cmd for shell aliases
404
405
405 This also handles $0, $@ and "$@".
406 This also handles $0, $@ and "$@".
406 '''
407 '''
407 # util.interpolate can't deal with "$@" (with quotes) because it's only
408 # util.interpolate can't deal with "$@" (with quotes) because it's only
408 # built to match prefix + patterns.
409 # built to match prefix + patterns.
409 replacemap = dict(('$%d' % (i + 1), arg) for i, arg in enumerate(args))
410 replacemap = dict(('$%d' % (i + 1), arg) for i, arg in enumerate(args))
410 replacemap['$0'] = name
411 replacemap['$0'] = name
411 replacemap['$$'] = '$'
412 replacemap['$$'] = '$'
412 replacemap['$@'] = ' '.join(args)
413 replacemap['$@'] = ' '.join(args)
413 # Typical Unix shells interpolate "$@" (with quotes) as all the positional
414 # Typical Unix shells interpolate "$@" (with quotes) as all the positional
414 # parameters, separated out into words. Emulate the same behavior here by
415 # parameters, separated out into words. Emulate the same behavior here by
415 # quoting the arguments individually. POSIX shells will then typically
416 # quoting the arguments individually. POSIX shells will then typically
416 # tokenize each argument into exactly one word.
417 # tokenize each argument into exactly one word.
417 replacemap['"$@"'] = ' '.join(util.shellquote(arg) for arg in args)
418 replacemap['"$@"'] = ' '.join(util.shellquote(arg) for arg in args)
418 # escape '\$' for regex
419 # escape '\$' for regex
419 regex = '|'.join(replacemap.keys()).replace('$', r'\$')
420 regex = '|'.join(replacemap.keys()).replace('$', r'\$')
420 r = re.compile(regex)
421 r = re.compile(regex)
421 return r.sub(lambda x: replacemap[x.group()], cmd)
422 return r.sub(lambda x: replacemap[x.group()], cmd)
422
423
423 class cmdalias(object):
424 class cmdalias(object):
424 def __init__(self, name, definition, cmdtable):
425 def __init__(self, name, definition, cmdtable):
425 self.name = self.cmd = name
426 self.name = self.cmd = name
426 self.cmdname = ''
427 self.cmdname = ''
427 self.definition = definition
428 self.definition = definition
428 self.fn = None
429 self.fn = None
429 self.args = []
430 self.args = []
430 self.opts = []
431 self.opts = []
431 self.help = ''
432 self.help = ''
432 self.norepo = True
433 self.norepo = True
433 self.optionalrepo = False
434 self.optionalrepo = False
434 self.badalias = None
435 self.badalias = None
435 self.unknowncmd = False
436 self.unknowncmd = False
436
437
437 try:
438 try:
438 aliases, entry = cmdutil.findcmd(self.name, cmdtable)
439 aliases, entry = cmdutil.findcmd(self.name, cmdtable)
439 for alias, e in cmdtable.iteritems():
440 for alias, e in cmdtable.iteritems():
440 if e is entry:
441 if e is entry:
441 self.cmd = alias
442 self.cmd = alias
442 break
443 break
443 self.shadows = True
444 self.shadows = True
444 except error.UnknownCommand:
445 except error.UnknownCommand:
445 self.shadows = False
446 self.shadows = False
446
447
447 if not self.definition:
448 if not self.definition:
448 self.badalias = _("no definition for alias '%s'") % self.name
449 self.badalias = _("no definition for alias '%s'") % self.name
449 return
450 return
450
451
451 if self.definition.startswith('!'):
452 if self.definition.startswith('!'):
452 self.shell = True
453 self.shell = True
453 def fn(ui, *args):
454 def fn(ui, *args):
454 env = {'HG_ARGS': ' '.join((self.name,) + args)}
455 env = {'HG_ARGS': ' '.join((self.name,) + args)}
455 def _checkvar(m):
456 def _checkvar(m):
456 if m.groups()[0] == '$':
457 if m.groups()[0] == '$':
457 return m.group()
458 return m.group()
458 elif int(m.groups()[0]) <= len(args):
459 elif int(m.groups()[0]) <= len(args):
459 return m.group()
460 return m.group()
460 else:
461 else:
461 ui.debug("No argument found for substitution "
462 ui.debug("No argument found for substitution "
462 "of %i variable in alias '%s' definition."
463 "of %i variable in alias '%s' definition."
463 % (int(m.groups()[0]), self.name))
464 % (int(m.groups()[0]), self.name))
464 return ''
465 return ''
465 cmd = re.sub(r'\$(\d+|\$)', _checkvar, self.definition[1:])
466 cmd = re.sub(r'\$(\d+|\$)', _checkvar, self.definition[1:])
466 cmd = aliasinterpolate(self.name, args, cmd)
467 cmd = aliasinterpolate(self.name, args, cmd)
467 return ui.system(cmd, environ=env)
468 return ui.system(cmd, environ=env)
468 self.fn = fn
469 self.fn = fn
469 return
470 return
470
471
471 try:
472 try:
472 args = shlex.split(self.definition)
473 args = shlex.split(self.definition)
473 except ValueError as inst:
474 except ValueError as inst:
474 self.badalias = (_("error in definition for alias '%s': %s")
475 self.badalias = (_("error in definition for alias '%s': %s")
475 % (self.name, inst))
476 % (self.name, inst))
476 return
477 return
477 self.cmdname = cmd = args.pop(0)
478 self.cmdname = cmd = args.pop(0)
478 args = map(util.expandpath, args)
479 args = map(util.expandpath, args)
479
480
480 for invalidarg in ("--cwd", "-R", "--repository", "--repo", "--config"):
481 for invalidarg in ("--cwd", "-R", "--repository", "--repo", "--config"):
481 if _earlygetopt([invalidarg], args):
482 if _earlygetopt([invalidarg], args):
482 self.badalias = (_("error in definition for alias '%s': %s may "
483 self.badalias = (_("error in definition for alias '%s': %s may "
483 "only be given on the command line")
484 "only be given on the command line")
484 % (self.name, invalidarg))
485 % (self.name, invalidarg))
485 return
486 return
486
487
487 try:
488 try:
488 tableentry = cmdutil.findcmd(cmd, cmdtable, False)[1]
489 tableentry = cmdutil.findcmd(cmd, cmdtable, False)[1]
489 if len(tableentry) > 2:
490 if len(tableentry) > 2:
490 self.fn, self.opts, self.help = tableentry
491 self.fn, self.opts, self.help = tableentry
491 else:
492 else:
492 self.fn, self.opts = tableentry
493 self.fn, self.opts = tableentry
493
494
494 self.args = aliasargs(self.fn, args)
495 self.args = aliasargs(self.fn, args)
495 if cmd not in commands.norepo.split(' '):
496 if cmd not in commands.norepo.split(' '):
496 self.norepo = False
497 self.norepo = False
497 if cmd in commands.optionalrepo.split(' '):
498 if cmd in commands.optionalrepo.split(' '):
498 self.optionalrepo = True
499 self.optionalrepo = True
499 if self.help.startswith("hg " + cmd):
500 if self.help.startswith("hg " + cmd):
500 # drop prefix in old-style help lines so hg shows the alias
501 # drop prefix in old-style help lines so hg shows the alias
501 self.help = self.help[4 + len(cmd):]
502 self.help = self.help[4 + len(cmd):]
502 self.__doc__ = self.fn.__doc__
503 self.__doc__ = self.fn.__doc__
503
504
504 except error.UnknownCommand:
505 except error.UnknownCommand:
505 self.badalias = (_("alias '%s' resolves to unknown command '%s'")
506 self.badalias = (_("alias '%s' resolves to unknown command '%s'")
506 % (self.name, cmd))
507 % (self.name, cmd))
507 self.unknowncmd = True
508 self.unknowncmd = True
508 except error.AmbiguousCommand:
509 except error.AmbiguousCommand:
509 self.badalias = (_("alias '%s' resolves to ambiguous command '%s'")
510 self.badalias = (_("alias '%s' resolves to ambiguous command '%s'")
510 % (self.name, cmd))
511 % (self.name, cmd))
511
512
512 def __call__(self, ui, *args, **opts):
513 def __call__(self, ui, *args, **opts):
513 if self.badalias:
514 if self.badalias:
514 hint = None
515 hint = None
515 if self.unknowncmd:
516 if self.unknowncmd:
516 try:
517 try:
517 # check if the command is in a disabled extension
518 # check if the command is in a disabled extension
518 cmd, ext = extensions.disabledcmd(ui, self.cmdname)[:2]
519 cmd, ext = extensions.disabledcmd(ui, self.cmdname)[:2]
519 hint = _("'%s' is provided by '%s' extension") % (cmd, ext)
520 hint = _("'%s' is provided by '%s' extension") % (cmd, ext)
520 except error.UnknownCommand:
521 except error.UnknownCommand:
521 pass
522 pass
522 raise error.Abort(self.badalias, hint=hint)
523 raise error.Abort(self.badalias, hint=hint)
523 if self.shadows:
524 if self.shadows:
524 ui.debug("alias '%s' shadows command '%s'\n" %
525 ui.debug("alias '%s' shadows command '%s'\n" %
525 (self.name, self.cmdname))
526 (self.name, self.cmdname))
526
527
527 if util.safehasattr(self, 'shell'):
528 if util.safehasattr(self, 'shell'):
528 return self.fn(ui, *args, **opts)
529 return self.fn(ui, *args, **opts)
529 else:
530 else:
530 try:
531 try:
531 return util.checksignature(self.fn)(ui, *args, **opts)
532 return util.checksignature(self.fn)(ui, *args, **opts)
532 except error.SignatureError:
533 except error.SignatureError:
533 args = ' '.join([self.cmdname] + self.args)
534 args = ' '.join([self.cmdname] + self.args)
534 ui.debug("alias '%s' expands to '%s'\n" % (self.name, args))
535 ui.debug("alias '%s' expands to '%s'\n" % (self.name, args))
535 raise
536 raise
536
537
537 def addaliases(ui, cmdtable):
538 def addaliases(ui, cmdtable):
538 # aliases are processed after extensions have been loaded, so they
539 # aliases are processed after extensions have been loaded, so they
539 # may use extension commands. Aliases can also use other alias definitions,
540 # may use extension commands. Aliases can also use other alias definitions,
540 # but only if they have been defined prior to the current definition.
541 # but only if they have been defined prior to the current definition.
541 for alias, definition in ui.configitems('alias'):
542 for alias, definition in ui.configitems('alias'):
542 aliasdef = cmdalias(alias, definition, cmdtable)
543 aliasdef = cmdalias(alias, definition, cmdtable)
543
544
544 try:
545 try:
545 olddef = cmdtable[aliasdef.cmd][0]
546 olddef = cmdtable[aliasdef.cmd][0]
546 if olddef.definition == aliasdef.definition:
547 if olddef.definition == aliasdef.definition:
547 continue
548 continue
548 except (KeyError, AttributeError):
549 except (KeyError, AttributeError):
549 # definition might not exist or it might not be a cmdalias
550 # definition might not exist or it might not be a cmdalias
550 pass
551 pass
551
552
552 cmdtable[aliasdef.name] = (aliasdef, aliasdef.opts, aliasdef.help)
553 cmdtable[aliasdef.name] = (aliasdef, aliasdef.opts, aliasdef.help)
553 if aliasdef.norepo:
554 if aliasdef.norepo:
554 commands.norepo += ' %s' % alias
555 commands.norepo += ' %s' % alias
555 if aliasdef.optionalrepo:
556 if aliasdef.optionalrepo:
556 commands.optionalrepo += ' %s' % alias
557 commands.optionalrepo += ' %s' % alias
557
558
558 def _parse(ui, args):
559 def _parse(ui, args):
559 options = {}
560 options = {}
560 cmdoptions = {}
561 cmdoptions = {}
561
562
562 try:
563 try:
563 args = fancyopts.fancyopts(args, commands.globalopts, options)
564 args = fancyopts.fancyopts(args, commands.globalopts, options)
564 except fancyopts.getopt.GetoptError as inst:
565 except fancyopts.getopt.GetoptError as inst:
565 raise error.CommandError(None, inst)
566 raise error.CommandError(None, inst)
566
567
567 if args:
568 if args:
568 cmd, args = args[0], args[1:]
569 cmd, args = args[0], args[1:]
569 aliases, entry = cmdutil.findcmd(cmd, commands.table,
570 aliases, entry = cmdutil.findcmd(cmd, commands.table,
570 ui.configbool("ui", "strict"))
571 ui.configbool("ui", "strict"))
571 cmd = aliases[0]
572 cmd = aliases[0]
572 args = aliasargs(entry[0], args)
573 args = aliasargs(entry[0], args)
573 defaults = ui.config("defaults", cmd)
574 defaults = ui.config("defaults", cmd)
574 if defaults:
575 if defaults:
575 args = map(util.expandpath, shlex.split(defaults)) + args
576 args = map(util.expandpath, shlex.split(defaults)) + args
576 c = list(entry[1])
577 c = list(entry[1])
577 else:
578 else:
578 cmd = None
579 cmd = None
579 c = []
580 c = []
580
581
581 # combine global options into local
582 # combine global options into local
582 for o in commands.globalopts:
583 for o in commands.globalopts:
583 c.append((o[0], o[1], options[o[1]], o[3]))
584 c.append((o[0], o[1], options[o[1]], o[3]))
584
585
585 try:
586 try:
586 args = fancyopts.fancyopts(args, c, cmdoptions, True)
587 args = fancyopts.fancyopts(args, c, cmdoptions, True)
587 except fancyopts.getopt.GetoptError as inst:
588 except fancyopts.getopt.GetoptError as inst:
588 raise error.CommandError(cmd, inst)
589 raise error.CommandError(cmd, inst)
589
590
590 # separate global options back out
591 # separate global options back out
591 for o in commands.globalopts:
592 for o in commands.globalopts:
592 n = o[1]
593 n = o[1]
593 options[n] = cmdoptions[n]
594 options[n] = cmdoptions[n]
594 del cmdoptions[n]
595 del cmdoptions[n]
595
596
596 return (cmd, cmd and entry[0] or None, args, options, cmdoptions)
597 return (cmd, cmd and entry[0] or None, args, options, cmdoptions)
597
598
598 def _parseconfig(ui, config):
599 def _parseconfig(ui, config):
599 """parse the --config options from the command line"""
600 """parse the --config options from the command line"""
600 configs = []
601 configs = []
601
602
602 for cfg in config:
603 for cfg in config:
603 try:
604 try:
604 name, value = cfg.split('=', 1)
605 name, value = cfg.split('=', 1)
605 section, name = name.split('.', 1)
606 section, name = name.split('.', 1)
606 if not section or not name:
607 if not section or not name:
607 raise IndexError
608 raise IndexError
608 ui.setconfig(section, name, value, '--config')
609 ui.setconfig(section, name, value, '--config')
609 configs.append((section, name, value))
610 configs.append((section, name, value))
610 except (IndexError, ValueError):
611 except (IndexError, ValueError):
611 raise error.Abort(_('malformed --config option: %r '
612 raise error.Abort(_('malformed --config option: %r '
612 '(use --config section.name=value)') % cfg)
613 '(use --config section.name=value)') % cfg)
613
614
614 return configs
615 return configs
615
616
616 def _earlygetopt(aliases, args):
617 def _earlygetopt(aliases, args):
617 """Return list of values for an option (or aliases).
618 """Return list of values for an option (or aliases).
618
619
619 The values are listed in the order they appear in args.
620 The values are listed in the order they appear in args.
620 The options and values are removed from args.
621 The options and values are removed from args.
621
622
622 >>> args = ['x', '--cwd', 'foo', 'y']
623 >>> args = ['x', '--cwd', 'foo', 'y']
623 >>> _earlygetopt(['--cwd'], args), args
624 >>> _earlygetopt(['--cwd'], args), args
624 (['foo'], ['x', 'y'])
625 (['foo'], ['x', 'y'])
625
626
626 >>> args = ['x', '--cwd=bar', 'y']
627 >>> args = ['x', '--cwd=bar', 'y']
627 >>> _earlygetopt(['--cwd'], args), args
628 >>> _earlygetopt(['--cwd'], args), args
628 (['bar'], ['x', 'y'])
629 (['bar'], ['x', 'y'])
629
630
630 >>> args = ['x', '-R', 'foo', 'y']
631 >>> args = ['x', '-R', 'foo', 'y']
631 >>> _earlygetopt(['-R'], args), args
632 >>> _earlygetopt(['-R'], args), args
632 (['foo'], ['x', 'y'])
633 (['foo'], ['x', 'y'])
633
634
634 >>> args = ['x', '-Rbar', 'y']
635 >>> args = ['x', '-Rbar', 'y']
635 >>> _earlygetopt(['-R'], args), args
636 >>> _earlygetopt(['-R'], args), args
636 (['bar'], ['x', 'y'])
637 (['bar'], ['x', 'y'])
637 """
638 """
638 try:
639 try:
639 argcount = args.index("--")
640 argcount = args.index("--")
640 except ValueError:
641 except ValueError:
641 argcount = len(args)
642 argcount = len(args)
642 shortopts = [opt for opt in aliases if len(opt) == 2]
643 shortopts = [opt for opt in aliases if len(opt) == 2]
643 values = []
644 values = []
644 pos = 0
645 pos = 0
645 while pos < argcount:
646 while pos < argcount:
646 fullarg = arg = args[pos]
647 fullarg = arg = args[pos]
647 equals = arg.find('=')
648 equals = arg.find('=')
648 if equals > -1:
649 if equals > -1:
649 arg = arg[:equals]
650 arg = arg[:equals]
650 if arg in aliases:
651 if arg in aliases:
651 del args[pos]
652 del args[pos]
652 if equals > -1:
653 if equals > -1:
653 values.append(fullarg[equals + 1:])
654 values.append(fullarg[equals + 1:])
654 argcount -= 1
655 argcount -= 1
655 else:
656 else:
656 if pos + 1 >= argcount:
657 if pos + 1 >= argcount:
657 # ignore and let getopt report an error if there is no value
658 # ignore and let getopt report an error if there is no value
658 break
659 break
659 values.append(args.pop(pos))
660 values.append(args.pop(pos))
660 argcount -= 2
661 argcount -= 2
661 elif arg[:2] in shortopts:
662 elif arg[:2] in shortopts:
662 # short option can have no following space, e.g. hg log -Rfoo
663 # short option can have no following space, e.g. hg log -Rfoo
663 values.append(args.pop(pos)[2:])
664 values.append(args.pop(pos)[2:])
664 argcount -= 1
665 argcount -= 1
665 else:
666 else:
666 pos += 1
667 pos += 1
667 return values
668 return values
668
669
669 def runcommand(lui, repo, cmd, fullargs, ui, options, d, cmdpats, cmdoptions):
670 def runcommand(lui, repo, cmd, fullargs, ui, options, d, cmdpats, cmdoptions):
670 # run pre-hook, and abort if it fails
671 # run pre-hook, and abort if it fails
671 hook.hook(lui, repo, "pre-%s" % cmd, True, args=" ".join(fullargs),
672 hook.hook(lui, repo, "pre-%s" % cmd, True, args=" ".join(fullargs),
672 pats=cmdpats, opts=cmdoptions)
673 pats=cmdpats, opts=cmdoptions)
673 ret = _runcommand(ui, options, cmd, d)
674 ret = _runcommand(ui, options, cmd, d)
674 # run post-hook, passing command result
675 # run post-hook, passing command result
675 hook.hook(lui, repo, "post-%s" % cmd, False, args=" ".join(fullargs),
676 hook.hook(lui, repo, "post-%s" % cmd, False, args=" ".join(fullargs),
676 result=ret, pats=cmdpats, opts=cmdoptions)
677 result=ret, pats=cmdpats, opts=cmdoptions)
677 return ret
678 return ret
678
679
679 def _getlocal(ui, rpath):
680 def _getlocal(ui, rpath):
680 """Return (path, local ui object) for the given target path.
681 """Return (path, local ui object) for the given target path.
681
682
682 Takes paths in [cwd]/.hg/hgrc into account."
683 Takes paths in [cwd]/.hg/hgrc into account."
683 """
684 """
684 try:
685 try:
685 wd = os.getcwd()
686 wd = os.getcwd()
686 except OSError as e:
687 except OSError as e:
687 raise error.Abort(_("error getting current working directory: %s") %
688 raise error.Abort(_("error getting current working directory: %s") %
688 e.strerror)
689 e.strerror)
689 path = cmdutil.findrepo(wd) or ""
690 path = cmdutil.findrepo(wd) or ""
690 if not path:
691 if not path:
691 lui = ui
692 lui = ui
692 else:
693 else:
693 lui = ui.copy()
694 lui = ui.copy()
694 lui.readconfig(os.path.join(path, ".hg", "hgrc"), path)
695 lui.readconfig(os.path.join(path, ".hg", "hgrc"), path)
695
696
696 if rpath and rpath[-1]:
697 if rpath and rpath[-1]:
697 path = lui.expandpath(rpath[-1])
698 path = lui.expandpath(rpath[-1])
698 lui = ui.copy()
699 lui = ui.copy()
699 lui.readconfig(os.path.join(path, ".hg", "hgrc"), path)
700 lui.readconfig(os.path.join(path, ".hg", "hgrc"), path)
700
701
701 return path, lui
702 return path, lui
702
703
703 def _checkshellalias(lui, ui, args, precheck=True):
704 def _checkshellalias(lui, ui, args, precheck=True):
704 """Return the function to run the shell alias, if it is required
705 """Return the function to run the shell alias, if it is required
705
706
706 'precheck' is whether this function is invoked before adding
707 'precheck' is whether this function is invoked before adding
707 aliases or not.
708 aliases or not.
708 """
709 """
709 options = {}
710 options = {}
710
711
711 try:
712 try:
712 args = fancyopts.fancyopts(args, commands.globalopts, options)
713 args = fancyopts.fancyopts(args, commands.globalopts, options)
713 except fancyopts.getopt.GetoptError:
714 except fancyopts.getopt.GetoptError:
714 return
715 return
715
716
716 if not args:
717 if not args:
717 return
718 return
718
719
719 if precheck:
720 if precheck:
720 strict = True
721 strict = True
721 norepo = commands.norepo
722 norepo = commands.norepo
722 optionalrepo = commands.optionalrepo
723 optionalrepo = commands.optionalrepo
723 def restorecommands():
724 def restorecommands():
724 commands.norepo = norepo
725 commands.norepo = norepo
725 commands.optionalrepo = optionalrepo
726 commands.optionalrepo = optionalrepo
726 cmdtable = commands.table.copy()
727 cmdtable = commands.table.copy()
727 addaliases(lui, cmdtable)
728 addaliases(lui, cmdtable)
728 else:
729 else:
729 strict = False
730 strict = False
730 def restorecommands():
731 def restorecommands():
731 pass
732 pass
732 cmdtable = commands.table
733 cmdtable = commands.table
733
734
734 cmd = args[0]
735 cmd = args[0]
735 try:
736 try:
736 aliases, entry = cmdutil.findcmd(cmd, cmdtable, strict)
737 aliases, entry = cmdutil.findcmd(cmd, cmdtable, strict)
737 except (error.AmbiguousCommand, error.UnknownCommand):
738 except (error.AmbiguousCommand, error.UnknownCommand):
738 restorecommands()
739 restorecommands()
739 return
740 return
740
741
741 cmd = aliases[0]
742 cmd = aliases[0]
742 fn = entry[0]
743 fn = entry[0]
743
744
744 if cmd and util.safehasattr(fn, 'shell'):
745 if cmd and util.safehasattr(fn, 'shell'):
745 d = lambda: fn(ui, *args[1:])
746 d = lambda: fn(ui, *args[1:])
746 return lambda: runcommand(lui, None, cmd, args[:1], ui, options, d,
747 return lambda: runcommand(lui, None, cmd, args[:1], ui, options, d,
747 [], {})
748 [], {})
748
749
749 restorecommands()
750 restorecommands()
750
751
751 _loaded = set()
752 _loaded = set()
752 def _dispatch(req):
753 def _dispatch(req):
753 args = req.args
754 args = req.args
754 ui = req.ui
755 ui = req.ui
755
756
756 # check for cwd
757 # check for cwd
757 cwd = _earlygetopt(['--cwd'], args)
758 cwd = _earlygetopt(['--cwd'], args)
758 if cwd:
759 if cwd:
759 os.chdir(cwd[-1])
760 os.chdir(cwd[-1])
760
761
761 rpath = _earlygetopt(["-R", "--repository", "--repo"], args)
762 rpath = _earlygetopt(["-R", "--repository", "--repo"], args)
762 path, lui = _getlocal(ui, rpath)
763 path, lui = _getlocal(ui, rpath)
763
764
764 # Now that we're operating in the right directory/repository with
765 # Now that we're operating in the right directory/repository with
765 # the right config settings, check for shell aliases
766 # the right config settings, check for shell aliases
766 shellaliasfn = _checkshellalias(lui, ui, args)
767 shellaliasfn = _checkshellalias(lui, ui, args)
767 if shellaliasfn:
768 if shellaliasfn:
768 return shellaliasfn()
769 return shellaliasfn()
769
770
770 # Configure extensions in phases: uisetup, extsetup, cmdtable, and
771 # Configure extensions in phases: uisetup, extsetup, cmdtable, and
771 # reposetup. Programs like TortoiseHg will call _dispatch several
772 # reposetup. Programs like TortoiseHg will call _dispatch several
772 # times so we keep track of configured extensions in _loaded.
773 # times so we keep track of configured extensions in _loaded.
773 extensions.loadall(lui)
774 extensions.loadall(lui)
774 exts = [ext for ext in extensions.extensions() if ext[0] not in _loaded]
775 exts = [ext for ext in extensions.extensions() if ext[0] not in _loaded]
775 # Propagate any changes to lui.__class__ by extensions
776 # Propagate any changes to lui.__class__ by extensions
776 ui.__class__ = lui.__class__
777 ui.__class__ = lui.__class__
777
778
778 # (uisetup and extsetup are handled in extensions.loadall)
779 # (uisetup and extsetup are handled in extensions.loadall)
779
780
780 for name, module in exts:
781 for name, module in exts:
781 cmdtable = getattr(module, 'cmdtable', {})
782 cmdtable = getattr(module, 'cmdtable', {})
782 overrides = [cmd for cmd in cmdtable if cmd in commands.table]
783 overrides = [cmd for cmd in cmdtable if cmd in commands.table]
783 if overrides:
784 if overrides:
784 ui.warn(_("extension '%s' overrides commands: %s\n")
785 ui.warn(_("extension '%s' overrides commands: %s\n")
785 % (name, " ".join(overrides)))
786 % (name, " ".join(overrides)))
786 commands.table.update(cmdtable)
787 commands.table.update(cmdtable)
787 _loaded.add(name)
788 _loaded.add(name)
788
789
789 # (reposetup is handled in hg.repository)
790 # (reposetup is handled in hg.repository)
790
791
791 addaliases(lui, commands.table)
792 addaliases(lui, commands.table)
792
793
793 if not lui.configbool("ui", "strict"):
794 if not lui.configbool("ui", "strict"):
794 # All aliases and commands are completely defined, now.
795 # All aliases and commands are completely defined, now.
795 # Check abbreviation/ambiguity of shell alias again, because shell
796 # Check abbreviation/ambiguity of shell alias again, because shell
796 # alias may cause failure of "_parse" (see issue4355)
797 # alias may cause failure of "_parse" (see issue4355)
797 shellaliasfn = _checkshellalias(lui, ui, args, precheck=False)
798 shellaliasfn = _checkshellalias(lui, ui, args, precheck=False)
798 if shellaliasfn:
799 if shellaliasfn:
799 return shellaliasfn()
800 return shellaliasfn()
800
801
801 # check for fallback encoding
802 # check for fallback encoding
802 fallback = lui.config('ui', 'fallbackencoding')
803 fallback = lui.config('ui', 'fallbackencoding')
803 if fallback:
804 if fallback:
804 encoding.fallbackencoding = fallback
805 encoding.fallbackencoding = fallback
805
806
806 fullargs = args
807 fullargs = args
807 cmd, func, args, options, cmdoptions = _parse(lui, args)
808 cmd, func, args, options, cmdoptions = _parse(lui, args)
808
809
809 if options["config"]:
810 if options["config"]:
810 raise error.Abort(_("option --config may not be abbreviated!"))
811 raise error.Abort(_("option --config may not be abbreviated!"))
811 if options["cwd"]:
812 if options["cwd"]:
812 raise error.Abort(_("option --cwd may not be abbreviated!"))
813 raise error.Abort(_("option --cwd may not be abbreviated!"))
813 if options["repository"]:
814 if options["repository"]:
814 raise error.Abort(_(
815 raise error.Abort(_(
815 "option -R has to be separated from other options (e.g. not -qR) "
816 "option -R has to be separated from other options (e.g. not -qR) "
816 "and --repository may only be abbreviated as --repo!"))
817 "and --repository may only be abbreviated as --repo!"))
817
818
818 if options["encoding"]:
819 if options["encoding"]:
819 encoding.encoding = options["encoding"]
820 encoding.encoding = options["encoding"]
820 if options["encodingmode"]:
821 if options["encodingmode"]:
821 encoding.encodingmode = options["encodingmode"]
822 encoding.encodingmode = options["encodingmode"]
822 if options["time"]:
823 if options["time"]:
823 def get_times():
824 def get_times():
824 t = os.times()
825 t = os.times()
825 if t[4] == 0.0: # Windows leaves this as zero, so use time.clock()
826 if t[4] == 0.0: # Windows leaves this as zero, so use time.clock()
826 t = (t[0], t[1], t[2], t[3], time.clock())
827 t = (t[0], t[1], t[2], t[3], time.clock())
827 return t
828 return t
828 s = get_times()
829 s = get_times()
829 def print_time():
830 def print_time():
830 t = get_times()
831 t = get_times()
831 ui.warn(_("time: real %.3f secs (user %.3f+%.3f sys %.3f+%.3f)\n") %
832 ui.warn(_("time: real %.3f secs (user %.3f+%.3f sys %.3f+%.3f)\n") %
832 (t[4]-s[4], t[0]-s[0], t[2]-s[2], t[1]-s[1], t[3]-s[3]))
833 (t[4]-s[4], t[0]-s[0], t[2]-s[2], t[1]-s[1], t[3]-s[3]))
833 atexit.register(print_time)
834 atexit.register(print_time)
834
835
835 uis = set([ui, lui])
836 uis = set([ui, lui])
836
837
837 if req.repo:
838 if req.repo:
838 uis.add(req.repo.ui)
839 uis.add(req.repo.ui)
839
840
840 if options['verbose'] or options['debug'] or options['quiet']:
841 if options['verbose'] or options['debug'] or options['quiet']:
841 for opt in ('verbose', 'debug', 'quiet'):
842 for opt in ('verbose', 'debug', 'quiet'):
842 val = str(bool(options[opt]))
843 val = str(bool(options[opt]))
843 for ui_ in uis:
844 for ui_ in uis:
844 ui_.setconfig('ui', opt, val, '--' + opt)
845 ui_.setconfig('ui', opt, val, '--' + opt)
845
846
846 if options['traceback']:
847 if options['traceback']:
847 for ui_ in uis:
848 for ui_ in uis:
848 ui_.setconfig('ui', 'traceback', 'on', '--traceback')
849 ui_.setconfig('ui', 'traceback', 'on', '--traceback')
849
850
850 if options['noninteractive']:
851 if options['noninteractive']:
851 for ui_ in uis:
852 for ui_ in uis:
852 ui_.setconfig('ui', 'interactive', 'off', '-y')
853 ui_.setconfig('ui', 'interactive', 'off', '-y')
853
854
854 if cmdoptions.get('insecure', False):
855 if cmdoptions.get('insecure', False):
855 for ui_ in uis:
856 for ui_ in uis:
856 ui_.setconfig('web', 'cacerts', '!', '--insecure')
857 ui_.setconfig('web', 'cacerts', '!', '--insecure')
857
858
858 if options['version']:
859 if options['version']:
859 return commands.version_(ui)
860 return commands.version_(ui)
860 if options['help']:
861 if options['help']:
861 return commands.help_(ui, cmd, command=cmd is not None)
862 return commands.help_(ui, cmd, command=cmd is not None)
862 elif not cmd:
863 elif not cmd:
863 return commands.help_(ui, 'shortlist')
864 return commands.help_(ui, 'shortlist')
864
865
865 repo = None
866 repo = None
866 cmdpats = args[:]
867 cmdpats = args[:]
867 if cmd not in commands.norepo.split():
868 if cmd not in commands.norepo.split():
868 # use the repo from the request only if we don't have -R
869 # use the repo from the request only if we don't have -R
869 if not rpath and not cwd:
870 if not rpath and not cwd:
870 repo = req.repo
871 repo = req.repo
871
872
872 if repo:
873 if repo:
873 # set the descriptors of the repo ui to those of ui
874 # set the descriptors of the repo ui to those of ui
874 repo.ui.fin = ui.fin
875 repo.ui.fin = ui.fin
875 repo.ui.fout = ui.fout
876 repo.ui.fout = ui.fout
876 repo.ui.ferr = ui.ferr
877 repo.ui.ferr = ui.ferr
877 else:
878 else:
878 try:
879 try:
879 repo = hg.repository(ui, path=path)
880 repo = hg.repository(ui, path=path)
880 if not repo.local():
881 if not repo.local():
881 raise error.Abort(_("repository '%s' is not local") % path)
882 raise error.Abort(_("repository '%s' is not local") % path)
882 repo.ui.setconfig("bundle", "mainreporoot", repo.root, 'repo')
883 repo.ui.setconfig("bundle", "mainreporoot", repo.root, 'repo')
883 except error.RequirementError:
884 except error.RequirementError:
884 raise
885 raise
885 except error.RepoError:
886 except error.RepoError:
886 if rpath and rpath[-1]: # invalid -R path
887 if rpath and rpath[-1]: # invalid -R path
887 raise
888 raise
888 if cmd not in commands.optionalrepo.split():
889 if cmd not in commands.optionalrepo.split():
889 if (cmd in commands.inferrepo.split() and
890 if (cmd in commands.inferrepo.split() and
890 args and not path): # try to infer -R from command args
891 args and not path): # try to infer -R from command args
891 repos = map(cmdutil.findrepo, args)
892 repos = map(cmdutil.findrepo, args)
892 guess = repos[0]
893 guess = repos[0]
893 if guess and repos.count(guess) == len(repos):
894 if guess and repos.count(guess) == len(repos):
894 req.args = ['--repository', guess] + fullargs
895 req.args = ['--repository', guess] + fullargs
895 return _dispatch(req)
896 return _dispatch(req)
896 if not path:
897 if not path:
897 raise error.RepoError(_("no repository found in '%s'"
898 raise error.RepoError(_("no repository found in '%s'"
898 " (.hg not found)")
899 " (.hg not found)")
899 % os.getcwd())
900 % os.getcwd())
900 raise
901 raise
901 if repo:
902 if repo:
902 ui = repo.ui
903 ui = repo.ui
903 if options['hidden']:
904 if options['hidden']:
904 repo = repo.unfiltered()
905 repo = repo.unfiltered()
905 args.insert(0, repo)
906 args.insert(0, repo)
906 elif rpath:
907 elif rpath:
907 ui.warn(_("warning: --repository ignored\n"))
908 ui.warn(_("warning: --repository ignored\n"))
908
909
909 msg = ' '.join(' ' in a and repr(a) or a for a in fullargs)
910 msg = ' '.join(' ' in a and repr(a) or a for a in fullargs)
910 ui.log("command", '%s\n', msg)
911 ui.log("command", '%s\n', msg)
911 d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
912 d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
912 try:
913 try:
913 return runcommand(lui, repo, cmd, fullargs, ui, options, d,
914 return runcommand(lui, repo, cmd, fullargs, ui, options, d,
914 cmdpats, cmdoptions)
915 cmdpats, cmdoptions)
915 finally:
916 finally:
916 if repo and repo != req.repo:
917 if repo and repo != req.repo:
917 repo.close()
918 repo.close()
918
919
919 def lsprofile(ui, func, fp):
920 def lsprofile(ui, func, fp):
920 format = ui.config('profiling', 'format', default='text')
921 format = ui.config('profiling', 'format', default='text')
921 field = ui.config('profiling', 'sort', default='inlinetime')
922 field = ui.config('profiling', 'sort', default='inlinetime')
922 limit = ui.configint('profiling', 'limit', default=30)
923 limit = ui.configint('profiling', 'limit', default=30)
923 climit = ui.configint('profiling', 'nested', default=0)
924 climit = ui.configint('profiling', 'nested', default=0)
924
925
925 if format not in ['text', 'kcachegrind']:
926 if format not in ['text', 'kcachegrind']:
926 ui.warn(_("unrecognized profiling format '%s'"
927 ui.warn(_("unrecognized profiling format '%s'"
927 " - Ignored\n") % format)
928 " - Ignored\n") % format)
928 format = 'text'
929 format = 'text'
929
930
930 try:
931 try:
931 from . import lsprof
932 from . import lsprof
932 except ImportError:
933 except ImportError:
933 raise error.Abort(_(
934 raise error.Abort(_(
934 'lsprof not available - install from '
935 'lsprof not available - install from '
935 'http://codespeak.net/svn/user/arigo/hack/misc/lsprof/'))
936 'http://codespeak.net/svn/user/arigo/hack/misc/lsprof/'))
936 p = lsprof.Profiler()
937 p = lsprof.Profiler()
937 p.enable(subcalls=True)
938 p.enable(subcalls=True)
938 try:
939 try:
939 return func()
940 return func()
940 finally:
941 finally:
941 p.disable()
942 p.disable()
942
943
943 if format == 'kcachegrind':
944 if format == 'kcachegrind':
944 from . import lsprofcalltree
945 from . import lsprofcalltree
945 calltree = lsprofcalltree.KCacheGrind(p)
946 calltree = lsprofcalltree.KCacheGrind(p)
946 calltree.output(fp)
947 calltree.output(fp)
947 else:
948 else:
948 # format == 'text'
949 # format == 'text'
949 stats = lsprof.Stats(p.getstats())
950 stats = lsprof.Stats(p.getstats())
950 stats.sort(field)
951 stats.sort(field)
951 stats.pprint(limit=limit, file=fp, climit=climit)
952 stats.pprint(limit=limit, file=fp, climit=climit)
952
953
953 def flameprofile(ui, func, fp):
954 def flameprofile(ui, func, fp):
954 try:
955 try:
955 from flamegraph import flamegraph
956 from flamegraph import flamegraph
956 except ImportError:
957 except ImportError:
957 raise error.Abort(_(
958 raise error.Abort(_(
958 'flamegraph not available - install from '
959 'flamegraph not available - install from '
959 'https://github.com/evanhempel/python-flamegraph'))
960 'https://github.com/evanhempel/python-flamegraph'))
960 # developer config: profiling.freq
961 # developer config: profiling.freq
961 freq = ui.configint('profiling', 'freq', default=1000)
962 freq = ui.configint('profiling', 'freq', default=1000)
962 filter_ = None
963 filter_ = None
963 collapse_recursion = True
964 collapse_recursion = True
964 thread = flamegraph.ProfileThread(fp, 1.0 / freq,
965 thread = flamegraph.ProfileThread(fp, 1.0 / freq,
965 filter_, collapse_recursion)
966 filter_, collapse_recursion)
966 start_time = time.clock()
967 start_time = time.clock()
967 try:
968 try:
968 thread.start()
969 thread.start()
969 func()
970 func()
970 finally:
971 finally:
971 thread.stop()
972 thread.stop()
972 thread.join()
973 thread.join()
973 print('Collected %d stack frames (%d unique) in %2.2f seconds.' % (
974 print('Collected %d stack frames (%d unique) in %2.2f seconds.' % (
974 time.clock() - start_time, thread.num_frames(),
975 time.clock() - start_time, thread.num_frames(),
975 thread.num_frames(unique=True)))
976 thread.num_frames(unique=True)))
976
977
977
978
978 def statprofile(ui, func, fp):
979 def statprofile(ui, func, fp):
979 try:
980 try:
980 import statprof
981 import statprof
981 except ImportError:
982 except ImportError:
982 raise error.Abort(_(
983 raise error.Abort(_(
983 'statprof not available - install using "easy_install statprof"'))
984 'statprof not available - install using "easy_install statprof"'))
984
985
985 freq = ui.configint('profiling', 'freq', default=1000)
986 freq = ui.configint('profiling', 'freq', default=1000)
986 if freq > 0:
987 if freq > 0:
987 statprof.reset(freq)
988 statprof.reset(freq)
988 else:
989 else:
989 ui.warn(_("invalid sampling frequency '%s' - ignoring\n") % freq)
990 ui.warn(_("invalid sampling frequency '%s' - ignoring\n") % freq)
990
991
991 statprof.start()
992 statprof.start()
992 try:
993 try:
993 return func()
994 return func()
994 finally:
995 finally:
995 statprof.stop()
996 statprof.stop()
996 statprof.display(fp)
997 statprof.display(fp)
997
998
998 def _runcommand(ui, options, cmd, cmdfunc):
999 def _runcommand(ui, options, cmd, cmdfunc):
999 """Enables the profiler if applicable.
1000 """Enables the profiler if applicable.
1000
1001
1001 ``profiling.enabled`` - boolean config that enables or disables profiling
1002 ``profiling.enabled`` - boolean config that enables or disables profiling
1002 """
1003 """
1003 def checkargs():
1004 def checkargs():
1004 try:
1005 try:
1005 return cmdfunc()
1006 return cmdfunc()
1006 except error.SignatureError:
1007 except error.SignatureError:
1007 raise error.CommandError(cmd, _("invalid arguments"))
1008 raise error.CommandError(cmd, _("invalid arguments"))
1008
1009
1009 if options['profile'] or ui.configbool('profiling', 'enabled'):
1010 if options['profile'] or ui.configbool('profiling', 'enabled'):
1010 profiler = os.getenv('HGPROF')
1011 profiler = os.getenv('HGPROF')
1011 if profiler is None:
1012 if profiler is None:
1012 profiler = ui.config('profiling', 'type', default='ls')
1013 profiler = ui.config('profiling', 'type', default='ls')
1013 if profiler not in ('ls', 'stat', 'flame'):
1014 if profiler not in ('ls', 'stat', 'flame'):
1014 ui.warn(_("unrecognized profiler '%s' - ignored\n") % profiler)
1015 ui.warn(_("unrecognized profiler '%s' - ignored\n") % profiler)
1015 profiler = 'ls'
1016 profiler = 'ls'
1016
1017
1017 output = ui.config('profiling', 'output')
1018 output = ui.config('profiling', 'output')
1018
1019
1019 if output == 'blackbox':
1020 if output == 'blackbox':
1020 import StringIO
1021 import StringIO
1021 fp = StringIO.StringIO()
1022 fp = StringIO.StringIO()
1022 elif output:
1023 elif output:
1023 path = ui.expandpath(output)
1024 path = ui.expandpath(output)
1024 fp = open(path, 'wb')
1025 fp = open(path, 'wb')
1025 else:
1026 else:
1026 fp = sys.stderr
1027 fp = sys.stderr
1027
1028
1028 try:
1029 try:
1029 if profiler == 'ls':
1030 if profiler == 'ls':
1030 return lsprofile(ui, checkargs, fp)
1031 return lsprofile(ui, checkargs, fp)
1031 elif profiler == 'flame':
1032 elif profiler == 'flame':
1032 return flameprofile(ui, checkargs, fp)
1033 return flameprofile(ui, checkargs, fp)
1033 else:
1034 else:
1034 return statprofile(ui, checkargs, fp)
1035 return statprofile(ui, checkargs, fp)
1035 finally:
1036 finally:
1036 if output:
1037 if output:
1037 if output == 'blackbox':
1038 if output == 'blackbox':
1038 val = "Profile:\n%s" % fp.getvalue()
1039 val = "Profile:\n%s" % fp.getvalue()
1039 # ui.log treats the input as a format string,
1040 # ui.log treats the input as a format string,
1040 # so we need to escape any % signs.
1041 # so we need to escape any % signs.
1041 val = val.replace('%', '%%')
1042 val = val.replace('%', '%%')
1042 ui.log('profile', val)
1043 ui.log('profile', val)
1043 fp.close()
1044 fp.close()
1044 else:
1045 else:
1045 return checkargs()
1046 return checkargs()
@@ -1,544 +1,544
1 $ HGFOO=BAR; export HGFOO
1 $ HGFOO=BAR; export HGFOO
2 $ cat >> $HGRCPATH <<EOF
2 $ cat >> $HGRCPATH <<EOF
3 > [alias]
3 > [alias]
4 > # should clobber ci but not commit (issue2993)
4 > # should clobber ci but not commit (issue2993)
5 > ci = version
5 > ci = version
6 > myinit = init
6 > myinit = init
7 > mycommit = commit
7 > mycommit = commit
8 > optionalrepo = showconfig alias.myinit
8 > optionalrepo = showconfig alias.myinit
9 > cleanstatus = status -c
9 > cleanstatus = status -c
10 > unknown = bargle
10 > unknown = bargle
11 > ambiguous = s
11 > ambiguous = s
12 > recursive = recursive
12 > recursive = recursive
13 > disabled = email
13 > disabled = email
14 > nodefinition =
14 > nodefinition =
15 > noclosingquotation = '
15 > noclosingquotation = '
16 > no--cwd = status --cwd elsewhere
16 > no--cwd = status --cwd elsewhere
17 > no-R = status -R elsewhere
17 > no-R = status -R elsewhere
18 > no--repo = status --repo elsewhere
18 > no--repo = status --repo elsewhere
19 > no--repository = status --repository elsewhere
19 > no--repository = status --repository elsewhere
20 > no--config = status --config a.config=1
20 > no--config = status --config a.config=1
21 > mylog = log
21 > mylog = log
22 > lognull = log -r null
22 > lognull = log -r null
23 > shortlog = log --template '{rev} {node|short} | {date|isodate}\n'
23 > shortlog = log --template '{rev} {node|short} | {date|isodate}\n'
24 > positional = log --template '{\$2} {\$1} | {date|isodate}\n'
24 > positional = log --template '{\$2} {\$1} | {date|isodate}\n'
25 > dln = lognull --debug
25 > dln = lognull --debug
26 > nousage = rollback
26 > nousage = rollback
27 > put = export -r 0 -o "\$FOO/%R.diff"
27 > put = export -r 0 -o "\$FOO/%R.diff"
28 > blank = !printf '\n'
28 > blank = !printf '\n'
29 > self = !printf '\$0\n'
29 > self = !printf '\$0\n'
30 > echoall = !printf '\$@\n'
30 > echoall = !printf '\$@\n'
31 > echo1 = !printf '\$1\n'
31 > echo1 = !printf '\$1\n'
32 > echo2 = !printf '\$2\n'
32 > echo2 = !printf '\$2\n'
33 > echo13 = !printf '\$1 \$3\n'
33 > echo13 = !printf '\$1 \$3\n'
34 > echotokens = !printf "%s\n" "\$@"
34 > echotokens = !printf "%s\n" "\$@"
35 > count = !hg log -r "\$@" --template=. | wc -c | sed -e 's/ //g'
35 > count = !hg log -r "\$@" --template=. | wc -c | sed -e 's/ //g'
36 > mcount = !hg log \$@ --template=. | wc -c | sed -e 's/ //g'
36 > mcount = !hg log \$@ --template=. | wc -c | sed -e 's/ //g'
37 > rt = root
37 > rt = root
38 > tglog = log -G --template "{rev}:{node|short}: '{desc}' {branches}\n"
38 > tglog = log -G --template "{rev}:{node|short}: '{desc}' {branches}\n"
39 > idalias = id
39 > idalias = id
40 > idaliaslong = id
40 > idaliaslong = id
41 > idaliasshell = !echo test
41 > idaliasshell = !echo test
42 > parentsshell1 = !echo one
42 > parentsshell1 = !echo one
43 > parentsshell2 = !echo two
43 > parentsshell2 = !echo two
44 > escaped1 = !printf 'test\$\$test\n'
44 > escaped1 = !printf 'test\$\$test\n'
45 > escaped2 = !sh -c 'echo "HGFOO is \$\$HGFOO"'
45 > escaped2 = !sh -c 'echo "HGFOO is \$\$HGFOO"'
46 > escaped3 = !sh -c 'echo "\$1 is \$\$\$1"'
46 > escaped3 = !sh -c 'echo "\$1 is \$\$\$1"'
47 > escaped4 = !printf '\$\$0 \$\$@\n'
47 > escaped4 = !printf '\$\$0 \$\$@\n'
48 > exit1 = !sh -c 'exit 1'
48 > exit1 = !sh -c 'exit 1'
49 >
49 >
50 > [defaults]
50 > [defaults]
51 > mylog = -q
51 > mylog = -q
52 > lognull = -q
52 > lognull = -q
53 > log = -v
53 > log = -v
54 > EOF
54 > EOF
55
55
56
56
57 basic
57 basic
58
58
59 $ hg myinit alias
59 $ hg myinit alias
60
60
61
61
62 unknown
62 unknown
63
63
64 $ hg unknown
64 $ hg unknown
65 abort: alias 'unknown' resolves to unknown command 'bargle'
65 abort: alias 'unknown' resolves to unknown command 'bargle'
66 [255]
66 [255]
67 $ hg help unknown
67 $ hg help unknown
68 alias 'unknown' resolves to unknown command 'bargle'
68 alias 'unknown' resolves to unknown command 'bargle'
69
69
70
70
71 ambiguous
71 ambiguous
72
72
73 $ hg ambiguous
73 $ hg ambiguous
74 abort: alias 'ambiguous' resolves to ambiguous command 's'
74 abort: alias 'ambiguous' resolves to ambiguous command 's'
75 [255]
75 [255]
76 $ hg help ambiguous
76 $ hg help ambiguous
77 alias 'ambiguous' resolves to ambiguous command 's'
77 alias 'ambiguous' resolves to ambiguous command 's'
78
78
79
79
80 recursive
80 recursive
81
81
82 $ hg recursive
82 $ hg recursive
83 abort: alias 'recursive' resolves to unknown command 'recursive'
83 abort: alias 'recursive' resolves to unknown command 'recursive'
84 [255]
84 [255]
85 $ hg help recursive
85 $ hg help recursive
86 alias 'recursive' resolves to unknown command 'recursive'
86 alias 'recursive' resolves to unknown command 'recursive'
87
87
88
88
89 disabled
89 disabled
90
90
91 $ hg disabled
91 $ hg disabled
92 abort: alias 'disabled' resolves to unknown command 'email'
92 abort: alias 'disabled' resolves to unknown command 'email'
93 ('email' is provided by 'patchbomb' extension)
93 ('email' is provided by 'patchbomb' extension)
94 [255]
94 [255]
95 $ hg help disabled
95 $ hg help disabled
96 alias 'disabled' resolves to unknown command 'email'
96 alias 'disabled' resolves to unknown command 'email'
97
97
98 'email' is provided by the following extension:
98 'email' is provided by the following extension:
99
99
100 patchbomb command to send changesets as (a series of) patch emails
100 patchbomb command to send changesets as (a series of) patch emails
101
101
102 (use "hg help extensions" for information on enabling extensions)
102 (use "hg help extensions" for information on enabling extensions)
103
103
104
104
105 no definition
105 no definition
106
106
107 $ hg nodef
107 $ hg nodef
108 abort: no definition for alias 'nodefinition'
108 abort: no definition for alias 'nodefinition'
109 [255]
109 [255]
110 $ hg help nodef
110 $ hg help nodef
111 no definition for alias 'nodefinition'
111 no definition for alias 'nodefinition'
112
112
113
113
114 no closing quotation
114 no closing quotation
115
115
116 $ hg noclosing
116 $ hg noclosing
117 abort: error in definition for alias 'noclosingquotation': No closing quotation
117 abort: error in definition for alias 'noclosingquotation': No closing quotation
118 [255]
118 [255]
119 $ hg help noclosing
119 $ hg help noclosing
120 error in definition for alias 'noclosingquotation': No closing quotation
120 error in definition for alias 'noclosingquotation': No closing quotation
121
121
122
122
123 invalid options
123 invalid options
124
124
125 $ hg no--cwd
125 $ hg no--cwd
126 abort: error in definition for alias 'no--cwd': --cwd may only be given on the command line
126 abort: error in definition for alias 'no--cwd': --cwd may only be given on the command line
127 [255]
127 [255]
128 $ hg help no--cwd
128 $ hg help no--cwd
129 error in definition for alias 'no--cwd': --cwd may only be given on the
129 error in definition for alias 'no--cwd': --cwd may only be given on the
130 command line
130 command line
131 $ hg no-R
131 $ hg no-R
132 abort: error in definition for alias 'no-R': -R may only be given on the command line
132 abort: error in definition for alias 'no-R': -R may only be given on the command line
133 [255]
133 [255]
134 $ hg help no-R
134 $ hg help no-R
135 error in definition for alias 'no-R': -R may only be given on the command line
135 error in definition for alias 'no-R': -R may only be given on the command line
136 $ hg no--repo
136 $ hg no--repo
137 abort: error in definition for alias 'no--repo': --repo may only be given on the command line
137 abort: error in definition for alias 'no--repo': --repo may only be given on the command line
138 [255]
138 [255]
139 $ hg help no--repo
139 $ hg help no--repo
140 error in definition for alias 'no--repo': --repo may only be given on the
140 error in definition for alias 'no--repo': --repo may only be given on the
141 command line
141 command line
142 $ hg no--repository
142 $ hg no--repository
143 abort: error in definition for alias 'no--repository': --repository may only be given on the command line
143 abort: error in definition for alias 'no--repository': --repository may only be given on the command line
144 [255]
144 [255]
145 $ hg help no--repository
145 $ hg help no--repository
146 error in definition for alias 'no--repository': --repository may only be given
146 error in definition for alias 'no--repository': --repository may only be given
147 on the command line
147 on the command line
148 $ hg no--config
148 $ hg no--config
149 abort: error in definition for alias 'no--config': --config may only be given on the command line
149 abort: error in definition for alias 'no--config': --config may only be given on the command line
150 [255]
150 [255]
151
151
152 optional repository
152 optional repository
153
153
154 #if no-outer-repo
154 #if no-outer-repo
155 $ hg optionalrepo
155 $ hg optionalrepo
156 init
156 init
157 #endif
157 #endif
158 $ cd alias
158 $ cd alias
159 $ cat > .hg/hgrc <<EOF
159 $ cat > .hg/hgrc <<EOF
160 > [alias]
160 > [alias]
161 > myinit = init -q
161 > myinit = init -q
162 > EOF
162 > EOF
163 $ hg optionalrepo
163 $ hg optionalrepo
164 init -q
164 init -q
165
165
166 no usage
166 no usage
167
167
168 $ hg nousage
168 $ hg nousage
169 no rollback information available
169 no rollback information available
170 [1]
170 [1]
171
171
172 $ echo foo > foo
172 $ echo foo > foo
173 $ hg commit -Amfoo
173 $ hg commit -Amfoo
174 adding foo
174 adding foo
175
175
176
176
177 with opts
177 with opts
178
178
179 $ hg cleanst
179 $ hg cleanst
180 C foo
180 C foo
181
181
182
182
183 with opts and whitespace
183 with opts and whitespace
184
184
185 $ hg shortlog
185 $ hg shortlog
186 0 e63c23eaa88a | 1970-01-01 00:00 +0000
186 0 e63c23eaa88a | 1970-01-01 00:00 +0000
187
187
188 positional arguments
188 positional arguments
189
189
190 $ hg positional
190 $ hg positional
191 abort: too few arguments for command alias
191 abort: too few arguments for command alias
192 [255]
192 [255]
193 $ hg positional a
193 $ hg positional a
194 abort: too few arguments for command alias
194 abort: too few arguments for command alias
195 [255]
195 [255]
196 $ hg positional 'node|short' rev
196 $ hg positional 'node|short' rev
197 0 e63c23eaa88a | 1970-01-01 00:00 +0000
197 0 e63c23eaa88a | 1970-01-01 00:00 +0000
198
198
199 interaction with defaults
199 interaction with defaults
200
200
201 $ hg mylog
201 $ hg mylog
202 0:e63c23eaa88a
202 0:e63c23eaa88a
203 $ hg lognull
203 $ hg lognull
204 -1:000000000000
204 -1:000000000000
205
205
206
206
207 properly recursive
207 properly recursive
208
208
209 $ hg dln
209 $ hg dln
210 changeset: -1:0000000000000000000000000000000000000000
210 changeset: -1:0000000000000000000000000000000000000000
211 phase: public
211 phase: public
212 parent: -1:0000000000000000000000000000000000000000
212 parent: -1:0000000000000000000000000000000000000000
213 parent: -1:0000000000000000000000000000000000000000
213 parent: -1:0000000000000000000000000000000000000000
214 manifest: -1:0000000000000000000000000000000000000000
214 manifest: -1:0000000000000000000000000000000000000000
215 user:
215 user:
216 date: Thu Jan 01 00:00:00 1970 +0000
216 date: Thu Jan 01 00:00:00 1970 +0000
217 extra: branch=default
217 extra: branch=default
218
218
219
219
220
220
221 path expanding
221 path expanding
222
222
223 $ FOO=`pwd` hg put
223 $ FOO=`pwd` hg put
224 $ cat 0.diff
224 $ cat 0.diff
225 # HG changeset patch
225 # HG changeset patch
226 # User test
226 # User test
227 # Date 0 0
227 # Date 0 0
228 # Thu Jan 01 00:00:00 1970 +0000
228 # Thu Jan 01 00:00:00 1970 +0000
229 # Node ID e63c23eaa88ae77967edcf4ea194d31167c478b0
229 # Node ID e63c23eaa88ae77967edcf4ea194d31167c478b0
230 # Parent 0000000000000000000000000000000000000000
230 # Parent 0000000000000000000000000000000000000000
231 foo
231 foo
232
232
233 diff -r 000000000000 -r e63c23eaa88a foo
233 diff -r 000000000000 -r e63c23eaa88a foo
234 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
234 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
235 +++ b/foo Thu Jan 01 00:00:00 1970 +0000
235 +++ b/foo Thu Jan 01 00:00:00 1970 +0000
236 @@ -0,0 +1,1 @@
236 @@ -0,0 +1,1 @@
237 +foo
237 +foo
238
238
239
239
240 simple shell aliases
240 simple shell aliases
241
241
242 $ hg blank
242 $ hg blank
243
243
244 $ hg blank foo
244 $ hg blank foo
245
245
246 $ hg self
246 $ hg self
247 self
247 self
248 $ hg echoall
248 $ hg echoall
249
249
250 $ hg echoall foo
250 $ hg echoall foo
251 foo
251 foo
252 $ hg echoall 'test $2' foo
252 $ hg echoall 'test $2' foo
253 test $2 foo
253 test $2 foo
254 $ hg echoall 'test $@' foo '$@'
254 $ hg echoall 'test $@' foo '$@'
255 test $@ foo $@
255 test $@ foo $@
256 $ hg echoall 'test "$@"' foo '"$@"'
256 $ hg echoall 'test "$@"' foo '"$@"'
257 test "$@" foo "$@"
257 test "$@" foo "$@"
258 $ hg echo1 foo bar baz
258 $ hg echo1 foo bar baz
259 foo
259 foo
260 $ hg echo2 foo bar baz
260 $ hg echo2 foo bar baz
261 bar
261 bar
262 $ hg echo13 foo bar baz test
262 $ hg echo13 foo bar baz test
263 foo baz
263 foo baz
264 $ hg echo2 foo
264 $ hg echo2 foo
265
265
266 $ hg echotokens
266 $ hg echotokens
267
267
268 $ hg echotokens foo 'bar $1 baz'
268 $ hg echotokens foo 'bar $1 baz'
269 foo
269 foo
270 bar $1 baz
270 bar $1 baz
271 $ hg echotokens 'test $2' foo
271 $ hg echotokens 'test $2' foo
272 test $2
272 test $2
273 foo
273 foo
274 $ hg echotokens 'test $@' foo '$@'
274 $ hg echotokens 'test $@' foo '$@'
275 test $@
275 test $@
276 foo
276 foo
277 $@
277 $@
278 $ hg echotokens 'test "$@"' foo '"$@"'
278 $ hg echotokens 'test "$@"' foo '"$@"'
279 test "$@"
279 test "$@"
280 foo
280 foo
281 "$@"
281 "$@"
282 $ echo bar > bar
282 $ echo bar > bar
283 $ hg commit -qA -m bar
283 $ hg commit -qA -m bar
284 $ hg count .
284 $ hg count .
285 1
285 1
286 $ hg count 'branch(default)'
286 $ hg count 'branch(default)'
287 2
287 2
288 $ hg mcount -r '"branch(default)"'
288 $ hg mcount -r '"branch(default)"'
289 2
289 2
290
290
291 $ hg tglog
291 $ hg tglog
292 @ 1:042423737847: 'bar'
292 @ 1:042423737847: 'bar'
293 |
293 |
294 o 0:e63c23eaa88a: 'foo'
294 o 0:e63c23eaa88a: 'foo'
295
295
296
296
297
297
298 shadowing
298 shadowing
299
299
300 $ hg i
300 $ hg i
301 hg: command 'i' is ambiguous:
301 hg: command 'i' is ambiguous:
302 idalias idaliaslong idaliasshell identify import incoming init
302 idalias idaliaslong idaliasshell identify import incoming init
303 [255]
303 [255]
304 $ hg id
304 $ hg id
305 042423737847 tip
305 042423737847 tip
306 $ hg ida
306 $ hg ida
307 hg: command 'ida' is ambiguous:
307 hg: command 'ida' is ambiguous:
308 idalias idaliaslong idaliasshell
308 idalias idaliaslong idaliasshell
309 [255]
309 [255]
310 $ hg idalias
310 $ hg idalias
311 042423737847 tip
311 042423737847 tip
312 $ hg idaliasl
312 $ hg idaliasl
313 042423737847 tip
313 042423737847 tip
314 $ hg idaliass
314 $ hg idaliass
315 test
315 test
316 $ hg parentsshell
316 $ hg parentsshell
317 hg: command 'parentsshell' is ambiguous:
317 hg: command 'parentsshell' is ambiguous:
318 parentsshell1 parentsshell2
318 parentsshell1 parentsshell2
319 [255]
319 [255]
320 $ hg parentsshell1
320 $ hg parentsshell1
321 one
321 one
322 $ hg parentsshell2
322 $ hg parentsshell2
323 two
323 two
324
324
325
325
326 shell aliases with global options
326 shell aliases with global options
327
327
328 $ hg init sub
328 $ hg init sub
329 $ cd sub
329 $ cd sub
330 $ hg count 'branch(default)'
330 $ hg count 'branch(default)'
331 abort: unknown revision 'default'!
331 abort: unknown revision 'default'!
332 0
332 0
333 $ hg -v count 'branch(default)'
333 $ hg -v count 'branch(default)'
334 abort: unknown revision 'default'!
334 abort: unknown revision 'default'!
335 0
335 0
336 $ hg -R .. count 'branch(default)'
336 $ hg -R .. count 'branch(default)'
337 abort: unknown revision 'default'!
337 abort: unknown revision 'default'!
338 0
338 0
339 $ hg --cwd .. count 'branch(default)'
339 $ hg --cwd .. count 'branch(default)'
340 2
340 2
341 $ hg echoall --cwd ..
341 $ hg echoall --cwd ..
342
342
343
343
344
344
345 repo specific shell aliases
345 repo specific shell aliases
346
346
347 $ cat >> .hg/hgrc <<EOF
347 $ cat >> .hg/hgrc <<EOF
348 > [alias]
348 > [alias]
349 > subalias = !echo sub
349 > subalias = !echo sub
350 > EOF
350 > EOF
351 $ cat >> ../.hg/hgrc <<EOF
351 $ cat >> ../.hg/hgrc <<EOF
352 > [alias]
352 > [alias]
353 > mainalias = !echo main
353 > mainalias = !echo main
354 > EOF
354 > EOF
355
355
356
356
357 shell alias defined in current repo
357 shell alias defined in current repo
358
358
359 $ hg subalias
359 $ hg subalias
360 sub
360 sub
361 $ hg --cwd .. subalias > /dev/null
361 $ hg --cwd .. subalias > /dev/null
362 hg: unknown command 'subalias'
362 hg: unknown command 'subalias'
363 (did you mean one of idalias?)
363 (did you mean idalias?)
364 [255]
364 [255]
365 $ hg -R .. subalias > /dev/null
365 $ hg -R .. subalias > /dev/null
366 hg: unknown command 'subalias'
366 hg: unknown command 'subalias'
367 (did you mean one of idalias?)
367 (did you mean idalias?)
368 [255]
368 [255]
369
369
370
370
371 shell alias defined in other repo
371 shell alias defined in other repo
372
372
373 $ hg mainalias > /dev/null
373 $ hg mainalias > /dev/null
374 hg: unknown command 'mainalias'
374 hg: unknown command 'mainalias'
375 (did you mean one of idalias?)
375 (did you mean idalias?)
376 [255]
376 [255]
377 $ hg -R .. mainalias
377 $ hg -R .. mainalias
378 main
378 main
379 $ hg --cwd .. mainalias
379 $ hg --cwd .. mainalias
380 main
380 main
381
381
382 typos get useful suggestions
382 typos get useful suggestions
383 $ hg --cwd .. manalias
383 $ hg --cwd .. manalias
384 hg: unknown command 'manalias'
384 hg: unknown command 'manalias'
385 (did you mean one of idalias, mainalias, manifest?)
385 (did you mean one of idalias, mainalias, manifest?)
386 [255]
386 [255]
387
387
388 shell aliases with escaped $ chars
388 shell aliases with escaped $ chars
389
389
390 $ hg escaped1
390 $ hg escaped1
391 test$test
391 test$test
392 $ hg escaped2
392 $ hg escaped2
393 HGFOO is BAR
393 HGFOO is BAR
394 $ hg escaped3 HGFOO
394 $ hg escaped3 HGFOO
395 HGFOO is BAR
395 HGFOO is BAR
396 $ hg escaped4 test
396 $ hg escaped4 test
397 $0 $@
397 $0 $@
398
398
399 abbreviated name, which matches against both shell alias and the
399 abbreviated name, which matches against both shell alias and the
400 command provided extension, should be aborted.
400 command provided extension, should be aborted.
401
401
402 $ cat >> .hg/hgrc <<EOF
402 $ cat >> .hg/hgrc <<EOF
403 > [extensions]
403 > [extensions]
404 > hgext.rebase =
404 > hgext.rebase =
405 > EOF
405 > EOF
406 #if windows
406 #if windows
407 $ cat >> .hg/hgrc <<EOF
407 $ cat >> .hg/hgrc <<EOF
408 > [alias]
408 > [alias]
409 > rebate = !echo this is %HG_ARGS%
409 > rebate = !echo this is %HG_ARGS%
410 > EOF
410 > EOF
411 #else
411 #else
412 $ cat >> .hg/hgrc <<EOF
412 $ cat >> .hg/hgrc <<EOF
413 > [alias]
413 > [alias]
414 > rebate = !echo this is \$HG_ARGS
414 > rebate = !echo this is \$HG_ARGS
415 > EOF
415 > EOF
416 #endif
416 #endif
417 $ hg reba
417 $ hg reba
418 hg: command 'reba' is ambiguous:
418 hg: command 'reba' is ambiguous:
419 rebase rebate
419 rebase rebate
420 [255]
420 [255]
421 $ hg rebat
421 $ hg rebat
422 this is rebate
422 this is rebate
423 $ hg rebat --foo-bar
423 $ hg rebat --foo-bar
424 this is rebate --foo-bar
424 this is rebate --foo-bar
425
425
426 invalid arguments
426 invalid arguments
427
427
428 $ hg rt foo
428 $ hg rt foo
429 hg rt: invalid arguments
429 hg rt: invalid arguments
430 hg rt
430 hg rt
431
431
432 alias for: hg root
432 alias for: hg root
433
433
434 (use "hg rt -h" to show more help)
434 (use "hg rt -h" to show more help)
435 [255]
435 [255]
436
436
437 invalid global arguments for normal commands, aliases, and shell aliases
437 invalid global arguments for normal commands, aliases, and shell aliases
438
438
439 $ hg --invalid root
439 $ hg --invalid root
440 hg: option --invalid not recognized
440 hg: option --invalid not recognized
441 Mercurial Distributed SCM
441 Mercurial Distributed SCM
442
442
443 basic commands:
443 basic commands:
444
444
445 add add the specified files on the next commit
445 add add the specified files on the next commit
446 annotate show changeset information by line for each file
446 annotate show changeset information by line for each file
447 clone make a copy of an existing repository
447 clone make a copy of an existing repository
448 commit commit the specified files or all outstanding changes
448 commit commit the specified files or all outstanding changes
449 diff diff repository (or selected files)
449 diff diff repository (or selected files)
450 export dump the header and diffs for one or more changesets
450 export dump the header and diffs for one or more changesets
451 forget forget the specified files on the next commit
451 forget forget the specified files on the next commit
452 init create a new repository in the given directory
452 init create a new repository in the given directory
453 log show revision history of entire repository or files
453 log show revision history of entire repository or files
454 merge merge another revision into working directory
454 merge merge another revision into working directory
455 pull pull changes from the specified source
455 pull pull changes from the specified source
456 push push changes to the specified destination
456 push push changes to the specified destination
457 remove remove the specified files on the next commit
457 remove remove the specified files on the next commit
458 serve start stand-alone webserver
458 serve start stand-alone webserver
459 status show changed files in the working directory
459 status show changed files in the working directory
460 summary summarize working directory state
460 summary summarize working directory state
461 update update working directory (or switch revisions)
461 update update working directory (or switch revisions)
462
462
463 (use "hg help" for the full list of commands or "hg -v" for details)
463 (use "hg help" for the full list of commands or "hg -v" for details)
464 [255]
464 [255]
465 $ hg --invalid mylog
465 $ hg --invalid mylog
466 hg: option --invalid not recognized
466 hg: option --invalid not recognized
467 Mercurial Distributed SCM
467 Mercurial Distributed SCM
468
468
469 basic commands:
469 basic commands:
470
470
471 add add the specified files on the next commit
471 add add the specified files on the next commit
472 annotate show changeset information by line for each file
472 annotate show changeset information by line for each file
473 clone make a copy of an existing repository
473 clone make a copy of an existing repository
474 commit commit the specified files or all outstanding changes
474 commit commit the specified files or all outstanding changes
475 diff diff repository (or selected files)
475 diff diff repository (or selected files)
476 export dump the header and diffs for one or more changesets
476 export dump the header and diffs for one or more changesets
477 forget forget the specified files on the next commit
477 forget forget the specified files on the next commit
478 init create a new repository in the given directory
478 init create a new repository in the given directory
479 log show revision history of entire repository or files
479 log show revision history of entire repository or files
480 merge merge another revision into working directory
480 merge merge another revision into working directory
481 pull pull changes from the specified source
481 pull pull changes from the specified source
482 push push changes to the specified destination
482 push push changes to the specified destination
483 remove remove the specified files on the next commit
483 remove remove the specified files on the next commit
484 serve start stand-alone webserver
484 serve start stand-alone webserver
485 status show changed files in the working directory
485 status show changed files in the working directory
486 summary summarize working directory state
486 summary summarize working directory state
487 update update working directory (or switch revisions)
487 update update working directory (or switch revisions)
488
488
489 (use "hg help" for the full list of commands or "hg -v" for details)
489 (use "hg help" for the full list of commands or "hg -v" for details)
490 [255]
490 [255]
491 $ hg --invalid blank
491 $ hg --invalid blank
492 hg: option --invalid not recognized
492 hg: option --invalid not recognized
493 Mercurial Distributed SCM
493 Mercurial Distributed SCM
494
494
495 basic commands:
495 basic commands:
496
496
497 add add the specified files on the next commit
497 add add the specified files on the next commit
498 annotate show changeset information by line for each file
498 annotate show changeset information by line for each file
499 clone make a copy of an existing repository
499 clone make a copy of an existing repository
500 commit commit the specified files or all outstanding changes
500 commit commit the specified files or all outstanding changes
501 diff diff repository (or selected files)
501 diff diff repository (or selected files)
502 export dump the header and diffs for one or more changesets
502 export dump the header and diffs for one or more changesets
503 forget forget the specified files on the next commit
503 forget forget the specified files on the next commit
504 init create a new repository in the given directory
504 init create a new repository in the given directory
505 log show revision history of entire repository or files
505 log show revision history of entire repository or files
506 merge merge another revision into working directory
506 merge merge another revision into working directory
507 pull pull changes from the specified source
507 pull pull changes from the specified source
508 push push changes to the specified destination
508 push push changes to the specified destination
509 remove remove the specified files on the next commit
509 remove remove the specified files on the next commit
510 serve start stand-alone webserver
510 serve start stand-alone webserver
511 status show changed files in the working directory
511 status show changed files in the working directory
512 summary summarize working directory state
512 summary summarize working directory state
513 update update working directory (or switch revisions)
513 update update working directory (or switch revisions)
514
514
515 (use "hg help" for the full list of commands or "hg -v" for details)
515 (use "hg help" for the full list of commands or "hg -v" for details)
516 [255]
516 [255]
517
517
518 This should show id:
518 This should show id:
519
519
520 $ hg --config alias.log='id' log
520 $ hg --config alias.log='id' log
521 000000000000 tip
521 000000000000 tip
522
522
523 This shouldn't:
523 This shouldn't:
524
524
525 $ hg --config alias.log='id' history
525 $ hg --config alias.log='id' history
526
526
527 $ cd ../..
527 $ cd ../..
528
528
529 return code of command and shell aliases:
529 return code of command and shell aliases:
530
530
531 $ hg mycommit -R alias
531 $ hg mycommit -R alias
532 nothing changed
532 nothing changed
533 [1]
533 [1]
534 $ hg exit1
534 $ hg exit1
535 [1]
535 [1]
536
536
537 #if no-outer-repo
537 #if no-outer-repo
538 $ hg root
538 $ hg root
539 abort: no repository found in '$TESTTMP' (.hg not found)!
539 abort: no repository found in '$TESTTMP' (.hg not found)!
540 [255]
540 [255]
541 $ hg --config alias.hgroot='!hg root' hgroot
541 $ hg --config alias.hgroot='!hg root' hgroot
542 abort: no repository found in '$TESTTMP' (.hg not found)!
542 abort: no repository found in '$TESTTMP' (.hg not found)!
543 [255]
543 [255]
544 #endif
544 #endif
@@ -1,2977 +1,2977
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 changegroup file
61 bundle create a changegroup 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 for a pattern in specified files and revisions
72 grep search for a pattern in specified files and revisions
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 changegroup 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 config Configuration Files
105 config Configuration Files
106 dates Date Formats
106 dates Date Formats
107 diffs Diff Formats
107 diffs Diff Formats
108 environment Environment Variables
108 environment Environment Variables
109 extensions Using Additional Features
109 extensions Using Additional Features
110 filesets Specifying File Sets
110 filesets Specifying File Sets
111 glossary Glossary
111 glossary Glossary
112 hgignore Syntax for Mercurial Ignore Files
112 hgignore Syntax for Mercurial Ignore Files
113 hgweb Configuring hgweb
113 hgweb Configuring hgweb
114 internals Technical implementation topics
114 internals Technical implementation topics
115 merge-tools Merge Tools
115 merge-tools Merge Tools
116 multirevs Specifying Multiple Revisions
116 multirevs Specifying Multiple Revisions
117 patterns File Name Patterns
117 patterns File Name Patterns
118 phases Working with Phases
118 phases Working with Phases
119 revisions Specifying Single Revisions
119 revisions Specifying Single Revisions
120 revsets Specifying Revision Sets
120 revsets Specifying Revision Sets
121 scripting Using Mercurial from scripts and automation
121 scripting Using Mercurial from scripts and automation
122 subrepos Subrepositories
122 subrepos Subrepositories
123 templating Template Usage
123 templating Template Usage
124 urls URL Paths
124 urls URL Paths
125
125
126 (use "hg help -v" to show built-in aliases and global options)
126 (use "hg help -v" to show built-in aliases and global options)
127
127
128 $ hg -q help
128 $ hg -q help
129 add add the specified files on the next commit
129 add add the specified files on the next commit
130 addremove add all new files, delete all missing files
130 addremove add all new files, delete all missing files
131 annotate show changeset information by line for each file
131 annotate show changeset information by line for each file
132 archive create an unversioned archive of a repository revision
132 archive create an unversioned archive of a repository revision
133 backout reverse effect of earlier changeset
133 backout reverse effect of earlier changeset
134 bisect subdivision search of changesets
134 bisect subdivision search of changesets
135 bookmarks create a new bookmark or list existing bookmarks
135 bookmarks create a new bookmark or list existing bookmarks
136 branch set or show the current branch name
136 branch set or show the current branch name
137 branches list repository named branches
137 branches list repository named branches
138 bundle create a changegroup file
138 bundle create a changegroup file
139 cat output the current or given revision of files
139 cat output the current or given revision of files
140 clone make a copy of an existing repository
140 clone make a copy of an existing repository
141 commit commit the specified files or all outstanding changes
141 commit commit the specified files or all outstanding changes
142 config show combined config settings from all hgrc files
142 config show combined config settings from all hgrc files
143 copy mark files as copied for the next commit
143 copy mark files as copied for the next commit
144 diff diff repository (or selected files)
144 diff diff repository (or selected files)
145 export dump the header and diffs for one or more changesets
145 export dump the header and diffs for one or more changesets
146 files list tracked files
146 files list tracked files
147 forget forget the specified files on the next commit
147 forget forget the specified files on the next commit
148 graft copy changes from other branches onto the current branch
148 graft copy changes from other branches onto the current branch
149 grep search for a pattern in specified files and revisions
149 grep search for a pattern in specified files and revisions
150 heads show branch heads
150 heads show branch heads
151 help show help for a given topic or a help overview
151 help show help for a given topic or a help overview
152 identify identify the working directory or specified revision
152 identify identify the working directory or specified revision
153 import import an ordered set of patches
153 import import an ordered set of patches
154 incoming show new changesets found in source
154 incoming show new changesets found in source
155 init create a new repository in the given directory
155 init create a new repository in the given directory
156 log show revision history of entire repository or files
156 log show revision history of entire repository or files
157 manifest output the current or given revision of the project manifest
157 manifest output the current or given revision of the project manifest
158 merge merge another revision into working directory
158 merge merge another revision into working directory
159 outgoing show changesets not found in the destination
159 outgoing show changesets not found in the destination
160 paths show aliases for remote repositories
160 paths show aliases for remote repositories
161 phase set or show the current phase name
161 phase set or show the current phase name
162 pull pull changes from the specified source
162 pull pull changes from the specified source
163 push push changes to the specified destination
163 push push changes to the specified destination
164 recover roll back an interrupted transaction
164 recover roll back an interrupted transaction
165 remove remove the specified files on the next commit
165 remove remove the specified files on the next commit
166 rename rename files; equivalent of copy + remove
166 rename rename files; equivalent of copy + remove
167 resolve redo merges or set/view the merge status of files
167 resolve redo merges or set/view the merge status of files
168 revert restore files to their checkout state
168 revert restore files to their checkout state
169 root print the root (top) of the current working directory
169 root print the root (top) of the current working directory
170 serve start stand-alone webserver
170 serve start stand-alone webserver
171 status show changed files in the working directory
171 status show changed files in the working directory
172 summary summarize working directory state
172 summary summarize working directory state
173 tag add one or more tags for the current or given revision
173 tag add one or more tags for the current or given revision
174 tags list repository tags
174 tags list repository tags
175 unbundle apply one or more changegroup files
175 unbundle apply one or more changegroup files
176 update update working directory (or switch revisions)
176 update update working directory (or switch revisions)
177 verify verify the integrity of the repository
177 verify verify the integrity of the repository
178 version output version and copyright information
178 version output version and copyright information
179
179
180 additional help topics:
180 additional help topics:
181
181
182 config Configuration Files
182 config Configuration Files
183 dates Date Formats
183 dates Date Formats
184 diffs Diff Formats
184 diffs Diff Formats
185 environment Environment Variables
185 environment Environment Variables
186 extensions Using Additional Features
186 extensions Using Additional Features
187 filesets Specifying File Sets
187 filesets Specifying File Sets
188 glossary Glossary
188 glossary Glossary
189 hgignore Syntax for Mercurial Ignore Files
189 hgignore Syntax for Mercurial Ignore Files
190 hgweb Configuring hgweb
190 hgweb Configuring hgweb
191 internals Technical implementation topics
191 internals Technical implementation topics
192 merge-tools Merge Tools
192 merge-tools Merge Tools
193 multirevs Specifying Multiple Revisions
193 multirevs Specifying Multiple Revisions
194 patterns File Name Patterns
194 patterns File Name Patterns
195 phases Working with Phases
195 phases Working with Phases
196 revisions Specifying Single Revisions
196 revisions Specifying Single Revisions
197 revsets Specifying Revision Sets
197 revsets Specifying Revision Sets
198 scripting Using Mercurial from scripts and automation
198 scripting Using Mercurial from scripts and automation
199 subrepos Subrepositories
199 subrepos Subrepositories
200 templating Template Usage
200 templating Template Usage
201 urls URL Paths
201 urls URL Paths
202
202
203 Test extension help:
203 Test extension help:
204 $ hg help extensions --config extensions.rebase= --config extensions.children=
204 $ hg help extensions --config extensions.rebase= --config extensions.children=
205 Using Additional Features
205 Using Additional Features
206 """""""""""""""""""""""""
206 """""""""""""""""""""""""
207
207
208 Mercurial has the ability to add new features through the use of
208 Mercurial has the ability to add new features through the use of
209 extensions. Extensions may add new commands, add options to existing
209 extensions. Extensions may add new commands, add options to existing
210 commands, change the default behavior of commands, or implement hooks.
210 commands, change the default behavior of commands, or implement hooks.
211
211
212 To enable the "foo" extension, either shipped with Mercurial or in the
212 To enable the "foo" extension, either shipped with Mercurial or in the
213 Python search path, create an entry for it in your configuration file,
213 Python search path, create an entry for it in your configuration file,
214 like this:
214 like this:
215
215
216 [extensions]
216 [extensions]
217 foo =
217 foo =
218
218
219 You may also specify the full path to an extension:
219 You may also specify the full path to an extension:
220
220
221 [extensions]
221 [extensions]
222 myfeature = ~/.hgext/myfeature.py
222 myfeature = ~/.hgext/myfeature.py
223
223
224 See "hg help config" for more information on configuration files.
224 See "hg help config" for more information on configuration files.
225
225
226 Extensions are not loaded by default for a variety of reasons: they can
226 Extensions are not loaded by default for a variety of reasons: they can
227 increase startup overhead; they may be meant for advanced usage only; they
227 increase startup overhead; they may be meant for advanced usage only; they
228 may provide potentially dangerous abilities (such as letting you destroy
228 may provide potentially dangerous abilities (such as letting you destroy
229 or modify history); they might not be ready for prime time; or they may
229 or modify history); they might not be ready for prime time; or they may
230 alter some usual behaviors of stock Mercurial. It is thus up to the user
230 alter some usual behaviors of stock Mercurial. It is thus up to the user
231 to activate extensions as needed.
231 to activate extensions as needed.
232
232
233 To explicitly disable an extension enabled in a configuration file of
233 To explicitly disable an extension enabled in a configuration file of
234 broader scope, prepend its path with !:
234 broader scope, prepend its path with !:
235
235
236 [extensions]
236 [extensions]
237 # disabling extension bar residing in /path/to/extension/bar.py
237 # disabling extension bar residing in /path/to/extension/bar.py
238 bar = !/path/to/extension/bar.py
238 bar = !/path/to/extension/bar.py
239 # ditto, but no path was supplied for extension baz
239 # ditto, but no path was supplied for extension baz
240 baz = !
240 baz = !
241
241
242 enabled extensions:
242 enabled extensions:
243
243
244 children command to display child changesets (DEPRECATED)
244 children command to display child changesets (DEPRECATED)
245 rebase command to move sets of revisions to a different ancestor
245 rebase command to move sets of revisions to a different ancestor
246
246
247 disabled extensions:
247 disabled extensions:
248
248
249 acl hooks for controlling repository access
249 acl hooks for controlling repository access
250 blackbox log repository events to a blackbox for debugging
250 blackbox log repository events to a blackbox for debugging
251 bugzilla hooks for integrating with the Bugzilla bug tracker
251 bugzilla hooks for integrating with the Bugzilla bug tracker
252 censor erase file content at a given revision
252 censor erase file content at a given revision
253 churn command to display statistics about repository history
253 churn command to display statistics about repository history
254 clonebundles advertise pre-generated bundles to seed clones
254 clonebundles advertise pre-generated bundles to seed clones
255 (experimental)
255 (experimental)
256 color colorize output from some commands
256 color colorize output from some commands
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 hgcia hooks for integrating with the CIA.vc notification service
263 hgcia hooks for integrating with the CIA.vc notification service
264 hgk browse the repository in a graphical way
264 hgk browse the repository in a graphical way
265 highlight syntax highlighting for hgweb (requires Pygments)
265 highlight syntax highlighting for hgweb (requires Pygments)
266 histedit interactive history editing
266 histedit interactive history editing
267 keyword expand keywords in tracked files
267 keyword expand keywords in tracked files
268 largefiles track large binary files
268 largefiles track large binary files
269 mq manage a stack of patches
269 mq manage a stack of patches
270 notify hooks for sending email push notifications
270 notify hooks for sending email push notifications
271 pager browse command output with an external pager
271 pager browse command output with an external pager
272 patchbomb command to send changesets as (a series of) patch emails
272 patchbomb command to send changesets as (a series of) patch emails
273 purge command to delete untracked files from the working
273 purge command to delete untracked files from the working
274 directory
274 directory
275 record commands to interactively select changes for
275 record commands to interactively select changes for
276 commit/qrefresh
276 commit/qrefresh
277 relink recreates hardlinks between repository clones
277 relink recreates hardlinks between repository clones
278 schemes extend schemes with shortcuts to repository swarms
278 schemes extend schemes with shortcuts to repository swarms
279 share share a common history between several working directories
279 share share a common history between several working directories
280 shelve save and restore changes to the working directory
280 shelve save and restore changes to the working directory
281 strip strip changesets and their descendants from history
281 strip strip changesets and their descendants from history
282 transplant command to transplant changesets from another branch
282 transplant command to transplant changesets from another branch
283 win32mbcs allow the use of MBCS paths with problematic encodings
283 win32mbcs allow the use of MBCS paths with problematic encodings
284 zeroconf discover and advertise repositories on the local network
284 zeroconf discover and advertise repositories on the local network
285
285
286 Verify that extension keywords appear in help templates
286 Verify that extension keywords appear in help templates
287
287
288 $ hg help --config extensions.transplant= templating|grep transplant > /dev/null
288 $ hg help --config extensions.transplant= templating|grep transplant > /dev/null
289
289
290 Test short command list with verbose option
290 Test short command list with verbose option
291
291
292 $ hg -v help shortlist
292 $ hg -v help shortlist
293 Mercurial Distributed SCM
293 Mercurial Distributed SCM
294
294
295 basic commands:
295 basic commands:
296
296
297 add add the specified files on the next commit
297 add add the specified files on the next commit
298 annotate, blame
298 annotate, blame
299 show changeset information by line for each file
299 show changeset information by line for each file
300 clone make a copy of an existing repository
300 clone make a copy of an existing repository
301 commit, ci commit the specified files or all outstanding changes
301 commit, ci commit the specified files or all outstanding changes
302 diff diff repository (or selected files)
302 diff diff repository (or selected files)
303 export dump the header and diffs for one or more changesets
303 export dump the header and diffs for one or more changesets
304 forget forget the specified files on the next commit
304 forget forget the specified files on the next commit
305 init create a new repository in the given directory
305 init create a new repository in the given directory
306 log, history show revision history of entire repository or files
306 log, history show revision history of entire repository or files
307 merge merge another revision into working directory
307 merge merge another revision into working directory
308 pull pull changes from the specified source
308 pull pull changes from the specified source
309 push push changes to the specified destination
309 push push changes to the specified destination
310 remove, rm remove the specified files on the next commit
310 remove, rm remove the specified files on the next commit
311 serve start stand-alone webserver
311 serve start stand-alone webserver
312 status, st show changed files in the working directory
312 status, st show changed files in the working directory
313 summary, sum summarize working directory state
313 summary, sum summarize working directory state
314 update, up, checkout, co
314 update, up, checkout, co
315 update working directory (or switch revisions)
315 update working directory (or switch revisions)
316
316
317 global options ([+] can be repeated):
317 global options ([+] can be repeated):
318
318
319 -R --repository REPO repository root directory or name of overlay bundle
319 -R --repository REPO repository root directory or name of overlay bundle
320 file
320 file
321 --cwd DIR change working directory
321 --cwd DIR change working directory
322 -y --noninteractive do not prompt, automatically pick the first choice for
322 -y --noninteractive do not prompt, automatically pick the first choice for
323 all prompts
323 all prompts
324 -q --quiet suppress output
324 -q --quiet suppress output
325 -v --verbose enable additional output
325 -v --verbose enable additional output
326 --config CONFIG [+] set/override config option (use 'section.name=value')
326 --config CONFIG [+] set/override config option (use 'section.name=value')
327 --debug enable debugging output
327 --debug enable debugging output
328 --debugger start debugger
328 --debugger start debugger
329 --encoding ENCODE set the charset encoding (default: ascii)
329 --encoding ENCODE set the charset encoding (default: ascii)
330 --encodingmode MODE set the charset encoding mode (default: strict)
330 --encodingmode MODE set the charset encoding mode (default: strict)
331 --traceback always print a traceback on exception
331 --traceback always print a traceback on exception
332 --time time how long the command takes
332 --time time how long the command takes
333 --profile print command execution profile
333 --profile print command execution profile
334 --version output version information and exit
334 --version output version information and exit
335 -h --help display help and exit
335 -h --help display help and exit
336 --hidden consider hidden changesets
336 --hidden consider hidden changesets
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 --config CONFIG [+] set/override config option (use 'section.name=value')
422 --config CONFIG [+] set/override config option (use 'section.name=value')
423 --debug enable debugging output
423 --debug enable debugging output
424 --debugger start debugger
424 --debugger start debugger
425 --encoding ENCODE set the charset encoding (default: ascii)
425 --encoding ENCODE set the charset encoding (default: ascii)
426 --encodingmode MODE set the charset encoding mode (default: strict)
426 --encodingmode MODE set the charset encoding mode (default: strict)
427 --traceback always print a traceback on exception
427 --traceback always print a traceback on exception
428 --time time how long the command takes
428 --time time how long the command takes
429 --profile print command execution profile
429 --profile print command execution profile
430 --version output version information and exit
430 --version output version information and exit
431 -h --help display help and exit
431 -h --help display help and exit
432 --hidden consider hidden changesets
432 --hidden consider hidden changesets
433
433
434 Test help option with version option
434 Test help option with version option
435
435
436 $ hg add -h --version
436 $ hg add -h --version
437 Mercurial Distributed SCM (version *) (glob)
437 Mercurial Distributed SCM (version *) (glob)
438 (see https://mercurial-scm.org for more information)
438 (see https://mercurial-scm.org for more information)
439
439
440 Copyright (C) 2005-2015 Matt Mackall and others
440 Copyright (C) 2005-2015 Matt Mackall and others
441 This is free software; see the source for copying conditions. There is NO
441 This is free software; see the source for copying conditions. There is NO
442 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
442 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
443
443
444 $ hg add --skjdfks
444 $ hg add --skjdfks
445 hg add: option --skjdfks not recognized
445 hg add: option --skjdfks not recognized
446 hg add [OPTION]... [FILE]...
446 hg add [OPTION]... [FILE]...
447
447
448 add the specified files on the next commit
448 add the specified files on the next commit
449
449
450 options ([+] can be repeated):
450 options ([+] can be repeated):
451
451
452 -I --include PATTERN [+] include names matching the given patterns
452 -I --include PATTERN [+] include names matching the given patterns
453 -X --exclude PATTERN [+] exclude names matching the given patterns
453 -X --exclude PATTERN [+] exclude names matching the given patterns
454 -S --subrepos recurse into subrepositories
454 -S --subrepos recurse into subrepositories
455 -n --dry-run do not perform actions, just print output
455 -n --dry-run do not perform actions, just print output
456
456
457 (use "hg add -h" to show more help)
457 (use "hg add -h" to show more help)
458 [255]
458 [255]
459
459
460 Test ambiguous command help
460 Test ambiguous command help
461
461
462 $ hg help ad
462 $ hg help ad
463 list of commands:
463 list of commands:
464
464
465 add add the specified files on the next commit
465 add add the specified files on the next commit
466 addremove add all new files, delete all missing files
466 addremove add all new files, delete all missing files
467
467
468 (use "hg help -v ad" to show built-in aliases and global options)
468 (use "hg help -v ad" to show built-in aliases and global options)
469
469
470 Test command without options
470 Test command without options
471
471
472 $ hg help verify
472 $ hg help verify
473 hg verify
473 hg verify
474
474
475 verify the integrity of the repository
475 verify the integrity of the repository
476
476
477 Verify the integrity of the current repository.
477 Verify the integrity of the current repository.
478
478
479 This will perform an extensive check of the repository's integrity,
479 This will perform an extensive check of the repository's integrity,
480 validating the hashes and checksums of each entry in the changelog,
480 validating the hashes and checksums of each entry in the changelog,
481 manifest, and tracked files, as well as the integrity of their crosslinks
481 manifest, and tracked files, as well as the integrity of their crosslinks
482 and indices.
482 and indices.
483
483
484 Please see https://mercurial-scm.org/wiki/RepositoryCorruption for more
484 Please see https://mercurial-scm.org/wiki/RepositoryCorruption for more
485 information about recovery from corruption of the repository.
485 information about recovery from corruption of the repository.
486
486
487 Returns 0 on success, 1 if errors are encountered.
487 Returns 0 on success, 1 if errors are encountered.
488
488
489 (some details hidden, use --verbose to show complete help)
489 (some details hidden, use --verbose to show complete help)
490
490
491 $ hg help diff
491 $ hg help diff
492 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
492 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
493
493
494 diff repository (or selected files)
494 diff repository (or selected files)
495
495
496 Show differences between revisions for the specified files.
496 Show differences between revisions for the specified files.
497
497
498 Differences between files are shown using the unified diff format.
498 Differences between files are shown using the unified diff format.
499
499
500 Note:
500 Note:
501 "hg diff" may generate unexpected results for merges, as it will
501 "hg diff" may generate unexpected results for merges, as it will
502 default to comparing against the working directory's first parent
502 default to comparing against the working directory's first parent
503 changeset if no revisions are specified.
503 changeset if no revisions are specified.
504
504
505 When two revision arguments are given, then changes are shown between
505 When two revision arguments are given, then changes are shown between
506 those revisions. If only one revision is specified then that revision is
506 those revisions. If only one revision is specified then that revision is
507 compared to the working directory, and, when no revisions are specified,
507 compared to the working directory, and, when no revisions are specified,
508 the working directory files are compared to its first parent.
508 the working directory files are compared to its first parent.
509
509
510 Alternatively you can specify -c/--change with a revision to see the
510 Alternatively you can specify -c/--change with a revision to see the
511 changes in that changeset relative to its first parent.
511 changes in that changeset relative to its first parent.
512
512
513 Without the -a/--text option, diff will avoid generating diffs of files it
513 Without the -a/--text option, diff will avoid generating diffs of files it
514 detects as binary. With -a, diff will generate a diff anyway, probably
514 detects as binary. With -a, diff will generate a diff anyway, probably
515 with undesirable results.
515 with undesirable results.
516
516
517 Use the -g/--git option to generate diffs in the git extended diff format.
517 Use the -g/--git option to generate diffs in the git extended diff format.
518 For more information, read "hg help diffs".
518 For more information, read "hg help diffs".
519
519
520 Returns 0 on success.
520 Returns 0 on success.
521
521
522 options ([+] can be repeated):
522 options ([+] can be repeated):
523
523
524 -r --rev REV [+] revision
524 -r --rev REV [+] revision
525 -c --change REV change made by revision
525 -c --change REV change made by revision
526 -a --text treat all files as text
526 -a --text treat all files as text
527 -g --git use git extended diff format
527 -g --git use git extended diff format
528 --nodates omit dates from diff headers
528 --nodates omit dates from diff headers
529 --noprefix omit a/ and b/ prefixes from filenames
529 --noprefix omit a/ and b/ prefixes from filenames
530 -p --show-function show which function each change is in
530 -p --show-function show which function each change is in
531 --reverse produce a diff that undoes the changes
531 --reverse produce a diff that undoes the changes
532 -w --ignore-all-space ignore white space when comparing lines
532 -w --ignore-all-space ignore white space when comparing lines
533 -b --ignore-space-change ignore changes in the amount of white space
533 -b --ignore-space-change ignore changes in the amount of white space
534 -B --ignore-blank-lines ignore changes whose lines are all blank
534 -B --ignore-blank-lines ignore changes whose lines are all blank
535 -U --unified NUM number of lines of context to show
535 -U --unified NUM number of lines of context to show
536 --stat output diffstat-style summary of changes
536 --stat output diffstat-style summary of changes
537 --root DIR produce diffs relative to subdirectory
537 --root DIR produce diffs relative to subdirectory
538 -I --include PATTERN [+] include names matching the given patterns
538 -I --include PATTERN [+] include names matching the given patterns
539 -X --exclude PATTERN [+] exclude names matching the given patterns
539 -X --exclude PATTERN [+] exclude names matching the given patterns
540 -S --subrepos recurse into subrepositories
540 -S --subrepos recurse into subrepositories
541
541
542 (some details hidden, use --verbose to show complete help)
542 (some details hidden, use --verbose to show complete help)
543
543
544 $ hg help status
544 $ hg help status
545 hg status [OPTION]... [FILE]...
545 hg status [OPTION]... [FILE]...
546
546
547 aliases: st
547 aliases: st
548
548
549 show changed files in the working directory
549 show changed files in the working directory
550
550
551 Show status of files in the repository. If names are given, only files
551 Show status of files in the repository. If names are given, only files
552 that match are shown. Files that are clean or ignored or the source of a
552 that match are shown. Files that are clean or ignored or the source of a
553 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
553 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
554 -C/--copies or -A/--all are given. Unless options described with "show
554 -C/--copies or -A/--all are given. Unless options described with "show
555 only ..." are given, the options -mardu are used.
555 only ..." are given, the options -mardu are used.
556
556
557 Option -q/--quiet hides untracked (unknown and ignored) files unless
557 Option -q/--quiet hides untracked (unknown and ignored) files unless
558 explicitly requested with -u/--unknown or -i/--ignored.
558 explicitly requested with -u/--unknown or -i/--ignored.
559
559
560 Note:
560 Note:
561 "hg status" may appear to disagree with diff if permissions have
561 "hg status" may appear to disagree with diff if permissions have
562 changed or a merge has occurred. The standard diff format does not
562 changed or a merge has occurred. The standard diff format does not
563 report permission changes and diff only reports changes relative to one
563 report permission changes and diff only reports changes relative to one
564 merge parent.
564 merge parent.
565
565
566 If one revision is given, it is used as the base revision. If two
566 If one revision is given, it is used as the base revision. If two
567 revisions are given, the differences between them are shown. The --change
567 revisions are given, the differences between them are shown. The --change
568 option can also be used as a shortcut to list the changed files of a
568 option can also be used as a shortcut to list the changed files of a
569 revision from its first parent.
569 revision from its first parent.
570
570
571 The codes used to show the status of files are:
571 The codes used to show the status of files are:
572
572
573 M = modified
573 M = modified
574 A = added
574 A = added
575 R = removed
575 R = removed
576 C = clean
576 C = clean
577 ! = missing (deleted by non-hg command, but still tracked)
577 ! = missing (deleted by non-hg command, but still tracked)
578 ? = not tracked
578 ? = not tracked
579 I = ignored
579 I = ignored
580 = origin of the previous file (with --copies)
580 = origin of the previous file (with --copies)
581
581
582 Returns 0 on success.
582 Returns 0 on success.
583
583
584 options ([+] can be repeated):
584 options ([+] can be repeated):
585
585
586 -A --all show status of all files
586 -A --all show status of all files
587 -m --modified show only modified files
587 -m --modified show only modified files
588 -a --added show only added files
588 -a --added show only added files
589 -r --removed show only removed files
589 -r --removed show only removed files
590 -d --deleted show only deleted (but tracked) files
590 -d --deleted show only deleted (but tracked) files
591 -c --clean show only files without changes
591 -c --clean show only files without changes
592 -u --unknown show only unknown (not tracked) files
592 -u --unknown show only unknown (not tracked) files
593 -i --ignored show only ignored files
593 -i --ignored show only ignored files
594 -n --no-status hide status prefix
594 -n --no-status hide status prefix
595 -C --copies show source of copied files
595 -C --copies show source of copied files
596 -0 --print0 end filenames with NUL, for use with xargs
596 -0 --print0 end filenames with NUL, for use with xargs
597 --rev REV [+] show difference from revision
597 --rev REV [+] show difference from revision
598 --change REV list the changed files of a revision
598 --change REV list the changed files of a revision
599 -I --include PATTERN [+] include names matching the given patterns
599 -I --include PATTERN [+] include names matching the given patterns
600 -X --exclude PATTERN [+] exclude names matching the given patterns
600 -X --exclude PATTERN [+] exclude names matching the given patterns
601 -S --subrepos recurse into subrepositories
601 -S --subrepos recurse into subrepositories
602
602
603 (some details hidden, use --verbose to show complete help)
603 (some details hidden, use --verbose to show complete help)
604
604
605 $ hg -q help status
605 $ hg -q help status
606 hg status [OPTION]... [FILE]...
606 hg status [OPTION]... [FILE]...
607
607
608 show changed files in the working directory
608 show changed files in the working directory
609
609
610 $ hg help foo
610 $ hg help foo
611 abort: no such help topic: foo
611 abort: no such help topic: foo
612 (try "hg help --keyword foo")
612 (try "hg help --keyword foo")
613 [255]
613 [255]
614
614
615 $ hg skjdfks
615 $ hg skjdfks
616 hg: unknown command 'skjdfks'
616 hg: unknown command 'skjdfks'
617 Mercurial Distributed SCM
617 Mercurial Distributed SCM
618
618
619 basic commands:
619 basic commands:
620
620
621 add add the specified files on the next commit
621 add add the specified files on the next commit
622 annotate show changeset information by line for each file
622 annotate show changeset information by line for each file
623 clone make a copy of an existing repository
623 clone make a copy of an existing repository
624 commit commit the specified files or all outstanding changes
624 commit commit the specified files or all outstanding changes
625 diff diff repository (or selected files)
625 diff diff repository (or selected files)
626 export dump the header and diffs for one or more changesets
626 export dump the header and diffs for one or more changesets
627 forget forget the specified files on the next commit
627 forget forget the specified files on the next commit
628 init create a new repository in the given directory
628 init create a new repository in the given directory
629 log show revision history of entire repository or files
629 log show revision history of entire repository or files
630 merge merge another revision into working directory
630 merge merge another revision into working directory
631 pull pull changes from the specified source
631 pull pull changes from the specified source
632 push push changes to the specified destination
632 push push changes to the specified destination
633 remove remove the specified files on the next commit
633 remove remove the specified files on the next commit
634 serve start stand-alone webserver
634 serve start stand-alone webserver
635 status show changed files in the working directory
635 status show changed files in the working directory
636 summary summarize working directory state
636 summary summarize working directory state
637 update update working directory (or switch revisions)
637 update update working directory (or switch revisions)
638
638
639 (use "hg help" for the full list of commands or "hg -v" for details)
639 (use "hg help" for the full list of commands or "hg -v" for details)
640 [255]
640 [255]
641
641
642
642
643 Make sure that we don't run afoul of the help system thinking that
643 Make sure that we don't run afoul of the help system thinking that
644 this is a section and erroring out weirdly.
644 this is a section and erroring out weirdly.
645
645
646 $ hg .log
646 $ hg .log
647 hg: unknown command '.log'
647 hg: unknown command '.log'
648 (did you mean one of log?)
648 (did you mean log?)
649 [255]
649 [255]
650
650
651 $ hg log.
651 $ hg log.
652 hg: unknown command 'log.'
652 hg: unknown command 'log.'
653 (did you mean one of log?)
653 (did you mean log?)
654 [255]
654 [255]
655 $ hg pu.lh
655 $ hg pu.lh
656 hg: unknown command 'pu.lh'
656 hg: unknown command 'pu.lh'
657 (did you mean one of pull, push?)
657 (did you mean one of pull, push?)
658 [255]
658 [255]
659
659
660 $ cat > helpext.py <<EOF
660 $ cat > helpext.py <<EOF
661 > import os
661 > import os
662 > from mercurial import cmdutil, commands
662 > from mercurial import cmdutil, commands
663 >
663 >
664 > cmdtable = {}
664 > cmdtable = {}
665 > command = cmdutil.command(cmdtable)
665 > command = cmdutil.command(cmdtable)
666 >
666 >
667 > @command('nohelp',
667 > @command('nohelp',
668 > [('', 'longdesc', 3, 'x'*90),
668 > [('', 'longdesc', 3, 'x'*90),
669 > ('n', '', None, 'normal desc'),
669 > ('n', '', None, 'normal desc'),
670 > ('', 'newline', '', 'line1\nline2')],
670 > ('', 'newline', '', 'line1\nline2')],
671 > 'hg nohelp',
671 > 'hg nohelp',
672 > norepo=True)
672 > norepo=True)
673 > @command('debugoptDEP', [('', 'dopt', None, 'option is (DEPRECATED)')])
673 > @command('debugoptDEP', [('', 'dopt', None, 'option is (DEPRECATED)')])
674 > @command('debugoptEXP', [('', 'eopt', None, 'option is (EXPERIMENTAL)')])
674 > @command('debugoptEXP', [('', 'eopt', None, 'option is (EXPERIMENTAL)')])
675 > def nohelp(ui, *args, **kwargs):
675 > def nohelp(ui, *args, **kwargs):
676 > pass
676 > pass
677 >
677 >
678 > EOF
678 > EOF
679 $ echo '[extensions]' >> $HGRCPATH
679 $ echo '[extensions]' >> $HGRCPATH
680 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
680 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
681
681
682 Test command with no help text
682 Test command with no help text
683
683
684 $ hg help nohelp
684 $ hg help nohelp
685 hg nohelp
685 hg nohelp
686
686
687 (no help text available)
687 (no help text available)
688
688
689 options:
689 options:
690
690
691 --longdesc VALUE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
691 --longdesc VALUE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
692 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (default: 3)
692 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (default: 3)
693 -n -- normal desc
693 -n -- normal desc
694 --newline VALUE line1 line2
694 --newline VALUE line1 line2
695
695
696 (some details hidden, use --verbose to show complete help)
696 (some details hidden, use --verbose to show complete help)
697
697
698 $ hg help -k nohelp
698 $ hg help -k nohelp
699 Commands:
699 Commands:
700
700
701 nohelp hg nohelp
701 nohelp hg nohelp
702
702
703 Extension Commands:
703 Extension Commands:
704
704
705 nohelp (no help text available)
705 nohelp (no help text available)
706
706
707 Test that default list of commands omits extension commands
707 Test that default list of commands omits extension commands
708
708
709 $ hg help
709 $ hg help
710 Mercurial Distributed SCM
710 Mercurial Distributed SCM
711
711
712 list of commands:
712 list of commands:
713
713
714 add add the specified files on the next commit
714 add add the specified files on the next commit
715 addremove add all new files, delete all missing files
715 addremove add all new files, delete all missing files
716 annotate show changeset information by line for each file
716 annotate show changeset information by line for each file
717 archive create an unversioned archive of a repository revision
717 archive create an unversioned archive of a repository revision
718 backout reverse effect of earlier changeset
718 backout reverse effect of earlier changeset
719 bisect subdivision search of changesets
719 bisect subdivision search of changesets
720 bookmarks create a new bookmark or list existing bookmarks
720 bookmarks create a new bookmark or list existing bookmarks
721 branch set or show the current branch name
721 branch set or show the current branch name
722 branches list repository named branches
722 branches list repository named branches
723 bundle create a changegroup file
723 bundle create a changegroup file
724 cat output the current or given revision of files
724 cat output the current or given revision of files
725 clone make a copy of an existing repository
725 clone make a copy of an existing repository
726 commit commit the specified files or all outstanding changes
726 commit commit the specified files or all outstanding changes
727 config show combined config settings from all hgrc files
727 config show combined config settings from all hgrc files
728 copy mark files as copied for the next commit
728 copy mark files as copied for the next commit
729 diff diff repository (or selected files)
729 diff diff repository (or selected files)
730 export dump the header and diffs for one or more changesets
730 export dump the header and diffs for one or more changesets
731 files list tracked files
731 files list tracked files
732 forget forget the specified files on the next commit
732 forget forget the specified files on the next commit
733 graft copy changes from other branches onto the current branch
733 graft copy changes from other branches onto the current branch
734 grep search for a pattern in specified files and revisions
734 grep search for a pattern in specified files and revisions
735 heads show branch heads
735 heads show branch heads
736 help show help for a given topic or a help overview
736 help show help for a given topic or a help overview
737 identify identify the working directory or specified revision
737 identify identify the working directory or specified revision
738 import import an ordered set of patches
738 import import an ordered set of patches
739 incoming show new changesets found in source
739 incoming show new changesets found in source
740 init create a new repository in the given directory
740 init create a new repository in the given directory
741 log show revision history of entire repository or files
741 log show revision history of entire repository or files
742 manifest output the current or given revision of the project manifest
742 manifest output the current or given revision of the project manifest
743 merge merge another revision into working directory
743 merge merge another revision into working directory
744 outgoing show changesets not found in the destination
744 outgoing show changesets not found in the destination
745 paths show aliases for remote repositories
745 paths show aliases for remote repositories
746 phase set or show the current phase name
746 phase set or show the current phase name
747 pull pull changes from the specified source
747 pull pull changes from the specified source
748 push push changes to the specified destination
748 push push changes to the specified destination
749 recover roll back an interrupted transaction
749 recover roll back an interrupted transaction
750 remove remove the specified files on the next commit
750 remove remove the specified files on the next commit
751 rename rename files; equivalent of copy + remove
751 rename rename files; equivalent of copy + remove
752 resolve redo merges or set/view the merge status of files
752 resolve redo merges or set/view the merge status of files
753 revert restore files to their checkout state
753 revert restore files to their checkout state
754 root print the root (top) of the current working directory
754 root print the root (top) of the current working directory
755 serve start stand-alone webserver
755 serve start stand-alone webserver
756 status show changed files in the working directory
756 status show changed files in the working directory
757 summary summarize working directory state
757 summary summarize working directory state
758 tag add one or more tags for the current or given revision
758 tag add one or more tags for the current or given revision
759 tags list repository tags
759 tags list repository tags
760 unbundle apply one or more changegroup files
760 unbundle apply one or more changegroup files
761 update update working directory (or switch revisions)
761 update update working directory (or switch revisions)
762 verify verify the integrity of the repository
762 verify verify the integrity of the repository
763 version output version and copyright information
763 version output version and copyright information
764
764
765 enabled extensions:
765 enabled extensions:
766
766
767 helpext (no help text available)
767 helpext (no help text available)
768
768
769 additional help topics:
769 additional help topics:
770
770
771 config Configuration Files
771 config Configuration Files
772 dates Date Formats
772 dates Date Formats
773 diffs Diff Formats
773 diffs Diff Formats
774 environment Environment Variables
774 environment Environment Variables
775 extensions Using Additional Features
775 extensions Using Additional Features
776 filesets Specifying File Sets
776 filesets Specifying File Sets
777 glossary Glossary
777 glossary Glossary
778 hgignore Syntax for Mercurial Ignore Files
778 hgignore Syntax for Mercurial Ignore Files
779 hgweb Configuring hgweb
779 hgweb Configuring hgweb
780 internals Technical implementation topics
780 internals Technical implementation topics
781 merge-tools Merge Tools
781 merge-tools Merge Tools
782 multirevs Specifying Multiple Revisions
782 multirevs Specifying Multiple Revisions
783 patterns File Name Patterns
783 patterns File Name Patterns
784 phases Working with Phases
784 phases Working with Phases
785 revisions Specifying Single Revisions
785 revisions Specifying Single Revisions
786 revsets Specifying Revision Sets
786 revsets Specifying Revision Sets
787 scripting Using Mercurial from scripts and automation
787 scripting Using Mercurial from scripts and automation
788 subrepos Subrepositories
788 subrepos Subrepositories
789 templating Template Usage
789 templating Template Usage
790 urls URL Paths
790 urls URL Paths
791
791
792 (use "hg help -v" to show built-in aliases and global options)
792 (use "hg help -v" to show built-in aliases and global options)
793
793
794
794
795 Test list of internal help commands
795 Test list of internal help commands
796
796
797 $ hg help debug
797 $ hg help debug
798 debug commands (internal and unsupported):
798 debug commands (internal and unsupported):
799
799
800 debugancestor
800 debugancestor
801 find the ancestor revision of two revisions in a given index
801 find the ancestor revision of two revisions in a given index
802 debugapplystreamclonebundle
802 debugapplystreamclonebundle
803 apply a stream clone bundle file
803 apply a stream clone bundle file
804 debugbuilddag
804 debugbuilddag
805 builds a repo with a given DAG from scratch in the current
805 builds a repo with a given DAG from scratch in the current
806 empty repo
806 empty repo
807 debugbundle lists the contents of a bundle
807 debugbundle lists the contents of a bundle
808 debugcheckstate
808 debugcheckstate
809 validate the correctness of the current dirstate
809 validate the correctness of the current dirstate
810 debugcommands
810 debugcommands
811 list all available commands and options
811 list all available commands and options
812 debugcomplete
812 debugcomplete
813 returns the completion list associated with the given command
813 returns the completion list associated with the given command
814 debugcreatestreamclonebundle
814 debugcreatestreamclonebundle
815 create a stream clone bundle file
815 create a stream clone bundle file
816 debugdag format the changelog or an index DAG as a concise textual
816 debugdag format the changelog or an index DAG as a concise textual
817 description
817 description
818 debugdata dump the contents of a data file revision
818 debugdata dump the contents of a data file revision
819 debugdate parse and display a date
819 debugdate parse and display a date
820 debugdeltachain
820 debugdeltachain
821 dump information about delta chains in a revlog
821 dump information about delta chains in a revlog
822 debugdirstate
822 debugdirstate
823 show the contents of the current dirstate
823 show the contents of the current dirstate
824 debugdiscovery
824 debugdiscovery
825 runs the changeset discovery protocol in isolation
825 runs the changeset discovery protocol in isolation
826 debugextensions
826 debugextensions
827 show information about active extensions
827 show information about active extensions
828 debugfileset parse and apply a fileset specification
828 debugfileset parse and apply a fileset specification
829 debugfsinfo show information detected about current filesystem
829 debugfsinfo show information detected about current filesystem
830 debuggetbundle
830 debuggetbundle
831 retrieves a bundle from a repo
831 retrieves a bundle from a repo
832 debugignore display the combined ignore pattern
832 debugignore display the combined ignore pattern
833 debugindex dump the contents of an index file
833 debugindex dump the contents of an index file
834 debugindexdot
834 debugindexdot
835 dump an index DAG as a graphviz dot file
835 dump an index DAG as a graphviz dot file
836 debuginstall test Mercurial installation
836 debuginstall test Mercurial installation
837 debugknown test whether node ids are known to a repo
837 debugknown test whether node ids are known to a repo
838 debuglocks show or modify state of locks
838 debuglocks show or modify state of locks
839 debugmergestate
839 debugmergestate
840 print merge state
840 print merge state
841 debugnamecomplete
841 debugnamecomplete
842 complete "names" - tags, open branch names, bookmark names
842 complete "names" - tags, open branch names, bookmark names
843 debugobsolete
843 debugobsolete
844 create arbitrary obsolete marker
844 create arbitrary obsolete marker
845 debugoptDEP (no help text available)
845 debugoptDEP (no help text available)
846 debugoptEXP (no help text available)
846 debugoptEXP (no help text available)
847 debugpathcomplete
847 debugpathcomplete
848 complete part or all of a tracked path
848 complete part or all of a tracked path
849 debugpushkey access the pushkey key/value protocol
849 debugpushkey access the pushkey key/value protocol
850 debugpvec (no help text available)
850 debugpvec (no help text available)
851 debugrebuilddirstate
851 debugrebuilddirstate
852 rebuild the dirstate as it would look like for the given
852 rebuild the dirstate as it would look like for the given
853 revision
853 revision
854 debugrebuildfncache
854 debugrebuildfncache
855 rebuild the fncache file
855 rebuild the fncache file
856 debugrename dump rename information
856 debugrename dump rename information
857 debugrevlog show data and statistics about a revlog
857 debugrevlog show data and statistics about a revlog
858 debugrevspec parse and apply a revision specification
858 debugrevspec parse and apply a revision specification
859 debugsetparents
859 debugsetparents
860 manually set the parents of the current working directory
860 manually set the parents of the current working directory
861 debugsub (no help text available)
861 debugsub (no help text available)
862 debugsuccessorssets
862 debugsuccessorssets
863 show set of successors for revision
863 show set of successors for revision
864 debugwalk show how files match on given patterns
864 debugwalk show how files match on given patterns
865 debugwireargs
865 debugwireargs
866 (no help text available)
866 (no help text available)
867
867
868 (use "hg help -v debug" to show built-in aliases and global options)
868 (use "hg help -v debug" to show built-in aliases and global options)
869
869
870 internals topic renders index of available sub-topics
870 internals topic renders index of available sub-topics
871
871
872 $ hg help internals
872 $ hg help internals
873 Technical implementation topics
873 Technical implementation topics
874 """""""""""""""""""""""""""""""
874 """""""""""""""""""""""""""""""
875
875
876 bundles container for exchange of repository data
876 bundles container for exchange of repository data
877 changegroups representation of revlog data
877 changegroups representation of revlog data
878
878
879 sub-topics can be accessed
879 sub-topics can be accessed
880
880
881 $ hg help internals.changegroups
881 $ hg help internals.changegroups
882 Changegroups
882 Changegroups
883 ============
883 ============
884
884
885 Changegroups are representations of repository revlog data, specifically
885 Changegroups are representations of repository revlog data, specifically
886 the changelog, manifest, and filelogs.
886 the changelog, manifest, and filelogs.
887
887
888 There are 3 versions of changegroups: "1", "2", and "3". From a high-
888 There are 3 versions of changegroups: "1", "2", and "3". From a high-
889 level, versions "1" and "2" are almost exactly the same, with the only
889 level, versions "1" and "2" are almost exactly the same, with the only
890 difference being a header on entries in the changeset segment. Version "3"
890 difference being a header on entries in the changeset segment. Version "3"
891 adds support for exchanging treemanifests and includes revlog flags in the
891 adds support for exchanging treemanifests and includes revlog flags in the
892 delta header.
892 delta header.
893
893
894 Changegroups consists of 3 logical segments:
894 Changegroups consists of 3 logical segments:
895
895
896 +---------------------------------+
896 +---------------------------------+
897 | | | |
897 | | | |
898 | changeset | manifest | filelogs |
898 | changeset | manifest | filelogs |
899 | | | |
899 | | | |
900 +---------------------------------+
900 +---------------------------------+
901
901
902 The principle building block of each segment is a *chunk*. A *chunk* is a
902 The principle building block of each segment is a *chunk*. A *chunk* is a
903 framed piece of data:
903 framed piece of data:
904
904
905 +---------------------------------------+
905 +---------------------------------------+
906 | | |
906 | | |
907 | length | data |
907 | length | data |
908 | (32 bits) | <length> bytes |
908 | (32 bits) | <length> bytes |
909 | | |
909 | | |
910 +---------------------------------------+
910 +---------------------------------------+
911
911
912 Each chunk starts with a 32-bit big-endian signed integer indicating the
912 Each chunk starts with a 32-bit big-endian signed integer indicating the
913 length of the raw data that follows.
913 length of the raw data that follows.
914
914
915 There is a special case chunk that has 0 length ("0x00000000"). We call
915 There is a special case chunk that has 0 length ("0x00000000"). We call
916 this an *empty chunk*.
916 this an *empty chunk*.
917
917
918 Delta Groups
918 Delta Groups
919 ------------
919 ------------
920
920
921 A *delta group* expresses the content of a revlog as a series of deltas,
921 A *delta group* expresses the content of a revlog as a series of deltas,
922 or patches against previous revisions.
922 or patches against previous revisions.
923
923
924 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
924 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
925 to signal the end of the delta group:
925 to signal the end of the delta group:
926
926
927 +------------------------------------------------------------------------+
927 +------------------------------------------------------------------------+
928 | | | | | |
928 | | | | | |
929 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
929 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
930 | (32 bits) | (various) | (32 bits) | (various) | (32 bits) |
930 | (32 bits) | (various) | (32 bits) | (various) | (32 bits) |
931 | | | | | |
931 | | | | | |
932 +------------------------------------------------------------+-----------+
932 +------------------------------------------------------------+-----------+
933
933
934 Each *chunk*'s data consists of the following:
934 Each *chunk*'s data consists of the following:
935
935
936 +-----------------------------------------+
936 +-----------------------------------------+
937 | | | |
937 | | | |
938 | delta header | mdiff header | delta |
938 | delta header | mdiff header | delta |
939 | (various) | (12 bytes) | (various) |
939 | (various) | (12 bytes) | (various) |
940 | | | |
940 | | | |
941 +-----------------------------------------+
941 +-----------------------------------------+
942
942
943 The *length* field is the byte length of the remaining 3 logical pieces of
943 The *length* field is the byte length of the remaining 3 logical pieces of
944 data. The *delta* is a diff from an existing entry in the changelog.
944 data. The *delta* is a diff from an existing entry in the changelog.
945
945
946 The *delta header* is different between versions "1", "2", and "3" of the
946 The *delta header* is different between versions "1", "2", and "3" of the
947 changegroup format.
947 changegroup format.
948
948
949 Version 1:
949 Version 1:
950
950
951 +------------------------------------------------------+
951 +------------------------------------------------------+
952 | | | | |
952 | | | | |
953 | node | p1 node | p2 node | link node |
953 | node | p1 node | p2 node | link node |
954 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
954 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
955 | | | | |
955 | | | | |
956 +------------------------------------------------------+
956 +------------------------------------------------------+
957
957
958 Version 2:
958 Version 2:
959
959
960 +------------------------------------------------------------------+
960 +------------------------------------------------------------------+
961 | | | | | |
961 | | | | | |
962 | node | p1 node | p2 node | base node | link node |
962 | node | p1 node | p2 node | base node | link node |
963 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
963 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
964 | | | | | |
964 | | | | | |
965 +------------------------------------------------------------------+
965 +------------------------------------------------------------------+
966
966
967 Version 3:
967 Version 3:
968
968
969 +------------------------------------------------------------------------------+
969 +------------------------------------------------------------------------------+
970 | | | | | | |
970 | | | | | | |
971 | node | p1 node | p2 node | base node | link node | flags |
971 | node | p1 node | p2 node | base node | link node | flags |
972 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
972 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
973 | | | | | | |
973 | | | | | | |
974 +------------------------------------------------------------------------------+
974 +------------------------------------------------------------------------------+
975
975
976 The *mdiff header* consists of 3 32-bit big-endian signed integers
976 The *mdiff header* consists of 3 32-bit big-endian signed integers
977 describing offsets at which to apply the following delta content:
977 describing offsets at which to apply the following delta content:
978
978
979 +-------------------------------------+
979 +-------------------------------------+
980 | | | |
980 | | | |
981 | offset | old length | new length |
981 | offset | old length | new length |
982 | (32 bits) | (32 bits) | (32 bits) |
982 | (32 bits) | (32 bits) | (32 bits) |
983 | | | |
983 | | | |
984 +-------------------------------------+
984 +-------------------------------------+
985
985
986 In version 1, the delta is always applied against the previous node from
986 In version 1, the delta is always applied against the previous node from
987 the changegroup or the first parent if this is the first entry in the
987 the changegroup or the first parent if this is the first entry in the
988 changegroup.
988 changegroup.
989
989
990 In version 2, the delta base node is encoded in the entry in the
990 In version 2, the delta base node is encoded in the entry in the
991 changegroup. This allows the delta to be expressed against any parent,
991 changegroup. This allows the delta to be expressed against any parent,
992 which can result in smaller deltas and more efficient encoding of data.
992 which can result in smaller deltas and more efficient encoding of data.
993
993
994 Changeset Segment
994 Changeset Segment
995 -----------------
995 -----------------
996
996
997 The *changeset segment* consists of a single *delta group* holding
997 The *changeset segment* consists of a single *delta group* holding
998 changelog data. It is followed by an *empty chunk* to denote the boundary
998 changelog data. It is followed by an *empty chunk* to denote the boundary
999 to the *manifests segment*.
999 to the *manifests segment*.
1000
1000
1001 Manifest Segment
1001 Manifest Segment
1002 ----------------
1002 ----------------
1003
1003
1004 The *manifest segment* consists of a single *delta group* holding manifest
1004 The *manifest segment* consists of a single *delta group* holding manifest
1005 data. It is followed by an *empty chunk* to denote the boundary to the
1005 data. It is followed by an *empty chunk* to denote the boundary to the
1006 *filelogs segment*.
1006 *filelogs segment*.
1007
1007
1008 Filelogs Segment
1008 Filelogs Segment
1009 ----------------
1009 ----------------
1010
1010
1011 The *filelogs* segment consists of multiple sub-segments, each
1011 The *filelogs* segment consists of multiple sub-segments, each
1012 corresponding to an individual file whose data is being described:
1012 corresponding to an individual file whose data is being described:
1013
1013
1014 +--------------------------------------+
1014 +--------------------------------------+
1015 | | | | |
1015 | | | | |
1016 | filelog0 | filelog1 | filelog2 | ... |
1016 | filelog0 | filelog1 | filelog2 | ... |
1017 | | | | |
1017 | | | | |
1018 +--------------------------------------+
1018 +--------------------------------------+
1019
1019
1020 In version "3" of the changegroup format, filelogs may include directory
1020 In version "3" of the changegroup format, filelogs may include directory
1021 logs when treemanifests are in use. directory logs are identified by
1021 logs when treemanifests are in use. directory logs are identified by
1022 having a trailing '/' on their filename (see below).
1022 having a trailing '/' on their filename (see below).
1023
1023
1024 The final filelog sub-segment is followed by an *empty chunk* to denote
1024 The final filelog sub-segment is followed by an *empty chunk* to denote
1025 the end of the segment and the overall changegroup.
1025 the end of the segment and the overall changegroup.
1026
1026
1027 Each filelog sub-segment consists of the following:
1027 Each filelog sub-segment consists of the following:
1028
1028
1029 +------------------------------------------+
1029 +------------------------------------------+
1030 | | | |
1030 | | | |
1031 | filename size | filename | delta group |
1031 | filename size | filename | delta group |
1032 | (32 bits) | (various) | (various) |
1032 | (32 bits) | (various) | (various) |
1033 | | | |
1033 | | | |
1034 +------------------------------------------+
1034 +------------------------------------------+
1035
1035
1036 That is, a *chunk* consisting of the filename (not terminated or padded)
1036 That is, a *chunk* consisting of the filename (not terminated or padded)
1037 followed by N chunks constituting the *delta group* for this file.
1037 followed by N chunks constituting the *delta group* for this file.
1038
1038
1039 Test list of commands with command with no help text
1039 Test list of commands with command with no help text
1040
1040
1041 $ hg help helpext
1041 $ hg help helpext
1042 helpext extension - no help text available
1042 helpext extension - no help text available
1043
1043
1044 list of commands:
1044 list of commands:
1045
1045
1046 nohelp (no help text available)
1046 nohelp (no help text available)
1047
1047
1048 (use "hg help -v helpext" to show built-in aliases and global options)
1048 (use "hg help -v helpext" to show built-in aliases and global options)
1049
1049
1050
1050
1051 test deprecated and experimental options are hidden in command help
1051 test deprecated and experimental options are hidden in command help
1052 $ hg help debugoptDEP
1052 $ hg help debugoptDEP
1053 hg debugoptDEP
1053 hg debugoptDEP
1054
1054
1055 (no help text available)
1055 (no help text available)
1056
1056
1057 options:
1057 options:
1058
1058
1059 (some details hidden, use --verbose to show complete help)
1059 (some details hidden, use --verbose to show complete help)
1060
1060
1061 $ hg help debugoptEXP
1061 $ hg help debugoptEXP
1062 hg debugoptEXP
1062 hg debugoptEXP
1063
1063
1064 (no help text available)
1064 (no help text available)
1065
1065
1066 options:
1066 options:
1067
1067
1068 (some details hidden, use --verbose to show complete help)
1068 (some details hidden, use --verbose to show complete help)
1069
1069
1070 test deprecated and experimental options is shown with -v
1070 test deprecated and experimental options is shown with -v
1071 $ hg help -v debugoptDEP | grep dopt
1071 $ hg help -v debugoptDEP | grep dopt
1072 --dopt option is (DEPRECATED)
1072 --dopt option is (DEPRECATED)
1073 $ hg help -v debugoptEXP | grep eopt
1073 $ hg help -v debugoptEXP | grep eopt
1074 --eopt option is (EXPERIMENTAL)
1074 --eopt option is (EXPERIMENTAL)
1075
1075
1076 #if gettext
1076 #if gettext
1077 test deprecated option is hidden with translation with untranslated description
1077 test deprecated option is hidden with translation with untranslated description
1078 (use many globy for not failing on changed transaction)
1078 (use many globy for not failing on changed transaction)
1079 $ LANGUAGE=sv hg help debugoptDEP
1079 $ LANGUAGE=sv hg help debugoptDEP
1080 hg debugoptDEP
1080 hg debugoptDEP
1081
1081
1082 (*) (glob)
1082 (*) (glob)
1083
1083
1084 options:
1084 options:
1085
1085
1086 (some details hidden, use --verbose to show complete help)
1086 (some details hidden, use --verbose to show complete help)
1087 #endif
1087 #endif
1088
1088
1089 Test commands that collide with topics (issue4240)
1089 Test commands that collide with topics (issue4240)
1090
1090
1091 $ hg config -hq
1091 $ hg config -hq
1092 hg config [-u] [NAME]...
1092 hg config [-u] [NAME]...
1093
1093
1094 show combined config settings from all hgrc files
1094 show combined config settings from all hgrc files
1095 $ hg showconfig -hq
1095 $ hg showconfig -hq
1096 hg config [-u] [NAME]...
1096 hg config [-u] [NAME]...
1097
1097
1098 show combined config settings from all hgrc files
1098 show combined config settings from all hgrc files
1099
1099
1100 Test a help topic
1100 Test a help topic
1101
1101
1102 $ hg help revs
1102 $ hg help revs
1103 Specifying Single Revisions
1103 Specifying Single Revisions
1104 """""""""""""""""""""""""""
1104 """""""""""""""""""""""""""
1105
1105
1106 Mercurial supports several ways to specify individual revisions.
1106 Mercurial supports several ways to specify individual revisions.
1107
1107
1108 A plain integer is treated as a revision number. Negative integers are
1108 A plain integer is treated as a revision number. Negative integers are
1109 treated as sequential offsets from the tip, with -1 denoting the tip, -2
1109 treated as sequential offsets from the tip, with -1 denoting the tip, -2
1110 denoting the revision prior to the tip, and so forth.
1110 denoting the revision prior to the tip, and so forth.
1111
1111
1112 A 40-digit hexadecimal string is treated as a unique revision identifier.
1112 A 40-digit hexadecimal string is treated as a unique revision identifier.
1113
1113
1114 A hexadecimal string less than 40 characters long is treated as a unique
1114 A hexadecimal string less than 40 characters long is treated as a unique
1115 revision identifier and is referred to as a short-form identifier. A
1115 revision identifier and is referred to as a short-form identifier. A
1116 short-form identifier is only valid if it is the prefix of exactly one
1116 short-form identifier is only valid if it is the prefix of exactly one
1117 full-length identifier.
1117 full-length identifier.
1118
1118
1119 Any other string is treated as a bookmark, tag, or branch name. A bookmark
1119 Any other string is treated as a bookmark, tag, or branch name. A bookmark
1120 is a movable pointer to a revision. A tag is a permanent name associated
1120 is a movable pointer to a revision. A tag is a permanent name associated
1121 with a revision. A branch name denotes the tipmost open branch head of
1121 with a revision. A branch name denotes the tipmost open branch head of
1122 that branch - or if they are all closed, the tipmost closed head of the
1122 that branch - or if they are all closed, the tipmost closed head of the
1123 branch. Bookmark, tag, and branch names must not contain the ":"
1123 branch. Bookmark, tag, and branch names must not contain the ":"
1124 character.
1124 character.
1125
1125
1126 The reserved name "tip" always identifies the most recent revision.
1126 The reserved name "tip" always identifies the most recent revision.
1127
1127
1128 The reserved name "null" indicates the null revision. This is the revision
1128 The reserved name "null" indicates the null revision. This is the revision
1129 of an empty repository, and the parent of revision 0.
1129 of an empty repository, and the parent of revision 0.
1130
1130
1131 The reserved name "." indicates the working directory parent. If no
1131 The reserved name "." indicates the working directory parent. If no
1132 working directory is checked out, it is equivalent to null. If an
1132 working directory is checked out, it is equivalent to null. If an
1133 uncommitted merge is in progress, "." is the revision of the first parent.
1133 uncommitted merge is in progress, "." is the revision of the first parent.
1134
1134
1135 Test repeated config section name
1135 Test repeated config section name
1136
1136
1137 $ hg help config.host
1137 $ hg help config.host
1138 "http_proxy.host"
1138 "http_proxy.host"
1139 Host name and (optional) port of the proxy server, for example
1139 Host name and (optional) port of the proxy server, for example
1140 "myproxy:8000".
1140 "myproxy:8000".
1141
1141
1142 "smtp.host"
1142 "smtp.host"
1143 Host name of mail server, e.g. "mail.example.com".
1143 Host name of mail server, e.g. "mail.example.com".
1144
1144
1145 Unrelated trailing paragraphs shouldn't be included
1145 Unrelated trailing paragraphs shouldn't be included
1146
1146
1147 $ hg help config.extramsg | grep '^$'
1147 $ hg help config.extramsg | grep '^$'
1148
1148
1149
1149
1150 Test capitalized section name
1150 Test capitalized section name
1151
1151
1152 $ hg help scripting.HGPLAIN > /dev/null
1152 $ hg help scripting.HGPLAIN > /dev/null
1153
1153
1154 Help subsection:
1154 Help subsection:
1155
1155
1156 $ hg help config.charsets |grep "Email example:" > /dev/null
1156 $ hg help config.charsets |grep "Email example:" > /dev/null
1157 [1]
1157 [1]
1158
1158
1159 Show nested definitions
1159 Show nested definitions
1160 ("profiling.type"[break]"ls"[break]"stat"[break])
1160 ("profiling.type"[break]"ls"[break]"stat"[break])
1161
1161
1162 $ hg help config.type | egrep '^$'|wc -l
1162 $ hg help config.type | egrep '^$'|wc -l
1163 \s*3 (re)
1163 \s*3 (re)
1164
1164
1165 Separate sections from subsections
1165 Separate sections from subsections
1166
1166
1167 $ hg help config.format | egrep '^ ("|-)|^\s*$' | uniq
1167 $ hg help config.format | egrep '^ ("|-)|^\s*$' | uniq
1168 "format"
1168 "format"
1169 --------
1169 --------
1170
1170
1171 "usegeneraldelta"
1171 "usegeneraldelta"
1172
1172
1173 "dotencode"
1173 "dotencode"
1174
1174
1175 "usefncache"
1175 "usefncache"
1176
1176
1177 "usestore"
1177 "usestore"
1178
1178
1179 "profiling"
1179 "profiling"
1180 -----------
1180 -----------
1181
1181
1182 "format"
1182 "format"
1183
1183
1184 "progress"
1184 "progress"
1185 ----------
1185 ----------
1186
1186
1187 "format"
1187 "format"
1188
1188
1189
1189
1190 Last item in help config.*:
1190 Last item in help config.*:
1191
1191
1192 $ hg help config.`hg help config|grep '^ "'| \
1192 $ hg help config.`hg help config|grep '^ "'| \
1193 > tail -1|sed 's![ "]*!!g'`| \
1193 > tail -1|sed 's![ "]*!!g'`| \
1194 > grep "hg help -c config" > /dev/null
1194 > grep "hg help -c config" > /dev/null
1195 [1]
1195 [1]
1196
1196
1197 note to use help -c for general hg help config:
1197 note to use help -c for general hg help config:
1198
1198
1199 $ hg help config |grep "hg help -c config" > /dev/null
1199 $ hg help config |grep "hg help -c config" > /dev/null
1200
1200
1201 Test templating help
1201 Test templating help
1202
1202
1203 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
1203 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
1204 desc String. The text of the changeset description.
1204 desc String. The text of the changeset description.
1205 diffstat String. Statistics of changes with the following format:
1205 diffstat String. Statistics of changes with the following format:
1206 firstline Any text. Returns the first line of text.
1206 firstline Any text. Returns the first line of text.
1207 nonempty Any text. Returns '(none)' if the string is empty.
1207 nonempty Any text. Returns '(none)' if the string is empty.
1208
1208
1209 Test deprecated items
1209 Test deprecated items
1210
1210
1211 $ hg help -v templating | grep currentbookmark
1211 $ hg help -v templating | grep currentbookmark
1212 currentbookmark
1212 currentbookmark
1213 $ hg help templating | (grep currentbookmark || true)
1213 $ hg help templating | (grep currentbookmark || true)
1214
1214
1215 Test help hooks
1215 Test help hooks
1216
1216
1217 $ cat > helphook1.py <<EOF
1217 $ cat > helphook1.py <<EOF
1218 > from mercurial import help
1218 > from mercurial import help
1219 >
1219 >
1220 > def rewrite(ui, topic, doc):
1220 > def rewrite(ui, topic, doc):
1221 > return doc + '\nhelphook1\n'
1221 > return doc + '\nhelphook1\n'
1222 >
1222 >
1223 > def extsetup(ui):
1223 > def extsetup(ui):
1224 > help.addtopichook('revsets', rewrite)
1224 > help.addtopichook('revsets', rewrite)
1225 > EOF
1225 > EOF
1226 $ cat > helphook2.py <<EOF
1226 $ cat > helphook2.py <<EOF
1227 > from mercurial import help
1227 > from mercurial import help
1228 >
1228 >
1229 > def rewrite(ui, topic, doc):
1229 > def rewrite(ui, topic, doc):
1230 > return doc + '\nhelphook2\n'
1230 > return doc + '\nhelphook2\n'
1231 >
1231 >
1232 > def extsetup(ui):
1232 > def extsetup(ui):
1233 > help.addtopichook('revsets', rewrite)
1233 > help.addtopichook('revsets', rewrite)
1234 > EOF
1234 > EOF
1235 $ echo '[extensions]' >> $HGRCPATH
1235 $ echo '[extensions]' >> $HGRCPATH
1236 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
1236 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
1237 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
1237 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
1238 $ hg help revsets | grep helphook
1238 $ hg help revsets | grep helphook
1239 helphook1
1239 helphook1
1240 helphook2
1240 helphook2
1241
1241
1242 help -c should only show debug --debug
1242 help -c should only show debug --debug
1243
1243
1244 $ hg help -c --debug|egrep debug|wc -l|egrep '^\s*0\s*$'
1244 $ hg help -c --debug|egrep debug|wc -l|egrep '^\s*0\s*$'
1245 [1]
1245 [1]
1246
1246
1247 help -c should only show deprecated for -v
1247 help -c should only show deprecated for -v
1248
1248
1249 $ hg help -c -v|egrep DEPRECATED|wc -l|egrep '^\s*0\s*$'
1249 $ hg help -c -v|egrep DEPRECATED|wc -l|egrep '^\s*0\s*$'
1250 [1]
1250 [1]
1251
1251
1252 Test -e / -c / -k combinations
1252 Test -e / -c / -k combinations
1253
1253
1254 $ hg help -c|egrep '^[A-Z].*:|^ debug'
1254 $ hg help -c|egrep '^[A-Z].*:|^ debug'
1255 Commands:
1255 Commands:
1256 $ hg help -e|egrep '^[A-Z].*:|^ debug'
1256 $ hg help -e|egrep '^[A-Z].*:|^ debug'
1257 Extensions:
1257 Extensions:
1258 $ hg help -k|egrep '^[A-Z].*:|^ debug'
1258 $ hg help -k|egrep '^[A-Z].*:|^ debug'
1259 Topics:
1259 Topics:
1260 Commands:
1260 Commands:
1261 Extensions:
1261 Extensions:
1262 Extension Commands:
1262 Extension Commands:
1263 $ hg help -c schemes
1263 $ hg help -c schemes
1264 abort: no such help topic: schemes
1264 abort: no such help topic: schemes
1265 (try "hg help --keyword schemes")
1265 (try "hg help --keyword schemes")
1266 [255]
1266 [255]
1267 $ hg help -e schemes |head -1
1267 $ hg help -e schemes |head -1
1268 schemes extension - extend schemes with shortcuts to repository swarms
1268 schemes extension - extend schemes with shortcuts to repository swarms
1269 $ hg help -c -k dates |egrep '^(Topics|Extensions|Commands):'
1269 $ hg help -c -k dates |egrep '^(Topics|Extensions|Commands):'
1270 Commands:
1270 Commands:
1271 $ hg help -e -k a |egrep '^(Topics|Extensions|Commands):'
1271 $ hg help -e -k a |egrep '^(Topics|Extensions|Commands):'
1272 Extensions:
1272 Extensions:
1273 $ hg help -e -c -k date |egrep '^(Topics|Extensions|Commands):'
1273 $ hg help -e -c -k date |egrep '^(Topics|Extensions|Commands):'
1274 Extensions:
1274 Extensions:
1275 Commands:
1275 Commands:
1276 $ hg help -c commit > /dev/null
1276 $ hg help -c commit > /dev/null
1277 $ hg help -e -c commit > /dev/null
1277 $ hg help -e -c commit > /dev/null
1278 $ hg help -e commit > /dev/null
1278 $ hg help -e commit > /dev/null
1279 abort: no such help topic: commit
1279 abort: no such help topic: commit
1280 (try "hg help --keyword commit")
1280 (try "hg help --keyword commit")
1281 [255]
1281 [255]
1282
1282
1283 Test keyword search help
1283 Test keyword search help
1284
1284
1285 $ cat > prefixedname.py <<EOF
1285 $ cat > prefixedname.py <<EOF
1286 > '''matched against word "clone"
1286 > '''matched against word "clone"
1287 > '''
1287 > '''
1288 > EOF
1288 > EOF
1289 $ echo '[extensions]' >> $HGRCPATH
1289 $ echo '[extensions]' >> $HGRCPATH
1290 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
1290 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
1291 $ hg help -k clone
1291 $ hg help -k clone
1292 Topics:
1292 Topics:
1293
1293
1294 config Configuration Files
1294 config Configuration Files
1295 extensions Using Additional Features
1295 extensions Using Additional Features
1296 glossary Glossary
1296 glossary Glossary
1297 phases Working with Phases
1297 phases Working with Phases
1298 subrepos Subrepositories
1298 subrepos Subrepositories
1299 urls URL Paths
1299 urls URL Paths
1300
1300
1301 Commands:
1301 Commands:
1302
1302
1303 bookmarks create a new bookmark or list existing bookmarks
1303 bookmarks create a new bookmark or list existing bookmarks
1304 clone make a copy of an existing repository
1304 clone make a copy of an existing repository
1305 paths show aliases for remote repositories
1305 paths show aliases for remote repositories
1306 update update working directory (or switch revisions)
1306 update update working directory (or switch revisions)
1307
1307
1308 Extensions:
1308 Extensions:
1309
1309
1310 clonebundles advertise pre-generated bundles to seed clones (experimental)
1310 clonebundles advertise pre-generated bundles to seed clones (experimental)
1311 prefixedname matched against word "clone"
1311 prefixedname matched against word "clone"
1312 relink recreates hardlinks between repository clones
1312 relink recreates hardlinks between repository clones
1313
1313
1314 Extension Commands:
1314 Extension Commands:
1315
1315
1316 qclone clone main and patch repository at same time
1316 qclone clone main and patch repository at same time
1317
1317
1318 Test unfound topic
1318 Test unfound topic
1319
1319
1320 $ hg help nonexistingtopicthatwillneverexisteverever
1320 $ hg help nonexistingtopicthatwillneverexisteverever
1321 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
1321 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
1322 (try "hg help --keyword nonexistingtopicthatwillneverexisteverever")
1322 (try "hg help --keyword nonexistingtopicthatwillneverexisteverever")
1323 [255]
1323 [255]
1324
1324
1325 Test unfound keyword
1325 Test unfound keyword
1326
1326
1327 $ hg help --keyword nonexistingwordthatwillneverexisteverever
1327 $ hg help --keyword nonexistingwordthatwillneverexisteverever
1328 abort: no matches
1328 abort: no matches
1329 (try "hg help" for a list of topics)
1329 (try "hg help" for a list of topics)
1330 [255]
1330 [255]
1331
1331
1332 Test omit indicating for help
1332 Test omit indicating for help
1333
1333
1334 $ cat > addverboseitems.py <<EOF
1334 $ cat > addverboseitems.py <<EOF
1335 > '''extension to test omit indicating.
1335 > '''extension to test omit indicating.
1336 >
1336 >
1337 > This paragraph is never omitted (for extension)
1337 > This paragraph is never omitted (for extension)
1338 >
1338 >
1339 > .. container:: verbose
1339 > .. container:: verbose
1340 >
1340 >
1341 > This paragraph is omitted,
1341 > This paragraph is omitted,
1342 > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension)
1342 > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension)
1343 >
1343 >
1344 > This paragraph is never omitted, too (for extension)
1344 > This paragraph is never omitted, too (for extension)
1345 > '''
1345 > '''
1346 >
1346 >
1347 > from mercurial import help, commands
1347 > from mercurial import help, commands
1348 > testtopic = """This paragraph is never omitted (for topic).
1348 > testtopic = """This paragraph is never omitted (for topic).
1349 >
1349 >
1350 > .. container:: verbose
1350 > .. container:: verbose
1351 >
1351 >
1352 > This paragraph is omitted,
1352 > This paragraph is omitted,
1353 > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic)
1353 > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic)
1354 >
1354 >
1355 > This paragraph is never omitted, too (for topic)
1355 > This paragraph is never omitted, too (for topic)
1356 > """
1356 > """
1357 > def extsetup(ui):
1357 > def extsetup(ui):
1358 > help.helptable.append((["topic-containing-verbose"],
1358 > help.helptable.append((["topic-containing-verbose"],
1359 > "This is the topic to test omit indicating.",
1359 > "This is the topic to test omit indicating.",
1360 > lambda ui: testtopic))
1360 > lambda ui: testtopic))
1361 > EOF
1361 > EOF
1362 $ echo '[extensions]' >> $HGRCPATH
1362 $ echo '[extensions]' >> $HGRCPATH
1363 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1363 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1364 $ hg help addverboseitems
1364 $ hg help addverboseitems
1365 addverboseitems extension - extension to test omit indicating.
1365 addverboseitems extension - extension to test omit indicating.
1366
1366
1367 This paragraph is never omitted (for extension)
1367 This paragraph is never omitted (for extension)
1368
1368
1369 This paragraph is never omitted, too (for extension)
1369 This paragraph is never omitted, too (for extension)
1370
1370
1371 (some details hidden, use --verbose to show complete help)
1371 (some details hidden, use --verbose to show complete help)
1372
1372
1373 no commands defined
1373 no commands defined
1374 $ hg help -v addverboseitems
1374 $ hg help -v addverboseitems
1375 addverboseitems extension - extension to test omit indicating.
1375 addverboseitems extension - extension to test omit indicating.
1376
1376
1377 This paragraph is never omitted (for extension)
1377 This paragraph is never omitted (for extension)
1378
1378
1379 This paragraph is omitted, if "hg help" is invoked without "-v" (for
1379 This paragraph is omitted, if "hg help" is invoked without "-v" (for
1380 extension)
1380 extension)
1381
1381
1382 This paragraph is never omitted, too (for extension)
1382 This paragraph is never omitted, too (for extension)
1383
1383
1384 no commands defined
1384 no commands defined
1385 $ hg help topic-containing-verbose
1385 $ hg help topic-containing-verbose
1386 This is the topic to test omit indicating.
1386 This is the topic to test omit indicating.
1387 """"""""""""""""""""""""""""""""""""""""""
1387 """"""""""""""""""""""""""""""""""""""""""
1388
1388
1389 This paragraph is never omitted (for topic).
1389 This paragraph is never omitted (for topic).
1390
1390
1391 This paragraph is never omitted, too (for topic)
1391 This paragraph is never omitted, too (for topic)
1392
1392
1393 (some details hidden, use --verbose to show complete help)
1393 (some details hidden, use --verbose to show complete help)
1394 $ hg help -v topic-containing-verbose
1394 $ hg help -v topic-containing-verbose
1395 This is the topic to test omit indicating.
1395 This is the topic to test omit indicating.
1396 """"""""""""""""""""""""""""""""""""""""""
1396 """"""""""""""""""""""""""""""""""""""""""
1397
1397
1398 This paragraph is never omitted (for topic).
1398 This paragraph is never omitted (for topic).
1399
1399
1400 This paragraph is omitted, if "hg help" is invoked without "-v" (for
1400 This paragraph is omitted, if "hg help" is invoked without "-v" (for
1401 topic)
1401 topic)
1402
1402
1403 This paragraph is never omitted, too (for topic)
1403 This paragraph is never omitted, too (for topic)
1404
1404
1405 Test section lookup
1405 Test section lookup
1406
1406
1407 $ hg help revset.merge
1407 $ hg help revset.merge
1408 "merge()"
1408 "merge()"
1409 Changeset is a merge changeset.
1409 Changeset is a merge changeset.
1410
1410
1411 $ hg help glossary.dag
1411 $ hg help glossary.dag
1412 DAG
1412 DAG
1413 The repository of changesets of a distributed version control system
1413 The repository of changesets of a distributed version control system
1414 (DVCS) can be described as a directed acyclic graph (DAG), consisting
1414 (DVCS) can be described as a directed acyclic graph (DAG), consisting
1415 of nodes and edges, where nodes correspond to changesets and edges
1415 of nodes and edges, where nodes correspond to changesets and edges
1416 imply a parent -> child relation. This graph can be visualized by
1416 imply a parent -> child relation. This graph can be visualized by
1417 graphical tools such as "hg log --graph". In Mercurial, the DAG is
1417 graphical tools such as "hg log --graph". In Mercurial, the DAG is
1418 limited by the requirement for children to have at most two parents.
1418 limited by the requirement for children to have at most two parents.
1419
1419
1420
1420
1421 $ hg help hgrc.paths
1421 $ hg help hgrc.paths
1422 "paths"
1422 "paths"
1423 -------
1423 -------
1424
1424
1425 Assigns symbolic names and behavior to repositories.
1425 Assigns symbolic names and behavior to repositories.
1426
1426
1427 Options are symbolic names defining the URL or directory that is the
1427 Options are symbolic names defining the URL or directory that is the
1428 location of the repository. Example:
1428 location of the repository. Example:
1429
1429
1430 [paths]
1430 [paths]
1431 my_server = https://example.com/my_repo
1431 my_server = https://example.com/my_repo
1432 local_path = /home/me/repo
1432 local_path = /home/me/repo
1433
1433
1434 These symbolic names can be used from the command line. To pull from
1434 These symbolic names can be used from the command line. To pull from
1435 "my_server": "hg pull my_server". To push to "local_path": "hg push
1435 "my_server": "hg pull my_server". To push to "local_path": "hg push
1436 local_path".
1436 local_path".
1437
1437
1438 Options containing colons (":") denote sub-options that can influence
1438 Options containing colons (":") denote sub-options that can influence
1439 behavior for that specific path. Example:
1439 behavior for that specific path. Example:
1440
1440
1441 [paths]
1441 [paths]
1442 my_server = https://example.com/my_path
1442 my_server = https://example.com/my_path
1443 my_server:pushurl = ssh://example.com/my_path
1443 my_server:pushurl = ssh://example.com/my_path
1444
1444
1445 The following sub-options can be defined:
1445 The following sub-options can be defined:
1446
1446
1447 "pushurl"
1447 "pushurl"
1448 The URL to use for push operations. If not defined, the location
1448 The URL to use for push operations. If not defined, the location
1449 defined by the path's main entry is used.
1449 defined by the path's main entry is used.
1450
1450
1451 The following special named paths exist:
1451 The following special named paths exist:
1452
1452
1453 "default"
1453 "default"
1454 The URL or directory to use when no source or remote is specified.
1454 The URL or directory to use when no source or remote is specified.
1455
1455
1456 "hg clone" will automatically define this path to the location the
1456 "hg clone" will automatically define this path to the location the
1457 repository was cloned from.
1457 repository was cloned from.
1458
1458
1459 "default-push"
1459 "default-push"
1460 (deprecated) The URL or directory for the default "hg push" location.
1460 (deprecated) The URL or directory for the default "hg push" location.
1461 "default:pushurl" should be used instead.
1461 "default:pushurl" should be used instead.
1462
1462
1463 $ hg help glossary.mcguffin
1463 $ hg help glossary.mcguffin
1464 abort: help section not found
1464 abort: help section not found
1465 [255]
1465 [255]
1466
1466
1467 $ hg help glossary.mc.guffin
1467 $ hg help glossary.mc.guffin
1468 abort: help section not found
1468 abort: help section not found
1469 [255]
1469 [255]
1470
1470
1471 $ hg help template.files
1471 $ hg help template.files
1472 files List of strings. All files modified, added, or removed by
1472 files List of strings. All files modified, added, or removed by
1473 this changeset.
1473 this changeset.
1474
1474
1475 Test dynamic list of merge tools only shows up once
1475 Test dynamic list of merge tools only shows up once
1476 $ hg help merge-tools
1476 $ hg help merge-tools
1477 Merge Tools
1477 Merge Tools
1478 """""""""""
1478 """""""""""
1479
1479
1480 To merge files Mercurial uses merge tools.
1480 To merge files Mercurial uses merge tools.
1481
1481
1482 A merge tool combines two different versions of a file into a merged file.
1482 A merge tool combines two different versions of a file into a merged file.
1483 Merge tools are given the two files and the greatest common ancestor of
1483 Merge tools are given the two files and the greatest common ancestor of
1484 the two file versions, so they can determine the changes made on both
1484 the two file versions, so they can determine the changes made on both
1485 branches.
1485 branches.
1486
1486
1487 Merge tools are used both for "hg resolve", "hg merge", "hg update", "hg
1487 Merge tools are used both for "hg resolve", "hg merge", "hg update", "hg
1488 backout" and in several extensions.
1488 backout" and in several extensions.
1489
1489
1490 Usually, the merge tool tries to automatically reconcile the files by
1490 Usually, the merge tool tries to automatically reconcile the files by
1491 combining all non-overlapping changes that occurred separately in the two
1491 combining all non-overlapping changes that occurred separately in the two
1492 different evolutions of the same initial base file. Furthermore, some
1492 different evolutions of the same initial base file. Furthermore, some
1493 interactive merge programs make it easier to manually resolve conflicting
1493 interactive merge programs make it easier to manually resolve conflicting
1494 merges, either in a graphical way, or by inserting some conflict markers.
1494 merges, either in a graphical way, or by inserting some conflict markers.
1495 Mercurial does not include any interactive merge programs but relies on
1495 Mercurial does not include any interactive merge programs but relies on
1496 external tools for that.
1496 external tools for that.
1497
1497
1498 Available merge tools
1498 Available merge tools
1499 =====================
1499 =====================
1500
1500
1501 External merge tools and their properties are configured in the merge-
1501 External merge tools and their properties are configured in the merge-
1502 tools configuration section - see hgrc(5) - but they can often just be
1502 tools configuration section - see hgrc(5) - but they can often just be
1503 named by their executable.
1503 named by their executable.
1504
1504
1505 A merge tool is generally usable if its executable can be found on the
1505 A merge tool is generally usable if its executable can be found on the
1506 system and if it can handle the merge. The executable is found if it is an
1506 system and if it can handle the merge. The executable is found if it is an
1507 absolute or relative executable path or the name of an application in the
1507 absolute or relative executable path or the name of an application in the
1508 executable search path. The tool is assumed to be able to handle the merge
1508 executable search path. The tool is assumed to be able to handle the merge
1509 if it can handle symlinks if the file is a symlink, if it can handle
1509 if it can handle symlinks if the file is a symlink, if it can handle
1510 binary files if the file is binary, and if a GUI is available if the tool
1510 binary files if the file is binary, and if a GUI is available if the tool
1511 requires a GUI.
1511 requires a GUI.
1512
1512
1513 There are some internal merge tools which can be used. The internal merge
1513 There are some internal merge tools which can be used. The internal merge
1514 tools are:
1514 tools are:
1515
1515
1516 ":dump"
1516 ":dump"
1517 Creates three versions of the files to merge, containing the contents of
1517 Creates three versions of the files to merge, containing the contents of
1518 local, other and base. These files can then be used to perform a merge
1518 local, other and base. These files can then be used to perform a merge
1519 manually. If the file to be merged is named "a.txt", these files will
1519 manually. If the file to be merged is named "a.txt", these files will
1520 accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and
1520 accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and
1521 they will be placed in the same directory as "a.txt".
1521 they will be placed in the same directory as "a.txt".
1522
1522
1523 ":fail"
1523 ":fail"
1524 Rather than attempting to merge files that were modified on both
1524 Rather than attempting to merge files that were modified on both
1525 branches, it marks them as unresolved. The resolve command must be used
1525 branches, it marks them as unresolved. The resolve command must be used
1526 to resolve these conflicts.
1526 to resolve these conflicts.
1527
1527
1528 ":local"
1528 ":local"
1529 Uses the local version of files as the merged version.
1529 Uses the local version of files as the merged version.
1530
1530
1531 ":merge"
1531 ":merge"
1532 Uses the internal non-interactive simple merge algorithm for merging
1532 Uses the internal non-interactive simple merge algorithm for merging
1533 files. It will fail if there are any conflicts and leave markers in the
1533 files. It will fail if there are any conflicts and leave markers in the
1534 partially merged file. Markers will have two sections, one for each side
1534 partially merged file. Markers will have two sections, one for each side
1535 of merge.
1535 of merge.
1536
1536
1537 ":merge-local"
1537 ":merge-local"
1538 Like :merge, but resolve all conflicts non-interactively in favor of the
1538 Like :merge, but resolve all conflicts non-interactively in favor of the
1539 local changes.
1539 local changes.
1540
1540
1541 ":merge-other"
1541 ":merge-other"
1542 Like :merge, but resolve all conflicts non-interactively in favor of the
1542 Like :merge, but resolve all conflicts non-interactively in favor of the
1543 other changes.
1543 other changes.
1544
1544
1545 ":merge3"
1545 ":merge3"
1546 Uses the internal non-interactive simple merge algorithm for merging
1546 Uses the internal non-interactive simple merge algorithm for merging
1547 files. It will fail if there are any conflicts and leave markers in the
1547 files. It will fail if there are any conflicts and leave markers in the
1548 partially merged file. Marker will have three sections, one from each
1548 partially merged file. Marker will have three sections, one from each
1549 side of the merge and one for the base content.
1549 side of the merge and one for the base content.
1550
1550
1551 ":other"
1551 ":other"
1552 Uses the other version of files as the merged version.
1552 Uses the other version of files as the merged version.
1553
1553
1554 ":prompt"
1554 ":prompt"
1555 Asks the user which of the local or the other version to keep as the
1555 Asks the user which of the local or the other version to keep as the
1556 merged version.
1556 merged version.
1557
1557
1558 ":tagmerge"
1558 ":tagmerge"
1559 Uses the internal tag merge algorithm (experimental).
1559 Uses the internal tag merge algorithm (experimental).
1560
1560
1561 ":union"
1561 ":union"
1562 Uses the internal non-interactive simple merge algorithm for merging
1562 Uses the internal non-interactive simple merge algorithm for merging
1563 files. It will use both left and right sides for conflict regions. No
1563 files. It will use both left and right sides for conflict regions. No
1564 markers are inserted.
1564 markers are inserted.
1565
1565
1566 Internal tools are always available and do not require a GUI but will by
1566 Internal tools are always available and do not require a GUI but will by
1567 default not handle symlinks or binary files.
1567 default not handle symlinks or binary files.
1568
1568
1569 Choosing a merge tool
1569 Choosing a merge tool
1570 =====================
1570 =====================
1571
1571
1572 Mercurial uses these rules when deciding which merge tool to use:
1572 Mercurial uses these rules when deciding which merge tool to use:
1573
1573
1574 1. If a tool has been specified with the --tool option to merge or
1574 1. If a tool has been specified with the --tool option to merge or
1575 resolve, it is used. If it is the name of a tool in the merge-tools
1575 resolve, it is used. If it is the name of a tool in the merge-tools
1576 configuration, its configuration is used. Otherwise the specified tool
1576 configuration, its configuration is used. Otherwise the specified tool
1577 must be executable by the shell.
1577 must be executable by the shell.
1578 2. If the "HGMERGE" environment variable is present, its value is used and
1578 2. If the "HGMERGE" environment variable is present, its value is used and
1579 must be executable by the shell.
1579 must be executable by the shell.
1580 3. If the filename of the file to be merged matches any of the patterns in
1580 3. If the filename of the file to be merged matches any of the patterns in
1581 the merge-patterns configuration section, the first usable merge tool
1581 the merge-patterns configuration section, the first usable merge tool
1582 corresponding to a matching pattern is used. Here, binary capabilities
1582 corresponding to a matching pattern is used. Here, binary capabilities
1583 of the merge tool are not considered.
1583 of the merge tool are not considered.
1584 4. If ui.merge is set it will be considered next. If the value is not the
1584 4. If ui.merge is set it will be considered next. If the value is not the
1585 name of a configured tool, the specified value is used and must be
1585 name of a configured tool, the specified value is used and must be
1586 executable by the shell. Otherwise the named tool is used if it is
1586 executable by the shell. Otherwise the named tool is used if it is
1587 usable.
1587 usable.
1588 5. If any usable merge tools are present in the merge-tools configuration
1588 5. If any usable merge tools are present in the merge-tools configuration
1589 section, the one with the highest priority is used.
1589 section, the one with the highest priority is used.
1590 6. If a program named "hgmerge" can be found on the system, it is used -
1590 6. If a program named "hgmerge" can be found on the system, it is used -
1591 but it will by default not be used for symlinks and binary files.
1591 but it will by default not be used for symlinks and binary files.
1592 7. If the file to be merged is not binary and is not a symlink, then
1592 7. If the file to be merged is not binary and is not a symlink, then
1593 internal ":merge" is used.
1593 internal ":merge" is used.
1594 8. The merge of the file fails and must be resolved before commit.
1594 8. The merge of the file fails and must be resolved before commit.
1595
1595
1596 Note:
1596 Note:
1597 After selecting a merge program, Mercurial will by default attempt to
1597 After selecting a merge program, Mercurial will by default attempt to
1598 merge the files using a simple merge algorithm first. Only if it
1598 merge the files using a simple merge algorithm first. Only if it
1599 doesn't succeed because of conflicting changes Mercurial will actually
1599 doesn't succeed because of conflicting changes Mercurial will actually
1600 execute the merge program. Whether to use the simple merge algorithm
1600 execute the merge program. Whether to use the simple merge algorithm
1601 first can be controlled by the premerge setting of the merge tool.
1601 first can be controlled by the premerge setting of the merge tool.
1602 Premerge is enabled by default unless the file is binary or a symlink.
1602 Premerge is enabled by default unless the file is binary or a symlink.
1603
1603
1604 See the merge-tools and ui sections of hgrc(5) for details on the
1604 See the merge-tools and ui sections of hgrc(5) for details on the
1605 configuration of merge tools.
1605 configuration of merge tools.
1606
1606
1607 Test usage of section marks in help documents
1607 Test usage of section marks in help documents
1608
1608
1609 $ cd "$TESTDIR"/../doc
1609 $ cd "$TESTDIR"/../doc
1610 $ python check-seclevel.py
1610 $ python check-seclevel.py
1611 $ cd $TESTTMP
1611 $ cd $TESTTMP
1612
1612
1613 #if serve
1613 #if serve
1614
1614
1615 Test the help pages in hgweb.
1615 Test the help pages in hgweb.
1616
1616
1617 Dish up an empty repo; serve it cold.
1617 Dish up an empty repo; serve it cold.
1618
1618
1619 $ hg init "$TESTTMP/test"
1619 $ hg init "$TESTTMP/test"
1620 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
1620 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
1621 $ cat hg.pid >> $DAEMON_PIDS
1621 $ cat hg.pid >> $DAEMON_PIDS
1622
1622
1623 $ get-with-headers.py 127.0.0.1:$HGPORT "help"
1623 $ get-with-headers.py 127.0.0.1:$HGPORT "help"
1624 200 Script output follows
1624 200 Script output follows
1625
1625
1626 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1626 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1627 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1627 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1628 <head>
1628 <head>
1629 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1629 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1630 <meta name="robots" content="index, nofollow" />
1630 <meta name="robots" content="index, nofollow" />
1631 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1631 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1632 <script type="text/javascript" src="/static/mercurial.js"></script>
1632 <script type="text/javascript" src="/static/mercurial.js"></script>
1633
1633
1634 <title>Help: Index</title>
1634 <title>Help: Index</title>
1635 </head>
1635 </head>
1636 <body>
1636 <body>
1637
1637
1638 <div class="container">
1638 <div class="container">
1639 <div class="menu">
1639 <div class="menu">
1640 <div class="logo">
1640 <div class="logo">
1641 <a href="https://mercurial-scm.org/">
1641 <a href="https://mercurial-scm.org/">
1642 <img src="/static/hglogo.png" alt="mercurial" /></a>
1642 <img src="/static/hglogo.png" alt="mercurial" /></a>
1643 </div>
1643 </div>
1644 <ul>
1644 <ul>
1645 <li><a href="/shortlog">log</a></li>
1645 <li><a href="/shortlog">log</a></li>
1646 <li><a href="/graph">graph</a></li>
1646 <li><a href="/graph">graph</a></li>
1647 <li><a href="/tags">tags</a></li>
1647 <li><a href="/tags">tags</a></li>
1648 <li><a href="/bookmarks">bookmarks</a></li>
1648 <li><a href="/bookmarks">bookmarks</a></li>
1649 <li><a href="/branches">branches</a></li>
1649 <li><a href="/branches">branches</a></li>
1650 </ul>
1650 </ul>
1651 <ul>
1651 <ul>
1652 <li class="active">help</li>
1652 <li class="active">help</li>
1653 </ul>
1653 </ul>
1654 </div>
1654 </div>
1655
1655
1656 <div class="main">
1656 <div class="main">
1657 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1657 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1658 <form class="search" action="/log">
1658 <form class="search" action="/log">
1659
1659
1660 <p><input name="rev" id="search1" type="text" size="30" /></p>
1660 <p><input name="rev" id="search1" type="text" size="30" /></p>
1661 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1661 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1662 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1662 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1663 </form>
1663 </form>
1664 <table class="bigtable">
1664 <table class="bigtable">
1665 <tr><td colspan="2"><h2><a name="main" href="#topics">Topics</a></h2></td></tr>
1665 <tr><td colspan="2"><h2><a name="main" href="#topics">Topics</a></h2></td></tr>
1666
1666
1667 <tr><td>
1667 <tr><td>
1668 <a href="/help/config">
1668 <a href="/help/config">
1669 config
1669 config
1670 </a>
1670 </a>
1671 </td><td>
1671 </td><td>
1672 Configuration Files
1672 Configuration Files
1673 </td></tr>
1673 </td></tr>
1674 <tr><td>
1674 <tr><td>
1675 <a href="/help/dates">
1675 <a href="/help/dates">
1676 dates
1676 dates
1677 </a>
1677 </a>
1678 </td><td>
1678 </td><td>
1679 Date Formats
1679 Date Formats
1680 </td></tr>
1680 </td></tr>
1681 <tr><td>
1681 <tr><td>
1682 <a href="/help/diffs">
1682 <a href="/help/diffs">
1683 diffs
1683 diffs
1684 </a>
1684 </a>
1685 </td><td>
1685 </td><td>
1686 Diff Formats
1686 Diff Formats
1687 </td></tr>
1687 </td></tr>
1688 <tr><td>
1688 <tr><td>
1689 <a href="/help/environment">
1689 <a href="/help/environment">
1690 environment
1690 environment
1691 </a>
1691 </a>
1692 </td><td>
1692 </td><td>
1693 Environment Variables
1693 Environment Variables
1694 </td></tr>
1694 </td></tr>
1695 <tr><td>
1695 <tr><td>
1696 <a href="/help/extensions">
1696 <a href="/help/extensions">
1697 extensions
1697 extensions
1698 </a>
1698 </a>
1699 </td><td>
1699 </td><td>
1700 Using Additional Features
1700 Using Additional Features
1701 </td></tr>
1701 </td></tr>
1702 <tr><td>
1702 <tr><td>
1703 <a href="/help/filesets">
1703 <a href="/help/filesets">
1704 filesets
1704 filesets
1705 </a>
1705 </a>
1706 </td><td>
1706 </td><td>
1707 Specifying File Sets
1707 Specifying File Sets
1708 </td></tr>
1708 </td></tr>
1709 <tr><td>
1709 <tr><td>
1710 <a href="/help/glossary">
1710 <a href="/help/glossary">
1711 glossary
1711 glossary
1712 </a>
1712 </a>
1713 </td><td>
1713 </td><td>
1714 Glossary
1714 Glossary
1715 </td></tr>
1715 </td></tr>
1716 <tr><td>
1716 <tr><td>
1717 <a href="/help/hgignore">
1717 <a href="/help/hgignore">
1718 hgignore
1718 hgignore
1719 </a>
1719 </a>
1720 </td><td>
1720 </td><td>
1721 Syntax for Mercurial Ignore Files
1721 Syntax for Mercurial Ignore Files
1722 </td></tr>
1722 </td></tr>
1723 <tr><td>
1723 <tr><td>
1724 <a href="/help/hgweb">
1724 <a href="/help/hgweb">
1725 hgweb
1725 hgweb
1726 </a>
1726 </a>
1727 </td><td>
1727 </td><td>
1728 Configuring hgweb
1728 Configuring hgweb
1729 </td></tr>
1729 </td></tr>
1730 <tr><td>
1730 <tr><td>
1731 <a href="/help/internals">
1731 <a href="/help/internals">
1732 internals
1732 internals
1733 </a>
1733 </a>
1734 </td><td>
1734 </td><td>
1735 Technical implementation topics
1735 Technical implementation topics
1736 </td></tr>
1736 </td></tr>
1737 <tr><td>
1737 <tr><td>
1738 <a href="/help/merge-tools">
1738 <a href="/help/merge-tools">
1739 merge-tools
1739 merge-tools
1740 </a>
1740 </a>
1741 </td><td>
1741 </td><td>
1742 Merge Tools
1742 Merge Tools
1743 </td></tr>
1743 </td></tr>
1744 <tr><td>
1744 <tr><td>
1745 <a href="/help/multirevs">
1745 <a href="/help/multirevs">
1746 multirevs
1746 multirevs
1747 </a>
1747 </a>
1748 </td><td>
1748 </td><td>
1749 Specifying Multiple Revisions
1749 Specifying Multiple Revisions
1750 </td></tr>
1750 </td></tr>
1751 <tr><td>
1751 <tr><td>
1752 <a href="/help/patterns">
1752 <a href="/help/patterns">
1753 patterns
1753 patterns
1754 </a>
1754 </a>
1755 </td><td>
1755 </td><td>
1756 File Name Patterns
1756 File Name Patterns
1757 </td></tr>
1757 </td></tr>
1758 <tr><td>
1758 <tr><td>
1759 <a href="/help/phases">
1759 <a href="/help/phases">
1760 phases
1760 phases
1761 </a>
1761 </a>
1762 </td><td>
1762 </td><td>
1763 Working with Phases
1763 Working with Phases
1764 </td></tr>
1764 </td></tr>
1765 <tr><td>
1765 <tr><td>
1766 <a href="/help/revisions">
1766 <a href="/help/revisions">
1767 revisions
1767 revisions
1768 </a>
1768 </a>
1769 </td><td>
1769 </td><td>
1770 Specifying Single Revisions
1770 Specifying Single Revisions
1771 </td></tr>
1771 </td></tr>
1772 <tr><td>
1772 <tr><td>
1773 <a href="/help/revsets">
1773 <a href="/help/revsets">
1774 revsets
1774 revsets
1775 </a>
1775 </a>
1776 </td><td>
1776 </td><td>
1777 Specifying Revision Sets
1777 Specifying Revision Sets
1778 </td></tr>
1778 </td></tr>
1779 <tr><td>
1779 <tr><td>
1780 <a href="/help/scripting">
1780 <a href="/help/scripting">
1781 scripting
1781 scripting
1782 </a>
1782 </a>
1783 </td><td>
1783 </td><td>
1784 Using Mercurial from scripts and automation
1784 Using Mercurial from scripts and automation
1785 </td></tr>
1785 </td></tr>
1786 <tr><td>
1786 <tr><td>
1787 <a href="/help/subrepos">
1787 <a href="/help/subrepos">
1788 subrepos
1788 subrepos
1789 </a>
1789 </a>
1790 </td><td>
1790 </td><td>
1791 Subrepositories
1791 Subrepositories
1792 </td></tr>
1792 </td></tr>
1793 <tr><td>
1793 <tr><td>
1794 <a href="/help/templating">
1794 <a href="/help/templating">
1795 templating
1795 templating
1796 </a>
1796 </a>
1797 </td><td>
1797 </td><td>
1798 Template Usage
1798 Template Usage
1799 </td></tr>
1799 </td></tr>
1800 <tr><td>
1800 <tr><td>
1801 <a href="/help/urls">
1801 <a href="/help/urls">
1802 urls
1802 urls
1803 </a>
1803 </a>
1804 </td><td>
1804 </td><td>
1805 URL Paths
1805 URL Paths
1806 </td></tr>
1806 </td></tr>
1807 <tr><td>
1807 <tr><td>
1808 <a href="/help/topic-containing-verbose">
1808 <a href="/help/topic-containing-verbose">
1809 topic-containing-verbose
1809 topic-containing-verbose
1810 </a>
1810 </a>
1811 </td><td>
1811 </td><td>
1812 This is the topic to test omit indicating.
1812 This is the topic to test omit indicating.
1813 </td></tr>
1813 </td></tr>
1814
1814
1815
1815
1816 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
1816 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
1817
1817
1818 <tr><td>
1818 <tr><td>
1819 <a href="/help/add">
1819 <a href="/help/add">
1820 add
1820 add
1821 </a>
1821 </a>
1822 </td><td>
1822 </td><td>
1823 add the specified files on the next commit
1823 add the specified files on the next commit
1824 </td></tr>
1824 </td></tr>
1825 <tr><td>
1825 <tr><td>
1826 <a href="/help/annotate">
1826 <a href="/help/annotate">
1827 annotate
1827 annotate
1828 </a>
1828 </a>
1829 </td><td>
1829 </td><td>
1830 show changeset information by line for each file
1830 show changeset information by line for each file
1831 </td></tr>
1831 </td></tr>
1832 <tr><td>
1832 <tr><td>
1833 <a href="/help/clone">
1833 <a href="/help/clone">
1834 clone
1834 clone
1835 </a>
1835 </a>
1836 </td><td>
1836 </td><td>
1837 make a copy of an existing repository
1837 make a copy of an existing repository
1838 </td></tr>
1838 </td></tr>
1839 <tr><td>
1839 <tr><td>
1840 <a href="/help/commit">
1840 <a href="/help/commit">
1841 commit
1841 commit
1842 </a>
1842 </a>
1843 </td><td>
1843 </td><td>
1844 commit the specified files or all outstanding changes
1844 commit the specified files or all outstanding changes
1845 </td></tr>
1845 </td></tr>
1846 <tr><td>
1846 <tr><td>
1847 <a href="/help/diff">
1847 <a href="/help/diff">
1848 diff
1848 diff
1849 </a>
1849 </a>
1850 </td><td>
1850 </td><td>
1851 diff repository (or selected files)
1851 diff repository (or selected files)
1852 </td></tr>
1852 </td></tr>
1853 <tr><td>
1853 <tr><td>
1854 <a href="/help/export">
1854 <a href="/help/export">
1855 export
1855 export
1856 </a>
1856 </a>
1857 </td><td>
1857 </td><td>
1858 dump the header and diffs for one or more changesets
1858 dump the header and diffs for one or more changesets
1859 </td></tr>
1859 </td></tr>
1860 <tr><td>
1860 <tr><td>
1861 <a href="/help/forget">
1861 <a href="/help/forget">
1862 forget
1862 forget
1863 </a>
1863 </a>
1864 </td><td>
1864 </td><td>
1865 forget the specified files on the next commit
1865 forget the specified files on the next commit
1866 </td></tr>
1866 </td></tr>
1867 <tr><td>
1867 <tr><td>
1868 <a href="/help/init">
1868 <a href="/help/init">
1869 init
1869 init
1870 </a>
1870 </a>
1871 </td><td>
1871 </td><td>
1872 create a new repository in the given directory
1872 create a new repository in the given directory
1873 </td></tr>
1873 </td></tr>
1874 <tr><td>
1874 <tr><td>
1875 <a href="/help/log">
1875 <a href="/help/log">
1876 log
1876 log
1877 </a>
1877 </a>
1878 </td><td>
1878 </td><td>
1879 show revision history of entire repository or files
1879 show revision history of entire repository or files
1880 </td></tr>
1880 </td></tr>
1881 <tr><td>
1881 <tr><td>
1882 <a href="/help/merge">
1882 <a href="/help/merge">
1883 merge
1883 merge
1884 </a>
1884 </a>
1885 </td><td>
1885 </td><td>
1886 merge another revision into working directory
1886 merge another revision into working directory
1887 </td></tr>
1887 </td></tr>
1888 <tr><td>
1888 <tr><td>
1889 <a href="/help/pull">
1889 <a href="/help/pull">
1890 pull
1890 pull
1891 </a>
1891 </a>
1892 </td><td>
1892 </td><td>
1893 pull changes from the specified source
1893 pull changes from the specified source
1894 </td></tr>
1894 </td></tr>
1895 <tr><td>
1895 <tr><td>
1896 <a href="/help/push">
1896 <a href="/help/push">
1897 push
1897 push
1898 </a>
1898 </a>
1899 </td><td>
1899 </td><td>
1900 push changes to the specified destination
1900 push changes to the specified destination
1901 </td></tr>
1901 </td></tr>
1902 <tr><td>
1902 <tr><td>
1903 <a href="/help/remove">
1903 <a href="/help/remove">
1904 remove
1904 remove
1905 </a>
1905 </a>
1906 </td><td>
1906 </td><td>
1907 remove the specified files on the next commit
1907 remove the specified files on the next commit
1908 </td></tr>
1908 </td></tr>
1909 <tr><td>
1909 <tr><td>
1910 <a href="/help/serve">
1910 <a href="/help/serve">
1911 serve
1911 serve
1912 </a>
1912 </a>
1913 </td><td>
1913 </td><td>
1914 start stand-alone webserver
1914 start stand-alone webserver
1915 </td></tr>
1915 </td></tr>
1916 <tr><td>
1916 <tr><td>
1917 <a href="/help/status">
1917 <a href="/help/status">
1918 status
1918 status
1919 </a>
1919 </a>
1920 </td><td>
1920 </td><td>
1921 show changed files in the working directory
1921 show changed files in the working directory
1922 </td></tr>
1922 </td></tr>
1923 <tr><td>
1923 <tr><td>
1924 <a href="/help/summary">
1924 <a href="/help/summary">
1925 summary
1925 summary
1926 </a>
1926 </a>
1927 </td><td>
1927 </td><td>
1928 summarize working directory state
1928 summarize working directory state
1929 </td></tr>
1929 </td></tr>
1930 <tr><td>
1930 <tr><td>
1931 <a href="/help/update">
1931 <a href="/help/update">
1932 update
1932 update
1933 </a>
1933 </a>
1934 </td><td>
1934 </td><td>
1935 update working directory (or switch revisions)
1935 update working directory (or switch revisions)
1936 </td></tr>
1936 </td></tr>
1937
1937
1938
1938
1939
1939
1940 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
1940 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
1941
1941
1942 <tr><td>
1942 <tr><td>
1943 <a href="/help/addremove">
1943 <a href="/help/addremove">
1944 addremove
1944 addremove
1945 </a>
1945 </a>
1946 </td><td>
1946 </td><td>
1947 add all new files, delete all missing files
1947 add all new files, delete all missing files
1948 </td></tr>
1948 </td></tr>
1949 <tr><td>
1949 <tr><td>
1950 <a href="/help/archive">
1950 <a href="/help/archive">
1951 archive
1951 archive
1952 </a>
1952 </a>
1953 </td><td>
1953 </td><td>
1954 create an unversioned archive of a repository revision
1954 create an unversioned archive of a repository revision
1955 </td></tr>
1955 </td></tr>
1956 <tr><td>
1956 <tr><td>
1957 <a href="/help/backout">
1957 <a href="/help/backout">
1958 backout
1958 backout
1959 </a>
1959 </a>
1960 </td><td>
1960 </td><td>
1961 reverse effect of earlier changeset
1961 reverse effect of earlier changeset
1962 </td></tr>
1962 </td></tr>
1963 <tr><td>
1963 <tr><td>
1964 <a href="/help/bisect">
1964 <a href="/help/bisect">
1965 bisect
1965 bisect
1966 </a>
1966 </a>
1967 </td><td>
1967 </td><td>
1968 subdivision search of changesets
1968 subdivision search of changesets
1969 </td></tr>
1969 </td></tr>
1970 <tr><td>
1970 <tr><td>
1971 <a href="/help/bookmarks">
1971 <a href="/help/bookmarks">
1972 bookmarks
1972 bookmarks
1973 </a>
1973 </a>
1974 </td><td>
1974 </td><td>
1975 create a new bookmark or list existing bookmarks
1975 create a new bookmark or list existing bookmarks
1976 </td></tr>
1976 </td></tr>
1977 <tr><td>
1977 <tr><td>
1978 <a href="/help/branch">
1978 <a href="/help/branch">
1979 branch
1979 branch
1980 </a>
1980 </a>
1981 </td><td>
1981 </td><td>
1982 set or show the current branch name
1982 set or show the current branch name
1983 </td></tr>
1983 </td></tr>
1984 <tr><td>
1984 <tr><td>
1985 <a href="/help/branches">
1985 <a href="/help/branches">
1986 branches
1986 branches
1987 </a>
1987 </a>
1988 </td><td>
1988 </td><td>
1989 list repository named branches
1989 list repository named branches
1990 </td></tr>
1990 </td></tr>
1991 <tr><td>
1991 <tr><td>
1992 <a href="/help/bundle">
1992 <a href="/help/bundle">
1993 bundle
1993 bundle
1994 </a>
1994 </a>
1995 </td><td>
1995 </td><td>
1996 create a changegroup file
1996 create a changegroup file
1997 </td></tr>
1997 </td></tr>
1998 <tr><td>
1998 <tr><td>
1999 <a href="/help/cat">
1999 <a href="/help/cat">
2000 cat
2000 cat
2001 </a>
2001 </a>
2002 </td><td>
2002 </td><td>
2003 output the current or given revision of files
2003 output the current or given revision of files
2004 </td></tr>
2004 </td></tr>
2005 <tr><td>
2005 <tr><td>
2006 <a href="/help/config">
2006 <a href="/help/config">
2007 config
2007 config
2008 </a>
2008 </a>
2009 </td><td>
2009 </td><td>
2010 show combined config settings from all hgrc files
2010 show combined config settings from all hgrc files
2011 </td></tr>
2011 </td></tr>
2012 <tr><td>
2012 <tr><td>
2013 <a href="/help/copy">
2013 <a href="/help/copy">
2014 copy
2014 copy
2015 </a>
2015 </a>
2016 </td><td>
2016 </td><td>
2017 mark files as copied for the next commit
2017 mark files as copied for the next commit
2018 </td></tr>
2018 </td></tr>
2019 <tr><td>
2019 <tr><td>
2020 <a href="/help/files">
2020 <a href="/help/files">
2021 files
2021 files
2022 </a>
2022 </a>
2023 </td><td>
2023 </td><td>
2024 list tracked files
2024 list tracked files
2025 </td></tr>
2025 </td></tr>
2026 <tr><td>
2026 <tr><td>
2027 <a href="/help/graft">
2027 <a href="/help/graft">
2028 graft
2028 graft
2029 </a>
2029 </a>
2030 </td><td>
2030 </td><td>
2031 copy changes from other branches onto the current branch
2031 copy changes from other branches onto the current branch
2032 </td></tr>
2032 </td></tr>
2033 <tr><td>
2033 <tr><td>
2034 <a href="/help/grep">
2034 <a href="/help/grep">
2035 grep
2035 grep
2036 </a>
2036 </a>
2037 </td><td>
2037 </td><td>
2038 search for a pattern in specified files and revisions
2038 search for a pattern in specified files and revisions
2039 </td></tr>
2039 </td></tr>
2040 <tr><td>
2040 <tr><td>
2041 <a href="/help/heads">
2041 <a href="/help/heads">
2042 heads
2042 heads
2043 </a>
2043 </a>
2044 </td><td>
2044 </td><td>
2045 show branch heads
2045 show branch heads
2046 </td></tr>
2046 </td></tr>
2047 <tr><td>
2047 <tr><td>
2048 <a href="/help/help">
2048 <a href="/help/help">
2049 help
2049 help
2050 </a>
2050 </a>
2051 </td><td>
2051 </td><td>
2052 show help for a given topic or a help overview
2052 show help for a given topic or a help overview
2053 </td></tr>
2053 </td></tr>
2054 <tr><td>
2054 <tr><td>
2055 <a href="/help/identify">
2055 <a href="/help/identify">
2056 identify
2056 identify
2057 </a>
2057 </a>
2058 </td><td>
2058 </td><td>
2059 identify the working directory or specified revision
2059 identify the working directory or specified revision
2060 </td></tr>
2060 </td></tr>
2061 <tr><td>
2061 <tr><td>
2062 <a href="/help/import">
2062 <a href="/help/import">
2063 import
2063 import
2064 </a>
2064 </a>
2065 </td><td>
2065 </td><td>
2066 import an ordered set of patches
2066 import an ordered set of patches
2067 </td></tr>
2067 </td></tr>
2068 <tr><td>
2068 <tr><td>
2069 <a href="/help/incoming">
2069 <a href="/help/incoming">
2070 incoming
2070 incoming
2071 </a>
2071 </a>
2072 </td><td>
2072 </td><td>
2073 show new changesets found in source
2073 show new changesets found in source
2074 </td></tr>
2074 </td></tr>
2075 <tr><td>
2075 <tr><td>
2076 <a href="/help/manifest">
2076 <a href="/help/manifest">
2077 manifest
2077 manifest
2078 </a>
2078 </a>
2079 </td><td>
2079 </td><td>
2080 output the current or given revision of the project manifest
2080 output the current or given revision of the project manifest
2081 </td></tr>
2081 </td></tr>
2082 <tr><td>
2082 <tr><td>
2083 <a href="/help/nohelp">
2083 <a href="/help/nohelp">
2084 nohelp
2084 nohelp
2085 </a>
2085 </a>
2086 </td><td>
2086 </td><td>
2087 (no help text available)
2087 (no help text available)
2088 </td></tr>
2088 </td></tr>
2089 <tr><td>
2089 <tr><td>
2090 <a href="/help/outgoing">
2090 <a href="/help/outgoing">
2091 outgoing
2091 outgoing
2092 </a>
2092 </a>
2093 </td><td>
2093 </td><td>
2094 show changesets not found in the destination
2094 show changesets not found in the destination
2095 </td></tr>
2095 </td></tr>
2096 <tr><td>
2096 <tr><td>
2097 <a href="/help/paths">
2097 <a href="/help/paths">
2098 paths
2098 paths
2099 </a>
2099 </a>
2100 </td><td>
2100 </td><td>
2101 show aliases for remote repositories
2101 show aliases for remote repositories
2102 </td></tr>
2102 </td></tr>
2103 <tr><td>
2103 <tr><td>
2104 <a href="/help/phase">
2104 <a href="/help/phase">
2105 phase
2105 phase
2106 </a>
2106 </a>
2107 </td><td>
2107 </td><td>
2108 set or show the current phase name
2108 set or show the current phase name
2109 </td></tr>
2109 </td></tr>
2110 <tr><td>
2110 <tr><td>
2111 <a href="/help/recover">
2111 <a href="/help/recover">
2112 recover
2112 recover
2113 </a>
2113 </a>
2114 </td><td>
2114 </td><td>
2115 roll back an interrupted transaction
2115 roll back an interrupted transaction
2116 </td></tr>
2116 </td></tr>
2117 <tr><td>
2117 <tr><td>
2118 <a href="/help/rename">
2118 <a href="/help/rename">
2119 rename
2119 rename
2120 </a>
2120 </a>
2121 </td><td>
2121 </td><td>
2122 rename files; equivalent of copy + remove
2122 rename files; equivalent of copy + remove
2123 </td></tr>
2123 </td></tr>
2124 <tr><td>
2124 <tr><td>
2125 <a href="/help/resolve">
2125 <a href="/help/resolve">
2126 resolve
2126 resolve
2127 </a>
2127 </a>
2128 </td><td>
2128 </td><td>
2129 redo merges or set/view the merge status of files
2129 redo merges or set/view the merge status of files
2130 </td></tr>
2130 </td></tr>
2131 <tr><td>
2131 <tr><td>
2132 <a href="/help/revert">
2132 <a href="/help/revert">
2133 revert
2133 revert
2134 </a>
2134 </a>
2135 </td><td>
2135 </td><td>
2136 restore files to their checkout state
2136 restore files to their checkout state
2137 </td></tr>
2137 </td></tr>
2138 <tr><td>
2138 <tr><td>
2139 <a href="/help/root">
2139 <a href="/help/root">
2140 root
2140 root
2141 </a>
2141 </a>
2142 </td><td>
2142 </td><td>
2143 print the root (top) of the current working directory
2143 print the root (top) of the current working directory
2144 </td></tr>
2144 </td></tr>
2145 <tr><td>
2145 <tr><td>
2146 <a href="/help/tag">
2146 <a href="/help/tag">
2147 tag
2147 tag
2148 </a>
2148 </a>
2149 </td><td>
2149 </td><td>
2150 add one or more tags for the current or given revision
2150 add one or more tags for the current or given revision
2151 </td></tr>
2151 </td></tr>
2152 <tr><td>
2152 <tr><td>
2153 <a href="/help/tags">
2153 <a href="/help/tags">
2154 tags
2154 tags
2155 </a>
2155 </a>
2156 </td><td>
2156 </td><td>
2157 list repository tags
2157 list repository tags
2158 </td></tr>
2158 </td></tr>
2159 <tr><td>
2159 <tr><td>
2160 <a href="/help/unbundle">
2160 <a href="/help/unbundle">
2161 unbundle
2161 unbundle
2162 </a>
2162 </a>
2163 </td><td>
2163 </td><td>
2164 apply one or more changegroup files
2164 apply one or more changegroup files
2165 </td></tr>
2165 </td></tr>
2166 <tr><td>
2166 <tr><td>
2167 <a href="/help/verify">
2167 <a href="/help/verify">
2168 verify
2168 verify
2169 </a>
2169 </a>
2170 </td><td>
2170 </td><td>
2171 verify the integrity of the repository
2171 verify the integrity of the repository
2172 </td></tr>
2172 </td></tr>
2173 <tr><td>
2173 <tr><td>
2174 <a href="/help/version">
2174 <a href="/help/version">
2175 version
2175 version
2176 </a>
2176 </a>
2177 </td><td>
2177 </td><td>
2178 output version and copyright information
2178 output version and copyright information
2179 </td></tr>
2179 </td></tr>
2180
2180
2181
2181
2182 </table>
2182 </table>
2183 </div>
2183 </div>
2184 </div>
2184 </div>
2185
2185
2186 <script type="text/javascript">process_dates()</script>
2186 <script type="text/javascript">process_dates()</script>
2187
2187
2188
2188
2189 </body>
2189 </body>
2190 </html>
2190 </html>
2191
2191
2192
2192
2193 $ get-with-headers.py 127.0.0.1:$HGPORT "help/add"
2193 $ get-with-headers.py 127.0.0.1:$HGPORT "help/add"
2194 200 Script output follows
2194 200 Script output follows
2195
2195
2196 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2196 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2197 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2197 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2198 <head>
2198 <head>
2199 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2199 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2200 <meta name="robots" content="index, nofollow" />
2200 <meta name="robots" content="index, nofollow" />
2201 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2201 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2202 <script type="text/javascript" src="/static/mercurial.js"></script>
2202 <script type="text/javascript" src="/static/mercurial.js"></script>
2203
2203
2204 <title>Help: add</title>
2204 <title>Help: add</title>
2205 </head>
2205 </head>
2206 <body>
2206 <body>
2207
2207
2208 <div class="container">
2208 <div class="container">
2209 <div class="menu">
2209 <div class="menu">
2210 <div class="logo">
2210 <div class="logo">
2211 <a href="https://mercurial-scm.org/">
2211 <a href="https://mercurial-scm.org/">
2212 <img src="/static/hglogo.png" alt="mercurial" /></a>
2212 <img src="/static/hglogo.png" alt="mercurial" /></a>
2213 </div>
2213 </div>
2214 <ul>
2214 <ul>
2215 <li><a href="/shortlog">log</a></li>
2215 <li><a href="/shortlog">log</a></li>
2216 <li><a href="/graph">graph</a></li>
2216 <li><a href="/graph">graph</a></li>
2217 <li><a href="/tags">tags</a></li>
2217 <li><a href="/tags">tags</a></li>
2218 <li><a href="/bookmarks">bookmarks</a></li>
2218 <li><a href="/bookmarks">bookmarks</a></li>
2219 <li><a href="/branches">branches</a></li>
2219 <li><a href="/branches">branches</a></li>
2220 </ul>
2220 </ul>
2221 <ul>
2221 <ul>
2222 <li class="active"><a href="/help">help</a></li>
2222 <li class="active"><a href="/help">help</a></li>
2223 </ul>
2223 </ul>
2224 </div>
2224 </div>
2225
2225
2226 <div class="main">
2226 <div class="main">
2227 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2227 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2228 <h3>Help: add</h3>
2228 <h3>Help: add</h3>
2229
2229
2230 <form class="search" action="/log">
2230 <form class="search" action="/log">
2231
2231
2232 <p><input name="rev" id="search1" type="text" size="30" /></p>
2232 <p><input name="rev" id="search1" type="text" size="30" /></p>
2233 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2233 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2234 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2234 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2235 </form>
2235 </form>
2236 <div id="doc">
2236 <div id="doc">
2237 <p>
2237 <p>
2238 hg add [OPTION]... [FILE]...
2238 hg add [OPTION]... [FILE]...
2239 </p>
2239 </p>
2240 <p>
2240 <p>
2241 add the specified files on the next commit
2241 add the specified files on the next commit
2242 </p>
2242 </p>
2243 <p>
2243 <p>
2244 Schedule files to be version controlled and added to the
2244 Schedule files to be version controlled and added to the
2245 repository.
2245 repository.
2246 </p>
2246 </p>
2247 <p>
2247 <p>
2248 The files will be added to the repository at the next commit. To
2248 The files will be added to the repository at the next commit. To
2249 undo an add before that, see &quot;hg forget&quot;.
2249 undo an add before that, see &quot;hg forget&quot;.
2250 </p>
2250 </p>
2251 <p>
2251 <p>
2252 If no names are given, add all files to the repository (except
2252 If no names are given, add all files to the repository (except
2253 files matching &quot;.hgignore&quot;).
2253 files matching &quot;.hgignore&quot;).
2254 </p>
2254 </p>
2255 <p>
2255 <p>
2256 Examples:
2256 Examples:
2257 </p>
2257 </p>
2258 <ul>
2258 <ul>
2259 <li> New (unknown) files are added automatically by &quot;hg add&quot;:
2259 <li> New (unknown) files are added automatically by &quot;hg add&quot;:
2260 <pre>
2260 <pre>
2261 \$ ls (re)
2261 \$ ls (re)
2262 foo.c
2262 foo.c
2263 \$ hg status (re)
2263 \$ hg status (re)
2264 ? foo.c
2264 ? foo.c
2265 \$ hg add (re)
2265 \$ hg add (re)
2266 adding foo.c
2266 adding foo.c
2267 \$ hg status (re)
2267 \$ hg status (re)
2268 A foo.c
2268 A foo.c
2269 </pre>
2269 </pre>
2270 <li> Specific files to be added can be specified:
2270 <li> Specific files to be added can be specified:
2271 <pre>
2271 <pre>
2272 \$ ls (re)
2272 \$ ls (re)
2273 bar.c foo.c
2273 bar.c foo.c
2274 \$ hg status (re)
2274 \$ hg status (re)
2275 ? bar.c
2275 ? bar.c
2276 ? foo.c
2276 ? foo.c
2277 \$ hg add bar.c (re)
2277 \$ hg add bar.c (re)
2278 \$ hg status (re)
2278 \$ hg status (re)
2279 A bar.c
2279 A bar.c
2280 ? foo.c
2280 ? foo.c
2281 </pre>
2281 </pre>
2282 </ul>
2282 </ul>
2283 <p>
2283 <p>
2284 Returns 0 if all files are successfully added.
2284 Returns 0 if all files are successfully added.
2285 </p>
2285 </p>
2286 <p>
2286 <p>
2287 options ([+] can be repeated):
2287 options ([+] can be repeated):
2288 </p>
2288 </p>
2289 <table>
2289 <table>
2290 <tr><td>-I</td>
2290 <tr><td>-I</td>
2291 <td>--include PATTERN [+]</td>
2291 <td>--include PATTERN [+]</td>
2292 <td>include names matching the given patterns</td></tr>
2292 <td>include names matching the given patterns</td></tr>
2293 <tr><td>-X</td>
2293 <tr><td>-X</td>
2294 <td>--exclude PATTERN [+]</td>
2294 <td>--exclude PATTERN [+]</td>
2295 <td>exclude names matching the given patterns</td></tr>
2295 <td>exclude names matching the given patterns</td></tr>
2296 <tr><td>-S</td>
2296 <tr><td>-S</td>
2297 <td>--subrepos</td>
2297 <td>--subrepos</td>
2298 <td>recurse into subrepositories</td></tr>
2298 <td>recurse into subrepositories</td></tr>
2299 <tr><td>-n</td>
2299 <tr><td>-n</td>
2300 <td>--dry-run</td>
2300 <td>--dry-run</td>
2301 <td>do not perform actions, just print output</td></tr>
2301 <td>do not perform actions, just print output</td></tr>
2302 </table>
2302 </table>
2303 <p>
2303 <p>
2304 global options ([+] can be repeated):
2304 global options ([+] can be repeated):
2305 </p>
2305 </p>
2306 <table>
2306 <table>
2307 <tr><td>-R</td>
2307 <tr><td>-R</td>
2308 <td>--repository REPO</td>
2308 <td>--repository REPO</td>
2309 <td>repository root directory or name of overlay bundle file</td></tr>
2309 <td>repository root directory or name of overlay bundle file</td></tr>
2310 <tr><td></td>
2310 <tr><td></td>
2311 <td>--cwd DIR</td>
2311 <td>--cwd DIR</td>
2312 <td>change working directory</td></tr>
2312 <td>change working directory</td></tr>
2313 <tr><td>-y</td>
2313 <tr><td>-y</td>
2314 <td>--noninteractive</td>
2314 <td>--noninteractive</td>
2315 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2315 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2316 <tr><td>-q</td>
2316 <tr><td>-q</td>
2317 <td>--quiet</td>
2317 <td>--quiet</td>
2318 <td>suppress output</td></tr>
2318 <td>suppress output</td></tr>
2319 <tr><td>-v</td>
2319 <tr><td>-v</td>
2320 <td>--verbose</td>
2320 <td>--verbose</td>
2321 <td>enable additional output</td></tr>
2321 <td>enable additional output</td></tr>
2322 <tr><td></td>
2322 <tr><td></td>
2323 <td>--config CONFIG [+]</td>
2323 <td>--config CONFIG [+]</td>
2324 <td>set/override config option (use 'section.name=value')</td></tr>
2324 <td>set/override config option (use 'section.name=value')</td></tr>
2325 <tr><td></td>
2325 <tr><td></td>
2326 <td>--debug</td>
2326 <td>--debug</td>
2327 <td>enable debugging output</td></tr>
2327 <td>enable debugging output</td></tr>
2328 <tr><td></td>
2328 <tr><td></td>
2329 <td>--debugger</td>
2329 <td>--debugger</td>
2330 <td>start debugger</td></tr>
2330 <td>start debugger</td></tr>
2331 <tr><td></td>
2331 <tr><td></td>
2332 <td>--encoding ENCODE</td>
2332 <td>--encoding ENCODE</td>
2333 <td>set the charset encoding (default: ascii)</td></tr>
2333 <td>set the charset encoding (default: ascii)</td></tr>
2334 <tr><td></td>
2334 <tr><td></td>
2335 <td>--encodingmode MODE</td>
2335 <td>--encodingmode MODE</td>
2336 <td>set the charset encoding mode (default: strict)</td></tr>
2336 <td>set the charset encoding mode (default: strict)</td></tr>
2337 <tr><td></td>
2337 <tr><td></td>
2338 <td>--traceback</td>
2338 <td>--traceback</td>
2339 <td>always print a traceback on exception</td></tr>
2339 <td>always print a traceback on exception</td></tr>
2340 <tr><td></td>
2340 <tr><td></td>
2341 <td>--time</td>
2341 <td>--time</td>
2342 <td>time how long the command takes</td></tr>
2342 <td>time how long the command takes</td></tr>
2343 <tr><td></td>
2343 <tr><td></td>
2344 <td>--profile</td>
2344 <td>--profile</td>
2345 <td>print command execution profile</td></tr>
2345 <td>print command execution profile</td></tr>
2346 <tr><td></td>
2346 <tr><td></td>
2347 <td>--version</td>
2347 <td>--version</td>
2348 <td>output version information and exit</td></tr>
2348 <td>output version information and exit</td></tr>
2349 <tr><td>-h</td>
2349 <tr><td>-h</td>
2350 <td>--help</td>
2350 <td>--help</td>
2351 <td>display help and exit</td></tr>
2351 <td>display help and exit</td></tr>
2352 <tr><td></td>
2352 <tr><td></td>
2353 <td>--hidden</td>
2353 <td>--hidden</td>
2354 <td>consider hidden changesets</td></tr>
2354 <td>consider hidden changesets</td></tr>
2355 </table>
2355 </table>
2356
2356
2357 </div>
2357 </div>
2358 </div>
2358 </div>
2359 </div>
2359 </div>
2360
2360
2361 <script type="text/javascript">process_dates()</script>
2361 <script type="text/javascript">process_dates()</script>
2362
2362
2363
2363
2364 </body>
2364 </body>
2365 </html>
2365 </html>
2366
2366
2367
2367
2368 $ get-with-headers.py 127.0.0.1:$HGPORT "help/remove"
2368 $ get-with-headers.py 127.0.0.1:$HGPORT "help/remove"
2369 200 Script output follows
2369 200 Script output follows
2370
2370
2371 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2371 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2372 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2372 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2373 <head>
2373 <head>
2374 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2374 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2375 <meta name="robots" content="index, nofollow" />
2375 <meta name="robots" content="index, nofollow" />
2376 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2376 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2377 <script type="text/javascript" src="/static/mercurial.js"></script>
2377 <script type="text/javascript" src="/static/mercurial.js"></script>
2378
2378
2379 <title>Help: remove</title>
2379 <title>Help: remove</title>
2380 </head>
2380 </head>
2381 <body>
2381 <body>
2382
2382
2383 <div class="container">
2383 <div class="container">
2384 <div class="menu">
2384 <div class="menu">
2385 <div class="logo">
2385 <div class="logo">
2386 <a href="https://mercurial-scm.org/">
2386 <a href="https://mercurial-scm.org/">
2387 <img src="/static/hglogo.png" alt="mercurial" /></a>
2387 <img src="/static/hglogo.png" alt="mercurial" /></a>
2388 </div>
2388 </div>
2389 <ul>
2389 <ul>
2390 <li><a href="/shortlog">log</a></li>
2390 <li><a href="/shortlog">log</a></li>
2391 <li><a href="/graph">graph</a></li>
2391 <li><a href="/graph">graph</a></li>
2392 <li><a href="/tags">tags</a></li>
2392 <li><a href="/tags">tags</a></li>
2393 <li><a href="/bookmarks">bookmarks</a></li>
2393 <li><a href="/bookmarks">bookmarks</a></li>
2394 <li><a href="/branches">branches</a></li>
2394 <li><a href="/branches">branches</a></li>
2395 </ul>
2395 </ul>
2396 <ul>
2396 <ul>
2397 <li class="active"><a href="/help">help</a></li>
2397 <li class="active"><a href="/help">help</a></li>
2398 </ul>
2398 </ul>
2399 </div>
2399 </div>
2400
2400
2401 <div class="main">
2401 <div class="main">
2402 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2402 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2403 <h3>Help: remove</h3>
2403 <h3>Help: remove</h3>
2404
2404
2405 <form class="search" action="/log">
2405 <form class="search" action="/log">
2406
2406
2407 <p><input name="rev" id="search1" type="text" size="30" /></p>
2407 <p><input name="rev" id="search1" type="text" size="30" /></p>
2408 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2408 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2409 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2409 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2410 </form>
2410 </form>
2411 <div id="doc">
2411 <div id="doc">
2412 <p>
2412 <p>
2413 hg remove [OPTION]... FILE...
2413 hg remove [OPTION]... FILE...
2414 </p>
2414 </p>
2415 <p>
2415 <p>
2416 aliases: rm
2416 aliases: rm
2417 </p>
2417 </p>
2418 <p>
2418 <p>
2419 remove the specified files on the next commit
2419 remove the specified files on the next commit
2420 </p>
2420 </p>
2421 <p>
2421 <p>
2422 Schedule the indicated files for removal from the current branch.
2422 Schedule the indicated files for removal from the current branch.
2423 </p>
2423 </p>
2424 <p>
2424 <p>
2425 This command schedules the files to be removed at the next commit.
2425 This command schedules the files to be removed at the next commit.
2426 To undo a remove before that, see &quot;hg revert&quot;. To undo added
2426 To undo a remove before that, see &quot;hg revert&quot;. To undo added
2427 files, see &quot;hg forget&quot;.
2427 files, see &quot;hg forget&quot;.
2428 </p>
2428 </p>
2429 <p>
2429 <p>
2430 -A/--after can be used to remove only files that have already
2430 -A/--after can be used to remove only files that have already
2431 been deleted, -f/--force can be used to force deletion, and -Af
2431 been deleted, -f/--force can be used to force deletion, and -Af
2432 can be used to remove files from the next revision without
2432 can be used to remove files from the next revision without
2433 deleting them from the working directory.
2433 deleting them from the working directory.
2434 </p>
2434 </p>
2435 <p>
2435 <p>
2436 The following table details the behavior of remove for different
2436 The following table details the behavior of remove for different
2437 file states (columns) and option combinations (rows). The file
2437 file states (columns) and option combinations (rows). The file
2438 states are Added [A], Clean [C], Modified [M] and Missing [!]
2438 states are Added [A], Clean [C], Modified [M] and Missing [!]
2439 (as reported by &quot;hg status&quot;). The actions are Warn, Remove
2439 (as reported by &quot;hg status&quot;). The actions are Warn, Remove
2440 (from branch) and Delete (from disk):
2440 (from branch) and Delete (from disk):
2441 </p>
2441 </p>
2442 <table>
2442 <table>
2443 <tr><td>opt/state</td>
2443 <tr><td>opt/state</td>
2444 <td>A</td>
2444 <td>A</td>
2445 <td>C</td>
2445 <td>C</td>
2446 <td>M</td>
2446 <td>M</td>
2447 <td>!</td></tr>
2447 <td>!</td></tr>
2448 <tr><td>none</td>
2448 <tr><td>none</td>
2449 <td>W</td>
2449 <td>W</td>
2450 <td>RD</td>
2450 <td>RD</td>
2451 <td>W</td>
2451 <td>W</td>
2452 <td>R</td></tr>
2452 <td>R</td></tr>
2453 <tr><td>-f</td>
2453 <tr><td>-f</td>
2454 <td>R</td>
2454 <td>R</td>
2455 <td>RD</td>
2455 <td>RD</td>
2456 <td>RD</td>
2456 <td>RD</td>
2457 <td>R</td></tr>
2457 <td>R</td></tr>
2458 <tr><td>-A</td>
2458 <tr><td>-A</td>
2459 <td>W</td>
2459 <td>W</td>
2460 <td>W</td>
2460 <td>W</td>
2461 <td>W</td>
2461 <td>W</td>
2462 <td>R</td></tr>
2462 <td>R</td></tr>
2463 <tr><td>-Af</td>
2463 <tr><td>-Af</td>
2464 <td>R</td>
2464 <td>R</td>
2465 <td>R</td>
2465 <td>R</td>
2466 <td>R</td>
2466 <td>R</td>
2467 <td>R</td></tr>
2467 <td>R</td></tr>
2468 </table>
2468 </table>
2469 <p>
2469 <p>
2470 <b>Note:</b>
2470 <b>Note:</b>
2471 </p>
2471 </p>
2472 <p>
2472 <p>
2473 &quot;hg remove&quot; never deletes files in Added [A] state from the
2473 &quot;hg remove&quot; never deletes files in Added [A] state from the
2474 working directory, not even if &quot;--force&quot; is specified.
2474 working directory, not even if &quot;--force&quot; is specified.
2475 </p>
2475 </p>
2476 <p>
2476 <p>
2477 Returns 0 on success, 1 if any warnings encountered.
2477 Returns 0 on success, 1 if any warnings encountered.
2478 </p>
2478 </p>
2479 <p>
2479 <p>
2480 options ([+] can be repeated):
2480 options ([+] can be repeated):
2481 </p>
2481 </p>
2482 <table>
2482 <table>
2483 <tr><td>-A</td>
2483 <tr><td>-A</td>
2484 <td>--after</td>
2484 <td>--after</td>
2485 <td>record delete for missing files</td></tr>
2485 <td>record delete for missing files</td></tr>
2486 <tr><td>-f</td>
2486 <tr><td>-f</td>
2487 <td>--force</td>
2487 <td>--force</td>
2488 <td>remove (and delete) file even if added or modified</td></tr>
2488 <td>remove (and delete) file even if added or modified</td></tr>
2489 <tr><td>-S</td>
2489 <tr><td>-S</td>
2490 <td>--subrepos</td>
2490 <td>--subrepos</td>
2491 <td>recurse into subrepositories</td></tr>
2491 <td>recurse into subrepositories</td></tr>
2492 <tr><td>-I</td>
2492 <tr><td>-I</td>
2493 <td>--include PATTERN [+]</td>
2493 <td>--include PATTERN [+]</td>
2494 <td>include names matching the given patterns</td></tr>
2494 <td>include names matching the given patterns</td></tr>
2495 <tr><td>-X</td>
2495 <tr><td>-X</td>
2496 <td>--exclude PATTERN [+]</td>
2496 <td>--exclude PATTERN [+]</td>
2497 <td>exclude names matching the given patterns</td></tr>
2497 <td>exclude names matching the given patterns</td></tr>
2498 </table>
2498 </table>
2499 <p>
2499 <p>
2500 global options ([+] can be repeated):
2500 global options ([+] can be repeated):
2501 </p>
2501 </p>
2502 <table>
2502 <table>
2503 <tr><td>-R</td>
2503 <tr><td>-R</td>
2504 <td>--repository REPO</td>
2504 <td>--repository REPO</td>
2505 <td>repository root directory or name of overlay bundle file</td></tr>
2505 <td>repository root directory or name of overlay bundle file</td></tr>
2506 <tr><td></td>
2506 <tr><td></td>
2507 <td>--cwd DIR</td>
2507 <td>--cwd DIR</td>
2508 <td>change working directory</td></tr>
2508 <td>change working directory</td></tr>
2509 <tr><td>-y</td>
2509 <tr><td>-y</td>
2510 <td>--noninteractive</td>
2510 <td>--noninteractive</td>
2511 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2511 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2512 <tr><td>-q</td>
2512 <tr><td>-q</td>
2513 <td>--quiet</td>
2513 <td>--quiet</td>
2514 <td>suppress output</td></tr>
2514 <td>suppress output</td></tr>
2515 <tr><td>-v</td>
2515 <tr><td>-v</td>
2516 <td>--verbose</td>
2516 <td>--verbose</td>
2517 <td>enable additional output</td></tr>
2517 <td>enable additional output</td></tr>
2518 <tr><td></td>
2518 <tr><td></td>
2519 <td>--config CONFIG [+]</td>
2519 <td>--config CONFIG [+]</td>
2520 <td>set/override config option (use 'section.name=value')</td></tr>
2520 <td>set/override config option (use 'section.name=value')</td></tr>
2521 <tr><td></td>
2521 <tr><td></td>
2522 <td>--debug</td>
2522 <td>--debug</td>
2523 <td>enable debugging output</td></tr>
2523 <td>enable debugging output</td></tr>
2524 <tr><td></td>
2524 <tr><td></td>
2525 <td>--debugger</td>
2525 <td>--debugger</td>
2526 <td>start debugger</td></tr>
2526 <td>start debugger</td></tr>
2527 <tr><td></td>
2527 <tr><td></td>
2528 <td>--encoding ENCODE</td>
2528 <td>--encoding ENCODE</td>
2529 <td>set the charset encoding (default: ascii)</td></tr>
2529 <td>set the charset encoding (default: ascii)</td></tr>
2530 <tr><td></td>
2530 <tr><td></td>
2531 <td>--encodingmode MODE</td>
2531 <td>--encodingmode MODE</td>
2532 <td>set the charset encoding mode (default: strict)</td></tr>
2532 <td>set the charset encoding mode (default: strict)</td></tr>
2533 <tr><td></td>
2533 <tr><td></td>
2534 <td>--traceback</td>
2534 <td>--traceback</td>
2535 <td>always print a traceback on exception</td></tr>
2535 <td>always print a traceback on exception</td></tr>
2536 <tr><td></td>
2536 <tr><td></td>
2537 <td>--time</td>
2537 <td>--time</td>
2538 <td>time how long the command takes</td></tr>
2538 <td>time how long the command takes</td></tr>
2539 <tr><td></td>
2539 <tr><td></td>
2540 <td>--profile</td>
2540 <td>--profile</td>
2541 <td>print command execution profile</td></tr>
2541 <td>print command execution profile</td></tr>
2542 <tr><td></td>
2542 <tr><td></td>
2543 <td>--version</td>
2543 <td>--version</td>
2544 <td>output version information and exit</td></tr>
2544 <td>output version information and exit</td></tr>
2545 <tr><td>-h</td>
2545 <tr><td>-h</td>
2546 <td>--help</td>
2546 <td>--help</td>
2547 <td>display help and exit</td></tr>
2547 <td>display help and exit</td></tr>
2548 <tr><td></td>
2548 <tr><td></td>
2549 <td>--hidden</td>
2549 <td>--hidden</td>
2550 <td>consider hidden changesets</td></tr>
2550 <td>consider hidden changesets</td></tr>
2551 </table>
2551 </table>
2552
2552
2553 </div>
2553 </div>
2554 </div>
2554 </div>
2555 </div>
2555 </div>
2556
2556
2557 <script type="text/javascript">process_dates()</script>
2557 <script type="text/javascript">process_dates()</script>
2558
2558
2559
2559
2560 </body>
2560 </body>
2561 </html>
2561 </html>
2562
2562
2563
2563
2564 $ get-with-headers.py 127.0.0.1:$HGPORT "help/revisions"
2564 $ get-with-headers.py 127.0.0.1:$HGPORT "help/revisions"
2565 200 Script output follows
2565 200 Script output follows
2566
2566
2567 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2567 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2568 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2568 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2569 <head>
2569 <head>
2570 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2570 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2571 <meta name="robots" content="index, nofollow" />
2571 <meta name="robots" content="index, nofollow" />
2572 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2572 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2573 <script type="text/javascript" src="/static/mercurial.js"></script>
2573 <script type="text/javascript" src="/static/mercurial.js"></script>
2574
2574
2575 <title>Help: revisions</title>
2575 <title>Help: revisions</title>
2576 </head>
2576 </head>
2577 <body>
2577 <body>
2578
2578
2579 <div class="container">
2579 <div class="container">
2580 <div class="menu">
2580 <div class="menu">
2581 <div class="logo">
2581 <div class="logo">
2582 <a href="https://mercurial-scm.org/">
2582 <a href="https://mercurial-scm.org/">
2583 <img src="/static/hglogo.png" alt="mercurial" /></a>
2583 <img src="/static/hglogo.png" alt="mercurial" /></a>
2584 </div>
2584 </div>
2585 <ul>
2585 <ul>
2586 <li><a href="/shortlog">log</a></li>
2586 <li><a href="/shortlog">log</a></li>
2587 <li><a href="/graph">graph</a></li>
2587 <li><a href="/graph">graph</a></li>
2588 <li><a href="/tags">tags</a></li>
2588 <li><a href="/tags">tags</a></li>
2589 <li><a href="/bookmarks">bookmarks</a></li>
2589 <li><a href="/bookmarks">bookmarks</a></li>
2590 <li><a href="/branches">branches</a></li>
2590 <li><a href="/branches">branches</a></li>
2591 </ul>
2591 </ul>
2592 <ul>
2592 <ul>
2593 <li class="active"><a href="/help">help</a></li>
2593 <li class="active"><a href="/help">help</a></li>
2594 </ul>
2594 </ul>
2595 </div>
2595 </div>
2596
2596
2597 <div class="main">
2597 <div class="main">
2598 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2598 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2599 <h3>Help: revisions</h3>
2599 <h3>Help: revisions</h3>
2600
2600
2601 <form class="search" action="/log">
2601 <form class="search" action="/log">
2602
2602
2603 <p><input name="rev" id="search1" type="text" size="30" /></p>
2603 <p><input name="rev" id="search1" type="text" size="30" /></p>
2604 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2604 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2605 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2605 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2606 </form>
2606 </form>
2607 <div id="doc">
2607 <div id="doc">
2608 <h1>Specifying Single Revisions</h1>
2608 <h1>Specifying Single Revisions</h1>
2609 <p>
2609 <p>
2610 Mercurial supports several ways to specify individual revisions.
2610 Mercurial supports several ways to specify individual revisions.
2611 </p>
2611 </p>
2612 <p>
2612 <p>
2613 A plain integer is treated as a revision number. Negative integers are
2613 A plain integer is treated as a revision number. Negative integers are
2614 treated as sequential offsets from the tip, with -1 denoting the tip,
2614 treated as sequential offsets from the tip, with -1 denoting the tip,
2615 -2 denoting the revision prior to the tip, and so forth.
2615 -2 denoting the revision prior to the tip, and so forth.
2616 </p>
2616 </p>
2617 <p>
2617 <p>
2618 A 40-digit hexadecimal string is treated as a unique revision
2618 A 40-digit hexadecimal string is treated as a unique revision
2619 identifier.
2619 identifier.
2620 </p>
2620 </p>
2621 <p>
2621 <p>
2622 A hexadecimal string less than 40 characters long is treated as a
2622 A hexadecimal string less than 40 characters long is treated as a
2623 unique revision identifier and is referred to as a short-form
2623 unique revision identifier and is referred to as a short-form
2624 identifier. A short-form identifier is only valid if it is the prefix
2624 identifier. A short-form identifier is only valid if it is the prefix
2625 of exactly one full-length identifier.
2625 of exactly one full-length identifier.
2626 </p>
2626 </p>
2627 <p>
2627 <p>
2628 Any other string is treated as a bookmark, tag, or branch name. A
2628 Any other string is treated as a bookmark, tag, or branch name. A
2629 bookmark is a movable pointer to a revision. A tag is a permanent name
2629 bookmark is a movable pointer to a revision. A tag is a permanent name
2630 associated with a revision. A branch name denotes the tipmost open branch head
2630 associated with a revision. A branch name denotes the tipmost open branch head
2631 of that branch - or if they are all closed, the tipmost closed head of the
2631 of that branch - or if they are all closed, the tipmost closed head of the
2632 branch. Bookmark, tag, and branch names must not contain the &quot;:&quot; character.
2632 branch. Bookmark, tag, and branch names must not contain the &quot;:&quot; character.
2633 </p>
2633 </p>
2634 <p>
2634 <p>
2635 The reserved name &quot;tip&quot; always identifies the most recent revision.
2635 The reserved name &quot;tip&quot; always identifies the most recent revision.
2636 </p>
2636 </p>
2637 <p>
2637 <p>
2638 The reserved name &quot;null&quot; indicates the null revision. This is the
2638 The reserved name &quot;null&quot; indicates the null revision. This is the
2639 revision of an empty repository, and the parent of revision 0.
2639 revision of an empty repository, and the parent of revision 0.
2640 </p>
2640 </p>
2641 <p>
2641 <p>
2642 The reserved name &quot;.&quot; indicates the working directory parent. If no
2642 The reserved name &quot;.&quot; indicates the working directory parent. If no
2643 working directory is checked out, it is equivalent to null. If an
2643 working directory is checked out, it is equivalent to null. If an
2644 uncommitted merge is in progress, &quot;.&quot; is the revision of the first
2644 uncommitted merge is in progress, &quot;.&quot; is the revision of the first
2645 parent.
2645 parent.
2646 </p>
2646 </p>
2647
2647
2648 </div>
2648 </div>
2649 </div>
2649 </div>
2650 </div>
2650 </div>
2651
2651
2652 <script type="text/javascript">process_dates()</script>
2652 <script type="text/javascript">process_dates()</script>
2653
2653
2654
2654
2655 </body>
2655 </body>
2656 </html>
2656 </html>
2657
2657
2658
2658
2659 Sub-topic indexes rendered properly
2659 Sub-topic indexes rendered properly
2660
2660
2661 $ get-with-headers.py 127.0.0.1:$HGPORT "help/internals"
2661 $ get-with-headers.py 127.0.0.1:$HGPORT "help/internals"
2662 200 Script output follows
2662 200 Script output follows
2663
2663
2664 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2664 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2665 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2665 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2666 <head>
2666 <head>
2667 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2667 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2668 <meta name="robots" content="index, nofollow" />
2668 <meta name="robots" content="index, nofollow" />
2669 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2669 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2670 <script type="text/javascript" src="/static/mercurial.js"></script>
2670 <script type="text/javascript" src="/static/mercurial.js"></script>
2671
2671
2672 <title>Help: internals</title>
2672 <title>Help: internals</title>
2673 </head>
2673 </head>
2674 <body>
2674 <body>
2675
2675
2676 <div class="container">
2676 <div class="container">
2677 <div class="menu">
2677 <div class="menu">
2678 <div class="logo">
2678 <div class="logo">
2679 <a href="https://mercurial-scm.org/">
2679 <a href="https://mercurial-scm.org/">
2680 <img src="/static/hglogo.png" alt="mercurial" /></a>
2680 <img src="/static/hglogo.png" alt="mercurial" /></a>
2681 </div>
2681 </div>
2682 <ul>
2682 <ul>
2683 <li><a href="/shortlog">log</a></li>
2683 <li><a href="/shortlog">log</a></li>
2684 <li><a href="/graph">graph</a></li>
2684 <li><a href="/graph">graph</a></li>
2685 <li><a href="/tags">tags</a></li>
2685 <li><a href="/tags">tags</a></li>
2686 <li><a href="/bookmarks">bookmarks</a></li>
2686 <li><a href="/bookmarks">bookmarks</a></li>
2687 <li><a href="/branches">branches</a></li>
2687 <li><a href="/branches">branches</a></li>
2688 </ul>
2688 </ul>
2689 <ul>
2689 <ul>
2690 <li><a href="/help">help</a></li>
2690 <li><a href="/help">help</a></li>
2691 </ul>
2691 </ul>
2692 </div>
2692 </div>
2693
2693
2694 <div class="main">
2694 <div class="main">
2695 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2695 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2696 <form class="search" action="/log">
2696 <form class="search" action="/log">
2697
2697
2698 <p><input name="rev" id="search1" type="text" size="30" /></p>
2698 <p><input name="rev" id="search1" type="text" size="30" /></p>
2699 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2699 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2700 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2700 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2701 </form>
2701 </form>
2702 <table class="bigtable">
2702 <table class="bigtable">
2703 <tr><td colspan="2"><h2><a name="main" href="#topics">Topics</a></h2></td></tr>
2703 <tr><td colspan="2"><h2><a name="main" href="#topics">Topics</a></h2></td></tr>
2704
2704
2705 <tr><td>
2705 <tr><td>
2706 <a href="/help/internals.bundles">
2706 <a href="/help/internals.bundles">
2707 bundles
2707 bundles
2708 </a>
2708 </a>
2709 </td><td>
2709 </td><td>
2710 container for exchange of repository data
2710 container for exchange of repository data
2711 </td></tr>
2711 </td></tr>
2712 <tr><td>
2712 <tr><td>
2713 <a href="/help/internals.changegroups">
2713 <a href="/help/internals.changegroups">
2714 changegroups
2714 changegroups
2715 </a>
2715 </a>
2716 </td><td>
2716 </td><td>
2717 representation of revlog data
2717 representation of revlog data
2718 </td></tr>
2718 </td></tr>
2719
2719
2720
2720
2721
2721
2722
2722
2723
2723
2724 </table>
2724 </table>
2725 </div>
2725 </div>
2726 </div>
2726 </div>
2727
2727
2728 <script type="text/javascript">process_dates()</script>
2728 <script type="text/javascript">process_dates()</script>
2729
2729
2730
2730
2731 </body>
2731 </body>
2732 </html>
2732 </html>
2733
2733
2734
2734
2735 Sub-topic topics rendered properly
2735 Sub-topic topics rendered properly
2736
2736
2737 $ get-with-headers.py 127.0.0.1:$HGPORT "help/internals.changegroups"
2737 $ get-with-headers.py 127.0.0.1:$HGPORT "help/internals.changegroups"
2738 200 Script output follows
2738 200 Script output follows
2739
2739
2740 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2740 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2741 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2741 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2742 <head>
2742 <head>
2743 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2743 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2744 <meta name="robots" content="index, nofollow" />
2744 <meta name="robots" content="index, nofollow" />
2745 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2745 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2746 <script type="text/javascript" src="/static/mercurial.js"></script>
2746 <script type="text/javascript" src="/static/mercurial.js"></script>
2747
2747
2748 <title>Help: internals.changegroups</title>
2748 <title>Help: internals.changegroups</title>
2749 </head>
2749 </head>
2750 <body>
2750 <body>
2751
2751
2752 <div class="container">
2752 <div class="container">
2753 <div class="menu">
2753 <div class="menu">
2754 <div class="logo">
2754 <div class="logo">
2755 <a href="https://mercurial-scm.org/">
2755 <a href="https://mercurial-scm.org/">
2756 <img src="/static/hglogo.png" alt="mercurial" /></a>
2756 <img src="/static/hglogo.png" alt="mercurial" /></a>
2757 </div>
2757 </div>
2758 <ul>
2758 <ul>
2759 <li><a href="/shortlog">log</a></li>
2759 <li><a href="/shortlog">log</a></li>
2760 <li><a href="/graph">graph</a></li>
2760 <li><a href="/graph">graph</a></li>
2761 <li><a href="/tags">tags</a></li>
2761 <li><a href="/tags">tags</a></li>
2762 <li><a href="/bookmarks">bookmarks</a></li>
2762 <li><a href="/bookmarks">bookmarks</a></li>
2763 <li><a href="/branches">branches</a></li>
2763 <li><a href="/branches">branches</a></li>
2764 </ul>
2764 </ul>
2765 <ul>
2765 <ul>
2766 <li class="active"><a href="/help">help</a></li>
2766 <li class="active"><a href="/help">help</a></li>
2767 </ul>
2767 </ul>
2768 </div>
2768 </div>
2769
2769
2770 <div class="main">
2770 <div class="main">
2771 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2771 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2772 <h3>Help: internals.changegroups</h3>
2772 <h3>Help: internals.changegroups</h3>
2773
2773
2774 <form class="search" action="/log">
2774 <form class="search" action="/log">
2775
2775
2776 <p><input name="rev" id="search1" type="text" size="30" /></p>
2776 <p><input name="rev" id="search1" type="text" size="30" /></p>
2777 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2777 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2778 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2778 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2779 </form>
2779 </form>
2780 <div id="doc">
2780 <div id="doc">
2781 <h1>representation of revlog data</h1>
2781 <h1>representation of revlog data</h1>
2782 <h2>Changegroups</h2>
2782 <h2>Changegroups</h2>
2783 <p>
2783 <p>
2784 Changegroups are representations of repository revlog data, specifically
2784 Changegroups are representations of repository revlog data, specifically
2785 the changelog, manifest, and filelogs.
2785 the changelog, manifest, and filelogs.
2786 </p>
2786 </p>
2787 <p>
2787 <p>
2788 There are 3 versions of changegroups: &quot;1&quot;, &quot;2&quot;, and &quot;3&quot;. From a
2788 There are 3 versions of changegroups: &quot;1&quot;, &quot;2&quot;, and &quot;3&quot;. From a
2789 high-level, versions &quot;1&quot; and &quot;2&quot; are almost exactly the same, with
2789 high-level, versions &quot;1&quot; and &quot;2&quot; are almost exactly the same, with
2790 the only difference being a header on entries in the changeset
2790 the only difference being a header on entries in the changeset
2791 segment. Version &quot;3&quot; adds support for exchanging treemanifests and
2791 segment. Version &quot;3&quot; adds support for exchanging treemanifests and
2792 includes revlog flags in the delta header.
2792 includes revlog flags in the delta header.
2793 </p>
2793 </p>
2794 <p>
2794 <p>
2795 Changegroups consists of 3 logical segments:
2795 Changegroups consists of 3 logical segments:
2796 </p>
2796 </p>
2797 <pre>
2797 <pre>
2798 +---------------------------------+
2798 +---------------------------------+
2799 | | | |
2799 | | | |
2800 | changeset | manifest | filelogs |
2800 | changeset | manifest | filelogs |
2801 | | | |
2801 | | | |
2802 +---------------------------------+
2802 +---------------------------------+
2803 </pre>
2803 </pre>
2804 <p>
2804 <p>
2805 The principle building block of each segment is a *chunk*. A *chunk*
2805 The principle building block of each segment is a *chunk*. A *chunk*
2806 is a framed piece of data:
2806 is a framed piece of data:
2807 </p>
2807 </p>
2808 <pre>
2808 <pre>
2809 +---------------------------------------+
2809 +---------------------------------------+
2810 | | |
2810 | | |
2811 | length | data |
2811 | length | data |
2812 | (32 bits) | &lt;length&gt; bytes |
2812 | (32 bits) | &lt;length&gt; bytes |
2813 | | |
2813 | | |
2814 +---------------------------------------+
2814 +---------------------------------------+
2815 </pre>
2815 </pre>
2816 <p>
2816 <p>
2817 Each chunk starts with a 32-bit big-endian signed integer indicating
2817 Each chunk starts with a 32-bit big-endian signed integer indicating
2818 the length of the raw data that follows.
2818 the length of the raw data that follows.
2819 </p>
2819 </p>
2820 <p>
2820 <p>
2821 There is a special case chunk that has 0 length (&quot;0x00000000&quot;). We
2821 There is a special case chunk that has 0 length (&quot;0x00000000&quot;). We
2822 call this an *empty chunk*.
2822 call this an *empty chunk*.
2823 </p>
2823 </p>
2824 <h3>Delta Groups</h3>
2824 <h3>Delta Groups</h3>
2825 <p>
2825 <p>
2826 A *delta group* expresses the content of a revlog as a series of deltas,
2826 A *delta group* expresses the content of a revlog as a series of deltas,
2827 or patches against previous revisions.
2827 or patches against previous revisions.
2828 </p>
2828 </p>
2829 <p>
2829 <p>
2830 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
2830 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
2831 to signal the end of the delta group:
2831 to signal the end of the delta group:
2832 </p>
2832 </p>
2833 <pre>
2833 <pre>
2834 +------------------------------------------------------------------------+
2834 +------------------------------------------------------------------------+
2835 | | | | | |
2835 | | | | | |
2836 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
2836 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
2837 | (32 bits) | (various) | (32 bits) | (various) | (32 bits) |
2837 | (32 bits) | (various) | (32 bits) | (various) | (32 bits) |
2838 | | | | | |
2838 | | | | | |
2839 +------------------------------------------------------------+-----------+
2839 +------------------------------------------------------------+-----------+
2840 </pre>
2840 </pre>
2841 <p>
2841 <p>
2842 Each *chunk*'s data consists of the following:
2842 Each *chunk*'s data consists of the following:
2843 </p>
2843 </p>
2844 <pre>
2844 <pre>
2845 +-----------------------------------------+
2845 +-----------------------------------------+
2846 | | | |
2846 | | | |
2847 | delta header | mdiff header | delta |
2847 | delta header | mdiff header | delta |
2848 | (various) | (12 bytes) | (various) |
2848 | (various) | (12 bytes) | (various) |
2849 | | | |
2849 | | | |
2850 +-----------------------------------------+
2850 +-----------------------------------------+
2851 </pre>
2851 </pre>
2852 <p>
2852 <p>
2853 The *length* field is the byte length of the remaining 3 logical pieces
2853 The *length* field is the byte length of the remaining 3 logical pieces
2854 of data. The *delta* is a diff from an existing entry in the changelog.
2854 of data. The *delta* is a diff from an existing entry in the changelog.
2855 </p>
2855 </p>
2856 <p>
2856 <p>
2857 The *delta header* is different between versions &quot;1&quot;, &quot;2&quot;, and
2857 The *delta header* is different between versions &quot;1&quot;, &quot;2&quot;, and
2858 &quot;3&quot; of the changegroup format.
2858 &quot;3&quot; of the changegroup format.
2859 </p>
2859 </p>
2860 <p>
2860 <p>
2861 Version 1:
2861 Version 1:
2862 </p>
2862 </p>
2863 <pre>
2863 <pre>
2864 +------------------------------------------------------+
2864 +------------------------------------------------------+
2865 | | | | |
2865 | | | | |
2866 | node | p1 node | p2 node | link node |
2866 | node | p1 node | p2 node | link node |
2867 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
2867 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
2868 | | | | |
2868 | | | | |
2869 +------------------------------------------------------+
2869 +------------------------------------------------------+
2870 </pre>
2870 </pre>
2871 <p>
2871 <p>
2872 Version 2:
2872 Version 2:
2873 </p>
2873 </p>
2874 <pre>
2874 <pre>
2875 +------------------------------------------------------------------+
2875 +------------------------------------------------------------------+
2876 | | | | | |
2876 | | | | | |
2877 | node | p1 node | p2 node | base node | link node |
2877 | node | p1 node | p2 node | base node | link node |
2878 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
2878 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
2879 | | | | | |
2879 | | | | | |
2880 +------------------------------------------------------------------+
2880 +------------------------------------------------------------------+
2881 </pre>
2881 </pre>
2882 <p>
2882 <p>
2883 Version 3:
2883 Version 3:
2884 </p>
2884 </p>
2885 <pre>
2885 <pre>
2886 +------------------------------------------------------------------------------+
2886 +------------------------------------------------------------------------------+
2887 | | | | | | |
2887 | | | | | | |
2888 | node | p1 node | p2 node | base node | link node | flags |
2888 | node | p1 node | p2 node | base node | link node | flags |
2889 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
2889 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
2890 | | | | | | |
2890 | | | | | | |
2891 +------------------------------------------------------------------------------+
2891 +------------------------------------------------------------------------------+
2892 </pre>
2892 </pre>
2893 <p>
2893 <p>
2894 The *mdiff header* consists of 3 32-bit big-endian signed integers
2894 The *mdiff header* consists of 3 32-bit big-endian signed integers
2895 describing offsets at which to apply the following delta content:
2895 describing offsets at which to apply the following delta content:
2896 </p>
2896 </p>
2897 <pre>
2897 <pre>
2898 +-------------------------------------+
2898 +-------------------------------------+
2899 | | | |
2899 | | | |
2900 | offset | old length | new length |
2900 | offset | old length | new length |
2901 | (32 bits) | (32 bits) | (32 bits) |
2901 | (32 bits) | (32 bits) | (32 bits) |
2902 | | | |
2902 | | | |
2903 +-------------------------------------+
2903 +-------------------------------------+
2904 </pre>
2904 </pre>
2905 <p>
2905 <p>
2906 In version 1, the delta is always applied against the previous node from
2906 In version 1, the delta is always applied against the previous node from
2907 the changegroup or the first parent if this is the first entry in the
2907 the changegroup or the first parent if this is the first entry in the
2908 changegroup.
2908 changegroup.
2909 </p>
2909 </p>
2910 <p>
2910 <p>
2911 In version 2, the delta base node is encoded in the entry in the
2911 In version 2, the delta base node is encoded in the entry in the
2912 changegroup. This allows the delta to be expressed against any parent,
2912 changegroup. This allows the delta to be expressed against any parent,
2913 which can result in smaller deltas and more efficient encoding of data.
2913 which can result in smaller deltas and more efficient encoding of data.
2914 </p>
2914 </p>
2915 <h3>Changeset Segment</h3>
2915 <h3>Changeset Segment</h3>
2916 <p>
2916 <p>
2917 The *changeset segment* consists of a single *delta group* holding
2917 The *changeset segment* consists of a single *delta group* holding
2918 changelog data. It is followed by an *empty chunk* to denote the
2918 changelog data. It is followed by an *empty chunk* to denote the
2919 boundary to the *manifests segment*.
2919 boundary to the *manifests segment*.
2920 </p>
2920 </p>
2921 <h3>Manifest Segment</h3>
2921 <h3>Manifest Segment</h3>
2922 <p>
2922 <p>
2923 The *manifest segment* consists of a single *delta group* holding
2923 The *manifest segment* consists of a single *delta group* holding
2924 manifest data. It is followed by an *empty chunk* to denote the boundary
2924 manifest data. It is followed by an *empty chunk* to denote the boundary
2925 to the *filelogs segment*.
2925 to the *filelogs segment*.
2926 </p>
2926 </p>
2927 <h3>Filelogs Segment</h3>
2927 <h3>Filelogs Segment</h3>
2928 <p>
2928 <p>
2929 The *filelogs* segment consists of multiple sub-segments, each
2929 The *filelogs* segment consists of multiple sub-segments, each
2930 corresponding to an individual file whose data is being described:
2930 corresponding to an individual file whose data is being described:
2931 </p>
2931 </p>
2932 <pre>
2932 <pre>
2933 +--------------------------------------+
2933 +--------------------------------------+
2934 | | | | |
2934 | | | | |
2935 | filelog0 | filelog1 | filelog2 | ... |
2935 | filelog0 | filelog1 | filelog2 | ... |
2936 | | | | |
2936 | | | | |
2937 +--------------------------------------+
2937 +--------------------------------------+
2938 </pre>
2938 </pre>
2939 <p>
2939 <p>
2940 In version &quot;3&quot; of the changegroup format, filelogs may include
2940 In version &quot;3&quot; of the changegroup format, filelogs may include
2941 directory logs when treemanifests are in use. directory logs are
2941 directory logs when treemanifests are in use. directory logs are
2942 identified by having a trailing '/' on their filename (see below).
2942 identified by having a trailing '/' on their filename (see below).
2943 </p>
2943 </p>
2944 <p>
2944 <p>
2945 The final filelog sub-segment is followed by an *empty chunk* to denote
2945 The final filelog sub-segment is followed by an *empty chunk* to denote
2946 the end of the segment and the overall changegroup.
2946 the end of the segment and the overall changegroup.
2947 </p>
2947 </p>
2948 <p>
2948 <p>
2949 Each filelog sub-segment consists of the following:
2949 Each filelog sub-segment consists of the following:
2950 </p>
2950 </p>
2951 <pre>
2951 <pre>
2952 +------------------------------------------+
2952 +------------------------------------------+
2953 | | | |
2953 | | | |
2954 | filename size | filename | delta group |
2954 | filename size | filename | delta group |
2955 | (32 bits) | (various) | (various) |
2955 | (32 bits) | (various) | (various) |
2956 | | | |
2956 | | | |
2957 +------------------------------------------+
2957 +------------------------------------------+
2958 </pre>
2958 </pre>
2959 <p>
2959 <p>
2960 That is, a *chunk* consisting of the filename (not terminated or padded)
2960 That is, a *chunk* consisting of the filename (not terminated or padded)
2961 followed by N chunks constituting the *delta group* for this file.
2961 followed by N chunks constituting the *delta group* for this file.
2962 </p>
2962 </p>
2963
2963
2964 </div>
2964 </div>
2965 </div>
2965 </div>
2966 </div>
2966 </div>
2967
2967
2968 <script type="text/javascript">process_dates()</script>
2968 <script type="text/javascript">process_dates()</script>
2969
2969
2970
2970
2971 </body>
2971 </body>
2972 </html>
2972 </html>
2973
2973
2974
2974
2975 $ killdaemons.py
2975 $ killdaemons.py
2976
2976
2977 #endif
2977 #endif
@@ -1,2231 +1,2231
1 $ HGENCODING=utf-8
1 $ HGENCODING=utf-8
2 $ export HGENCODING
2 $ export HGENCODING
3 $ cat > testrevset.py << EOF
3 $ cat > testrevset.py << EOF
4 > import mercurial.revset
4 > import mercurial.revset
5 >
5 >
6 > baseset = mercurial.revset.baseset
6 > baseset = mercurial.revset.baseset
7 >
7 >
8 > def r3232(repo, subset, x):
8 > def r3232(repo, subset, x):
9 > """"simple revset that return [3,2,3,2]
9 > """"simple revset that return [3,2,3,2]
10 >
10 >
11 > revisions duplicated on purpose.
11 > revisions duplicated on purpose.
12 > """
12 > """
13 > if 3 not in subset:
13 > if 3 not in subset:
14 > if 2 in subset:
14 > if 2 in subset:
15 > return baseset([2,2])
15 > return baseset([2,2])
16 > return baseset()
16 > return baseset()
17 > return baseset([3,3,2,2])
17 > return baseset([3,3,2,2])
18 >
18 >
19 > mercurial.revset.symbols['r3232'] = r3232
19 > mercurial.revset.symbols['r3232'] = r3232
20 > EOF
20 > EOF
21 $ cat >> $HGRCPATH << EOF
21 $ cat >> $HGRCPATH << EOF
22 > [extensions]
22 > [extensions]
23 > testrevset=$TESTTMP/testrevset.py
23 > testrevset=$TESTTMP/testrevset.py
24 > EOF
24 > EOF
25
25
26 $ try() {
26 $ try() {
27 > hg debugrevspec --debug "$@"
27 > hg debugrevspec --debug "$@"
28 > }
28 > }
29
29
30 $ log() {
30 $ log() {
31 > hg log --template '{rev}\n' -r "$1"
31 > hg log --template '{rev}\n' -r "$1"
32 > }
32 > }
33
33
34 $ hg init repo
34 $ hg init repo
35 $ cd repo
35 $ cd repo
36
36
37 $ echo a > a
37 $ echo a > a
38 $ hg branch a
38 $ hg branch a
39 marked working directory as branch a
39 marked working directory as branch a
40 (branches are permanent and global, did you want a bookmark?)
40 (branches are permanent and global, did you want a bookmark?)
41 $ hg ci -Aqm0
41 $ hg ci -Aqm0
42
42
43 $ echo b > b
43 $ echo b > b
44 $ hg branch b
44 $ hg branch b
45 marked working directory as branch b
45 marked working directory as branch b
46 $ hg ci -Aqm1
46 $ hg ci -Aqm1
47
47
48 $ rm a
48 $ rm a
49 $ hg branch a-b-c-
49 $ hg branch a-b-c-
50 marked working directory as branch a-b-c-
50 marked working directory as branch a-b-c-
51 $ hg ci -Aqm2 -u Bob
51 $ hg ci -Aqm2 -u Bob
52
52
53 $ hg log -r "extra('branch', 'a-b-c-')" --template '{rev}\n'
53 $ hg log -r "extra('branch', 'a-b-c-')" --template '{rev}\n'
54 2
54 2
55 $ hg log -r "extra('branch')" --template '{rev}\n'
55 $ hg log -r "extra('branch')" --template '{rev}\n'
56 0
56 0
57 1
57 1
58 2
58 2
59 $ hg log -r "extra('branch', 're:a')" --template '{rev} {branch}\n'
59 $ hg log -r "extra('branch', 're:a')" --template '{rev} {branch}\n'
60 0 a
60 0 a
61 2 a-b-c-
61 2 a-b-c-
62
62
63 $ hg co 1
63 $ hg co 1
64 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
64 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
65 $ hg branch +a+b+c+
65 $ hg branch +a+b+c+
66 marked working directory as branch +a+b+c+
66 marked working directory as branch +a+b+c+
67 $ hg ci -Aqm3
67 $ hg ci -Aqm3
68
68
69 $ hg co 2 # interleave
69 $ hg co 2 # interleave
70 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
70 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
71 $ echo bb > b
71 $ echo bb > b
72 $ hg branch -- -a-b-c-
72 $ hg branch -- -a-b-c-
73 marked working directory as branch -a-b-c-
73 marked working directory as branch -a-b-c-
74 $ hg ci -Aqm4 -d "May 12 2005"
74 $ hg ci -Aqm4 -d "May 12 2005"
75
75
76 $ hg co 3
76 $ hg co 3
77 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
77 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
78 $ hg branch !a/b/c/
78 $ hg branch !a/b/c/
79 marked working directory as branch !a/b/c/
79 marked working directory as branch !a/b/c/
80 $ hg ci -Aqm"5 bug"
80 $ hg ci -Aqm"5 bug"
81
81
82 $ hg merge 4
82 $ hg merge 4
83 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
83 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
84 (branch merge, don't forget to commit)
84 (branch merge, don't forget to commit)
85 $ hg branch _a_b_c_
85 $ hg branch _a_b_c_
86 marked working directory as branch _a_b_c_
86 marked working directory as branch _a_b_c_
87 $ hg ci -Aqm"6 issue619"
87 $ hg ci -Aqm"6 issue619"
88
88
89 $ hg branch .a.b.c.
89 $ hg branch .a.b.c.
90 marked working directory as branch .a.b.c.
90 marked working directory as branch .a.b.c.
91 $ hg ci -Aqm7
91 $ hg ci -Aqm7
92
92
93 $ hg branch all
93 $ hg branch all
94 marked working directory as branch all
94 marked working directory as branch all
95
95
96 $ hg co 4
96 $ hg co 4
97 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
97 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
98 $ hg branch Γ©
98 $ hg branch Γ©
99 marked working directory as branch \xc3\xa9 (esc)
99 marked working directory as branch \xc3\xa9 (esc)
100 $ hg ci -Aqm9
100 $ hg ci -Aqm9
101
101
102 $ hg tag -r6 1.0
102 $ hg tag -r6 1.0
103 $ hg bookmark -r6 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
103 $ hg bookmark -r6 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
104
104
105 $ hg clone --quiet -U -r 7 . ../remote1
105 $ hg clone --quiet -U -r 7 . ../remote1
106 $ hg clone --quiet -U -r 8 . ../remote2
106 $ hg clone --quiet -U -r 8 . ../remote2
107 $ echo "[paths]" >> .hg/hgrc
107 $ echo "[paths]" >> .hg/hgrc
108 $ echo "default = ../remote1" >> .hg/hgrc
108 $ echo "default = ../remote1" >> .hg/hgrc
109
109
110 trivial
110 trivial
111
111
112 $ try 0:1
112 $ try 0:1
113 (range
113 (range
114 ('symbol', '0')
114 ('symbol', '0')
115 ('symbol', '1'))
115 ('symbol', '1'))
116 * set:
116 * set:
117 <spanset+ 0:1>
117 <spanset+ 0:1>
118 0
118 0
119 1
119 1
120 $ try --optimize :
120 $ try --optimize :
121 (rangeall
121 (rangeall
122 None)
122 None)
123 * optimized:
123 * optimized:
124 (range
124 (range
125 ('string', '0')
125 ('string', '0')
126 ('string', 'tip'))
126 ('string', 'tip'))
127 * set:
127 * set:
128 <spanset+ 0:9>
128 <spanset+ 0:9>
129 0
129 0
130 1
130 1
131 2
131 2
132 3
132 3
133 4
133 4
134 5
134 5
135 6
135 6
136 7
136 7
137 8
137 8
138 9
138 9
139 $ try 3::6
139 $ try 3::6
140 (dagrange
140 (dagrange
141 ('symbol', '3')
141 ('symbol', '3')
142 ('symbol', '6'))
142 ('symbol', '6'))
143 * set:
143 * set:
144 <baseset+ [3, 5, 6]>
144 <baseset+ [3, 5, 6]>
145 3
145 3
146 5
146 5
147 6
147 6
148 $ try '0|1|2'
148 $ try '0|1|2'
149 (or
149 (or
150 ('symbol', '0')
150 ('symbol', '0')
151 ('symbol', '1')
151 ('symbol', '1')
152 ('symbol', '2'))
152 ('symbol', '2'))
153 * set:
153 * set:
154 <baseset [0, 1, 2]>
154 <baseset [0, 1, 2]>
155 0
155 0
156 1
156 1
157 2
157 2
158
158
159 names that should work without quoting
159 names that should work without quoting
160
160
161 $ try a
161 $ try a
162 ('symbol', 'a')
162 ('symbol', 'a')
163 * set:
163 * set:
164 <baseset [0]>
164 <baseset [0]>
165 0
165 0
166 $ try b-a
166 $ try b-a
167 (minus
167 (minus
168 ('symbol', 'b')
168 ('symbol', 'b')
169 ('symbol', 'a'))
169 ('symbol', 'a'))
170 * set:
170 * set:
171 <filteredset
171 <filteredset
172 <baseset [1]>>
172 <baseset [1]>>
173 1
173 1
174 $ try _a_b_c_
174 $ try _a_b_c_
175 ('symbol', '_a_b_c_')
175 ('symbol', '_a_b_c_')
176 * set:
176 * set:
177 <baseset [6]>
177 <baseset [6]>
178 6
178 6
179 $ try _a_b_c_-a
179 $ try _a_b_c_-a
180 (minus
180 (minus
181 ('symbol', '_a_b_c_')
181 ('symbol', '_a_b_c_')
182 ('symbol', 'a'))
182 ('symbol', 'a'))
183 * set:
183 * set:
184 <filteredset
184 <filteredset
185 <baseset [6]>>
185 <baseset [6]>>
186 6
186 6
187 $ try .a.b.c.
187 $ try .a.b.c.
188 ('symbol', '.a.b.c.')
188 ('symbol', '.a.b.c.')
189 * set:
189 * set:
190 <baseset [7]>
190 <baseset [7]>
191 7
191 7
192 $ try .a.b.c.-a
192 $ try .a.b.c.-a
193 (minus
193 (minus
194 ('symbol', '.a.b.c.')
194 ('symbol', '.a.b.c.')
195 ('symbol', 'a'))
195 ('symbol', 'a'))
196 * set:
196 * set:
197 <filteredset
197 <filteredset
198 <baseset [7]>>
198 <baseset [7]>>
199 7
199 7
200
200
201 names that should be caught by fallback mechanism
201 names that should be caught by fallback mechanism
202
202
203 $ try -- '-a-b-c-'
203 $ try -- '-a-b-c-'
204 ('symbol', '-a-b-c-')
204 ('symbol', '-a-b-c-')
205 * set:
205 * set:
206 <baseset [4]>
206 <baseset [4]>
207 4
207 4
208 $ log -a-b-c-
208 $ log -a-b-c-
209 4
209 4
210 $ try '+a+b+c+'
210 $ try '+a+b+c+'
211 ('symbol', '+a+b+c+')
211 ('symbol', '+a+b+c+')
212 * set:
212 * set:
213 <baseset [3]>
213 <baseset [3]>
214 3
214 3
215 $ try '+a+b+c+:'
215 $ try '+a+b+c+:'
216 (rangepost
216 (rangepost
217 ('symbol', '+a+b+c+'))
217 ('symbol', '+a+b+c+'))
218 * set:
218 * set:
219 <spanset+ 3:9>
219 <spanset+ 3:9>
220 3
220 3
221 4
221 4
222 5
222 5
223 6
223 6
224 7
224 7
225 8
225 8
226 9
226 9
227 $ try ':+a+b+c+'
227 $ try ':+a+b+c+'
228 (rangepre
228 (rangepre
229 ('symbol', '+a+b+c+'))
229 ('symbol', '+a+b+c+'))
230 * set:
230 * set:
231 <spanset+ 0:3>
231 <spanset+ 0:3>
232 0
232 0
233 1
233 1
234 2
234 2
235 3
235 3
236 $ try -- '-a-b-c-:+a+b+c+'
236 $ try -- '-a-b-c-:+a+b+c+'
237 (range
237 (range
238 ('symbol', '-a-b-c-')
238 ('symbol', '-a-b-c-')
239 ('symbol', '+a+b+c+'))
239 ('symbol', '+a+b+c+'))
240 * set:
240 * set:
241 <spanset- 3:4>
241 <spanset- 3:4>
242 4
242 4
243 3
243 3
244 $ log '-a-b-c-:+a+b+c+'
244 $ log '-a-b-c-:+a+b+c+'
245 4
245 4
246 3
246 3
247
247
248 $ try -- -a-b-c--a # complains
248 $ try -- -a-b-c--a # complains
249 (minus
249 (minus
250 (minus
250 (minus
251 (minus
251 (minus
252 (negate
252 (negate
253 ('symbol', 'a'))
253 ('symbol', 'a'))
254 ('symbol', 'b'))
254 ('symbol', 'b'))
255 ('symbol', 'c'))
255 ('symbol', 'c'))
256 (negate
256 (negate
257 ('symbol', 'a')))
257 ('symbol', 'a')))
258 abort: unknown revision '-a'!
258 abort: unknown revision '-a'!
259 [255]
259 [255]
260 $ try Γ©
260 $ try Γ©
261 ('symbol', '\xc3\xa9')
261 ('symbol', '\xc3\xa9')
262 * set:
262 * set:
263 <baseset [9]>
263 <baseset [9]>
264 9
264 9
265
265
266 no quoting needed
266 no quoting needed
267
267
268 $ log ::a-b-c-
268 $ log ::a-b-c-
269 0
269 0
270 1
270 1
271 2
271 2
272
272
273 quoting needed
273 quoting needed
274
274
275 $ try '"-a-b-c-"-a'
275 $ try '"-a-b-c-"-a'
276 (minus
276 (minus
277 ('string', '-a-b-c-')
277 ('string', '-a-b-c-')
278 ('symbol', 'a'))
278 ('symbol', 'a'))
279 * set:
279 * set:
280 <filteredset
280 <filteredset
281 <baseset [4]>>
281 <baseset [4]>>
282 4
282 4
283
283
284 $ log '1 or 2'
284 $ log '1 or 2'
285 1
285 1
286 2
286 2
287 $ log '1|2'
287 $ log '1|2'
288 1
288 1
289 2
289 2
290 $ log '1 and 2'
290 $ log '1 and 2'
291 $ log '1&2'
291 $ log '1&2'
292 $ try '1&2|3' # precedence - and is higher
292 $ try '1&2|3' # precedence - and is higher
293 (or
293 (or
294 (and
294 (and
295 ('symbol', '1')
295 ('symbol', '1')
296 ('symbol', '2'))
296 ('symbol', '2'))
297 ('symbol', '3'))
297 ('symbol', '3'))
298 * set:
298 * set:
299 <addset
299 <addset
300 <baseset []>,
300 <baseset []>,
301 <baseset [3]>>
301 <baseset [3]>>
302 3
302 3
303 $ try '1|2&3'
303 $ try '1|2&3'
304 (or
304 (or
305 ('symbol', '1')
305 ('symbol', '1')
306 (and
306 (and
307 ('symbol', '2')
307 ('symbol', '2')
308 ('symbol', '3')))
308 ('symbol', '3')))
309 * set:
309 * set:
310 <addset
310 <addset
311 <baseset [1]>,
311 <baseset [1]>,
312 <baseset []>>
312 <baseset []>>
313 1
313 1
314 $ try '1&2&3' # associativity
314 $ try '1&2&3' # associativity
315 (and
315 (and
316 (and
316 (and
317 ('symbol', '1')
317 ('symbol', '1')
318 ('symbol', '2'))
318 ('symbol', '2'))
319 ('symbol', '3'))
319 ('symbol', '3'))
320 * set:
320 * set:
321 <baseset []>
321 <baseset []>
322 $ try '1|(2|3)'
322 $ try '1|(2|3)'
323 (or
323 (or
324 ('symbol', '1')
324 ('symbol', '1')
325 (group
325 (group
326 (or
326 (or
327 ('symbol', '2')
327 ('symbol', '2')
328 ('symbol', '3'))))
328 ('symbol', '3'))))
329 * set:
329 * set:
330 <addset
330 <addset
331 <baseset [1]>,
331 <baseset [1]>,
332 <baseset [2, 3]>>
332 <baseset [2, 3]>>
333 1
333 1
334 2
334 2
335 3
335 3
336 $ log '1.0' # tag
336 $ log '1.0' # tag
337 6
337 6
338 $ log 'a' # branch
338 $ log 'a' # branch
339 0
339 0
340 $ log '2785f51ee'
340 $ log '2785f51ee'
341 0
341 0
342 $ log 'date(2005)'
342 $ log 'date(2005)'
343 4
343 4
344 $ log 'date(this is a test)'
344 $ log 'date(this is a test)'
345 hg: parse error at 10: unexpected token: symbol
345 hg: parse error at 10: unexpected token: symbol
346 [255]
346 [255]
347 $ log 'date()'
347 $ log 'date()'
348 hg: parse error: date requires a string
348 hg: parse error: date requires a string
349 [255]
349 [255]
350 $ log 'date'
350 $ log 'date'
351 abort: unknown revision 'date'!
351 abort: unknown revision 'date'!
352 [255]
352 [255]
353 $ log 'date('
353 $ log 'date('
354 hg: parse error at 5: not a prefix: end
354 hg: parse error at 5: not a prefix: end
355 [255]
355 [255]
356 $ log 'date("\xy")'
356 $ log 'date("\xy")'
357 hg: parse error: invalid \x escape
357 hg: parse error: invalid \x escape
358 [255]
358 [255]
359 $ log 'date(tip)'
359 $ log 'date(tip)'
360 abort: invalid date: 'tip'
360 abort: invalid date: 'tip'
361 [255]
361 [255]
362 $ log '0:date'
362 $ log '0:date'
363 abort: unknown revision 'date'!
363 abort: unknown revision 'date'!
364 [255]
364 [255]
365 $ log '::"date"'
365 $ log '::"date"'
366 abort: unknown revision 'date'!
366 abort: unknown revision 'date'!
367 [255]
367 [255]
368 $ hg book date -r 4
368 $ hg book date -r 4
369 $ log '0:date'
369 $ log '0:date'
370 0
370 0
371 1
371 1
372 2
372 2
373 3
373 3
374 4
374 4
375 $ log '::date'
375 $ log '::date'
376 0
376 0
377 1
377 1
378 2
378 2
379 4
379 4
380 $ log '::"date"'
380 $ log '::"date"'
381 0
381 0
382 1
382 1
383 2
383 2
384 4
384 4
385 $ log 'date(2005) and 1::'
385 $ log 'date(2005) and 1::'
386 4
386 4
387 $ hg book -d date
387 $ hg book -d date
388
388
389 keyword arguments
389 keyword arguments
390
390
391 $ log 'extra(branch, value=a)'
391 $ log 'extra(branch, value=a)'
392 0
392 0
393
393
394 $ log 'extra(branch, a, b)'
394 $ log 'extra(branch, a, b)'
395 hg: parse error: extra takes at most 2 arguments
395 hg: parse error: extra takes at most 2 arguments
396 [255]
396 [255]
397 $ log 'extra(a, label=b)'
397 $ log 'extra(a, label=b)'
398 hg: parse error: extra got multiple values for keyword argument 'label'
398 hg: parse error: extra got multiple values for keyword argument 'label'
399 [255]
399 [255]
400 $ log 'extra(label=branch, default)'
400 $ log 'extra(label=branch, default)'
401 hg: parse error: extra got an invalid argument
401 hg: parse error: extra got an invalid argument
402 [255]
402 [255]
403 $ log 'extra(branch, foo+bar=baz)'
403 $ log 'extra(branch, foo+bar=baz)'
404 hg: parse error: extra got an invalid argument
404 hg: parse error: extra got an invalid argument
405 [255]
405 [255]
406 $ log 'extra(unknown=branch)'
406 $ log 'extra(unknown=branch)'
407 hg: parse error: extra got an unexpected keyword argument 'unknown'
407 hg: parse error: extra got an unexpected keyword argument 'unknown'
408 [255]
408 [255]
409
409
410 $ try 'foo=bar|baz'
410 $ try 'foo=bar|baz'
411 (keyvalue
411 (keyvalue
412 ('symbol', 'foo')
412 ('symbol', 'foo')
413 (or
413 (or
414 ('symbol', 'bar')
414 ('symbol', 'bar')
415 ('symbol', 'baz')))
415 ('symbol', 'baz')))
416 hg: parse error: can't use a key-value pair in this context
416 hg: parse error: can't use a key-value pair in this context
417 [255]
417 [255]
418
418
419 Test that symbols only get parsed as functions if there's an opening
419 Test that symbols only get parsed as functions if there's an opening
420 parenthesis.
420 parenthesis.
421
421
422 $ hg book only -r 9
422 $ hg book only -r 9
423 $ log 'only(only)' # Outer "only" is a function, inner "only" is the bookmark
423 $ log 'only(only)' # Outer "only" is a function, inner "only" is the bookmark
424 8
424 8
425 9
425 9
426
426
427 ancestor can accept 0 or more arguments
427 ancestor can accept 0 or more arguments
428
428
429 $ log 'ancestor()'
429 $ log 'ancestor()'
430 $ log 'ancestor(1)'
430 $ log 'ancestor(1)'
431 1
431 1
432 $ log 'ancestor(4,5)'
432 $ log 'ancestor(4,5)'
433 1
433 1
434 $ log 'ancestor(4,5) and 4'
434 $ log 'ancestor(4,5) and 4'
435 $ log 'ancestor(0,0,1,3)'
435 $ log 'ancestor(0,0,1,3)'
436 0
436 0
437 $ log 'ancestor(3,1,5,3,5,1)'
437 $ log 'ancestor(3,1,5,3,5,1)'
438 1
438 1
439 $ log 'ancestor(0,1,3,5)'
439 $ log 'ancestor(0,1,3,5)'
440 0
440 0
441 $ log 'ancestor(1,2,3,4,5)'
441 $ log 'ancestor(1,2,3,4,5)'
442 1
442 1
443
443
444 test ancestors
444 test ancestors
445
445
446 $ log 'ancestors(5)'
446 $ log 'ancestors(5)'
447 0
447 0
448 1
448 1
449 3
449 3
450 5
450 5
451 $ log 'ancestor(ancestors(5))'
451 $ log 'ancestor(ancestors(5))'
452 0
452 0
453 $ log '::r3232()'
453 $ log '::r3232()'
454 0
454 0
455 1
455 1
456 2
456 2
457 3
457 3
458
458
459 $ log 'author(bob)'
459 $ log 'author(bob)'
460 2
460 2
461 $ log 'author("re:bob|test")'
461 $ log 'author("re:bob|test")'
462 0
462 0
463 1
463 1
464 2
464 2
465 3
465 3
466 4
466 4
467 5
467 5
468 6
468 6
469 7
469 7
470 8
470 8
471 9
471 9
472 $ log 'branch(Γ©)'
472 $ log 'branch(Γ©)'
473 8
473 8
474 9
474 9
475 $ log 'branch(a)'
475 $ log 'branch(a)'
476 0
476 0
477 $ hg log -r 'branch("re:a")' --template '{rev} {branch}\n'
477 $ hg log -r 'branch("re:a")' --template '{rev} {branch}\n'
478 0 a
478 0 a
479 2 a-b-c-
479 2 a-b-c-
480 3 +a+b+c+
480 3 +a+b+c+
481 4 -a-b-c-
481 4 -a-b-c-
482 5 !a/b/c/
482 5 !a/b/c/
483 6 _a_b_c_
483 6 _a_b_c_
484 7 .a.b.c.
484 7 .a.b.c.
485 $ log 'children(ancestor(4,5))'
485 $ log 'children(ancestor(4,5))'
486 2
486 2
487 3
487 3
488 $ log 'closed()'
488 $ log 'closed()'
489 $ log 'contains(a)'
489 $ log 'contains(a)'
490 0
490 0
491 1
491 1
492 3
492 3
493 5
493 5
494 $ log 'contains("../repo/a")'
494 $ log 'contains("../repo/a")'
495 0
495 0
496 1
496 1
497 3
497 3
498 5
498 5
499 $ log 'desc(B)'
499 $ log 'desc(B)'
500 5
500 5
501 $ log 'descendants(2 or 3)'
501 $ log 'descendants(2 or 3)'
502 2
502 2
503 3
503 3
504 4
504 4
505 5
505 5
506 6
506 6
507 7
507 7
508 8
508 8
509 9
509 9
510 $ log 'file("b*")'
510 $ log 'file("b*")'
511 1
511 1
512 4
512 4
513 $ log 'filelog("b")'
513 $ log 'filelog("b")'
514 1
514 1
515 4
515 4
516 $ log 'filelog("../repo/b")'
516 $ log 'filelog("../repo/b")'
517 1
517 1
518 4
518 4
519 $ log 'follow()'
519 $ log 'follow()'
520 0
520 0
521 1
521 1
522 2
522 2
523 4
523 4
524 8
524 8
525 9
525 9
526 $ log 'grep("issue\d+")'
526 $ log 'grep("issue\d+")'
527 6
527 6
528 $ try 'grep("(")' # invalid regular expression
528 $ try 'grep("(")' # invalid regular expression
529 (func
529 (func
530 ('symbol', 'grep')
530 ('symbol', 'grep')
531 ('string', '('))
531 ('string', '('))
532 hg: parse error: invalid match pattern: unbalanced parenthesis
532 hg: parse error: invalid match pattern: unbalanced parenthesis
533 [255]
533 [255]
534 $ try 'grep("\bissue\d+")'
534 $ try 'grep("\bissue\d+")'
535 (func
535 (func
536 ('symbol', 'grep')
536 ('symbol', 'grep')
537 ('string', '\x08issue\\d+'))
537 ('string', '\x08issue\\d+'))
538 * set:
538 * set:
539 <filteredset
539 <filteredset
540 <fullreposet+ 0:9>>
540 <fullreposet+ 0:9>>
541 $ try 'grep(r"\bissue\d+")'
541 $ try 'grep(r"\bissue\d+")'
542 (func
542 (func
543 ('symbol', 'grep')
543 ('symbol', 'grep')
544 ('string', '\\bissue\\d+'))
544 ('string', '\\bissue\\d+'))
545 * set:
545 * set:
546 <filteredset
546 <filteredset
547 <fullreposet+ 0:9>>
547 <fullreposet+ 0:9>>
548 6
548 6
549 $ try 'grep(r"\")'
549 $ try 'grep(r"\")'
550 hg: parse error at 7: unterminated string
550 hg: parse error at 7: unterminated string
551 [255]
551 [255]
552 $ log 'head()'
552 $ log 'head()'
553 0
553 0
554 1
554 1
555 2
555 2
556 3
556 3
557 4
557 4
558 5
558 5
559 6
559 6
560 7
560 7
561 9
561 9
562 $ log 'heads(6::)'
562 $ log 'heads(6::)'
563 7
563 7
564 $ log 'keyword(issue)'
564 $ log 'keyword(issue)'
565 6
565 6
566 $ log 'keyword("test a")'
566 $ log 'keyword("test a")'
567 $ log 'limit(head(), 1)'
567 $ log 'limit(head(), 1)'
568 0
568 0
569 $ log 'limit(author("re:bob|test"), 3, 5)'
569 $ log 'limit(author("re:bob|test"), 3, 5)'
570 5
570 5
571 6
571 6
572 7
572 7
573 $ log 'limit(author("re:bob|test"), offset=6)'
573 $ log 'limit(author("re:bob|test"), offset=6)'
574 6
574 6
575 $ log 'limit(author("re:bob|test"), offset=10)'
575 $ log 'limit(author("re:bob|test"), offset=10)'
576 $ log 'limit(all(), 1, -1)'
576 $ log 'limit(all(), 1, -1)'
577 hg: parse error: negative offset
577 hg: parse error: negative offset
578 [255]
578 [255]
579 $ log 'matching(6)'
579 $ log 'matching(6)'
580 6
580 6
581 $ log 'matching(6:7, "phase parents user date branch summary files description substate")'
581 $ log 'matching(6:7, "phase parents user date branch summary files description substate")'
582 6
582 6
583 7
583 7
584
584
585 Testing min and max
585 Testing min and max
586
586
587 max: simple
587 max: simple
588
588
589 $ log 'max(contains(a))'
589 $ log 'max(contains(a))'
590 5
590 5
591
591
592 max: simple on unordered set)
592 max: simple on unordered set)
593
593
594 $ log 'max((4+0+2+5+7) and contains(a))'
594 $ log 'max((4+0+2+5+7) and contains(a))'
595 5
595 5
596
596
597 max: no result
597 max: no result
598
598
599 $ log 'max(contains(stringthatdoesnotappearanywhere))'
599 $ log 'max(contains(stringthatdoesnotappearanywhere))'
600
600
601 max: no result on unordered set
601 max: no result on unordered set
602
602
603 $ log 'max((4+0+2+5+7) and contains(stringthatdoesnotappearanywhere))'
603 $ log 'max((4+0+2+5+7) and contains(stringthatdoesnotappearanywhere))'
604
604
605 min: simple
605 min: simple
606
606
607 $ log 'min(contains(a))'
607 $ log 'min(contains(a))'
608 0
608 0
609
609
610 min: simple on unordered set
610 min: simple on unordered set
611
611
612 $ log 'min((4+0+2+5+7) and contains(a))'
612 $ log 'min((4+0+2+5+7) and contains(a))'
613 0
613 0
614
614
615 min: empty
615 min: empty
616
616
617 $ log 'min(contains(stringthatdoesnotappearanywhere))'
617 $ log 'min(contains(stringthatdoesnotappearanywhere))'
618
618
619 min: empty on unordered set
619 min: empty on unordered set
620
620
621 $ log 'min((4+0+2+5+7) and contains(stringthatdoesnotappearanywhere))'
621 $ log 'min((4+0+2+5+7) and contains(stringthatdoesnotappearanywhere))'
622
622
623
623
624 $ log 'merge()'
624 $ log 'merge()'
625 6
625 6
626 $ log 'branchpoint()'
626 $ log 'branchpoint()'
627 1
627 1
628 4
628 4
629 $ log 'modifies(b)'
629 $ log 'modifies(b)'
630 4
630 4
631 $ log 'modifies("path:b")'
631 $ log 'modifies("path:b")'
632 4
632 4
633 $ log 'modifies("*")'
633 $ log 'modifies("*")'
634 4
634 4
635 6
635 6
636 $ log 'modifies("set:modified()")'
636 $ log 'modifies("set:modified()")'
637 4
637 4
638 $ log 'id(5)'
638 $ log 'id(5)'
639 2
639 2
640 $ log 'only(9)'
640 $ log 'only(9)'
641 8
641 8
642 9
642 9
643 $ log 'only(8)'
643 $ log 'only(8)'
644 8
644 8
645 $ log 'only(9, 5)'
645 $ log 'only(9, 5)'
646 2
646 2
647 4
647 4
648 8
648 8
649 9
649 9
650 $ log 'only(7 + 9, 5 + 2)'
650 $ log 'only(7 + 9, 5 + 2)'
651 4
651 4
652 6
652 6
653 7
653 7
654 8
654 8
655 9
655 9
656
656
657 Test empty set input
657 Test empty set input
658 $ log 'only(p2())'
658 $ log 'only(p2())'
659 $ log 'only(p1(), p2())'
659 $ log 'only(p1(), p2())'
660 0
660 0
661 1
661 1
662 2
662 2
663 4
663 4
664 8
664 8
665 9
665 9
666
666
667 Test '%' operator
667 Test '%' operator
668
668
669 $ log '9%'
669 $ log '9%'
670 8
670 8
671 9
671 9
672 $ log '9%5'
672 $ log '9%5'
673 2
673 2
674 4
674 4
675 8
675 8
676 9
676 9
677 $ log '(7 + 9)%(5 + 2)'
677 $ log '(7 + 9)%(5 + 2)'
678 4
678 4
679 6
679 6
680 7
680 7
681 8
681 8
682 9
682 9
683
683
684 Test opreand of '%' is optimized recursively (issue4670)
684 Test opreand of '%' is optimized recursively (issue4670)
685
685
686 $ try --optimize '8:9-8%'
686 $ try --optimize '8:9-8%'
687 (onlypost
687 (onlypost
688 (minus
688 (minus
689 (range
689 (range
690 ('symbol', '8')
690 ('symbol', '8')
691 ('symbol', '9'))
691 ('symbol', '9'))
692 ('symbol', '8')))
692 ('symbol', '8')))
693 * optimized:
693 * optimized:
694 (func
694 (func
695 ('symbol', 'only')
695 ('symbol', 'only')
696 (and
696 (and
697 (range
697 (range
698 ('symbol', '8')
698 ('symbol', '8')
699 ('symbol', '9'))
699 ('symbol', '9'))
700 (not
700 (not
701 ('symbol', '8'))))
701 ('symbol', '8'))))
702 * set:
702 * set:
703 <baseset+ [8, 9]>
703 <baseset+ [8, 9]>
704 8
704 8
705 9
705 9
706 $ try --optimize '(9)%(5)'
706 $ try --optimize '(9)%(5)'
707 (only
707 (only
708 (group
708 (group
709 ('symbol', '9'))
709 ('symbol', '9'))
710 (group
710 (group
711 ('symbol', '5')))
711 ('symbol', '5')))
712 * optimized:
712 * optimized:
713 (func
713 (func
714 ('symbol', 'only')
714 ('symbol', 'only')
715 (list
715 (list
716 ('symbol', '9')
716 ('symbol', '9')
717 ('symbol', '5')))
717 ('symbol', '5')))
718 * set:
718 * set:
719 <baseset+ [8, 9, 2, 4]>
719 <baseset+ [8, 9, 2, 4]>
720 2
720 2
721 4
721 4
722 8
722 8
723 9
723 9
724
724
725 Test the order of operations
725 Test the order of operations
726
726
727 $ log '7 + 9%5 + 2'
727 $ log '7 + 9%5 + 2'
728 7
728 7
729 2
729 2
730 4
730 4
731 8
731 8
732 9
732 9
733
733
734 Test explicit numeric revision
734 Test explicit numeric revision
735 $ log 'rev(-2)'
735 $ log 'rev(-2)'
736 $ log 'rev(-1)'
736 $ log 'rev(-1)'
737 -1
737 -1
738 $ log 'rev(0)'
738 $ log 'rev(0)'
739 0
739 0
740 $ log 'rev(9)'
740 $ log 'rev(9)'
741 9
741 9
742 $ log 'rev(10)'
742 $ log 'rev(10)'
743 $ log 'rev(tip)'
743 $ log 'rev(tip)'
744 hg: parse error: rev expects a number
744 hg: parse error: rev expects a number
745 [255]
745 [255]
746
746
747 Test hexadecimal revision
747 Test hexadecimal revision
748 $ log 'id(2)'
748 $ log 'id(2)'
749 abort: 00changelog.i@2: ambiguous identifier!
749 abort: 00changelog.i@2: ambiguous identifier!
750 [255]
750 [255]
751 $ log 'id(23268)'
751 $ log 'id(23268)'
752 4
752 4
753 $ log 'id(2785f51eece)'
753 $ log 'id(2785f51eece)'
754 0
754 0
755 $ log 'id(d5d0dcbdc4d9ff5dbb2d336f32f0bb561c1a532c)'
755 $ log 'id(d5d0dcbdc4d9ff5dbb2d336f32f0bb561c1a532c)'
756 8
756 8
757 $ log 'id(d5d0dcbdc4a)'
757 $ log 'id(d5d0dcbdc4a)'
758 $ log 'id(d5d0dcbdc4w)'
758 $ log 'id(d5d0dcbdc4w)'
759 $ log 'id(d5d0dcbdc4d9ff5dbb2d336f32f0bb561c1a532d)'
759 $ log 'id(d5d0dcbdc4d9ff5dbb2d336f32f0bb561c1a532d)'
760 $ log 'id(d5d0dcbdc4d9ff5dbb2d336f32f0bb561c1a532q)'
760 $ log 'id(d5d0dcbdc4d9ff5dbb2d336f32f0bb561c1a532q)'
761 $ log 'id(1.0)'
761 $ log 'id(1.0)'
762 $ log 'id(xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)'
762 $ log 'id(xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)'
763
763
764 Test null revision
764 Test null revision
765 $ log '(null)'
765 $ log '(null)'
766 -1
766 -1
767 $ log '(null:0)'
767 $ log '(null:0)'
768 -1
768 -1
769 0
769 0
770 $ log '(0:null)'
770 $ log '(0:null)'
771 0
771 0
772 -1
772 -1
773 $ log 'null::0'
773 $ log 'null::0'
774 -1
774 -1
775 0
775 0
776 $ log 'null:tip - 0:'
776 $ log 'null:tip - 0:'
777 -1
777 -1
778 $ log 'null: and null::' | head -1
778 $ log 'null: and null::' | head -1
779 -1
779 -1
780 $ log 'null: or 0:' | head -2
780 $ log 'null: or 0:' | head -2
781 -1
781 -1
782 0
782 0
783 $ log 'ancestors(null)'
783 $ log 'ancestors(null)'
784 -1
784 -1
785 $ log 'reverse(null:)' | tail -2
785 $ log 'reverse(null:)' | tail -2
786 0
786 0
787 -1
787 -1
788 BROKEN: should be '-1'
788 BROKEN: should be '-1'
789 $ log 'first(null:)'
789 $ log 'first(null:)'
790 BROKEN: should be '-1'
790 BROKEN: should be '-1'
791 $ log 'min(null:)'
791 $ log 'min(null:)'
792 $ log 'tip:null and all()' | tail -2
792 $ log 'tip:null and all()' | tail -2
793 1
793 1
794 0
794 0
795
795
796 Test working-directory revision
796 Test working-directory revision
797 $ hg debugrevspec 'wdir()'
797 $ hg debugrevspec 'wdir()'
798 2147483647
798 2147483647
799 $ hg debugrevspec 'tip or wdir()'
799 $ hg debugrevspec 'tip or wdir()'
800 9
800 9
801 2147483647
801 2147483647
802 $ hg debugrevspec '0:tip and wdir()'
802 $ hg debugrevspec '0:tip and wdir()'
803 $ log '0:wdir()' | tail -3
803 $ log '0:wdir()' | tail -3
804 8
804 8
805 9
805 9
806 2147483647
806 2147483647
807 $ log 'wdir():0' | head -3
807 $ log 'wdir():0' | head -3
808 2147483647
808 2147483647
809 9
809 9
810 8
810 8
811 $ log 'wdir():wdir()'
811 $ log 'wdir():wdir()'
812 2147483647
812 2147483647
813 $ log '(all() + wdir()) & min(. + wdir())'
813 $ log '(all() + wdir()) & min(. + wdir())'
814 9
814 9
815 $ log '(all() + wdir()) & max(. + wdir())'
815 $ log '(all() + wdir()) & max(. + wdir())'
816 2147483647
816 2147483647
817 $ log '(all() + wdir()) & first(wdir() + .)'
817 $ log '(all() + wdir()) & first(wdir() + .)'
818 2147483647
818 2147483647
819 $ log '(all() + wdir()) & last(. + wdir())'
819 $ log '(all() + wdir()) & last(. + wdir())'
820 2147483647
820 2147483647
821
821
822 $ log 'outgoing()'
822 $ log 'outgoing()'
823 8
823 8
824 9
824 9
825 $ log 'outgoing("../remote1")'
825 $ log 'outgoing("../remote1")'
826 8
826 8
827 9
827 9
828 $ log 'outgoing("../remote2")'
828 $ log 'outgoing("../remote2")'
829 3
829 3
830 5
830 5
831 6
831 6
832 7
832 7
833 9
833 9
834 $ log 'p1(merge())'
834 $ log 'p1(merge())'
835 5
835 5
836 $ log 'p2(merge())'
836 $ log 'p2(merge())'
837 4
837 4
838 $ log 'parents(merge())'
838 $ log 'parents(merge())'
839 4
839 4
840 5
840 5
841 $ log 'p1(branchpoint())'
841 $ log 'p1(branchpoint())'
842 0
842 0
843 2
843 2
844 $ log 'p2(branchpoint())'
844 $ log 'p2(branchpoint())'
845 $ log 'parents(branchpoint())'
845 $ log 'parents(branchpoint())'
846 0
846 0
847 2
847 2
848 $ log 'removes(a)'
848 $ log 'removes(a)'
849 2
849 2
850 6
850 6
851 $ log 'roots(all())'
851 $ log 'roots(all())'
852 0
852 0
853 $ log 'reverse(2 or 3 or 4 or 5)'
853 $ log 'reverse(2 or 3 or 4 or 5)'
854 5
854 5
855 4
855 4
856 3
856 3
857 2
857 2
858 $ log 'reverse(all())'
858 $ log 'reverse(all())'
859 9
859 9
860 8
860 8
861 7
861 7
862 6
862 6
863 5
863 5
864 4
864 4
865 3
865 3
866 2
866 2
867 1
867 1
868 0
868 0
869 $ log 'reverse(all()) & filelog(b)'
869 $ log 'reverse(all()) & filelog(b)'
870 4
870 4
871 1
871 1
872 $ log 'rev(5)'
872 $ log 'rev(5)'
873 5
873 5
874 $ log 'sort(limit(reverse(all()), 3))'
874 $ log 'sort(limit(reverse(all()), 3))'
875 7
875 7
876 8
876 8
877 9
877 9
878 $ log 'sort(2 or 3 or 4 or 5, date)'
878 $ log 'sort(2 or 3 or 4 or 5, date)'
879 2
879 2
880 3
880 3
881 5
881 5
882 4
882 4
883 $ log 'tagged()'
883 $ log 'tagged()'
884 6
884 6
885 $ log 'tag()'
885 $ log 'tag()'
886 6
886 6
887 $ log 'tag(1.0)'
887 $ log 'tag(1.0)'
888 6
888 6
889 $ log 'tag(tip)'
889 $ log 'tag(tip)'
890 9
890 9
891
891
892 test sort revset
892 test sort revset
893 --------------------------------------------
893 --------------------------------------------
894
894
895 test when adding two unordered revsets
895 test when adding two unordered revsets
896
896
897 $ log 'sort(keyword(issue) or modifies(b))'
897 $ log 'sort(keyword(issue) or modifies(b))'
898 4
898 4
899 6
899 6
900
900
901 test when sorting a reversed collection in the same way it is
901 test when sorting a reversed collection in the same way it is
902
902
903 $ log 'sort(reverse(all()), -rev)'
903 $ log 'sort(reverse(all()), -rev)'
904 9
904 9
905 8
905 8
906 7
906 7
907 6
907 6
908 5
908 5
909 4
909 4
910 3
910 3
911 2
911 2
912 1
912 1
913 0
913 0
914
914
915 test when sorting a reversed collection
915 test when sorting a reversed collection
916
916
917 $ log 'sort(reverse(all()), rev)'
917 $ log 'sort(reverse(all()), rev)'
918 0
918 0
919 1
919 1
920 2
920 2
921 3
921 3
922 4
922 4
923 5
923 5
924 6
924 6
925 7
925 7
926 8
926 8
927 9
927 9
928
928
929
929
930 test sorting two sorted collections in different orders
930 test sorting two sorted collections in different orders
931
931
932 $ log 'sort(outgoing() or reverse(removes(a)), rev)'
932 $ log 'sort(outgoing() or reverse(removes(a)), rev)'
933 2
933 2
934 6
934 6
935 8
935 8
936 9
936 9
937
937
938 test sorting two sorted collections in different orders backwards
938 test sorting two sorted collections in different orders backwards
939
939
940 $ log 'sort(outgoing() or reverse(removes(a)), -rev)'
940 $ log 'sort(outgoing() or reverse(removes(a)), -rev)'
941 9
941 9
942 8
942 8
943 6
943 6
944 2
944 2
945
945
946 test subtracting something from an addset
946 test subtracting something from an addset
947
947
948 $ log '(outgoing() or removes(a)) - removes(a)'
948 $ log '(outgoing() or removes(a)) - removes(a)'
949 8
949 8
950 9
950 9
951
951
952 test intersecting something with an addset
952 test intersecting something with an addset
953
953
954 $ log 'parents(outgoing() or removes(a))'
954 $ log 'parents(outgoing() or removes(a))'
955 1
955 1
956 4
956 4
957 5
957 5
958 8
958 8
959
959
960 test that `or` operation combines elements in the right order:
960 test that `or` operation combines elements in the right order:
961
961
962 $ log '3:4 or 2:5'
962 $ log '3:4 or 2:5'
963 3
963 3
964 4
964 4
965 2
965 2
966 5
966 5
967 $ log '3:4 or 5:2'
967 $ log '3:4 or 5:2'
968 3
968 3
969 4
969 4
970 5
970 5
971 2
971 2
972 $ log 'sort(3:4 or 2:5)'
972 $ log 'sort(3:4 or 2:5)'
973 2
973 2
974 3
974 3
975 4
975 4
976 5
976 5
977 $ log 'sort(3:4 or 5:2)'
977 $ log 'sort(3:4 or 5:2)'
978 2
978 2
979 3
979 3
980 4
980 4
981 5
981 5
982
982
983 test that more than one `-r`s are combined in the right order and deduplicated:
983 test that more than one `-r`s are combined in the right order and deduplicated:
984
984
985 $ hg log -T '{rev}\n' -r 3 -r 3 -r 4 -r 5:2 -r 'ancestors(4)'
985 $ hg log -T '{rev}\n' -r 3 -r 3 -r 4 -r 5:2 -r 'ancestors(4)'
986 3
986 3
987 4
987 4
988 5
988 5
989 2
989 2
990 0
990 0
991 1
991 1
992
992
993 test that `or` operation skips duplicated revisions from right-hand side
993 test that `or` operation skips duplicated revisions from right-hand side
994
994
995 $ try 'reverse(1::5) or ancestors(4)'
995 $ try 'reverse(1::5) or ancestors(4)'
996 (or
996 (or
997 (func
997 (func
998 ('symbol', 'reverse')
998 ('symbol', 'reverse')
999 (dagrange
999 (dagrange
1000 ('symbol', '1')
1000 ('symbol', '1')
1001 ('symbol', '5')))
1001 ('symbol', '5')))
1002 (func
1002 (func
1003 ('symbol', 'ancestors')
1003 ('symbol', 'ancestors')
1004 ('symbol', '4')))
1004 ('symbol', '4')))
1005 * set:
1005 * set:
1006 <addset
1006 <addset
1007 <baseset- [1, 3, 5]>,
1007 <baseset- [1, 3, 5]>,
1008 <generatorset+>>
1008 <generatorset+>>
1009 5
1009 5
1010 3
1010 3
1011 1
1011 1
1012 0
1012 0
1013 2
1013 2
1014 4
1014 4
1015 $ try 'sort(ancestors(4) or reverse(1::5))'
1015 $ try 'sort(ancestors(4) or reverse(1::5))'
1016 (func
1016 (func
1017 ('symbol', 'sort')
1017 ('symbol', 'sort')
1018 (or
1018 (or
1019 (func
1019 (func
1020 ('symbol', 'ancestors')
1020 ('symbol', 'ancestors')
1021 ('symbol', '4'))
1021 ('symbol', '4'))
1022 (func
1022 (func
1023 ('symbol', 'reverse')
1023 ('symbol', 'reverse')
1024 (dagrange
1024 (dagrange
1025 ('symbol', '1')
1025 ('symbol', '1')
1026 ('symbol', '5')))))
1026 ('symbol', '5')))))
1027 * set:
1027 * set:
1028 <addset+
1028 <addset+
1029 <generatorset+>,
1029 <generatorset+>,
1030 <baseset- [1, 3, 5]>>
1030 <baseset- [1, 3, 5]>>
1031 0
1031 0
1032 1
1032 1
1033 2
1033 2
1034 3
1034 3
1035 4
1035 4
1036 5
1036 5
1037
1037
1038 test optimization of trivial `or` operation
1038 test optimization of trivial `or` operation
1039
1039
1040 $ try --optimize '0|(1)|"2"|-2|tip|null'
1040 $ try --optimize '0|(1)|"2"|-2|tip|null'
1041 (or
1041 (or
1042 ('symbol', '0')
1042 ('symbol', '0')
1043 (group
1043 (group
1044 ('symbol', '1'))
1044 ('symbol', '1'))
1045 ('string', '2')
1045 ('string', '2')
1046 (negate
1046 (negate
1047 ('symbol', '2'))
1047 ('symbol', '2'))
1048 ('symbol', 'tip')
1048 ('symbol', 'tip')
1049 ('symbol', 'null'))
1049 ('symbol', 'null'))
1050 * optimized:
1050 * optimized:
1051 (func
1051 (func
1052 ('symbol', '_list')
1052 ('symbol', '_list')
1053 ('string', '0\x001\x002\x00-2\x00tip\x00null'))
1053 ('string', '0\x001\x002\x00-2\x00tip\x00null'))
1054 * set:
1054 * set:
1055 <baseset [0, 1, 2, 8, 9, -1]>
1055 <baseset [0, 1, 2, 8, 9, -1]>
1056 0
1056 0
1057 1
1057 1
1058 2
1058 2
1059 8
1059 8
1060 9
1060 9
1061 -1
1061 -1
1062
1062
1063 $ try --optimize '0|1|2:3'
1063 $ try --optimize '0|1|2:3'
1064 (or
1064 (or
1065 ('symbol', '0')
1065 ('symbol', '0')
1066 ('symbol', '1')
1066 ('symbol', '1')
1067 (range
1067 (range
1068 ('symbol', '2')
1068 ('symbol', '2')
1069 ('symbol', '3')))
1069 ('symbol', '3')))
1070 * optimized:
1070 * optimized:
1071 (or
1071 (or
1072 (func
1072 (func
1073 ('symbol', '_list')
1073 ('symbol', '_list')
1074 ('string', '0\x001'))
1074 ('string', '0\x001'))
1075 (range
1075 (range
1076 ('symbol', '2')
1076 ('symbol', '2')
1077 ('symbol', '3')))
1077 ('symbol', '3')))
1078 * set:
1078 * set:
1079 <addset
1079 <addset
1080 <baseset [0, 1]>,
1080 <baseset [0, 1]>,
1081 <spanset+ 2:3>>
1081 <spanset+ 2:3>>
1082 0
1082 0
1083 1
1083 1
1084 2
1084 2
1085 3
1085 3
1086
1086
1087 $ try --optimize '0:1|2|3:4|5|6'
1087 $ try --optimize '0:1|2|3:4|5|6'
1088 (or
1088 (or
1089 (range
1089 (range
1090 ('symbol', '0')
1090 ('symbol', '0')
1091 ('symbol', '1'))
1091 ('symbol', '1'))
1092 ('symbol', '2')
1092 ('symbol', '2')
1093 (range
1093 (range
1094 ('symbol', '3')
1094 ('symbol', '3')
1095 ('symbol', '4'))
1095 ('symbol', '4'))
1096 ('symbol', '5')
1096 ('symbol', '5')
1097 ('symbol', '6'))
1097 ('symbol', '6'))
1098 * optimized:
1098 * optimized:
1099 (or
1099 (or
1100 (range
1100 (range
1101 ('symbol', '0')
1101 ('symbol', '0')
1102 ('symbol', '1'))
1102 ('symbol', '1'))
1103 ('symbol', '2')
1103 ('symbol', '2')
1104 (range
1104 (range
1105 ('symbol', '3')
1105 ('symbol', '3')
1106 ('symbol', '4'))
1106 ('symbol', '4'))
1107 (func
1107 (func
1108 ('symbol', '_list')
1108 ('symbol', '_list')
1109 ('string', '5\x006')))
1109 ('string', '5\x006')))
1110 * set:
1110 * set:
1111 <addset
1111 <addset
1112 <addset
1112 <addset
1113 <spanset+ 0:1>,
1113 <spanset+ 0:1>,
1114 <baseset [2]>>,
1114 <baseset [2]>>,
1115 <addset
1115 <addset
1116 <spanset+ 3:4>,
1116 <spanset+ 3:4>,
1117 <baseset [5, 6]>>>
1117 <baseset [5, 6]>>>
1118 0
1118 0
1119 1
1119 1
1120 2
1120 2
1121 3
1121 3
1122 4
1122 4
1123 5
1123 5
1124 6
1124 6
1125
1125
1126 test that `_list` should be narrowed by provided `subset`
1126 test that `_list` should be narrowed by provided `subset`
1127
1127
1128 $ log '0:2 and (null|1|2|3)'
1128 $ log '0:2 and (null|1|2|3)'
1129 1
1129 1
1130 2
1130 2
1131
1131
1132 test that `_list` should remove duplicates
1132 test that `_list` should remove duplicates
1133
1133
1134 $ log '0|1|2|1|2|-1|tip'
1134 $ log '0|1|2|1|2|-1|tip'
1135 0
1135 0
1136 1
1136 1
1137 2
1137 2
1138 9
1138 9
1139
1139
1140 test unknown revision in `_list`
1140 test unknown revision in `_list`
1141
1141
1142 $ log '0|unknown'
1142 $ log '0|unknown'
1143 abort: unknown revision 'unknown'!
1143 abort: unknown revision 'unknown'!
1144 [255]
1144 [255]
1145
1145
1146 test integer range in `_list`
1146 test integer range in `_list`
1147
1147
1148 $ log '-1|-10'
1148 $ log '-1|-10'
1149 9
1149 9
1150 0
1150 0
1151
1151
1152 $ log '-10|-11'
1152 $ log '-10|-11'
1153 abort: unknown revision '-11'!
1153 abort: unknown revision '-11'!
1154 [255]
1154 [255]
1155
1155
1156 $ log '9|10'
1156 $ log '9|10'
1157 abort: unknown revision '10'!
1157 abort: unknown revision '10'!
1158 [255]
1158 [255]
1159
1159
1160 test '0000' != '0' in `_list`
1160 test '0000' != '0' in `_list`
1161
1161
1162 $ log '0|0000'
1162 $ log '0|0000'
1163 0
1163 0
1164 -1
1164 -1
1165
1165
1166 test ',' in `_list`
1166 test ',' in `_list`
1167 $ log '0,1'
1167 $ log '0,1'
1168 hg: parse error: can't use a list in this context
1168 hg: parse error: can't use a list in this context
1169 (see hg help "revsets.x or y")
1169 (see hg help "revsets.x or y")
1170 [255]
1170 [255]
1171
1171
1172 test that chained `or` operations make balanced addsets
1172 test that chained `or` operations make balanced addsets
1173
1173
1174 $ try '0:1|1:2|2:3|3:4|4:5'
1174 $ try '0:1|1:2|2:3|3:4|4:5'
1175 (or
1175 (or
1176 (range
1176 (range
1177 ('symbol', '0')
1177 ('symbol', '0')
1178 ('symbol', '1'))
1178 ('symbol', '1'))
1179 (range
1179 (range
1180 ('symbol', '1')
1180 ('symbol', '1')
1181 ('symbol', '2'))
1181 ('symbol', '2'))
1182 (range
1182 (range
1183 ('symbol', '2')
1183 ('symbol', '2')
1184 ('symbol', '3'))
1184 ('symbol', '3'))
1185 (range
1185 (range
1186 ('symbol', '3')
1186 ('symbol', '3')
1187 ('symbol', '4'))
1187 ('symbol', '4'))
1188 (range
1188 (range
1189 ('symbol', '4')
1189 ('symbol', '4')
1190 ('symbol', '5')))
1190 ('symbol', '5')))
1191 * set:
1191 * set:
1192 <addset
1192 <addset
1193 <addset
1193 <addset
1194 <spanset+ 0:1>,
1194 <spanset+ 0:1>,
1195 <spanset+ 1:2>>,
1195 <spanset+ 1:2>>,
1196 <addset
1196 <addset
1197 <spanset+ 2:3>,
1197 <spanset+ 2:3>,
1198 <addset
1198 <addset
1199 <spanset+ 3:4>,
1199 <spanset+ 3:4>,
1200 <spanset+ 4:5>>>>
1200 <spanset+ 4:5>>>>
1201 0
1201 0
1202 1
1202 1
1203 2
1203 2
1204 3
1204 3
1205 4
1205 4
1206 5
1206 5
1207
1207
1208 no crash by empty group "()" while optimizing `or` operations
1208 no crash by empty group "()" while optimizing `or` operations
1209
1209
1210 $ try --optimize '0|()'
1210 $ try --optimize '0|()'
1211 (or
1211 (or
1212 ('symbol', '0')
1212 ('symbol', '0')
1213 (group
1213 (group
1214 None))
1214 None))
1215 * optimized:
1215 * optimized:
1216 (or
1216 (or
1217 ('symbol', '0')
1217 ('symbol', '0')
1218 None)
1218 None)
1219 hg: parse error: missing argument
1219 hg: parse error: missing argument
1220 [255]
1220 [255]
1221
1221
1222 test that chained `or` operations never eat up stack (issue4624)
1222 test that chained `or` operations never eat up stack (issue4624)
1223 (uses `0:1` instead of `0` to avoid future optimization of trivial revisions)
1223 (uses `0:1` instead of `0` to avoid future optimization of trivial revisions)
1224
1224
1225 $ hg log -T '{rev}\n' -r "`python -c "print '|'.join(['0:1'] * 500)"`"
1225 $ hg log -T '{rev}\n' -r "`python -c "print '|'.join(['0:1'] * 500)"`"
1226 0
1226 0
1227 1
1227 1
1228
1228
1229 test that repeated `-r` options never eat up stack (issue4565)
1229 test that repeated `-r` options never eat up stack (issue4565)
1230 (uses `-r 0::1` to avoid possible optimization at old-style parser)
1230 (uses `-r 0::1` to avoid possible optimization at old-style parser)
1231
1231
1232 $ hg log -T '{rev}\n' `python -c "for i in xrange(500): print '-r 0::1 ',"`
1232 $ hg log -T '{rev}\n' `python -c "for i in xrange(500): print '-r 0::1 ',"`
1233 0
1233 0
1234 1
1234 1
1235
1235
1236 check that conversion to only works
1236 check that conversion to only works
1237 $ try --optimize '::3 - ::1'
1237 $ try --optimize '::3 - ::1'
1238 (minus
1238 (minus
1239 (dagrangepre
1239 (dagrangepre
1240 ('symbol', '3'))
1240 ('symbol', '3'))
1241 (dagrangepre
1241 (dagrangepre
1242 ('symbol', '1')))
1242 ('symbol', '1')))
1243 * optimized:
1243 * optimized:
1244 (func
1244 (func
1245 ('symbol', 'only')
1245 ('symbol', 'only')
1246 (list
1246 (list
1247 ('symbol', '3')
1247 ('symbol', '3')
1248 ('symbol', '1')))
1248 ('symbol', '1')))
1249 * set:
1249 * set:
1250 <baseset+ [3]>
1250 <baseset+ [3]>
1251 3
1251 3
1252 $ try --optimize 'ancestors(1) - ancestors(3)'
1252 $ try --optimize 'ancestors(1) - ancestors(3)'
1253 (minus
1253 (minus
1254 (func
1254 (func
1255 ('symbol', 'ancestors')
1255 ('symbol', 'ancestors')
1256 ('symbol', '1'))
1256 ('symbol', '1'))
1257 (func
1257 (func
1258 ('symbol', 'ancestors')
1258 ('symbol', 'ancestors')
1259 ('symbol', '3')))
1259 ('symbol', '3')))
1260 * optimized:
1260 * optimized:
1261 (func
1261 (func
1262 ('symbol', 'only')
1262 ('symbol', 'only')
1263 (list
1263 (list
1264 ('symbol', '1')
1264 ('symbol', '1')
1265 ('symbol', '3')))
1265 ('symbol', '3')))
1266 * set:
1266 * set:
1267 <baseset+ []>
1267 <baseset+ []>
1268 $ try --optimize 'not ::2 and ::6'
1268 $ try --optimize 'not ::2 and ::6'
1269 (and
1269 (and
1270 (not
1270 (not
1271 (dagrangepre
1271 (dagrangepre
1272 ('symbol', '2')))
1272 ('symbol', '2')))
1273 (dagrangepre
1273 (dagrangepre
1274 ('symbol', '6')))
1274 ('symbol', '6')))
1275 * optimized:
1275 * optimized:
1276 (func
1276 (func
1277 ('symbol', 'only')
1277 ('symbol', 'only')
1278 (list
1278 (list
1279 ('symbol', '6')
1279 ('symbol', '6')
1280 ('symbol', '2')))
1280 ('symbol', '2')))
1281 * set:
1281 * set:
1282 <baseset+ [3, 4, 5, 6]>
1282 <baseset+ [3, 4, 5, 6]>
1283 3
1283 3
1284 4
1284 4
1285 5
1285 5
1286 6
1286 6
1287 $ try --optimize 'ancestors(6) and not ancestors(4)'
1287 $ try --optimize 'ancestors(6) and not ancestors(4)'
1288 (and
1288 (and
1289 (func
1289 (func
1290 ('symbol', 'ancestors')
1290 ('symbol', 'ancestors')
1291 ('symbol', '6'))
1291 ('symbol', '6'))
1292 (not
1292 (not
1293 (func
1293 (func
1294 ('symbol', 'ancestors')
1294 ('symbol', 'ancestors')
1295 ('symbol', '4'))))
1295 ('symbol', '4'))))
1296 * optimized:
1296 * optimized:
1297 (func
1297 (func
1298 ('symbol', 'only')
1298 ('symbol', 'only')
1299 (list
1299 (list
1300 ('symbol', '6')
1300 ('symbol', '6')
1301 ('symbol', '4')))
1301 ('symbol', '4')))
1302 * set:
1302 * set:
1303 <baseset+ [3, 5, 6]>
1303 <baseset+ [3, 5, 6]>
1304 3
1304 3
1305 5
1305 5
1306 6
1306 6
1307
1307
1308 no crash by empty group "()" while optimizing to "only()"
1308 no crash by empty group "()" while optimizing to "only()"
1309
1309
1310 $ try --optimize '::1 and ()'
1310 $ try --optimize '::1 and ()'
1311 (and
1311 (and
1312 (dagrangepre
1312 (dagrangepre
1313 ('symbol', '1'))
1313 ('symbol', '1'))
1314 (group
1314 (group
1315 None))
1315 None))
1316 * optimized:
1316 * optimized:
1317 (and
1317 (and
1318 None
1318 None
1319 (func
1319 (func
1320 ('symbol', 'ancestors')
1320 ('symbol', 'ancestors')
1321 ('symbol', '1')))
1321 ('symbol', '1')))
1322 hg: parse error: missing argument
1322 hg: parse error: missing argument
1323 [255]
1323 [255]
1324
1324
1325 we can use patterns when searching for tags
1325 we can use patterns when searching for tags
1326
1326
1327 $ log 'tag("1..*")'
1327 $ log 'tag("1..*")'
1328 abort: tag '1..*' does not exist!
1328 abort: tag '1..*' does not exist!
1329 [255]
1329 [255]
1330 $ log 'tag("re:1..*")'
1330 $ log 'tag("re:1..*")'
1331 6
1331 6
1332 $ log 'tag("re:[0-9].[0-9]")'
1332 $ log 'tag("re:[0-9].[0-9]")'
1333 6
1333 6
1334 $ log 'tag("literal:1.0")'
1334 $ log 'tag("literal:1.0")'
1335 6
1335 6
1336 $ log 'tag("re:0..*")'
1336 $ log 'tag("re:0..*")'
1337
1337
1338 $ log 'tag(unknown)'
1338 $ log 'tag(unknown)'
1339 abort: tag 'unknown' does not exist!
1339 abort: tag 'unknown' does not exist!
1340 [255]
1340 [255]
1341 $ log 'tag("re:unknown")'
1341 $ log 'tag("re:unknown")'
1342 $ log 'present(tag("unknown"))'
1342 $ log 'present(tag("unknown"))'
1343 $ log 'present(tag("re:unknown"))'
1343 $ log 'present(tag("re:unknown"))'
1344 $ log 'branch(unknown)'
1344 $ log 'branch(unknown)'
1345 abort: unknown revision 'unknown'!
1345 abort: unknown revision 'unknown'!
1346 [255]
1346 [255]
1347 $ log 'branch("literal:unknown")'
1347 $ log 'branch("literal:unknown")'
1348 abort: branch 'unknown' does not exist!
1348 abort: branch 'unknown' does not exist!
1349 [255]
1349 [255]
1350 $ log 'branch("re:unknown")'
1350 $ log 'branch("re:unknown")'
1351 $ log 'present(branch("unknown"))'
1351 $ log 'present(branch("unknown"))'
1352 $ log 'present(branch("re:unknown"))'
1352 $ log 'present(branch("re:unknown"))'
1353 $ log 'user(bob)'
1353 $ log 'user(bob)'
1354 2
1354 2
1355
1355
1356 $ log '4::8'
1356 $ log '4::8'
1357 4
1357 4
1358 8
1358 8
1359 $ log '4:8'
1359 $ log '4:8'
1360 4
1360 4
1361 5
1361 5
1362 6
1362 6
1363 7
1363 7
1364 8
1364 8
1365
1365
1366 $ log 'sort(!merge() & (modifies(b) | user(bob) | keyword(bug) | keyword(issue) & 1::9), "-date")'
1366 $ log 'sort(!merge() & (modifies(b) | user(bob) | keyword(bug) | keyword(issue) & 1::9), "-date")'
1367 4
1367 4
1368 2
1368 2
1369 5
1369 5
1370
1370
1371 $ log 'not 0 and 0:2'
1371 $ log 'not 0 and 0:2'
1372 1
1372 1
1373 2
1373 2
1374 $ log 'not 1 and 0:2'
1374 $ log 'not 1 and 0:2'
1375 0
1375 0
1376 2
1376 2
1377 $ log 'not 2 and 0:2'
1377 $ log 'not 2 and 0:2'
1378 0
1378 0
1379 1
1379 1
1380 $ log '(1 and 2)::'
1380 $ log '(1 and 2)::'
1381 $ log '(1 and 2):'
1381 $ log '(1 and 2):'
1382 $ log '(1 and 2):3'
1382 $ log '(1 and 2):3'
1383 $ log 'sort(head(), -rev)'
1383 $ log 'sort(head(), -rev)'
1384 9
1384 9
1385 7
1385 7
1386 6
1386 6
1387 5
1387 5
1388 4
1388 4
1389 3
1389 3
1390 2
1390 2
1391 1
1391 1
1392 0
1392 0
1393 $ log '4::8 - 8'
1393 $ log '4::8 - 8'
1394 4
1394 4
1395 $ log 'matching(1 or 2 or 3) and (2 or 3 or 1)'
1395 $ log 'matching(1 or 2 or 3) and (2 or 3 or 1)'
1396 2
1396 2
1397 3
1397 3
1398 1
1398 1
1399
1399
1400 $ log 'named("unknown")'
1400 $ log 'named("unknown")'
1401 abort: namespace 'unknown' does not exist!
1401 abort: namespace 'unknown' does not exist!
1402 [255]
1402 [255]
1403 $ log 'named("re:unknown")'
1403 $ log 'named("re:unknown")'
1404 abort: no namespace exists that match 'unknown'!
1404 abort: no namespace exists that match 'unknown'!
1405 [255]
1405 [255]
1406 $ log 'present(named("unknown"))'
1406 $ log 'present(named("unknown"))'
1407 $ log 'present(named("re:unknown"))'
1407 $ log 'present(named("re:unknown"))'
1408
1408
1409 $ log 'tag()'
1409 $ log 'tag()'
1410 6
1410 6
1411 $ log 'named("tags")'
1411 $ log 'named("tags")'
1412 6
1412 6
1413
1413
1414 issue2437
1414 issue2437
1415
1415
1416 $ log '3 and p1(5)'
1416 $ log '3 and p1(5)'
1417 3
1417 3
1418 $ log '4 and p2(6)'
1418 $ log '4 and p2(6)'
1419 4
1419 4
1420 $ log '1 and parents(:2)'
1420 $ log '1 and parents(:2)'
1421 1
1421 1
1422 $ log '2 and children(1:)'
1422 $ log '2 and children(1:)'
1423 2
1423 2
1424 $ log 'roots(all()) or roots(all())'
1424 $ log 'roots(all()) or roots(all())'
1425 0
1425 0
1426 $ hg debugrevspec 'roots(all()) or roots(all())'
1426 $ hg debugrevspec 'roots(all()) or roots(all())'
1427 0
1427 0
1428 $ log 'heads(branch(Γ©)) or heads(branch(Γ©))'
1428 $ log 'heads(branch(Γ©)) or heads(branch(Γ©))'
1429 9
1429 9
1430 $ log 'ancestors(8) and (heads(branch("-a-b-c-")) or heads(branch(Γ©)))'
1430 $ log 'ancestors(8) and (heads(branch("-a-b-c-")) or heads(branch(Γ©)))'
1431 4
1431 4
1432
1432
1433 issue2654: report a parse error if the revset was not completely parsed
1433 issue2654: report a parse error if the revset was not completely parsed
1434
1434
1435 $ log '1 OR 2'
1435 $ log '1 OR 2'
1436 hg: parse error at 2: invalid token
1436 hg: parse error at 2: invalid token
1437 [255]
1437 [255]
1438
1438
1439 or operator should preserve ordering:
1439 or operator should preserve ordering:
1440 $ log 'reverse(2::4) or tip'
1440 $ log 'reverse(2::4) or tip'
1441 4
1441 4
1442 2
1442 2
1443 9
1443 9
1444
1444
1445 parentrevspec
1445 parentrevspec
1446
1446
1447 $ log 'merge()^0'
1447 $ log 'merge()^0'
1448 6
1448 6
1449 $ log 'merge()^'
1449 $ log 'merge()^'
1450 5
1450 5
1451 $ log 'merge()^1'
1451 $ log 'merge()^1'
1452 5
1452 5
1453 $ log 'merge()^2'
1453 $ log 'merge()^2'
1454 4
1454 4
1455 $ log 'merge()^^'
1455 $ log 'merge()^^'
1456 3
1456 3
1457 $ log 'merge()^1^'
1457 $ log 'merge()^1^'
1458 3
1458 3
1459 $ log 'merge()^^^'
1459 $ log 'merge()^^^'
1460 1
1460 1
1461
1461
1462 $ log 'merge()~0'
1462 $ log 'merge()~0'
1463 6
1463 6
1464 $ log 'merge()~1'
1464 $ log 'merge()~1'
1465 5
1465 5
1466 $ log 'merge()~2'
1466 $ log 'merge()~2'
1467 3
1467 3
1468 $ log 'merge()~2^1'
1468 $ log 'merge()~2^1'
1469 1
1469 1
1470 $ log 'merge()~3'
1470 $ log 'merge()~3'
1471 1
1471 1
1472
1472
1473 $ log '(-3:tip)^'
1473 $ log '(-3:tip)^'
1474 4
1474 4
1475 6
1475 6
1476 8
1476 8
1477
1477
1478 $ log 'tip^foo'
1478 $ log 'tip^foo'
1479 hg: parse error: ^ expects a number 0, 1, or 2
1479 hg: parse error: ^ expects a number 0, 1, or 2
1480 [255]
1480 [255]
1481
1481
1482 Bogus function gets suggestions
1482 Bogus function gets suggestions
1483 $ log 'add()'
1483 $ log 'add()'
1484 hg: parse error: unknown identifier: add
1484 hg: parse error: unknown identifier: add
1485 (did you mean 'adds'?)
1485 (did you mean adds?)
1486 [255]
1486 [255]
1487 $ log 'added()'
1487 $ log 'added()'
1488 hg: parse error: unknown identifier: added
1488 hg: parse error: unknown identifier: added
1489 (did you mean 'adds'?)
1489 (did you mean adds?)
1490 [255]
1490 [255]
1491 $ log 'remo()'
1491 $ log 'remo()'
1492 hg: parse error: unknown identifier: remo
1492 hg: parse error: unknown identifier: remo
1493 (did you mean one of remote, removes?)
1493 (did you mean one of remote, removes?)
1494 [255]
1494 [255]
1495 $ log 'babar()'
1495 $ log 'babar()'
1496 hg: parse error: unknown identifier: babar
1496 hg: parse error: unknown identifier: babar
1497 [255]
1497 [255]
1498
1498
1499 Bogus function with a similar internal name doesn't suggest the internal name
1499 Bogus function with a similar internal name doesn't suggest the internal name
1500 $ log 'matches()'
1500 $ log 'matches()'
1501 hg: parse error: unknown identifier: matches
1501 hg: parse error: unknown identifier: matches
1502 (did you mean 'matching'?)
1502 (did you mean matching?)
1503 [255]
1503 [255]
1504
1504
1505 Undocumented functions aren't suggested as similar either
1505 Undocumented functions aren't suggested as similar either
1506 $ log 'wdir2()'
1506 $ log 'wdir2()'
1507 hg: parse error: unknown identifier: wdir2
1507 hg: parse error: unknown identifier: wdir2
1508 [255]
1508 [255]
1509
1509
1510 multiple revspecs
1510 multiple revspecs
1511
1511
1512 $ hg log -r 'tip~1:tip' -r 'tip~2:tip~1' --template '{rev}\n'
1512 $ hg log -r 'tip~1:tip' -r 'tip~2:tip~1' --template '{rev}\n'
1513 8
1513 8
1514 9
1514 9
1515 4
1515 4
1516 5
1516 5
1517 6
1517 6
1518 7
1518 7
1519
1519
1520 test usage in revpair (with "+")
1520 test usage in revpair (with "+")
1521
1521
1522 (real pair)
1522 (real pair)
1523
1523
1524 $ hg diff -r 'tip^^' -r 'tip'
1524 $ hg diff -r 'tip^^' -r 'tip'
1525 diff -r 2326846efdab -r 24286f4ae135 .hgtags
1525 diff -r 2326846efdab -r 24286f4ae135 .hgtags
1526 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1526 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1527 +++ b/.hgtags Thu Jan 01 00:00:00 1970 +0000
1527 +++ b/.hgtags Thu Jan 01 00:00:00 1970 +0000
1528 @@ -0,0 +1,1 @@
1528 @@ -0,0 +1,1 @@
1529 +e0cc66ef77e8b6f711815af4e001a6594fde3ba5 1.0
1529 +e0cc66ef77e8b6f711815af4e001a6594fde3ba5 1.0
1530 $ hg diff -r 'tip^^::tip'
1530 $ hg diff -r 'tip^^::tip'
1531 diff -r 2326846efdab -r 24286f4ae135 .hgtags
1531 diff -r 2326846efdab -r 24286f4ae135 .hgtags
1532 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1532 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1533 +++ b/.hgtags Thu Jan 01 00:00:00 1970 +0000
1533 +++ b/.hgtags Thu Jan 01 00:00:00 1970 +0000
1534 @@ -0,0 +1,1 @@
1534 @@ -0,0 +1,1 @@
1535 +e0cc66ef77e8b6f711815af4e001a6594fde3ba5 1.0
1535 +e0cc66ef77e8b6f711815af4e001a6594fde3ba5 1.0
1536
1536
1537 (single rev)
1537 (single rev)
1538
1538
1539 $ hg diff -r 'tip^' -r 'tip^'
1539 $ hg diff -r 'tip^' -r 'tip^'
1540 $ hg diff -r 'tip^:tip^'
1540 $ hg diff -r 'tip^:tip^'
1541
1541
1542 (single rev that does not looks like a range)
1542 (single rev that does not looks like a range)
1543
1543
1544 $ hg diff -r 'tip^::tip^ or tip^'
1544 $ hg diff -r 'tip^::tip^ or tip^'
1545 diff -r d5d0dcbdc4d9 .hgtags
1545 diff -r d5d0dcbdc4d9 .hgtags
1546 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1546 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1547 +++ b/.hgtags * (glob)
1547 +++ b/.hgtags * (glob)
1548 @@ -0,0 +1,1 @@
1548 @@ -0,0 +1,1 @@
1549 +e0cc66ef77e8b6f711815af4e001a6594fde3ba5 1.0
1549 +e0cc66ef77e8b6f711815af4e001a6594fde3ba5 1.0
1550 $ hg diff -r 'tip^ or tip^'
1550 $ hg diff -r 'tip^ or tip^'
1551 diff -r d5d0dcbdc4d9 .hgtags
1551 diff -r d5d0dcbdc4d9 .hgtags
1552 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1552 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1553 +++ b/.hgtags * (glob)
1553 +++ b/.hgtags * (glob)
1554 @@ -0,0 +1,1 @@
1554 @@ -0,0 +1,1 @@
1555 +e0cc66ef77e8b6f711815af4e001a6594fde3ba5 1.0
1555 +e0cc66ef77e8b6f711815af4e001a6594fde3ba5 1.0
1556
1556
1557 (no rev)
1557 (no rev)
1558
1558
1559 $ hg diff -r 'author("babar") or author("celeste")'
1559 $ hg diff -r 'author("babar") or author("celeste")'
1560 abort: empty revision range
1560 abort: empty revision range
1561 [255]
1561 [255]
1562
1562
1563 aliases:
1563 aliases:
1564
1564
1565 $ echo '[revsetalias]' >> .hg/hgrc
1565 $ echo '[revsetalias]' >> .hg/hgrc
1566 $ echo 'm = merge()' >> .hg/hgrc
1566 $ echo 'm = merge()' >> .hg/hgrc
1567 (revset aliases can override builtin revsets)
1567 (revset aliases can override builtin revsets)
1568 $ echo 'p2($1) = p1($1)' >> .hg/hgrc
1568 $ echo 'p2($1) = p1($1)' >> .hg/hgrc
1569 $ echo 'sincem = descendants(m)' >> .hg/hgrc
1569 $ echo 'sincem = descendants(m)' >> .hg/hgrc
1570 $ echo 'd($1) = reverse(sort($1, date))' >> .hg/hgrc
1570 $ echo 'd($1) = reverse(sort($1, date))' >> .hg/hgrc
1571 $ echo 'rs(ARG1, ARG2) = reverse(sort(ARG1, ARG2))' >> .hg/hgrc
1571 $ echo 'rs(ARG1, ARG2) = reverse(sort(ARG1, ARG2))' >> .hg/hgrc
1572 $ echo 'rs4(ARG1, ARGA, ARGB, ARG2) = reverse(sort(ARG1, ARG2))' >> .hg/hgrc
1572 $ echo 'rs4(ARG1, ARGA, ARGB, ARG2) = reverse(sort(ARG1, ARG2))' >> .hg/hgrc
1573
1573
1574 $ try m
1574 $ try m
1575 ('symbol', 'm')
1575 ('symbol', 'm')
1576 (func
1576 (func
1577 ('symbol', 'merge')
1577 ('symbol', 'merge')
1578 None)
1578 None)
1579 * set:
1579 * set:
1580 <filteredset
1580 <filteredset
1581 <fullreposet+ 0:9>>
1581 <fullreposet+ 0:9>>
1582 6
1582 6
1583
1583
1584 $ HGPLAIN=1
1584 $ HGPLAIN=1
1585 $ export HGPLAIN
1585 $ export HGPLAIN
1586 $ try m
1586 $ try m
1587 ('symbol', 'm')
1587 ('symbol', 'm')
1588 abort: unknown revision 'm'!
1588 abort: unknown revision 'm'!
1589 [255]
1589 [255]
1590
1590
1591 $ HGPLAINEXCEPT=revsetalias
1591 $ HGPLAINEXCEPT=revsetalias
1592 $ export HGPLAINEXCEPT
1592 $ export HGPLAINEXCEPT
1593 $ try m
1593 $ try m
1594 ('symbol', 'm')
1594 ('symbol', 'm')
1595 (func
1595 (func
1596 ('symbol', 'merge')
1596 ('symbol', 'merge')
1597 None)
1597 None)
1598 * set:
1598 * set:
1599 <filteredset
1599 <filteredset
1600 <fullreposet+ 0:9>>
1600 <fullreposet+ 0:9>>
1601 6
1601 6
1602
1602
1603 $ unset HGPLAIN
1603 $ unset HGPLAIN
1604 $ unset HGPLAINEXCEPT
1604 $ unset HGPLAINEXCEPT
1605
1605
1606 $ try 'p2(.)'
1606 $ try 'p2(.)'
1607 (func
1607 (func
1608 ('symbol', 'p2')
1608 ('symbol', 'p2')
1609 ('symbol', '.'))
1609 ('symbol', '.'))
1610 (func
1610 (func
1611 ('symbol', 'p1')
1611 ('symbol', 'p1')
1612 ('symbol', '.'))
1612 ('symbol', '.'))
1613 * set:
1613 * set:
1614 <baseset+ [8]>
1614 <baseset+ [8]>
1615 8
1615 8
1616
1616
1617 $ HGPLAIN=1
1617 $ HGPLAIN=1
1618 $ export HGPLAIN
1618 $ export HGPLAIN
1619 $ try 'p2(.)'
1619 $ try 'p2(.)'
1620 (func
1620 (func
1621 ('symbol', 'p2')
1621 ('symbol', 'p2')
1622 ('symbol', '.'))
1622 ('symbol', '.'))
1623 * set:
1623 * set:
1624 <baseset+ []>
1624 <baseset+ []>
1625
1625
1626 $ HGPLAINEXCEPT=revsetalias
1626 $ HGPLAINEXCEPT=revsetalias
1627 $ export HGPLAINEXCEPT
1627 $ export HGPLAINEXCEPT
1628 $ try 'p2(.)'
1628 $ try 'p2(.)'
1629 (func
1629 (func
1630 ('symbol', 'p2')
1630 ('symbol', 'p2')
1631 ('symbol', '.'))
1631 ('symbol', '.'))
1632 (func
1632 (func
1633 ('symbol', 'p1')
1633 ('symbol', 'p1')
1634 ('symbol', '.'))
1634 ('symbol', '.'))
1635 * set:
1635 * set:
1636 <baseset+ [8]>
1636 <baseset+ [8]>
1637 8
1637 8
1638
1638
1639 $ unset HGPLAIN
1639 $ unset HGPLAIN
1640 $ unset HGPLAINEXCEPT
1640 $ unset HGPLAINEXCEPT
1641
1641
1642 test alias recursion
1642 test alias recursion
1643
1643
1644 $ try sincem
1644 $ try sincem
1645 ('symbol', 'sincem')
1645 ('symbol', 'sincem')
1646 (func
1646 (func
1647 ('symbol', 'descendants')
1647 ('symbol', 'descendants')
1648 (func
1648 (func
1649 ('symbol', 'merge')
1649 ('symbol', 'merge')
1650 None))
1650 None))
1651 * set:
1651 * set:
1652 <addset+
1652 <addset+
1653 <filteredset
1653 <filteredset
1654 <fullreposet+ 0:9>>,
1654 <fullreposet+ 0:9>>,
1655 <generatorset+>>
1655 <generatorset+>>
1656 6
1656 6
1657 7
1657 7
1658
1658
1659 test infinite recursion
1659 test infinite recursion
1660
1660
1661 $ echo 'recurse1 = recurse2' >> .hg/hgrc
1661 $ echo 'recurse1 = recurse2' >> .hg/hgrc
1662 $ echo 'recurse2 = recurse1' >> .hg/hgrc
1662 $ echo 'recurse2 = recurse1' >> .hg/hgrc
1663 $ try recurse1
1663 $ try recurse1
1664 ('symbol', 'recurse1')
1664 ('symbol', 'recurse1')
1665 hg: parse error: infinite expansion of revset alias "recurse1" detected
1665 hg: parse error: infinite expansion of revset alias "recurse1" detected
1666 [255]
1666 [255]
1667
1667
1668 $ echo 'level1($1, $2) = $1 or $2' >> .hg/hgrc
1668 $ echo 'level1($1, $2) = $1 or $2' >> .hg/hgrc
1669 $ echo 'level2($1, $2) = level1($2, $1)' >> .hg/hgrc
1669 $ echo 'level2($1, $2) = level1($2, $1)' >> .hg/hgrc
1670 $ try "level2(level1(1, 2), 3)"
1670 $ try "level2(level1(1, 2), 3)"
1671 (func
1671 (func
1672 ('symbol', 'level2')
1672 ('symbol', 'level2')
1673 (list
1673 (list
1674 (func
1674 (func
1675 ('symbol', 'level1')
1675 ('symbol', 'level1')
1676 (list
1676 (list
1677 ('symbol', '1')
1677 ('symbol', '1')
1678 ('symbol', '2')))
1678 ('symbol', '2')))
1679 ('symbol', '3')))
1679 ('symbol', '3')))
1680 (or
1680 (or
1681 ('symbol', '3')
1681 ('symbol', '3')
1682 (or
1682 (or
1683 ('symbol', '1')
1683 ('symbol', '1')
1684 ('symbol', '2')))
1684 ('symbol', '2')))
1685 * set:
1685 * set:
1686 <addset
1686 <addset
1687 <baseset [3]>,
1687 <baseset [3]>,
1688 <baseset [1, 2]>>
1688 <baseset [1, 2]>>
1689 3
1689 3
1690 1
1690 1
1691 2
1691 2
1692
1692
1693 test nesting and variable passing
1693 test nesting and variable passing
1694
1694
1695 $ echo 'nested($1) = nested2($1)' >> .hg/hgrc
1695 $ echo 'nested($1) = nested2($1)' >> .hg/hgrc
1696 $ echo 'nested2($1) = nested3($1)' >> .hg/hgrc
1696 $ echo 'nested2($1) = nested3($1)' >> .hg/hgrc
1697 $ echo 'nested3($1) = max($1)' >> .hg/hgrc
1697 $ echo 'nested3($1) = max($1)' >> .hg/hgrc
1698 $ try 'nested(2:5)'
1698 $ try 'nested(2:5)'
1699 (func
1699 (func
1700 ('symbol', 'nested')
1700 ('symbol', 'nested')
1701 (range
1701 (range
1702 ('symbol', '2')
1702 ('symbol', '2')
1703 ('symbol', '5')))
1703 ('symbol', '5')))
1704 (func
1704 (func
1705 ('symbol', 'max')
1705 ('symbol', 'max')
1706 (range
1706 (range
1707 ('symbol', '2')
1707 ('symbol', '2')
1708 ('symbol', '5')))
1708 ('symbol', '5')))
1709 * set:
1709 * set:
1710 <baseset [5]>
1710 <baseset [5]>
1711 5
1711 5
1712
1712
1713 test chained `or` operations are flattened at parsing phase
1713 test chained `or` operations are flattened at parsing phase
1714
1714
1715 $ echo 'chainedorops($1, $2, $3) = $1|$2|$3' >> .hg/hgrc
1715 $ echo 'chainedorops($1, $2, $3) = $1|$2|$3' >> .hg/hgrc
1716 $ try 'chainedorops(0:1, 1:2, 2:3)'
1716 $ try 'chainedorops(0:1, 1:2, 2:3)'
1717 (func
1717 (func
1718 ('symbol', 'chainedorops')
1718 ('symbol', 'chainedorops')
1719 (list
1719 (list
1720 (list
1720 (list
1721 (range
1721 (range
1722 ('symbol', '0')
1722 ('symbol', '0')
1723 ('symbol', '1'))
1723 ('symbol', '1'))
1724 (range
1724 (range
1725 ('symbol', '1')
1725 ('symbol', '1')
1726 ('symbol', '2')))
1726 ('symbol', '2')))
1727 (range
1727 (range
1728 ('symbol', '2')
1728 ('symbol', '2')
1729 ('symbol', '3'))))
1729 ('symbol', '3'))))
1730 (or
1730 (or
1731 (range
1731 (range
1732 ('symbol', '0')
1732 ('symbol', '0')
1733 ('symbol', '1'))
1733 ('symbol', '1'))
1734 (range
1734 (range
1735 ('symbol', '1')
1735 ('symbol', '1')
1736 ('symbol', '2'))
1736 ('symbol', '2'))
1737 (range
1737 (range
1738 ('symbol', '2')
1738 ('symbol', '2')
1739 ('symbol', '3')))
1739 ('symbol', '3')))
1740 * set:
1740 * set:
1741 <addset
1741 <addset
1742 <spanset+ 0:1>,
1742 <spanset+ 0:1>,
1743 <addset
1743 <addset
1744 <spanset+ 1:2>,
1744 <spanset+ 1:2>,
1745 <spanset+ 2:3>>>
1745 <spanset+ 2:3>>>
1746 0
1746 0
1747 1
1747 1
1748 2
1748 2
1749 3
1749 3
1750
1750
1751 test variable isolation, variable placeholders are rewritten as string
1751 test variable isolation, variable placeholders are rewritten as string
1752 then parsed and matched again as string. Check they do not leak too
1752 then parsed and matched again as string. Check they do not leak too
1753 far away.
1753 far away.
1754
1754
1755 $ echo 'injectparamasstring = max("$1")' >> .hg/hgrc
1755 $ echo 'injectparamasstring = max("$1")' >> .hg/hgrc
1756 $ echo 'callinjection($1) = descendants(injectparamasstring)' >> .hg/hgrc
1756 $ echo 'callinjection($1) = descendants(injectparamasstring)' >> .hg/hgrc
1757 $ try 'callinjection(2:5)'
1757 $ try 'callinjection(2:5)'
1758 (func
1758 (func
1759 ('symbol', 'callinjection')
1759 ('symbol', 'callinjection')
1760 (range
1760 (range
1761 ('symbol', '2')
1761 ('symbol', '2')
1762 ('symbol', '5')))
1762 ('symbol', '5')))
1763 (func
1763 (func
1764 ('symbol', 'descendants')
1764 ('symbol', 'descendants')
1765 (func
1765 (func
1766 ('symbol', 'max')
1766 ('symbol', 'max')
1767 ('string', '$1')))
1767 ('string', '$1')))
1768 abort: unknown revision '$1'!
1768 abort: unknown revision '$1'!
1769 [255]
1769 [255]
1770
1770
1771 $ echo 'injectparamasstring2 = max(_aliasarg("$1"))' >> .hg/hgrc
1771 $ echo 'injectparamasstring2 = max(_aliasarg("$1"))' >> .hg/hgrc
1772 $ echo 'callinjection2($1) = descendants(injectparamasstring2)' >> .hg/hgrc
1772 $ echo 'callinjection2($1) = descendants(injectparamasstring2)' >> .hg/hgrc
1773 $ try 'callinjection2(2:5)'
1773 $ try 'callinjection2(2:5)'
1774 (func
1774 (func
1775 ('symbol', 'callinjection2')
1775 ('symbol', 'callinjection2')
1776 (range
1776 (range
1777 ('symbol', '2')
1777 ('symbol', '2')
1778 ('symbol', '5')))
1778 ('symbol', '5')))
1779 abort: failed to parse the definition of revset alias "injectparamasstring2": unknown identifier: _aliasarg
1779 abort: failed to parse the definition of revset alias "injectparamasstring2": unknown identifier: _aliasarg
1780 [255]
1780 [255]
1781 $ hg debugrevspec --debug --config revsetalias.anotherbadone='branch(' "tip"
1781 $ hg debugrevspec --debug --config revsetalias.anotherbadone='branch(' "tip"
1782 ('symbol', 'tip')
1782 ('symbol', 'tip')
1783 warning: failed to parse the definition of revset alias "anotherbadone": at 7: not a prefix: end
1783 warning: failed to parse the definition of revset alias "anotherbadone": at 7: not a prefix: end
1784 warning: failed to parse the definition of revset alias "injectparamasstring2": unknown identifier: _aliasarg
1784 warning: failed to parse the definition of revset alias "injectparamasstring2": unknown identifier: _aliasarg
1785 * set:
1785 * set:
1786 <baseset [9]>
1786 <baseset [9]>
1787 9
1787 9
1788 >>> data = file('.hg/hgrc', 'rb').read()
1788 >>> data = file('.hg/hgrc', 'rb').read()
1789 >>> file('.hg/hgrc', 'wb').write(data.replace('_aliasarg', ''))
1789 >>> file('.hg/hgrc', 'wb').write(data.replace('_aliasarg', ''))
1790
1790
1791 $ try 'tip'
1791 $ try 'tip'
1792 ('symbol', 'tip')
1792 ('symbol', 'tip')
1793 * set:
1793 * set:
1794 <baseset [9]>
1794 <baseset [9]>
1795 9
1795 9
1796
1796
1797 $ hg debugrevspec --debug --config revsetalias.'bad name'='tip' "tip"
1797 $ hg debugrevspec --debug --config revsetalias.'bad name'='tip' "tip"
1798 ('symbol', 'tip')
1798 ('symbol', 'tip')
1799 warning: failed to parse the declaration of revset alias "bad name": at 4: invalid token
1799 warning: failed to parse the declaration of revset alias "bad name": at 4: invalid token
1800 * set:
1800 * set:
1801 <baseset [9]>
1801 <baseset [9]>
1802 9
1802 9
1803 $ echo 'strictreplacing($1, $10) = $10 or desc("$1")' >> .hg/hgrc
1803 $ echo 'strictreplacing($1, $10) = $10 or desc("$1")' >> .hg/hgrc
1804 $ try 'strictreplacing("foo", tip)'
1804 $ try 'strictreplacing("foo", tip)'
1805 (func
1805 (func
1806 ('symbol', 'strictreplacing')
1806 ('symbol', 'strictreplacing')
1807 (list
1807 (list
1808 ('string', 'foo')
1808 ('string', 'foo')
1809 ('symbol', 'tip')))
1809 ('symbol', 'tip')))
1810 (or
1810 (or
1811 ('symbol', 'tip')
1811 ('symbol', 'tip')
1812 (func
1812 (func
1813 ('symbol', 'desc')
1813 ('symbol', 'desc')
1814 ('string', '$1')))
1814 ('string', '$1')))
1815 * set:
1815 * set:
1816 <addset
1816 <addset
1817 <baseset [9]>,
1817 <baseset [9]>,
1818 <filteredset
1818 <filteredset
1819 <fullreposet+ 0:9>>>
1819 <fullreposet+ 0:9>>>
1820 9
1820 9
1821
1821
1822 $ try 'd(2:5)'
1822 $ try 'd(2:5)'
1823 (func
1823 (func
1824 ('symbol', 'd')
1824 ('symbol', 'd')
1825 (range
1825 (range
1826 ('symbol', '2')
1826 ('symbol', '2')
1827 ('symbol', '5')))
1827 ('symbol', '5')))
1828 (func
1828 (func
1829 ('symbol', 'reverse')
1829 ('symbol', 'reverse')
1830 (func
1830 (func
1831 ('symbol', 'sort')
1831 ('symbol', 'sort')
1832 (list
1832 (list
1833 (range
1833 (range
1834 ('symbol', '2')
1834 ('symbol', '2')
1835 ('symbol', '5'))
1835 ('symbol', '5'))
1836 ('symbol', 'date'))))
1836 ('symbol', 'date'))))
1837 * set:
1837 * set:
1838 <baseset [4, 5, 3, 2]>
1838 <baseset [4, 5, 3, 2]>
1839 4
1839 4
1840 5
1840 5
1841 3
1841 3
1842 2
1842 2
1843 $ try 'rs(2 or 3, date)'
1843 $ try 'rs(2 or 3, date)'
1844 (func
1844 (func
1845 ('symbol', 'rs')
1845 ('symbol', 'rs')
1846 (list
1846 (list
1847 (or
1847 (or
1848 ('symbol', '2')
1848 ('symbol', '2')
1849 ('symbol', '3'))
1849 ('symbol', '3'))
1850 ('symbol', 'date')))
1850 ('symbol', 'date')))
1851 (func
1851 (func
1852 ('symbol', 'reverse')
1852 ('symbol', 'reverse')
1853 (func
1853 (func
1854 ('symbol', 'sort')
1854 ('symbol', 'sort')
1855 (list
1855 (list
1856 (or
1856 (or
1857 ('symbol', '2')
1857 ('symbol', '2')
1858 ('symbol', '3'))
1858 ('symbol', '3'))
1859 ('symbol', 'date'))))
1859 ('symbol', 'date'))))
1860 * set:
1860 * set:
1861 <baseset [3, 2]>
1861 <baseset [3, 2]>
1862 3
1862 3
1863 2
1863 2
1864 $ try 'rs()'
1864 $ try 'rs()'
1865 (func
1865 (func
1866 ('symbol', 'rs')
1866 ('symbol', 'rs')
1867 None)
1867 None)
1868 hg: parse error: invalid number of arguments: 0
1868 hg: parse error: invalid number of arguments: 0
1869 [255]
1869 [255]
1870 $ try 'rs(2)'
1870 $ try 'rs(2)'
1871 (func
1871 (func
1872 ('symbol', 'rs')
1872 ('symbol', 'rs')
1873 ('symbol', '2'))
1873 ('symbol', '2'))
1874 hg: parse error: invalid number of arguments: 1
1874 hg: parse error: invalid number of arguments: 1
1875 [255]
1875 [255]
1876 $ try 'rs(2, data, 7)'
1876 $ try 'rs(2, data, 7)'
1877 (func
1877 (func
1878 ('symbol', 'rs')
1878 ('symbol', 'rs')
1879 (list
1879 (list
1880 (list
1880 (list
1881 ('symbol', '2')
1881 ('symbol', '2')
1882 ('symbol', 'data'))
1882 ('symbol', 'data'))
1883 ('symbol', '7')))
1883 ('symbol', '7')))
1884 hg: parse error: invalid number of arguments: 3
1884 hg: parse error: invalid number of arguments: 3
1885 [255]
1885 [255]
1886 $ try 'rs4(2 or 3, x, x, date)'
1886 $ try 'rs4(2 or 3, x, x, date)'
1887 (func
1887 (func
1888 ('symbol', 'rs4')
1888 ('symbol', 'rs4')
1889 (list
1889 (list
1890 (list
1890 (list
1891 (list
1891 (list
1892 (or
1892 (or
1893 ('symbol', '2')
1893 ('symbol', '2')
1894 ('symbol', '3'))
1894 ('symbol', '3'))
1895 ('symbol', 'x'))
1895 ('symbol', 'x'))
1896 ('symbol', 'x'))
1896 ('symbol', 'x'))
1897 ('symbol', 'date')))
1897 ('symbol', 'date')))
1898 (func
1898 (func
1899 ('symbol', 'reverse')
1899 ('symbol', 'reverse')
1900 (func
1900 (func
1901 ('symbol', 'sort')
1901 ('symbol', 'sort')
1902 (list
1902 (list
1903 (or
1903 (or
1904 ('symbol', '2')
1904 ('symbol', '2')
1905 ('symbol', '3'))
1905 ('symbol', '3'))
1906 ('symbol', 'date'))))
1906 ('symbol', 'date'))))
1907 * set:
1907 * set:
1908 <baseset [3, 2]>
1908 <baseset [3, 2]>
1909 3
1909 3
1910 2
1910 2
1911
1911
1912 issue4553: check that revset aliases override existing hash prefix
1912 issue4553: check that revset aliases override existing hash prefix
1913
1913
1914 $ hg log -qr e
1914 $ hg log -qr e
1915 6:e0cc66ef77e8
1915 6:e0cc66ef77e8
1916
1916
1917 $ hg log -qr e --config revsetalias.e="all()"
1917 $ hg log -qr e --config revsetalias.e="all()"
1918 0:2785f51eece5
1918 0:2785f51eece5
1919 1:d75937da8da0
1919 1:d75937da8da0
1920 2:5ed5505e9f1c
1920 2:5ed5505e9f1c
1921 3:8528aa5637f2
1921 3:8528aa5637f2
1922 4:2326846efdab
1922 4:2326846efdab
1923 5:904fa392b941
1923 5:904fa392b941
1924 6:e0cc66ef77e8
1924 6:e0cc66ef77e8
1925 7:013af1973af4
1925 7:013af1973af4
1926 8:d5d0dcbdc4d9
1926 8:d5d0dcbdc4d9
1927 9:24286f4ae135
1927 9:24286f4ae135
1928
1928
1929 $ hg log -qr e: --config revsetalias.e="0"
1929 $ hg log -qr e: --config revsetalias.e="0"
1930 0:2785f51eece5
1930 0:2785f51eece5
1931 1:d75937da8da0
1931 1:d75937da8da0
1932 2:5ed5505e9f1c
1932 2:5ed5505e9f1c
1933 3:8528aa5637f2
1933 3:8528aa5637f2
1934 4:2326846efdab
1934 4:2326846efdab
1935 5:904fa392b941
1935 5:904fa392b941
1936 6:e0cc66ef77e8
1936 6:e0cc66ef77e8
1937 7:013af1973af4
1937 7:013af1973af4
1938 8:d5d0dcbdc4d9
1938 8:d5d0dcbdc4d9
1939 9:24286f4ae135
1939 9:24286f4ae135
1940
1940
1941 $ hg log -qr :e --config revsetalias.e="9"
1941 $ hg log -qr :e --config revsetalias.e="9"
1942 0:2785f51eece5
1942 0:2785f51eece5
1943 1:d75937da8da0
1943 1:d75937da8da0
1944 2:5ed5505e9f1c
1944 2:5ed5505e9f1c
1945 3:8528aa5637f2
1945 3:8528aa5637f2
1946 4:2326846efdab
1946 4:2326846efdab
1947 5:904fa392b941
1947 5:904fa392b941
1948 6:e0cc66ef77e8
1948 6:e0cc66ef77e8
1949 7:013af1973af4
1949 7:013af1973af4
1950 8:d5d0dcbdc4d9
1950 8:d5d0dcbdc4d9
1951 9:24286f4ae135
1951 9:24286f4ae135
1952
1952
1953 $ hg log -qr e:
1953 $ hg log -qr e:
1954 6:e0cc66ef77e8
1954 6:e0cc66ef77e8
1955 7:013af1973af4
1955 7:013af1973af4
1956 8:d5d0dcbdc4d9
1956 8:d5d0dcbdc4d9
1957 9:24286f4ae135
1957 9:24286f4ae135
1958
1958
1959 $ hg log -qr :e
1959 $ hg log -qr :e
1960 0:2785f51eece5
1960 0:2785f51eece5
1961 1:d75937da8da0
1961 1:d75937da8da0
1962 2:5ed5505e9f1c
1962 2:5ed5505e9f1c
1963 3:8528aa5637f2
1963 3:8528aa5637f2
1964 4:2326846efdab
1964 4:2326846efdab
1965 5:904fa392b941
1965 5:904fa392b941
1966 6:e0cc66ef77e8
1966 6:e0cc66ef77e8
1967
1967
1968 issue2549 - correct optimizations
1968 issue2549 - correct optimizations
1969
1969
1970 $ log 'limit(1 or 2 or 3, 2) and not 2'
1970 $ log 'limit(1 or 2 or 3, 2) and not 2'
1971 1
1971 1
1972 $ log 'max(1 or 2) and not 2'
1972 $ log 'max(1 or 2) and not 2'
1973 $ log 'min(1 or 2) and not 1'
1973 $ log 'min(1 or 2) and not 1'
1974 $ log 'last(1 or 2, 1) and not 2'
1974 $ log 'last(1 or 2, 1) and not 2'
1975
1975
1976 issue4289 - ordering of built-ins
1976 issue4289 - ordering of built-ins
1977 $ hg log -M -q -r 3:2
1977 $ hg log -M -q -r 3:2
1978 3:8528aa5637f2
1978 3:8528aa5637f2
1979 2:5ed5505e9f1c
1979 2:5ed5505e9f1c
1980
1980
1981 test revsets started with 40-chars hash (issue3669)
1981 test revsets started with 40-chars hash (issue3669)
1982
1982
1983 $ ISSUE3669_TIP=`hg tip --template '{node}'`
1983 $ ISSUE3669_TIP=`hg tip --template '{node}'`
1984 $ hg log -r "${ISSUE3669_TIP}" --template '{rev}\n'
1984 $ hg log -r "${ISSUE3669_TIP}" --template '{rev}\n'
1985 9
1985 9
1986 $ hg log -r "${ISSUE3669_TIP}^" --template '{rev}\n'
1986 $ hg log -r "${ISSUE3669_TIP}^" --template '{rev}\n'
1987 8
1987 8
1988
1988
1989 test or-ed indirect predicates (issue3775)
1989 test or-ed indirect predicates (issue3775)
1990
1990
1991 $ log '6 or 6^1' | sort
1991 $ log '6 or 6^1' | sort
1992 5
1992 5
1993 6
1993 6
1994 $ log '6^1 or 6' | sort
1994 $ log '6^1 or 6' | sort
1995 5
1995 5
1996 6
1996 6
1997 $ log '4 or 4~1' | sort
1997 $ log '4 or 4~1' | sort
1998 2
1998 2
1999 4
1999 4
2000 $ log '4~1 or 4' | sort
2000 $ log '4~1 or 4' | sort
2001 2
2001 2
2002 4
2002 4
2003 $ log '(0 or 2):(4 or 6) or 0 or 6' | sort
2003 $ log '(0 or 2):(4 or 6) or 0 or 6' | sort
2004 0
2004 0
2005 1
2005 1
2006 2
2006 2
2007 3
2007 3
2008 4
2008 4
2009 5
2009 5
2010 6
2010 6
2011 $ log '0 or 6 or (0 or 2):(4 or 6)' | sort
2011 $ log '0 or 6 or (0 or 2):(4 or 6)' | sort
2012 0
2012 0
2013 1
2013 1
2014 2
2014 2
2015 3
2015 3
2016 4
2016 4
2017 5
2017 5
2018 6
2018 6
2019
2019
2020 tests for 'remote()' predicate:
2020 tests for 'remote()' predicate:
2021 #. (csets in remote) (id) (remote)
2021 #. (csets in remote) (id) (remote)
2022 1. less than local current branch "default"
2022 1. less than local current branch "default"
2023 2. same with local specified "default"
2023 2. same with local specified "default"
2024 3. more than local specified specified
2024 3. more than local specified specified
2025
2025
2026 $ hg clone --quiet -U . ../remote3
2026 $ hg clone --quiet -U . ../remote3
2027 $ cd ../remote3
2027 $ cd ../remote3
2028 $ hg update -q 7
2028 $ hg update -q 7
2029 $ echo r > r
2029 $ echo r > r
2030 $ hg ci -Aqm 10
2030 $ hg ci -Aqm 10
2031 $ log 'remote()'
2031 $ log 'remote()'
2032 7
2032 7
2033 $ log 'remote("a-b-c-")'
2033 $ log 'remote("a-b-c-")'
2034 2
2034 2
2035 $ cd ../repo
2035 $ cd ../repo
2036 $ log 'remote(".a.b.c.", "../remote3")'
2036 $ log 'remote(".a.b.c.", "../remote3")'
2037
2037
2038 tests for concatenation of strings/symbols by "##"
2038 tests for concatenation of strings/symbols by "##"
2039
2039
2040 $ try "278 ## '5f5' ## 1ee ## 'ce5'"
2040 $ try "278 ## '5f5' ## 1ee ## 'ce5'"
2041 (_concat
2041 (_concat
2042 (_concat
2042 (_concat
2043 (_concat
2043 (_concat
2044 ('symbol', '278')
2044 ('symbol', '278')
2045 ('string', '5f5'))
2045 ('string', '5f5'))
2046 ('symbol', '1ee'))
2046 ('symbol', '1ee'))
2047 ('string', 'ce5'))
2047 ('string', 'ce5'))
2048 ('string', '2785f51eece5')
2048 ('string', '2785f51eece5')
2049 * set:
2049 * set:
2050 <baseset [0]>
2050 <baseset [0]>
2051 0
2051 0
2052
2052
2053 $ echo 'cat4($1, $2, $3, $4) = $1 ## $2 ## $3 ## $4' >> .hg/hgrc
2053 $ echo 'cat4($1, $2, $3, $4) = $1 ## $2 ## $3 ## $4' >> .hg/hgrc
2054 $ try "cat4(278, '5f5', 1ee, 'ce5')"
2054 $ try "cat4(278, '5f5', 1ee, 'ce5')"
2055 (func
2055 (func
2056 ('symbol', 'cat4')
2056 ('symbol', 'cat4')
2057 (list
2057 (list
2058 (list
2058 (list
2059 (list
2059 (list
2060 ('symbol', '278')
2060 ('symbol', '278')
2061 ('string', '5f5'))
2061 ('string', '5f5'))
2062 ('symbol', '1ee'))
2062 ('symbol', '1ee'))
2063 ('string', 'ce5')))
2063 ('string', 'ce5')))
2064 (_concat
2064 (_concat
2065 (_concat
2065 (_concat
2066 (_concat
2066 (_concat
2067 ('symbol', '278')
2067 ('symbol', '278')
2068 ('string', '5f5'))
2068 ('string', '5f5'))
2069 ('symbol', '1ee'))
2069 ('symbol', '1ee'))
2070 ('string', 'ce5'))
2070 ('string', 'ce5'))
2071 ('string', '2785f51eece5')
2071 ('string', '2785f51eece5')
2072 * set:
2072 * set:
2073 <baseset [0]>
2073 <baseset [0]>
2074 0
2074 0
2075
2075
2076 (check concatenation in alias nesting)
2076 (check concatenation in alias nesting)
2077
2077
2078 $ echo 'cat2($1, $2) = $1 ## $2' >> .hg/hgrc
2078 $ echo 'cat2($1, $2) = $1 ## $2' >> .hg/hgrc
2079 $ echo 'cat2x2($1, $2, $3, $4) = cat2($1 ## $2, $3 ## $4)' >> .hg/hgrc
2079 $ echo 'cat2x2($1, $2, $3, $4) = cat2($1 ## $2, $3 ## $4)' >> .hg/hgrc
2080 $ log "cat2x2(278, '5f5', 1ee, 'ce5')"
2080 $ log "cat2x2(278, '5f5', 1ee, 'ce5')"
2081 0
2081 0
2082
2082
2083 (check operator priority)
2083 (check operator priority)
2084
2084
2085 $ echo 'cat2n2($1, $2, $3, $4) = $1 ## $2 or $3 ## $4~2' >> .hg/hgrc
2085 $ echo 'cat2n2($1, $2, $3, $4) = $1 ## $2 or $3 ## $4~2' >> .hg/hgrc
2086 $ log "cat2n2(2785f5, 1eece5, 24286f, 4ae135)"
2086 $ log "cat2n2(2785f5, 1eece5, 24286f, 4ae135)"
2087 0
2087 0
2088 4
2088 4
2089
2089
2090 $ cd ..
2090 $ cd ..
2091
2091
2092 prepare repository that has "default" branches of multiple roots
2092 prepare repository that has "default" branches of multiple roots
2093
2093
2094 $ hg init namedbranch
2094 $ hg init namedbranch
2095 $ cd namedbranch
2095 $ cd namedbranch
2096
2096
2097 $ echo default0 >> a
2097 $ echo default0 >> a
2098 $ hg ci -Aqm0
2098 $ hg ci -Aqm0
2099 $ echo default1 >> a
2099 $ echo default1 >> a
2100 $ hg ci -m1
2100 $ hg ci -m1
2101
2101
2102 $ hg branch -q stable
2102 $ hg branch -q stable
2103 $ echo stable2 >> a
2103 $ echo stable2 >> a
2104 $ hg ci -m2
2104 $ hg ci -m2
2105 $ echo stable3 >> a
2105 $ echo stable3 >> a
2106 $ hg ci -m3
2106 $ hg ci -m3
2107
2107
2108 $ hg update -q null
2108 $ hg update -q null
2109 $ echo default4 >> a
2109 $ echo default4 >> a
2110 $ hg ci -Aqm4
2110 $ hg ci -Aqm4
2111 $ echo default5 >> a
2111 $ echo default5 >> a
2112 $ hg ci -m5
2112 $ hg ci -m5
2113
2113
2114 "null" revision belongs to "default" branch (issue4683)
2114 "null" revision belongs to "default" branch (issue4683)
2115
2115
2116 $ log 'branch(null)'
2116 $ log 'branch(null)'
2117 0
2117 0
2118 1
2118 1
2119 4
2119 4
2120 5
2120 5
2121
2121
2122 "null" revision belongs to "default" branch, but it shouldn't appear in set
2122 "null" revision belongs to "default" branch, but it shouldn't appear in set
2123 unless explicitly specified (issue4682)
2123 unless explicitly specified (issue4682)
2124
2124
2125 $ log 'children(branch(default))'
2125 $ log 'children(branch(default))'
2126 1
2126 1
2127 2
2127 2
2128 5
2128 5
2129
2129
2130 $ cd ..
2130 $ cd ..
2131
2131
2132 test author/desc/keyword in problematic encoding
2132 test author/desc/keyword in problematic encoding
2133 # unicode: cp932:
2133 # unicode: cp932:
2134 # u30A2 0x83 0x41(= 'A')
2134 # u30A2 0x83 0x41(= 'A')
2135 # u30C2 0x83 0x61(= 'a')
2135 # u30C2 0x83 0x61(= 'a')
2136
2136
2137 $ hg init problematicencoding
2137 $ hg init problematicencoding
2138 $ cd problematicencoding
2138 $ cd problematicencoding
2139
2139
2140 $ python > setup.sh <<EOF
2140 $ python > setup.sh <<EOF
2141 > print u'''
2141 > print u'''
2142 > echo a > text
2142 > echo a > text
2143 > hg add text
2143 > hg add text
2144 > hg --encoding utf-8 commit -u '\u30A2' -m none
2144 > hg --encoding utf-8 commit -u '\u30A2' -m none
2145 > echo b > text
2145 > echo b > text
2146 > hg --encoding utf-8 commit -u '\u30C2' -m none
2146 > hg --encoding utf-8 commit -u '\u30C2' -m none
2147 > echo c > text
2147 > echo c > text
2148 > hg --encoding utf-8 commit -u none -m '\u30A2'
2148 > hg --encoding utf-8 commit -u none -m '\u30A2'
2149 > echo d > text
2149 > echo d > text
2150 > hg --encoding utf-8 commit -u none -m '\u30C2'
2150 > hg --encoding utf-8 commit -u none -m '\u30C2'
2151 > '''.encode('utf-8')
2151 > '''.encode('utf-8')
2152 > EOF
2152 > EOF
2153 $ sh < setup.sh
2153 $ sh < setup.sh
2154
2154
2155 test in problematic encoding
2155 test in problematic encoding
2156 $ python > test.sh <<EOF
2156 $ python > test.sh <<EOF
2157 > print u'''
2157 > print u'''
2158 > hg --encoding cp932 log --template '{rev}\\n' -r 'author(\u30A2)'
2158 > hg --encoding cp932 log --template '{rev}\\n' -r 'author(\u30A2)'
2159 > echo ====
2159 > echo ====
2160 > hg --encoding cp932 log --template '{rev}\\n' -r 'author(\u30C2)'
2160 > hg --encoding cp932 log --template '{rev}\\n' -r 'author(\u30C2)'
2161 > echo ====
2161 > echo ====
2162 > hg --encoding cp932 log --template '{rev}\\n' -r 'desc(\u30A2)'
2162 > hg --encoding cp932 log --template '{rev}\\n' -r 'desc(\u30A2)'
2163 > echo ====
2163 > echo ====
2164 > hg --encoding cp932 log --template '{rev}\\n' -r 'desc(\u30C2)'
2164 > hg --encoding cp932 log --template '{rev}\\n' -r 'desc(\u30C2)'
2165 > echo ====
2165 > echo ====
2166 > hg --encoding cp932 log --template '{rev}\\n' -r 'keyword(\u30A2)'
2166 > hg --encoding cp932 log --template '{rev}\\n' -r 'keyword(\u30A2)'
2167 > echo ====
2167 > echo ====
2168 > hg --encoding cp932 log --template '{rev}\\n' -r 'keyword(\u30C2)'
2168 > hg --encoding cp932 log --template '{rev}\\n' -r 'keyword(\u30C2)'
2169 > '''.encode('cp932')
2169 > '''.encode('cp932')
2170 > EOF
2170 > EOF
2171 $ sh < test.sh
2171 $ sh < test.sh
2172 0
2172 0
2173 ====
2173 ====
2174 1
2174 1
2175 ====
2175 ====
2176 2
2176 2
2177 ====
2177 ====
2178 3
2178 3
2179 ====
2179 ====
2180 0
2180 0
2181 2
2181 2
2182 ====
2182 ====
2183 1
2183 1
2184 3
2184 3
2185
2185
2186 test error message of bad revset
2186 test error message of bad revset
2187 $ hg log -r 'foo\\'
2187 $ hg log -r 'foo\\'
2188 hg: parse error at 3: syntax error in revset 'foo\\'
2188 hg: parse error at 3: syntax error in revset 'foo\\'
2189 [255]
2189 [255]
2190
2190
2191 $ cd ..
2191 $ cd ..
2192
2192
2193 Test registrar.delayregistrar via revset.extpredicate
2193 Test registrar.delayregistrar via revset.extpredicate
2194
2194
2195 'extpredicate' decorator shouldn't register any functions until
2195 'extpredicate' decorator shouldn't register any functions until
2196 'setup()' on it.
2196 'setup()' on it.
2197
2197
2198 $ cd repo
2198 $ cd repo
2199
2199
2200 $ cat <<EOF > $TESTTMP/custompredicate.py
2200 $ cat <<EOF > $TESTTMP/custompredicate.py
2201 > from mercurial import revset
2201 > from mercurial import revset
2202 >
2202 >
2203 > revsetpredicate = revset.extpredicate()
2203 > revsetpredicate = revset.extpredicate()
2204 >
2204 >
2205 > @revsetpredicate('custom1()')
2205 > @revsetpredicate('custom1()')
2206 > def custom1(repo, subset, x):
2206 > def custom1(repo, subset, x):
2207 > return revset.baseset([1])
2207 > return revset.baseset([1])
2208 > @revsetpredicate('custom2()')
2208 > @revsetpredicate('custom2()')
2209 > def custom2(repo, subset, x):
2209 > def custom2(repo, subset, x):
2210 > return revset.baseset([2])
2210 > return revset.baseset([2])
2211 >
2211 >
2212 > def uisetup(ui):
2212 > def uisetup(ui):
2213 > if ui.configbool('custompredicate', 'enabled'):
2213 > if ui.configbool('custompredicate', 'enabled'):
2214 > revsetpredicate.setup()
2214 > revsetpredicate.setup()
2215 > EOF
2215 > EOF
2216 $ cat <<EOF > .hg/hgrc
2216 $ cat <<EOF > .hg/hgrc
2217 > [extensions]
2217 > [extensions]
2218 > custompredicate = $TESTTMP/custompredicate.py
2218 > custompredicate = $TESTTMP/custompredicate.py
2219 > EOF
2219 > EOF
2220
2220
2221 $ hg debugrevspec "custom1()"
2221 $ hg debugrevspec "custom1()"
2222 hg: parse error: unknown identifier: custom1
2222 hg: parse error: unknown identifier: custom1
2223 [255]
2223 [255]
2224 $ hg debugrevspec "custom2()"
2224 $ hg debugrevspec "custom2()"
2225 hg: parse error: unknown identifier: custom2
2225 hg: parse error: unknown identifier: custom2
2226 [255]
2226 [255]
2227 $ hg debugrevspec "custom1() or custom2()" --config custompredicate.enabled=true
2227 $ hg debugrevspec "custom1() or custom2()" --config custompredicate.enabled=true
2228 1
2228 1
2229 2
2229 2
2230
2230
2231 $ cd ..
2231 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now