##// END OF EJS Templates
filemerge: show actual capabilities of internal merge tools...
FUJIWARA Katsunori -
r39162:e09fad98 default
parent child Browse files
Show More
@@ -1,996 +1,1002
1 # filemerge.py - file-level merge handling for Mercurial
1 # filemerge.py - file-level merge handling for Mercurial
2 #
2 #
3 # Copyright 2006, 2007, 2008 Matt Mackall <mpm@selenic.com>
3 # Copyright 2006, 2007, 2008 Matt Mackall <mpm@selenic.com>
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 from __future__ import absolute_import
8 from __future__ import absolute_import
9
9
10 import contextlib
10 import contextlib
11 import os
11 import os
12 import re
12 import re
13 import shutil
13 import shutil
14
14
15 from .i18n import _
15 from .i18n import _
16 from .node import nullid, short
16 from .node import nullid, short
17
17
18 from . import (
18 from . import (
19 encoding,
19 encoding,
20 error,
20 error,
21 formatter,
21 formatter,
22 match,
22 match,
23 pycompat,
23 pycompat,
24 registrar,
24 registrar,
25 scmutil,
25 scmutil,
26 simplemerge,
26 simplemerge,
27 tagmerge,
27 tagmerge,
28 templatekw,
28 templatekw,
29 templater,
29 templater,
30 util,
30 util,
31 )
31 )
32
32
33 from .utils import (
33 from .utils import (
34 procutil,
34 procutil,
35 stringutil,
35 stringutil,
36 )
36 )
37
37
38 def _toolstr(ui, tool, part, *args):
38 def _toolstr(ui, tool, part, *args):
39 return ui.config("merge-tools", tool + "." + part, *args)
39 return ui.config("merge-tools", tool + "." + part, *args)
40
40
41 def _toolbool(ui, tool, part,*args):
41 def _toolbool(ui, tool, part,*args):
42 return ui.configbool("merge-tools", tool + "." + part, *args)
42 return ui.configbool("merge-tools", tool + "." + part, *args)
43
43
44 def _toollist(ui, tool, part):
44 def _toollist(ui, tool, part):
45 return ui.configlist("merge-tools", tool + "." + part)
45 return ui.configlist("merge-tools", tool + "." + part)
46
46
47 internals = {}
47 internals = {}
48 # Merge tools to document.
48 # Merge tools to document.
49 internalsdoc = {}
49 internalsdoc = {}
50
50
51 internaltool = registrar.internalmerge()
51 internaltool = registrar.internalmerge()
52
52
53 # internal tool merge types
53 # internal tool merge types
54 nomerge = internaltool.nomerge
54 nomerge = internaltool.nomerge
55 mergeonly = internaltool.mergeonly # just the full merge, no premerge
55 mergeonly = internaltool.mergeonly # just the full merge, no premerge
56 fullmerge = internaltool.fullmerge # both premerge and merge
56 fullmerge = internaltool.fullmerge # both premerge and merge
57
57
58 _localchangedotherdeletedmsg = _(
58 _localchangedotherdeletedmsg = _(
59 "local%(l)s changed %(fd)s which other%(o)s deleted\n"
59 "local%(l)s changed %(fd)s which other%(o)s deleted\n"
60 "use (c)hanged version, (d)elete, or leave (u)nresolved?"
60 "use (c)hanged version, (d)elete, or leave (u)nresolved?"
61 "$$ &Changed $$ &Delete $$ &Unresolved")
61 "$$ &Changed $$ &Delete $$ &Unresolved")
62
62
63 _otherchangedlocaldeletedmsg = _(
63 _otherchangedlocaldeletedmsg = _(
64 "other%(o)s changed %(fd)s which local%(l)s deleted\n"
64 "other%(o)s changed %(fd)s which local%(l)s deleted\n"
65 "use (c)hanged version, leave (d)eleted, or "
65 "use (c)hanged version, leave (d)eleted, or "
66 "leave (u)nresolved?"
66 "leave (u)nresolved?"
67 "$$ &Changed $$ &Deleted $$ &Unresolved")
67 "$$ &Changed $$ &Deleted $$ &Unresolved")
68
68
69 class absentfilectx(object):
69 class absentfilectx(object):
70 """Represents a file that's ostensibly in a context but is actually not
70 """Represents a file that's ostensibly in a context but is actually not
71 present in it.
71 present in it.
72
72
73 This is here because it's very specific to the filemerge code for now --
73 This is here because it's very specific to the filemerge code for now --
74 other code is likely going to break with the values this returns."""
74 other code is likely going to break with the values this returns."""
75 def __init__(self, ctx, f):
75 def __init__(self, ctx, f):
76 self._ctx = ctx
76 self._ctx = ctx
77 self._f = f
77 self._f = f
78
78
79 def path(self):
79 def path(self):
80 return self._f
80 return self._f
81
81
82 def size(self):
82 def size(self):
83 return None
83 return None
84
84
85 def data(self):
85 def data(self):
86 return None
86 return None
87
87
88 def filenode(self):
88 def filenode(self):
89 return nullid
89 return nullid
90
90
91 _customcmp = True
91 _customcmp = True
92 def cmp(self, fctx):
92 def cmp(self, fctx):
93 """compare with other file context
93 """compare with other file context
94
94
95 returns True if different from fctx.
95 returns True if different from fctx.
96 """
96 """
97 return not (fctx.isabsent() and
97 return not (fctx.isabsent() and
98 fctx.ctx() == self.ctx() and
98 fctx.ctx() == self.ctx() and
99 fctx.path() == self.path())
99 fctx.path() == self.path())
100
100
101 def flags(self):
101 def flags(self):
102 return ''
102 return ''
103
103
104 def changectx(self):
104 def changectx(self):
105 return self._ctx
105 return self._ctx
106
106
107 def isbinary(self):
107 def isbinary(self):
108 return False
108 return False
109
109
110 def isabsent(self):
110 def isabsent(self):
111 return True
111 return True
112
112
113 def _findtool(ui, tool):
113 def _findtool(ui, tool):
114 if tool in internals:
114 if tool in internals:
115 return tool
115 return tool
116 cmd = _toolstr(ui, tool, "executable", tool)
116 cmd = _toolstr(ui, tool, "executable", tool)
117 if cmd.startswith('python:'):
117 if cmd.startswith('python:'):
118 return cmd
118 return cmd
119 return findexternaltool(ui, tool)
119 return findexternaltool(ui, tool)
120
120
121 def _quotetoolpath(cmd):
121 def _quotetoolpath(cmd):
122 if cmd.startswith('python:'):
122 if cmd.startswith('python:'):
123 return cmd
123 return cmd
124 return procutil.shellquote(cmd)
124 return procutil.shellquote(cmd)
125
125
126 def findexternaltool(ui, tool):
126 def findexternaltool(ui, tool):
127 for kn in ("regkey", "regkeyalt"):
127 for kn in ("regkey", "regkeyalt"):
128 k = _toolstr(ui, tool, kn)
128 k = _toolstr(ui, tool, kn)
129 if not k:
129 if not k:
130 continue
130 continue
131 p = util.lookupreg(k, _toolstr(ui, tool, "regname"))
131 p = util.lookupreg(k, _toolstr(ui, tool, "regname"))
132 if p:
132 if p:
133 p = procutil.findexe(p + _toolstr(ui, tool, "regappend", ""))
133 p = procutil.findexe(p + _toolstr(ui, tool, "regappend", ""))
134 if p:
134 if p:
135 return p
135 return p
136 exe = _toolstr(ui, tool, "executable", tool)
136 exe = _toolstr(ui, tool, "executable", tool)
137 return procutil.findexe(util.expandpath(exe))
137 return procutil.findexe(util.expandpath(exe))
138
138
139 def _picktool(repo, ui, path, binary, symlink, changedelete):
139 def _picktool(repo, ui, path, binary, symlink, changedelete):
140 strictcheck = ui.configbool('merge', 'strict-capability-check')
140 strictcheck = ui.configbool('merge', 'strict-capability-check')
141
141
142 def hascapability(tool, capability, strict=False):
142 def hascapability(tool, capability, strict=False):
143 if strict and tool in internals:
143 if strict and tool in internals:
144 if internals[tool].capabilities.get(capability):
144 if internals[tool].capabilities.get(capability):
145 return True
145 return True
146 return _toolbool(ui, tool, capability)
146 return _toolbool(ui, tool, capability)
147
147
148 def supportscd(tool):
148 def supportscd(tool):
149 return tool in internals and internals[tool].mergetype == nomerge
149 return tool in internals and internals[tool].mergetype == nomerge
150
150
151 def check(tool, pat, symlink, binary, changedelete):
151 def check(tool, pat, symlink, binary, changedelete):
152 tmsg = tool
152 tmsg = tool
153 if pat:
153 if pat:
154 tmsg = _("%s (for pattern %s)") % (tool, pat)
154 tmsg = _("%s (for pattern %s)") % (tool, pat)
155 if not _findtool(ui, tool):
155 if not _findtool(ui, tool):
156 if pat: # explicitly requested tool deserves a warning
156 if pat: # explicitly requested tool deserves a warning
157 ui.warn(_("couldn't find merge tool %s\n") % tmsg)
157 ui.warn(_("couldn't find merge tool %s\n") % tmsg)
158 else: # configured but non-existing tools are more silent
158 else: # configured but non-existing tools are more silent
159 ui.note(_("couldn't find merge tool %s\n") % tmsg)
159 ui.note(_("couldn't find merge tool %s\n") % tmsg)
160 elif symlink and not hascapability(tool, "symlink", strictcheck):
160 elif symlink and not hascapability(tool, "symlink", strictcheck):
161 ui.warn(_("tool %s can't handle symlinks\n") % tmsg)
161 ui.warn(_("tool %s can't handle symlinks\n") % tmsg)
162 elif binary and not hascapability(tool, "binary", strictcheck):
162 elif binary and not hascapability(tool, "binary", strictcheck):
163 ui.warn(_("tool %s can't handle binary\n") % tmsg)
163 ui.warn(_("tool %s can't handle binary\n") % tmsg)
164 elif changedelete and not supportscd(tool):
164 elif changedelete and not supportscd(tool):
165 # the nomerge tools are the only tools that support change/delete
165 # the nomerge tools are the only tools that support change/delete
166 # conflicts
166 # conflicts
167 pass
167 pass
168 elif not procutil.gui() and _toolbool(ui, tool, "gui"):
168 elif not procutil.gui() and _toolbool(ui, tool, "gui"):
169 ui.warn(_("tool %s requires a GUI\n") % tmsg)
169 ui.warn(_("tool %s requires a GUI\n") % tmsg)
170 else:
170 else:
171 return True
171 return True
172 return False
172 return False
173
173
174 # internal config: ui.forcemerge
174 # internal config: ui.forcemerge
175 # forcemerge comes from command line arguments, highest priority
175 # forcemerge comes from command line arguments, highest priority
176 force = ui.config('ui', 'forcemerge')
176 force = ui.config('ui', 'forcemerge')
177 if force:
177 if force:
178 toolpath = _findtool(ui, force)
178 toolpath = _findtool(ui, force)
179 if changedelete and not supportscd(toolpath):
179 if changedelete and not supportscd(toolpath):
180 return ":prompt", None
180 return ":prompt", None
181 else:
181 else:
182 if toolpath:
182 if toolpath:
183 return (force, _quotetoolpath(toolpath))
183 return (force, _quotetoolpath(toolpath))
184 else:
184 else:
185 # mimic HGMERGE if given tool not found
185 # mimic HGMERGE if given tool not found
186 return (force, force)
186 return (force, force)
187
187
188 # HGMERGE takes next precedence
188 # HGMERGE takes next precedence
189 hgmerge = encoding.environ.get("HGMERGE")
189 hgmerge = encoding.environ.get("HGMERGE")
190 if hgmerge:
190 if hgmerge:
191 if changedelete and not supportscd(hgmerge):
191 if changedelete and not supportscd(hgmerge):
192 return ":prompt", None
192 return ":prompt", None
193 else:
193 else:
194 return (hgmerge, hgmerge)
194 return (hgmerge, hgmerge)
195
195
196 # then patterns
196 # then patterns
197
197
198 # whether binary capability should be checked strictly
198 # whether binary capability should be checked strictly
199 binarycap = binary and strictcheck
199 binarycap = binary and strictcheck
200
200
201 for pat, tool in ui.configitems("merge-patterns"):
201 for pat, tool in ui.configitems("merge-patterns"):
202 mf = match.match(repo.root, '', [pat])
202 mf = match.match(repo.root, '', [pat])
203 if mf(path) and check(tool, pat, symlink, binarycap, changedelete):
203 if mf(path) and check(tool, pat, symlink, binarycap, changedelete):
204 if binary and not hascapability(tool, "binary", strict=True):
204 if binary and not hascapability(tool, "binary", strict=True):
205 ui.warn(_("warning: check merge-patterns configurations,"
205 ui.warn(_("warning: check merge-patterns configurations,"
206 " if %r for binary file %r is unintentional\n"
206 " if %r for binary file %r is unintentional\n"
207 "(see 'hg help merge-tools'"
207 "(see 'hg help merge-tools'"
208 " for binary files capability)\n")
208 " for binary files capability)\n")
209 % (pycompat.bytestr(tool), pycompat.bytestr(path)))
209 % (pycompat.bytestr(tool), pycompat.bytestr(path)))
210 toolpath = _findtool(ui, tool)
210 toolpath = _findtool(ui, tool)
211 return (tool, _quotetoolpath(toolpath))
211 return (tool, _quotetoolpath(toolpath))
212
212
213 # then merge tools
213 # then merge tools
214 tools = {}
214 tools = {}
215 disabled = set()
215 disabled = set()
216 for k, v in ui.configitems("merge-tools"):
216 for k, v in ui.configitems("merge-tools"):
217 t = k.split('.')[0]
217 t = k.split('.')[0]
218 if t not in tools:
218 if t not in tools:
219 tools[t] = int(_toolstr(ui, t, "priority"))
219 tools[t] = int(_toolstr(ui, t, "priority"))
220 if _toolbool(ui, t, "disabled"):
220 if _toolbool(ui, t, "disabled"):
221 disabled.add(t)
221 disabled.add(t)
222 names = tools.keys()
222 names = tools.keys()
223 tools = sorted([(-p, tool) for tool, p in tools.items()
223 tools = sorted([(-p, tool) for tool, p in tools.items()
224 if tool not in disabled])
224 if tool not in disabled])
225 uimerge = ui.config("ui", "merge")
225 uimerge = ui.config("ui", "merge")
226 if uimerge:
226 if uimerge:
227 # external tools defined in uimerge won't be able to handle
227 # external tools defined in uimerge won't be able to handle
228 # change/delete conflicts
228 # change/delete conflicts
229 if check(uimerge, path, symlink, binary, changedelete):
229 if check(uimerge, path, symlink, binary, changedelete):
230 if uimerge not in names and not changedelete:
230 if uimerge not in names and not changedelete:
231 return (uimerge, uimerge)
231 return (uimerge, uimerge)
232 tools.insert(0, (None, uimerge)) # highest priority
232 tools.insert(0, (None, uimerge)) # highest priority
233 tools.append((None, "hgmerge")) # the old default, if found
233 tools.append((None, "hgmerge")) # the old default, if found
234 for p, t in tools:
234 for p, t in tools:
235 if check(t, None, symlink, binary, changedelete):
235 if check(t, None, symlink, binary, changedelete):
236 toolpath = _findtool(ui, t)
236 toolpath = _findtool(ui, t)
237 return (t, _quotetoolpath(toolpath))
237 return (t, _quotetoolpath(toolpath))
238
238
239 # internal merge or prompt as last resort
239 # internal merge or prompt as last resort
240 if symlink or binary or changedelete:
240 if symlink or binary or changedelete:
241 if not changedelete and len(tools):
241 if not changedelete and len(tools):
242 # any tool is rejected by capability for symlink or binary
242 # any tool is rejected by capability for symlink or binary
243 ui.warn(_("no tool found to merge %s\n") % path)
243 ui.warn(_("no tool found to merge %s\n") % path)
244 return ":prompt", None
244 return ":prompt", None
245 return ":merge", None
245 return ":merge", None
246
246
247 def _eoltype(data):
247 def _eoltype(data):
248 "Guess the EOL type of a file"
248 "Guess the EOL type of a file"
249 if '\0' in data: # binary
249 if '\0' in data: # binary
250 return None
250 return None
251 if '\r\n' in data: # Windows
251 if '\r\n' in data: # Windows
252 return '\r\n'
252 return '\r\n'
253 if '\r' in data: # Old Mac
253 if '\r' in data: # Old Mac
254 return '\r'
254 return '\r'
255 if '\n' in data: # UNIX
255 if '\n' in data: # UNIX
256 return '\n'
256 return '\n'
257 return None # unknown
257 return None # unknown
258
258
259 def _matcheol(file, back):
259 def _matcheol(file, back):
260 "Convert EOL markers in a file to match origfile"
260 "Convert EOL markers in a file to match origfile"
261 tostyle = _eoltype(back.data()) # No repo.wread filters?
261 tostyle = _eoltype(back.data()) # No repo.wread filters?
262 if tostyle:
262 if tostyle:
263 data = util.readfile(file)
263 data = util.readfile(file)
264 style = _eoltype(data)
264 style = _eoltype(data)
265 if style:
265 if style:
266 newdata = data.replace(style, tostyle)
266 newdata = data.replace(style, tostyle)
267 if newdata != data:
267 if newdata != data:
268 util.writefile(file, newdata)
268 util.writefile(file, newdata)
269
269
270 @internaltool('prompt', nomerge)
270 @internaltool('prompt', nomerge)
271 def _iprompt(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None):
271 def _iprompt(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None):
272 """Asks the user which of the local `p1()` or the other `p2()` version to
272 """Asks the user which of the local `p1()` or the other `p2()` version to
273 keep as the merged version."""
273 keep as the merged version."""
274 ui = repo.ui
274 ui = repo.ui
275 fd = fcd.path()
275 fd = fcd.path()
276
276
277 # Avoid prompting during an in-memory merge since it doesn't support merge
277 # Avoid prompting during an in-memory merge since it doesn't support merge
278 # conflicts.
278 # conflicts.
279 if fcd.changectx().isinmemory():
279 if fcd.changectx().isinmemory():
280 raise error.InMemoryMergeConflictsError('in-memory merge does not '
280 raise error.InMemoryMergeConflictsError('in-memory merge does not '
281 'support file conflicts')
281 'support file conflicts')
282
282
283 prompts = partextras(labels)
283 prompts = partextras(labels)
284 prompts['fd'] = fd
284 prompts['fd'] = fd
285 try:
285 try:
286 if fco.isabsent():
286 if fco.isabsent():
287 index = ui.promptchoice(
287 index = ui.promptchoice(
288 _localchangedotherdeletedmsg % prompts, 2)
288 _localchangedotherdeletedmsg % prompts, 2)
289 choice = ['local', 'other', 'unresolved'][index]
289 choice = ['local', 'other', 'unresolved'][index]
290 elif fcd.isabsent():
290 elif fcd.isabsent():
291 index = ui.promptchoice(
291 index = ui.promptchoice(
292 _otherchangedlocaldeletedmsg % prompts, 2)
292 _otherchangedlocaldeletedmsg % prompts, 2)
293 choice = ['other', 'local', 'unresolved'][index]
293 choice = ['other', 'local', 'unresolved'][index]
294 else:
294 else:
295 index = ui.promptchoice(
295 index = ui.promptchoice(
296 _("keep (l)ocal%(l)s, take (o)ther%(o)s, or leave (u)nresolved"
296 _("keep (l)ocal%(l)s, take (o)ther%(o)s, or leave (u)nresolved"
297 " for %(fd)s?"
297 " for %(fd)s?"
298 "$$ &Local $$ &Other $$ &Unresolved") % prompts, 2)
298 "$$ &Local $$ &Other $$ &Unresolved") % prompts, 2)
299 choice = ['local', 'other', 'unresolved'][index]
299 choice = ['local', 'other', 'unresolved'][index]
300
300
301 if choice == 'other':
301 if choice == 'other':
302 return _iother(repo, mynode, orig, fcd, fco, fca, toolconf,
302 return _iother(repo, mynode, orig, fcd, fco, fca, toolconf,
303 labels)
303 labels)
304 elif choice == 'local':
304 elif choice == 'local':
305 return _ilocal(repo, mynode, orig, fcd, fco, fca, toolconf,
305 return _ilocal(repo, mynode, orig, fcd, fco, fca, toolconf,
306 labels)
306 labels)
307 elif choice == 'unresolved':
307 elif choice == 'unresolved':
308 return _ifail(repo, mynode, orig, fcd, fco, fca, toolconf,
308 return _ifail(repo, mynode, orig, fcd, fco, fca, toolconf,
309 labels)
309 labels)
310 except error.ResponseExpected:
310 except error.ResponseExpected:
311 ui.write("\n")
311 ui.write("\n")
312 return _ifail(repo, mynode, orig, fcd, fco, fca, toolconf,
312 return _ifail(repo, mynode, orig, fcd, fco, fca, toolconf,
313 labels)
313 labels)
314
314
315 @internaltool('local', nomerge)
315 @internaltool('local', nomerge)
316 def _ilocal(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None):
316 def _ilocal(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None):
317 """Uses the local `p1()` version of files as the merged version."""
317 """Uses the local `p1()` version of files as the merged version."""
318 return 0, fcd.isabsent()
318 return 0, fcd.isabsent()
319
319
320 @internaltool('other', nomerge)
320 @internaltool('other', nomerge)
321 def _iother(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None):
321 def _iother(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None):
322 """Uses the other `p2()` version of files as the merged version."""
322 """Uses the other `p2()` version of files as the merged version."""
323 if fco.isabsent():
323 if fco.isabsent():
324 # local changed, remote deleted -- 'deleted' picked
324 # local changed, remote deleted -- 'deleted' picked
325 _underlyingfctxifabsent(fcd).remove()
325 _underlyingfctxifabsent(fcd).remove()
326 deleted = True
326 deleted = True
327 else:
327 else:
328 _underlyingfctxifabsent(fcd).write(fco.data(), fco.flags())
328 _underlyingfctxifabsent(fcd).write(fco.data(), fco.flags())
329 deleted = False
329 deleted = False
330 return 0, deleted
330 return 0, deleted
331
331
332 @internaltool('fail', nomerge)
332 @internaltool('fail', nomerge)
333 def _ifail(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None):
333 def _ifail(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None):
334 """
334 """
335 Rather than attempting to merge files that were modified on both
335 Rather than attempting to merge files that were modified on both
336 branches, it marks them as unresolved. The resolve command must be
336 branches, it marks them as unresolved. The resolve command must be
337 used to resolve these conflicts."""
337 used to resolve these conflicts."""
338 # for change/delete conflicts write out the changed version, then fail
338 # for change/delete conflicts write out the changed version, then fail
339 if fcd.isabsent():
339 if fcd.isabsent():
340 _underlyingfctxifabsent(fcd).write(fco.data(), fco.flags())
340 _underlyingfctxifabsent(fcd).write(fco.data(), fco.flags())
341 return 1, False
341 return 1, False
342
342
343 def _underlyingfctxifabsent(filectx):
343 def _underlyingfctxifabsent(filectx):
344 """Sometimes when resolving, our fcd is actually an absentfilectx, but
344 """Sometimes when resolving, our fcd is actually an absentfilectx, but
345 we want to write to it (to do the resolve). This helper returns the
345 we want to write to it (to do the resolve). This helper returns the
346 underyling workingfilectx in that case.
346 underyling workingfilectx in that case.
347 """
347 """
348 if filectx.isabsent():
348 if filectx.isabsent():
349 return filectx.changectx()[filectx.path()]
349 return filectx.changectx()[filectx.path()]
350 else:
350 else:
351 return filectx
351 return filectx
352
352
353 def _premerge(repo, fcd, fco, fca, toolconf, files, labels=None):
353 def _premerge(repo, fcd, fco, fca, toolconf, files, labels=None):
354 tool, toolpath, binary, symlink, scriptfn = toolconf
354 tool, toolpath, binary, symlink, scriptfn = toolconf
355 if symlink or fcd.isabsent() or fco.isabsent():
355 if symlink or fcd.isabsent() or fco.isabsent():
356 return 1
356 return 1
357 unused, unused, unused, back = files
357 unused, unused, unused, back = files
358
358
359 ui = repo.ui
359 ui = repo.ui
360
360
361 validkeep = ['keep', 'keep-merge3']
361 validkeep = ['keep', 'keep-merge3']
362
362
363 # do we attempt to simplemerge first?
363 # do we attempt to simplemerge first?
364 try:
364 try:
365 premerge = _toolbool(ui, tool, "premerge", not binary)
365 premerge = _toolbool(ui, tool, "premerge", not binary)
366 except error.ConfigError:
366 except error.ConfigError:
367 premerge = _toolstr(ui, tool, "premerge", "").lower()
367 premerge = _toolstr(ui, tool, "premerge", "").lower()
368 if premerge not in validkeep:
368 if premerge not in validkeep:
369 _valid = ', '.join(["'" + v + "'" for v in validkeep])
369 _valid = ', '.join(["'" + v + "'" for v in validkeep])
370 raise error.ConfigError(_("%s.premerge not valid "
370 raise error.ConfigError(_("%s.premerge not valid "
371 "('%s' is neither boolean nor %s)") %
371 "('%s' is neither boolean nor %s)") %
372 (tool, premerge, _valid))
372 (tool, premerge, _valid))
373
373
374 if premerge:
374 if premerge:
375 if premerge == 'keep-merge3':
375 if premerge == 'keep-merge3':
376 if not labels:
376 if not labels:
377 labels = _defaultconflictlabels
377 labels = _defaultconflictlabels
378 if len(labels) < 3:
378 if len(labels) < 3:
379 labels.append('base')
379 labels.append('base')
380 r = simplemerge.simplemerge(ui, fcd, fca, fco, quiet=True, label=labels)
380 r = simplemerge.simplemerge(ui, fcd, fca, fco, quiet=True, label=labels)
381 if not r:
381 if not r:
382 ui.debug(" premerge successful\n")
382 ui.debug(" premerge successful\n")
383 return 0
383 return 0
384 if premerge not in validkeep:
384 if premerge not in validkeep:
385 # restore from backup and try again
385 # restore from backup and try again
386 _restorebackup(fcd, back)
386 _restorebackup(fcd, back)
387 return 1 # continue merging
387 return 1 # continue merging
388
388
389 def _mergecheck(repo, mynode, orig, fcd, fco, fca, toolconf):
389 def _mergecheck(repo, mynode, orig, fcd, fco, fca, toolconf):
390 tool, toolpath, binary, symlink, scriptfn = toolconf
390 tool, toolpath, binary, symlink, scriptfn = toolconf
391 if symlink:
391 if symlink:
392 repo.ui.warn(_('warning: internal %s cannot merge symlinks '
392 repo.ui.warn(_('warning: internal %s cannot merge symlinks '
393 'for %s\n') % (tool, fcd.path()))
393 'for %s\n') % (tool, fcd.path()))
394 return False
394 return False
395 if fcd.isabsent() or fco.isabsent():
395 if fcd.isabsent() or fco.isabsent():
396 repo.ui.warn(_('warning: internal %s cannot merge change/delete '
396 repo.ui.warn(_('warning: internal %s cannot merge change/delete '
397 'conflict for %s\n') % (tool, fcd.path()))
397 'conflict for %s\n') % (tool, fcd.path()))
398 return False
398 return False
399 return True
399 return True
400
400
401 def _merge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels, mode):
401 def _merge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels, mode):
402 """
402 """
403 Uses the internal non-interactive simple merge algorithm for merging
403 Uses the internal non-interactive simple merge algorithm for merging
404 files. It will fail if there are any conflicts and leave markers in
404 files. It will fail if there are any conflicts and leave markers in
405 the partially merged file. Markers will have two sections, one for each side
405 the partially merged file. Markers will have two sections, one for each side
406 of merge, unless mode equals 'union' which suppresses the markers."""
406 of merge, unless mode equals 'union' which suppresses the markers."""
407 ui = repo.ui
407 ui = repo.ui
408
408
409 r = simplemerge.simplemerge(ui, fcd, fca, fco, label=labels, mode=mode)
409 r = simplemerge.simplemerge(ui, fcd, fca, fco, label=labels, mode=mode)
410 return True, r, False
410 return True, r, False
411
411
412 @internaltool('union', fullmerge,
412 @internaltool('union', fullmerge,
413 _("warning: conflicts while merging %s! "
413 _("warning: conflicts while merging %s! "
414 "(edit, then use 'hg resolve --mark')\n"),
414 "(edit, then use 'hg resolve --mark')\n"),
415 precheck=_mergecheck)
415 precheck=_mergecheck)
416 def _iunion(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
416 def _iunion(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
417 """
417 """
418 Uses the internal non-interactive simple merge algorithm for merging
418 Uses the internal non-interactive simple merge algorithm for merging
419 files. It will use both left and right sides for conflict regions.
419 files. It will use both left and right sides for conflict regions.
420 No markers are inserted."""
420 No markers are inserted."""
421 return _merge(repo, mynode, orig, fcd, fco, fca, toolconf,
421 return _merge(repo, mynode, orig, fcd, fco, fca, toolconf,
422 files, labels, 'union')
422 files, labels, 'union')
423
423
424 @internaltool('merge', fullmerge,
424 @internaltool('merge', fullmerge,
425 _("warning: conflicts while merging %s! "
425 _("warning: conflicts while merging %s! "
426 "(edit, then use 'hg resolve --mark')\n"),
426 "(edit, then use 'hg resolve --mark')\n"),
427 precheck=_mergecheck)
427 precheck=_mergecheck)
428 def _imerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
428 def _imerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
429 """
429 """
430 Uses the internal non-interactive simple merge algorithm for merging
430 Uses the internal non-interactive simple merge algorithm for merging
431 files. It will fail if there are any conflicts and leave markers in
431 files. It will fail if there are any conflicts and leave markers in
432 the partially merged file. Markers will have two sections, one for each side
432 the partially merged file. Markers will have two sections, one for each side
433 of merge."""
433 of merge."""
434 return _merge(repo, mynode, orig, fcd, fco, fca, toolconf,
434 return _merge(repo, mynode, orig, fcd, fco, fca, toolconf,
435 files, labels, 'merge')
435 files, labels, 'merge')
436
436
437 @internaltool('merge3', fullmerge,
437 @internaltool('merge3', fullmerge,
438 _("warning: conflicts while merging %s! "
438 _("warning: conflicts while merging %s! "
439 "(edit, then use 'hg resolve --mark')\n"),
439 "(edit, then use 'hg resolve --mark')\n"),
440 precheck=_mergecheck)
440 precheck=_mergecheck)
441 def _imerge3(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
441 def _imerge3(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
442 """
442 """
443 Uses the internal non-interactive simple merge algorithm for merging
443 Uses the internal non-interactive simple merge algorithm for merging
444 files. It will fail if there are any conflicts and leave markers in
444 files. It will fail if there are any conflicts and leave markers in
445 the partially merged file. Marker will have three sections, one from each
445 the partially merged file. Marker will have three sections, one from each
446 side of the merge and one for the base content."""
446 side of the merge and one for the base content."""
447 if not labels:
447 if not labels:
448 labels = _defaultconflictlabels
448 labels = _defaultconflictlabels
449 if len(labels) < 3:
449 if len(labels) < 3:
450 labels.append('base')
450 labels.append('base')
451 return _imerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels)
451 return _imerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels)
452
452
453 def _imergeauto(repo, mynode, orig, fcd, fco, fca, toolconf, files,
453 def _imergeauto(repo, mynode, orig, fcd, fco, fca, toolconf, files,
454 labels=None, localorother=None):
454 labels=None, localorother=None):
455 """
455 """
456 Generic driver for _imergelocal and _imergeother
456 Generic driver for _imergelocal and _imergeother
457 """
457 """
458 assert localorother is not None
458 assert localorother is not None
459 tool, toolpath, binary, symlink, scriptfn = toolconf
459 tool, toolpath, binary, symlink, scriptfn = toolconf
460 r = simplemerge.simplemerge(repo.ui, fcd, fca, fco, label=labels,
460 r = simplemerge.simplemerge(repo.ui, fcd, fca, fco, label=labels,
461 localorother=localorother)
461 localorother=localorother)
462 return True, r
462 return True, r
463
463
464 @internaltool('merge-local', mergeonly, precheck=_mergecheck)
464 @internaltool('merge-local', mergeonly, precheck=_mergecheck)
465 def _imergelocal(*args, **kwargs):
465 def _imergelocal(*args, **kwargs):
466 """
466 """
467 Like :merge, but resolve all conflicts non-interactively in favor
467 Like :merge, but resolve all conflicts non-interactively in favor
468 of the local `p1()` changes."""
468 of the local `p1()` changes."""
469 success, status = _imergeauto(localorother='local', *args, **kwargs)
469 success, status = _imergeauto(localorother='local', *args, **kwargs)
470 return success, status, False
470 return success, status, False
471
471
472 @internaltool('merge-other', mergeonly, precheck=_mergecheck)
472 @internaltool('merge-other', mergeonly, precheck=_mergecheck)
473 def _imergeother(*args, **kwargs):
473 def _imergeother(*args, **kwargs):
474 """
474 """
475 Like :merge, but resolve all conflicts non-interactively in favor
475 Like :merge, but resolve all conflicts non-interactively in favor
476 of the other `p2()` changes."""
476 of the other `p2()` changes."""
477 success, status = _imergeauto(localorother='other', *args, **kwargs)
477 success, status = _imergeauto(localorother='other', *args, **kwargs)
478 return success, status, False
478 return success, status, False
479
479
480 @internaltool('tagmerge', mergeonly,
480 @internaltool('tagmerge', mergeonly,
481 _("automatic tag merging of %s failed! "
481 _("automatic tag merging of %s failed! "
482 "(use 'hg resolve --tool :merge' or another merge "
482 "(use 'hg resolve --tool :merge' or another merge "
483 "tool of your choice)\n"))
483 "tool of your choice)\n"))
484 def _itagmerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
484 def _itagmerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
485 """
485 """
486 Uses the internal tag merge algorithm (experimental).
486 Uses the internal tag merge algorithm (experimental).
487 """
487 """
488 success, status = tagmerge.merge(repo, fcd, fco, fca)
488 success, status = tagmerge.merge(repo, fcd, fco, fca)
489 return success, status, False
489 return success, status, False
490
490
491 @internaltool('dump', fullmerge, binary=True, symlink=True)
491 @internaltool('dump', fullmerge, binary=True, symlink=True)
492 def _idump(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
492 def _idump(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
493 """
493 """
494 Creates three versions of the files to merge, containing the
494 Creates three versions of the files to merge, containing the
495 contents of local, other and base. These files can then be used to
495 contents of local, other and base. These files can then be used to
496 perform a merge manually. If the file to be merged is named
496 perform a merge manually. If the file to be merged is named
497 ``a.txt``, these files will accordingly be named ``a.txt.local``,
497 ``a.txt``, these files will accordingly be named ``a.txt.local``,
498 ``a.txt.other`` and ``a.txt.base`` and they will be placed in the
498 ``a.txt.other`` and ``a.txt.base`` and they will be placed in the
499 same directory as ``a.txt``.
499 same directory as ``a.txt``.
500
500
501 This implies premerge. Therefore, files aren't dumped, if premerge
501 This implies premerge. Therefore, files aren't dumped, if premerge
502 runs successfully. Use :forcedump to forcibly write files out.
502 runs successfully. Use :forcedump to forcibly write files out.
503 """
503 """
504 a = _workingpath(repo, fcd)
504 a = _workingpath(repo, fcd)
505 fd = fcd.path()
505 fd = fcd.path()
506
506
507 from . import context
507 from . import context
508 if isinstance(fcd, context.overlayworkingfilectx):
508 if isinstance(fcd, context.overlayworkingfilectx):
509 raise error.InMemoryMergeConflictsError('in-memory merge does not '
509 raise error.InMemoryMergeConflictsError('in-memory merge does not '
510 'support the :dump tool.')
510 'support the :dump tool.')
511
511
512 util.writefile(a + ".local", fcd.decodeddata())
512 util.writefile(a + ".local", fcd.decodeddata())
513 repo.wwrite(fd + ".other", fco.data(), fco.flags())
513 repo.wwrite(fd + ".other", fco.data(), fco.flags())
514 repo.wwrite(fd + ".base", fca.data(), fca.flags())
514 repo.wwrite(fd + ".base", fca.data(), fca.flags())
515 return False, 1, False
515 return False, 1, False
516
516
517 @internaltool('forcedump', mergeonly, binary=True, symlink=True)
517 @internaltool('forcedump', mergeonly, binary=True, symlink=True)
518 def _forcedump(repo, mynode, orig, fcd, fco, fca, toolconf, files,
518 def _forcedump(repo, mynode, orig, fcd, fco, fca, toolconf, files,
519 labels=None):
519 labels=None):
520 """
520 """
521 Creates three versions of the files as same as :dump, but omits premerge.
521 Creates three versions of the files as same as :dump, but omits premerge.
522 """
522 """
523 return _idump(repo, mynode, orig, fcd, fco, fca, toolconf, files,
523 return _idump(repo, mynode, orig, fcd, fco, fca, toolconf, files,
524 labels=labels)
524 labels=labels)
525
525
526 def _xmergeimm(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
526 def _xmergeimm(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
527 # In-memory merge simply raises an exception on all external merge tools,
527 # In-memory merge simply raises an exception on all external merge tools,
528 # for now.
528 # for now.
529 #
529 #
530 # It would be possible to run most tools with temporary files, but this
530 # It would be possible to run most tools with temporary files, but this
531 # raises the question of what to do if the user only partially resolves the
531 # raises the question of what to do if the user only partially resolves the
532 # file -- we can't leave a merge state. (Copy to somewhere in the .hg/
532 # file -- we can't leave a merge state. (Copy to somewhere in the .hg/
533 # directory and tell the user how to get it is my best idea, but it's
533 # directory and tell the user how to get it is my best idea, but it's
534 # clunky.)
534 # clunky.)
535 raise error.InMemoryMergeConflictsError('in-memory merge does not support '
535 raise error.InMemoryMergeConflictsError('in-memory merge does not support '
536 'external merge tools')
536 'external merge tools')
537
537
538 def _xmerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
538 def _xmerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
539 tool, toolpath, binary, symlink, scriptfn = toolconf
539 tool, toolpath, binary, symlink, scriptfn = toolconf
540 if fcd.isabsent() or fco.isabsent():
540 if fcd.isabsent() or fco.isabsent():
541 repo.ui.warn(_('warning: %s cannot merge change/delete conflict '
541 repo.ui.warn(_('warning: %s cannot merge change/delete conflict '
542 'for %s\n') % (tool, fcd.path()))
542 'for %s\n') % (tool, fcd.path()))
543 return False, 1, None
543 return False, 1, None
544 unused, unused, unused, back = files
544 unused, unused, unused, back = files
545 localpath = _workingpath(repo, fcd)
545 localpath = _workingpath(repo, fcd)
546 args = _toolstr(repo.ui, tool, "args")
546 args = _toolstr(repo.ui, tool, "args")
547
547
548 with _maketempfiles(repo, fco, fca, repo.wvfs.join(back.path()),
548 with _maketempfiles(repo, fco, fca, repo.wvfs.join(back.path()),
549 "$output" in args) as temppaths:
549 "$output" in args) as temppaths:
550 basepath, otherpath, localoutputpath = temppaths
550 basepath, otherpath, localoutputpath = temppaths
551 outpath = ""
551 outpath = ""
552 mylabel, otherlabel = labels[:2]
552 mylabel, otherlabel = labels[:2]
553 if len(labels) >= 3:
553 if len(labels) >= 3:
554 baselabel = labels[2]
554 baselabel = labels[2]
555 else:
555 else:
556 baselabel = 'base'
556 baselabel = 'base'
557 env = {'HG_FILE': fcd.path(),
557 env = {'HG_FILE': fcd.path(),
558 'HG_MY_NODE': short(mynode),
558 'HG_MY_NODE': short(mynode),
559 'HG_OTHER_NODE': short(fco.changectx().node()),
559 'HG_OTHER_NODE': short(fco.changectx().node()),
560 'HG_BASE_NODE': short(fca.changectx().node()),
560 'HG_BASE_NODE': short(fca.changectx().node()),
561 'HG_MY_ISLINK': 'l' in fcd.flags(),
561 'HG_MY_ISLINK': 'l' in fcd.flags(),
562 'HG_OTHER_ISLINK': 'l' in fco.flags(),
562 'HG_OTHER_ISLINK': 'l' in fco.flags(),
563 'HG_BASE_ISLINK': 'l' in fca.flags(),
563 'HG_BASE_ISLINK': 'l' in fca.flags(),
564 'HG_MY_LABEL': mylabel,
564 'HG_MY_LABEL': mylabel,
565 'HG_OTHER_LABEL': otherlabel,
565 'HG_OTHER_LABEL': otherlabel,
566 'HG_BASE_LABEL': baselabel,
566 'HG_BASE_LABEL': baselabel,
567 }
567 }
568 ui = repo.ui
568 ui = repo.ui
569
569
570 if "$output" in args:
570 if "$output" in args:
571 # read input from backup, write to original
571 # read input from backup, write to original
572 outpath = localpath
572 outpath = localpath
573 localpath = localoutputpath
573 localpath = localoutputpath
574 replace = {'local': localpath, 'base': basepath, 'other': otherpath,
574 replace = {'local': localpath, 'base': basepath, 'other': otherpath,
575 'output': outpath, 'labellocal': mylabel,
575 'output': outpath, 'labellocal': mylabel,
576 'labelother': otherlabel, 'labelbase': baselabel}
576 'labelother': otherlabel, 'labelbase': baselabel}
577 args = util.interpolate(
577 args = util.interpolate(
578 br'\$', replace, args,
578 br'\$', replace, args,
579 lambda s: procutil.shellquote(util.localpath(s)))
579 lambda s: procutil.shellquote(util.localpath(s)))
580 if _toolbool(ui, tool, "gui"):
580 if _toolbool(ui, tool, "gui"):
581 repo.ui.status(_('running merge tool %s for file %s\n') %
581 repo.ui.status(_('running merge tool %s for file %s\n') %
582 (tool, fcd.path()))
582 (tool, fcd.path()))
583 if scriptfn is None:
583 if scriptfn is None:
584 cmd = toolpath + ' ' + args
584 cmd = toolpath + ' ' + args
585 repo.ui.debug('launching merge tool: %s\n' % cmd)
585 repo.ui.debug('launching merge tool: %s\n' % cmd)
586 r = ui.system(cmd, cwd=repo.root, environ=env,
586 r = ui.system(cmd, cwd=repo.root, environ=env,
587 blockedtag='mergetool')
587 blockedtag='mergetool')
588 else:
588 else:
589 repo.ui.debug('launching python merge script: %s:%s\n' %
589 repo.ui.debug('launching python merge script: %s:%s\n' %
590 (toolpath, scriptfn))
590 (toolpath, scriptfn))
591 r = 0
591 r = 0
592 try:
592 try:
593 # avoid cycle cmdutil->merge->filemerge->extensions->cmdutil
593 # avoid cycle cmdutil->merge->filemerge->extensions->cmdutil
594 from . import extensions
594 from . import extensions
595 mod = extensions.loadpath(toolpath, 'hgmerge.%s' % tool)
595 mod = extensions.loadpath(toolpath, 'hgmerge.%s' % tool)
596 except Exception:
596 except Exception:
597 raise error.Abort(_("loading python merge script failed: %s") %
597 raise error.Abort(_("loading python merge script failed: %s") %
598 toolpath)
598 toolpath)
599 mergefn = getattr(mod, scriptfn, None)
599 mergefn = getattr(mod, scriptfn, None)
600 if mergefn is None:
600 if mergefn is None:
601 raise error.Abort(_("%s does not have function: %s") %
601 raise error.Abort(_("%s does not have function: %s") %
602 (toolpath, scriptfn))
602 (toolpath, scriptfn))
603 argslist = procutil.shellsplit(args)
603 argslist = procutil.shellsplit(args)
604 # avoid cycle cmdutil->merge->filemerge->hook->extensions->cmdutil
604 # avoid cycle cmdutil->merge->filemerge->hook->extensions->cmdutil
605 from . import hook
605 from . import hook
606 ret, raised = hook.pythonhook(ui, repo, "merge", toolpath,
606 ret, raised = hook.pythonhook(ui, repo, "merge", toolpath,
607 mergefn, {'args': argslist}, True)
607 mergefn, {'args': argslist}, True)
608 if raised:
608 if raised:
609 r = 1
609 r = 1
610 repo.ui.debug('merge tool returned: %d\n' % r)
610 repo.ui.debug('merge tool returned: %d\n' % r)
611 return True, r, False
611 return True, r, False
612
612
613 def _formatconflictmarker(ctx, template, label, pad):
613 def _formatconflictmarker(ctx, template, label, pad):
614 """Applies the given template to the ctx, prefixed by the label.
614 """Applies the given template to the ctx, prefixed by the label.
615
615
616 Pad is the minimum width of the label prefix, so that multiple markers
616 Pad is the minimum width of the label prefix, so that multiple markers
617 can have aligned templated parts.
617 can have aligned templated parts.
618 """
618 """
619 if ctx.node() is None:
619 if ctx.node() is None:
620 ctx = ctx.p1()
620 ctx = ctx.p1()
621
621
622 props = {'ctx': ctx}
622 props = {'ctx': ctx}
623 templateresult = template.renderdefault(props)
623 templateresult = template.renderdefault(props)
624
624
625 label = ('%s:' % label).ljust(pad + 1)
625 label = ('%s:' % label).ljust(pad + 1)
626 mark = '%s %s' % (label, templateresult)
626 mark = '%s %s' % (label, templateresult)
627
627
628 if mark:
628 if mark:
629 mark = mark.splitlines()[0] # split for safety
629 mark = mark.splitlines()[0] # split for safety
630
630
631 # 8 for the prefix of conflict marker lines (e.g. '<<<<<<< ')
631 # 8 for the prefix of conflict marker lines (e.g. '<<<<<<< ')
632 return stringutil.ellipsis(mark, 80 - 8)
632 return stringutil.ellipsis(mark, 80 - 8)
633
633
634 _defaultconflictlabels = ['local', 'other']
634 _defaultconflictlabels = ['local', 'other']
635
635
636 def _formatlabels(repo, fcd, fco, fca, labels, tool=None):
636 def _formatlabels(repo, fcd, fco, fca, labels, tool=None):
637 """Formats the given labels using the conflict marker template.
637 """Formats the given labels using the conflict marker template.
638
638
639 Returns a list of formatted labels.
639 Returns a list of formatted labels.
640 """
640 """
641 cd = fcd.changectx()
641 cd = fcd.changectx()
642 co = fco.changectx()
642 co = fco.changectx()
643 ca = fca.changectx()
643 ca = fca.changectx()
644
644
645 ui = repo.ui
645 ui = repo.ui
646 template = ui.config('ui', 'mergemarkertemplate')
646 template = ui.config('ui', 'mergemarkertemplate')
647 if tool is not None:
647 if tool is not None:
648 template = _toolstr(ui, tool, 'mergemarkertemplate', template)
648 template = _toolstr(ui, tool, 'mergemarkertemplate', template)
649 template = templater.unquotestring(template)
649 template = templater.unquotestring(template)
650 tres = formatter.templateresources(ui, repo)
650 tres = formatter.templateresources(ui, repo)
651 tmpl = formatter.maketemplater(ui, template, defaults=templatekw.keywords,
651 tmpl = formatter.maketemplater(ui, template, defaults=templatekw.keywords,
652 resources=tres)
652 resources=tres)
653
653
654 pad = max(len(l) for l in labels)
654 pad = max(len(l) for l in labels)
655
655
656 newlabels = [_formatconflictmarker(cd, tmpl, labels[0], pad),
656 newlabels = [_formatconflictmarker(cd, tmpl, labels[0], pad),
657 _formatconflictmarker(co, tmpl, labels[1], pad)]
657 _formatconflictmarker(co, tmpl, labels[1], pad)]
658 if len(labels) > 2:
658 if len(labels) > 2:
659 newlabels.append(_formatconflictmarker(ca, tmpl, labels[2], pad))
659 newlabels.append(_formatconflictmarker(ca, tmpl, labels[2], pad))
660 return newlabels
660 return newlabels
661
661
662 def partextras(labels):
662 def partextras(labels):
663 """Return a dictionary of extra labels for use in prompts to the user
663 """Return a dictionary of extra labels for use in prompts to the user
664
664
665 Intended use is in strings of the form "(l)ocal%(l)s".
665 Intended use is in strings of the form "(l)ocal%(l)s".
666 """
666 """
667 if labels is None:
667 if labels is None:
668 return {
668 return {
669 "l": "",
669 "l": "",
670 "o": "",
670 "o": "",
671 }
671 }
672
672
673 return {
673 return {
674 "l": " [%s]" % labels[0],
674 "l": " [%s]" % labels[0],
675 "o": " [%s]" % labels[1],
675 "o": " [%s]" % labels[1],
676 }
676 }
677
677
678 def _restorebackup(fcd, back):
678 def _restorebackup(fcd, back):
679 # TODO: Add a workingfilectx.write(otherfilectx) path so we can use
679 # TODO: Add a workingfilectx.write(otherfilectx) path so we can use
680 # util.copy here instead.
680 # util.copy here instead.
681 fcd.write(back.data(), fcd.flags())
681 fcd.write(back.data(), fcd.flags())
682
682
683 def _makebackup(repo, ui, wctx, fcd, premerge):
683 def _makebackup(repo, ui, wctx, fcd, premerge):
684 """Makes and returns a filectx-like object for ``fcd``'s backup file.
684 """Makes and returns a filectx-like object for ``fcd``'s backup file.
685
685
686 In addition to preserving the user's pre-existing modifications to `fcd`
686 In addition to preserving the user's pre-existing modifications to `fcd`
687 (if any), the backup is used to undo certain premerges, confirm whether a
687 (if any), the backup is used to undo certain premerges, confirm whether a
688 merge changed anything, and determine what line endings the new file should
688 merge changed anything, and determine what line endings the new file should
689 have.
689 have.
690
690
691 Backups only need to be written once (right before the premerge) since their
691 Backups only need to be written once (right before the premerge) since their
692 content doesn't change afterwards.
692 content doesn't change afterwards.
693 """
693 """
694 if fcd.isabsent():
694 if fcd.isabsent():
695 return None
695 return None
696 # TODO: Break this import cycle somehow. (filectx -> ctx -> fileset ->
696 # TODO: Break this import cycle somehow. (filectx -> ctx -> fileset ->
697 # merge -> filemerge). (I suspect the fileset import is the weakest link)
697 # merge -> filemerge). (I suspect the fileset import is the weakest link)
698 from . import context
698 from . import context
699 a = _workingpath(repo, fcd)
699 a = _workingpath(repo, fcd)
700 back = scmutil.origpath(ui, repo, a)
700 back = scmutil.origpath(ui, repo, a)
701 inworkingdir = (back.startswith(repo.wvfs.base) and not
701 inworkingdir = (back.startswith(repo.wvfs.base) and not
702 back.startswith(repo.vfs.base))
702 back.startswith(repo.vfs.base))
703 if isinstance(fcd, context.overlayworkingfilectx) and inworkingdir:
703 if isinstance(fcd, context.overlayworkingfilectx) and inworkingdir:
704 # If the backup file is to be in the working directory, and we're
704 # If the backup file is to be in the working directory, and we're
705 # merging in-memory, we must redirect the backup to the memory context
705 # merging in-memory, we must redirect the backup to the memory context
706 # so we don't disturb the working directory.
706 # so we don't disturb the working directory.
707 relpath = back[len(repo.wvfs.base) + 1:]
707 relpath = back[len(repo.wvfs.base) + 1:]
708 if premerge:
708 if premerge:
709 wctx[relpath].write(fcd.data(), fcd.flags())
709 wctx[relpath].write(fcd.data(), fcd.flags())
710 return wctx[relpath]
710 return wctx[relpath]
711 else:
711 else:
712 if premerge:
712 if premerge:
713 # Otherwise, write to wherever path the user specified the backups
713 # Otherwise, write to wherever path the user specified the backups
714 # should go. We still need to switch based on whether the source is
714 # should go. We still need to switch based on whether the source is
715 # in-memory so we can use the fast path of ``util.copy`` if both are
715 # in-memory so we can use the fast path of ``util.copy`` if both are
716 # on disk.
716 # on disk.
717 if isinstance(fcd, context.overlayworkingfilectx):
717 if isinstance(fcd, context.overlayworkingfilectx):
718 util.writefile(back, fcd.data())
718 util.writefile(back, fcd.data())
719 else:
719 else:
720 util.copyfile(a, back)
720 util.copyfile(a, back)
721 # A arbitraryfilectx is returned, so we can run the same functions on
721 # A arbitraryfilectx is returned, so we can run the same functions on
722 # the backup context regardless of where it lives.
722 # the backup context regardless of where it lives.
723 return context.arbitraryfilectx(back, repo=repo)
723 return context.arbitraryfilectx(back, repo=repo)
724
724
725 @contextlib.contextmanager
725 @contextlib.contextmanager
726 def _maketempfiles(repo, fco, fca, localpath, uselocalpath):
726 def _maketempfiles(repo, fco, fca, localpath, uselocalpath):
727 """Writes out `fco` and `fca` as temporary files, and (if uselocalpath)
727 """Writes out `fco` and `fca` as temporary files, and (if uselocalpath)
728 copies `localpath` to another temporary file, so an external merge tool may
728 copies `localpath` to another temporary file, so an external merge tool may
729 use them.
729 use them.
730 """
730 """
731 tmproot = None
731 tmproot = None
732 tmprootprefix = repo.ui.config('experimental', 'mergetempdirprefix')
732 tmprootprefix = repo.ui.config('experimental', 'mergetempdirprefix')
733 if tmprootprefix:
733 if tmprootprefix:
734 tmproot = pycompat.mkdtemp(prefix=tmprootprefix)
734 tmproot = pycompat.mkdtemp(prefix=tmprootprefix)
735
735
736 def maketempfrompath(prefix, path):
736 def maketempfrompath(prefix, path):
737 fullbase, ext = os.path.splitext(path)
737 fullbase, ext = os.path.splitext(path)
738 pre = "%s~%s" % (os.path.basename(fullbase), prefix)
738 pre = "%s~%s" % (os.path.basename(fullbase), prefix)
739 if tmproot:
739 if tmproot:
740 name = os.path.join(tmproot, pre)
740 name = os.path.join(tmproot, pre)
741 if ext:
741 if ext:
742 name += ext
742 name += ext
743 f = open(name, r"wb")
743 f = open(name, r"wb")
744 else:
744 else:
745 fd, name = pycompat.mkstemp(prefix=pre + '.', suffix=ext)
745 fd, name = pycompat.mkstemp(prefix=pre + '.', suffix=ext)
746 f = os.fdopen(fd, r"wb")
746 f = os.fdopen(fd, r"wb")
747 return f, name
747 return f, name
748
748
749 def tempfromcontext(prefix, ctx):
749 def tempfromcontext(prefix, ctx):
750 f, name = maketempfrompath(prefix, ctx.path())
750 f, name = maketempfrompath(prefix, ctx.path())
751 data = repo.wwritedata(ctx.path(), ctx.data())
751 data = repo.wwritedata(ctx.path(), ctx.data())
752 f.write(data)
752 f.write(data)
753 f.close()
753 f.close()
754 return name
754 return name
755
755
756 b = tempfromcontext("base", fca)
756 b = tempfromcontext("base", fca)
757 c = tempfromcontext("other", fco)
757 c = tempfromcontext("other", fco)
758 d = localpath
758 d = localpath
759 if uselocalpath:
759 if uselocalpath:
760 # We start off with this being the backup filename, so remove the .orig
760 # We start off with this being the backup filename, so remove the .orig
761 # to make syntax-highlighting more likely.
761 # to make syntax-highlighting more likely.
762 if d.endswith('.orig'):
762 if d.endswith('.orig'):
763 d, _ = os.path.splitext(d)
763 d, _ = os.path.splitext(d)
764 f, d = maketempfrompath("local", d)
764 f, d = maketempfrompath("local", d)
765 with open(localpath, 'rb') as src:
765 with open(localpath, 'rb') as src:
766 f.write(src.read())
766 f.write(src.read())
767 f.close()
767 f.close()
768
768
769 try:
769 try:
770 yield b, c, d
770 yield b, c, d
771 finally:
771 finally:
772 if tmproot:
772 if tmproot:
773 shutil.rmtree(tmproot)
773 shutil.rmtree(tmproot)
774 else:
774 else:
775 util.unlink(b)
775 util.unlink(b)
776 util.unlink(c)
776 util.unlink(c)
777 # if not uselocalpath, d is the 'orig'/backup file which we
777 # if not uselocalpath, d is the 'orig'/backup file which we
778 # shouldn't delete.
778 # shouldn't delete.
779 if d and uselocalpath:
779 if d and uselocalpath:
780 util.unlink(d)
780 util.unlink(d)
781
781
782 def _filemerge(premerge, repo, wctx, mynode, orig, fcd, fco, fca, labels=None):
782 def _filemerge(premerge, repo, wctx, mynode, orig, fcd, fco, fca, labels=None):
783 """perform a 3-way merge in the working directory
783 """perform a 3-way merge in the working directory
784
784
785 premerge = whether this is a premerge
785 premerge = whether this is a premerge
786 mynode = parent node before merge
786 mynode = parent node before merge
787 orig = original local filename before merge
787 orig = original local filename before merge
788 fco = other file context
788 fco = other file context
789 fca = ancestor file context
789 fca = ancestor file context
790 fcd = local file context for current/destination file
790 fcd = local file context for current/destination file
791
791
792 Returns whether the merge is complete, the return value of the merge, and
792 Returns whether the merge is complete, the return value of the merge, and
793 a boolean indicating whether the file was deleted from disk."""
793 a boolean indicating whether the file was deleted from disk."""
794
794
795 if not fco.cmp(fcd): # files identical?
795 if not fco.cmp(fcd): # files identical?
796 return True, None, False
796 return True, None, False
797
797
798 ui = repo.ui
798 ui = repo.ui
799 fd = fcd.path()
799 fd = fcd.path()
800 binary = fcd.isbinary() or fco.isbinary() or fca.isbinary()
800 binary = fcd.isbinary() or fco.isbinary() or fca.isbinary()
801 symlink = 'l' in fcd.flags() + fco.flags()
801 symlink = 'l' in fcd.flags() + fco.flags()
802 changedelete = fcd.isabsent() or fco.isabsent()
802 changedelete = fcd.isabsent() or fco.isabsent()
803 tool, toolpath = _picktool(repo, ui, fd, binary, symlink, changedelete)
803 tool, toolpath = _picktool(repo, ui, fd, binary, symlink, changedelete)
804 scriptfn = None
804 scriptfn = None
805 if tool in internals and tool.startswith('internal:'):
805 if tool in internals and tool.startswith('internal:'):
806 # normalize to new-style names (':merge' etc)
806 # normalize to new-style names (':merge' etc)
807 tool = tool[len('internal'):]
807 tool = tool[len('internal'):]
808 if toolpath and toolpath.startswith('python:'):
808 if toolpath and toolpath.startswith('python:'):
809 invalidsyntax = False
809 invalidsyntax = False
810 if toolpath.count(':') >= 2:
810 if toolpath.count(':') >= 2:
811 script, scriptfn = toolpath[7:].rsplit(':', 1)
811 script, scriptfn = toolpath[7:].rsplit(':', 1)
812 if not scriptfn:
812 if not scriptfn:
813 invalidsyntax = True
813 invalidsyntax = True
814 # missing :callable can lead to spliting on windows drive letter
814 # missing :callable can lead to spliting on windows drive letter
815 if '\\' in scriptfn or '/' in scriptfn:
815 if '\\' in scriptfn or '/' in scriptfn:
816 invalidsyntax = True
816 invalidsyntax = True
817 else:
817 else:
818 invalidsyntax = True
818 invalidsyntax = True
819 if invalidsyntax:
819 if invalidsyntax:
820 raise error.Abort(_("invalid 'python:' syntax: %s") % toolpath)
820 raise error.Abort(_("invalid 'python:' syntax: %s") % toolpath)
821 toolpath = script
821 toolpath = script
822 ui.debug("picked tool '%s' for %s (binary %s symlink %s changedelete %s)\n"
822 ui.debug("picked tool '%s' for %s (binary %s symlink %s changedelete %s)\n"
823 % (tool, fd, pycompat.bytestr(binary), pycompat.bytestr(symlink),
823 % (tool, fd, pycompat.bytestr(binary), pycompat.bytestr(symlink),
824 pycompat.bytestr(changedelete)))
824 pycompat.bytestr(changedelete)))
825
825
826 if tool in internals:
826 if tool in internals:
827 func = internals[tool]
827 func = internals[tool]
828 mergetype = func.mergetype
828 mergetype = func.mergetype
829 onfailure = func.onfailure
829 onfailure = func.onfailure
830 precheck = func.precheck
830 precheck = func.precheck
831 isexternal = False
831 isexternal = False
832 else:
832 else:
833 if wctx.isinmemory():
833 if wctx.isinmemory():
834 func = _xmergeimm
834 func = _xmergeimm
835 else:
835 else:
836 func = _xmerge
836 func = _xmerge
837 mergetype = fullmerge
837 mergetype = fullmerge
838 onfailure = _("merging %s failed!\n")
838 onfailure = _("merging %s failed!\n")
839 precheck = None
839 precheck = None
840 isexternal = True
840 isexternal = True
841
841
842 toolconf = tool, toolpath, binary, symlink, scriptfn
842 toolconf = tool, toolpath, binary, symlink, scriptfn
843
843
844 if mergetype == nomerge:
844 if mergetype == nomerge:
845 r, deleted = func(repo, mynode, orig, fcd, fco, fca, toolconf, labels)
845 r, deleted = func(repo, mynode, orig, fcd, fco, fca, toolconf, labels)
846 return True, r, deleted
846 return True, r, deleted
847
847
848 if premerge:
848 if premerge:
849 if orig != fco.path():
849 if orig != fco.path():
850 ui.status(_("merging %s and %s to %s\n") % (orig, fco.path(), fd))
850 ui.status(_("merging %s and %s to %s\n") % (orig, fco.path(), fd))
851 else:
851 else:
852 ui.status(_("merging %s\n") % fd)
852 ui.status(_("merging %s\n") % fd)
853
853
854 ui.debug("my %s other %s ancestor %s\n" % (fcd, fco, fca))
854 ui.debug("my %s other %s ancestor %s\n" % (fcd, fco, fca))
855
855
856 if precheck and not precheck(repo, mynode, orig, fcd, fco, fca,
856 if precheck and not precheck(repo, mynode, orig, fcd, fco, fca,
857 toolconf):
857 toolconf):
858 if onfailure:
858 if onfailure:
859 if wctx.isinmemory():
859 if wctx.isinmemory():
860 raise error.InMemoryMergeConflictsError('in-memory merge does '
860 raise error.InMemoryMergeConflictsError('in-memory merge does '
861 'not support merge '
861 'not support merge '
862 'conflicts')
862 'conflicts')
863 ui.warn(onfailure % fd)
863 ui.warn(onfailure % fd)
864 return True, 1, False
864 return True, 1, False
865
865
866 back = _makebackup(repo, ui, wctx, fcd, premerge)
866 back = _makebackup(repo, ui, wctx, fcd, premerge)
867 files = (None, None, None, back)
867 files = (None, None, None, back)
868 r = 1
868 r = 1
869 try:
869 try:
870 internalmarkerstyle = ui.config('ui', 'mergemarkers')
870 internalmarkerstyle = ui.config('ui', 'mergemarkers')
871 if isexternal:
871 if isexternal:
872 markerstyle = _toolstr(ui, tool, 'mergemarkers')
872 markerstyle = _toolstr(ui, tool, 'mergemarkers')
873 else:
873 else:
874 markerstyle = internalmarkerstyle
874 markerstyle = internalmarkerstyle
875
875
876 if not labels:
876 if not labels:
877 labels = _defaultconflictlabels
877 labels = _defaultconflictlabels
878 formattedlabels = labels
878 formattedlabels = labels
879 if markerstyle != 'basic':
879 if markerstyle != 'basic':
880 formattedlabels = _formatlabels(repo, fcd, fco, fca, labels,
880 formattedlabels = _formatlabels(repo, fcd, fco, fca, labels,
881 tool=tool)
881 tool=tool)
882
882
883 if premerge and mergetype == fullmerge:
883 if premerge and mergetype == fullmerge:
884 # conflict markers generated by premerge will use 'detailed'
884 # conflict markers generated by premerge will use 'detailed'
885 # settings if either ui.mergemarkers or the tool's mergemarkers
885 # settings if either ui.mergemarkers or the tool's mergemarkers
886 # setting is 'detailed'. This way tools can have basic labels in
886 # setting is 'detailed'. This way tools can have basic labels in
887 # space-constrained areas of the UI, but still get full information
887 # space-constrained areas of the UI, but still get full information
888 # in conflict markers if premerge is 'keep' or 'keep-merge3'.
888 # in conflict markers if premerge is 'keep' or 'keep-merge3'.
889 premergelabels = labels
889 premergelabels = labels
890 labeltool = None
890 labeltool = None
891 if markerstyle != 'basic':
891 if markerstyle != 'basic':
892 # respect 'tool's mergemarkertemplate (which defaults to
892 # respect 'tool's mergemarkertemplate (which defaults to
893 # ui.mergemarkertemplate)
893 # ui.mergemarkertemplate)
894 labeltool = tool
894 labeltool = tool
895 if internalmarkerstyle != 'basic' or markerstyle != 'basic':
895 if internalmarkerstyle != 'basic' or markerstyle != 'basic':
896 premergelabels = _formatlabels(repo, fcd, fco, fca,
896 premergelabels = _formatlabels(repo, fcd, fco, fca,
897 premergelabels, tool=labeltool)
897 premergelabels, tool=labeltool)
898
898
899 r = _premerge(repo, fcd, fco, fca, toolconf, files,
899 r = _premerge(repo, fcd, fco, fca, toolconf, files,
900 labels=premergelabels)
900 labels=premergelabels)
901 # complete if premerge successful (r is 0)
901 # complete if premerge successful (r is 0)
902 return not r, r, False
902 return not r, r, False
903
903
904 needcheck, r, deleted = func(repo, mynode, orig, fcd, fco, fca,
904 needcheck, r, deleted = func(repo, mynode, orig, fcd, fco, fca,
905 toolconf, files, labels=formattedlabels)
905 toolconf, files, labels=formattedlabels)
906
906
907 if needcheck:
907 if needcheck:
908 r = _check(repo, r, ui, tool, fcd, files)
908 r = _check(repo, r, ui, tool, fcd, files)
909
909
910 if r:
910 if r:
911 if onfailure:
911 if onfailure:
912 if wctx.isinmemory():
912 if wctx.isinmemory():
913 raise error.InMemoryMergeConflictsError('in-memory merge '
913 raise error.InMemoryMergeConflictsError('in-memory merge '
914 'does not support '
914 'does not support '
915 'merge conflicts')
915 'merge conflicts')
916 ui.warn(onfailure % fd)
916 ui.warn(onfailure % fd)
917 _onfilemergefailure(ui)
917 _onfilemergefailure(ui)
918
918
919 return True, r, deleted
919 return True, r, deleted
920 finally:
920 finally:
921 if not r and back is not None:
921 if not r and back is not None:
922 back.remove()
922 back.remove()
923
923
924 def _haltmerge():
924 def _haltmerge():
925 msg = _('merge halted after failed merge (see hg resolve)')
925 msg = _('merge halted after failed merge (see hg resolve)')
926 raise error.InterventionRequired(msg)
926 raise error.InterventionRequired(msg)
927
927
928 def _onfilemergefailure(ui):
928 def _onfilemergefailure(ui):
929 action = ui.config('merge', 'on-failure')
929 action = ui.config('merge', 'on-failure')
930 if action == 'prompt':
930 if action == 'prompt':
931 msg = _('continue merge operation (yn)?' '$$ &Yes $$ &No')
931 msg = _('continue merge operation (yn)?' '$$ &Yes $$ &No')
932 if ui.promptchoice(msg, 0) == 1:
932 if ui.promptchoice(msg, 0) == 1:
933 _haltmerge()
933 _haltmerge()
934 if action == 'halt':
934 if action == 'halt':
935 _haltmerge()
935 _haltmerge()
936 # default action is 'continue', in which case we neither prompt nor halt
936 # default action is 'continue', in which case we neither prompt nor halt
937
937
938 def hasconflictmarkers(data):
938 def hasconflictmarkers(data):
939 return bool(re.search("^(<<<<<<< .*|=======|>>>>>>> .*)$", data,
939 return bool(re.search("^(<<<<<<< .*|=======|>>>>>>> .*)$", data,
940 re.MULTILINE))
940 re.MULTILINE))
941
941
942 def _check(repo, r, ui, tool, fcd, files):
942 def _check(repo, r, ui, tool, fcd, files):
943 fd = fcd.path()
943 fd = fcd.path()
944 unused, unused, unused, back = files
944 unused, unused, unused, back = files
945
945
946 if not r and (_toolbool(ui, tool, "checkconflicts") or
946 if not r and (_toolbool(ui, tool, "checkconflicts") or
947 'conflicts' in _toollist(ui, tool, "check")):
947 'conflicts' in _toollist(ui, tool, "check")):
948 if hasconflictmarkers(fcd.data()):
948 if hasconflictmarkers(fcd.data()):
949 r = 1
949 r = 1
950
950
951 checked = False
951 checked = False
952 if 'prompt' in _toollist(ui, tool, "check"):
952 if 'prompt' in _toollist(ui, tool, "check"):
953 checked = True
953 checked = True
954 if ui.promptchoice(_("was merge of '%s' successful (yn)?"
954 if ui.promptchoice(_("was merge of '%s' successful (yn)?"
955 "$$ &Yes $$ &No") % fd, 1):
955 "$$ &Yes $$ &No") % fd, 1):
956 r = 1
956 r = 1
957
957
958 if not r and not checked and (_toolbool(ui, tool, "checkchanged") or
958 if not r and not checked and (_toolbool(ui, tool, "checkchanged") or
959 'changed' in
959 'changed' in
960 _toollist(ui, tool, "check")):
960 _toollist(ui, tool, "check")):
961 if back is not None and not fcd.cmp(back):
961 if back is not None and not fcd.cmp(back):
962 if ui.promptchoice(_(" output file %s appears unchanged\n"
962 if ui.promptchoice(_(" output file %s appears unchanged\n"
963 "was merge successful (yn)?"
963 "was merge successful (yn)?"
964 "$$ &Yes $$ &No") % fd, 1):
964 "$$ &Yes $$ &No") % fd, 1):
965 r = 1
965 r = 1
966
966
967 if back is not None and _toolbool(ui, tool, "fixeol"):
967 if back is not None and _toolbool(ui, tool, "fixeol"):
968 _matcheol(_workingpath(repo, fcd), back)
968 _matcheol(_workingpath(repo, fcd), back)
969
969
970 return r
970 return r
971
971
972 def _workingpath(repo, ctx):
972 def _workingpath(repo, ctx):
973 return repo.wjoin(ctx.path())
973 return repo.wjoin(ctx.path())
974
974
975 def premerge(repo, wctx, mynode, orig, fcd, fco, fca, labels=None):
975 def premerge(repo, wctx, mynode, orig, fcd, fco, fca, labels=None):
976 return _filemerge(True, repo, wctx, mynode, orig, fcd, fco, fca,
976 return _filemerge(True, repo, wctx, mynode, orig, fcd, fco, fca,
977 labels=labels)
977 labels=labels)
978
978
979 def filemerge(repo, wctx, mynode, orig, fcd, fco, fca, labels=None):
979 def filemerge(repo, wctx, mynode, orig, fcd, fco, fca, labels=None):
980 return _filemerge(False, repo, wctx, mynode, orig, fcd, fco, fca,
980 return _filemerge(False, repo, wctx, mynode, orig, fcd, fco, fca,
981 labels=labels)
981 labels=labels)
982
982
983 def loadinternalmerge(ui, extname, registrarobj):
983 def loadinternalmerge(ui, extname, registrarobj):
984 """Load internal merge tool from specified registrarobj
984 """Load internal merge tool from specified registrarobj
985 """
985 """
986 for name, func in registrarobj._table.iteritems():
986 for name, func in registrarobj._table.iteritems():
987 fullname = ':' + name
987 fullname = ':' + name
988 internals[fullname] = func
988 internals[fullname] = func
989 internals['internal:' + name] = func
989 internals['internal:' + name] = func
990 internalsdoc[fullname] = func
990 internalsdoc[fullname] = func
991
991
992 capabilities = sorted([k for k, v in func.capabilities.items() if v])
993 if capabilities:
994 capdesc = _("(actual capabilities: %s)") % ', '.join(capabilities)
995 func.__doc__ = (func.__doc__ +
996 pycompat.sysstr("\n\n %s" % capdesc))
997
992 # load built-in merge tools explicitly to setup internalsdoc
998 # load built-in merge tools explicitly to setup internalsdoc
993 loadinternalmerge(None, None, internaltool)
999 loadinternalmerge(None, None, internaltool)
994
1000
995 # tell hggettext to extract docstrings from these functions:
1001 # tell hggettext to extract docstrings from these functions:
996 i18nfunctions = internals.values()
1002 i18nfunctions = internals.values()
@@ -1,101 +1,102
1 To merge files Mercurial uses merge tools.
1 To merge files Mercurial uses merge tools.
2
2
3 A merge tool combines two different versions of a file into a merged
3 A merge tool combines two different versions of a file into a merged
4 file. Merge tools are given the two files and the greatest common
4 file. Merge tools are given the two files and the greatest common
5 ancestor of the two file versions, so they can determine the changes
5 ancestor of the two file versions, so they can determine the changes
6 made on both branches.
6 made on both branches.
7
7
8 Merge tools are used both for :hg:`resolve`, :hg:`merge`, :hg:`update`,
8 Merge tools are used both for :hg:`resolve`, :hg:`merge`, :hg:`update`,
9 :hg:`backout` and in several extensions.
9 :hg:`backout` and in several extensions.
10
10
11 Usually, the merge tool tries to automatically reconcile the files by
11 Usually, the merge tool tries to automatically reconcile the files by
12 combining all non-overlapping changes that occurred separately in
12 combining all non-overlapping changes that occurred separately in
13 the two different evolutions of the same initial base file. Furthermore, some
13 the two different evolutions of the same initial base file. Furthermore, some
14 interactive merge programs make it easier to manually resolve
14 interactive merge programs make it easier to manually resolve
15 conflicting merges, either in a graphical way, or by inserting some
15 conflicting merges, either in a graphical way, or by inserting some
16 conflict markers. Mercurial does not include any interactive merge
16 conflict markers. Mercurial does not include any interactive merge
17 programs but relies on external tools for that.
17 programs but relies on external tools for that.
18
18
19 Available merge tools
19 Available merge tools
20 =====================
20 =====================
21
21
22 External merge tools and their properties are configured in the
22 External merge tools and their properties are configured in the
23 merge-tools configuration section - see hgrc(5) - but they can often just
23 merge-tools configuration section - see hgrc(5) - but they can often just
24 be named by their executable.
24 be named by their executable.
25
25
26 A merge tool is generally usable if its executable can be found on the
26 A merge tool is generally usable if its executable can be found on the
27 system and if it can handle the merge. The executable is found if it
27 system and if it can handle the merge. The executable is found if it
28 is an absolute or relative executable path or the name of an
28 is an absolute or relative executable path or the name of an
29 application in the executable search path. The tool is assumed to be
29 application in the executable search path. The tool is assumed to be
30 able to handle the merge if it can handle symlinks if the file is a
30 able to handle the merge if it can handle symlinks if the file is a
31 symlink, if it can handle binary files if the file is binary, and if a
31 symlink, if it can handle binary files if the file is binary, and if a
32 GUI is available if the tool requires a GUI.
32 GUI is available if the tool requires a GUI.
33
33
34 There are some internal merge tools which can be used. The internal
34 There are some internal merge tools which can be used. The internal
35 merge tools are:
35 merge tools are:
36
36
37 .. internaltoolsmarker
37 .. internaltoolsmarker
38
38
39 Internal tools are always available and do not require a GUI but will by default
39 Internal tools are always available and do not require a GUI but will
40 not handle symlinks or binary files.
40 by default not handle symlinks or binary files. See next section for
41 detail about "actual capabilities" described above.
41
42
42 Choosing a merge tool
43 Choosing a merge tool
43 =====================
44 =====================
44
45
45 Mercurial uses these rules when deciding which merge tool to use:
46 Mercurial uses these rules when deciding which merge tool to use:
46
47
47 1. If a tool has been specified with the --tool option to merge or resolve, it
48 1. If a tool has been specified with the --tool option to merge or resolve, it
48 is used. If it is the name of a tool in the merge-tools configuration, its
49 is used. If it is the name of a tool in the merge-tools configuration, its
49 configuration is used. Otherwise the specified tool must be executable by
50 configuration is used. Otherwise the specified tool must be executable by
50 the shell.
51 the shell.
51
52
52 2. If the ``HGMERGE`` environment variable is present, its value is used and
53 2. If the ``HGMERGE`` environment variable is present, its value is used and
53 must be executable by the shell.
54 must be executable by the shell.
54
55
55 3. If the filename of the file to be merged matches any of the patterns in the
56 3. If the filename of the file to be merged matches any of the patterns in the
56 merge-patterns configuration section, the first usable merge tool
57 merge-patterns configuration section, the first usable merge tool
57 corresponding to a matching pattern is used.
58 corresponding to a matching pattern is used.
58
59
59 4. If ui.merge is set it will be considered next. If the value is not the name
60 4. If ui.merge is set it will be considered next. If the value is not the name
60 of a configured tool, the specified value is used and must be executable by
61 of a configured tool, the specified value is used and must be executable by
61 the shell. Otherwise the named tool is used if it is usable.
62 the shell. Otherwise the named tool is used if it is usable.
62
63
63 5. If any usable merge tools are present in the merge-tools configuration
64 5. If any usable merge tools are present in the merge-tools configuration
64 section, the one with the highest priority is used.
65 section, the one with the highest priority is used.
65
66
66 6. If a program named ``hgmerge`` can be found on the system, it is used - but
67 6. If a program named ``hgmerge`` can be found on the system, it is used - but
67 it will by default not be used for symlinks and binary files.
68 it will by default not be used for symlinks and binary files.
68
69
69 7. If the file to be merged is not binary and is not a symlink, then
70 7. If the file to be merged is not binary and is not a symlink, then
70 internal ``:merge`` is used.
71 internal ``:merge`` is used.
71
72
72 8. Otherwise, ``:prompt`` is used.
73 8. Otherwise, ``:prompt`` is used.
73
74
74 For historical reason, Mercurial assumes capabilities of internal
75 For historical reason, Mercurial assumes capabilities of internal
75 merge tools as below while examining rules above, regardless of actual
76 merge tools as below while examining rules above, regardless of actual
76 capabilities of them.
77 capabilities of them.
77
78
78 ==== =============== ====== =======
79 ==== =============== ====== =======
79 step specified via binary symlink
80 step specified via binary symlink
80 ==== =============== ====== =======
81 ==== =============== ====== =======
81 1. --tool o o
82 1. --tool o o
82 2. HGMERGE o o
83 2. HGMERGE o o
83 3. merge-patterns o (*) x (*)
84 3. merge-patterns o (*) x (*)
84 4. ui.merge x (*) x (*)
85 4. ui.merge x (*) x (*)
85 ==== =============== ====== =======
86 ==== =============== ====== =======
86
87
87 If ``merge.strict-capability-check`` configuration is true, Mercurial
88 If ``merge.strict-capability-check`` configuration is true, Mercurial
88 checks capabilities of internal merge tools strictly in (*) cases
89 checks capabilities of internal merge tools strictly in (*) cases
89 above. It is false by default for backward compatibility.
90 above. It is false by default for backward compatibility.
90
91
91 .. note::
92 .. note::
92
93
93 After selecting a merge program, Mercurial will by default attempt
94 After selecting a merge program, Mercurial will by default attempt
94 to merge the files using a simple merge algorithm first. Only if it doesn't
95 to merge the files using a simple merge algorithm first. Only if it doesn't
95 succeed because of conflicting changes will Mercurial actually execute the
96 succeed because of conflicting changes will Mercurial actually execute the
96 merge program. Whether to use the simple merge algorithm first can be
97 merge program. Whether to use the simple merge algorithm first can be
97 controlled by the premerge setting of the merge tool. Premerge is enabled by
98 controlled by the premerge setting of the merge tool. Premerge is enabled by
98 default unless the file is binary or a symlink.
99 default unless the file is binary or a symlink.
99
100
100 See the merge-tools and ui sections of hgrc(5) for details on the
101 See the merge-tools and ui sections of hgrc(5) for details on the
101 configuration of merge tools.
102 configuration of merge tools.
@@ -1,3615 +1,3628
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 Extra extensions will be printed in help output in a non-reliable order since
47 Extra extensions will be printed in help output in a non-reliable order since
48 the extension is unknown.
48 the extension is unknown.
49 #if no-extraextensions
49 #if no-extraextensions
50
50
51 $ hg help
51 $ hg help
52 Mercurial Distributed SCM
52 Mercurial Distributed SCM
53
53
54 list of commands:
54 list of commands:
55
55
56 add add the specified files on the next commit
56 add add the specified files on the next commit
57 addremove add all new files, delete all missing files
57 addremove add all new files, delete all missing files
58 annotate show changeset information by line for each file
58 annotate show changeset information by line for each file
59 archive create an unversioned archive of a repository revision
59 archive create an unversioned archive of a repository revision
60 backout reverse effect of earlier changeset
60 backout reverse effect of earlier changeset
61 bisect subdivision search of changesets
61 bisect subdivision search of changesets
62 bookmarks create a new bookmark or list existing bookmarks
62 bookmarks create a new bookmark or list existing bookmarks
63 branch set or show the current branch name
63 branch set or show the current branch name
64 branches list repository named branches
64 branches list repository named branches
65 bundle create a bundle file
65 bundle create a bundle file
66 cat output the current or given revision of files
66 cat output the current or given revision of files
67 clone make a copy of an existing repository
67 clone make a copy of an existing repository
68 commit commit the specified files or all outstanding changes
68 commit commit the specified files or all outstanding changes
69 config show combined config settings from all hgrc files
69 config show combined config settings from all hgrc files
70 copy mark files as copied for the next commit
70 copy mark files as copied for the next commit
71 diff diff repository (or selected files)
71 diff diff repository (or selected files)
72 export dump the header and diffs for one or more changesets
72 export dump the header and diffs for one or more changesets
73 files list tracked files
73 files list tracked files
74 forget forget the specified files on the next commit
74 forget forget the specified files on the next commit
75 graft copy changes from other branches onto the current branch
75 graft copy changes from other branches onto the current branch
76 grep search revision history for a pattern in specified files
76 grep search revision history for a pattern in specified files
77 heads show branch heads
77 heads show branch heads
78 help show help for a given topic or a help overview
78 help show help for a given topic or a help overview
79 identify identify the working directory or specified revision
79 identify identify the working directory or specified revision
80 import import an ordered set of patches
80 import import an ordered set of patches
81 incoming show new changesets found in source
81 incoming show new changesets found in source
82 init create a new repository in the given directory
82 init create a new repository in the given directory
83 log show revision history of entire repository or files
83 log show revision history of entire repository or files
84 manifest output the current or given revision of the project manifest
84 manifest output the current or given revision of the project manifest
85 merge merge another revision into working directory
85 merge merge another revision into working directory
86 outgoing show changesets not found in the destination
86 outgoing show changesets not found in the destination
87 paths show aliases for remote repositories
87 paths show aliases for remote repositories
88 phase set or show the current phase name
88 phase set or show the current phase name
89 pull pull changes from the specified source
89 pull pull changes from the specified source
90 push push changes to the specified destination
90 push push changes to the specified destination
91 recover roll back an interrupted transaction
91 recover roll back an interrupted transaction
92 remove remove the specified files on the next commit
92 remove remove the specified files on the next commit
93 rename rename files; equivalent of copy + remove
93 rename rename files; equivalent of copy + remove
94 resolve redo merges or set/view the merge status of files
94 resolve redo merges or set/view the merge status of files
95 revert restore files to their checkout state
95 revert restore files to their checkout state
96 root print the root (top) of the current working directory
96 root print the root (top) of the current working directory
97 serve start stand-alone webserver
97 serve start stand-alone webserver
98 status show changed files in the working directory
98 status show changed files in the working directory
99 summary summarize working directory state
99 summary summarize working directory state
100 tag add one or more tags for the current or given revision
100 tag add one or more tags for the current or given revision
101 tags list repository tags
101 tags list repository tags
102 unbundle apply one or more bundle files
102 unbundle apply one or more bundle files
103 update update working directory (or switch revisions)
103 update update working directory (or switch revisions)
104 verify verify the integrity of the repository
104 verify verify the integrity of the repository
105 version output version and copyright information
105 version output version and copyright information
106
106
107 additional help topics:
107 additional help topics:
108
108
109 bundlespec Bundle File Formats
109 bundlespec Bundle File Formats
110 color Colorizing Outputs
110 color Colorizing Outputs
111 config Configuration Files
111 config Configuration Files
112 dates Date Formats
112 dates Date Formats
113 deprecated Deprecated Features
113 deprecated Deprecated Features
114 diffs Diff Formats
114 diffs Diff Formats
115 environment Environment Variables
115 environment Environment Variables
116 extensions Using Additional Features
116 extensions Using Additional Features
117 filesets Specifying File Sets
117 filesets Specifying File Sets
118 flags Command-line flags
118 flags Command-line flags
119 glossary Glossary
119 glossary Glossary
120 hgignore Syntax for Mercurial Ignore Files
120 hgignore Syntax for Mercurial Ignore Files
121 hgweb Configuring hgweb
121 hgweb Configuring hgweb
122 internals Technical implementation topics
122 internals Technical implementation topics
123 merge-tools Merge Tools
123 merge-tools Merge Tools
124 pager Pager Support
124 pager Pager Support
125 patterns File Name Patterns
125 patterns File Name Patterns
126 phases Working with Phases
126 phases Working with Phases
127 revisions Specifying Revisions
127 revisions Specifying Revisions
128 scripting Using Mercurial from scripts and automation
128 scripting Using Mercurial from scripts and automation
129 subrepos Subrepositories
129 subrepos Subrepositories
130 templating Template Usage
130 templating Template Usage
131 urls URL Paths
131 urls URL Paths
132
132
133 (use 'hg help -v' to show built-in aliases and global options)
133 (use 'hg help -v' to show built-in aliases and global options)
134
134
135 $ hg -q help
135 $ hg -q help
136 add add the specified files on the next commit
136 add add the specified files on the next commit
137 addremove add all new files, delete all missing files
137 addremove add all new files, delete all missing files
138 annotate show changeset information by line for each file
138 annotate show changeset information by line for each file
139 archive create an unversioned archive of a repository revision
139 archive create an unversioned archive of a repository revision
140 backout reverse effect of earlier changeset
140 backout reverse effect of earlier changeset
141 bisect subdivision search of changesets
141 bisect subdivision search of changesets
142 bookmarks create a new bookmark or list existing bookmarks
142 bookmarks create a new bookmark or list existing bookmarks
143 branch set or show the current branch name
143 branch set or show the current branch name
144 branches list repository named branches
144 branches list repository named branches
145 bundle create a bundle file
145 bundle create a bundle file
146 cat output the current or given revision of files
146 cat output the current or given revision of files
147 clone make a copy of an existing repository
147 clone make a copy of an existing repository
148 commit commit the specified files or all outstanding changes
148 commit commit the specified files or all outstanding changes
149 config show combined config settings from all hgrc files
149 config show combined config settings from all hgrc files
150 copy mark files as copied for the next commit
150 copy mark files as copied for the next commit
151 diff diff repository (or selected files)
151 diff diff repository (or selected files)
152 export dump the header and diffs for one or more changesets
152 export dump the header and diffs for one or more changesets
153 files list tracked files
153 files list tracked files
154 forget forget the specified files on the next commit
154 forget forget the specified files on the next commit
155 graft copy changes from other branches onto the current branch
155 graft copy changes from other branches onto the current branch
156 grep search revision history for a pattern in specified files
156 grep search revision history for a pattern in specified files
157 heads show branch heads
157 heads show branch heads
158 help show help for a given topic or a help overview
158 help show help for a given topic or a help overview
159 identify identify the working directory or specified revision
159 identify identify the working directory or specified revision
160 import import an ordered set of patches
160 import import an ordered set of patches
161 incoming show new changesets found in source
161 incoming show new changesets found in source
162 init create a new repository in the given directory
162 init create a new repository in the given directory
163 log show revision history of entire repository or files
163 log show revision history of entire repository or files
164 manifest output the current or given revision of the project manifest
164 manifest output the current or given revision of the project manifest
165 merge merge another revision into working directory
165 merge merge another revision into working directory
166 outgoing show changesets not found in the destination
166 outgoing show changesets not found in the destination
167 paths show aliases for remote repositories
167 paths show aliases for remote repositories
168 phase set or show the current phase name
168 phase set or show the current phase name
169 pull pull changes from the specified source
169 pull pull changes from the specified source
170 push push changes to the specified destination
170 push push changes to the specified destination
171 recover roll back an interrupted transaction
171 recover roll back an interrupted transaction
172 remove remove the specified files on the next commit
172 remove remove the specified files on the next commit
173 rename rename files; equivalent of copy + remove
173 rename rename files; equivalent of copy + remove
174 resolve redo merges or set/view the merge status of files
174 resolve redo merges or set/view the merge status of files
175 revert restore files to their checkout state
175 revert restore files to their checkout state
176 root print the root (top) of the current working directory
176 root print the root (top) of the current working directory
177 serve start stand-alone webserver
177 serve start stand-alone webserver
178 status show changed files in the working directory
178 status show changed files in the working directory
179 summary summarize working directory state
179 summary summarize working directory state
180 tag add one or more tags for the current or given revision
180 tag add one or more tags for the current or given revision
181 tags list repository tags
181 tags list repository tags
182 unbundle apply one or more bundle files
182 unbundle apply one or more bundle files
183 update update working directory (or switch revisions)
183 update update working directory (or switch revisions)
184 verify verify the integrity of the repository
184 verify verify the integrity of the repository
185 version output version and copyright information
185 version output version and copyright information
186
186
187 additional help topics:
187 additional help topics:
188
188
189 bundlespec Bundle File Formats
189 bundlespec Bundle File Formats
190 color Colorizing Outputs
190 color Colorizing Outputs
191 config Configuration Files
191 config Configuration Files
192 dates Date Formats
192 dates Date Formats
193 deprecated Deprecated Features
193 deprecated Deprecated Features
194 diffs Diff Formats
194 diffs Diff Formats
195 environment Environment Variables
195 environment Environment Variables
196 extensions Using Additional Features
196 extensions Using Additional Features
197 filesets Specifying File Sets
197 filesets Specifying File Sets
198 flags Command-line flags
198 flags Command-line flags
199 glossary Glossary
199 glossary Glossary
200 hgignore Syntax for Mercurial Ignore Files
200 hgignore Syntax for Mercurial Ignore Files
201 hgweb Configuring hgweb
201 hgweb Configuring hgweb
202 internals Technical implementation topics
202 internals Technical implementation topics
203 merge-tools Merge Tools
203 merge-tools Merge Tools
204 pager Pager Support
204 pager Pager Support
205 patterns File Name Patterns
205 patterns File Name Patterns
206 phases Working with Phases
206 phases Working with Phases
207 revisions Specifying Revisions
207 revisions Specifying Revisions
208 scripting Using Mercurial from scripts and automation
208 scripting Using Mercurial from scripts and automation
209 subrepos Subrepositories
209 subrepos Subrepositories
210 templating Template Usage
210 templating Template Usage
211 urls URL Paths
211 urls URL Paths
212
212
213 Test extension help:
213 Test extension help:
214 $ hg help extensions --config extensions.rebase= --config extensions.children=
214 $ hg help extensions --config extensions.rebase= --config extensions.children=
215 Using Additional Features
215 Using Additional Features
216 """""""""""""""""""""""""
216 """""""""""""""""""""""""
217
217
218 Mercurial has the ability to add new features through the use of
218 Mercurial has the ability to add new features through the use of
219 extensions. Extensions may add new commands, add options to existing
219 extensions. Extensions may add new commands, add options to existing
220 commands, change the default behavior of commands, or implement hooks.
220 commands, change the default behavior of commands, or implement hooks.
221
221
222 To enable the "foo" extension, either shipped with Mercurial or in the
222 To enable the "foo" extension, either shipped with Mercurial or in the
223 Python search path, create an entry for it in your configuration file,
223 Python search path, create an entry for it in your configuration file,
224 like this:
224 like this:
225
225
226 [extensions]
226 [extensions]
227 foo =
227 foo =
228
228
229 You may also specify the full path to an extension:
229 You may also specify the full path to an extension:
230
230
231 [extensions]
231 [extensions]
232 myfeature = ~/.hgext/myfeature.py
232 myfeature = ~/.hgext/myfeature.py
233
233
234 See 'hg help config' for more information on configuration files.
234 See 'hg help config' for more information on configuration files.
235
235
236 Extensions are not loaded by default for a variety of reasons: they can
236 Extensions are not loaded by default for a variety of reasons: they can
237 increase startup overhead; they may be meant for advanced usage only; they
237 increase startup overhead; they may be meant for advanced usage only; they
238 may provide potentially dangerous abilities (such as letting you destroy
238 may provide potentially dangerous abilities (such as letting you destroy
239 or modify history); they might not be ready for prime time; or they may
239 or modify history); they might not be ready for prime time; or they may
240 alter some usual behaviors of stock Mercurial. It is thus up to the user
240 alter some usual behaviors of stock Mercurial. It is thus up to the user
241 to activate extensions as needed.
241 to activate extensions as needed.
242
242
243 To explicitly disable an extension enabled in a configuration file of
243 To explicitly disable an extension enabled in a configuration file of
244 broader scope, prepend its path with !:
244 broader scope, prepend its path with !:
245
245
246 [extensions]
246 [extensions]
247 # disabling extension bar residing in /path/to/extension/bar.py
247 # disabling extension bar residing in /path/to/extension/bar.py
248 bar = !/path/to/extension/bar.py
248 bar = !/path/to/extension/bar.py
249 # ditto, but no path was supplied for extension baz
249 # ditto, but no path was supplied for extension baz
250 baz = !
250 baz = !
251
251
252 enabled extensions:
252 enabled extensions:
253
253
254 children command to display child changesets (DEPRECATED)
254 children command to display child changesets (DEPRECATED)
255 rebase command to move sets of revisions to a different ancestor
255 rebase command to move sets of revisions to a different ancestor
256
256
257 disabled extensions:
257 disabled extensions:
258
258
259 acl hooks for controlling repository access
259 acl hooks for controlling repository access
260 blackbox log repository events to a blackbox for debugging
260 blackbox log repository events to a blackbox for debugging
261 bugzilla hooks for integrating with the Bugzilla bug tracker
261 bugzilla hooks for integrating with the Bugzilla bug tracker
262 censor erase file content at a given revision
262 censor erase file content at a given revision
263 churn command to display statistics about repository history
263 churn command to display statistics about repository history
264 clonebundles advertise pre-generated bundles to seed clones
264 clonebundles advertise pre-generated bundles to seed clones
265 convert import revisions from foreign VCS repositories into
265 convert import revisions from foreign VCS repositories into
266 Mercurial
266 Mercurial
267 eol automatically manage newlines in repository files
267 eol automatically manage newlines in repository files
268 extdiff command to allow external programs to compare revisions
268 extdiff command to allow external programs to compare revisions
269 factotum http authentication with factotum
269 factotum http authentication with factotum
270 githelp try mapping git commands to Mercurial commands
270 githelp try mapping git commands to Mercurial commands
271 gpg commands to sign and verify changesets
271 gpg commands to sign and verify changesets
272 hgk browse the repository in a graphical way
272 hgk browse the repository in a graphical way
273 highlight syntax highlighting for hgweb (requires Pygments)
273 highlight syntax highlighting for hgweb (requires Pygments)
274 histedit interactive history editing
274 histedit interactive history editing
275 keyword expand keywords in tracked files
275 keyword expand keywords in tracked files
276 largefiles track large binary files
276 largefiles track large binary files
277 mq manage a stack of patches
277 mq manage a stack of patches
278 notify hooks for sending email push notifications
278 notify hooks for sending email push notifications
279 patchbomb command to send changesets as (a series of) patch emails
279 patchbomb command to send changesets as (a series of) patch emails
280 purge command to delete untracked files from the working
280 purge command to delete untracked files from the working
281 directory
281 directory
282 relink recreates hardlinks between repository clones
282 relink recreates hardlinks between repository clones
283 schemes extend schemes with shortcuts to repository swarms
283 schemes extend schemes with shortcuts to repository swarms
284 share share a common history between several working directories
284 share share a common history between several working directories
285 shelve save and restore changes to the working directory
285 shelve save and restore changes to the working directory
286 strip strip changesets and their descendants from history
286 strip strip changesets and their descendants from history
287 transplant command to transplant changesets from another branch
287 transplant command to transplant changesets from another branch
288 win32mbcs allow the use of MBCS paths with problematic encodings
288 win32mbcs allow the use of MBCS paths with problematic encodings
289 zeroconf discover and advertise repositories on the local network
289 zeroconf discover and advertise repositories on the local network
290
290
291 #endif
291 #endif
292
292
293 Verify that deprecated extensions are included if --verbose:
293 Verify that deprecated extensions are included if --verbose:
294
294
295 $ hg -v help extensions | grep children
295 $ hg -v help extensions | grep children
296 children command to display child changesets (DEPRECATED)
296 children command to display child changesets (DEPRECATED)
297
297
298 Verify that extension keywords appear in help templates
298 Verify that extension keywords appear in help templates
299
299
300 $ hg help --config extensions.transplant= templating|grep transplant > /dev/null
300 $ hg help --config extensions.transplant= templating|grep transplant > /dev/null
301
301
302 Test short command list with verbose option
302 Test short command list with verbose option
303
303
304 $ hg -v help shortlist
304 $ hg -v help shortlist
305 Mercurial Distributed SCM
305 Mercurial Distributed SCM
306
306
307 basic commands:
307 basic commands:
308
308
309 add add the specified files on the next commit
309 add add the specified files on the next commit
310 annotate, blame
310 annotate, blame
311 show changeset information by line for each file
311 show changeset information by line for each file
312 clone make a copy of an existing repository
312 clone make a copy of an existing repository
313 commit, ci commit the specified files or all outstanding changes
313 commit, ci commit the specified files or all outstanding changes
314 diff diff repository (or selected files)
314 diff diff repository (or selected files)
315 export dump the header and diffs for one or more changesets
315 export dump the header and diffs for one or more changesets
316 forget forget the specified files on the next commit
316 forget forget the specified files on the next commit
317 init create a new repository in the given directory
317 init create a new repository in the given directory
318 log, history show revision history of entire repository or files
318 log, history show revision history of entire repository or files
319 merge merge another revision into working directory
319 merge merge another revision into working directory
320 pull pull changes from the specified source
320 pull pull changes from the specified source
321 push push changes to the specified destination
321 push push changes to the specified destination
322 remove, rm remove the specified files on the next commit
322 remove, rm remove the specified files on the next commit
323 serve start stand-alone webserver
323 serve start stand-alone webserver
324 status, st show changed files in the working directory
324 status, st show changed files in the working directory
325 summary, sum summarize working directory state
325 summary, sum summarize working directory state
326 update, up, checkout, co
326 update, up, checkout, co
327 update working directory (or switch revisions)
327 update working directory (or switch revisions)
328
328
329 global options ([+] can be repeated):
329 global options ([+] can be repeated):
330
330
331 -R --repository REPO repository root directory or name of overlay bundle
331 -R --repository REPO repository root directory or name of overlay bundle
332 file
332 file
333 --cwd DIR change working directory
333 --cwd DIR change working directory
334 -y --noninteractive do not prompt, automatically pick the first choice for
334 -y --noninteractive do not prompt, automatically pick the first choice for
335 all prompts
335 all prompts
336 -q --quiet suppress output
336 -q --quiet suppress output
337 -v --verbose enable additional output
337 -v --verbose enable additional output
338 --color TYPE when to colorize (boolean, always, auto, never, or
338 --color TYPE when to colorize (boolean, always, auto, never, or
339 debug)
339 debug)
340 --config CONFIG [+] set/override config option (use 'section.name=value')
340 --config CONFIG [+] set/override config option (use 'section.name=value')
341 --debug enable debugging output
341 --debug enable debugging output
342 --debugger start debugger
342 --debugger start debugger
343 --encoding ENCODE set the charset encoding (default: ascii)
343 --encoding ENCODE set the charset encoding (default: ascii)
344 --encodingmode MODE set the charset encoding mode (default: strict)
344 --encodingmode MODE set the charset encoding mode (default: strict)
345 --traceback always print a traceback on exception
345 --traceback always print a traceback on exception
346 --time time how long the command takes
346 --time time how long the command takes
347 --profile print command execution profile
347 --profile print command execution profile
348 --version output version information and exit
348 --version output version information and exit
349 -h --help display help and exit
349 -h --help display help and exit
350 --hidden consider hidden changesets
350 --hidden consider hidden changesets
351 --pager TYPE when to paginate (boolean, always, auto, or never)
351 --pager TYPE when to paginate (boolean, always, auto, or never)
352 (default: auto)
352 (default: auto)
353
353
354 (use 'hg help' for the full list of commands)
354 (use 'hg help' for the full list of commands)
355
355
356 $ hg add -h
356 $ hg add -h
357 hg add [OPTION]... [FILE]...
357 hg add [OPTION]... [FILE]...
358
358
359 add the specified files on the next commit
359 add the specified files on the next commit
360
360
361 Schedule files to be version controlled and added to the repository.
361 Schedule files to be version controlled and added to the repository.
362
362
363 The files will be added to the repository at the next commit. To undo an
363 The files will be added to the repository at the next commit. To undo an
364 add before that, see 'hg forget'.
364 add before that, see 'hg forget'.
365
365
366 If no names are given, add all files to the repository (except files
366 If no names are given, add all files to the repository (except files
367 matching ".hgignore").
367 matching ".hgignore").
368
368
369 Returns 0 if all files are successfully added.
369 Returns 0 if all files are successfully added.
370
370
371 options ([+] can be repeated):
371 options ([+] can be repeated):
372
372
373 -I --include PATTERN [+] include names matching the given patterns
373 -I --include PATTERN [+] include names matching the given patterns
374 -X --exclude PATTERN [+] exclude names matching the given patterns
374 -X --exclude PATTERN [+] exclude names matching the given patterns
375 -S --subrepos recurse into subrepositories
375 -S --subrepos recurse into subrepositories
376 -n --dry-run do not perform actions, just print output
376 -n --dry-run do not perform actions, just print output
377
377
378 (some details hidden, use --verbose to show complete help)
378 (some details hidden, use --verbose to show complete help)
379
379
380 Verbose help for add
380 Verbose help for add
381
381
382 $ hg add -hv
382 $ hg add -hv
383 hg add [OPTION]... [FILE]...
383 hg add [OPTION]... [FILE]...
384
384
385 add the specified files on the next commit
385 add the specified files on the next commit
386
386
387 Schedule files to be version controlled and added to the repository.
387 Schedule files to be version controlled and added to the repository.
388
388
389 The files will be added to the repository at the next commit. To undo an
389 The files will be added to the repository at the next commit. To undo an
390 add before that, see 'hg forget'.
390 add before that, see 'hg forget'.
391
391
392 If no names are given, add all files to the repository (except files
392 If no names are given, add all files to the repository (except files
393 matching ".hgignore").
393 matching ".hgignore").
394
394
395 Examples:
395 Examples:
396
396
397 - New (unknown) files are added automatically by 'hg add':
397 - New (unknown) files are added automatically by 'hg add':
398
398
399 $ ls
399 $ ls
400 foo.c
400 foo.c
401 $ hg status
401 $ hg status
402 ? foo.c
402 ? foo.c
403 $ hg add
403 $ hg add
404 adding foo.c
404 adding foo.c
405 $ hg status
405 $ hg status
406 A foo.c
406 A foo.c
407
407
408 - Specific files to be added can be specified:
408 - Specific files to be added can be specified:
409
409
410 $ ls
410 $ ls
411 bar.c foo.c
411 bar.c foo.c
412 $ hg status
412 $ hg status
413 ? bar.c
413 ? bar.c
414 ? foo.c
414 ? foo.c
415 $ hg add bar.c
415 $ hg add bar.c
416 $ hg status
416 $ hg status
417 A bar.c
417 A bar.c
418 ? foo.c
418 ? foo.c
419
419
420 Returns 0 if all files are successfully added.
420 Returns 0 if all files are successfully added.
421
421
422 options ([+] can be repeated):
422 options ([+] can be repeated):
423
423
424 -I --include PATTERN [+] include names matching the given patterns
424 -I --include PATTERN [+] include names matching the given patterns
425 -X --exclude PATTERN [+] exclude names matching the given patterns
425 -X --exclude PATTERN [+] exclude names matching the given patterns
426 -S --subrepos recurse into subrepositories
426 -S --subrepos recurse into subrepositories
427 -n --dry-run do not perform actions, just print output
427 -n --dry-run do not perform actions, just print output
428
428
429 global options ([+] can be repeated):
429 global options ([+] can be repeated):
430
430
431 -R --repository REPO repository root directory or name of overlay bundle
431 -R --repository REPO repository root directory or name of overlay bundle
432 file
432 file
433 --cwd DIR change working directory
433 --cwd DIR change working directory
434 -y --noninteractive do not prompt, automatically pick the first choice for
434 -y --noninteractive do not prompt, automatically pick the first choice for
435 all prompts
435 all prompts
436 -q --quiet suppress output
436 -q --quiet suppress output
437 -v --verbose enable additional output
437 -v --verbose enable additional output
438 --color TYPE when to colorize (boolean, always, auto, never, or
438 --color TYPE when to colorize (boolean, always, auto, never, or
439 debug)
439 debug)
440 --config CONFIG [+] set/override config option (use 'section.name=value')
440 --config CONFIG [+] set/override config option (use 'section.name=value')
441 --debug enable debugging output
441 --debug enable debugging output
442 --debugger start debugger
442 --debugger start debugger
443 --encoding ENCODE set the charset encoding (default: ascii)
443 --encoding ENCODE set the charset encoding (default: ascii)
444 --encodingmode MODE set the charset encoding mode (default: strict)
444 --encodingmode MODE set the charset encoding mode (default: strict)
445 --traceback always print a traceback on exception
445 --traceback always print a traceback on exception
446 --time time how long the command takes
446 --time time how long the command takes
447 --profile print command execution profile
447 --profile print command execution profile
448 --version output version information and exit
448 --version output version information and exit
449 -h --help display help and exit
449 -h --help display help and exit
450 --hidden consider hidden changesets
450 --hidden consider hidden changesets
451 --pager TYPE when to paginate (boolean, always, auto, or never)
451 --pager TYPE when to paginate (boolean, always, auto, or never)
452 (default: auto)
452 (default: auto)
453
453
454 Test the textwidth config option
454 Test the textwidth config option
455
455
456 $ hg root -h --config ui.textwidth=50
456 $ hg root -h --config ui.textwidth=50
457 hg root
457 hg root
458
458
459 print the root (top) of the current working
459 print the root (top) of the current working
460 directory
460 directory
461
461
462 Print the root directory of the current
462 Print the root directory of the current
463 repository.
463 repository.
464
464
465 Returns 0 on success.
465 Returns 0 on success.
466
466
467 (some details hidden, use --verbose to show
467 (some details hidden, use --verbose to show
468 complete help)
468 complete help)
469
469
470 Test help option with version option
470 Test help option with version option
471
471
472 $ hg add -h --version
472 $ hg add -h --version
473 Mercurial Distributed SCM (version *) (glob)
473 Mercurial Distributed SCM (version *) (glob)
474 (see https://mercurial-scm.org for more information)
474 (see https://mercurial-scm.org for more information)
475
475
476 Copyright (C) 2005-* Matt Mackall and others (glob)
476 Copyright (C) 2005-* Matt Mackall and others (glob)
477 This is free software; see the source for copying conditions. There is NO
477 This is free software; see the source for copying conditions. There is NO
478 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
478 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
479
479
480 $ hg add --skjdfks
480 $ hg add --skjdfks
481 hg add: option --skjdfks not recognized
481 hg add: option --skjdfks not recognized
482 hg add [OPTION]... [FILE]...
482 hg add [OPTION]... [FILE]...
483
483
484 add the specified files on the next commit
484 add the specified files on the next commit
485
485
486 options ([+] can be repeated):
486 options ([+] can be repeated):
487
487
488 -I --include PATTERN [+] include names matching the given patterns
488 -I --include PATTERN [+] include names matching the given patterns
489 -X --exclude PATTERN [+] exclude names matching the given patterns
489 -X --exclude PATTERN [+] exclude names matching the given patterns
490 -S --subrepos recurse into subrepositories
490 -S --subrepos recurse into subrepositories
491 -n --dry-run do not perform actions, just print output
491 -n --dry-run do not perform actions, just print output
492
492
493 (use 'hg add -h' to show more help)
493 (use 'hg add -h' to show more help)
494 [255]
494 [255]
495
495
496 Test ambiguous command help
496 Test ambiguous command help
497
497
498 $ hg help ad
498 $ hg help ad
499 list of commands:
499 list of commands:
500
500
501 add add the specified files on the next commit
501 add add the specified files on the next commit
502 addremove add all new files, delete all missing files
502 addremove add all new files, delete all missing files
503
503
504 (use 'hg help -v ad' to show built-in aliases and global options)
504 (use 'hg help -v ad' to show built-in aliases and global options)
505
505
506 Test command without options
506 Test command without options
507
507
508 $ hg help verify
508 $ hg help verify
509 hg verify
509 hg verify
510
510
511 verify the integrity of the repository
511 verify the integrity of the repository
512
512
513 Verify the integrity of the current repository.
513 Verify the integrity of the current repository.
514
514
515 This will perform an extensive check of the repository's integrity,
515 This will perform an extensive check of the repository's integrity,
516 validating the hashes and checksums of each entry in the changelog,
516 validating the hashes and checksums of each entry in the changelog,
517 manifest, and tracked files, as well as the integrity of their crosslinks
517 manifest, and tracked files, as well as the integrity of their crosslinks
518 and indices.
518 and indices.
519
519
520 Please see https://mercurial-scm.org/wiki/RepositoryCorruption for more
520 Please see https://mercurial-scm.org/wiki/RepositoryCorruption for more
521 information about recovery from corruption of the repository.
521 information about recovery from corruption of the repository.
522
522
523 Returns 0 on success, 1 if errors are encountered.
523 Returns 0 on success, 1 if errors are encountered.
524
524
525 (some details hidden, use --verbose to show complete help)
525 (some details hidden, use --verbose to show complete help)
526
526
527 $ hg help diff
527 $ hg help diff
528 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
528 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
529
529
530 diff repository (or selected files)
530 diff repository (or selected files)
531
531
532 Show differences between revisions for the specified files.
532 Show differences between revisions for the specified files.
533
533
534 Differences between files are shown using the unified diff format.
534 Differences between files are shown using the unified diff format.
535
535
536 Note:
536 Note:
537 'hg diff' may generate unexpected results for merges, as it will
537 'hg diff' may generate unexpected results for merges, as it will
538 default to comparing against the working directory's first parent
538 default to comparing against the working directory's first parent
539 changeset if no revisions are specified.
539 changeset if no revisions are specified.
540
540
541 When two revision arguments are given, then changes are shown between
541 When two revision arguments are given, then changes are shown between
542 those revisions. If only one revision is specified then that revision is
542 those revisions. If only one revision is specified then that revision is
543 compared to the working directory, and, when no revisions are specified,
543 compared to the working directory, and, when no revisions are specified,
544 the working directory files are compared to its first parent.
544 the working directory files are compared to its first parent.
545
545
546 Alternatively you can specify -c/--change with a revision to see the
546 Alternatively you can specify -c/--change with a revision to see the
547 changes in that changeset relative to its first parent.
547 changes in that changeset relative to its first parent.
548
548
549 Without the -a/--text option, diff will avoid generating diffs of files it
549 Without the -a/--text option, diff will avoid generating diffs of files it
550 detects as binary. With -a, diff will generate a diff anyway, probably
550 detects as binary. With -a, diff will generate a diff anyway, probably
551 with undesirable results.
551 with undesirable results.
552
552
553 Use the -g/--git option to generate diffs in the git extended diff format.
553 Use the -g/--git option to generate diffs in the git extended diff format.
554 For more information, read 'hg help diffs'.
554 For more information, read 'hg help diffs'.
555
555
556 Returns 0 on success.
556 Returns 0 on success.
557
557
558 options ([+] can be repeated):
558 options ([+] can be repeated):
559
559
560 -r --rev REV [+] revision
560 -r --rev REV [+] revision
561 -c --change REV change made by revision
561 -c --change REV change made by revision
562 -a --text treat all files as text
562 -a --text treat all files as text
563 -g --git use git extended diff format
563 -g --git use git extended diff format
564 --binary generate binary diffs in git mode (default)
564 --binary generate binary diffs in git mode (default)
565 --nodates omit dates from diff headers
565 --nodates omit dates from diff headers
566 --noprefix omit a/ and b/ prefixes from filenames
566 --noprefix omit a/ and b/ prefixes from filenames
567 -p --show-function show which function each change is in
567 -p --show-function show which function each change is in
568 --reverse produce a diff that undoes the changes
568 --reverse produce a diff that undoes the changes
569 -w --ignore-all-space ignore white space when comparing lines
569 -w --ignore-all-space ignore white space when comparing lines
570 -b --ignore-space-change ignore changes in the amount of white space
570 -b --ignore-space-change ignore changes in the amount of white space
571 -B --ignore-blank-lines ignore changes whose lines are all blank
571 -B --ignore-blank-lines ignore changes whose lines are all blank
572 -Z --ignore-space-at-eol ignore changes in whitespace at EOL
572 -Z --ignore-space-at-eol ignore changes in whitespace at EOL
573 -U --unified NUM number of lines of context to show
573 -U --unified NUM number of lines of context to show
574 --stat output diffstat-style summary of changes
574 --stat output diffstat-style summary of changes
575 --root DIR produce diffs relative to subdirectory
575 --root DIR produce diffs relative to subdirectory
576 -I --include PATTERN [+] include names matching the given patterns
576 -I --include PATTERN [+] include names matching the given patterns
577 -X --exclude PATTERN [+] exclude names matching the given patterns
577 -X --exclude PATTERN [+] exclude names matching the given patterns
578 -S --subrepos recurse into subrepositories
578 -S --subrepos recurse into subrepositories
579
579
580 (some details hidden, use --verbose to show complete help)
580 (some details hidden, use --verbose to show complete help)
581
581
582 $ hg help status
582 $ hg help status
583 hg status [OPTION]... [FILE]...
583 hg status [OPTION]... [FILE]...
584
584
585 aliases: st
585 aliases: st
586
586
587 show changed files in the working directory
587 show changed files in the working directory
588
588
589 Show status of files in the repository. If names are given, only files
589 Show status of files in the repository. If names are given, only files
590 that match are shown. Files that are clean or ignored or the source of a
590 that match are shown. Files that are clean or ignored or the source of a
591 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
591 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
592 -C/--copies or -A/--all are given. Unless options described with "show
592 -C/--copies or -A/--all are given. Unless options described with "show
593 only ..." are given, the options -mardu are used.
593 only ..." are given, the options -mardu are used.
594
594
595 Option -q/--quiet hides untracked (unknown and ignored) files unless
595 Option -q/--quiet hides untracked (unknown and ignored) files unless
596 explicitly requested with -u/--unknown or -i/--ignored.
596 explicitly requested with -u/--unknown or -i/--ignored.
597
597
598 Note:
598 Note:
599 'hg status' may appear to disagree with diff if permissions have
599 'hg status' may appear to disagree with diff if permissions have
600 changed or a merge has occurred. The standard diff format does not
600 changed or a merge has occurred. The standard diff format does not
601 report permission changes and diff only reports changes relative to one
601 report permission changes and diff only reports changes relative to one
602 merge parent.
602 merge parent.
603
603
604 If one revision is given, it is used as the base revision. If two
604 If one revision is given, it is used as the base revision. If two
605 revisions are given, the differences between them are shown. The --change
605 revisions are given, the differences between them are shown. The --change
606 option can also be used as a shortcut to list the changed files of a
606 option can also be used as a shortcut to list the changed files of a
607 revision from its first parent.
607 revision from its first parent.
608
608
609 The codes used to show the status of files are:
609 The codes used to show the status of files are:
610
610
611 M = modified
611 M = modified
612 A = added
612 A = added
613 R = removed
613 R = removed
614 C = clean
614 C = clean
615 ! = missing (deleted by non-hg command, but still tracked)
615 ! = missing (deleted by non-hg command, but still tracked)
616 ? = not tracked
616 ? = not tracked
617 I = ignored
617 I = ignored
618 = origin of the previous file (with --copies)
618 = origin of the previous file (with --copies)
619
619
620 Returns 0 on success.
620 Returns 0 on success.
621
621
622 options ([+] can be repeated):
622 options ([+] can be repeated):
623
623
624 -A --all show status of all files
624 -A --all show status of all files
625 -m --modified show only modified files
625 -m --modified show only modified files
626 -a --added show only added files
626 -a --added show only added files
627 -r --removed show only removed files
627 -r --removed show only removed files
628 -d --deleted show only deleted (but tracked) files
628 -d --deleted show only deleted (but tracked) files
629 -c --clean show only files without changes
629 -c --clean show only files without changes
630 -u --unknown show only unknown (not tracked) files
630 -u --unknown show only unknown (not tracked) files
631 -i --ignored show only ignored files
631 -i --ignored show only ignored files
632 -n --no-status hide status prefix
632 -n --no-status hide status prefix
633 -C --copies show source of copied files
633 -C --copies show source of copied files
634 -0 --print0 end filenames with NUL, for use with xargs
634 -0 --print0 end filenames with NUL, for use with xargs
635 --rev REV [+] show difference from revision
635 --rev REV [+] show difference from revision
636 --change REV list the changed files of a revision
636 --change REV list the changed files of a revision
637 -I --include PATTERN [+] include names matching the given patterns
637 -I --include PATTERN [+] include names matching the given patterns
638 -X --exclude PATTERN [+] exclude names matching the given patterns
638 -X --exclude PATTERN [+] exclude names matching the given patterns
639 -S --subrepos recurse into subrepositories
639 -S --subrepos recurse into subrepositories
640
640
641 (some details hidden, use --verbose to show complete help)
641 (some details hidden, use --verbose to show complete help)
642
642
643 $ hg -q help status
643 $ hg -q help status
644 hg status [OPTION]... [FILE]...
644 hg status [OPTION]... [FILE]...
645
645
646 show changed files in the working directory
646 show changed files in the working directory
647
647
648 $ hg help foo
648 $ hg help foo
649 abort: no such help topic: foo
649 abort: no such help topic: foo
650 (try 'hg help --keyword foo')
650 (try 'hg help --keyword foo')
651 [255]
651 [255]
652
652
653 $ hg skjdfks
653 $ hg skjdfks
654 hg: unknown command 'skjdfks'
654 hg: unknown command 'skjdfks'
655 (use 'hg help' for a list of commands)
655 (use 'hg help' for a list of commands)
656 [255]
656 [255]
657
657
658 Typoed command gives suggestion
658 Typoed command gives suggestion
659 $ hg puls
659 $ hg puls
660 hg: unknown command 'puls'
660 hg: unknown command 'puls'
661 (did you mean one of pull, push?)
661 (did you mean one of pull, push?)
662 [255]
662 [255]
663
663
664 Not enabled extension gets suggested
664 Not enabled extension gets suggested
665
665
666 $ hg rebase
666 $ hg rebase
667 hg: unknown command 'rebase'
667 hg: unknown command 'rebase'
668 'rebase' is provided by the following extension:
668 'rebase' is provided by the following extension:
669
669
670 rebase command to move sets of revisions to a different ancestor
670 rebase command to move sets of revisions to a different ancestor
671
671
672 (use 'hg help extensions' for information on enabling extensions)
672 (use 'hg help extensions' for information on enabling extensions)
673 [255]
673 [255]
674
674
675 Disabled extension gets suggested
675 Disabled extension gets suggested
676 $ hg --config extensions.rebase=! rebase
676 $ hg --config extensions.rebase=! rebase
677 hg: unknown command 'rebase'
677 hg: unknown command 'rebase'
678 'rebase' is provided by the following extension:
678 'rebase' is provided by the following extension:
679
679
680 rebase command to move sets of revisions to a different ancestor
680 rebase command to move sets of revisions to a different ancestor
681
681
682 (use 'hg help extensions' for information on enabling extensions)
682 (use 'hg help extensions' for information on enabling extensions)
683 [255]
683 [255]
684
684
685 Make sure that we don't run afoul of the help system thinking that
685 Make sure that we don't run afoul of the help system thinking that
686 this is a section and erroring out weirdly.
686 this is a section and erroring out weirdly.
687
687
688 $ hg .log
688 $ hg .log
689 hg: unknown command '.log'
689 hg: unknown command '.log'
690 (did you mean log?)
690 (did you mean log?)
691 [255]
691 [255]
692
692
693 $ hg log.
693 $ hg log.
694 hg: unknown command 'log.'
694 hg: unknown command 'log.'
695 (did you mean log?)
695 (did you mean log?)
696 [255]
696 [255]
697 $ hg pu.lh
697 $ hg pu.lh
698 hg: unknown command 'pu.lh'
698 hg: unknown command 'pu.lh'
699 (did you mean one of pull, push?)
699 (did you mean one of pull, push?)
700 [255]
700 [255]
701
701
702 $ cat > helpext.py <<EOF
702 $ cat > helpext.py <<EOF
703 > import os
703 > import os
704 > from mercurial import commands, fancyopts, registrar
704 > from mercurial import commands, fancyopts, registrar
705 >
705 >
706 > def func(arg):
706 > def func(arg):
707 > return '%sfoo' % arg
707 > return '%sfoo' % arg
708 > class customopt(fancyopts.customopt):
708 > class customopt(fancyopts.customopt):
709 > def newstate(self, oldstate, newparam, abort):
709 > def newstate(self, oldstate, newparam, abort):
710 > return '%sbar' % oldstate
710 > return '%sbar' % oldstate
711 > cmdtable = {}
711 > cmdtable = {}
712 > command = registrar.command(cmdtable)
712 > command = registrar.command(cmdtable)
713 >
713 >
714 > @command(b'nohelp',
714 > @command(b'nohelp',
715 > [(b'', b'longdesc', 3, b'x'*67),
715 > [(b'', b'longdesc', 3, b'x'*67),
716 > (b'n', b'', None, b'normal desc'),
716 > (b'n', b'', None, b'normal desc'),
717 > (b'', b'newline', b'', b'line1\nline2'),
717 > (b'', b'newline', b'', b'line1\nline2'),
718 > (b'', b'callableopt', func, b'adds foo'),
718 > (b'', b'callableopt', func, b'adds foo'),
719 > (b'', b'customopt', customopt(''), b'adds bar'),
719 > (b'', b'customopt', customopt(''), b'adds bar'),
720 > (b'', b'customopt-withdefault', customopt('foo'), b'adds bar')],
720 > (b'', b'customopt-withdefault', customopt('foo'), b'adds bar')],
721 > b'hg nohelp',
721 > b'hg nohelp',
722 > norepo=True)
722 > norepo=True)
723 > @command(b'debugoptADV', [(b'', b'aopt', None, b'option is (ADVANCED)')])
723 > @command(b'debugoptADV', [(b'', b'aopt', None, b'option is (ADVANCED)')])
724 > @command(b'debugoptDEP', [(b'', b'dopt', None, b'option is (DEPRECATED)')])
724 > @command(b'debugoptDEP', [(b'', b'dopt', None, b'option is (DEPRECATED)')])
725 > @command(b'debugoptEXP', [(b'', b'eopt', None, b'option is (EXPERIMENTAL)')])
725 > @command(b'debugoptEXP', [(b'', b'eopt', None, b'option is (EXPERIMENTAL)')])
726 > def nohelp(ui, *args, **kwargs):
726 > def nohelp(ui, *args, **kwargs):
727 > pass
727 > pass
728 >
728 >
729 > def uisetup(ui):
729 > def uisetup(ui):
730 > ui.setconfig(b'alias', b'shellalias', b'!echo hi', b'helpext')
730 > ui.setconfig(b'alias', b'shellalias', b'!echo hi', b'helpext')
731 > ui.setconfig(b'alias', b'hgalias', b'summary', b'helpext')
731 > ui.setconfig(b'alias', b'hgalias', b'summary', b'helpext')
732 >
732 >
733 > EOF
733 > EOF
734 $ echo '[extensions]' >> $HGRCPATH
734 $ echo '[extensions]' >> $HGRCPATH
735 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
735 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
736
736
737 Test for aliases
737 Test for aliases
738
738
739 $ hg help hgalias
739 $ hg help hgalias
740 hg hgalias [--remote]
740 hg hgalias [--remote]
741
741
742 alias for: hg summary
742 alias for: hg summary
743
743
744 summarize working directory state
744 summarize working directory state
745
745
746 This generates a brief summary of the working directory state, including
746 This generates a brief summary of the working directory state, including
747 parents, branch, commit status, phase and available updates.
747 parents, branch, commit status, phase and available updates.
748
748
749 With the --remote option, this will check the default paths for incoming
749 With the --remote option, this will check the default paths for incoming
750 and outgoing changes. This can be time-consuming.
750 and outgoing changes. This can be time-consuming.
751
751
752 Returns 0 on success.
752 Returns 0 on success.
753
753
754 defined by: helpext
754 defined by: helpext
755
755
756 options:
756 options:
757
757
758 --remote check for push and pull
758 --remote check for push and pull
759
759
760 (some details hidden, use --verbose to show complete help)
760 (some details hidden, use --verbose to show complete help)
761
761
762 $ hg help shellalias
762 $ hg help shellalias
763 hg shellalias
763 hg shellalias
764
764
765 shell alias for: echo hi
765 shell alias for: echo hi
766
766
767 (no help text available)
767 (no help text available)
768
768
769 defined by: helpext
769 defined by: helpext
770
770
771 (some details hidden, use --verbose to show complete help)
771 (some details hidden, use --verbose to show complete help)
772
772
773 Test command with no help text
773 Test command with no help text
774
774
775 $ hg help nohelp
775 $ hg help nohelp
776 hg nohelp
776 hg nohelp
777
777
778 (no help text available)
778 (no help text available)
779
779
780 options:
780 options:
781
781
782 --longdesc VALUE
782 --longdesc VALUE
783 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
783 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
784 xxxxxxxxxxxxxxxxxxxxxxx (default: 3)
784 xxxxxxxxxxxxxxxxxxxxxxx (default: 3)
785 -n -- normal desc
785 -n -- normal desc
786 --newline VALUE line1 line2
786 --newline VALUE line1 line2
787 --callableopt VALUE adds foo
787 --callableopt VALUE adds foo
788 --customopt VALUE adds bar
788 --customopt VALUE adds bar
789 --customopt-withdefault VALUE adds bar (default: foo)
789 --customopt-withdefault VALUE adds bar (default: foo)
790
790
791 (some details hidden, use --verbose to show complete help)
791 (some details hidden, use --verbose to show complete help)
792
792
793 $ hg help -k nohelp
793 $ hg help -k nohelp
794 Commands:
794 Commands:
795
795
796 nohelp hg nohelp
796 nohelp hg nohelp
797
797
798 Extension Commands:
798 Extension Commands:
799
799
800 nohelp (no help text available)
800 nohelp (no help text available)
801
801
802 Test that default list of commands omits extension commands
802 Test that default list of commands omits extension commands
803
803
804 #if no-extraextensions
804 #if no-extraextensions
805
805
806 $ hg help
806 $ hg help
807 Mercurial Distributed SCM
807 Mercurial Distributed SCM
808
808
809 list of commands:
809 list of commands:
810
810
811 add add the specified files on the next commit
811 add add the specified files on the next commit
812 addremove add all new files, delete all missing files
812 addremove add all new files, delete all missing files
813 annotate show changeset information by line for each file
813 annotate show changeset information by line for each file
814 archive create an unversioned archive of a repository revision
814 archive create an unversioned archive of a repository revision
815 backout reverse effect of earlier changeset
815 backout reverse effect of earlier changeset
816 bisect subdivision search of changesets
816 bisect subdivision search of changesets
817 bookmarks create a new bookmark or list existing bookmarks
817 bookmarks create a new bookmark or list existing bookmarks
818 branch set or show the current branch name
818 branch set or show the current branch name
819 branches list repository named branches
819 branches list repository named branches
820 bundle create a bundle file
820 bundle create a bundle file
821 cat output the current or given revision of files
821 cat output the current or given revision of files
822 clone make a copy of an existing repository
822 clone make a copy of an existing repository
823 commit commit the specified files or all outstanding changes
823 commit commit the specified files or all outstanding changes
824 config show combined config settings from all hgrc files
824 config show combined config settings from all hgrc files
825 copy mark files as copied for the next commit
825 copy mark files as copied for the next commit
826 diff diff repository (or selected files)
826 diff diff repository (or selected files)
827 export dump the header and diffs for one or more changesets
827 export dump the header and diffs for one or more changesets
828 files list tracked files
828 files list tracked files
829 forget forget the specified files on the next commit
829 forget forget the specified files on the next commit
830 graft copy changes from other branches onto the current branch
830 graft copy changes from other branches onto the current branch
831 grep search revision history for a pattern in specified files
831 grep search revision history for a pattern in specified files
832 heads show branch heads
832 heads show branch heads
833 help show help for a given topic or a help overview
833 help show help for a given topic or a help overview
834 identify identify the working directory or specified revision
834 identify identify the working directory or specified revision
835 import import an ordered set of patches
835 import import an ordered set of patches
836 incoming show new changesets found in source
836 incoming show new changesets found in source
837 init create a new repository in the given directory
837 init create a new repository in the given directory
838 log show revision history of entire repository or files
838 log show revision history of entire repository or files
839 manifest output the current or given revision of the project manifest
839 manifest output the current or given revision of the project manifest
840 merge merge another revision into working directory
840 merge merge another revision into working directory
841 outgoing show changesets not found in the destination
841 outgoing show changesets not found in the destination
842 paths show aliases for remote repositories
842 paths show aliases for remote repositories
843 phase set or show the current phase name
843 phase set or show the current phase name
844 pull pull changes from the specified source
844 pull pull changes from the specified source
845 push push changes to the specified destination
845 push push changes to the specified destination
846 recover roll back an interrupted transaction
846 recover roll back an interrupted transaction
847 remove remove the specified files on the next commit
847 remove remove the specified files on the next commit
848 rename rename files; equivalent of copy + remove
848 rename rename files; equivalent of copy + remove
849 resolve redo merges or set/view the merge status of files
849 resolve redo merges or set/view the merge status of files
850 revert restore files to their checkout state
850 revert restore files to their checkout state
851 root print the root (top) of the current working directory
851 root print the root (top) of the current working directory
852 serve start stand-alone webserver
852 serve start stand-alone webserver
853 status show changed files in the working directory
853 status show changed files in the working directory
854 summary summarize working directory state
854 summary summarize working directory state
855 tag add one or more tags for the current or given revision
855 tag add one or more tags for the current or given revision
856 tags list repository tags
856 tags list repository tags
857 unbundle apply one or more bundle files
857 unbundle apply one or more bundle files
858 update update working directory (or switch revisions)
858 update update working directory (or switch revisions)
859 verify verify the integrity of the repository
859 verify verify the integrity of the repository
860 version output version and copyright information
860 version output version and copyright information
861
861
862 enabled extensions:
862 enabled extensions:
863
863
864 helpext (no help text available)
864 helpext (no help text available)
865
865
866 additional help topics:
866 additional help topics:
867
867
868 bundlespec Bundle File Formats
868 bundlespec Bundle File Formats
869 color Colorizing Outputs
869 color Colorizing Outputs
870 config Configuration Files
870 config Configuration Files
871 dates Date Formats
871 dates Date Formats
872 deprecated Deprecated Features
872 deprecated Deprecated Features
873 diffs Diff Formats
873 diffs Diff Formats
874 environment Environment Variables
874 environment Environment Variables
875 extensions Using Additional Features
875 extensions Using Additional Features
876 filesets Specifying File Sets
876 filesets Specifying File Sets
877 flags Command-line flags
877 flags Command-line flags
878 glossary Glossary
878 glossary Glossary
879 hgignore Syntax for Mercurial Ignore Files
879 hgignore Syntax for Mercurial Ignore Files
880 hgweb Configuring hgweb
880 hgweb Configuring hgweb
881 internals Technical implementation topics
881 internals Technical implementation topics
882 merge-tools Merge Tools
882 merge-tools Merge Tools
883 pager Pager Support
883 pager Pager Support
884 patterns File Name Patterns
884 patterns File Name Patterns
885 phases Working with Phases
885 phases Working with Phases
886 revisions Specifying Revisions
886 revisions Specifying Revisions
887 scripting Using Mercurial from scripts and automation
887 scripting Using Mercurial from scripts and automation
888 subrepos Subrepositories
888 subrepos Subrepositories
889 templating Template Usage
889 templating Template Usage
890 urls URL Paths
890 urls URL Paths
891
891
892 (use 'hg help -v' to show built-in aliases and global options)
892 (use 'hg help -v' to show built-in aliases and global options)
893
893
894 #endif
894 #endif
895
895
896 Test list of internal help commands
896 Test list of internal help commands
897
897
898 $ hg help debug
898 $ hg help debug
899 debug commands (internal and unsupported):
899 debug commands (internal and unsupported):
900
900
901 debugancestor
901 debugancestor
902 find the ancestor revision of two revisions in a given index
902 find the ancestor revision of two revisions in a given index
903 debugapplystreamclonebundle
903 debugapplystreamclonebundle
904 apply a stream clone bundle file
904 apply a stream clone bundle file
905 debugbuilddag
905 debugbuilddag
906 builds a repo with a given DAG from scratch in the current
906 builds a repo with a given DAG from scratch in the current
907 empty repo
907 empty repo
908 debugbundle lists the contents of a bundle
908 debugbundle lists the contents of a bundle
909 debugcapabilities
909 debugcapabilities
910 lists the capabilities of a remote peer
910 lists the capabilities of a remote peer
911 debugcheckstate
911 debugcheckstate
912 validate the correctness of the current dirstate
912 validate the correctness of the current dirstate
913 debugcolor show available color, effects or style
913 debugcolor show available color, effects or style
914 debugcommands
914 debugcommands
915 list all available commands and options
915 list all available commands and options
916 debugcomplete
916 debugcomplete
917 returns the completion list associated with the given command
917 returns the completion list associated with the given command
918 debugcreatestreamclonebundle
918 debugcreatestreamclonebundle
919 create a stream clone bundle file
919 create a stream clone bundle file
920 debugdag format the changelog or an index DAG as a concise textual
920 debugdag format the changelog or an index DAG as a concise textual
921 description
921 description
922 debugdata dump the contents of a data file revision
922 debugdata dump the contents of a data file revision
923 debugdate parse and display a date
923 debugdate parse and display a date
924 debugdeltachain
924 debugdeltachain
925 dump information about delta chains in a revlog
925 dump information about delta chains in a revlog
926 debugdirstate
926 debugdirstate
927 show the contents of the current dirstate
927 show the contents of the current dirstate
928 debugdiscovery
928 debugdiscovery
929 runs the changeset discovery protocol in isolation
929 runs the changeset discovery protocol in isolation
930 debugdownload
930 debugdownload
931 download a resource using Mercurial logic and config
931 download a resource using Mercurial logic and config
932 debugextensions
932 debugextensions
933 show information about active extensions
933 show information about active extensions
934 debugfileset parse and apply a fileset specification
934 debugfileset parse and apply a fileset specification
935 debugformat display format information about the current repository
935 debugformat display format information about the current repository
936 debugfsinfo show information detected about current filesystem
936 debugfsinfo show information detected about current filesystem
937 debuggetbundle
937 debuggetbundle
938 retrieves a bundle from a repo
938 retrieves a bundle from a repo
939 debugignore display the combined ignore pattern and information about
939 debugignore display the combined ignore pattern and information about
940 ignored files
940 ignored files
941 debugindex dump the contents of an index file
941 debugindex dump the contents of an index file
942 debugindexdot
942 debugindexdot
943 dump an index DAG as a graphviz dot file
943 dump an index DAG as a graphviz dot file
944 debuginstall test Mercurial installation
944 debuginstall test Mercurial installation
945 debugknown test whether node ids are known to a repo
945 debugknown test whether node ids are known to a repo
946 debuglocks show or modify state of locks
946 debuglocks show or modify state of locks
947 debugmanifestfulltextcache
947 debugmanifestfulltextcache
948 show, clear or amend the contents of the manifest fulltext
948 show, clear or amend the contents of the manifest fulltext
949 cache
949 cache
950 debugmergestate
950 debugmergestate
951 print merge state
951 print merge state
952 debugnamecomplete
952 debugnamecomplete
953 complete "names" - tags, open branch names, bookmark names
953 complete "names" - tags, open branch names, bookmark names
954 debugobsolete
954 debugobsolete
955 create arbitrary obsolete marker
955 create arbitrary obsolete marker
956 debugoptADV (no help text available)
956 debugoptADV (no help text available)
957 debugoptDEP (no help text available)
957 debugoptDEP (no help text available)
958 debugoptEXP (no help text available)
958 debugoptEXP (no help text available)
959 debugpathcomplete
959 debugpathcomplete
960 complete part or all of a tracked path
960 complete part or all of a tracked path
961 debugpeer establish a connection to a peer repository
961 debugpeer establish a connection to a peer repository
962 debugpickmergetool
962 debugpickmergetool
963 examine which merge tool is chosen for specified file
963 examine which merge tool is chosen for specified file
964 debugpushkey access the pushkey key/value protocol
964 debugpushkey access the pushkey key/value protocol
965 debugpvec (no help text available)
965 debugpvec (no help text available)
966 debugrebuilddirstate
966 debugrebuilddirstate
967 rebuild the dirstate as it would look like for the given
967 rebuild the dirstate as it would look like for the given
968 revision
968 revision
969 debugrebuildfncache
969 debugrebuildfncache
970 rebuild the fncache file
970 rebuild the fncache file
971 debugrename dump rename information
971 debugrename dump rename information
972 debugrevlog show data and statistics about a revlog
972 debugrevlog show data and statistics about a revlog
973 debugrevspec parse and apply a revision specification
973 debugrevspec parse and apply a revision specification
974 debugserve run a server with advanced settings
974 debugserve run a server with advanced settings
975 debugsetparents
975 debugsetparents
976 manually set the parents of the current working directory
976 manually set the parents of the current working directory
977 debugssl test a secure connection to a server
977 debugssl test a secure connection to a server
978 debugsub (no help text available)
978 debugsub (no help text available)
979 debugsuccessorssets
979 debugsuccessorssets
980 show set of successors for revision
980 show set of successors for revision
981 debugtemplate
981 debugtemplate
982 parse and apply a template
982 parse and apply a template
983 debuguigetpass
983 debuguigetpass
984 show prompt to type password
984 show prompt to type password
985 debuguiprompt
985 debuguiprompt
986 show plain prompt
986 show plain prompt
987 debugupdatecaches
987 debugupdatecaches
988 warm all known caches in the repository
988 warm all known caches in the repository
989 debugupgraderepo
989 debugupgraderepo
990 upgrade a repository to use different features
990 upgrade a repository to use different features
991 debugwalk show how files match on given patterns
991 debugwalk show how files match on given patterns
992 debugwhyunstable
992 debugwhyunstable
993 explain instabilities of a changeset
993 explain instabilities of a changeset
994 debugwireargs
994 debugwireargs
995 (no help text available)
995 (no help text available)
996 debugwireproto
996 debugwireproto
997 send wire protocol commands to a server
997 send wire protocol commands to a server
998
998
999 (use 'hg help -v debug' to show built-in aliases and global options)
999 (use 'hg help -v debug' to show built-in aliases and global options)
1000
1000
1001 internals topic renders index of available sub-topics
1001 internals topic renders index of available sub-topics
1002
1002
1003 $ hg help internals
1003 $ hg help internals
1004 Technical implementation topics
1004 Technical implementation topics
1005 """""""""""""""""""""""""""""""
1005 """""""""""""""""""""""""""""""
1006
1006
1007 To access a subtopic, use "hg help internals.{subtopic-name}"
1007 To access a subtopic, use "hg help internals.{subtopic-name}"
1008
1008
1009 bundle2 Bundle2
1009 bundle2 Bundle2
1010 bundles Bundles
1010 bundles Bundles
1011 censor Censor
1011 censor Censor
1012 changegroups Changegroups
1012 changegroups Changegroups
1013 config Config Registrar
1013 config Config Registrar
1014 requirements Repository Requirements
1014 requirements Repository Requirements
1015 revlogs Revision Logs
1015 revlogs Revision Logs
1016 wireprotocol Wire Protocol
1016 wireprotocol Wire Protocol
1017
1017
1018 sub-topics can be accessed
1018 sub-topics can be accessed
1019
1019
1020 $ hg help internals.changegroups
1020 $ hg help internals.changegroups
1021 Changegroups
1021 Changegroups
1022 """"""""""""
1022 """"""""""""
1023
1023
1024 Changegroups are representations of repository revlog data, specifically
1024 Changegroups are representations of repository revlog data, specifically
1025 the changelog data, root/flat manifest data, treemanifest data, and
1025 the changelog data, root/flat manifest data, treemanifest data, and
1026 filelogs.
1026 filelogs.
1027
1027
1028 There are 3 versions of changegroups: "1", "2", and "3". From a high-
1028 There are 3 versions of changegroups: "1", "2", and "3". From a high-
1029 level, versions "1" and "2" are almost exactly the same, with the only
1029 level, versions "1" and "2" are almost exactly the same, with the only
1030 difference being an additional item in the *delta header*. Version "3"
1030 difference being an additional item in the *delta header*. Version "3"
1031 adds support for revlog flags in the *delta header* and optionally
1031 adds support for revlog flags in the *delta header* and optionally
1032 exchanging treemanifests (enabled by setting an option on the
1032 exchanging treemanifests (enabled by setting an option on the
1033 "changegroup" part in the bundle2).
1033 "changegroup" part in the bundle2).
1034
1034
1035 Changegroups when not exchanging treemanifests consist of 3 logical
1035 Changegroups when not exchanging treemanifests consist of 3 logical
1036 segments:
1036 segments:
1037
1037
1038 +---------------------------------+
1038 +---------------------------------+
1039 | | | |
1039 | | | |
1040 | changeset | manifest | filelogs |
1040 | changeset | manifest | filelogs |
1041 | | | |
1041 | | | |
1042 | | | |
1042 | | | |
1043 +---------------------------------+
1043 +---------------------------------+
1044
1044
1045 When exchanging treemanifests, there are 4 logical segments:
1045 When exchanging treemanifests, there are 4 logical segments:
1046
1046
1047 +-------------------------------------------------+
1047 +-------------------------------------------------+
1048 | | | | |
1048 | | | | |
1049 | changeset | root | treemanifests | filelogs |
1049 | changeset | root | treemanifests | filelogs |
1050 | | manifest | | |
1050 | | manifest | | |
1051 | | | | |
1051 | | | | |
1052 +-------------------------------------------------+
1052 +-------------------------------------------------+
1053
1053
1054 The principle building block of each segment is a *chunk*. A *chunk* is a
1054 The principle building block of each segment is a *chunk*. A *chunk* is a
1055 framed piece of data:
1055 framed piece of data:
1056
1056
1057 +---------------------------------------+
1057 +---------------------------------------+
1058 | | |
1058 | | |
1059 | length | data |
1059 | length | data |
1060 | (4 bytes) | (<length - 4> bytes) |
1060 | (4 bytes) | (<length - 4> bytes) |
1061 | | |
1061 | | |
1062 +---------------------------------------+
1062 +---------------------------------------+
1063
1063
1064 All integers are big-endian signed integers. Each chunk starts with a
1064 All integers are big-endian signed integers. Each chunk starts with a
1065 32-bit integer indicating the length of the entire chunk (including the
1065 32-bit integer indicating the length of the entire chunk (including the
1066 length field itself).
1066 length field itself).
1067
1067
1068 There is a special case chunk that has a value of 0 for the length
1068 There is a special case chunk that has a value of 0 for the length
1069 ("0x00000000"). We call this an *empty chunk*.
1069 ("0x00000000"). We call this an *empty chunk*.
1070
1070
1071 Delta Groups
1071 Delta Groups
1072 ============
1072 ============
1073
1073
1074 A *delta group* expresses the content of a revlog as a series of deltas,
1074 A *delta group* expresses the content of a revlog as a series of deltas,
1075 or patches against previous revisions.
1075 or patches against previous revisions.
1076
1076
1077 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
1077 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
1078 to signal the end of the delta group:
1078 to signal the end of the delta group:
1079
1079
1080 +------------------------------------------------------------------------+
1080 +------------------------------------------------------------------------+
1081 | | | | | |
1081 | | | | | |
1082 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
1082 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
1083 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
1083 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
1084 | | | | | |
1084 | | | | | |
1085 +------------------------------------------------------------------------+
1085 +------------------------------------------------------------------------+
1086
1086
1087 Each *chunk*'s data consists of the following:
1087 Each *chunk*'s data consists of the following:
1088
1088
1089 +---------------------------------------+
1089 +---------------------------------------+
1090 | | |
1090 | | |
1091 | delta header | delta data |
1091 | delta header | delta data |
1092 | (various by version) | (various) |
1092 | (various by version) | (various) |
1093 | | |
1093 | | |
1094 +---------------------------------------+
1094 +---------------------------------------+
1095
1095
1096 The *delta data* is a series of *delta*s that describe a diff from an
1096 The *delta data* is a series of *delta*s that describe a diff from an
1097 existing entry (either that the recipient already has, or previously
1097 existing entry (either that the recipient already has, or previously
1098 specified in the bundle/changegroup).
1098 specified in the bundle/changegroup).
1099
1099
1100 The *delta header* is different between versions "1", "2", and "3" of the
1100 The *delta header* is different between versions "1", "2", and "3" of the
1101 changegroup format.
1101 changegroup format.
1102
1102
1103 Version 1 (headerlen=80):
1103 Version 1 (headerlen=80):
1104
1104
1105 +------------------------------------------------------+
1105 +------------------------------------------------------+
1106 | | | | |
1106 | | | | |
1107 | node | p1 node | p2 node | link node |
1107 | node | p1 node | p2 node | link node |
1108 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1108 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1109 | | | | |
1109 | | | | |
1110 +------------------------------------------------------+
1110 +------------------------------------------------------+
1111
1111
1112 Version 2 (headerlen=100):
1112 Version 2 (headerlen=100):
1113
1113
1114 +------------------------------------------------------------------+
1114 +------------------------------------------------------------------+
1115 | | | | | |
1115 | | | | | |
1116 | node | p1 node | p2 node | base node | link node |
1116 | node | p1 node | p2 node | base node | link node |
1117 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1117 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1118 | | | | | |
1118 | | | | | |
1119 +------------------------------------------------------------------+
1119 +------------------------------------------------------------------+
1120
1120
1121 Version 3 (headerlen=102):
1121 Version 3 (headerlen=102):
1122
1122
1123 +------------------------------------------------------------------------------+
1123 +------------------------------------------------------------------------------+
1124 | | | | | | |
1124 | | | | | | |
1125 | node | p1 node | p2 node | base node | link node | flags |
1125 | node | p1 node | p2 node | base node | link node | flags |
1126 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
1126 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
1127 | | | | | | |
1127 | | | | | | |
1128 +------------------------------------------------------------------------------+
1128 +------------------------------------------------------------------------------+
1129
1129
1130 The *delta data* consists of "chunklen - 4 - headerlen" bytes, which
1130 The *delta data* consists of "chunklen - 4 - headerlen" bytes, which
1131 contain a series of *delta*s, densely packed (no separators). These deltas
1131 contain a series of *delta*s, densely packed (no separators). These deltas
1132 describe a diff from an existing entry (either that the recipient already
1132 describe a diff from an existing entry (either that the recipient already
1133 has, or previously specified in the bundle/changegroup). The format is
1133 has, or previously specified in the bundle/changegroup). The format is
1134 described more fully in "hg help internals.bdiff", but briefly:
1134 described more fully in "hg help internals.bdiff", but briefly:
1135
1135
1136 +---------------------------------------------------------------+
1136 +---------------------------------------------------------------+
1137 | | | | |
1137 | | | | |
1138 | start offset | end offset | new length | content |
1138 | start offset | end offset | new length | content |
1139 | (4 bytes) | (4 bytes) | (4 bytes) | (<new length> bytes) |
1139 | (4 bytes) | (4 bytes) | (4 bytes) | (<new length> bytes) |
1140 | | | | |
1140 | | | | |
1141 +---------------------------------------------------------------+
1141 +---------------------------------------------------------------+
1142
1142
1143 Please note that the length field in the delta data does *not* include
1143 Please note that the length field in the delta data does *not* include
1144 itself.
1144 itself.
1145
1145
1146 In version 1, the delta is always applied against the previous node from
1146 In version 1, the delta is always applied against the previous node from
1147 the changegroup or the first parent if this is the first entry in the
1147 the changegroup or the first parent if this is the first entry in the
1148 changegroup.
1148 changegroup.
1149
1149
1150 In version 2 and up, the delta base node is encoded in the entry in the
1150 In version 2 and up, the delta base node is encoded in the entry in the
1151 changegroup. This allows the delta to be expressed against any parent,
1151 changegroup. This allows the delta to be expressed against any parent,
1152 which can result in smaller deltas and more efficient encoding of data.
1152 which can result in smaller deltas and more efficient encoding of data.
1153
1153
1154 Changeset Segment
1154 Changeset Segment
1155 =================
1155 =================
1156
1156
1157 The *changeset segment* consists of a single *delta group* holding
1157 The *changeset segment* consists of a single *delta group* holding
1158 changelog data. The *empty chunk* at the end of the *delta group* denotes
1158 changelog data. The *empty chunk* at the end of the *delta group* denotes
1159 the boundary to the *manifest segment*.
1159 the boundary to the *manifest segment*.
1160
1160
1161 Manifest Segment
1161 Manifest Segment
1162 ================
1162 ================
1163
1163
1164 The *manifest segment* consists of a single *delta group* holding manifest
1164 The *manifest segment* consists of a single *delta group* holding manifest
1165 data. If treemanifests are in use, it contains only the manifest for the
1165 data. If treemanifests are in use, it contains only the manifest for the
1166 root directory of the repository. Otherwise, it contains the entire
1166 root directory of the repository. Otherwise, it contains the entire
1167 manifest data. The *empty chunk* at the end of the *delta group* denotes
1167 manifest data. The *empty chunk* at the end of the *delta group* denotes
1168 the boundary to the next segment (either the *treemanifests segment* or
1168 the boundary to the next segment (either the *treemanifests segment* or
1169 the *filelogs segment*, depending on version and the request options).
1169 the *filelogs segment*, depending on version and the request options).
1170
1170
1171 Treemanifests Segment
1171 Treemanifests Segment
1172 ---------------------
1172 ---------------------
1173
1173
1174 The *treemanifests segment* only exists in changegroup version "3", and
1174 The *treemanifests segment* only exists in changegroup version "3", and
1175 only if the 'treemanifest' param is part of the bundle2 changegroup part
1175 only if the 'treemanifest' param is part of the bundle2 changegroup part
1176 (it is not possible to use changegroup version 3 outside of bundle2).
1176 (it is not possible to use changegroup version 3 outside of bundle2).
1177 Aside from the filenames in the *treemanifests segment* containing a
1177 Aside from the filenames in the *treemanifests segment* containing a
1178 trailing "/" character, it behaves identically to the *filelogs segment*
1178 trailing "/" character, it behaves identically to the *filelogs segment*
1179 (see below). The final sub-segment is followed by an *empty chunk*
1179 (see below). The final sub-segment is followed by an *empty chunk*
1180 (logically, a sub-segment with filename size 0). This denotes the boundary
1180 (logically, a sub-segment with filename size 0). This denotes the boundary
1181 to the *filelogs segment*.
1181 to the *filelogs segment*.
1182
1182
1183 Filelogs Segment
1183 Filelogs Segment
1184 ================
1184 ================
1185
1185
1186 The *filelogs segment* consists of multiple sub-segments, each
1186 The *filelogs segment* consists of multiple sub-segments, each
1187 corresponding to an individual file whose data is being described:
1187 corresponding to an individual file whose data is being described:
1188
1188
1189 +--------------------------------------------------+
1189 +--------------------------------------------------+
1190 | | | | | |
1190 | | | | | |
1191 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
1191 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
1192 | | | | | (4 bytes) |
1192 | | | | | (4 bytes) |
1193 | | | | | |
1193 | | | | | |
1194 +--------------------------------------------------+
1194 +--------------------------------------------------+
1195
1195
1196 The final filelog sub-segment is followed by an *empty chunk* (logically,
1196 The final filelog sub-segment is followed by an *empty chunk* (logically,
1197 a sub-segment with filename size 0). This denotes the end of the segment
1197 a sub-segment with filename size 0). This denotes the end of the segment
1198 and of the overall changegroup.
1198 and of the overall changegroup.
1199
1199
1200 Each filelog sub-segment consists of the following:
1200 Each filelog sub-segment consists of the following:
1201
1201
1202 +------------------------------------------------------+
1202 +------------------------------------------------------+
1203 | | | |
1203 | | | |
1204 | filename length | filename | delta group |
1204 | filename length | filename | delta group |
1205 | (4 bytes) | (<length - 4> bytes) | (various) |
1205 | (4 bytes) | (<length - 4> bytes) | (various) |
1206 | | | |
1206 | | | |
1207 +------------------------------------------------------+
1207 +------------------------------------------------------+
1208
1208
1209 That is, a *chunk* consisting of the filename (not terminated or padded)
1209 That is, a *chunk* consisting of the filename (not terminated or padded)
1210 followed by N chunks constituting the *delta group* for this file. The
1210 followed by N chunks constituting the *delta group* for this file. The
1211 *empty chunk* at the end of each *delta group* denotes the boundary to the
1211 *empty chunk* at the end of each *delta group* denotes the boundary to the
1212 next filelog sub-segment.
1212 next filelog sub-segment.
1213
1213
1214 Test list of commands with command with no help text
1214 Test list of commands with command with no help text
1215
1215
1216 $ hg help helpext
1216 $ hg help helpext
1217 helpext extension - no help text available
1217 helpext extension - no help text available
1218
1218
1219 list of commands:
1219 list of commands:
1220
1220
1221 nohelp (no help text available)
1221 nohelp (no help text available)
1222
1222
1223 (use 'hg help -v helpext' to show built-in aliases and global options)
1223 (use 'hg help -v helpext' to show built-in aliases and global options)
1224
1224
1225
1225
1226 test advanced, deprecated and experimental options are hidden in command help
1226 test advanced, deprecated and experimental options are hidden in command help
1227 $ hg help debugoptADV
1227 $ hg help debugoptADV
1228 hg debugoptADV
1228 hg debugoptADV
1229
1229
1230 (no help text available)
1230 (no help text available)
1231
1231
1232 options:
1232 options:
1233
1233
1234 (some details hidden, use --verbose to show complete help)
1234 (some details hidden, use --verbose to show complete help)
1235 $ hg help debugoptDEP
1235 $ hg help debugoptDEP
1236 hg debugoptDEP
1236 hg debugoptDEP
1237
1237
1238 (no help text available)
1238 (no help text available)
1239
1239
1240 options:
1240 options:
1241
1241
1242 (some details hidden, use --verbose to show complete help)
1242 (some details hidden, use --verbose to show complete help)
1243
1243
1244 $ hg help debugoptEXP
1244 $ hg help debugoptEXP
1245 hg debugoptEXP
1245 hg debugoptEXP
1246
1246
1247 (no help text available)
1247 (no help text available)
1248
1248
1249 options:
1249 options:
1250
1250
1251 (some details hidden, use --verbose to show complete help)
1251 (some details hidden, use --verbose to show complete help)
1252
1252
1253 test advanced, deprecated and experimental options are shown with -v
1253 test advanced, deprecated and experimental options are shown with -v
1254 $ hg help -v debugoptADV | grep aopt
1254 $ hg help -v debugoptADV | grep aopt
1255 --aopt option is (ADVANCED)
1255 --aopt option is (ADVANCED)
1256 $ hg help -v debugoptDEP | grep dopt
1256 $ hg help -v debugoptDEP | grep dopt
1257 --dopt option is (DEPRECATED)
1257 --dopt option is (DEPRECATED)
1258 $ hg help -v debugoptEXP | grep eopt
1258 $ hg help -v debugoptEXP | grep eopt
1259 --eopt option is (EXPERIMENTAL)
1259 --eopt option is (EXPERIMENTAL)
1260
1260
1261 #if gettext
1261 #if gettext
1262 test deprecated option is hidden with translation with untranslated description
1262 test deprecated option is hidden with translation with untranslated description
1263 (use many globy for not failing on changed transaction)
1263 (use many globy for not failing on changed transaction)
1264 $ LANGUAGE=sv hg help debugoptDEP
1264 $ LANGUAGE=sv hg help debugoptDEP
1265 hg debugoptDEP
1265 hg debugoptDEP
1266
1266
1267 (*) (glob)
1267 (*) (glob)
1268
1268
1269 options:
1269 options:
1270
1270
1271 (some details hidden, use --verbose to show complete help)
1271 (some details hidden, use --verbose to show complete help)
1272 #endif
1272 #endif
1273
1273
1274 Test commands that collide with topics (issue4240)
1274 Test commands that collide with topics (issue4240)
1275
1275
1276 $ hg config -hq
1276 $ hg config -hq
1277 hg config [-u] [NAME]...
1277 hg config [-u] [NAME]...
1278
1278
1279 show combined config settings from all hgrc files
1279 show combined config settings from all hgrc files
1280 $ hg showconfig -hq
1280 $ hg showconfig -hq
1281 hg config [-u] [NAME]...
1281 hg config [-u] [NAME]...
1282
1282
1283 show combined config settings from all hgrc files
1283 show combined config settings from all hgrc files
1284
1284
1285 Test a help topic
1285 Test a help topic
1286
1286
1287 $ hg help dates
1287 $ hg help dates
1288 Date Formats
1288 Date Formats
1289 """"""""""""
1289 """"""""""""
1290
1290
1291 Some commands allow the user to specify a date, e.g.:
1291 Some commands allow the user to specify a date, e.g.:
1292
1292
1293 - backout, commit, import, tag: Specify the commit date.
1293 - backout, commit, import, tag: Specify the commit date.
1294 - log, revert, update: Select revision(s) by date.
1294 - log, revert, update: Select revision(s) by date.
1295
1295
1296 Many date formats are valid. Here are some examples:
1296 Many date formats are valid. Here are some examples:
1297
1297
1298 - "Wed Dec 6 13:18:29 2006" (local timezone assumed)
1298 - "Wed Dec 6 13:18:29 2006" (local timezone assumed)
1299 - "Dec 6 13:18 -0600" (year assumed, time offset provided)
1299 - "Dec 6 13:18 -0600" (year assumed, time offset provided)
1300 - "Dec 6 13:18 UTC" (UTC and GMT are aliases for +0000)
1300 - "Dec 6 13:18 UTC" (UTC and GMT are aliases for +0000)
1301 - "Dec 6" (midnight)
1301 - "Dec 6" (midnight)
1302 - "13:18" (today assumed)
1302 - "13:18" (today assumed)
1303 - "3:39" (3:39AM assumed)
1303 - "3:39" (3:39AM assumed)
1304 - "3:39pm" (15:39)
1304 - "3:39pm" (15:39)
1305 - "2006-12-06 13:18:29" (ISO 8601 format)
1305 - "2006-12-06 13:18:29" (ISO 8601 format)
1306 - "2006-12-6 13:18"
1306 - "2006-12-6 13:18"
1307 - "2006-12-6"
1307 - "2006-12-6"
1308 - "12-6"
1308 - "12-6"
1309 - "12/6"
1309 - "12/6"
1310 - "12/6/6" (Dec 6 2006)
1310 - "12/6/6" (Dec 6 2006)
1311 - "today" (midnight)
1311 - "today" (midnight)
1312 - "yesterday" (midnight)
1312 - "yesterday" (midnight)
1313 - "now" - right now
1313 - "now" - right now
1314
1314
1315 Lastly, there is Mercurial's internal format:
1315 Lastly, there is Mercurial's internal format:
1316
1316
1317 - "1165411109 0" (Wed Dec 6 13:18:29 2006 UTC)
1317 - "1165411109 0" (Wed Dec 6 13:18:29 2006 UTC)
1318
1318
1319 This is the internal representation format for dates. The first number is
1319 This is the internal representation format for dates. The first number is
1320 the number of seconds since the epoch (1970-01-01 00:00 UTC). The second
1320 the number of seconds since the epoch (1970-01-01 00:00 UTC). The second
1321 is the offset of the local timezone, in seconds west of UTC (negative if
1321 is the offset of the local timezone, in seconds west of UTC (negative if
1322 the timezone is east of UTC).
1322 the timezone is east of UTC).
1323
1323
1324 The log command also accepts date ranges:
1324 The log command also accepts date ranges:
1325
1325
1326 - "<DATE" - at or before a given date/time
1326 - "<DATE" - at or before a given date/time
1327 - ">DATE" - on or after a given date/time
1327 - ">DATE" - on or after a given date/time
1328 - "DATE to DATE" - a date range, inclusive
1328 - "DATE to DATE" - a date range, inclusive
1329 - "-DAYS" - within a given number of days of today
1329 - "-DAYS" - within a given number of days of today
1330
1330
1331 Test repeated config section name
1331 Test repeated config section name
1332
1332
1333 $ hg help config.host
1333 $ hg help config.host
1334 "http_proxy.host"
1334 "http_proxy.host"
1335 Host name and (optional) port of the proxy server, for example
1335 Host name and (optional) port of the proxy server, for example
1336 "myproxy:8000".
1336 "myproxy:8000".
1337
1337
1338 "smtp.host"
1338 "smtp.host"
1339 Host name of mail server, e.g. "mail.example.com".
1339 Host name of mail server, e.g. "mail.example.com".
1340
1340
1341 Unrelated trailing paragraphs shouldn't be included
1341 Unrelated trailing paragraphs shouldn't be included
1342
1342
1343 $ hg help config.extramsg | grep '^$'
1343 $ hg help config.extramsg | grep '^$'
1344
1344
1345
1345
1346 Test capitalized section name
1346 Test capitalized section name
1347
1347
1348 $ hg help scripting.HGPLAIN > /dev/null
1348 $ hg help scripting.HGPLAIN > /dev/null
1349
1349
1350 Help subsection:
1350 Help subsection:
1351
1351
1352 $ hg help config.charsets |grep "Email example:" > /dev/null
1352 $ hg help config.charsets |grep "Email example:" > /dev/null
1353 [1]
1353 [1]
1354
1354
1355 Show nested definitions
1355 Show nested definitions
1356 ("profiling.type"[break]"ls"[break]"stat"[break])
1356 ("profiling.type"[break]"ls"[break]"stat"[break])
1357
1357
1358 $ hg help config.type | egrep '^$'|wc -l
1358 $ hg help config.type | egrep '^$'|wc -l
1359 \s*3 (re)
1359 \s*3 (re)
1360
1360
1361 Separate sections from subsections
1361 Separate sections from subsections
1362
1362
1363 $ hg help config.format | egrep '^ ("|-)|^\s*$' | uniq
1363 $ hg help config.format | egrep '^ ("|-)|^\s*$' | uniq
1364 "format"
1364 "format"
1365 --------
1365 --------
1366
1366
1367 "usegeneraldelta"
1367 "usegeneraldelta"
1368
1368
1369 "dotencode"
1369 "dotencode"
1370
1370
1371 "usefncache"
1371 "usefncache"
1372
1372
1373 "usestore"
1373 "usestore"
1374
1374
1375 "profiling"
1375 "profiling"
1376 -----------
1376 -----------
1377
1377
1378 "format"
1378 "format"
1379
1379
1380 "progress"
1380 "progress"
1381 ----------
1381 ----------
1382
1382
1383 "format"
1383 "format"
1384
1384
1385
1385
1386 Last item in help config.*:
1386 Last item in help config.*:
1387
1387
1388 $ hg help config.`hg help config|grep '^ "'| \
1388 $ hg help config.`hg help config|grep '^ "'| \
1389 > tail -1|sed 's![ "]*!!g'`| \
1389 > tail -1|sed 's![ "]*!!g'`| \
1390 > grep 'hg help -c config' > /dev/null
1390 > grep 'hg help -c config' > /dev/null
1391 [1]
1391 [1]
1392
1392
1393 note to use help -c for general hg help config:
1393 note to use help -c for general hg help config:
1394
1394
1395 $ hg help config |grep 'hg help -c config' > /dev/null
1395 $ hg help config |grep 'hg help -c config' > /dev/null
1396
1396
1397 Test templating help
1397 Test templating help
1398
1398
1399 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
1399 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
1400 desc String. The text of the changeset description.
1400 desc String. The text of the changeset description.
1401 diffstat String. Statistics of changes with the following format:
1401 diffstat String. Statistics of changes with the following format:
1402 firstline Any text. Returns the first line of text.
1402 firstline Any text. Returns the first line of text.
1403 nonempty Any text. Returns '(none)' if the string is empty.
1403 nonempty Any text. Returns '(none)' if the string is empty.
1404
1404
1405 Test deprecated items
1405 Test deprecated items
1406
1406
1407 $ hg help -v templating | grep currentbookmark
1407 $ hg help -v templating | grep currentbookmark
1408 currentbookmark
1408 currentbookmark
1409 $ hg help templating | (grep currentbookmark || true)
1409 $ hg help templating | (grep currentbookmark || true)
1410
1410
1411 Test help hooks
1411 Test help hooks
1412
1412
1413 $ cat > helphook1.py <<EOF
1413 $ cat > helphook1.py <<EOF
1414 > from mercurial import help
1414 > from mercurial import help
1415 >
1415 >
1416 > def rewrite(ui, topic, doc):
1416 > def rewrite(ui, topic, doc):
1417 > return doc + '\nhelphook1\n'
1417 > return doc + '\nhelphook1\n'
1418 >
1418 >
1419 > def extsetup(ui):
1419 > def extsetup(ui):
1420 > help.addtopichook('revisions', rewrite)
1420 > help.addtopichook('revisions', rewrite)
1421 > EOF
1421 > EOF
1422 $ cat > helphook2.py <<EOF
1422 $ cat > helphook2.py <<EOF
1423 > from mercurial import help
1423 > from mercurial import help
1424 >
1424 >
1425 > def rewrite(ui, topic, doc):
1425 > def rewrite(ui, topic, doc):
1426 > return doc + '\nhelphook2\n'
1426 > return doc + '\nhelphook2\n'
1427 >
1427 >
1428 > def extsetup(ui):
1428 > def extsetup(ui):
1429 > help.addtopichook('revisions', rewrite)
1429 > help.addtopichook('revisions', rewrite)
1430 > EOF
1430 > EOF
1431 $ echo '[extensions]' >> $HGRCPATH
1431 $ echo '[extensions]' >> $HGRCPATH
1432 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
1432 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
1433 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
1433 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
1434 $ hg help revsets | grep helphook
1434 $ hg help revsets | grep helphook
1435 helphook1
1435 helphook1
1436 helphook2
1436 helphook2
1437
1437
1438 help -c should only show debug --debug
1438 help -c should only show debug --debug
1439
1439
1440 $ hg help -c --debug|egrep debug|wc -l|egrep '^\s*0\s*$'
1440 $ hg help -c --debug|egrep debug|wc -l|egrep '^\s*0\s*$'
1441 [1]
1441 [1]
1442
1442
1443 help -c should only show deprecated for -v
1443 help -c should only show deprecated for -v
1444
1444
1445 $ hg help -c -v|egrep DEPRECATED|wc -l|egrep '^\s*0\s*$'
1445 $ hg help -c -v|egrep DEPRECATED|wc -l|egrep '^\s*0\s*$'
1446 [1]
1446 [1]
1447
1447
1448 Test -s / --system
1448 Test -s / --system
1449
1449
1450 $ hg help config.files -s windows |grep 'etc/mercurial' | \
1450 $ hg help config.files -s windows |grep 'etc/mercurial' | \
1451 > wc -l | sed -e 's/ //g'
1451 > wc -l | sed -e 's/ //g'
1452 0
1452 0
1453 $ hg help config.files --system unix | grep 'USER' | \
1453 $ hg help config.files --system unix | grep 'USER' | \
1454 > wc -l | sed -e 's/ //g'
1454 > wc -l | sed -e 's/ //g'
1455 0
1455 0
1456
1456
1457 Test -e / -c / -k combinations
1457 Test -e / -c / -k combinations
1458
1458
1459 $ hg help -c|egrep '^[A-Z].*:|^ debug'
1459 $ hg help -c|egrep '^[A-Z].*:|^ debug'
1460 Commands:
1460 Commands:
1461 $ hg help -e|egrep '^[A-Z].*:|^ debug'
1461 $ hg help -e|egrep '^[A-Z].*:|^ debug'
1462 Extensions:
1462 Extensions:
1463 $ hg help -k|egrep '^[A-Z].*:|^ debug'
1463 $ hg help -k|egrep '^[A-Z].*:|^ debug'
1464 Topics:
1464 Topics:
1465 Commands:
1465 Commands:
1466 Extensions:
1466 Extensions:
1467 Extension Commands:
1467 Extension Commands:
1468 $ hg help -c schemes
1468 $ hg help -c schemes
1469 abort: no such help topic: schemes
1469 abort: no such help topic: schemes
1470 (try 'hg help --keyword schemes')
1470 (try 'hg help --keyword schemes')
1471 [255]
1471 [255]
1472 $ hg help -e schemes |head -1
1472 $ hg help -e schemes |head -1
1473 schemes extension - extend schemes with shortcuts to repository swarms
1473 schemes extension - extend schemes with shortcuts to repository swarms
1474 $ hg help -c -k dates |egrep '^(Topics|Extensions|Commands):'
1474 $ hg help -c -k dates |egrep '^(Topics|Extensions|Commands):'
1475 Commands:
1475 Commands:
1476 $ hg help -e -k a |egrep '^(Topics|Extensions|Commands):'
1476 $ hg help -e -k a |egrep '^(Topics|Extensions|Commands):'
1477 Extensions:
1477 Extensions:
1478 $ hg help -e -c -k date |egrep '^(Topics|Extensions|Commands):'
1478 $ hg help -e -c -k date |egrep '^(Topics|Extensions|Commands):'
1479 Extensions:
1479 Extensions:
1480 Commands:
1480 Commands:
1481 $ hg help -c commit > /dev/null
1481 $ hg help -c commit > /dev/null
1482 $ hg help -e -c commit > /dev/null
1482 $ hg help -e -c commit > /dev/null
1483 $ hg help -e commit > /dev/null
1483 $ hg help -e commit > /dev/null
1484 abort: no such help topic: commit
1484 abort: no such help topic: commit
1485 (try 'hg help --keyword commit')
1485 (try 'hg help --keyword commit')
1486 [255]
1486 [255]
1487
1487
1488 Test keyword search help
1488 Test keyword search help
1489
1489
1490 $ cat > prefixedname.py <<EOF
1490 $ cat > prefixedname.py <<EOF
1491 > '''matched against word "clone"
1491 > '''matched against word "clone"
1492 > '''
1492 > '''
1493 > EOF
1493 > EOF
1494 $ echo '[extensions]' >> $HGRCPATH
1494 $ echo '[extensions]' >> $HGRCPATH
1495 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
1495 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
1496 $ hg help -k clone
1496 $ hg help -k clone
1497 Topics:
1497 Topics:
1498
1498
1499 config Configuration Files
1499 config Configuration Files
1500 extensions Using Additional Features
1500 extensions Using Additional Features
1501 glossary Glossary
1501 glossary Glossary
1502 phases Working with Phases
1502 phases Working with Phases
1503 subrepos Subrepositories
1503 subrepos Subrepositories
1504 urls URL Paths
1504 urls URL Paths
1505
1505
1506 Commands:
1506 Commands:
1507
1507
1508 bookmarks create a new bookmark or list existing bookmarks
1508 bookmarks create a new bookmark or list existing bookmarks
1509 clone make a copy of an existing repository
1509 clone make a copy of an existing repository
1510 paths show aliases for remote repositories
1510 paths show aliases for remote repositories
1511 pull pull changes from the specified source
1511 pull pull changes from the specified source
1512 update update working directory (or switch revisions)
1512 update update working directory (or switch revisions)
1513
1513
1514 Extensions:
1514 Extensions:
1515
1515
1516 clonebundles advertise pre-generated bundles to seed clones
1516 clonebundles advertise pre-generated bundles to seed clones
1517 narrow create clones which fetch history data for subset of files
1517 narrow create clones which fetch history data for subset of files
1518 (EXPERIMENTAL)
1518 (EXPERIMENTAL)
1519 prefixedname matched against word "clone"
1519 prefixedname matched against word "clone"
1520 relink recreates hardlinks between repository clones
1520 relink recreates hardlinks between repository clones
1521
1521
1522 Extension Commands:
1522 Extension Commands:
1523
1523
1524 qclone clone main and patch repository at same time
1524 qclone clone main and patch repository at same time
1525
1525
1526 Test unfound topic
1526 Test unfound topic
1527
1527
1528 $ hg help nonexistingtopicthatwillneverexisteverever
1528 $ hg help nonexistingtopicthatwillneverexisteverever
1529 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
1529 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
1530 (try 'hg help --keyword nonexistingtopicthatwillneverexisteverever')
1530 (try 'hg help --keyword nonexistingtopicthatwillneverexisteverever')
1531 [255]
1531 [255]
1532
1532
1533 Test unfound keyword
1533 Test unfound keyword
1534
1534
1535 $ hg help --keyword nonexistingwordthatwillneverexisteverever
1535 $ hg help --keyword nonexistingwordthatwillneverexisteverever
1536 abort: no matches
1536 abort: no matches
1537 (try 'hg help' for a list of topics)
1537 (try 'hg help' for a list of topics)
1538 [255]
1538 [255]
1539
1539
1540 Test omit indicating for help
1540 Test omit indicating for help
1541
1541
1542 $ cat > addverboseitems.py <<EOF
1542 $ cat > addverboseitems.py <<EOF
1543 > '''extension to test omit indicating.
1543 > '''extension to test omit indicating.
1544 >
1544 >
1545 > This paragraph is never omitted (for extension)
1545 > This paragraph is never omitted (for extension)
1546 >
1546 >
1547 > .. container:: verbose
1547 > .. container:: verbose
1548 >
1548 >
1549 > This paragraph is omitted,
1549 > This paragraph is omitted,
1550 > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension)
1550 > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension)
1551 >
1551 >
1552 > This paragraph is never omitted, too (for extension)
1552 > This paragraph is never omitted, too (for extension)
1553 > '''
1553 > '''
1554 > from __future__ import absolute_import
1554 > from __future__ import absolute_import
1555 > from mercurial import commands, help
1555 > from mercurial import commands, help
1556 > testtopic = """This paragraph is never omitted (for topic).
1556 > testtopic = """This paragraph is never omitted (for topic).
1557 >
1557 >
1558 > .. container:: verbose
1558 > .. container:: verbose
1559 >
1559 >
1560 > This paragraph is omitted,
1560 > This paragraph is omitted,
1561 > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic)
1561 > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic)
1562 >
1562 >
1563 > This paragraph is never omitted, too (for topic)
1563 > This paragraph is never omitted, too (for topic)
1564 > """
1564 > """
1565 > def extsetup(ui):
1565 > def extsetup(ui):
1566 > help.helptable.append((["topic-containing-verbose"],
1566 > help.helptable.append((["topic-containing-verbose"],
1567 > "This is the topic to test omit indicating.",
1567 > "This is the topic to test omit indicating.",
1568 > lambda ui: testtopic))
1568 > lambda ui: testtopic))
1569 > EOF
1569 > EOF
1570 $ echo '[extensions]' >> $HGRCPATH
1570 $ echo '[extensions]' >> $HGRCPATH
1571 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1571 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1572 $ hg help addverboseitems
1572 $ hg help addverboseitems
1573 addverboseitems extension - extension to test omit indicating.
1573 addverboseitems extension - extension to test omit indicating.
1574
1574
1575 This paragraph is never omitted (for extension)
1575 This paragraph is never omitted (for extension)
1576
1576
1577 This paragraph is never omitted, too (for extension)
1577 This paragraph is never omitted, too (for extension)
1578
1578
1579 (some details hidden, use --verbose to show complete help)
1579 (some details hidden, use --verbose to show complete help)
1580
1580
1581 no commands defined
1581 no commands defined
1582 $ hg help -v addverboseitems
1582 $ hg help -v addverboseitems
1583 addverboseitems extension - extension to test omit indicating.
1583 addverboseitems extension - extension to test omit indicating.
1584
1584
1585 This paragraph is never omitted (for extension)
1585 This paragraph is never omitted (for extension)
1586
1586
1587 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1587 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1588 extension)
1588 extension)
1589
1589
1590 This paragraph is never omitted, too (for extension)
1590 This paragraph is never omitted, too (for extension)
1591
1591
1592 no commands defined
1592 no commands defined
1593 $ hg help topic-containing-verbose
1593 $ hg help topic-containing-verbose
1594 This is the topic to test omit indicating.
1594 This is the topic to test omit indicating.
1595 """"""""""""""""""""""""""""""""""""""""""
1595 """"""""""""""""""""""""""""""""""""""""""
1596
1596
1597 This paragraph is never omitted (for topic).
1597 This paragraph is never omitted (for topic).
1598
1598
1599 This paragraph is never omitted, too (for topic)
1599 This paragraph is never omitted, too (for topic)
1600
1600
1601 (some details hidden, use --verbose to show complete help)
1601 (some details hidden, use --verbose to show complete help)
1602 $ hg help -v topic-containing-verbose
1602 $ hg help -v topic-containing-verbose
1603 This is the topic to test omit indicating.
1603 This is the topic to test omit indicating.
1604 """"""""""""""""""""""""""""""""""""""""""
1604 """"""""""""""""""""""""""""""""""""""""""
1605
1605
1606 This paragraph is never omitted (for topic).
1606 This paragraph is never omitted (for topic).
1607
1607
1608 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1608 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1609 topic)
1609 topic)
1610
1610
1611 This paragraph is never omitted, too (for topic)
1611 This paragraph is never omitted, too (for topic)
1612
1612
1613 Test section lookup
1613 Test section lookup
1614
1614
1615 $ hg help revset.merge
1615 $ hg help revset.merge
1616 "merge()"
1616 "merge()"
1617 Changeset is a merge changeset.
1617 Changeset is a merge changeset.
1618
1618
1619 $ hg help glossary.dag
1619 $ hg help glossary.dag
1620 DAG
1620 DAG
1621 The repository of changesets of a distributed version control system
1621 The repository of changesets of a distributed version control system
1622 (DVCS) can be described as a directed acyclic graph (DAG), consisting
1622 (DVCS) can be described as a directed acyclic graph (DAG), consisting
1623 of nodes and edges, where nodes correspond to changesets and edges
1623 of nodes and edges, where nodes correspond to changesets and edges
1624 imply a parent -> child relation. This graph can be visualized by
1624 imply a parent -> child relation. This graph can be visualized by
1625 graphical tools such as 'hg log --graph'. In Mercurial, the DAG is
1625 graphical tools such as 'hg log --graph'. In Mercurial, the DAG is
1626 limited by the requirement for children to have at most two parents.
1626 limited by the requirement for children to have at most two parents.
1627
1627
1628
1628
1629 $ hg help hgrc.paths
1629 $ hg help hgrc.paths
1630 "paths"
1630 "paths"
1631 -------
1631 -------
1632
1632
1633 Assigns symbolic names and behavior to repositories.
1633 Assigns symbolic names and behavior to repositories.
1634
1634
1635 Options are symbolic names defining the URL or directory that is the
1635 Options are symbolic names defining the URL or directory that is the
1636 location of the repository. Example:
1636 location of the repository. Example:
1637
1637
1638 [paths]
1638 [paths]
1639 my_server = https://example.com/my_repo
1639 my_server = https://example.com/my_repo
1640 local_path = /home/me/repo
1640 local_path = /home/me/repo
1641
1641
1642 These symbolic names can be used from the command line. To pull from
1642 These symbolic names can be used from the command line. To pull from
1643 "my_server": 'hg pull my_server'. To push to "local_path": 'hg push
1643 "my_server": 'hg pull my_server'. To push to "local_path": 'hg push
1644 local_path'.
1644 local_path'.
1645
1645
1646 Options containing colons (":") denote sub-options that can influence
1646 Options containing colons (":") denote sub-options that can influence
1647 behavior for that specific path. Example:
1647 behavior for that specific path. Example:
1648
1648
1649 [paths]
1649 [paths]
1650 my_server = https://example.com/my_path
1650 my_server = https://example.com/my_path
1651 my_server:pushurl = ssh://example.com/my_path
1651 my_server:pushurl = ssh://example.com/my_path
1652
1652
1653 The following sub-options can be defined:
1653 The following sub-options can be defined:
1654
1654
1655 "pushurl"
1655 "pushurl"
1656 The URL to use for push operations. If not defined, the location
1656 The URL to use for push operations. If not defined, the location
1657 defined by the path's main entry is used.
1657 defined by the path's main entry is used.
1658
1658
1659 "pushrev"
1659 "pushrev"
1660 A revset defining which revisions to push by default.
1660 A revset defining which revisions to push by default.
1661
1661
1662 When 'hg push' is executed without a "-r" argument, the revset defined
1662 When 'hg push' is executed without a "-r" argument, the revset defined
1663 by this sub-option is evaluated to determine what to push.
1663 by this sub-option is evaluated to determine what to push.
1664
1664
1665 For example, a value of "." will push the working directory's revision
1665 For example, a value of "." will push the working directory's revision
1666 by default.
1666 by default.
1667
1667
1668 Revsets specifying bookmarks will not result in the bookmark being
1668 Revsets specifying bookmarks will not result in the bookmark being
1669 pushed.
1669 pushed.
1670
1670
1671 The following special named paths exist:
1671 The following special named paths exist:
1672
1672
1673 "default"
1673 "default"
1674 The URL or directory to use when no source or remote is specified.
1674 The URL or directory to use when no source or remote is specified.
1675
1675
1676 'hg clone' will automatically define this path to the location the
1676 'hg clone' will automatically define this path to the location the
1677 repository was cloned from.
1677 repository was cloned from.
1678
1678
1679 "default-push"
1679 "default-push"
1680 (deprecated) The URL or directory for the default 'hg push' location.
1680 (deprecated) The URL or directory for the default 'hg push' location.
1681 "default:pushurl" should be used instead.
1681 "default:pushurl" should be used instead.
1682
1682
1683 $ hg help glossary.mcguffin
1683 $ hg help glossary.mcguffin
1684 abort: help section not found: glossary.mcguffin
1684 abort: help section not found: glossary.mcguffin
1685 [255]
1685 [255]
1686
1686
1687 $ hg help glossary.mc.guffin
1687 $ hg help glossary.mc.guffin
1688 abort: help section not found: glossary.mc.guffin
1688 abort: help section not found: glossary.mc.guffin
1689 [255]
1689 [255]
1690
1690
1691 $ hg help template.files
1691 $ hg help template.files
1692 files List of strings. All files modified, added, or removed by
1692 files List of strings. All files modified, added, or removed by
1693 this changeset.
1693 this changeset.
1694 files(pattern)
1694 files(pattern)
1695 All files of the current changeset matching the pattern. See
1695 All files of the current changeset matching the pattern. See
1696 'hg help patterns'.
1696 'hg help patterns'.
1697
1697
1698 Test section lookup by translated message
1698 Test section lookup by translated message
1699
1699
1700 str.lower() instead of encoding.lower(str) on translated message might
1700 str.lower() instead of encoding.lower(str) on translated message might
1701 make message meaningless, because some encoding uses 0x41(A) - 0x5a(Z)
1701 make message meaningless, because some encoding uses 0x41(A) - 0x5a(Z)
1702 as the second or later byte of multi-byte character.
1702 as the second or later byte of multi-byte character.
1703
1703
1704 For example, "\x8bL\x98^" (translation of "record" in ja_JP.cp932)
1704 For example, "\x8bL\x98^" (translation of "record" in ja_JP.cp932)
1705 contains 0x4c (L). str.lower() replaces 0x4c(L) by 0x6c(l) and this
1705 contains 0x4c (L). str.lower() replaces 0x4c(L) by 0x6c(l) and this
1706 replacement makes message meaningless.
1706 replacement makes message meaningless.
1707
1707
1708 This tests that section lookup by translated string isn't broken by
1708 This tests that section lookup by translated string isn't broken by
1709 such str.lower().
1709 such str.lower().
1710
1710
1711 $ $PYTHON <<EOF
1711 $ $PYTHON <<EOF
1712 > def escape(s):
1712 > def escape(s):
1713 > return ''.join('\u%x' % ord(uc) for uc in s.decode('cp932'))
1713 > return ''.join('\u%x' % ord(uc) for uc in s.decode('cp932'))
1714 > # translation of "record" in ja_JP.cp932
1714 > # translation of "record" in ja_JP.cp932
1715 > upper = "\x8bL\x98^"
1715 > upper = "\x8bL\x98^"
1716 > # str.lower()-ed section name should be treated as different one
1716 > # str.lower()-ed section name should be treated as different one
1717 > lower = "\x8bl\x98^"
1717 > lower = "\x8bl\x98^"
1718 > with open('ambiguous.py', 'w') as fp:
1718 > with open('ambiguous.py', 'w') as fp:
1719 > fp.write("""# ambiguous section names in ja_JP.cp932
1719 > fp.write("""# ambiguous section names in ja_JP.cp932
1720 > u'''summary of extension
1720 > u'''summary of extension
1721 >
1721 >
1722 > %s
1722 > %s
1723 > ----
1723 > ----
1724 >
1724 >
1725 > Upper name should show only this message
1725 > Upper name should show only this message
1726 >
1726 >
1727 > %s
1727 > %s
1728 > ----
1728 > ----
1729 >
1729 >
1730 > Lower name should show only this message
1730 > Lower name should show only this message
1731 >
1731 >
1732 > subsequent section
1732 > subsequent section
1733 > ------------------
1733 > ------------------
1734 >
1734 >
1735 > This should be hidden at 'hg help ambiguous' with section name.
1735 > This should be hidden at 'hg help ambiguous' with section name.
1736 > '''
1736 > '''
1737 > """ % (escape(upper), escape(lower)))
1737 > """ % (escape(upper), escape(lower)))
1738 > EOF
1738 > EOF
1739
1739
1740 $ cat >> $HGRCPATH <<EOF
1740 $ cat >> $HGRCPATH <<EOF
1741 > [extensions]
1741 > [extensions]
1742 > ambiguous = ./ambiguous.py
1742 > ambiguous = ./ambiguous.py
1743 > EOF
1743 > EOF
1744
1744
1745 $ $PYTHON <<EOF | sh
1745 $ $PYTHON <<EOF | sh
1746 > upper = "\x8bL\x98^"
1746 > upper = "\x8bL\x98^"
1747 > print("hg --encoding cp932 help -e ambiguous.%s" % upper)
1747 > print("hg --encoding cp932 help -e ambiguous.%s" % upper)
1748 > EOF
1748 > EOF
1749 \x8bL\x98^ (esc)
1749 \x8bL\x98^ (esc)
1750 ----
1750 ----
1751
1751
1752 Upper name should show only this message
1752 Upper name should show only this message
1753
1753
1754
1754
1755 $ $PYTHON <<EOF | sh
1755 $ $PYTHON <<EOF | sh
1756 > lower = "\x8bl\x98^"
1756 > lower = "\x8bl\x98^"
1757 > print("hg --encoding cp932 help -e ambiguous.%s" % lower)
1757 > print("hg --encoding cp932 help -e ambiguous.%s" % lower)
1758 > EOF
1758 > EOF
1759 \x8bl\x98^ (esc)
1759 \x8bl\x98^ (esc)
1760 ----
1760 ----
1761
1761
1762 Lower name should show only this message
1762 Lower name should show only this message
1763
1763
1764
1764
1765 $ cat >> $HGRCPATH <<EOF
1765 $ cat >> $HGRCPATH <<EOF
1766 > [extensions]
1766 > [extensions]
1767 > ambiguous = !
1767 > ambiguous = !
1768 > EOF
1768 > EOF
1769
1769
1770 Show help content of disabled extensions
1770 Show help content of disabled extensions
1771
1771
1772 $ cat >> $HGRCPATH <<EOF
1772 $ cat >> $HGRCPATH <<EOF
1773 > [extensions]
1773 > [extensions]
1774 > ambiguous = !./ambiguous.py
1774 > ambiguous = !./ambiguous.py
1775 > EOF
1775 > EOF
1776 $ hg help -e ambiguous
1776 $ hg help -e ambiguous
1777 ambiguous extension - (no help text available)
1777 ambiguous extension - (no help text available)
1778
1778
1779 (use 'hg help extensions' for information on enabling extensions)
1779 (use 'hg help extensions' for information on enabling extensions)
1780
1780
1781 Test dynamic list of merge tools only shows up once
1781 Test dynamic list of merge tools only shows up once
1782 $ hg help merge-tools
1782 $ hg help merge-tools
1783 Merge Tools
1783 Merge Tools
1784 """""""""""
1784 """""""""""
1785
1785
1786 To merge files Mercurial uses merge tools.
1786 To merge files Mercurial uses merge tools.
1787
1787
1788 A merge tool combines two different versions of a file into a merged file.
1788 A merge tool combines two different versions of a file into a merged file.
1789 Merge tools are given the two files and the greatest common ancestor of
1789 Merge tools are given the two files and the greatest common ancestor of
1790 the two file versions, so they can determine the changes made on both
1790 the two file versions, so they can determine the changes made on both
1791 branches.
1791 branches.
1792
1792
1793 Merge tools are used both for 'hg resolve', 'hg merge', 'hg update', 'hg
1793 Merge tools are used both for 'hg resolve', 'hg merge', 'hg update', 'hg
1794 backout' and in several extensions.
1794 backout' and in several extensions.
1795
1795
1796 Usually, the merge tool tries to automatically reconcile the files by
1796 Usually, the merge tool tries to automatically reconcile the files by
1797 combining all non-overlapping changes that occurred separately in the two
1797 combining all non-overlapping changes that occurred separately in the two
1798 different evolutions of the same initial base file. Furthermore, some
1798 different evolutions of the same initial base file. Furthermore, some
1799 interactive merge programs make it easier to manually resolve conflicting
1799 interactive merge programs make it easier to manually resolve conflicting
1800 merges, either in a graphical way, or by inserting some conflict markers.
1800 merges, either in a graphical way, or by inserting some conflict markers.
1801 Mercurial does not include any interactive merge programs but relies on
1801 Mercurial does not include any interactive merge programs but relies on
1802 external tools for that.
1802 external tools for that.
1803
1803
1804 Available merge tools
1804 Available merge tools
1805 =====================
1805 =====================
1806
1806
1807 External merge tools and their properties are configured in the merge-
1807 External merge tools and their properties are configured in the merge-
1808 tools configuration section - see hgrc(5) - but they can often just be
1808 tools configuration section - see hgrc(5) - but they can often just be
1809 named by their executable.
1809 named by their executable.
1810
1810
1811 A merge tool is generally usable if its executable can be found on the
1811 A merge tool is generally usable if its executable can be found on the
1812 system and if it can handle the merge. The executable is found if it is an
1812 system and if it can handle the merge. The executable is found if it is an
1813 absolute or relative executable path or the name of an application in the
1813 absolute or relative executable path or the name of an application in the
1814 executable search path. The tool is assumed to be able to handle the merge
1814 executable search path. The tool is assumed to be able to handle the merge
1815 if it can handle symlinks if the file is a symlink, if it can handle
1815 if it can handle symlinks if the file is a symlink, if it can handle
1816 binary files if the file is binary, and if a GUI is available if the tool
1816 binary files if the file is binary, and if a GUI is available if the tool
1817 requires a GUI.
1817 requires a GUI.
1818
1818
1819 There are some internal merge tools which can be used. The internal merge
1819 There are some internal merge tools which can be used. The internal merge
1820 tools are:
1820 tools are:
1821
1821
1822 ":dump"
1822 ":dump"
1823 Creates three versions of the files to merge, containing the contents of
1823 Creates three versions of the files to merge, containing the contents of
1824 local, other and base. These files can then be used to perform a merge
1824 local, other and base. These files can then be used to perform a merge
1825 manually. If the file to be merged is named "a.txt", these files will
1825 manually. If the file to be merged is named "a.txt", these files will
1826 accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and
1826 accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and
1827 they will be placed in the same directory as "a.txt".
1827 they will be placed in the same directory as "a.txt".
1828
1828
1829 This implies premerge. Therefore, files aren't dumped, if premerge runs
1829 This implies premerge. Therefore, files aren't dumped, if premerge runs
1830 successfully. Use :forcedump to forcibly write files out.
1830 successfully. Use :forcedump to forcibly write files out.
1831
1831
1832 (actual capabilities: binary, symlink)
1833
1832 ":fail"
1834 ":fail"
1833 Rather than attempting to merge files that were modified on both
1835 Rather than attempting to merge files that were modified on both
1834 branches, it marks them as unresolved. The resolve command must be used
1836 branches, it marks them as unresolved. The resolve command must be used
1835 to resolve these conflicts.
1837 to resolve these conflicts.
1836
1838
1839 (actual capabilities: binary, symlink)
1840
1837 ":forcedump"
1841 ":forcedump"
1838 Creates three versions of the files as same as :dump, but omits
1842 Creates three versions of the files as same as :dump, but omits
1839 premerge.
1843 premerge.
1840
1844
1845 (actual capabilities: binary, symlink)
1846
1841 ":local"
1847 ":local"
1842 Uses the local 'p1()' version of files as the merged version.
1848 Uses the local 'p1()' version of files as the merged version.
1843
1849
1850 (actual capabilities: binary, symlink)
1851
1844 ":merge"
1852 ":merge"
1845 Uses the internal non-interactive simple merge algorithm for merging
1853 Uses the internal non-interactive simple merge algorithm for merging
1846 files. It will fail if there are any conflicts and leave markers in the
1854 files. It will fail if there are any conflicts and leave markers in the
1847 partially merged file. Markers will have two sections, one for each side
1855 partially merged file. Markers will have two sections, one for each side
1848 of merge.
1856 of merge.
1849
1857
1850 ":merge-local"
1858 ":merge-local"
1851 Like :merge, but resolve all conflicts non-interactively in favor of the
1859 Like :merge, but resolve all conflicts non-interactively in favor of the
1852 local 'p1()' changes.
1860 local 'p1()' changes.
1853
1861
1854 ":merge-other"
1862 ":merge-other"
1855 Like :merge, but resolve all conflicts non-interactively in favor of the
1863 Like :merge, but resolve all conflicts non-interactively in favor of the
1856 other 'p2()' changes.
1864 other 'p2()' changes.
1857
1865
1858 ":merge3"
1866 ":merge3"
1859 Uses the internal non-interactive simple merge algorithm for merging
1867 Uses the internal non-interactive simple merge algorithm for merging
1860 files. It will fail if there are any conflicts and leave markers in the
1868 files. It will fail if there are any conflicts and leave markers in the
1861 partially merged file. Marker will have three sections, one from each
1869 partially merged file. Marker will have three sections, one from each
1862 side of the merge and one for the base content.
1870 side of the merge and one for the base content.
1863
1871
1864 ":other"
1872 ":other"
1865 Uses the other 'p2()' version of files as the merged version.
1873 Uses the other 'p2()' version of files as the merged version.
1866
1874
1875 (actual capabilities: binary, symlink)
1876
1867 ":prompt"
1877 ":prompt"
1868 Asks the user which of the local 'p1()' or the other 'p2()' version to
1878 Asks the user which of the local 'p1()' or the other 'p2()' version to
1869 keep as the merged version.
1879 keep as the merged version.
1870
1880
1881 (actual capabilities: binary, symlink)
1882
1871 ":tagmerge"
1883 ":tagmerge"
1872 Uses the internal tag merge algorithm (experimental).
1884 Uses the internal tag merge algorithm (experimental).
1873
1885
1874 ":union"
1886 ":union"
1875 Uses the internal non-interactive simple merge algorithm for merging
1887 Uses the internal non-interactive simple merge algorithm for merging
1876 files. It will use both left and right sides for conflict regions. No
1888 files. It will use both left and right sides for conflict regions. No
1877 markers are inserted.
1889 markers are inserted.
1878
1890
1879 Internal tools are always available and do not require a GUI but will by
1891 Internal tools are always available and do not require a GUI but will by
1880 default not handle symlinks or binary files.
1892 default not handle symlinks or binary files. See next section for detail
1893 about "actual capabilities" described above.
1881
1894
1882 Choosing a merge tool
1895 Choosing a merge tool
1883 =====================
1896 =====================
1884
1897
1885 Mercurial uses these rules when deciding which merge tool to use:
1898 Mercurial uses these rules when deciding which merge tool to use:
1886
1899
1887 1. If a tool has been specified with the --tool option to merge or
1900 1. If a tool has been specified with the --tool option to merge or
1888 resolve, it is used. If it is the name of a tool in the merge-tools
1901 resolve, it is used. If it is the name of a tool in the merge-tools
1889 configuration, its configuration is used. Otherwise the specified tool
1902 configuration, its configuration is used. Otherwise the specified tool
1890 must be executable by the shell.
1903 must be executable by the shell.
1891 2. If the "HGMERGE" environment variable is present, its value is used and
1904 2. If the "HGMERGE" environment variable is present, its value is used and
1892 must be executable by the shell.
1905 must be executable by the shell.
1893 3. If the filename of the file to be merged matches any of the patterns in
1906 3. If the filename of the file to be merged matches any of the patterns in
1894 the merge-patterns configuration section, the first usable merge tool
1907 the merge-patterns configuration section, the first usable merge tool
1895 corresponding to a matching pattern is used.
1908 corresponding to a matching pattern is used.
1896 4. If ui.merge is set it will be considered next. If the value is not the
1909 4. If ui.merge is set it will be considered next. If the value is not the
1897 name of a configured tool, the specified value is used and must be
1910 name of a configured tool, the specified value is used and must be
1898 executable by the shell. Otherwise the named tool is used if it is
1911 executable by the shell. Otherwise the named tool is used if it is
1899 usable.
1912 usable.
1900 5. If any usable merge tools are present in the merge-tools configuration
1913 5. If any usable merge tools are present in the merge-tools configuration
1901 section, the one with the highest priority is used.
1914 section, the one with the highest priority is used.
1902 6. If a program named "hgmerge" can be found on the system, it is used -
1915 6. If a program named "hgmerge" can be found on the system, it is used -
1903 but it will by default not be used for symlinks and binary files.
1916 but it will by default not be used for symlinks and binary files.
1904 7. If the file to be merged is not binary and is not a symlink, then
1917 7. If the file to be merged is not binary and is not a symlink, then
1905 internal ":merge" is used.
1918 internal ":merge" is used.
1906 8. Otherwise, ":prompt" is used.
1919 8. Otherwise, ":prompt" is used.
1907
1920
1908 For historical reason, Mercurial assumes capabilities of internal merge
1921 For historical reason, Mercurial assumes capabilities of internal merge
1909 tools as below while examining rules above, regardless of actual
1922 tools as below while examining rules above, regardless of actual
1910 capabilities of them.
1923 capabilities of them.
1911
1924
1912 step specified via binary symlink
1925 step specified via binary symlink
1913 ----------------------------------
1926 ----------------------------------
1914 1. --tool o o
1927 1. --tool o o
1915 2. HGMERGE o o
1928 2. HGMERGE o o
1916 3. merge-patterns o (*) x (*)
1929 3. merge-patterns o (*) x (*)
1917 4. ui.merge x (*) x (*)
1930 4. ui.merge x (*) x (*)
1918
1931
1919 If "merge.strict-capability-check" configuration is true, Mercurial checks
1932 If "merge.strict-capability-check" configuration is true, Mercurial checks
1920 capabilities of internal merge tools strictly in (*) cases above. It is
1933 capabilities of internal merge tools strictly in (*) cases above. It is
1921 false by default for backward compatibility.
1934 false by default for backward compatibility.
1922
1935
1923 Note:
1936 Note:
1924 After selecting a merge program, Mercurial will by default attempt to
1937 After selecting a merge program, Mercurial will by default attempt to
1925 merge the files using a simple merge algorithm first. Only if it
1938 merge the files using a simple merge algorithm first. Only if it
1926 doesn't succeed because of conflicting changes will Mercurial actually
1939 doesn't succeed because of conflicting changes will Mercurial actually
1927 execute the merge program. Whether to use the simple merge algorithm
1940 execute the merge program. Whether to use the simple merge algorithm
1928 first can be controlled by the premerge setting of the merge tool.
1941 first can be controlled by the premerge setting of the merge tool.
1929 Premerge is enabled by default unless the file is binary or a symlink.
1942 Premerge is enabled by default unless the file is binary or a symlink.
1930
1943
1931 See the merge-tools and ui sections of hgrc(5) for details on the
1944 See the merge-tools and ui sections of hgrc(5) for details on the
1932 configuration of merge tools.
1945 configuration of merge tools.
1933
1946
1934 Compression engines listed in `hg help bundlespec`
1947 Compression engines listed in `hg help bundlespec`
1935
1948
1936 $ hg help bundlespec | grep gzip
1949 $ hg help bundlespec | grep gzip
1937 "v1" bundles can only use the "gzip", "bzip2", and "none" compression
1950 "v1" bundles can only use the "gzip", "bzip2", and "none" compression
1938 An algorithm that produces smaller bundles than "gzip".
1951 An algorithm that produces smaller bundles than "gzip".
1939 This engine will likely produce smaller bundles than "gzip" but will be
1952 This engine will likely produce smaller bundles than "gzip" but will be
1940 "gzip"
1953 "gzip"
1941 better compression than "gzip". It also frequently yields better (?)
1954 better compression than "gzip". It also frequently yields better (?)
1942
1955
1943 Test usage of section marks in help documents
1956 Test usage of section marks in help documents
1944
1957
1945 $ cd "$TESTDIR"/../doc
1958 $ cd "$TESTDIR"/../doc
1946 $ $PYTHON check-seclevel.py
1959 $ $PYTHON check-seclevel.py
1947 $ cd $TESTTMP
1960 $ cd $TESTTMP
1948
1961
1949 #if serve
1962 #if serve
1950
1963
1951 Test the help pages in hgweb.
1964 Test the help pages in hgweb.
1952
1965
1953 Dish up an empty repo; serve it cold.
1966 Dish up an empty repo; serve it cold.
1954
1967
1955 $ hg init "$TESTTMP/test"
1968 $ hg init "$TESTTMP/test"
1956 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
1969 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
1957 $ cat hg.pid >> $DAEMON_PIDS
1970 $ cat hg.pid >> $DAEMON_PIDS
1958
1971
1959 $ get-with-headers.py $LOCALIP:$HGPORT "help"
1972 $ get-with-headers.py $LOCALIP:$HGPORT "help"
1960 200 Script output follows
1973 200 Script output follows
1961
1974
1962 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1975 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1963 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1976 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1964 <head>
1977 <head>
1965 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1978 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1966 <meta name="robots" content="index, nofollow" />
1979 <meta name="robots" content="index, nofollow" />
1967 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1980 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1968 <script type="text/javascript" src="/static/mercurial.js"></script>
1981 <script type="text/javascript" src="/static/mercurial.js"></script>
1969
1982
1970 <title>Help: Index</title>
1983 <title>Help: Index</title>
1971 </head>
1984 </head>
1972 <body>
1985 <body>
1973
1986
1974 <div class="container">
1987 <div class="container">
1975 <div class="menu">
1988 <div class="menu">
1976 <div class="logo">
1989 <div class="logo">
1977 <a href="https://mercurial-scm.org/">
1990 <a href="https://mercurial-scm.org/">
1978 <img src="/static/hglogo.png" alt="mercurial" /></a>
1991 <img src="/static/hglogo.png" alt="mercurial" /></a>
1979 </div>
1992 </div>
1980 <ul>
1993 <ul>
1981 <li><a href="/shortlog">log</a></li>
1994 <li><a href="/shortlog">log</a></li>
1982 <li><a href="/graph">graph</a></li>
1995 <li><a href="/graph">graph</a></li>
1983 <li><a href="/tags">tags</a></li>
1996 <li><a href="/tags">tags</a></li>
1984 <li><a href="/bookmarks">bookmarks</a></li>
1997 <li><a href="/bookmarks">bookmarks</a></li>
1985 <li><a href="/branches">branches</a></li>
1998 <li><a href="/branches">branches</a></li>
1986 </ul>
1999 </ul>
1987 <ul>
2000 <ul>
1988 <li class="active">help</li>
2001 <li class="active">help</li>
1989 </ul>
2002 </ul>
1990 </div>
2003 </div>
1991
2004
1992 <div class="main">
2005 <div class="main">
1993 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2006 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1994
2007
1995 <form class="search" action="/log">
2008 <form class="search" action="/log">
1996
2009
1997 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2010 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
1998 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2011 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1999 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2012 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2000 </form>
2013 </form>
2001 <table class="bigtable">
2014 <table class="bigtable">
2002 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
2015 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
2003
2016
2004 <tr><td>
2017 <tr><td>
2005 <a href="/help/bundlespec">
2018 <a href="/help/bundlespec">
2006 bundlespec
2019 bundlespec
2007 </a>
2020 </a>
2008 </td><td>
2021 </td><td>
2009 Bundle File Formats
2022 Bundle File Formats
2010 </td></tr>
2023 </td></tr>
2011 <tr><td>
2024 <tr><td>
2012 <a href="/help/color">
2025 <a href="/help/color">
2013 color
2026 color
2014 </a>
2027 </a>
2015 </td><td>
2028 </td><td>
2016 Colorizing Outputs
2029 Colorizing Outputs
2017 </td></tr>
2030 </td></tr>
2018 <tr><td>
2031 <tr><td>
2019 <a href="/help/config">
2032 <a href="/help/config">
2020 config
2033 config
2021 </a>
2034 </a>
2022 </td><td>
2035 </td><td>
2023 Configuration Files
2036 Configuration Files
2024 </td></tr>
2037 </td></tr>
2025 <tr><td>
2038 <tr><td>
2026 <a href="/help/dates">
2039 <a href="/help/dates">
2027 dates
2040 dates
2028 </a>
2041 </a>
2029 </td><td>
2042 </td><td>
2030 Date Formats
2043 Date Formats
2031 </td></tr>
2044 </td></tr>
2032 <tr><td>
2045 <tr><td>
2033 <a href="/help/deprecated">
2046 <a href="/help/deprecated">
2034 deprecated
2047 deprecated
2035 </a>
2048 </a>
2036 </td><td>
2049 </td><td>
2037 Deprecated Features
2050 Deprecated Features
2038 </td></tr>
2051 </td></tr>
2039 <tr><td>
2052 <tr><td>
2040 <a href="/help/diffs">
2053 <a href="/help/diffs">
2041 diffs
2054 diffs
2042 </a>
2055 </a>
2043 </td><td>
2056 </td><td>
2044 Diff Formats
2057 Diff Formats
2045 </td></tr>
2058 </td></tr>
2046 <tr><td>
2059 <tr><td>
2047 <a href="/help/environment">
2060 <a href="/help/environment">
2048 environment
2061 environment
2049 </a>
2062 </a>
2050 </td><td>
2063 </td><td>
2051 Environment Variables
2064 Environment Variables
2052 </td></tr>
2065 </td></tr>
2053 <tr><td>
2066 <tr><td>
2054 <a href="/help/extensions">
2067 <a href="/help/extensions">
2055 extensions
2068 extensions
2056 </a>
2069 </a>
2057 </td><td>
2070 </td><td>
2058 Using Additional Features
2071 Using Additional Features
2059 </td></tr>
2072 </td></tr>
2060 <tr><td>
2073 <tr><td>
2061 <a href="/help/filesets">
2074 <a href="/help/filesets">
2062 filesets
2075 filesets
2063 </a>
2076 </a>
2064 </td><td>
2077 </td><td>
2065 Specifying File Sets
2078 Specifying File Sets
2066 </td></tr>
2079 </td></tr>
2067 <tr><td>
2080 <tr><td>
2068 <a href="/help/flags">
2081 <a href="/help/flags">
2069 flags
2082 flags
2070 </a>
2083 </a>
2071 </td><td>
2084 </td><td>
2072 Command-line flags
2085 Command-line flags
2073 </td></tr>
2086 </td></tr>
2074 <tr><td>
2087 <tr><td>
2075 <a href="/help/glossary">
2088 <a href="/help/glossary">
2076 glossary
2089 glossary
2077 </a>
2090 </a>
2078 </td><td>
2091 </td><td>
2079 Glossary
2092 Glossary
2080 </td></tr>
2093 </td></tr>
2081 <tr><td>
2094 <tr><td>
2082 <a href="/help/hgignore">
2095 <a href="/help/hgignore">
2083 hgignore
2096 hgignore
2084 </a>
2097 </a>
2085 </td><td>
2098 </td><td>
2086 Syntax for Mercurial Ignore Files
2099 Syntax for Mercurial Ignore Files
2087 </td></tr>
2100 </td></tr>
2088 <tr><td>
2101 <tr><td>
2089 <a href="/help/hgweb">
2102 <a href="/help/hgweb">
2090 hgweb
2103 hgweb
2091 </a>
2104 </a>
2092 </td><td>
2105 </td><td>
2093 Configuring hgweb
2106 Configuring hgweb
2094 </td></tr>
2107 </td></tr>
2095 <tr><td>
2108 <tr><td>
2096 <a href="/help/internals">
2109 <a href="/help/internals">
2097 internals
2110 internals
2098 </a>
2111 </a>
2099 </td><td>
2112 </td><td>
2100 Technical implementation topics
2113 Technical implementation topics
2101 </td></tr>
2114 </td></tr>
2102 <tr><td>
2115 <tr><td>
2103 <a href="/help/merge-tools">
2116 <a href="/help/merge-tools">
2104 merge-tools
2117 merge-tools
2105 </a>
2118 </a>
2106 </td><td>
2119 </td><td>
2107 Merge Tools
2120 Merge Tools
2108 </td></tr>
2121 </td></tr>
2109 <tr><td>
2122 <tr><td>
2110 <a href="/help/pager">
2123 <a href="/help/pager">
2111 pager
2124 pager
2112 </a>
2125 </a>
2113 </td><td>
2126 </td><td>
2114 Pager Support
2127 Pager Support
2115 </td></tr>
2128 </td></tr>
2116 <tr><td>
2129 <tr><td>
2117 <a href="/help/patterns">
2130 <a href="/help/patterns">
2118 patterns
2131 patterns
2119 </a>
2132 </a>
2120 </td><td>
2133 </td><td>
2121 File Name Patterns
2134 File Name Patterns
2122 </td></tr>
2135 </td></tr>
2123 <tr><td>
2136 <tr><td>
2124 <a href="/help/phases">
2137 <a href="/help/phases">
2125 phases
2138 phases
2126 </a>
2139 </a>
2127 </td><td>
2140 </td><td>
2128 Working with Phases
2141 Working with Phases
2129 </td></tr>
2142 </td></tr>
2130 <tr><td>
2143 <tr><td>
2131 <a href="/help/revisions">
2144 <a href="/help/revisions">
2132 revisions
2145 revisions
2133 </a>
2146 </a>
2134 </td><td>
2147 </td><td>
2135 Specifying Revisions
2148 Specifying Revisions
2136 </td></tr>
2149 </td></tr>
2137 <tr><td>
2150 <tr><td>
2138 <a href="/help/scripting">
2151 <a href="/help/scripting">
2139 scripting
2152 scripting
2140 </a>
2153 </a>
2141 </td><td>
2154 </td><td>
2142 Using Mercurial from scripts and automation
2155 Using Mercurial from scripts and automation
2143 </td></tr>
2156 </td></tr>
2144 <tr><td>
2157 <tr><td>
2145 <a href="/help/subrepos">
2158 <a href="/help/subrepos">
2146 subrepos
2159 subrepos
2147 </a>
2160 </a>
2148 </td><td>
2161 </td><td>
2149 Subrepositories
2162 Subrepositories
2150 </td></tr>
2163 </td></tr>
2151 <tr><td>
2164 <tr><td>
2152 <a href="/help/templating">
2165 <a href="/help/templating">
2153 templating
2166 templating
2154 </a>
2167 </a>
2155 </td><td>
2168 </td><td>
2156 Template Usage
2169 Template Usage
2157 </td></tr>
2170 </td></tr>
2158 <tr><td>
2171 <tr><td>
2159 <a href="/help/urls">
2172 <a href="/help/urls">
2160 urls
2173 urls
2161 </a>
2174 </a>
2162 </td><td>
2175 </td><td>
2163 URL Paths
2176 URL Paths
2164 </td></tr>
2177 </td></tr>
2165 <tr><td>
2178 <tr><td>
2166 <a href="/help/topic-containing-verbose">
2179 <a href="/help/topic-containing-verbose">
2167 topic-containing-verbose
2180 topic-containing-verbose
2168 </a>
2181 </a>
2169 </td><td>
2182 </td><td>
2170 This is the topic to test omit indicating.
2183 This is the topic to test omit indicating.
2171 </td></tr>
2184 </td></tr>
2172
2185
2173
2186
2174 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
2187 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
2175
2188
2176 <tr><td>
2189 <tr><td>
2177 <a href="/help/add">
2190 <a href="/help/add">
2178 add
2191 add
2179 </a>
2192 </a>
2180 </td><td>
2193 </td><td>
2181 add the specified files on the next commit
2194 add the specified files on the next commit
2182 </td></tr>
2195 </td></tr>
2183 <tr><td>
2196 <tr><td>
2184 <a href="/help/annotate">
2197 <a href="/help/annotate">
2185 annotate
2198 annotate
2186 </a>
2199 </a>
2187 </td><td>
2200 </td><td>
2188 show changeset information by line for each file
2201 show changeset information by line for each file
2189 </td></tr>
2202 </td></tr>
2190 <tr><td>
2203 <tr><td>
2191 <a href="/help/clone">
2204 <a href="/help/clone">
2192 clone
2205 clone
2193 </a>
2206 </a>
2194 </td><td>
2207 </td><td>
2195 make a copy of an existing repository
2208 make a copy of an existing repository
2196 </td></tr>
2209 </td></tr>
2197 <tr><td>
2210 <tr><td>
2198 <a href="/help/commit">
2211 <a href="/help/commit">
2199 commit
2212 commit
2200 </a>
2213 </a>
2201 </td><td>
2214 </td><td>
2202 commit the specified files or all outstanding changes
2215 commit the specified files or all outstanding changes
2203 </td></tr>
2216 </td></tr>
2204 <tr><td>
2217 <tr><td>
2205 <a href="/help/diff">
2218 <a href="/help/diff">
2206 diff
2219 diff
2207 </a>
2220 </a>
2208 </td><td>
2221 </td><td>
2209 diff repository (or selected files)
2222 diff repository (or selected files)
2210 </td></tr>
2223 </td></tr>
2211 <tr><td>
2224 <tr><td>
2212 <a href="/help/export">
2225 <a href="/help/export">
2213 export
2226 export
2214 </a>
2227 </a>
2215 </td><td>
2228 </td><td>
2216 dump the header and diffs for one or more changesets
2229 dump the header and diffs for one or more changesets
2217 </td></tr>
2230 </td></tr>
2218 <tr><td>
2231 <tr><td>
2219 <a href="/help/forget">
2232 <a href="/help/forget">
2220 forget
2233 forget
2221 </a>
2234 </a>
2222 </td><td>
2235 </td><td>
2223 forget the specified files on the next commit
2236 forget the specified files on the next commit
2224 </td></tr>
2237 </td></tr>
2225 <tr><td>
2238 <tr><td>
2226 <a href="/help/init">
2239 <a href="/help/init">
2227 init
2240 init
2228 </a>
2241 </a>
2229 </td><td>
2242 </td><td>
2230 create a new repository in the given directory
2243 create a new repository in the given directory
2231 </td></tr>
2244 </td></tr>
2232 <tr><td>
2245 <tr><td>
2233 <a href="/help/log">
2246 <a href="/help/log">
2234 log
2247 log
2235 </a>
2248 </a>
2236 </td><td>
2249 </td><td>
2237 show revision history of entire repository or files
2250 show revision history of entire repository or files
2238 </td></tr>
2251 </td></tr>
2239 <tr><td>
2252 <tr><td>
2240 <a href="/help/merge">
2253 <a href="/help/merge">
2241 merge
2254 merge
2242 </a>
2255 </a>
2243 </td><td>
2256 </td><td>
2244 merge another revision into working directory
2257 merge another revision into working directory
2245 </td></tr>
2258 </td></tr>
2246 <tr><td>
2259 <tr><td>
2247 <a href="/help/pull">
2260 <a href="/help/pull">
2248 pull
2261 pull
2249 </a>
2262 </a>
2250 </td><td>
2263 </td><td>
2251 pull changes from the specified source
2264 pull changes from the specified source
2252 </td></tr>
2265 </td></tr>
2253 <tr><td>
2266 <tr><td>
2254 <a href="/help/push">
2267 <a href="/help/push">
2255 push
2268 push
2256 </a>
2269 </a>
2257 </td><td>
2270 </td><td>
2258 push changes to the specified destination
2271 push changes to the specified destination
2259 </td></tr>
2272 </td></tr>
2260 <tr><td>
2273 <tr><td>
2261 <a href="/help/remove">
2274 <a href="/help/remove">
2262 remove
2275 remove
2263 </a>
2276 </a>
2264 </td><td>
2277 </td><td>
2265 remove the specified files on the next commit
2278 remove the specified files on the next commit
2266 </td></tr>
2279 </td></tr>
2267 <tr><td>
2280 <tr><td>
2268 <a href="/help/serve">
2281 <a href="/help/serve">
2269 serve
2282 serve
2270 </a>
2283 </a>
2271 </td><td>
2284 </td><td>
2272 start stand-alone webserver
2285 start stand-alone webserver
2273 </td></tr>
2286 </td></tr>
2274 <tr><td>
2287 <tr><td>
2275 <a href="/help/status">
2288 <a href="/help/status">
2276 status
2289 status
2277 </a>
2290 </a>
2278 </td><td>
2291 </td><td>
2279 show changed files in the working directory
2292 show changed files in the working directory
2280 </td></tr>
2293 </td></tr>
2281 <tr><td>
2294 <tr><td>
2282 <a href="/help/summary">
2295 <a href="/help/summary">
2283 summary
2296 summary
2284 </a>
2297 </a>
2285 </td><td>
2298 </td><td>
2286 summarize working directory state
2299 summarize working directory state
2287 </td></tr>
2300 </td></tr>
2288 <tr><td>
2301 <tr><td>
2289 <a href="/help/update">
2302 <a href="/help/update">
2290 update
2303 update
2291 </a>
2304 </a>
2292 </td><td>
2305 </td><td>
2293 update working directory (or switch revisions)
2306 update working directory (or switch revisions)
2294 </td></tr>
2307 </td></tr>
2295
2308
2296
2309
2297
2310
2298 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
2311 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
2299
2312
2300 <tr><td>
2313 <tr><td>
2301 <a href="/help/addremove">
2314 <a href="/help/addremove">
2302 addremove
2315 addremove
2303 </a>
2316 </a>
2304 </td><td>
2317 </td><td>
2305 add all new files, delete all missing files
2318 add all new files, delete all missing files
2306 </td></tr>
2319 </td></tr>
2307 <tr><td>
2320 <tr><td>
2308 <a href="/help/archive">
2321 <a href="/help/archive">
2309 archive
2322 archive
2310 </a>
2323 </a>
2311 </td><td>
2324 </td><td>
2312 create an unversioned archive of a repository revision
2325 create an unversioned archive of a repository revision
2313 </td></tr>
2326 </td></tr>
2314 <tr><td>
2327 <tr><td>
2315 <a href="/help/backout">
2328 <a href="/help/backout">
2316 backout
2329 backout
2317 </a>
2330 </a>
2318 </td><td>
2331 </td><td>
2319 reverse effect of earlier changeset
2332 reverse effect of earlier changeset
2320 </td></tr>
2333 </td></tr>
2321 <tr><td>
2334 <tr><td>
2322 <a href="/help/bisect">
2335 <a href="/help/bisect">
2323 bisect
2336 bisect
2324 </a>
2337 </a>
2325 </td><td>
2338 </td><td>
2326 subdivision search of changesets
2339 subdivision search of changesets
2327 </td></tr>
2340 </td></tr>
2328 <tr><td>
2341 <tr><td>
2329 <a href="/help/bookmarks">
2342 <a href="/help/bookmarks">
2330 bookmarks
2343 bookmarks
2331 </a>
2344 </a>
2332 </td><td>
2345 </td><td>
2333 create a new bookmark or list existing bookmarks
2346 create a new bookmark or list existing bookmarks
2334 </td></tr>
2347 </td></tr>
2335 <tr><td>
2348 <tr><td>
2336 <a href="/help/branch">
2349 <a href="/help/branch">
2337 branch
2350 branch
2338 </a>
2351 </a>
2339 </td><td>
2352 </td><td>
2340 set or show the current branch name
2353 set or show the current branch name
2341 </td></tr>
2354 </td></tr>
2342 <tr><td>
2355 <tr><td>
2343 <a href="/help/branches">
2356 <a href="/help/branches">
2344 branches
2357 branches
2345 </a>
2358 </a>
2346 </td><td>
2359 </td><td>
2347 list repository named branches
2360 list repository named branches
2348 </td></tr>
2361 </td></tr>
2349 <tr><td>
2362 <tr><td>
2350 <a href="/help/bundle">
2363 <a href="/help/bundle">
2351 bundle
2364 bundle
2352 </a>
2365 </a>
2353 </td><td>
2366 </td><td>
2354 create a bundle file
2367 create a bundle file
2355 </td></tr>
2368 </td></tr>
2356 <tr><td>
2369 <tr><td>
2357 <a href="/help/cat">
2370 <a href="/help/cat">
2358 cat
2371 cat
2359 </a>
2372 </a>
2360 </td><td>
2373 </td><td>
2361 output the current or given revision of files
2374 output the current or given revision of files
2362 </td></tr>
2375 </td></tr>
2363 <tr><td>
2376 <tr><td>
2364 <a href="/help/config">
2377 <a href="/help/config">
2365 config
2378 config
2366 </a>
2379 </a>
2367 </td><td>
2380 </td><td>
2368 show combined config settings from all hgrc files
2381 show combined config settings from all hgrc files
2369 </td></tr>
2382 </td></tr>
2370 <tr><td>
2383 <tr><td>
2371 <a href="/help/copy">
2384 <a href="/help/copy">
2372 copy
2385 copy
2373 </a>
2386 </a>
2374 </td><td>
2387 </td><td>
2375 mark files as copied for the next commit
2388 mark files as copied for the next commit
2376 </td></tr>
2389 </td></tr>
2377 <tr><td>
2390 <tr><td>
2378 <a href="/help/files">
2391 <a href="/help/files">
2379 files
2392 files
2380 </a>
2393 </a>
2381 </td><td>
2394 </td><td>
2382 list tracked files
2395 list tracked files
2383 </td></tr>
2396 </td></tr>
2384 <tr><td>
2397 <tr><td>
2385 <a href="/help/graft">
2398 <a href="/help/graft">
2386 graft
2399 graft
2387 </a>
2400 </a>
2388 </td><td>
2401 </td><td>
2389 copy changes from other branches onto the current branch
2402 copy changes from other branches onto the current branch
2390 </td></tr>
2403 </td></tr>
2391 <tr><td>
2404 <tr><td>
2392 <a href="/help/grep">
2405 <a href="/help/grep">
2393 grep
2406 grep
2394 </a>
2407 </a>
2395 </td><td>
2408 </td><td>
2396 search revision history for a pattern in specified files
2409 search revision history for a pattern in specified files
2397 </td></tr>
2410 </td></tr>
2398 <tr><td>
2411 <tr><td>
2399 <a href="/help/heads">
2412 <a href="/help/heads">
2400 heads
2413 heads
2401 </a>
2414 </a>
2402 </td><td>
2415 </td><td>
2403 show branch heads
2416 show branch heads
2404 </td></tr>
2417 </td></tr>
2405 <tr><td>
2418 <tr><td>
2406 <a href="/help/help">
2419 <a href="/help/help">
2407 help
2420 help
2408 </a>
2421 </a>
2409 </td><td>
2422 </td><td>
2410 show help for a given topic or a help overview
2423 show help for a given topic or a help overview
2411 </td></tr>
2424 </td></tr>
2412 <tr><td>
2425 <tr><td>
2413 <a href="/help/hgalias">
2426 <a href="/help/hgalias">
2414 hgalias
2427 hgalias
2415 </a>
2428 </a>
2416 </td><td>
2429 </td><td>
2417 summarize working directory state
2430 summarize working directory state
2418 </td></tr>
2431 </td></tr>
2419 <tr><td>
2432 <tr><td>
2420 <a href="/help/identify">
2433 <a href="/help/identify">
2421 identify
2434 identify
2422 </a>
2435 </a>
2423 </td><td>
2436 </td><td>
2424 identify the working directory or specified revision
2437 identify the working directory or specified revision
2425 </td></tr>
2438 </td></tr>
2426 <tr><td>
2439 <tr><td>
2427 <a href="/help/import">
2440 <a href="/help/import">
2428 import
2441 import
2429 </a>
2442 </a>
2430 </td><td>
2443 </td><td>
2431 import an ordered set of patches
2444 import an ordered set of patches
2432 </td></tr>
2445 </td></tr>
2433 <tr><td>
2446 <tr><td>
2434 <a href="/help/incoming">
2447 <a href="/help/incoming">
2435 incoming
2448 incoming
2436 </a>
2449 </a>
2437 </td><td>
2450 </td><td>
2438 show new changesets found in source
2451 show new changesets found in source
2439 </td></tr>
2452 </td></tr>
2440 <tr><td>
2453 <tr><td>
2441 <a href="/help/manifest">
2454 <a href="/help/manifest">
2442 manifest
2455 manifest
2443 </a>
2456 </a>
2444 </td><td>
2457 </td><td>
2445 output the current or given revision of the project manifest
2458 output the current or given revision of the project manifest
2446 </td></tr>
2459 </td></tr>
2447 <tr><td>
2460 <tr><td>
2448 <a href="/help/nohelp">
2461 <a href="/help/nohelp">
2449 nohelp
2462 nohelp
2450 </a>
2463 </a>
2451 </td><td>
2464 </td><td>
2452 (no help text available)
2465 (no help text available)
2453 </td></tr>
2466 </td></tr>
2454 <tr><td>
2467 <tr><td>
2455 <a href="/help/outgoing">
2468 <a href="/help/outgoing">
2456 outgoing
2469 outgoing
2457 </a>
2470 </a>
2458 </td><td>
2471 </td><td>
2459 show changesets not found in the destination
2472 show changesets not found in the destination
2460 </td></tr>
2473 </td></tr>
2461 <tr><td>
2474 <tr><td>
2462 <a href="/help/paths">
2475 <a href="/help/paths">
2463 paths
2476 paths
2464 </a>
2477 </a>
2465 </td><td>
2478 </td><td>
2466 show aliases for remote repositories
2479 show aliases for remote repositories
2467 </td></tr>
2480 </td></tr>
2468 <tr><td>
2481 <tr><td>
2469 <a href="/help/phase">
2482 <a href="/help/phase">
2470 phase
2483 phase
2471 </a>
2484 </a>
2472 </td><td>
2485 </td><td>
2473 set or show the current phase name
2486 set or show the current phase name
2474 </td></tr>
2487 </td></tr>
2475 <tr><td>
2488 <tr><td>
2476 <a href="/help/recover">
2489 <a href="/help/recover">
2477 recover
2490 recover
2478 </a>
2491 </a>
2479 </td><td>
2492 </td><td>
2480 roll back an interrupted transaction
2493 roll back an interrupted transaction
2481 </td></tr>
2494 </td></tr>
2482 <tr><td>
2495 <tr><td>
2483 <a href="/help/rename">
2496 <a href="/help/rename">
2484 rename
2497 rename
2485 </a>
2498 </a>
2486 </td><td>
2499 </td><td>
2487 rename files; equivalent of copy + remove
2500 rename files; equivalent of copy + remove
2488 </td></tr>
2501 </td></tr>
2489 <tr><td>
2502 <tr><td>
2490 <a href="/help/resolve">
2503 <a href="/help/resolve">
2491 resolve
2504 resolve
2492 </a>
2505 </a>
2493 </td><td>
2506 </td><td>
2494 redo merges or set/view the merge status of files
2507 redo merges or set/view the merge status of files
2495 </td></tr>
2508 </td></tr>
2496 <tr><td>
2509 <tr><td>
2497 <a href="/help/revert">
2510 <a href="/help/revert">
2498 revert
2511 revert
2499 </a>
2512 </a>
2500 </td><td>
2513 </td><td>
2501 restore files to their checkout state
2514 restore files to their checkout state
2502 </td></tr>
2515 </td></tr>
2503 <tr><td>
2516 <tr><td>
2504 <a href="/help/root">
2517 <a href="/help/root">
2505 root
2518 root
2506 </a>
2519 </a>
2507 </td><td>
2520 </td><td>
2508 print the root (top) of the current working directory
2521 print the root (top) of the current working directory
2509 </td></tr>
2522 </td></tr>
2510 <tr><td>
2523 <tr><td>
2511 <a href="/help/shellalias">
2524 <a href="/help/shellalias">
2512 shellalias
2525 shellalias
2513 </a>
2526 </a>
2514 </td><td>
2527 </td><td>
2515 (no help text available)
2528 (no help text available)
2516 </td></tr>
2529 </td></tr>
2517 <tr><td>
2530 <tr><td>
2518 <a href="/help/tag">
2531 <a href="/help/tag">
2519 tag
2532 tag
2520 </a>
2533 </a>
2521 </td><td>
2534 </td><td>
2522 add one or more tags for the current or given revision
2535 add one or more tags for the current or given revision
2523 </td></tr>
2536 </td></tr>
2524 <tr><td>
2537 <tr><td>
2525 <a href="/help/tags">
2538 <a href="/help/tags">
2526 tags
2539 tags
2527 </a>
2540 </a>
2528 </td><td>
2541 </td><td>
2529 list repository tags
2542 list repository tags
2530 </td></tr>
2543 </td></tr>
2531 <tr><td>
2544 <tr><td>
2532 <a href="/help/unbundle">
2545 <a href="/help/unbundle">
2533 unbundle
2546 unbundle
2534 </a>
2547 </a>
2535 </td><td>
2548 </td><td>
2536 apply one or more bundle files
2549 apply one or more bundle files
2537 </td></tr>
2550 </td></tr>
2538 <tr><td>
2551 <tr><td>
2539 <a href="/help/verify">
2552 <a href="/help/verify">
2540 verify
2553 verify
2541 </a>
2554 </a>
2542 </td><td>
2555 </td><td>
2543 verify the integrity of the repository
2556 verify the integrity of the repository
2544 </td></tr>
2557 </td></tr>
2545 <tr><td>
2558 <tr><td>
2546 <a href="/help/version">
2559 <a href="/help/version">
2547 version
2560 version
2548 </a>
2561 </a>
2549 </td><td>
2562 </td><td>
2550 output version and copyright information
2563 output version and copyright information
2551 </td></tr>
2564 </td></tr>
2552
2565
2553
2566
2554 </table>
2567 </table>
2555 </div>
2568 </div>
2556 </div>
2569 </div>
2557
2570
2558
2571
2559
2572
2560 </body>
2573 </body>
2561 </html>
2574 </html>
2562
2575
2563
2576
2564 $ get-with-headers.py $LOCALIP:$HGPORT "help/add"
2577 $ get-with-headers.py $LOCALIP:$HGPORT "help/add"
2565 200 Script output follows
2578 200 Script output follows
2566
2579
2567 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2580 <!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">
2581 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2569 <head>
2582 <head>
2570 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2583 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2571 <meta name="robots" content="index, nofollow" />
2584 <meta name="robots" content="index, nofollow" />
2572 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2585 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2573 <script type="text/javascript" src="/static/mercurial.js"></script>
2586 <script type="text/javascript" src="/static/mercurial.js"></script>
2574
2587
2575 <title>Help: add</title>
2588 <title>Help: add</title>
2576 </head>
2589 </head>
2577 <body>
2590 <body>
2578
2591
2579 <div class="container">
2592 <div class="container">
2580 <div class="menu">
2593 <div class="menu">
2581 <div class="logo">
2594 <div class="logo">
2582 <a href="https://mercurial-scm.org/">
2595 <a href="https://mercurial-scm.org/">
2583 <img src="/static/hglogo.png" alt="mercurial" /></a>
2596 <img src="/static/hglogo.png" alt="mercurial" /></a>
2584 </div>
2597 </div>
2585 <ul>
2598 <ul>
2586 <li><a href="/shortlog">log</a></li>
2599 <li><a href="/shortlog">log</a></li>
2587 <li><a href="/graph">graph</a></li>
2600 <li><a href="/graph">graph</a></li>
2588 <li><a href="/tags">tags</a></li>
2601 <li><a href="/tags">tags</a></li>
2589 <li><a href="/bookmarks">bookmarks</a></li>
2602 <li><a href="/bookmarks">bookmarks</a></li>
2590 <li><a href="/branches">branches</a></li>
2603 <li><a href="/branches">branches</a></li>
2591 </ul>
2604 </ul>
2592 <ul>
2605 <ul>
2593 <li class="active"><a href="/help">help</a></li>
2606 <li class="active"><a href="/help">help</a></li>
2594 </ul>
2607 </ul>
2595 </div>
2608 </div>
2596
2609
2597 <div class="main">
2610 <div class="main">
2598 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2611 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2599 <h3>Help: add</h3>
2612 <h3>Help: add</h3>
2600
2613
2601 <form class="search" action="/log">
2614 <form class="search" action="/log">
2602
2615
2603 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2616 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2604 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2617 <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>
2618 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2606 </form>
2619 </form>
2607 <div id="doc">
2620 <div id="doc">
2608 <p>
2621 <p>
2609 hg add [OPTION]... [FILE]...
2622 hg add [OPTION]... [FILE]...
2610 </p>
2623 </p>
2611 <p>
2624 <p>
2612 add the specified files on the next commit
2625 add the specified files on the next commit
2613 </p>
2626 </p>
2614 <p>
2627 <p>
2615 Schedule files to be version controlled and added to the
2628 Schedule files to be version controlled and added to the
2616 repository.
2629 repository.
2617 </p>
2630 </p>
2618 <p>
2631 <p>
2619 The files will be added to the repository at the next commit. To
2632 The files will be added to the repository at the next commit. To
2620 undo an add before that, see 'hg forget'.
2633 undo an add before that, see 'hg forget'.
2621 </p>
2634 </p>
2622 <p>
2635 <p>
2623 If no names are given, add all files to the repository (except
2636 If no names are given, add all files to the repository (except
2624 files matching &quot;.hgignore&quot;).
2637 files matching &quot;.hgignore&quot;).
2625 </p>
2638 </p>
2626 <p>
2639 <p>
2627 Examples:
2640 Examples:
2628 </p>
2641 </p>
2629 <ul>
2642 <ul>
2630 <li> New (unknown) files are added automatically by 'hg add':
2643 <li> New (unknown) files are added automatically by 'hg add':
2631 <pre>
2644 <pre>
2632 \$ ls (re)
2645 \$ ls (re)
2633 foo.c
2646 foo.c
2634 \$ hg status (re)
2647 \$ hg status (re)
2635 ? foo.c
2648 ? foo.c
2636 \$ hg add (re)
2649 \$ hg add (re)
2637 adding foo.c
2650 adding foo.c
2638 \$ hg status (re)
2651 \$ hg status (re)
2639 A foo.c
2652 A foo.c
2640 </pre>
2653 </pre>
2641 <li> Specific files to be added can be specified:
2654 <li> Specific files to be added can be specified:
2642 <pre>
2655 <pre>
2643 \$ ls (re)
2656 \$ ls (re)
2644 bar.c foo.c
2657 bar.c foo.c
2645 \$ hg status (re)
2658 \$ hg status (re)
2646 ? bar.c
2659 ? bar.c
2647 ? foo.c
2660 ? foo.c
2648 \$ hg add bar.c (re)
2661 \$ hg add bar.c (re)
2649 \$ hg status (re)
2662 \$ hg status (re)
2650 A bar.c
2663 A bar.c
2651 ? foo.c
2664 ? foo.c
2652 </pre>
2665 </pre>
2653 </ul>
2666 </ul>
2654 <p>
2667 <p>
2655 Returns 0 if all files are successfully added.
2668 Returns 0 if all files are successfully added.
2656 </p>
2669 </p>
2657 <p>
2670 <p>
2658 options ([+] can be repeated):
2671 options ([+] can be repeated):
2659 </p>
2672 </p>
2660 <table>
2673 <table>
2661 <tr><td>-I</td>
2674 <tr><td>-I</td>
2662 <td>--include PATTERN [+]</td>
2675 <td>--include PATTERN [+]</td>
2663 <td>include names matching the given patterns</td></tr>
2676 <td>include names matching the given patterns</td></tr>
2664 <tr><td>-X</td>
2677 <tr><td>-X</td>
2665 <td>--exclude PATTERN [+]</td>
2678 <td>--exclude PATTERN [+]</td>
2666 <td>exclude names matching the given patterns</td></tr>
2679 <td>exclude names matching the given patterns</td></tr>
2667 <tr><td>-S</td>
2680 <tr><td>-S</td>
2668 <td>--subrepos</td>
2681 <td>--subrepos</td>
2669 <td>recurse into subrepositories</td></tr>
2682 <td>recurse into subrepositories</td></tr>
2670 <tr><td>-n</td>
2683 <tr><td>-n</td>
2671 <td>--dry-run</td>
2684 <td>--dry-run</td>
2672 <td>do not perform actions, just print output</td></tr>
2685 <td>do not perform actions, just print output</td></tr>
2673 </table>
2686 </table>
2674 <p>
2687 <p>
2675 global options ([+] can be repeated):
2688 global options ([+] can be repeated):
2676 </p>
2689 </p>
2677 <table>
2690 <table>
2678 <tr><td>-R</td>
2691 <tr><td>-R</td>
2679 <td>--repository REPO</td>
2692 <td>--repository REPO</td>
2680 <td>repository root directory or name of overlay bundle file</td></tr>
2693 <td>repository root directory or name of overlay bundle file</td></tr>
2681 <tr><td></td>
2694 <tr><td></td>
2682 <td>--cwd DIR</td>
2695 <td>--cwd DIR</td>
2683 <td>change working directory</td></tr>
2696 <td>change working directory</td></tr>
2684 <tr><td>-y</td>
2697 <tr><td>-y</td>
2685 <td>--noninteractive</td>
2698 <td>--noninteractive</td>
2686 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2699 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2687 <tr><td>-q</td>
2700 <tr><td>-q</td>
2688 <td>--quiet</td>
2701 <td>--quiet</td>
2689 <td>suppress output</td></tr>
2702 <td>suppress output</td></tr>
2690 <tr><td>-v</td>
2703 <tr><td>-v</td>
2691 <td>--verbose</td>
2704 <td>--verbose</td>
2692 <td>enable additional output</td></tr>
2705 <td>enable additional output</td></tr>
2693 <tr><td></td>
2706 <tr><td></td>
2694 <td>--color TYPE</td>
2707 <td>--color TYPE</td>
2695 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2708 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2696 <tr><td></td>
2709 <tr><td></td>
2697 <td>--config CONFIG [+]</td>
2710 <td>--config CONFIG [+]</td>
2698 <td>set/override config option (use 'section.name=value')</td></tr>
2711 <td>set/override config option (use 'section.name=value')</td></tr>
2699 <tr><td></td>
2712 <tr><td></td>
2700 <td>--debug</td>
2713 <td>--debug</td>
2701 <td>enable debugging output</td></tr>
2714 <td>enable debugging output</td></tr>
2702 <tr><td></td>
2715 <tr><td></td>
2703 <td>--debugger</td>
2716 <td>--debugger</td>
2704 <td>start debugger</td></tr>
2717 <td>start debugger</td></tr>
2705 <tr><td></td>
2718 <tr><td></td>
2706 <td>--encoding ENCODE</td>
2719 <td>--encoding ENCODE</td>
2707 <td>set the charset encoding (default: ascii)</td></tr>
2720 <td>set the charset encoding (default: ascii)</td></tr>
2708 <tr><td></td>
2721 <tr><td></td>
2709 <td>--encodingmode MODE</td>
2722 <td>--encodingmode MODE</td>
2710 <td>set the charset encoding mode (default: strict)</td></tr>
2723 <td>set the charset encoding mode (default: strict)</td></tr>
2711 <tr><td></td>
2724 <tr><td></td>
2712 <td>--traceback</td>
2725 <td>--traceback</td>
2713 <td>always print a traceback on exception</td></tr>
2726 <td>always print a traceback on exception</td></tr>
2714 <tr><td></td>
2727 <tr><td></td>
2715 <td>--time</td>
2728 <td>--time</td>
2716 <td>time how long the command takes</td></tr>
2729 <td>time how long the command takes</td></tr>
2717 <tr><td></td>
2730 <tr><td></td>
2718 <td>--profile</td>
2731 <td>--profile</td>
2719 <td>print command execution profile</td></tr>
2732 <td>print command execution profile</td></tr>
2720 <tr><td></td>
2733 <tr><td></td>
2721 <td>--version</td>
2734 <td>--version</td>
2722 <td>output version information and exit</td></tr>
2735 <td>output version information and exit</td></tr>
2723 <tr><td>-h</td>
2736 <tr><td>-h</td>
2724 <td>--help</td>
2737 <td>--help</td>
2725 <td>display help and exit</td></tr>
2738 <td>display help and exit</td></tr>
2726 <tr><td></td>
2739 <tr><td></td>
2727 <td>--hidden</td>
2740 <td>--hidden</td>
2728 <td>consider hidden changesets</td></tr>
2741 <td>consider hidden changesets</td></tr>
2729 <tr><td></td>
2742 <tr><td></td>
2730 <td>--pager TYPE</td>
2743 <td>--pager TYPE</td>
2731 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2744 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2732 </table>
2745 </table>
2733
2746
2734 </div>
2747 </div>
2735 </div>
2748 </div>
2736 </div>
2749 </div>
2737
2750
2738
2751
2739
2752
2740 </body>
2753 </body>
2741 </html>
2754 </html>
2742
2755
2743
2756
2744 $ get-with-headers.py $LOCALIP:$HGPORT "help/remove"
2757 $ get-with-headers.py $LOCALIP:$HGPORT "help/remove"
2745 200 Script output follows
2758 200 Script output follows
2746
2759
2747 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2760 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2748 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2761 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2749 <head>
2762 <head>
2750 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2763 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2751 <meta name="robots" content="index, nofollow" />
2764 <meta name="robots" content="index, nofollow" />
2752 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2765 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2753 <script type="text/javascript" src="/static/mercurial.js"></script>
2766 <script type="text/javascript" src="/static/mercurial.js"></script>
2754
2767
2755 <title>Help: remove</title>
2768 <title>Help: remove</title>
2756 </head>
2769 </head>
2757 <body>
2770 <body>
2758
2771
2759 <div class="container">
2772 <div class="container">
2760 <div class="menu">
2773 <div class="menu">
2761 <div class="logo">
2774 <div class="logo">
2762 <a href="https://mercurial-scm.org/">
2775 <a href="https://mercurial-scm.org/">
2763 <img src="/static/hglogo.png" alt="mercurial" /></a>
2776 <img src="/static/hglogo.png" alt="mercurial" /></a>
2764 </div>
2777 </div>
2765 <ul>
2778 <ul>
2766 <li><a href="/shortlog">log</a></li>
2779 <li><a href="/shortlog">log</a></li>
2767 <li><a href="/graph">graph</a></li>
2780 <li><a href="/graph">graph</a></li>
2768 <li><a href="/tags">tags</a></li>
2781 <li><a href="/tags">tags</a></li>
2769 <li><a href="/bookmarks">bookmarks</a></li>
2782 <li><a href="/bookmarks">bookmarks</a></li>
2770 <li><a href="/branches">branches</a></li>
2783 <li><a href="/branches">branches</a></li>
2771 </ul>
2784 </ul>
2772 <ul>
2785 <ul>
2773 <li class="active"><a href="/help">help</a></li>
2786 <li class="active"><a href="/help">help</a></li>
2774 </ul>
2787 </ul>
2775 </div>
2788 </div>
2776
2789
2777 <div class="main">
2790 <div class="main">
2778 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2791 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2779 <h3>Help: remove</h3>
2792 <h3>Help: remove</h3>
2780
2793
2781 <form class="search" action="/log">
2794 <form class="search" action="/log">
2782
2795
2783 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2796 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2784 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2797 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2785 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2798 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2786 </form>
2799 </form>
2787 <div id="doc">
2800 <div id="doc">
2788 <p>
2801 <p>
2789 hg remove [OPTION]... FILE...
2802 hg remove [OPTION]... FILE...
2790 </p>
2803 </p>
2791 <p>
2804 <p>
2792 aliases: rm
2805 aliases: rm
2793 </p>
2806 </p>
2794 <p>
2807 <p>
2795 remove the specified files on the next commit
2808 remove the specified files on the next commit
2796 </p>
2809 </p>
2797 <p>
2810 <p>
2798 Schedule the indicated files for removal from the current branch.
2811 Schedule the indicated files for removal from the current branch.
2799 </p>
2812 </p>
2800 <p>
2813 <p>
2801 This command schedules the files to be removed at the next commit.
2814 This command schedules the files to be removed at the next commit.
2802 To undo a remove before that, see 'hg revert'. To undo added
2815 To undo a remove before that, see 'hg revert'. To undo added
2803 files, see 'hg forget'.
2816 files, see 'hg forget'.
2804 </p>
2817 </p>
2805 <p>
2818 <p>
2806 -A/--after can be used to remove only files that have already
2819 -A/--after can be used to remove only files that have already
2807 been deleted, -f/--force can be used to force deletion, and -Af
2820 been deleted, -f/--force can be used to force deletion, and -Af
2808 can be used to remove files from the next revision without
2821 can be used to remove files from the next revision without
2809 deleting them from the working directory.
2822 deleting them from the working directory.
2810 </p>
2823 </p>
2811 <p>
2824 <p>
2812 The following table details the behavior of remove for different
2825 The following table details the behavior of remove for different
2813 file states (columns) and option combinations (rows). The file
2826 file states (columns) and option combinations (rows). The file
2814 states are Added [A], Clean [C], Modified [M] and Missing [!]
2827 states are Added [A], Clean [C], Modified [M] and Missing [!]
2815 (as reported by 'hg status'). The actions are Warn, Remove
2828 (as reported by 'hg status'). The actions are Warn, Remove
2816 (from branch) and Delete (from disk):
2829 (from branch) and Delete (from disk):
2817 </p>
2830 </p>
2818 <table>
2831 <table>
2819 <tr><td>opt/state</td>
2832 <tr><td>opt/state</td>
2820 <td>A</td>
2833 <td>A</td>
2821 <td>C</td>
2834 <td>C</td>
2822 <td>M</td>
2835 <td>M</td>
2823 <td>!</td></tr>
2836 <td>!</td></tr>
2824 <tr><td>none</td>
2837 <tr><td>none</td>
2825 <td>W</td>
2838 <td>W</td>
2826 <td>RD</td>
2839 <td>RD</td>
2827 <td>W</td>
2840 <td>W</td>
2828 <td>R</td></tr>
2841 <td>R</td></tr>
2829 <tr><td>-f</td>
2842 <tr><td>-f</td>
2830 <td>R</td>
2843 <td>R</td>
2831 <td>RD</td>
2844 <td>RD</td>
2832 <td>RD</td>
2845 <td>RD</td>
2833 <td>R</td></tr>
2846 <td>R</td></tr>
2834 <tr><td>-A</td>
2847 <tr><td>-A</td>
2835 <td>W</td>
2848 <td>W</td>
2836 <td>W</td>
2849 <td>W</td>
2837 <td>W</td>
2850 <td>W</td>
2838 <td>R</td></tr>
2851 <td>R</td></tr>
2839 <tr><td>-Af</td>
2852 <tr><td>-Af</td>
2840 <td>R</td>
2853 <td>R</td>
2841 <td>R</td>
2854 <td>R</td>
2842 <td>R</td>
2855 <td>R</td>
2843 <td>R</td></tr>
2856 <td>R</td></tr>
2844 </table>
2857 </table>
2845 <p>
2858 <p>
2846 <b>Note:</b>
2859 <b>Note:</b>
2847 </p>
2860 </p>
2848 <p>
2861 <p>
2849 'hg remove' never deletes files in Added [A] state from the
2862 'hg remove' never deletes files in Added [A] state from the
2850 working directory, not even if &quot;--force&quot; is specified.
2863 working directory, not even if &quot;--force&quot; is specified.
2851 </p>
2864 </p>
2852 <p>
2865 <p>
2853 Returns 0 on success, 1 if any warnings encountered.
2866 Returns 0 on success, 1 if any warnings encountered.
2854 </p>
2867 </p>
2855 <p>
2868 <p>
2856 options ([+] can be repeated):
2869 options ([+] can be repeated):
2857 </p>
2870 </p>
2858 <table>
2871 <table>
2859 <tr><td>-A</td>
2872 <tr><td>-A</td>
2860 <td>--after</td>
2873 <td>--after</td>
2861 <td>record delete for missing files</td></tr>
2874 <td>record delete for missing files</td></tr>
2862 <tr><td>-f</td>
2875 <tr><td>-f</td>
2863 <td>--force</td>
2876 <td>--force</td>
2864 <td>forget added files, delete modified files</td></tr>
2877 <td>forget added files, delete modified files</td></tr>
2865 <tr><td>-S</td>
2878 <tr><td>-S</td>
2866 <td>--subrepos</td>
2879 <td>--subrepos</td>
2867 <td>recurse into subrepositories</td></tr>
2880 <td>recurse into subrepositories</td></tr>
2868 <tr><td>-I</td>
2881 <tr><td>-I</td>
2869 <td>--include PATTERN [+]</td>
2882 <td>--include PATTERN [+]</td>
2870 <td>include names matching the given patterns</td></tr>
2883 <td>include names matching the given patterns</td></tr>
2871 <tr><td>-X</td>
2884 <tr><td>-X</td>
2872 <td>--exclude PATTERN [+]</td>
2885 <td>--exclude PATTERN [+]</td>
2873 <td>exclude names matching the given patterns</td></tr>
2886 <td>exclude names matching the given patterns</td></tr>
2874 <tr><td>-n</td>
2887 <tr><td>-n</td>
2875 <td>--dry-run</td>
2888 <td>--dry-run</td>
2876 <td>do not perform actions, just print output</td></tr>
2889 <td>do not perform actions, just print output</td></tr>
2877 </table>
2890 </table>
2878 <p>
2891 <p>
2879 global options ([+] can be repeated):
2892 global options ([+] can be repeated):
2880 </p>
2893 </p>
2881 <table>
2894 <table>
2882 <tr><td>-R</td>
2895 <tr><td>-R</td>
2883 <td>--repository REPO</td>
2896 <td>--repository REPO</td>
2884 <td>repository root directory or name of overlay bundle file</td></tr>
2897 <td>repository root directory or name of overlay bundle file</td></tr>
2885 <tr><td></td>
2898 <tr><td></td>
2886 <td>--cwd DIR</td>
2899 <td>--cwd DIR</td>
2887 <td>change working directory</td></tr>
2900 <td>change working directory</td></tr>
2888 <tr><td>-y</td>
2901 <tr><td>-y</td>
2889 <td>--noninteractive</td>
2902 <td>--noninteractive</td>
2890 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2903 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2891 <tr><td>-q</td>
2904 <tr><td>-q</td>
2892 <td>--quiet</td>
2905 <td>--quiet</td>
2893 <td>suppress output</td></tr>
2906 <td>suppress output</td></tr>
2894 <tr><td>-v</td>
2907 <tr><td>-v</td>
2895 <td>--verbose</td>
2908 <td>--verbose</td>
2896 <td>enable additional output</td></tr>
2909 <td>enable additional output</td></tr>
2897 <tr><td></td>
2910 <tr><td></td>
2898 <td>--color TYPE</td>
2911 <td>--color TYPE</td>
2899 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2912 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2900 <tr><td></td>
2913 <tr><td></td>
2901 <td>--config CONFIG [+]</td>
2914 <td>--config CONFIG [+]</td>
2902 <td>set/override config option (use 'section.name=value')</td></tr>
2915 <td>set/override config option (use 'section.name=value')</td></tr>
2903 <tr><td></td>
2916 <tr><td></td>
2904 <td>--debug</td>
2917 <td>--debug</td>
2905 <td>enable debugging output</td></tr>
2918 <td>enable debugging output</td></tr>
2906 <tr><td></td>
2919 <tr><td></td>
2907 <td>--debugger</td>
2920 <td>--debugger</td>
2908 <td>start debugger</td></tr>
2921 <td>start debugger</td></tr>
2909 <tr><td></td>
2922 <tr><td></td>
2910 <td>--encoding ENCODE</td>
2923 <td>--encoding ENCODE</td>
2911 <td>set the charset encoding (default: ascii)</td></tr>
2924 <td>set the charset encoding (default: ascii)</td></tr>
2912 <tr><td></td>
2925 <tr><td></td>
2913 <td>--encodingmode MODE</td>
2926 <td>--encodingmode MODE</td>
2914 <td>set the charset encoding mode (default: strict)</td></tr>
2927 <td>set the charset encoding mode (default: strict)</td></tr>
2915 <tr><td></td>
2928 <tr><td></td>
2916 <td>--traceback</td>
2929 <td>--traceback</td>
2917 <td>always print a traceback on exception</td></tr>
2930 <td>always print a traceback on exception</td></tr>
2918 <tr><td></td>
2931 <tr><td></td>
2919 <td>--time</td>
2932 <td>--time</td>
2920 <td>time how long the command takes</td></tr>
2933 <td>time how long the command takes</td></tr>
2921 <tr><td></td>
2934 <tr><td></td>
2922 <td>--profile</td>
2935 <td>--profile</td>
2923 <td>print command execution profile</td></tr>
2936 <td>print command execution profile</td></tr>
2924 <tr><td></td>
2937 <tr><td></td>
2925 <td>--version</td>
2938 <td>--version</td>
2926 <td>output version information and exit</td></tr>
2939 <td>output version information and exit</td></tr>
2927 <tr><td>-h</td>
2940 <tr><td>-h</td>
2928 <td>--help</td>
2941 <td>--help</td>
2929 <td>display help and exit</td></tr>
2942 <td>display help and exit</td></tr>
2930 <tr><td></td>
2943 <tr><td></td>
2931 <td>--hidden</td>
2944 <td>--hidden</td>
2932 <td>consider hidden changesets</td></tr>
2945 <td>consider hidden changesets</td></tr>
2933 <tr><td></td>
2946 <tr><td></td>
2934 <td>--pager TYPE</td>
2947 <td>--pager TYPE</td>
2935 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2948 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2936 </table>
2949 </table>
2937
2950
2938 </div>
2951 </div>
2939 </div>
2952 </div>
2940 </div>
2953 </div>
2941
2954
2942
2955
2943
2956
2944 </body>
2957 </body>
2945 </html>
2958 </html>
2946
2959
2947
2960
2948 $ get-with-headers.py $LOCALIP:$HGPORT "help/dates"
2961 $ get-with-headers.py $LOCALIP:$HGPORT "help/dates"
2949 200 Script output follows
2962 200 Script output follows
2950
2963
2951 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2964 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2952 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2965 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2953 <head>
2966 <head>
2954 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2967 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2955 <meta name="robots" content="index, nofollow" />
2968 <meta name="robots" content="index, nofollow" />
2956 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2969 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2957 <script type="text/javascript" src="/static/mercurial.js"></script>
2970 <script type="text/javascript" src="/static/mercurial.js"></script>
2958
2971
2959 <title>Help: dates</title>
2972 <title>Help: dates</title>
2960 </head>
2973 </head>
2961 <body>
2974 <body>
2962
2975
2963 <div class="container">
2976 <div class="container">
2964 <div class="menu">
2977 <div class="menu">
2965 <div class="logo">
2978 <div class="logo">
2966 <a href="https://mercurial-scm.org/">
2979 <a href="https://mercurial-scm.org/">
2967 <img src="/static/hglogo.png" alt="mercurial" /></a>
2980 <img src="/static/hglogo.png" alt="mercurial" /></a>
2968 </div>
2981 </div>
2969 <ul>
2982 <ul>
2970 <li><a href="/shortlog">log</a></li>
2983 <li><a href="/shortlog">log</a></li>
2971 <li><a href="/graph">graph</a></li>
2984 <li><a href="/graph">graph</a></li>
2972 <li><a href="/tags">tags</a></li>
2985 <li><a href="/tags">tags</a></li>
2973 <li><a href="/bookmarks">bookmarks</a></li>
2986 <li><a href="/bookmarks">bookmarks</a></li>
2974 <li><a href="/branches">branches</a></li>
2987 <li><a href="/branches">branches</a></li>
2975 </ul>
2988 </ul>
2976 <ul>
2989 <ul>
2977 <li class="active"><a href="/help">help</a></li>
2990 <li class="active"><a href="/help">help</a></li>
2978 </ul>
2991 </ul>
2979 </div>
2992 </div>
2980
2993
2981 <div class="main">
2994 <div class="main">
2982 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2995 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2983 <h3>Help: dates</h3>
2996 <h3>Help: dates</h3>
2984
2997
2985 <form class="search" action="/log">
2998 <form class="search" action="/log">
2986
2999
2987 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3000 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2988 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3001 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2989 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3002 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2990 </form>
3003 </form>
2991 <div id="doc">
3004 <div id="doc">
2992 <h1>Date Formats</h1>
3005 <h1>Date Formats</h1>
2993 <p>
3006 <p>
2994 Some commands allow the user to specify a date, e.g.:
3007 Some commands allow the user to specify a date, e.g.:
2995 </p>
3008 </p>
2996 <ul>
3009 <ul>
2997 <li> backout, commit, import, tag: Specify the commit date.
3010 <li> backout, commit, import, tag: Specify the commit date.
2998 <li> log, revert, update: Select revision(s) by date.
3011 <li> log, revert, update: Select revision(s) by date.
2999 </ul>
3012 </ul>
3000 <p>
3013 <p>
3001 Many date formats are valid. Here are some examples:
3014 Many date formats are valid. Here are some examples:
3002 </p>
3015 </p>
3003 <ul>
3016 <ul>
3004 <li> &quot;Wed Dec 6 13:18:29 2006&quot; (local timezone assumed)
3017 <li> &quot;Wed Dec 6 13:18:29 2006&quot; (local timezone assumed)
3005 <li> &quot;Dec 6 13:18 -0600&quot; (year assumed, time offset provided)
3018 <li> &quot;Dec 6 13:18 -0600&quot; (year assumed, time offset provided)
3006 <li> &quot;Dec 6 13:18 UTC&quot; (UTC and GMT are aliases for +0000)
3019 <li> &quot;Dec 6 13:18 UTC&quot; (UTC and GMT are aliases for +0000)
3007 <li> &quot;Dec 6&quot; (midnight)
3020 <li> &quot;Dec 6&quot; (midnight)
3008 <li> &quot;13:18&quot; (today assumed)
3021 <li> &quot;13:18&quot; (today assumed)
3009 <li> &quot;3:39&quot; (3:39AM assumed)
3022 <li> &quot;3:39&quot; (3:39AM assumed)
3010 <li> &quot;3:39pm&quot; (15:39)
3023 <li> &quot;3:39pm&quot; (15:39)
3011 <li> &quot;2006-12-06 13:18:29&quot; (ISO 8601 format)
3024 <li> &quot;2006-12-06 13:18:29&quot; (ISO 8601 format)
3012 <li> &quot;2006-12-6 13:18&quot;
3025 <li> &quot;2006-12-6 13:18&quot;
3013 <li> &quot;2006-12-6&quot;
3026 <li> &quot;2006-12-6&quot;
3014 <li> &quot;12-6&quot;
3027 <li> &quot;12-6&quot;
3015 <li> &quot;12/6&quot;
3028 <li> &quot;12/6&quot;
3016 <li> &quot;12/6/6&quot; (Dec 6 2006)
3029 <li> &quot;12/6/6&quot; (Dec 6 2006)
3017 <li> &quot;today&quot; (midnight)
3030 <li> &quot;today&quot; (midnight)
3018 <li> &quot;yesterday&quot; (midnight)
3031 <li> &quot;yesterday&quot; (midnight)
3019 <li> &quot;now&quot; - right now
3032 <li> &quot;now&quot; - right now
3020 </ul>
3033 </ul>
3021 <p>
3034 <p>
3022 Lastly, there is Mercurial's internal format:
3035 Lastly, there is Mercurial's internal format:
3023 </p>
3036 </p>
3024 <ul>
3037 <ul>
3025 <li> &quot;1165411109 0&quot; (Wed Dec 6 13:18:29 2006 UTC)
3038 <li> &quot;1165411109 0&quot; (Wed Dec 6 13:18:29 2006 UTC)
3026 </ul>
3039 </ul>
3027 <p>
3040 <p>
3028 This is the internal representation format for dates. The first number
3041 This is the internal representation format for dates. The first number
3029 is the number of seconds since the epoch (1970-01-01 00:00 UTC). The
3042 is the number of seconds since the epoch (1970-01-01 00:00 UTC). The
3030 second is the offset of the local timezone, in seconds west of UTC
3043 second is the offset of the local timezone, in seconds west of UTC
3031 (negative if the timezone is east of UTC).
3044 (negative if the timezone is east of UTC).
3032 </p>
3045 </p>
3033 <p>
3046 <p>
3034 The log command also accepts date ranges:
3047 The log command also accepts date ranges:
3035 </p>
3048 </p>
3036 <ul>
3049 <ul>
3037 <li> &quot;&lt;DATE&quot; - at or before a given date/time
3050 <li> &quot;&lt;DATE&quot; - at or before a given date/time
3038 <li> &quot;&gt;DATE&quot; - on or after a given date/time
3051 <li> &quot;&gt;DATE&quot; - on or after a given date/time
3039 <li> &quot;DATE to DATE&quot; - a date range, inclusive
3052 <li> &quot;DATE to DATE&quot; - a date range, inclusive
3040 <li> &quot;-DAYS&quot; - within a given number of days of today
3053 <li> &quot;-DAYS&quot; - within a given number of days of today
3041 </ul>
3054 </ul>
3042
3055
3043 </div>
3056 </div>
3044 </div>
3057 </div>
3045 </div>
3058 </div>
3046
3059
3047
3060
3048
3061
3049 </body>
3062 </body>
3050 </html>
3063 </html>
3051
3064
3052
3065
3053 $ get-with-headers.py $LOCALIP:$HGPORT "help/pager"
3066 $ get-with-headers.py $LOCALIP:$HGPORT "help/pager"
3054 200 Script output follows
3067 200 Script output follows
3055
3068
3056 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3069 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3057 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3070 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3058 <head>
3071 <head>
3059 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3072 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3060 <meta name="robots" content="index, nofollow" />
3073 <meta name="robots" content="index, nofollow" />
3061 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3074 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3062 <script type="text/javascript" src="/static/mercurial.js"></script>
3075 <script type="text/javascript" src="/static/mercurial.js"></script>
3063
3076
3064 <title>Help: pager</title>
3077 <title>Help: pager</title>
3065 </head>
3078 </head>
3066 <body>
3079 <body>
3067
3080
3068 <div class="container">
3081 <div class="container">
3069 <div class="menu">
3082 <div class="menu">
3070 <div class="logo">
3083 <div class="logo">
3071 <a href="https://mercurial-scm.org/">
3084 <a href="https://mercurial-scm.org/">
3072 <img src="/static/hglogo.png" alt="mercurial" /></a>
3085 <img src="/static/hglogo.png" alt="mercurial" /></a>
3073 </div>
3086 </div>
3074 <ul>
3087 <ul>
3075 <li><a href="/shortlog">log</a></li>
3088 <li><a href="/shortlog">log</a></li>
3076 <li><a href="/graph">graph</a></li>
3089 <li><a href="/graph">graph</a></li>
3077 <li><a href="/tags">tags</a></li>
3090 <li><a href="/tags">tags</a></li>
3078 <li><a href="/bookmarks">bookmarks</a></li>
3091 <li><a href="/bookmarks">bookmarks</a></li>
3079 <li><a href="/branches">branches</a></li>
3092 <li><a href="/branches">branches</a></li>
3080 </ul>
3093 </ul>
3081 <ul>
3094 <ul>
3082 <li class="active"><a href="/help">help</a></li>
3095 <li class="active"><a href="/help">help</a></li>
3083 </ul>
3096 </ul>
3084 </div>
3097 </div>
3085
3098
3086 <div class="main">
3099 <div class="main">
3087 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3100 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3088 <h3>Help: pager</h3>
3101 <h3>Help: pager</h3>
3089
3102
3090 <form class="search" action="/log">
3103 <form class="search" action="/log">
3091
3104
3092 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3105 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3093 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3106 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3094 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3107 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3095 </form>
3108 </form>
3096 <div id="doc">
3109 <div id="doc">
3097 <h1>Pager Support</h1>
3110 <h1>Pager Support</h1>
3098 <p>
3111 <p>
3099 Some Mercurial commands can produce a lot of output, and Mercurial will
3112 Some Mercurial commands can produce a lot of output, and Mercurial will
3100 attempt to use a pager to make those commands more pleasant.
3113 attempt to use a pager to make those commands more pleasant.
3101 </p>
3114 </p>
3102 <p>
3115 <p>
3103 To set the pager that should be used, set the application variable:
3116 To set the pager that should be used, set the application variable:
3104 </p>
3117 </p>
3105 <pre>
3118 <pre>
3106 [pager]
3119 [pager]
3107 pager = less -FRX
3120 pager = less -FRX
3108 </pre>
3121 </pre>
3109 <p>
3122 <p>
3110 If no pager is set in the user or repository configuration, Mercurial uses the
3123 If no pager is set in the user or repository configuration, Mercurial uses the
3111 environment variable $PAGER. If $PAGER is not set, pager.pager from the default
3124 environment variable $PAGER. If $PAGER is not set, pager.pager from the default
3112 or system configuration is used. If none of these are set, a default pager will
3125 or system configuration is used. If none of these are set, a default pager will
3113 be used, typically 'less' on Unix and 'more' on Windows.
3126 be used, typically 'less' on Unix and 'more' on Windows.
3114 </p>
3127 </p>
3115 <p>
3128 <p>
3116 You can disable the pager for certain commands by adding them to the
3129 You can disable the pager for certain commands by adding them to the
3117 pager.ignore list:
3130 pager.ignore list:
3118 </p>
3131 </p>
3119 <pre>
3132 <pre>
3120 [pager]
3133 [pager]
3121 ignore = version, help, update
3134 ignore = version, help, update
3122 </pre>
3135 </pre>
3123 <p>
3136 <p>
3124 To ignore global commands like 'hg version' or 'hg help', you have
3137 To ignore global commands like 'hg version' or 'hg help', you have
3125 to specify them in your user configuration file.
3138 to specify them in your user configuration file.
3126 </p>
3139 </p>
3127 <p>
3140 <p>
3128 To control whether the pager is used at all for an individual command,
3141 To control whether the pager is used at all for an individual command,
3129 you can use --pager=&lt;value&gt;:
3142 you can use --pager=&lt;value&gt;:
3130 </p>
3143 </p>
3131 <ul>
3144 <ul>
3132 <li> use as needed: 'auto'.
3145 <li> use as needed: 'auto'.
3133 <li> require the pager: 'yes' or 'on'.
3146 <li> require the pager: 'yes' or 'on'.
3134 <li> suppress the pager: 'no' or 'off' (any unrecognized value will also work).
3147 <li> suppress the pager: 'no' or 'off' (any unrecognized value will also work).
3135 </ul>
3148 </ul>
3136 <p>
3149 <p>
3137 To globally turn off all attempts to use a pager, set:
3150 To globally turn off all attempts to use a pager, set:
3138 </p>
3151 </p>
3139 <pre>
3152 <pre>
3140 [ui]
3153 [ui]
3141 paginate = never
3154 paginate = never
3142 </pre>
3155 </pre>
3143 <p>
3156 <p>
3144 which will prevent the pager from running.
3157 which will prevent the pager from running.
3145 </p>
3158 </p>
3146
3159
3147 </div>
3160 </div>
3148 </div>
3161 </div>
3149 </div>
3162 </div>
3150
3163
3151
3164
3152
3165
3153 </body>
3166 </body>
3154 </html>
3167 </html>
3155
3168
3156
3169
3157 Sub-topic indexes rendered properly
3170 Sub-topic indexes rendered properly
3158
3171
3159 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals"
3172 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals"
3160 200 Script output follows
3173 200 Script output follows
3161
3174
3162 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3175 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3163 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3176 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3164 <head>
3177 <head>
3165 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3178 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3166 <meta name="robots" content="index, nofollow" />
3179 <meta name="robots" content="index, nofollow" />
3167 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3180 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3168 <script type="text/javascript" src="/static/mercurial.js"></script>
3181 <script type="text/javascript" src="/static/mercurial.js"></script>
3169
3182
3170 <title>Help: internals</title>
3183 <title>Help: internals</title>
3171 </head>
3184 </head>
3172 <body>
3185 <body>
3173
3186
3174 <div class="container">
3187 <div class="container">
3175 <div class="menu">
3188 <div class="menu">
3176 <div class="logo">
3189 <div class="logo">
3177 <a href="https://mercurial-scm.org/">
3190 <a href="https://mercurial-scm.org/">
3178 <img src="/static/hglogo.png" alt="mercurial" /></a>
3191 <img src="/static/hglogo.png" alt="mercurial" /></a>
3179 </div>
3192 </div>
3180 <ul>
3193 <ul>
3181 <li><a href="/shortlog">log</a></li>
3194 <li><a href="/shortlog">log</a></li>
3182 <li><a href="/graph">graph</a></li>
3195 <li><a href="/graph">graph</a></li>
3183 <li><a href="/tags">tags</a></li>
3196 <li><a href="/tags">tags</a></li>
3184 <li><a href="/bookmarks">bookmarks</a></li>
3197 <li><a href="/bookmarks">bookmarks</a></li>
3185 <li><a href="/branches">branches</a></li>
3198 <li><a href="/branches">branches</a></li>
3186 </ul>
3199 </ul>
3187 <ul>
3200 <ul>
3188 <li><a href="/help">help</a></li>
3201 <li><a href="/help">help</a></li>
3189 </ul>
3202 </ul>
3190 </div>
3203 </div>
3191
3204
3192 <div class="main">
3205 <div class="main">
3193 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3206 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3194
3207
3195 <form class="search" action="/log">
3208 <form class="search" action="/log">
3196
3209
3197 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3210 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3198 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3211 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3199 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3212 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3200 </form>
3213 </form>
3201 <table class="bigtable">
3214 <table class="bigtable">
3202 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
3215 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
3203
3216
3204 <tr><td>
3217 <tr><td>
3205 <a href="/help/internals.bundle2">
3218 <a href="/help/internals.bundle2">
3206 bundle2
3219 bundle2
3207 </a>
3220 </a>
3208 </td><td>
3221 </td><td>
3209 Bundle2
3222 Bundle2
3210 </td></tr>
3223 </td></tr>
3211 <tr><td>
3224 <tr><td>
3212 <a href="/help/internals.bundles">
3225 <a href="/help/internals.bundles">
3213 bundles
3226 bundles
3214 </a>
3227 </a>
3215 </td><td>
3228 </td><td>
3216 Bundles
3229 Bundles
3217 </td></tr>
3230 </td></tr>
3218 <tr><td>
3231 <tr><td>
3219 <a href="/help/internals.censor">
3232 <a href="/help/internals.censor">
3220 censor
3233 censor
3221 </a>
3234 </a>
3222 </td><td>
3235 </td><td>
3223 Censor
3236 Censor
3224 </td></tr>
3237 </td></tr>
3225 <tr><td>
3238 <tr><td>
3226 <a href="/help/internals.changegroups">
3239 <a href="/help/internals.changegroups">
3227 changegroups
3240 changegroups
3228 </a>
3241 </a>
3229 </td><td>
3242 </td><td>
3230 Changegroups
3243 Changegroups
3231 </td></tr>
3244 </td></tr>
3232 <tr><td>
3245 <tr><td>
3233 <a href="/help/internals.config">
3246 <a href="/help/internals.config">
3234 config
3247 config
3235 </a>
3248 </a>
3236 </td><td>
3249 </td><td>
3237 Config Registrar
3250 Config Registrar
3238 </td></tr>
3251 </td></tr>
3239 <tr><td>
3252 <tr><td>
3240 <a href="/help/internals.requirements">
3253 <a href="/help/internals.requirements">
3241 requirements
3254 requirements
3242 </a>
3255 </a>
3243 </td><td>
3256 </td><td>
3244 Repository Requirements
3257 Repository Requirements
3245 </td></tr>
3258 </td></tr>
3246 <tr><td>
3259 <tr><td>
3247 <a href="/help/internals.revlogs">
3260 <a href="/help/internals.revlogs">
3248 revlogs
3261 revlogs
3249 </a>
3262 </a>
3250 </td><td>
3263 </td><td>
3251 Revision Logs
3264 Revision Logs
3252 </td></tr>
3265 </td></tr>
3253 <tr><td>
3266 <tr><td>
3254 <a href="/help/internals.wireprotocol">
3267 <a href="/help/internals.wireprotocol">
3255 wireprotocol
3268 wireprotocol
3256 </a>
3269 </a>
3257 </td><td>
3270 </td><td>
3258 Wire Protocol
3271 Wire Protocol
3259 </td></tr>
3272 </td></tr>
3260
3273
3261
3274
3262
3275
3263
3276
3264
3277
3265 </table>
3278 </table>
3266 </div>
3279 </div>
3267 </div>
3280 </div>
3268
3281
3269
3282
3270
3283
3271 </body>
3284 </body>
3272 </html>
3285 </html>
3273
3286
3274
3287
3275 Sub-topic topics rendered properly
3288 Sub-topic topics rendered properly
3276
3289
3277 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals.changegroups"
3290 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals.changegroups"
3278 200 Script output follows
3291 200 Script output follows
3279
3292
3280 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3293 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3281 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3294 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3282 <head>
3295 <head>
3283 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3296 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3284 <meta name="robots" content="index, nofollow" />
3297 <meta name="robots" content="index, nofollow" />
3285 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3298 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3286 <script type="text/javascript" src="/static/mercurial.js"></script>
3299 <script type="text/javascript" src="/static/mercurial.js"></script>
3287
3300
3288 <title>Help: internals.changegroups</title>
3301 <title>Help: internals.changegroups</title>
3289 </head>
3302 </head>
3290 <body>
3303 <body>
3291
3304
3292 <div class="container">
3305 <div class="container">
3293 <div class="menu">
3306 <div class="menu">
3294 <div class="logo">
3307 <div class="logo">
3295 <a href="https://mercurial-scm.org/">
3308 <a href="https://mercurial-scm.org/">
3296 <img src="/static/hglogo.png" alt="mercurial" /></a>
3309 <img src="/static/hglogo.png" alt="mercurial" /></a>
3297 </div>
3310 </div>
3298 <ul>
3311 <ul>
3299 <li><a href="/shortlog">log</a></li>
3312 <li><a href="/shortlog">log</a></li>
3300 <li><a href="/graph">graph</a></li>
3313 <li><a href="/graph">graph</a></li>
3301 <li><a href="/tags">tags</a></li>
3314 <li><a href="/tags">tags</a></li>
3302 <li><a href="/bookmarks">bookmarks</a></li>
3315 <li><a href="/bookmarks">bookmarks</a></li>
3303 <li><a href="/branches">branches</a></li>
3316 <li><a href="/branches">branches</a></li>
3304 </ul>
3317 </ul>
3305 <ul>
3318 <ul>
3306 <li class="active"><a href="/help">help</a></li>
3319 <li class="active"><a href="/help">help</a></li>
3307 </ul>
3320 </ul>
3308 </div>
3321 </div>
3309
3322
3310 <div class="main">
3323 <div class="main">
3311 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3324 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3312 <h3>Help: internals.changegroups</h3>
3325 <h3>Help: internals.changegroups</h3>
3313
3326
3314 <form class="search" action="/log">
3327 <form class="search" action="/log">
3315
3328
3316 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3329 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3317 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3330 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3318 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3331 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3319 </form>
3332 </form>
3320 <div id="doc">
3333 <div id="doc">
3321 <h1>Changegroups</h1>
3334 <h1>Changegroups</h1>
3322 <p>
3335 <p>
3323 Changegroups are representations of repository revlog data, specifically
3336 Changegroups are representations of repository revlog data, specifically
3324 the changelog data, root/flat manifest data, treemanifest data, and
3337 the changelog data, root/flat manifest data, treemanifest data, and
3325 filelogs.
3338 filelogs.
3326 </p>
3339 </p>
3327 <p>
3340 <p>
3328 There are 3 versions of changegroups: &quot;1&quot;, &quot;2&quot;, and &quot;3&quot;. From a
3341 There are 3 versions of changegroups: &quot;1&quot;, &quot;2&quot;, and &quot;3&quot;. From a
3329 high-level, versions &quot;1&quot; and &quot;2&quot; are almost exactly the same, with the
3342 high-level, versions &quot;1&quot; and &quot;2&quot; are almost exactly the same, with the
3330 only difference being an additional item in the *delta header*. Version
3343 only difference being an additional item in the *delta header*. Version
3331 &quot;3&quot; adds support for revlog flags in the *delta header* and optionally
3344 &quot;3&quot; adds support for revlog flags in the *delta header* and optionally
3332 exchanging treemanifests (enabled by setting an option on the
3345 exchanging treemanifests (enabled by setting an option on the
3333 &quot;changegroup&quot; part in the bundle2).
3346 &quot;changegroup&quot; part in the bundle2).
3334 </p>
3347 </p>
3335 <p>
3348 <p>
3336 Changegroups when not exchanging treemanifests consist of 3 logical
3349 Changegroups when not exchanging treemanifests consist of 3 logical
3337 segments:
3350 segments:
3338 </p>
3351 </p>
3339 <pre>
3352 <pre>
3340 +---------------------------------+
3353 +---------------------------------+
3341 | | | |
3354 | | | |
3342 | changeset | manifest | filelogs |
3355 | changeset | manifest | filelogs |
3343 | | | |
3356 | | | |
3344 | | | |
3357 | | | |
3345 +---------------------------------+
3358 +---------------------------------+
3346 </pre>
3359 </pre>
3347 <p>
3360 <p>
3348 When exchanging treemanifests, there are 4 logical segments:
3361 When exchanging treemanifests, there are 4 logical segments:
3349 </p>
3362 </p>
3350 <pre>
3363 <pre>
3351 +-------------------------------------------------+
3364 +-------------------------------------------------+
3352 | | | | |
3365 | | | | |
3353 | changeset | root | treemanifests | filelogs |
3366 | changeset | root | treemanifests | filelogs |
3354 | | manifest | | |
3367 | | manifest | | |
3355 | | | | |
3368 | | | | |
3356 +-------------------------------------------------+
3369 +-------------------------------------------------+
3357 </pre>
3370 </pre>
3358 <p>
3371 <p>
3359 The principle building block of each segment is a *chunk*. A *chunk*
3372 The principle building block of each segment is a *chunk*. A *chunk*
3360 is a framed piece of data:
3373 is a framed piece of data:
3361 </p>
3374 </p>
3362 <pre>
3375 <pre>
3363 +---------------------------------------+
3376 +---------------------------------------+
3364 | | |
3377 | | |
3365 | length | data |
3378 | length | data |
3366 | (4 bytes) | (&lt;length - 4&gt; bytes) |
3379 | (4 bytes) | (&lt;length - 4&gt; bytes) |
3367 | | |
3380 | | |
3368 +---------------------------------------+
3381 +---------------------------------------+
3369 </pre>
3382 </pre>
3370 <p>
3383 <p>
3371 All integers are big-endian signed integers. Each chunk starts with a 32-bit
3384 All integers are big-endian signed integers. Each chunk starts with a 32-bit
3372 integer indicating the length of the entire chunk (including the length field
3385 integer indicating the length of the entire chunk (including the length field
3373 itself).
3386 itself).
3374 </p>
3387 </p>
3375 <p>
3388 <p>
3376 There is a special case chunk that has a value of 0 for the length
3389 There is a special case chunk that has a value of 0 for the length
3377 (&quot;0x00000000&quot;). We call this an *empty chunk*.
3390 (&quot;0x00000000&quot;). We call this an *empty chunk*.
3378 </p>
3391 </p>
3379 <h2>Delta Groups</h2>
3392 <h2>Delta Groups</h2>
3380 <p>
3393 <p>
3381 A *delta group* expresses the content of a revlog as a series of deltas,
3394 A *delta group* expresses the content of a revlog as a series of deltas,
3382 or patches against previous revisions.
3395 or patches against previous revisions.
3383 </p>
3396 </p>
3384 <p>
3397 <p>
3385 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
3398 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
3386 to signal the end of the delta group:
3399 to signal the end of the delta group:
3387 </p>
3400 </p>
3388 <pre>
3401 <pre>
3389 +------------------------------------------------------------------------+
3402 +------------------------------------------------------------------------+
3390 | | | | | |
3403 | | | | | |
3391 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
3404 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
3392 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
3405 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
3393 | | | | | |
3406 | | | | | |
3394 +------------------------------------------------------------------------+
3407 +------------------------------------------------------------------------+
3395 </pre>
3408 </pre>
3396 <p>
3409 <p>
3397 Each *chunk*'s data consists of the following:
3410 Each *chunk*'s data consists of the following:
3398 </p>
3411 </p>
3399 <pre>
3412 <pre>
3400 +---------------------------------------+
3413 +---------------------------------------+
3401 | | |
3414 | | |
3402 | delta header | delta data |
3415 | delta header | delta data |
3403 | (various by version) | (various) |
3416 | (various by version) | (various) |
3404 | | |
3417 | | |
3405 +---------------------------------------+
3418 +---------------------------------------+
3406 </pre>
3419 </pre>
3407 <p>
3420 <p>
3408 The *delta data* is a series of *delta*s that describe a diff from an existing
3421 The *delta data* is a series of *delta*s that describe a diff from an existing
3409 entry (either that the recipient already has, or previously specified in the
3422 entry (either that the recipient already has, or previously specified in the
3410 bundle/changegroup).
3423 bundle/changegroup).
3411 </p>
3424 </p>
3412 <p>
3425 <p>
3413 The *delta header* is different between versions &quot;1&quot;, &quot;2&quot;, and
3426 The *delta header* is different between versions &quot;1&quot;, &quot;2&quot;, and
3414 &quot;3&quot; of the changegroup format.
3427 &quot;3&quot; of the changegroup format.
3415 </p>
3428 </p>
3416 <p>
3429 <p>
3417 Version 1 (headerlen=80):
3430 Version 1 (headerlen=80):
3418 </p>
3431 </p>
3419 <pre>
3432 <pre>
3420 +------------------------------------------------------+
3433 +------------------------------------------------------+
3421 | | | | |
3434 | | | | |
3422 | node | p1 node | p2 node | link node |
3435 | node | p1 node | p2 node | link node |
3423 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3436 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3424 | | | | |
3437 | | | | |
3425 +------------------------------------------------------+
3438 +------------------------------------------------------+
3426 </pre>
3439 </pre>
3427 <p>
3440 <p>
3428 Version 2 (headerlen=100):
3441 Version 2 (headerlen=100):
3429 </p>
3442 </p>
3430 <pre>
3443 <pre>
3431 +------------------------------------------------------------------+
3444 +------------------------------------------------------------------+
3432 | | | | | |
3445 | | | | | |
3433 | node | p1 node | p2 node | base node | link node |
3446 | node | p1 node | p2 node | base node | link node |
3434 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3447 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3435 | | | | | |
3448 | | | | | |
3436 +------------------------------------------------------------------+
3449 +------------------------------------------------------------------+
3437 </pre>
3450 </pre>
3438 <p>
3451 <p>
3439 Version 3 (headerlen=102):
3452 Version 3 (headerlen=102):
3440 </p>
3453 </p>
3441 <pre>
3454 <pre>
3442 +------------------------------------------------------------------------------+
3455 +------------------------------------------------------------------------------+
3443 | | | | | | |
3456 | | | | | | |
3444 | node | p1 node | p2 node | base node | link node | flags |
3457 | node | p1 node | p2 node | base node | link node | flags |
3445 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
3458 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
3446 | | | | | | |
3459 | | | | | | |
3447 +------------------------------------------------------------------------------+
3460 +------------------------------------------------------------------------------+
3448 </pre>
3461 </pre>
3449 <p>
3462 <p>
3450 The *delta data* consists of &quot;chunklen - 4 - headerlen&quot; bytes, which contain a
3463 The *delta data* consists of &quot;chunklen - 4 - headerlen&quot; bytes, which contain a
3451 series of *delta*s, densely packed (no separators). These deltas describe a diff
3464 series of *delta*s, densely packed (no separators). These deltas describe a diff
3452 from an existing entry (either that the recipient already has, or previously
3465 from an existing entry (either that the recipient already has, or previously
3453 specified in the bundle/changegroup). The format is described more fully in
3466 specified in the bundle/changegroup). The format is described more fully in
3454 &quot;hg help internals.bdiff&quot;, but briefly:
3467 &quot;hg help internals.bdiff&quot;, but briefly:
3455 </p>
3468 </p>
3456 <pre>
3469 <pre>
3457 +---------------------------------------------------------------+
3470 +---------------------------------------------------------------+
3458 | | | | |
3471 | | | | |
3459 | start offset | end offset | new length | content |
3472 | start offset | end offset | new length | content |
3460 | (4 bytes) | (4 bytes) | (4 bytes) | (&lt;new length&gt; bytes) |
3473 | (4 bytes) | (4 bytes) | (4 bytes) | (&lt;new length&gt; bytes) |
3461 | | | | |
3474 | | | | |
3462 +---------------------------------------------------------------+
3475 +---------------------------------------------------------------+
3463 </pre>
3476 </pre>
3464 <p>
3477 <p>
3465 Please note that the length field in the delta data does *not* include itself.
3478 Please note that the length field in the delta data does *not* include itself.
3466 </p>
3479 </p>
3467 <p>
3480 <p>
3468 In version 1, the delta is always applied against the previous node from
3481 In version 1, the delta is always applied against the previous node from
3469 the changegroup or the first parent if this is the first entry in the
3482 the changegroup or the first parent if this is the first entry in the
3470 changegroup.
3483 changegroup.
3471 </p>
3484 </p>
3472 <p>
3485 <p>
3473 In version 2 and up, the delta base node is encoded in the entry in the
3486 In version 2 and up, the delta base node is encoded in the entry in the
3474 changegroup. This allows the delta to be expressed against any parent,
3487 changegroup. This allows the delta to be expressed against any parent,
3475 which can result in smaller deltas and more efficient encoding of data.
3488 which can result in smaller deltas and more efficient encoding of data.
3476 </p>
3489 </p>
3477 <h2>Changeset Segment</h2>
3490 <h2>Changeset Segment</h2>
3478 <p>
3491 <p>
3479 The *changeset segment* consists of a single *delta group* holding
3492 The *changeset segment* consists of a single *delta group* holding
3480 changelog data. The *empty chunk* at the end of the *delta group* denotes
3493 changelog data. The *empty chunk* at the end of the *delta group* denotes
3481 the boundary to the *manifest segment*.
3494 the boundary to the *manifest segment*.
3482 </p>
3495 </p>
3483 <h2>Manifest Segment</h2>
3496 <h2>Manifest Segment</h2>
3484 <p>
3497 <p>
3485 The *manifest segment* consists of a single *delta group* holding manifest
3498 The *manifest segment* consists of a single *delta group* holding manifest
3486 data. If treemanifests are in use, it contains only the manifest for the
3499 data. If treemanifests are in use, it contains only the manifest for the
3487 root directory of the repository. Otherwise, it contains the entire
3500 root directory of the repository. Otherwise, it contains the entire
3488 manifest data. The *empty chunk* at the end of the *delta group* denotes
3501 manifest data. The *empty chunk* at the end of the *delta group* denotes
3489 the boundary to the next segment (either the *treemanifests segment* or the
3502 the boundary to the next segment (either the *treemanifests segment* or the
3490 *filelogs segment*, depending on version and the request options).
3503 *filelogs segment*, depending on version and the request options).
3491 </p>
3504 </p>
3492 <h3>Treemanifests Segment</h3>
3505 <h3>Treemanifests Segment</h3>
3493 <p>
3506 <p>
3494 The *treemanifests segment* only exists in changegroup version &quot;3&quot;, and
3507 The *treemanifests segment* only exists in changegroup version &quot;3&quot;, and
3495 only if the 'treemanifest' param is part of the bundle2 changegroup part
3508 only if the 'treemanifest' param is part of the bundle2 changegroup part
3496 (it is not possible to use changegroup version 3 outside of bundle2).
3509 (it is not possible to use changegroup version 3 outside of bundle2).
3497 Aside from the filenames in the *treemanifests segment* containing a
3510 Aside from the filenames in the *treemanifests segment* containing a
3498 trailing &quot;/&quot; character, it behaves identically to the *filelogs segment*
3511 trailing &quot;/&quot; character, it behaves identically to the *filelogs segment*
3499 (see below). The final sub-segment is followed by an *empty chunk* (logically,
3512 (see below). The final sub-segment is followed by an *empty chunk* (logically,
3500 a sub-segment with filename size 0). This denotes the boundary to the
3513 a sub-segment with filename size 0). This denotes the boundary to the
3501 *filelogs segment*.
3514 *filelogs segment*.
3502 </p>
3515 </p>
3503 <h2>Filelogs Segment</h2>
3516 <h2>Filelogs Segment</h2>
3504 <p>
3517 <p>
3505 The *filelogs segment* consists of multiple sub-segments, each
3518 The *filelogs segment* consists of multiple sub-segments, each
3506 corresponding to an individual file whose data is being described:
3519 corresponding to an individual file whose data is being described:
3507 </p>
3520 </p>
3508 <pre>
3521 <pre>
3509 +--------------------------------------------------+
3522 +--------------------------------------------------+
3510 | | | | | |
3523 | | | | | |
3511 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
3524 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
3512 | | | | | (4 bytes) |
3525 | | | | | (4 bytes) |
3513 | | | | | |
3526 | | | | | |
3514 +--------------------------------------------------+
3527 +--------------------------------------------------+
3515 </pre>
3528 </pre>
3516 <p>
3529 <p>
3517 The final filelog sub-segment is followed by an *empty chunk* (logically,
3530 The final filelog sub-segment is followed by an *empty chunk* (logically,
3518 a sub-segment with filename size 0). This denotes the end of the segment
3531 a sub-segment with filename size 0). This denotes the end of the segment
3519 and of the overall changegroup.
3532 and of the overall changegroup.
3520 </p>
3533 </p>
3521 <p>
3534 <p>
3522 Each filelog sub-segment consists of the following:
3535 Each filelog sub-segment consists of the following:
3523 </p>
3536 </p>
3524 <pre>
3537 <pre>
3525 +------------------------------------------------------+
3538 +------------------------------------------------------+
3526 | | | |
3539 | | | |
3527 | filename length | filename | delta group |
3540 | filename length | filename | delta group |
3528 | (4 bytes) | (&lt;length - 4&gt; bytes) | (various) |
3541 | (4 bytes) | (&lt;length - 4&gt; bytes) | (various) |
3529 | | | |
3542 | | | |
3530 +------------------------------------------------------+
3543 +------------------------------------------------------+
3531 </pre>
3544 </pre>
3532 <p>
3545 <p>
3533 That is, a *chunk* consisting of the filename (not terminated or padded)
3546 That is, a *chunk* consisting of the filename (not terminated or padded)
3534 followed by N chunks constituting the *delta group* for this file. The
3547 followed by N chunks constituting the *delta group* for this file. The
3535 *empty chunk* at the end of each *delta group* denotes the boundary to the
3548 *empty chunk* at the end of each *delta group* denotes the boundary to the
3536 next filelog sub-segment.
3549 next filelog sub-segment.
3537 </p>
3550 </p>
3538
3551
3539 </div>
3552 </div>
3540 </div>
3553 </div>
3541 </div>
3554 </div>
3542
3555
3543
3556
3544
3557
3545 </body>
3558 </body>
3546 </html>
3559 </html>
3547
3560
3548
3561
3549 $ get-with-headers.py 127.0.0.1:$HGPORT "help/unknowntopic"
3562 $ get-with-headers.py 127.0.0.1:$HGPORT "help/unknowntopic"
3550 404 Not Found
3563 404 Not Found
3551
3564
3552 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3565 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3553 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3566 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3554 <head>
3567 <head>
3555 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3568 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3556 <meta name="robots" content="index, nofollow" />
3569 <meta name="robots" content="index, nofollow" />
3557 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3570 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3558 <script type="text/javascript" src="/static/mercurial.js"></script>
3571 <script type="text/javascript" src="/static/mercurial.js"></script>
3559
3572
3560 <title>test: error</title>
3573 <title>test: error</title>
3561 </head>
3574 </head>
3562 <body>
3575 <body>
3563
3576
3564 <div class="container">
3577 <div class="container">
3565 <div class="menu">
3578 <div class="menu">
3566 <div class="logo">
3579 <div class="logo">
3567 <a href="https://mercurial-scm.org/">
3580 <a href="https://mercurial-scm.org/">
3568 <img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial" /></a>
3581 <img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial" /></a>
3569 </div>
3582 </div>
3570 <ul>
3583 <ul>
3571 <li><a href="/shortlog">log</a></li>
3584 <li><a href="/shortlog">log</a></li>
3572 <li><a href="/graph">graph</a></li>
3585 <li><a href="/graph">graph</a></li>
3573 <li><a href="/tags">tags</a></li>
3586 <li><a href="/tags">tags</a></li>
3574 <li><a href="/bookmarks">bookmarks</a></li>
3587 <li><a href="/bookmarks">bookmarks</a></li>
3575 <li><a href="/branches">branches</a></li>
3588 <li><a href="/branches">branches</a></li>
3576 </ul>
3589 </ul>
3577 <ul>
3590 <ul>
3578 <li><a href="/help">help</a></li>
3591 <li><a href="/help">help</a></li>
3579 </ul>
3592 </ul>
3580 </div>
3593 </div>
3581
3594
3582 <div class="main">
3595 <div class="main">
3583
3596
3584 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3597 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3585 <h3>error</h3>
3598 <h3>error</h3>
3586
3599
3587
3600
3588 <form class="search" action="/log">
3601 <form class="search" action="/log">
3589
3602
3590 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3603 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3591 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3604 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3592 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3605 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3593 </form>
3606 </form>
3594
3607
3595 <div class="description">
3608 <div class="description">
3596 <p>
3609 <p>
3597 An error occurred while processing your request:
3610 An error occurred while processing your request:
3598 </p>
3611 </p>
3599 <p>
3612 <p>
3600 Not Found
3613 Not Found
3601 </p>
3614 </p>
3602 </div>
3615 </div>
3603 </div>
3616 </div>
3604 </div>
3617 </div>
3605
3618
3606
3619
3607
3620
3608 </body>
3621 </body>
3609 </html>
3622 </html>
3610
3623
3611 [1]
3624 [1]
3612
3625
3613 $ killdaemons.py
3626 $ killdaemons.py
3614
3627
3615 #endif
3628 #endif
General Comments 0
You need to be logged in to leave comments. Login now