##// END OF EJS Templates
mergetools: add new conflict marker format with diffs in...
Martin von Zweigbergk -
r46724:bdc2bf68 default
parent child Browse files
Show More
@@ -1,1266 +1,1293 b''
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 (
16 from .node import (
17 hex,
17 hex,
18 nullid,
18 nullid,
19 short,
19 short,
20 )
20 )
21 from .pycompat import (
21 from .pycompat import (
22 getattr,
22 getattr,
23 open,
23 open,
24 )
24 )
25
25
26 from . import (
26 from . import (
27 encoding,
27 encoding,
28 error,
28 error,
29 formatter,
29 formatter,
30 match,
30 match,
31 pycompat,
31 pycompat,
32 registrar,
32 registrar,
33 scmutil,
33 scmutil,
34 simplemerge,
34 simplemerge,
35 tagmerge,
35 tagmerge,
36 templatekw,
36 templatekw,
37 templater,
37 templater,
38 templateutil,
38 templateutil,
39 util,
39 util,
40 )
40 )
41
41
42 from .utils import (
42 from .utils import (
43 procutil,
43 procutil,
44 stringutil,
44 stringutil,
45 )
45 )
46
46
47
47
48 def _toolstr(ui, tool, part, *args):
48 def _toolstr(ui, tool, part, *args):
49 return ui.config(b"merge-tools", tool + b"." + part, *args)
49 return ui.config(b"merge-tools", tool + b"." + part, *args)
50
50
51
51
52 def _toolbool(ui, tool, part, *args):
52 def _toolbool(ui, tool, part, *args):
53 return ui.configbool(b"merge-tools", tool + b"." + part, *args)
53 return ui.configbool(b"merge-tools", tool + b"." + part, *args)
54
54
55
55
56 def _toollist(ui, tool, part):
56 def _toollist(ui, tool, part):
57 return ui.configlist(b"merge-tools", tool + b"." + part)
57 return ui.configlist(b"merge-tools", tool + b"." + part)
58
58
59
59
60 internals = {}
60 internals = {}
61 # Merge tools to document.
61 # Merge tools to document.
62 internalsdoc = {}
62 internalsdoc = {}
63
63
64 internaltool = registrar.internalmerge()
64 internaltool = registrar.internalmerge()
65
65
66 # internal tool merge types
66 # internal tool merge types
67 nomerge = internaltool.nomerge
67 nomerge = internaltool.nomerge
68 mergeonly = internaltool.mergeonly # just the full merge, no premerge
68 mergeonly = internaltool.mergeonly # just the full merge, no premerge
69 fullmerge = internaltool.fullmerge # both premerge and merge
69 fullmerge = internaltool.fullmerge # both premerge and merge
70
70
71 # IMPORTANT: keep the last line of this prompt very short ("What do you want to
71 # IMPORTANT: keep the last line of this prompt very short ("What do you want to
72 # do?") because of issue6158, ideally to <40 English characters (to allow other
72 # do?") because of issue6158, ideally to <40 English characters (to allow other
73 # languages that may take more columns to still have a chance to fit in an
73 # languages that may take more columns to still have a chance to fit in an
74 # 80-column screen).
74 # 80-column screen).
75 _localchangedotherdeletedmsg = _(
75 _localchangedotherdeletedmsg = _(
76 b"file '%(fd)s' was deleted in other%(o)s but was modified in local%(l)s.\n"
76 b"file '%(fd)s' was deleted in other%(o)s but was modified in local%(l)s.\n"
77 b"You can use (c)hanged version, (d)elete, or leave (u)nresolved.\n"
77 b"You can use (c)hanged version, (d)elete, or leave (u)nresolved.\n"
78 b"What do you want to do?"
78 b"What do you want to do?"
79 b"$$ &Changed $$ &Delete $$ &Unresolved"
79 b"$$ &Changed $$ &Delete $$ &Unresolved"
80 )
80 )
81
81
82 _otherchangedlocaldeletedmsg = _(
82 _otherchangedlocaldeletedmsg = _(
83 b"file '%(fd)s' was deleted in local%(l)s but was modified in other%(o)s.\n"
83 b"file '%(fd)s' was deleted in local%(l)s but was modified in other%(o)s.\n"
84 b"You can use (c)hanged version, leave (d)eleted, or leave (u)nresolved.\n"
84 b"You can use (c)hanged version, leave (d)eleted, or leave (u)nresolved.\n"
85 b"What do you want to do?"
85 b"What do you want to do?"
86 b"$$ &Changed $$ &Deleted $$ &Unresolved"
86 b"$$ &Changed $$ &Deleted $$ &Unresolved"
87 )
87 )
88
88
89
89
90 class absentfilectx(object):
90 class absentfilectx(object):
91 """Represents a file that's ostensibly in a context but is actually not
91 """Represents a file that's ostensibly in a context but is actually not
92 present in it.
92 present in it.
93
93
94 This is here because it's very specific to the filemerge code for now --
94 This is here because it's very specific to the filemerge code for now --
95 other code is likely going to break with the values this returns."""
95 other code is likely going to break with the values this returns."""
96
96
97 def __init__(self, ctx, f):
97 def __init__(self, ctx, f):
98 self._ctx = ctx
98 self._ctx = ctx
99 self._f = f
99 self._f = f
100
100
101 def __bytes__(self):
101 def __bytes__(self):
102 return b'absent file %s@%s' % (self._f, self._ctx)
102 return b'absent file %s@%s' % (self._f, self._ctx)
103
103
104 def path(self):
104 def path(self):
105 return self._f
105 return self._f
106
106
107 def size(self):
107 def size(self):
108 return None
108 return None
109
109
110 def data(self):
110 def data(self):
111 return None
111 return None
112
112
113 def filenode(self):
113 def filenode(self):
114 return nullid
114 return nullid
115
115
116 _customcmp = True
116 _customcmp = True
117
117
118 def cmp(self, fctx):
118 def cmp(self, fctx):
119 """compare with other file context
119 """compare with other file context
120
120
121 returns True if different from fctx.
121 returns True if different from fctx.
122 """
122 """
123 return not (
123 return not (
124 fctx.isabsent()
124 fctx.isabsent()
125 and fctx.changectx() == self.changectx()
125 and fctx.changectx() == self.changectx()
126 and fctx.path() == self.path()
126 and fctx.path() == self.path()
127 )
127 )
128
128
129 def flags(self):
129 def flags(self):
130 return b''
130 return b''
131
131
132 def changectx(self):
132 def changectx(self):
133 return self._ctx
133 return self._ctx
134
134
135 def isbinary(self):
135 def isbinary(self):
136 return False
136 return False
137
137
138 def isabsent(self):
138 def isabsent(self):
139 return True
139 return True
140
140
141
141
142 def _findtool(ui, tool):
142 def _findtool(ui, tool):
143 if tool in internals:
143 if tool in internals:
144 return tool
144 return tool
145 cmd = _toolstr(ui, tool, b"executable", tool)
145 cmd = _toolstr(ui, tool, b"executable", tool)
146 if cmd.startswith(b'python:'):
146 if cmd.startswith(b'python:'):
147 return cmd
147 return cmd
148 return findexternaltool(ui, tool)
148 return findexternaltool(ui, tool)
149
149
150
150
151 def _quotetoolpath(cmd):
151 def _quotetoolpath(cmd):
152 if cmd.startswith(b'python:'):
152 if cmd.startswith(b'python:'):
153 return cmd
153 return cmd
154 return procutil.shellquote(cmd)
154 return procutil.shellquote(cmd)
155
155
156
156
157 def findexternaltool(ui, tool):
157 def findexternaltool(ui, tool):
158 for kn in (b"regkey", b"regkeyalt"):
158 for kn in (b"regkey", b"regkeyalt"):
159 k = _toolstr(ui, tool, kn)
159 k = _toolstr(ui, tool, kn)
160 if not k:
160 if not k:
161 continue
161 continue
162 p = util.lookupreg(k, _toolstr(ui, tool, b"regname"))
162 p = util.lookupreg(k, _toolstr(ui, tool, b"regname"))
163 if p:
163 if p:
164 p = procutil.findexe(p + _toolstr(ui, tool, b"regappend", b""))
164 p = procutil.findexe(p + _toolstr(ui, tool, b"regappend", b""))
165 if p:
165 if p:
166 return p
166 return p
167 exe = _toolstr(ui, tool, b"executable", tool)
167 exe = _toolstr(ui, tool, b"executable", tool)
168 return procutil.findexe(util.expandpath(exe))
168 return procutil.findexe(util.expandpath(exe))
169
169
170
170
171 def _picktool(repo, ui, path, binary, symlink, changedelete):
171 def _picktool(repo, ui, path, binary, symlink, changedelete):
172 strictcheck = ui.configbool(b'merge', b'strict-capability-check')
172 strictcheck = ui.configbool(b'merge', b'strict-capability-check')
173
173
174 def hascapability(tool, capability, strict=False):
174 def hascapability(tool, capability, strict=False):
175 if tool in internals:
175 if tool in internals:
176 return strict and internals[tool].capabilities.get(capability)
176 return strict and internals[tool].capabilities.get(capability)
177 return _toolbool(ui, tool, capability)
177 return _toolbool(ui, tool, capability)
178
178
179 def supportscd(tool):
179 def supportscd(tool):
180 return tool in internals and internals[tool].mergetype == nomerge
180 return tool in internals and internals[tool].mergetype == nomerge
181
181
182 def check(tool, pat, symlink, binary, changedelete):
182 def check(tool, pat, symlink, binary, changedelete):
183 tmsg = tool
183 tmsg = tool
184 if pat:
184 if pat:
185 tmsg = _(b"%s (for pattern %s)") % (tool, pat)
185 tmsg = _(b"%s (for pattern %s)") % (tool, pat)
186 if not _findtool(ui, tool):
186 if not _findtool(ui, tool):
187 if pat: # explicitly requested tool deserves a warning
187 if pat: # explicitly requested tool deserves a warning
188 ui.warn(_(b"couldn't find merge tool %s\n") % tmsg)
188 ui.warn(_(b"couldn't find merge tool %s\n") % tmsg)
189 else: # configured but non-existing tools are more silent
189 else: # configured but non-existing tools are more silent
190 ui.note(_(b"couldn't find merge tool %s\n") % tmsg)
190 ui.note(_(b"couldn't find merge tool %s\n") % tmsg)
191 elif symlink and not hascapability(tool, b"symlink", strictcheck):
191 elif symlink and not hascapability(tool, b"symlink", strictcheck):
192 ui.warn(_(b"tool %s can't handle symlinks\n") % tmsg)
192 ui.warn(_(b"tool %s can't handle symlinks\n") % tmsg)
193 elif binary and not hascapability(tool, b"binary", strictcheck):
193 elif binary and not hascapability(tool, b"binary", strictcheck):
194 ui.warn(_(b"tool %s can't handle binary\n") % tmsg)
194 ui.warn(_(b"tool %s can't handle binary\n") % tmsg)
195 elif changedelete and not supportscd(tool):
195 elif changedelete and not supportscd(tool):
196 # the nomerge tools are the only tools that support change/delete
196 # the nomerge tools are the only tools that support change/delete
197 # conflicts
197 # conflicts
198 pass
198 pass
199 elif not procutil.gui() and _toolbool(ui, tool, b"gui"):
199 elif not procutil.gui() and _toolbool(ui, tool, b"gui"):
200 ui.warn(_(b"tool %s requires a GUI\n") % tmsg)
200 ui.warn(_(b"tool %s requires a GUI\n") % tmsg)
201 else:
201 else:
202 return True
202 return True
203 return False
203 return False
204
204
205 # internal config: ui.forcemerge
205 # internal config: ui.forcemerge
206 # forcemerge comes from command line arguments, highest priority
206 # forcemerge comes from command line arguments, highest priority
207 force = ui.config(b'ui', b'forcemerge')
207 force = ui.config(b'ui', b'forcemerge')
208 if force:
208 if force:
209 toolpath = _findtool(ui, force)
209 toolpath = _findtool(ui, force)
210 if changedelete and not supportscd(toolpath):
210 if changedelete and not supportscd(toolpath):
211 return b":prompt", None
211 return b":prompt", None
212 else:
212 else:
213 if toolpath:
213 if toolpath:
214 return (force, _quotetoolpath(toolpath))
214 return (force, _quotetoolpath(toolpath))
215 else:
215 else:
216 # mimic HGMERGE if given tool not found
216 # mimic HGMERGE if given tool not found
217 return (force, force)
217 return (force, force)
218
218
219 # HGMERGE takes next precedence
219 # HGMERGE takes next precedence
220 hgmerge = encoding.environ.get(b"HGMERGE")
220 hgmerge = encoding.environ.get(b"HGMERGE")
221 if hgmerge:
221 if hgmerge:
222 if changedelete and not supportscd(hgmerge):
222 if changedelete and not supportscd(hgmerge):
223 return b":prompt", None
223 return b":prompt", None
224 else:
224 else:
225 return (hgmerge, hgmerge)
225 return (hgmerge, hgmerge)
226
226
227 # then patterns
227 # then patterns
228
228
229 # whether binary capability should be checked strictly
229 # whether binary capability should be checked strictly
230 binarycap = binary and strictcheck
230 binarycap = binary and strictcheck
231
231
232 for pat, tool in ui.configitems(b"merge-patterns"):
232 for pat, tool in ui.configitems(b"merge-patterns"):
233 mf = match.match(repo.root, b'', [pat])
233 mf = match.match(repo.root, b'', [pat])
234 if mf(path) and check(tool, pat, symlink, binarycap, changedelete):
234 if mf(path) and check(tool, pat, symlink, binarycap, changedelete):
235 if binary and not hascapability(tool, b"binary", strict=True):
235 if binary and not hascapability(tool, b"binary", strict=True):
236 ui.warn(
236 ui.warn(
237 _(
237 _(
238 b"warning: check merge-patterns configurations,"
238 b"warning: check merge-patterns configurations,"
239 b" if %r for binary file %r is unintentional\n"
239 b" if %r for binary file %r is unintentional\n"
240 b"(see 'hg help merge-tools'"
240 b"(see 'hg help merge-tools'"
241 b" for binary files capability)\n"
241 b" for binary files capability)\n"
242 )
242 )
243 % (pycompat.bytestr(tool), pycompat.bytestr(path))
243 % (pycompat.bytestr(tool), pycompat.bytestr(path))
244 )
244 )
245 toolpath = _findtool(ui, tool)
245 toolpath = _findtool(ui, tool)
246 return (tool, _quotetoolpath(toolpath))
246 return (tool, _quotetoolpath(toolpath))
247
247
248 # then merge tools
248 # then merge tools
249 tools = {}
249 tools = {}
250 disabled = set()
250 disabled = set()
251 for k, v in ui.configitems(b"merge-tools"):
251 for k, v in ui.configitems(b"merge-tools"):
252 t = k.split(b'.')[0]
252 t = k.split(b'.')[0]
253 if t not in tools:
253 if t not in tools:
254 tools[t] = int(_toolstr(ui, t, b"priority"))
254 tools[t] = int(_toolstr(ui, t, b"priority"))
255 if _toolbool(ui, t, b"disabled"):
255 if _toolbool(ui, t, b"disabled"):
256 disabled.add(t)
256 disabled.add(t)
257 names = tools.keys()
257 names = tools.keys()
258 tools = sorted(
258 tools = sorted(
259 [(-p, tool) for tool, p in tools.items() if tool not in disabled]
259 [(-p, tool) for tool, p in tools.items() if tool not in disabled]
260 )
260 )
261 uimerge = ui.config(b"ui", b"merge")
261 uimerge = ui.config(b"ui", b"merge")
262 if uimerge:
262 if uimerge:
263 # external tools defined in uimerge won't be able to handle
263 # external tools defined in uimerge won't be able to handle
264 # change/delete conflicts
264 # change/delete conflicts
265 if check(uimerge, path, symlink, binary, changedelete):
265 if check(uimerge, path, symlink, binary, changedelete):
266 if uimerge not in names and not changedelete:
266 if uimerge not in names and not changedelete:
267 return (uimerge, uimerge)
267 return (uimerge, uimerge)
268 tools.insert(0, (None, uimerge)) # highest priority
268 tools.insert(0, (None, uimerge)) # highest priority
269 tools.append((None, b"hgmerge")) # the old default, if found
269 tools.append((None, b"hgmerge")) # the old default, if found
270 for p, t in tools:
270 for p, t in tools:
271 if check(t, None, symlink, binary, changedelete):
271 if check(t, None, symlink, binary, changedelete):
272 toolpath = _findtool(ui, t)
272 toolpath = _findtool(ui, t)
273 return (t, _quotetoolpath(toolpath))
273 return (t, _quotetoolpath(toolpath))
274
274
275 # internal merge or prompt as last resort
275 # internal merge or prompt as last resort
276 if symlink or binary or changedelete:
276 if symlink or binary or changedelete:
277 if not changedelete and len(tools):
277 if not changedelete and len(tools):
278 # any tool is rejected by capability for symlink or binary
278 # any tool is rejected by capability for symlink or binary
279 ui.warn(_(b"no tool found to merge %s\n") % path)
279 ui.warn(_(b"no tool found to merge %s\n") % path)
280 return b":prompt", None
280 return b":prompt", None
281 return b":merge", None
281 return b":merge", None
282
282
283
283
284 def _eoltype(data):
284 def _eoltype(data):
285 """Guess the EOL type of a file"""
285 """Guess the EOL type of a file"""
286 if b'\0' in data: # binary
286 if b'\0' in data: # binary
287 return None
287 return None
288 if b'\r\n' in data: # Windows
288 if b'\r\n' in data: # Windows
289 return b'\r\n'
289 return b'\r\n'
290 if b'\r' in data: # Old Mac
290 if b'\r' in data: # Old Mac
291 return b'\r'
291 return b'\r'
292 if b'\n' in data: # UNIX
292 if b'\n' in data: # UNIX
293 return b'\n'
293 return b'\n'
294 return None # unknown
294 return None # unknown
295
295
296
296
297 def _matcheol(file, back):
297 def _matcheol(file, back):
298 """Convert EOL markers in a file to match origfile"""
298 """Convert EOL markers in a file to match origfile"""
299 tostyle = _eoltype(back.data()) # No repo.wread filters?
299 tostyle = _eoltype(back.data()) # No repo.wread filters?
300 if tostyle:
300 if tostyle:
301 data = util.readfile(file)
301 data = util.readfile(file)
302 style = _eoltype(data)
302 style = _eoltype(data)
303 if style:
303 if style:
304 newdata = data.replace(style, tostyle)
304 newdata = data.replace(style, tostyle)
305 if newdata != data:
305 if newdata != data:
306 util.writefile(file, newdata)
306 util.writefile(file, newdata)
307
307
308
308
309 @internaltool(b'prompt', nomerge)
309 @internaltool(b'prompt', nomerge)
310 def _iprompt(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None):
310 def _iprompt(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None):
311 """Asks the user which of the local `p1()` or the other `p2()` version to
311 """Asks the user which of the local `p1()` or the other `p2()` version to
312 keep as the merged version."""
312 keep as the merged version."""
313 ui = repo.ui
313 ui = repo.ui
314 fd = fcd.path()
314 fd = fcd.path()
315 uipathfn = scmutil.getuipathfn(repo)
315 uipathfn = scmutil.getuipathfn(repo)
316
316
317 # Avoid prompting during an in-memory merge since it doesn't support merge
317 # Avoid prompting during an in-memory merge since it doesn't support merge
318 # conflicts.
318 # conflicts.
319 if fcd.changectx().isinmemory():
319 if fcd.changectx().isinmemory():
320 raise error.InMemoryMergeConflictsError(
320 raise error.InMemoryMergeConflictsError(
321 b'in-memory merge does not support file conflicts'
321 b'in-memory merge does not support file conflicts'
322 )
322 )
323
323
324 prompts = partextras(labels)
324 prompts = partextras(labels)
325 prompts[b'fd'] = uipathfn(fd)
325 prompts[b'fd'] = uipathfn(fd)
326 try:
326 try:
327 if fco.isabsent():
327 if fco.isabsent():
328 index = ui.promptchoice(_localchangedotherdeletedmsg % prompts, 2)
328 index = ui.promptchoice(_localchangedotherdeletedmsg % prompts, 2)
329 choice = [b'local', b'other', b'unresolved'][index]
329 choice = [b'local', b'other', b'unresolved'][index]
330 elif fcd.isabsent():
330 elif fcd.isabsent():
331 index = ui.promptchoice(_otherchangedlocaldeletedmsg % prompts, 2)
331 index = ui.promptchoice(_otherchangedlocaldeletedmsg % prompts, 2)
332 choice = [b'other', b'local', b'unresolved'][index]
332 choice = [b'other', b'local', b'unresolved'][index]
333 else:
333 else:
334 # IMPORTANT: keep the last line of this prompt ("What do you want to
334 # IMPORTANT: keep the last line of this prompt ("What do you want to
335 # do?") very short, see comment next to _localchangedotherdeletedmsg
335 # do?") very short, see comment next to _localchangedotherdeletedmsg
336 # at the top of the file for details.
336 # at the top of the file for details.
337 index = ui.promptchoice(
337 index = ui.promptchoice(
338 _(
338 _(
339 b"file '%(fd)s' needs to be resolved.\n"
339 b"file '%(fd)s' needs to be resolved.\n"
340 b"You can keep (l)ocal%(l)s, take (o)ther%(o)s, or leave "
340 b"You can keep (l)ocal%(l)s, take (o)ther%(o)s, or leave "
341 b"(u)nresolved.\n"
341 b"(u)nresolved.\n"
342 b"What do you want to do?"
342 b"What do you want to do?"
343 b"$$ &Local $$ &Other $$ &Unresolved"
343 b"$$ &Local $$ &Other $$ &Unresolved"
344 )
344 )
345 % prompts,
345 % prompts,
346 2,
346 2,
347 )
347 )
348 choice = [b'local', b'other', b'unresolved'][index]
348 choice = [b'local', b'other', b'unresolved'][index]
349
349
350 if choice == b'other':
350 if choice == b'other':
351 return _iother(repo, mynode, orig, fcd, fco, fca, toolconf, labels)
351 return _iother(repo, mynode, orig, fcd, fco, fca, toolconf, labels)
352 elif choice == b'local':
352 elif choice == b'local':
353 return _ilocal(repo, mynode, orig, fcd, fco, fca, toolconf, labels)
353 return _ilocal(repo, mynode, orig, fcd, fco, fca, toolconf, labels)
354 elif choice == b'unresolved':
354 elif choice == b'unresolved':
355 return _ifail(repo, mynode, orig, fcd, fco, fca, toolconf, labels)
355 return _ifail(repo, mynode, orig, fcd, fco, fca, toolconf, labels)
356 except error.ResponseExpected:
356 except error.ResponseExpected:
357 ui.write(b"\n")
357 ui.write(b"\n")
358 return _ifail(repo, mynode, orig, fcd, fco, fca, toolconf, labels)
358 return _ifail(repo, mynode, orig, fcd, fco, fca, toolconf, labels)
359
359
360
360
361 @internaltool(b'local', nomerge)
361 @internaltool(b'local', nomerge)
362 def _ilocal(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None):
362 def _ilocal(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None):
363 """Uses the local `p1()` version of files as the merged version."""
363 """Uses the local `p1()` version of files as the merged version."""
364 return 0, fcd.isabsent()
364 return 0, fcd.isabsent()
365
365
366
366
367 @internaltool(b'other', nomerge)
367 @internaltool(b'other', nomerge)
368 def _iother(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None):
368 def _iother(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None):
369 """Uses the other `p2()` version of files as the merged version."""
369 """Uses the other `p2()` version of files as the merged version."""
370 if fco.isabsent():
370 if fco.isabsent():
371 # local changed, remote deleted -- 'deleted' picked
371 # local changed, remote deleted -- 'deleted' picked
372 _underlyingfctxifabsent(fcd).remove()
372 _underlyingfctxifabsent(fcd).remove()
373 deleted = True
373 deleted = True
374 else:
374 else:
375 _underlyingfctxifabsent(fcd).write(fco.data(), fco.flags())
375 _underlyingfctxifabsent(fcd).write(fco.data(), fco.flags())
376 deleted = False
376 deleted = False
377 return 0, deleted
377 return 0, deleted
378
378
379
379
380 @internaltool(b'fail', nomerge)
380 @internaltool(b'fail', nomerge)
381 def _ifail(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None):
381 def _ifail(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None):
382 """
382 """
383 Rather than attempting to merge files that were modified on both
383 Rather than attempting to merge files that were modified on both
384 branches, it marks them as unresolved. The resolve command must be
384 branches, it marks them as unresolved. The resolve command must be
385 used to resolve these conflicts."""
385 used to resolve these conflicts."""
386 # for change/delete conflicts write out the changed version, then fail
386 # for change/delete conflicts write out the changed version, then fail
387 if fcd.isabsent():
387 if fcd.isabsent():
388 _underlyingfctxifabsent(fcd).write(fco.data(), fco.flags())
388 _underlyingfctxifabsent(fcd).write(fco.data(), fco.flags())
389 return 1, False
389 return 1, False
390
390
391
391
392 def _underlyingfctxifabsent(filectx):
392 def _underlyingfctxifabsent(filectx):
393 """Sometimes when resolving, our fcd is actually an absentfilectx, but
393 """Sometimes when resolving, our fcd is actually an absentfilectx, but
394 we want to write to it (to do the resolve). This helper returns the
394 we want to write to it (to do the resolve). This helper returns the
395 underyling workingfilectx in that case.
395 underyling workingfilectx in that case.
396 """
396 """
397 if filectx.isabsent():
397 if filectx.isabsent():
398 return filectx.changectx()[filectx.path()]
398 return filectx.changectx()[filectx.path()]
399 else:
399 else:
400 return filectx
400 return filectx
401
401
402
402
403 def _premerge(repo, fcd, fco, fca, toolconf, files, labels=None):
403 def _premerge(repo, fcd, fco, fca, toolconf, files, labels=None):
404 tool, toolpath, binary, symlink, scriptfn = toolconf
404 tool, toolpath, binary, symlink, scriptfn = toolconf
405 if symlink or fcd.isabsent() or fco.isabsent():
405 if symlink or fcd.isabsent() or fco.isabsent():
406 return 1
406 return 1
407 unused, unused, unused, back = files
407 unused, unused, unused, back = files
408
408
409 ui = repo.ui
409 ui = repo.ui
410
410
411 validkeep = [b'keep', b'keep-merge3']
411 validkeep = [b'keep', b'keep-merge3']
412
412
413 # do we attempt to simplemerge first?
413 # do we attempt to simplemerge first?
414 try:
414 try:
415 premerge = _toolbool(ui, tool, b"premerge", not binary)
415 premerge = _toolbool(ui, tool, b"premerge", not binary)
416 except error.ConfigError:
416 except error.ConfigError:
417 premerge = _toolstr(ui, tool, b"premerge", b"").lower()
417 premerge = _toolstr(ui, tool, b"premerge", b"").lower()
418 if premerge not in validkeep:
418 if premerge not in validkeep:
419 _valid = b', '.join([b"'" + v + b"'" for v in validkeep])
419 _valid = b', '.join([b"'" + v + b"'" for v in validkeep])
420 raise error.ConfigError(
420 raise error.ConfigError(
421 _(b"%s.premerge not valid ('%s' is neither boolean nor %s)")
421 _(b"%s.premerge not valid ('%s' is neither boolean nor %s)")
422 % (tool, premerge, _valid)
422 % (tool, premerge, _valid)
423 )
423 )
424
424
425 if premerge:
425 if premerge:
426 if premerge == b'keep-merge3':
426 if premerge == b'keep-merge3':
427 if not labels:
427 if not labels:
428 labels = _defaultconflictlabels
428 labels = _defaultconflictlabels
429 if len(labels) < 3:
429 if len(labels) < 3:
430 labels.append(b'base')
430 labels.append(b'base')
431 r = simplemerge.simplemerge(ui, fcd, fca, fco, quiet=True, label=labels)
431 r = simplemerge.simplemerge(ui, fcd, fca, fco, quiet=True, label=labels)
432 if not r:
432 if not r:
433 ui.debug(b" premerge successful\n")
433 ui.debug(b" premerge successful\n")
434 return 0
434 return 0
435 if premerge not in validkeep:
435 if premerge not in validkeep:
436 # restore from backup and try again
436 # restore from backup and try again
437 _restorebackup(fcd, back)
437 _restorebackup(fcd, back)
438 return 1 # continue merging
438 return 1 # continue merging
439
439
440
440
441 def _mergecheck(repo, mynode, orig, fcd, fco, fca, toolconf):
441 def _mergecheck(repo, mynode, orig, fcd, fco, fca, toolconf):
442 tool, toolpath, binary, symlink, scriptfn = toolconf
442 tool, toolpath, binary, symlink, scriptfn = toolconf
443 uipathfn = scmutil.getuipathfn(repo)
443 uipathfn = scmutil.getuipathfn(repo)
444 if symlink:
444 if symlink:
445 repo.ui.warn(
445 repo.ui.warn(
446 _(b'warning: internal %s cannot merge symlinks for %s\n')
446 _(b'warning: internal %s cannot merge symlinks for %s\n')
447 % (tool, uipathfn(fcd.path()))
447 % (tool, uipathfn(fcd.path()))
448 )
448 )
449 return False
449 return False
450 if fcd.isabsent() or fco.isabsent():
450 if fcd.isabsent() or fco.isabsent():
451 repo.ui.warn(
451 repo.ui.warn(
452 _(
452 _(
453 b'warning: internal %s cannot merge change/delete '
453 b'warning: internal %s cannot merge change/delete '
454 b'conflict for %s\n'
454 b'conflict for %s\n'
455 )
455 )
456 % (tool, uipathfn(fcd.path()))
456 % (tool, uipathfn(fcd.path()))
457 )
457 )
458 return False
458 return False
459 return True
459 return True
460
460
461
461
462 def _merge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels, mode):
462 def _merge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels, mode):
463 """
463 """
464 Uses the internal non-interactive simple merge algorithm for merging
464 Uses the internal non-interactive simple merge algorithm for merging
465 files. It will fail if there are any conflicts and leave markers in
465 files. It will fail if there are any conflicts and leave markers in
466 the partially merged file. Markers will have two sections, one for each side
466 the partially merged file. Markers will have two sections, one for each side
467 of merge, unless mode equals 'union' which suppresses the markers."""
467 of merge, unless mode equals 'union' which suppresses the markers."""
468 ui = repo.ui
468 ui = repo.ui
469
469
470 r = simplemerge.simplemerge(ui, fcd, fca, fco, label=labels, mode=mode)
470 r = simplemerge.simplemerge(ui, fcd, fca, fco, label=labels, mode=mode)
471 return True, r, False
471 return True, r, False
472
472
473
473
474 @internaltool(
474 @internaltool(
475 b'union',
475 b'union',
476 fullmerge,
476 fullmerge,
477 _(
477 _(
478 b"warning: conflicts while merging %s! "
478 b"warning: conflicts while merging %s! "
479 b"(edit, then use 'hg resolve --mark')\n"
479 b"(edit, then use 'hg resolve --mark')\n"
480 ),
480 ),
481 precheck=_mergecheck,
481 precheck=_mergecheck,
482 )
482 )
483 def _iunion(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
483 def _iunion(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
484 """
484 """
485 Uses the internal non-interactive simple merge algorithm for merging
485 Uses the internal non-interactive simple merge algorithm for merging
486 files. It will use both left and right sides for conflict regions.
486 files. It will use both left and right sides for conflict regions.
487 No markers are inserted."""
487 No markers are inserted."""
488 return _merge(
488 return _merge(
489 repo, mynode, orig, fcd, fco, fca, toolconf, files, labels, b'union'
489 repo, mynode, orig, fcd, fco, fca, toolconf, files, labels, b'union'
490 )
490 )
491
491
492
492
493 @internaltool(
493 @internaltool(
494 b'merge',
494 b'merge',
495 fullmerge,
495 fullmerge,
496 _(
496 _(
497 b"warning: conflicts while merging %s! "
497 b"warning: conflicts while merging %s! "
498 b"(edit, then use 'hg resolve --mark')\n"
498 b"(edit, then use 'hg resolve --mark')\n"
499 ),
499 ),
500 precheck=_mergecheck,
500 precheck=_mergecheck,
501 )
501 )
502 def _imerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
502 def _imerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
503 """
503 """
504 Uses the internal non-interactive simple merge algorithm for merging
504 Uses the internal non-interactive simple merge algorithm for merging
505 files. It will fail if there are any conflicts and leave markers in
505 files. It will fail if there are any conflicts and leave markers in
506 the partially merged file. Markers will have two sections, one for each side
506 the partially merged file. Markers will have two sections, one for each side
507 of merge."""
507 of merge."""
508 return _merge(
508 return _merge(
509 repo, mynode, orig, fcd, fco, fca, toolconf, files, labels, b'merge'
509 repo, mynode, orig, fcd, fco, fca, toolconf, files, labels, b'merge'
510 )
510 )
511
511
512
512
513 @internaltool(
513 @internaltool(
514 b'merge3',
514 b'merge3',
515 fullmerge,
515 fullmerge,
516 _(
516 _(
517 b"warning: conflicts while merging %s! "
517 b"warning: conflicts while merging %s! "
518 b"(edit, then use 'hg resolve --mark')\n"
518 b"(edit, then use 'hg resolve --mark')\n"
519 ),
519 ),
520 precheck=_mergecheck,
520 precheck=_mergecheck,
521 )
521 )
522 def _imerge3(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
522 def _imerge3(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
523 """
523 """
524 Uses the internal non-interactive simple merge algorithm for merging
524 Uses the internal non-interactive simple merge algorithm for merging
525 files. It will fail if there are any conflicts and leave markers in
525 files. It will fail if there are any conflicts and leave markers in
526 the partially merged file. Marker will have three sections, one from each
526 the partially merged file. Marker will have three sections, one from each
527 side of the merge and one for the base content."""
527 side of the merge and one for the base content."""
528 if not labels:
528 if not labels:
529 labels = _defaultconflictlabels
529 labels = _defaultconflictlabels
530 if len(labels) < 3:
530 if len(labels) < 3:
531 labels.append(b'base')
531 labels.append(b'base')
532 return _imerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels)
532 return _imerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels)
533
533
534
534
535 @internaltool(
536 b'mergediff',
537 fullmerge,
538 _(
539 b"warning: conflicts while merging %s! "
540 b"(edit, then use 'hg resolve --mark')\n"
541 ),
542 precheck=_mergecheck,
543 )
544 def _imerge_diff(
545 repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None
546 ):
547 """
548 Uses the internal non-interactive simple merge algorithm for merging
549 files. It will fail if there are any conflicts and leave markers in
550 the partially merged file. The marker will have two sections, one with the
551 content from one side of the merge, and one with a diff from the base
552 content to the content on the other side. (experimental)"""
553 if not labels:
554 labels = _defaultconflictlabels
555 if len(labels) < 3:
556 labels.append(b'base')
557 return _merge(
558 repo, mynode, orig, fcd, fco, fca, toolconf, files, labels, b'mergediff'
559 )
560
561
535 def _imergeauto(
562 def _imergeauto(
536 repo,
563 repo,
537 mynode,
564 mynode,
538 orig,
565 orig,
539 fcd,
566 fcd,
540 fco,
567 fco,
541 fca,
568 fca,
542 toolconf,
569 toolconf,
543 files,
570 files,
544 labels=None,
571 labels=None,
545 localorother=None,
572 localorother=None,
546 ):
573 ):
547 """
574 """
548 Generic driver for _imergelocal and _imergeother
575 Generic driver for _imergelocal and _imergeother
549 """
576 """
550 assert localorother is not None
577 assert localorother is not None
551 r = simplemerge.simplemerge(
578 r = simplemerge.simplemerge(
552 repo.ui, fcd, fca, fco, label=labels, localorother=localorother
579 repo.ui, fcd, fca, fco, label=labels, localorother=localorother
553 )
580 )
554 return True, r
581 return True, r
555
582
556
583
557 @internaltool(b'merge-local', mergeonly, precheck=_mergecheck)
584 @internaltool(b'merge-local', mergeonly, precheck=_mergecheck)
558 def _imergelocal(*args, **kwargs):
585 def _imergelocal(*args, **kwargs):
559 """
586 """
560 Like :merge, but resolve all conflicts non-interactively in favor
587 Like :merge, but resolve all conflicts non-interactively in favor
561 of the local `p1()` changes."""
588 of the local `p1()` changes."""
562 success, status = _imergeauto(localorother=b'local', *args, **kwargs)
589 success, status = _imergeauto(localorother=b'local', *args, **kwargs)
563 return success, status, False
590 return success, status, False
564
591
565
592
566 @internaltool(b'merge-other', mergeonly, precheck=_mergecheck)
593 @internaltool(b'merge-other', mergeonly, precheck=_mergecheck)
567 def _imergeother(*args, **kwargs):
594 def _imergeother(*args, **kwargs):
568 """
595 """
569 Like :merge, but resolve all conflicts non-interactively in favor
596 Like :merge, but resolve all conflicts non-interactively in favor
570 of the other `p2()` changes."""
597 of the other `p2()` changes."""
571 success, status = _imergeauto(localorother=b'other', *args, **kwargs)
598 success, status = _imergeauto(localorother=b'other', *args, **kwargs)
572 return success, status, False
599 return success, status, False
573
600
574
601
575 @internaltool(
602 @internaltool(
576 b'tagmerge',
603 b'tagmerge',
577 mergeonly,
604 mergeonly,
578 _(
605 _(
579 b"automatic tag merging of %s failed! "
606 b"automatic tag merging of %s failed! "
580 b"(use 'hg resolve --tool :merge' or another merge "
607 b"(use 'hg resolve --tool :merge' or another merge "
581 b"tool of your choice)\n"
608 b"tool of your choice)\n"
582 ),
609 ),
583 )
610 )
584 def _itagmerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
611 def _itagmerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
585 """
612 """
586 Uses the internal tag merge algorithm (experimental).
613 Uses the internal tag merge algorithm (experimental).
587 """
614 """
588 success, status = tagmerge.merge(repo, fcd, fco, fca)
615 success, status = tagmerge.merge(repo, fcd, fco, fca)
589 return success, status, False
616 return success, status, False
590
617
591
618
592 @internaltool(b'dump', fullmerge, binary=True, symlink=True)
619 @internaltool(b'dump', fullmerge, binary=True, symlink=True)
593 def _idump(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
620 def _idump(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
594 """
621 """
595 Creates three versions of the files to merge, containing the
622 Creates three versions of the files to merge, containing the
596 contents of local, other and base. These files can then be used to
623 contents of local, other and base. These files can then be used to
597 perform a merge manually. If the file to be merged is named
624 perform a merge manually. If the file to be merged is named
598 ``a.txt``, these files will accordingly be named ``a.txt.local``,
625 ``a.txt``, these files will accordingly be named ``a.txt.local``,
599 ``a.txt.other`` and ``a.txt.base`` and they will be placed in the
626 ``a.txt.other`` and ``a.txt.base`` and they will be placed in the
600 same directory as ``a.txt``.
627 same directory as ``a.txt``.
601
628
602 This implies premerge. Therefore, files aren't dumped, if premerge
629 This implies premerge. Therefore, files aren't dumped, if premerge
603 runs successfully. Use :forcedump to forcibly write files out.
630 runs successfully. Use :forcedump to forcibly write files out.
604 """
631 """
605 a = _workingpath(repo, fcd)
632 a = _workingpath(repo, fcd)
606 fd = fcd.path()
633 fd = fcd.path()
607
634
608 from . import context
635 from . import context
609
636
610 if isinstance(fcd, context.overlayworkingfilectx):
637 if isinstance(fcd, context.overlayworkingfilectx):
611 raise error.InMemoryMergeConflictsError(
638 raise error.InMemoryMergeConflictsError(
612 b'in-memory merge does not support the :dump tool.'
639 b'in-memory merge does not support the :dump tool.'
613 )
640 )
614
641
615 util.writefile(a + b".local", fcd.decodeddata())
642 util.writefile(a + b".local", fcd.decodeddata())
616 repo.wwrite(fd + b".other", fco.data(), fco.flags())
643 repo.wwrite(fd + b".other", fco.data(), fco.flags())
617 repo.wwrite(fd + b".base", fca.data(), fca.flags())
644 repo.wwrite(fd + b".base", fca.data(), fca.flags())
618 return False, 1, False
645 return False, 1, False
619
646
620
647
621 @internaltool(b'forcedump', mergeonly, binary=True, symlink=True)
648 @internaltool(b'forcedump', mergeonly, binary=True, symlink=True)
622 def _forcedump(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
649 def _forcedump(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
623 """
650 """
624 Creates three versions of the files as same as :dump, but omits premerge.
651 Creates three versions of the files as same as :dump, but omits premerge.
625 """
652 """
626 return _idump(
653 return _idump(
627 repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=labels
654 repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=labels
628 )
655 )
629
656
630
657
631 def _xmergeimm(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
658 def _xmergeimm(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
632 # In-memory merge simply raises an exception on all external merge tools,
659 # In-memory merge simply raises an exception on all external merge tools,
633 # for now.
660 # for now.
634 #
661 #
635 # It would be possible to run most tools with temporary files, but this
662 # It would be possible to run most tools with temporary files, but this
636 # raises the question of what to do if the user only partially resolves the
663 # raises the question of what to do if the user only partially resolves the
637 # file -- we can't leave a merge state. (Copy to somewhere in the .hg/
664 # file -- we can't leave a merge state. (Copy to somewhere in the .hg/
638 # directory and tell the user how to get it is my best idea, but it's
665 # directory and tell the user how to get it is my best idea, but it's
639 # clunky.)
666 # clunky.)
640 raise error.InMemoryMergeConflictsError(
667 raise error.InMemoryMergeConflictsError(
641 b'in-memory merge does not support external merge tools'
668 b'in-memory merge does not support external merge tools'
642 )
669 )
643
670
644
671
645 def _describemerge(ui, repo, mynode, fcl, fcb, fco, env, toolpath, args):
672 def _describemerge(ui, repo, mynode, fcl, fcb, fco, env, toolpath, args):
646 tmpl = ui.config(b'command-templates', b'pre-merge-tool-output')
673 tmpl = ui.config(b'command-templates', b'pre-merge-tool-output')
647 if not tmpl:
674 if not tmpl:
648 return
675 return
649
676
650 mappingdict = templateutil.mappingdict
677 mappingdict = templateutil.mappingdict
651 props = {
678 props = {
652 b'ctx': fcl.changectx(),
679 b'ctx': fcl.changectx(),
653 b'node': hex(mynode),
680 b'node': hex(mynode),
654 b'path': fcl.path(),
681 b'path': fcl.path(),
655 b'local': mappingdict(
682 b'local': mappingdict(
656 {
683 {
657 b'ctx': fcl.changectx(),
684 b'ctx': fcl.changectx(),
658 b'fctx': fcl,
685 b'fctx': fcl,
659 b'node': hex(mynode),
686 b'node': hex(mynode),
660 b'name': _(b'local'),
687 b'name': _(b'local'),
661 b'islink': b'l' in fcl.flags(),
688 b'islink': b'l' in fcl.flags(),
662 b'label': env[b'HG_MY_LABEL'],
689 b'label': env[b'HG_MY_LABEL'],
663 }
690 }
664 ),
691 ),
665 b'base': mappingdict(
692 b'base': mappingdict(
666 {
693 {
667 b'ctx': fcb.changectx(),
694 b'ctx': fcb.changectx(),
668 b'fctx': fcb,
695 b'fctx': fcb,
669 b'name': _(b'base'),
696 b'name': _(b'base'),
670 b'islink': b'l' in fcb.flags(),
697 b'islink': b'l' in fcb.flags(),
671 b'label': env[b'HG_BASE_LABEL'],
698 b'label': env[b'HG_BASE_LABEL'],
672 }
699 }
673 ),
700 ),
674 b'other': mappingdict(
701 b'other': mappingdict(
675 {
702 {
676 b'ctx': fco.changectx(),
703 b'ctx': fco.changectx(),
677 b'fctx': fco,
704 b'fctx': fco,
678 b'name': _(b'other'),
705 b'name': _(b'other'),
679 b'islink': b'l' in fco.flags(),
706 b'islink': b'l' in fco.flags(),
680 b'label': env[b'HG_OTHER_LABEL'],
707 b'label': env[b'HG_OTHER_LABEL'],
681 }
708 }
682 ),
709 ),
683 b'toolpath': toolpath,
710 b'toolpath': toolpath,
684 b'toolargs': args,
711 b'toolargs': args,
685 }
712 }
686
713
687 # TODO: make all of this something that can be specified on a per-tool basis
714 # TODO: make all of this something that can be specified on a per-tool basis
688 tmpl = templater.unquotestring(tmpl)
715 tmpl = templater.unquotestring(tmpl)
689
716
690 # Not using cmdutil.rendertemplate here since it causes errors importing
717 # Not using cmdutil.rendertemplate here since it causes errors importing
691 # things for us to import cmdutil.
718 # things for us to import cmdutil.
692 tres = formatter.templateresources(ui, repo)
719 tres = formatter.templateresources(ui, repo)
693 t = formatter.maketemplater(
720 t = formatter.maketemplater(
694 ui, tmpl, defaults=templatekw.keywords, resources=tres
721 ui, tmpl, defaults=templatekw.keywords, resources=tres
695 )
722 )
696 ui.status(t.renderdefault(props))
723 ui.status(t.renderdefault(props))
697
724
698
725
699 def _xmerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels):
726 def _xmerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels):
700 tool, toolpath, binary, symlink, scriptfn = toolconf
727 tool, toolpath, binary, symlink, scriptfn = toolconf
701 uipathfn = scmutil.getuipathfn(repo)
728 uipathfn = scmutil.getuipathfn(repo)
702 if fcd.isabsent() or fco.isabsent():
729 if fcd.isabsent() or fco.isabsent():
703 repo.ui.warn(
730 repo.ui.warn(
704 _(b'warning: %s cannot merge change/delete conflict for %s\n')
731 _(b'warning: %s cannot merge change/delete conflict for %s\n')
705 % (tool, uipathfn(fcd.path()))
732 % (tool, uipathfn(fcd.path()))
706 )
733 )
707 return False, 1, None
734 return False, 1, None
708 unused, unused, unused, back = files
735 unused, unused, unused, back = files
709 localpath = _workingpath(repo, fcd)
736 localpath = _workingpath(repo, fcd)
710 args = _toolstr(repo.ui, tool, b"args")
737 args = _toolstr(repo.ui, tool, b"args")
711
738
712 with _maketempfiles(
739 with _maketempfiles(
713 repo, fco, fca, repo.wvfs.join(back.path()), b"$output" in args
740 repo, fco, fca, repo.wvfs.join(back.path()), b"$output" in args
714 ) as temppaths:
741 ) as temppaths:
715 basepath, otherpath, localoutputpath = temppaths
742 basepath, otherpath, localoutputpath = temppaths
716 outpath = b""
743 outpath = b""
717 mylabel, otherlabel = labels[:2]
744 mylabel, otherlabel = labels[:2]
718 if len(labels) >= 3:
745 if len(labels) >= 3:
719 baselabel = labels[2]
746 baselabel = labels[2]
720 else:
747 else:
721 baselabel = b'base'
748 baselabel = b'base'
722 env = {
749 env = {
723 b'HG_FILE': fcd.path(),
750 b'HG_FILE': fcd.path(),
724 b'HG_MY_NODE': short(mynode),
751 b'HG_MY_NODE': short(mynode),
725 b'HG_OTHER_NODE': short(fco.changectx().node()),
752 b'HG_OTHER_NODE': short(fco.changectx().node()),
726 b'HG_BASE_NODE': short(fca.changectx().node()),
753 b'HG_BASE_NODE': short(fca.changectx().node()),
727 b'HG_MY_ISLINK': b'l' in fcd.flags(),
754 b'HG_MY_ISLINK': b'l' in fcd.flags(),
728 b'HG_OTHER_ISLINK': b'l' in fco.flags(),
755 b'HG_OTHER_ISLINK': b'l' in fco.flags(),
729 b'HG_BASE_ISLINK': b'l' in fca.flags(),
756 b'HG_BASE_ISLINK': b'l' in fca.flags(),
730 b'HG_MY_LABEL': mylabel,
757 b'HG_MY_LABEL': mylabel,
731 b'HG_OTHER_LABEL': otherlabel,
758 b'HG_OTHER_LABEL': otherlabel,
732 b'HG_BASE_LABEL': baselabel,
759 b'HG_BASE_LABEL': baselabel,
733 }
760 }
734 ui = repo.ui
761 ui = repo.ui
735
762
736 if b"$output" in args:
763 if b"$output" in args:
737 # read input from backup, write to original
764 # read input from backup, write to original
738 outpath = localpath
765 outpath = localpath
739 localpath = localoutputpath
766 localpath = localoutputpath
740 replace = {
767 replace = {
741 b'local': localpath,
768 b'local': localpath,
742 b'base': basepath,
769 b'base': basepath,
743 b'other': otherpath,
770 b'other': otherpath,
744 b'output': outpath,
771 b'output': outpath,
745 b'labellocal': mylabel,
772 b'labellocal': mylabel,
746 b'labelother': otherlabel,
773 b'labelother': otherlabel,
747 b'labelbase': baselabel,
774 b'labelbase': baselabel,
748 }
775 }
749 args = util.interpolate(
776 args = util.interpolate(
750 br'\$',
777 br'\$',
751 replace,
778 replace,
752 args,
779 args,
753 lambda s: procutil.shellquote(util.localpath(s)),
780 lambda s: procutil.shellquote(util.localpath(s)),
754 )
781 )
755 if _toolbool(ui, tool, b"gui"):
782 if _toolbool(ui, tool, b"gui"):
756 repo.ui.status(
783 repo.ui.status(
757 _(b'running merge tool %s for file %s\n')
784 _(b'running merge tool %s for file %s\n')
758 % (tool, uipathfn(fcd.path()))
785 % (tool, uipathfn(fcd.path()))
759 )
786 )
760 if scriptfn is None:
787 if scriptfn is None:
761 cmd = toolpath + b' ' + args
788 cmd = toolpath + b' ' + args
762 repo.ui.debug(b'launching merge tool: %s\n' % cmd)
789 repo.ui.debug(b'launching merge tool: %s\n' % cmd)
763 _describemerge(ui, repo, mynode, fcd, fca, fco, env, toolpath, args)
790 _describemerge(ui, repo, mynode, fcd, fca, fco, env, toolpath, args)
764 r = ui.system(
791 r = ui.system(
765 cmd, cwd=repo.root, environ=env, blockedtag=b'mergetool'
792 cmd, cwd=repo.root, environ=env, blockedtag=b'mergetool'
766 )
793 )
767 else:
794 else:
768 repo.ui.debug(
795 repo.ui.debug(
769 b'launching python merge script: %s:%s\n' % (toolpath, scriptfn)
796 b'launching python merge script: %s:%s\n' % (toolpath, scriptfn)
770 )
797 )
771 r = 0
798 r = 0
772 try:
799 try:
773 # avoid cycle cmdutil->merge->filemerge->extensions->cmdutil
800 # avoid cycle cmdutil->merge->filemerge->extensions->cmdutil
774 from . import extensions
801 from . import extensions
775
802
776 mod = extensions.loadpath(toolpath, b'hgmerge.%s' % tool)
803 mod = extensions.loadpath(toolpath, b'hgmerge.%s' % tool)
777 except Exception:
804 except Exception:
778 raise error.Abort(
805 raise error.Abort(
779 _(b"loading python merge script failed: %s") % toolpath
806 _(b"loading python merge script failed: %s") % toolpath
780 )
807 )
781 mergefn = getattr(mod, scriptfn, None)
808 mergefn = getattr(mod, scriptfn, None)
782 if mergefn is None:
809 if mergefn is None:
783 raise error.Abort(
810 raise error.Abort(
784 _(b"%s does not have function: %s") % (toolpath, scriptfn)
811 _(b"%s does not have function: %s") % (toolpath, scriptfn)
785 )
812 )
786 argslist = procutil.shellsplit(args)
813 argslist = procutil.shellsplit(args)
787 # avoid cycle cmdutil->merge->filemerge->hook->extensions->cmdutil
814 # avoid cycle cmdutil->merge->filemerge->hook->extensions->cmdutil
788 from . import hook
815 from . import hook
789
816
790 ret, raised = hook.pythonhook(
817 ret, raised = hook.pythonhook(
791 ui, repo, b"merge", toolpath, mergefn, {b'args': argslist}, True
818 ui, repo, b"merge", toolpath, mergefn, {b'args': argslist}, True
792 )
819 )
793 if raised:
820 if raised:
794 r = 1
821 r = 1
795 repo.ui.debug(b'merge tool returned: %d\n' % r)
822 repo.ui.debug(b'merge tool returned: %d\n' % r)
796 return True, r, False
823 return True, r, False
797
824
798
825
799 def _formatconflictmarker(ctx, template, label, pad):
826 def _formatconflictmarker(ctx, template, label, pad):
800 """Applies the given template to the ctx, prefixed by the label.
827 """Applies the given template to the ctx, prefixed by the label.
801
828
802 Pad is the minimum width of the label prefix, so that multiple markers
829 Pad is the minimum width of the label prefix, so that multiple markers
803 can have aligned templated parts.
830 can have aligned templated parts.
804 """
831 """
805 if ctx.node() is None:
832 if ctx.node() is None:
806 ctx = ctx.p1()
833 ctx = ctx.p1()
807
834
808 props = {b'ctx': ctx}
835 props = {b'ctx': ctx}
809 templateresult = template.renderdefault(props)
836 templateresult = template.renderdefault(props)
810
837
811 label = (b'%s:' % label).ljust(pad + 1)
838 label = (b'%s:' % label).ljust(pad + 1)
812 mark = b'%s %s' % (label, templateresult)
839 mark = b'%s %s' % (label, templateresult)
813
840
814 if mark:
841 if mark:
815 mark = mark.splitlines()[0] # split for safety
842 mark = mark.splitlines()[0] # split for safety
816
843
817 # 8 for the prefix of conflict marker lines (e.g. '<<<<<<< ')
844 # 8 for the prefix of conflict marker lines (e.g. '<<<<<<< ')
818 return stringutil.ellipsis(mark, 80 - 8)
845 return stringutil.ellipsis(mark, 80 - 8)
819
846
820
847
821 _defaultconflictlabels = [b'local', b'other']
848 _defaultconflictlabels = [b'local', b'other']
822
849
823
850
824 def _formatlabels(repo, fcd, fco, fca, labels, tool=None):
851 def _formatlabels(repo, fcd, fco, fca, labels, tool=None):
825 """Formats the given labels using the conflict marker template.
852 """Formats the given labels using the conflict marker template.
826
853
827 Returns a list of formatted labels.
854 Returns a list of formatted labels.
828 """
855 """
829 cd = fcd.changectx()
856 cd = fcd.changectx()
830 co = fco.changectx()
857 co = fco.changectx()
831 ca = fca.changectx()
858 ca = fca.changectx()
832
859
833 ui = repo.ui
860 ui = repo.ui
834 template = ui.config(b'command-templates', b'mergemarker')
861 template = ui.config(b'command-templates', b'mergemarker')
835 if tool is not None:
862 if tool is not None:
836 template = _toolstr(ui, tool, b'mergemarkertemplate', template)
863 template = _toolstr(ui, tool, b'mergemarkertemplate', template)
837 template = templater.unquotestring(template)
864 template = templater.unquotestring(template)
838 tres = formatter.templateresources(ui, repo)
865 tres = formatter.templateresources(ui, repo)
839 tmpl = formatter.maketemplater(
866 tmpl = formatter.maketemplater(
840 ui, template, defaults=templatekw.keywords, resources=tres
867 ui, template, defaults=templatekw.keywords, resources=tres
841 )
868 )
842
869
843 pad = max(len(l) for l in labels)
870 pad = max(len(l) for l in labels)
844
871
845 newlabels = [
872 newlabels = [
846 _formatconflictmarker(cd, tmpl, labels[0], pad),
873 _formatconflictmarker(cd, tmpl, labels[0], pad),
847 _formatconflictmarker(co, tmpl, labels[1], pad),
874 _formatconflictmarker(co, tmpl, labels[1], pad),
848 ]
875 ]
849 if len(labels) > 2:
876 if len(labels) > 2:
850 newlabels.append(_formatconflictmarker(ca, tmpl, labels[2], pad))
877 newlabels.append(_formatconflictmarker(ca, tmpl, labels[2], pad))
851 return newlabels
878 return newlabels
852
879
853
880
854 def partextras(labels):
881 def partextras(labels):
855 """Return a dictionary of extra labels for use in prompts to the user
882 """Return a dictionary of extra labels for use in prompts to the user
856
883
857 Intended use is in strings of the form "(l)ocal%(l)s".
884 Intended use is in strings of the form "(l)ocal%(l)s".
858 """
885 """
859 if labels is None:
886 if labels is None:
860 return {
887 return {
861 b"l": b"",
888 b"l": b"",
862 b"o": b"",
889 b"o": b"",
863 }
890 }
864
891
865 return {
892 return {
866 b"l": b" [%s]" % labels[0],
893 b"l": b" [%s]" % labels[0],
867 b"o": b" [%s]" % labels[1],
894 b"o": b" [%s]" % labels[1],
868 }
895 }
869
896
870
897
871 def _restorebackup(fcd, back):
898 def _restorebackup(fcd, back):
872 # TODO: Add a workingfilectx.write(otherfilectx) path so we can use
899 # TODO: Add a workingfilectx.write(otherfilectx) path so we can use
873 # util.copy here instead.
900 # util.copy here instead.
874 fcd.write(back.data(), fcd.flags())
901 fcd.write(back.data(), fcd.flags())
875
902
876
903
877 def _makebackup(repo, ui, wctx, fcd, premerge):
904 def _makebackup(repo, ui, wctx, fcd, premerge):
878 """Makes and returns a filectx-like object for ``fcd``'s backup file.
905 """Makes and returns a filectx-like object for ``fcd``'s backup file.
879
906
880 In addition to preserving the user's pre-existing modifications to `fcd`
907 In addition to preserving the user's pre-existing modifications to `fcd`
881 (if any), the backup is used to undo certain premerges, confirm whether a
908 (if any), the backup is used to undo certain premerges, confirm whether a
882 merge changed anything, and determine what line endings the new file should
909 merge changed anything, and determine what line endings the new file should
883 have.
910 have.
884
911
885 Backups only need to be written once (right before the premerge) since their
912 Backups only need to be written once (right before the premerge) since their
886 content doesn't change afterwards.
913 content doesn't change afterwards.
887 """
914 """
888 if fcd.isabsent():
915 if fcd.isabsent():
889 return None
916 return None
890 # TODO: Break this import cycle somehow. (filectx -> ctx -> fileset ->
917 # TODO: Break this import cycle somehow. (filectx -> ctx -> fileset ->
891 # merge -> filemerge). (I suspect the fileset import is the weakest link)
918 # merge -> filemerge). (I suspect the fileset import is the weakest link)
892 from . import context
919 from . import context
893
920
894 back = scmutil.backuppath(ui, repo, fcd.path())
921 back = scmutil.backuppath(ui, repo, fcd.path())
895 inworkingdir = back.startswith(repo.wvfs.base) and not back.startswith(
922 inworkingdir = back.startswith(repo.wvfs.base) and not back.startswith(
896 repo.vfs.base
923 repo.vfs.base
897 )
924 )
898 if isinstance(fcd, context.overlayworkingfilectx) and inworkingdir:
925 if isinstance(fcd, context.overlayworkingfilectx) and inworkingdir:
899 # If the backup file is to be in the working directory, and we're
926 # If the backup file is to be in the working directory, and we're
900 # merging in-memory, we must redirect the backup to the memory context
927 # merging in-memory, we must redirect the backup to the memory context
901 # so we don't disturb the working directory.
928 # so we don't disturb the working directory.
902 relpath = back[len(repo.wvfs.base) + 1 :]
929 relpath = back[len(repo.wvfs.base) + 1 :]
903 if premerge:
930 if premerge:
904 wctx[relpath].write(fcd.data(), fcd.flags())
931 wctx[relpath].write(fcd.data(), fcd.flags())
905 return wctx[relpath]
932 return wctx[relpath]
906 else:
933 else:
907 if premerge:
934 if premerge:
908 # Otherwise, write to wherever path the user specified the backups
935 # Otherwise, write to wherever path the user specified the backups
909 # should go. We still need to switch based on whether the source is
936 # should go. We still need to switch based on whether the source is
910 # in-memory so we can use the fast path of ``util.copy`` if both are
937 # in-memory so we can use the fast path of ``util.copy`` if both are
911 # on disk.
938 # on disk.
912 if isinstance(fcd, context.overlayworkingfilectx):
939 if isinstance(fcd, context.overlayworkingfilectx):
913 util.writefile(back, fcd.data())
940 util.writefile(back, fcd.data())
914 else:
941 else:
915 a = _workingpath(repo, fcd)
942 a = _workingpath(repo, fcd)
916 util.copyfile(a, back)
943 util.copyfile(a, back)
917 # A arbitraryfilectx is returned, so we can run the same functions on
944 # A arbitraryfilectx is returned, so we can run the same functions on
918 # the backup context regardless of where it lives.
945 # the backup context regardless of where it lives.
919 return context.arbitraryfilectx(back, repo=repo)
946 return context.arbitraryfilectx(back, repo=repo)
920
947
921
948
922 @contextlib.contextmanager
949 @contextlib.contextmanager
923 def _maketempfiles(repo, fco, fca, localpath, uselocalpath):
950 def _maketempfiles(repo, fco, fca, localpath, uselocalpath):
924 """Writes out `fco` and `fca` as temporary files, and (if uselocalpath)
951 """Writes out `fco` and `fca` as temporary files, and (if uselocalpath)
925 copies `localpath` to another temporary file, so an external merge tool may
952 copies `localpath` to another temporary file, so an external merge tool may
926 use them.
953 use them.
927 """
954 """
928 tmproot = None
955 tmproot = None
929 tmprootprefix = repo.ui.config(b'experimental', b'mergetempdirprefix')
956 tmprootprefix = repo.ui.config(b'experimental', b'mergetempdirprefix')
930 if tmprootprefix:
957 if tmprootprefix:
931 tmproot = pycompat.mkdtemp(prefix=tmprootprefix)
958 tmproot = pycompat.mkdtemp(prefix=tmprootprefix)
932
959
933 def maketempfrompath(prefix, path):
960 def maketempfrompath(prefix, path):
934 fullbase, ext = os.path.splitext(path)
961 fullbase, ext = os.path.splitext(path)
935 pre = b"%s~%s" % (os.path.basename(fullbase), prefix)
962 pre = b"%s~%s" % (os.path.basename(fullbase), prefix)
936 if tmproot:
963 if tmproot:
937 name = os.path.join(tmproot, pre)
964 name = os.path.join(tmproot, pre)
938 if ext:
965 if ext:
939 name += ext
966 name += ext
940 f = open(name, "wb")
967 f = open(name, "wb")
941 else:
968 else:
942 fd, name = pycompat.mkstemp(prefix=pre + b'.', suffix=ext)
969 fd, name = pycompat.mkstemp(prefix=pre + b'.', suffix=ext)
943 f = os.fdopen(fd, "wb")
970 f = os.fdopen(fd, "wb")
944 return f, name
971 return f, name
945
972
946 def tempfromcontext(prefix, ctx):
973 def tempfromcontext(prefix, ctx):
947 f, name = maketempfrompath(prefix, ctx.path())
974 f, name = maketempfrompath(prefix, ctx.path())
948 data = repo.wwritedata(ctx.path(), ctx.data())
975 data = repo.wwritedata(ctx.path(), ctx.data())
949 f.write(data)
976 f.write(data)
950 f.close()
977 f.close()
951 return name
978 return name
952
979
953 b = tempfromcontext(b"base", fca)
980 b = tempfromcontext(b"base", fca)
954 c = tempfromcontext(b"other", fco)
981 c = tempfromcontext(b"other", fco)
955 d = localpath
982 d = localpath
956 if uselocalpath:
983 if uselocalpath:
957 # We start off with this being the backup filename, so remove the .orig
984 # We start off with this being the backup filename, so remove the .orig
958 # to make syntax-highlighting more likely.
985 # to make syntax-highlighting more likely.
959 if d.endswith(b'.orig'):
986 if d.endswith(b'.orig'):
960 d, _ = os.path.splitext(d)
987 d, _ = os.path.splitext(d)
961 f, d = maketempfrompath(b"local", d)
988 f, d = maketempfrompath(b"local", d)
962 with open(localpath, b'rb') as src:
989 with open(localpath, b'rb') as src:
963 f.write(src.read())
990 f.write(src.read())
964 f.close()
991 f.close()
965
992
966 try:
993 try:
967 yield b, c, d
994 yield b, c, d
968 finally:
995 finally:
969 if tmproot:
996 if tmproot:
970 shutil.rmtree(tmproot)
997 shutil.rmtree(tmproot)
971 else:
998 else:
972 util.unlink(b)
999 util.unlink(b)
973 util.unlink(c)
1000 util.unlink(c)
974 # if not uselocalpath, d is the 'orig'/backup file which we
1001 # if not uselocalpath, d is the 'orig'/backup file which we
975 # shouldn't delete.
1002 # shouldn't delete.
976 if d and uselocalpath:
1003 if d and uselocalpath:
977 util.unlink(d)
1004 util.unlink(d)
978
1005
979
1006
980 def _filemerge(premerge, repo, wctx, mynode, orig, fcd, fco, fca, labels=None):
1007 def _filemerge(premerge, repo, wctx, mynode, orig, fcd, fco, fca, labels=None):
981 """perform a 3-way merge in the working directory
1008 """perform a 3-way merge in the working directory
982
1009
983 premerge = whether this is a premerge
1010 premerge = whether this is a premerge
984 mynode = parent node before merge
1011 mynode = parent node before merge
985 orig = original local filename before merge
1012 orig = original local filename before merge
986 fco = other file context
1013 fco = other file context
987 fca = ancestor file context
1014 fca = ancestor file context
988 fcd = local file context for current/destination file
1015 fcd = local file context for current/destination file
989
1016
990 Returns whether the merge is complete, the return value of the merge, and
1017 Returns whether the merge is complete, the return value of the merge, and
991 a boolean indicating whether the file was deleted from disk."""
1018 a boolean indicating whether the file was deleted from disk."""
992
1019
993 if not fco.cmp(fcd): # files identical?
1020 if not fco.cmp(fcd): # files identical?
994 return True, None, False
1021 return True, None, False
995
1022
996 ui = repo.ui
1023 ui = repo.ui
997 fd = fcd.path()
1024 fd = fcd.path()
998 uipathfn = scmutil.getuipathfn(repo)
1025 uipathfn = scmutil.getuipathfn(repo)
999 fduipath = uipathfn(fd)
1026 fduipath = uipathfn(fd)
1000 binary = fcd.isbinary() or fco.isbinary() or fca.isbinary()
1027 binary = fcd.isbinary() or fco.isbinary() or fca.isbinary()
1001 symlink = b'l' in fcd.flags() + fco.flags()
1028 symlink = b'l' in fcd.flags() + fco.flags()
1002 changedelete = fcd.isabsent() or fco.isabsent()
1029 changedelete = fcd.isabsent() or fco.isabsent()
1003 tool, toolpath = _picktool(repo, ui, fd, binary, symlink, changedelete)
1030 tool, toolpath = _picktool(repo, ui, fd, binary, symlink, changedelete)
1004 scriptfn = None
1031 scriptfn = None
1005 if tool in internals and tool.startswith(b'internal:'):
1032 if tool in internals and tool.startswith(b'internal:'):
1006 # normalize to new-style names (':merge' etc)
1033 # normalize to new-style names (':merge' etc)
1007 tool = tool[len(b'internal') :]
1034 tool = tool[len(b'internal') :]
1008 if toolpath and toolpath.startswith(b'python:'):
1035 if toolpath and toolpath.startswith(b'python:'):
1009 invalidsyntax = False
1036 invalidsyntax = False
1010 if toolpath.count(b':') >= 2:
1037 if toolpath.count(b':') >= 2:
1011 script, scriptfn = toolpath[7:].rsplit(b':', 1)
1038 script, scriptfn = toolpath[7:].rsplit(b':', 1)
1012 if not scriptfn:
1039 if not scriptfn:
1013 invalidsyntax = True
1040 invalidsyntax = True
1014 # missing :callable can lead to spliting on windows drive letter
1041 # missing :callable can lead to spliting on windows drive letter
1015 if b'\\' in scriptfn or b'/' in scriptfn:
1042 if b'\\' in scriptfn or b'/' in scriptfn:
1016 invalidsyntax = True
1043 invalidsyntax = True
1017 else:
1044 else:
1018 invalidsyntax = True
1045 invalidsyntax = True
1019 if invalidsyntax:
1046 if invalidsyntax:
1020 raise error.Abort(_(b"invalid 'python:' syntax: %s") % toolpath)
1047 raise error.Abort(_(b"invalid 'python:' syntax: %s") % toolpath)
1021 toolpath = script
1048 toolpath = script
1022 ui.debug(
1049 ui.debug(
1023 b"picked tool '%s' for %s (binary %s symlink %s changedelete %s)\n"
1050 b"picked tool '%s' for %s (binary %s symlink %s changedelete %s)\n"
1024 % (
1051 % (
1025 tool,
1052 tool,
1026 fduipath,
1053 fduipath,
1027 pycompat.bytestr(binary),
1054 pycompat.bytestr(binary),
1028 pycompat.bytestr(symlink),
1055 pycompat.bytestr(symlink),
1029 pycompat.bytestr(changedelete),
1056 pycompat.bytestr(changedelete),
1030 )
1057 )
1031 )
1058 )
1032
1059
1033 if tool in internals:
1060 if tool in internals:
1034 func = internals[tool]
1061 func = internals[tool]
1035 mergetype = func.mergetype
1062 mergetype = func.mergetype
1036 onfailure = func.onfailure
1063 onfailure = func.onfailure
1037 precheck = func.precheck
1064 precheck = func.precheck
1038 isexternal = False
1065 isexternal = False
1039 else:
1066 else:
1040 if wctx.isinmemory():
1067 if wctx.isinmemory():
1041 func = _xmergeimm
1068 func = _xmergeimm
1042 else:
1069 else:
1043 func = _xmerge
1070 func = _xmerge
1044 mergetype = fullmerge
1071 mergetype = fullmerge
1045 onfailure = _(b"merging %s failed!\n")
1072 onfailure = _(b"merging %s failed!\n")
1046 precheck = None
1073 precheck = None
1047 isexternal = True
1074 isexternal = True
1048
1075
1049 toolconf = tool, toolpath, binary, symlink, scriptfn
1076 toolconf = tool, toolpath, binary, symlink, scriptfn
1050
1077
1051 if mergetype == nomerge:
1078 if mergetype == nomerge:
1052 r, deleted = func(repo, mynode, orig, fcd, fco, fca, toolconf, labels)
1079 r, deleted = func(repo, mynode, orig, fcd, fco, fca, toolconf, labels)
1053 return True, r, deleted
1080 return True, r, deleted
1054
1081
1055 if premerge:
1082 if premerge:
1056 if orig != fco.path():
1083 if orig != fco.path():
1057 ui.status(
1084 ui.status(
1058 _(b"merging %s and %s to %s\n")
1085 _(b"merging %s and %s to %s\n")
1059 % (uipathfn(orig), uipathfn(fco.path()), fduipath)
1086 % (uipathfn(orig), uipathfn(fco.path()), fduipath)
1060 )
1087 )
1061 else:
1088 else:
1062 ui.status(_(b"merging %s\n") % fduipath)
1089 ui.status(_(b"merging %s\n") % fduipath)
1063
1090
1064 ui.debug(b"my %s other %s ancestor %s\n" % (fcd, fco, fca))
1091 ui.debug(b"my %s other %s ancestor %s\n" % (fcd, fco, fca))
1065
1092
1066 if precheck and not precheck(repo, mynode, orig, fcd, fco, fca, toolconf):
1093 if precheck and not precheck(repo, mynode, orig, fcd, fco, fca, toolconf):
1067 if onfailure:
1094 if onfailure:
1068 if wctx.isinmemory():
1095 if wctx.isinmemory():
1069 raise error.InMemoryMergeConflictsError(
1096 raise error.InMemoryMergeConflictsError(
1070 b'in-memory merge does not support merge conflicts'
1097 b'in-memory merge does not support merge conflicts'
1071 )
1098 )
1072 ui.warn(onfailure % fduipath)
1099 ui.warn(onfailure % fduipath)
1073 return True, 1, False
1100 return True, 1, False
1074
1101
1075 back = _makebackup(repo, ui, wctx, fcd, premerge)
1102 back = _makebackup(repo, ui, wctx, fcd, premerge)
1076 files = (None, None, None, back)
1103 files = (None, None, None, back)
1077 r = 1
1104 r = 1
1078 try:
1105 try:
1079 internalmarkerstyle = ui.config(b'ui', b'mergemarkers')
1106 internalmarkerstyle = ui.config(b'ui', b'mergemarkers')
1080 if isexternal:
1107 if isexternal:
1081 markerstyle = _toolstr(ui, tool, b'mergemarkers')
1108 markerstyle = _toolstr(ui, tool, b'mergemarkers')
1082 else:
1109 else:
1083 markerstyle = internalmarkerstyle
1110 markerstyle = internalmarkerstyle
1084
1111
1085 if not labels:
1112 if not labels:
1086 labels = _defaultconflictlabels
1113 labels = _defaultconflictlabels
1087 formattedlabels = labels
1114 formattedlabels = labels
1088 if markerstyle != b'basic':
1115 if markerstyle != b'basic':
1089 formattedlabels = _formatlabels(
1116 formattedlabels = _formatlabels(
1090 repo, fcd, fco, fca, labels, tool=tool
1117 repo, fcd, fco, fca, labels, tool=tool
1091 )
1118 )
1092
1119
1093 if premerge and mergetype == fullmerge:
1120 if premerge and mergetype == fullmerge:
1094 # conflict markers generated by premerge will use 'detailed'
1121 # conflict markers generated by premerge will use 'detailed'
1095 # settings if either ui.mergemarkers or the tool's mergemarkers
1122 # settings if either ui.mergemarkers or the tool's mergemarkers
1096 # setting is 'detailed'. This way tools can have basic labels in
1123 # setting is 'detailed'. This way tools can have basic labels in
1097 # space-constrained areas of the UI, but still get full information
1124 # space-constrained areas of the UI, but still get full information
1098 # in conflict markers if premerge is 'keep' or 'keep-merge3'.
1125 # in conflict markers if premerge is 'keep' or 'keep-merge3'.
1099 premergelabels = labels
1126 premergelabels = labels
1100 labeltool = None
1127 labeltool = None
1101 if markerstyle != b'basic':
1128 if markerstyle != b'basic':
1102 # respect 'tool's mergemarkertemplate (which defaults to
1129 # respect 'tool's mergemarkertemplate (which defaults to
1103 # command-templates.mergemarker)
1130 # command-templates.mergemarker)
1104 labeltool = tool
1131 labeltool = tool
1105 if internalmarkerstyle != b'basic' or markerstyle != b'basic':
1132 if internalmarkerstyle != b'basic' or markerstyle != b'basic':
1106 premergelabels = _formatlabels(
1133 premergelabels = _formatlabels(
1107 repo, fcd, fco, fca, premergelabels, tool=labeltool
1134 repo, fcd, fco, fca, premergelabels, tool=labeltool
1108 )
1135 )
1109
1136
1110 r = _premerge(
1137 r = _premerge(
1111 repo, fcd, fco, fca, toolconf, files, labels=premergelabels
1138 repo, fcd, fco, fca, toolconf, files, labels=premergelabels
1112 )
1139 )
1113 # complete if premerge successful (r is 0)
1140 # complete if premerge successful (r is 0)
1114 return not r, r, False
1141 return not r, r, False
1115
1142
1116 needcheck, r, deleted = func(
1143 needcheck, r, deleted = func(
1117 repo,
1144 repo,
1118 mynode,
1145 mynode,
1119 orig,
1146 orig,
1120 fcd,
1147 fcd,
1121 fco,
1148 fco,
1122 fca,
1149 fca,
1123 toolconf,
1150 toolconf,
1124 files,
1151 files,
1125 labels=formattedlabels,
1152 labels=formattedlabels,
1126 )
1153 )
1127
1154
1128 if needcheck:
1155 if needcheck:
1129 r = _check(repo, r, ui, tool, fcd, files)
1156 r = _check(repo, r, ui, tool, fcd, files)
1130
1157
1131 if r:
1158 if r:
1132 if onfailure:
1159 if onfailure:
1133 if wctx.isinmemory():
1160 if wctx.isinmemory():
1134 raise error.InMemoryMergeConflictsError(
1161 raise error.InMemoryMergeConflictsError(
1135 b'in-memory merge '
1162 b'in-memory merge '
1136 b'does not support '
1163 b'does not support '
1137 b'merge conflicts'
1164 b'merge conflicts'
1138 )
1165 )
1139 ui.warn(onfailure % fduipath)
1166 ui.warn(onfailure % fduipath)
1140 _onfilemergefailure(ui)
1167 _onfilemergefailure(ui)
1141
1168
1142 return True, r, deleted
1169 return True, r, deleted
1143 finally:
1170 finally:
1144 if not r and back is not None:
1171 if not r and back is not None:
1145 back.remove()
1172 back.remove()
1146
1173
1147
1174
1148 def _haltmerge():
1175 def _haltmerge():
1149 msg = _(b'merge halted after failed merge (see hg resolve)')
1176 msg = _(b'merge halted after failed merge (see hg resolve)')
1150 raise error.InterventionRequired(msg)
1177 raise error.InterventionRequired(msg)
1151
1178
1152
1179
1153 def _onfilemergefailure(ui):
1180 def _onfilemergefailure(ui):
1154 action = ui.config(b'merge', b'on-failure')
1181 action = ui.config(b'merge', b'on-failure')
1155 if action == b'prompt':
1182 if action == b'prompt':
1156 msg = _(b'continue merge operation (yn)?$$ &Yes $$ &No')
1183 msg = _(b'continue merge operation (yn)?$$ &Yes $$ &No')
1157 if ui.promptchoice(msg, 0) == 1:
1184 if ui.promptchoice(msg, 0) == 1:
1158 _haltmerge()
1185 _haltmerge()
1159 if action == b'halt':
1186 if action == b'halt':
1160 _haltmerge()
1187 _haltmerge()
1161 # default action is 'continue', in which case we neither prompt nor halt
1188 # default action is 'continue', in which case we neither prompt nor halt
1162
1189
1163
1190
1164 def hasconflictmarkers(data):
1191 def hasconflictmarkers(data):
1165 return bool(
1192 return bool(
1166 re.search(b"^(<<<<<<< .*|=======|>>>>>>> .*)$", data, re.MULTILINE)
1193 re.search(b"^(<<<<<<< .*|=======|>>>>>>> .*)$", data, re.MULTILINE)
1167 )
1194 )
1168
1195
1169
1196
1170 def _check(repo, r, ui, tool, fcd, files):
1197 def _check(repo, r, ui, tool, fcd, files):
1171 fd = fcd.path()
1198 fd = fcd.path()
1172 uipathfn = scmutil.getuipathfn(repo)
1199 uipathfn = scmutil.getuipathfn(repo)
1173 unused, unused, unused, back = files
1200 unused, unused, unused, back = files
1174
1201
1175 if not r and (
1202 if not r and (
1176 _toolbool(ui, tool, b"checkconflicts")
1203 _toolbool(ui, tool, b"checkconflicts")
1177 or b'conflicts' in _toollist(ui, tool, b"check")
1204 or b'conflicts' in _toollist(ui, tool, b"check")
1178 ):
1205 ):
1179 if hasconflictmarkers(fcd.data()):
1206 if hasconflictmarkers(fcd.data()):
1180 r = 1
1207 r = 1
1181
1208
1182 checked = False
1209 checked = False
1183 if b'prompt' in _toollist(ui, tool, b"check"):
1210 if b'prompt' in _toollist(ui, tool, b"check"):
1184 checked = True
1211 checked = True
1185 if ui.promptchoice(
1212 if ui.promptchoice(
1186 _(b"was merge of '%s' successful (yn)?$$ &Yes $$ &No")
1213 _(b"was merge of '%s' successful (yn)?$$ &Yes $$ &No")
1187 % uipathfn(fd),
1214 % uipathfn(fd),
1188 1,
1215 1,
1189 ):
1216 ):
1190 r = 1
1217 r = 1
1191
1218
1192 if (
1219 if (
1193 not r
1220 not r
1194 and not checked
1221 and not checked
1195 and (
1222 and (
1196 _toolbool(ui, tool, b"checkchanged")
1223 _toolbool(ui, tool, b"checkchanged")
1197 or b'changed' in _toollist(ui, tool, b"check")
1224 or b'changed' in _toollist(ui, tool, b"check")
1198 )
1225 )
1199 ):
1226 ):
1200 if back is not None and not fcd.cmp(back):
1227 if back is not None and not fcd.cmp(back):
1201 if ui.promptchoice(
1228 if ui.promptchoice(
1202 _(
1229 _(
1203 b" output file %s appears unchanged\n"
1230 b" output file %s appears unchanged\n"
1204 b"was merge successful (yn)?"
1231 b"was merge successful (yn)?"
1205 b"$$ &Yes $$ &No"
1232 b"$$ &Yes $$ &No"
1206 )
1233 )
1207 % uipathfn(fd),
1234 % uipathfn(fd),
1208 1,
1235 1,
1209 ):
1236 ):
1210 r = 1
1237 r = 1
1211
1238
1212 if back is not None and _toolbool(ui, tool, b"fixeol"):
1239 if back is not None and _toolbool(ui, tool, b"fixeol"):
1213 _matcheol(_workingpath(repo, fcd), back)
1240 _matcheol(_workingpath(repo, fcd), back)
1214
1241
1215 return r
1242 return r
1216
1243
1217
1244
1218 def _workingpath(repo, ctx):
1245 def _workingpath(repo, ctx):
1219 return repo.wjoin(ctx.path())
1246 return repo.wjoin(ctx.path())
1220
1247
1221
1248
1222 def premerge(repo, wctx, mynode, orig, fcd, fco, fca, labels=None):
1249 def premerge(repo, wctx, mynode, orig, fcd, fco, fca, labels=None):
1223 return _filemerge(
1250 return _filemerge(
1224 True, repo, wctx, mynode, orig, fcd, fco, fca, labels=labels
1251 True, repo, wctx, mynode, orig, fcd, fco, fca, labels=labels
1225 )
1252 )
1226
1253
1227
1254
1228 def filemerge(repo, wctx, mynode, orig, fcd, fco, fca, labels=None):
1255 def filemerge(repo, wctx, mynode, orig, fcd, fco, fca, labels=None):
1229 return _filemerge(
1256 return _filemerge(
1230 False, repo, wctx, mynode, orig, fcd, fco, fca, labels=labels
1257 False, repo, wctx, mynode, orig, fcd, fco, fca, labels=labels
1231 )
1258 )
1232
1259
1233
1260
1234 def loadinternalmerge(ui, extname, registrarobj):
1261 def loadinternalmerge(ui, extname, registrarobj):
1235 """Load internal merge tool from specified registrarobj"""
1262 """Load internal merge tool from specified registrarobj"""
1236 for name, func in pycompat.iteritems(registrarobj._table):
1263 for name, func in pycompat.iteritems(registrarobj._table):
1237 fullname = b':' + name
1264 fullname = b':' + name
1238 internals[fullname] = func
1265 internals[fullname] = func
1239 internals[b'internal:' + name] = func
1266 internals[b'internal:' + name] = func
1240 internalsdoc[fullname] = func
1267 internalsdoc[fullname] = func
1241
1268
1242 capabilities = sorted([k for k, v in func.capabilities.items() if v])
1269 capabilities = sorted([k for k, v in func.capabilities.items() if v])
1243 if capabilities:
1270 if capabilities:
1244 capdesc = b" (actual capabilities: %s)" % b', '.join(
1271 capdesc = b" (actual capabilities: %s)" % b', '.join(
1245 capabilities
1272 capabilities
1246 )
1273 )
1247 func.__doc__ = func.__doc__ + pycompat.sysstr(b"\n\n%s" % capdesc)
1274 func.__doc__ = func.__doc__ + pycompat.sysstr(b"\n\n%s" % capdesc)
1248
1275
1249 # to put i18n comments into hg.pot for automatically generated texts
1276 # to put i18n comments into hg.pot for automatically generated texts
1250
1277
1251 # i18n: "binary" and "symlink" are keywords
1278 # i18n: "binary" and "symlink" are keywords
1252 # i18n: this text is added automatically
1279 # i18n: this text is added automatically
1253 _(b" (actual capabilities: binary, symlink)")
1280 _(b" (actual capabilities: binary, symlink)")
1254 # i18n: "binary" is keyword
1281 # i18n: "binary" is keyword
1255 # i18n: this text is added automatically
1282 # i18n: this text is added automatically
1256 _(b" (actual capabilities: binary)")
1283 _(b" (actual capabilities: binary)")
1257 # i18n: "symlink" is keyword
1284 # i18n: "symlink" is keyword
1258 # i18n: this text is added automatically
1285 # i18n: this text is added automatically
1259 _(b" (actual capabilities: symlink)")
1286 _(b" (actual capabilities: symlink)")
1260
1287
1261
1288
1262 # load built-in merge tools explicitly to setup internalsdoc
1289 # load built-in merge tools explicitly to setup internalsdoc
1263 loadinternalmerge(None, None, internaltool)
1290 loadinternalmerge(None, None, internaltool)
1264
1291
1265 # tell hggettext to extract docstrings from these functions:
1292 # tell hggettext to extract docstrings from these functions:
1266 i18nfunctions = internals.values()
1293 i18nfunctions = internals.values()
@@ -1,523 +1,591 b''
1 # Copyright (C) 2004, 2005 Canonical Ltd
1 # Copyright (C) 2004, 2005 Canonical Ltd
2 #
2 #
3 # This program is free software; you can redistribute it and/or modify
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
6 # (at your option) any later version.
7 #
7 #
8 # This program is distributed in the hope that it will be useful,
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
11 # GNU General Public License for more details.
12 #
12 #
13 # You should have received a copy of the GNU General Public License
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, see <http://www.gnu.org/licenses/>.
14 # along with this program; if not, see <http://www.gnu.org/licenses/>.
15
15
16 # mbp: "you know that thing where cvs gives you conflict markers?"
16 # mbp: "you know that thing where cvs gives you conflict markers?"
17 # s: "i hate that."
17 # s: "i hate that."
18
18
19 from __future__ import absolute_import
19 from __future__ import absolute_import
20
20
21 from .i18n import _
21 from .i18n import _
22 from . import (
22 from . import (
23 error,
23 error,
24 mdiff,
24 mdiff,
25 node as nodemod,
25 node as nodemod,
26 pycompat,
26 pycompat,
27 util,
27 util,
28 )
28 )
29 from .utils import stringutil
29 from .utils import stringutil
30
30
31
31
32 class CantReprocessAndShowBase(Exception):
32 class CantReprocessAndShowBase(Exception):
33 pass
33 pass
34
34
35
35
36 def intersect(ra, rb):
36 def intersect(ra, rb):
37 """Given two ranges return the range where they intersect or None.
37 """Given two ranges return the range where they intersect or None.
38
38
39 >>> intersect((0, 10), (0, 6))
39 >>> intersect((0, 10), (0, 6))
40 (0, 6)
40 (0, 6)
41 >>> intersect((0, 10), (5, 15))
41 >>> intersect((0, 10), (5, 15))
42 (5, 10)
42 (5, 10)
43 >>> intersect((0, 10), (10, 15))
43 >>> intersect((0, 10), (10, 15))
44 >>> intersect((0, 9), (10, 15))
44 >>> intersect((0, 9), (10, 15))
45 >>> intersect((0, 9), (7, 15))
45 >>> intersect((0, 9), (7, 15))
46 (7, 9)
46 (7, 9)
47 """
47 """
48 assert ra[0] <= ra[1]
48 assert ra[0] <= ra[1]
49 assert rb[0] <= rb[1]
49 assert rb[0] <= rb[1]
50
50
51 sa = max(ra[0], rb[0])
51 sa = max(ra[0], rb[0])
52 sb = min(ra[1], rb[1])
52 sb = min(ra[1], rb[1])
53 if sa < sb:
53 if sa < sb:
54 return sa, sb
54 return sa, sb
55 else:
55 else:
56 return None
56 return None
57
57
58
58
59 def compare_range(a, astart, aend, b, bstart, bend):
59 def compare_range(a, astart, aend, b, bstart, bend):
60 """Compare a[astart:aend] == b[bstart:bend], without slicing."""
60 """Compare a[astart:aend] == b[bstart:bend], without slicing."""
61 if (aend - astart) != (bend - bstart):
61 if (aend - astart) != (bend - bstart):
62 return False
62 return False
63 for ia, ib in zip(
63 for ia, ib in zip(
64 pycompat.xrange(astart, aend), pycompat.xrange(bstart, bend)
64 pycompat.xrange(astart, aend), pycompat.xrange(bstart, bend)
65 ):
65 ):
66 if a[ia] != b[ib]:
66 if a[ia] != b[ib]:
67 return False
67 return False
68 else:
68 else:
69 return True
69 return True
70
70
71
71
72 class Merge3Text(object):
72 class Merge3Text(object):
73 """3-way merge of texts.
73 """3-way merge of texts.
74
74
75 Given strings BASE, OTHER, THIS, tries to produce a combined text
75 Given strings BASE, OTHER, THIS, tries to produce a combined text
76 incorporating the changes from both BASE->OTHER and BASE->THIS."""
76 incorporating the changes from both BASE->OTHER and BASE->THIS."""
77
77
78 def __init__(self, basetext, atext, btext, base=None, a=None, b=None):
78 def __init__(self, basetext, atext, btext, base=None, a=None, b=None):
79 self.basetext = basetext
79 self.basetext = basetext
80 self.atext = atext
80 self.atext = atext
81 self.btext = btext
81 self.btext = btext
82 if base is None:
82 if base is None:
83 base = mdiff.splitnewlines(basetext)
83 base = mdiff.splitnewlines(basetext)
84 if a is None:
84 if a is None:
85 a = mdiff.splitnewlines(atext)
85 a = mdiff.splitnewlines(atext)
86 if b is None:
86 if b is None:
87 b = mdiff.splitnewlines(btext)
87 b = mdiff.splitnewlines(btext)
88 self.base = base
88 self.base = base
89 self.a = a
89 self.a = a
90 self.b = b
90 self.b = b
91
91
92 def merge_lines(
92 def merge_lines(
93 self,
93 self,
94 name_a=None,
94 name_a=None,
95 name_b=None,
95 name_b=None,
96 name_base=None,
96 name_base=None,
97 start_marker=b'<<<<<<<',
97 start_marker=b'<<<<<<<',
98 mid_marker=b'=======',
98 mid_marker=b'=======',
99 end_marker=b'>>>>>>>',
99 end_marker=b'>>>>>>>',
100 base_marker=None,
100 base_marker=None,
101 localorother=None,
101 localorother=None,
102 minimize=False,
102 minimize=False,
103 ):
103 ):
104 """Return merge in cvs-like form."""
104 """Return merge in cvs-like form."""
105 self.conflicts = False
105 self.conflicts = False
106 newline = b'\n'
106 newline = b'\n'
107 if len(self.a) > 0:
107 if len(self.a) > 0:
108 if self.a[0].endswith(b'\r\n'):
108 if self.a[0].endswith(b'\r\n'):
109 newline = b'\r\n'
109 newline = b'\r\n'
110 elif self.a[0].endswith(b'\r'):
110 elif self.a[0].endswith(b'\r'):
111 newline = b'\r'
111 newline = b'\r'
112 if name_a and start_marker:
112 if name_a and start_marker:
113 start_marker = start_marker + b' ' + name_a
113 start_marker = start_marker + b' ' + name_a
114 if name_b and end_marker:
114 if name_b and end_marker:
115 end_marker = end_marker + b' ' + name_b
115 end_marker = end_marker + b' ' + name_b
116 if name_base and base_marker:
116 if name_base and base_marker:
117 base_marker = base_marker + b' ' + name_base
117 base_marker = base_marker + b' ' + name_base
118 merge_regions = self.merge_regions()
118 merge_regions = self.merge_regions()
119 if minimize:
119 if minimize:
120 merge_regions = self.minimize(merge_regions)
120 merge_regions = self.minimize(merge_regions)
121 for t in merge_regions:
121 for t in merge_regions:
122 what = t[0]
122 what = t[0]
123 if what == b'unchanged':
123 if what == b'unchanged':
124 for i in range(t[1], t[2]):
124 for i in range(t[1], t[2]):
125 yield self.base[i]
125 yield self.base[i]
126 elif what == b'a' or what == b'same':
126 elif what == b'a' or what == b'same':
127 for i in range(t[1], t[2]):
127 for i in range(t[1], t[2]):
128 yield self.a[i]
128 yield self.a[i]
129 elif what == b'b':
129 elif what == b'b':
130 for i in range(t[1], t[2]):
130 for i in range(t[1], t[2]):
131 yield self.b[i]
131 yield self.b[i]
132 elif what == b'conflict':
132 elif what == b'conflict':
133 if localorother == b'local':
133 if localorother == b'local':
134 for i in range(t[3], t[4]):
134 for i in range(t[3], t[4]):
135 yield self.a[i]
135 yield self.a[i]
136 elif localorother == b'other':
136 elif localorother == b'other':
137 for i in range(t[5], t[6]):
137 for i in range(t[5], t[6]):
138 yield self.b[i]
138 yield self.b[i]
139 else:
139 else:
140 self.conflicts = True
140 self.conflicts = True
141 if start_marker is not None:
141 if start_marker is not None:
142 yield start_marker + newline
142 yield start_marker + newline
143 for i in range(t[3], t[4]):
143 for i in range(t[3], t[4]):
144 yield self.a[i]
144 yield self.a[i]
145 if base_marker is not None:
145 if base_marker is not None:
146 yield base_marker + newline
146 yield base_marker + newline
147 for i in range(t[1], t[2]):
147 for i in range(t[1], t[2]):
148 yield self.base[i]
148 yield self.base[i]
149 if mid_marker is not None:
149 if mid_marker is not None:
150 yield mid_marker + newline
150 yield mid_marker + newline
151 for i in range(t[5], t[6]):
151 for i in range(t[5], t[6]):
152 yield self.b[i]
152 yield self.b[i]
153 if end_marker is not None:
153 if end_marker is not None:
154 yield end_marker + newline
154 yield end_marker + newline
155 else:
155 else:
156 raise ValueError(what)
156 raise ValueError(what)
157
157
158 def merge_groups(self):
158 def merge_groups(self):
159 """Yield sequence of line groups. Each one is a tuple:
159 """Yield sequence of line groups. Each one is a tuple:
160
160
161 'unchanged', lines
161 'unchanged', lines
162 Lines unchanged from base
162 Lines unchanged from base
163
163
164 'a', lines
164 'a', lines
165 Lines taken from a
165 Lines taken from a
166
166
167 'same', lines
167 'same', lines
168 Lines taken from a (and equal to b)
168 Lines taken from a (and equal to b)
169
169
170 'b', lines
170 'b', lines
171 Lines taken from b
171 Lines taken from b
172
172
173 'conflict', base_lines, a_lines, b_lines
173 'conflict', base_lines, a_lines, b_lines
174 Lines from base were changed to either a or b and conflict.
174 Lines from base were changed to either a or b and conflict.
175 """
175 """
176 for t in self.merge_regions():
176 for t in self.merge_regions():
177 what = t[0]
177 what = t[0]
178 if what == b'unchanged':
178 if what == b'unchanged':
179 yield what, self.base[t[1] : t[2]]
179 yield what, self.base[t[1] : t[2]]
180 elif what == b'a' or what == b'same':
180 elif what == b'a' or what == b'same':
181 yield what, self.a[t[1] : t[2]]
181 yield what, self.a[t[1] : t[2]]
182 elif what == b'b':
182 elif what == b'b':
183 yield what, self.b[t[1] : t[2]]
183 yield what, self.b[t[1] : t[2]]
184 elif what == b'conflict':
184 elif what == b'conflict':
185 yield (
185 yield (
186 what,
186 what,
187 self.base[t[1] : t[2]],
187 self.base[t[1] : t[2]],
188 self.a[t[3] : t[4]],
188 self.a[t[3] : t[4]],
189 self.b[t[5] : t[6]],
189 self.b[t[5] : t[6]],
190 )
190 )
191 else:
191 else:
192 raise ValueError(what)
192 raise ValueError(what)
193
193
194 def merge_regions(self):
194 def merge_regions(self):
195 """Return sequences of matching and conflicting regions.
195 """Return sequences of matching and conflicting regions.
196
196
197 This returns tuples, where the first value says what kind we
197 This returns tuples, where the first value says what kind we
198 have:
198 have:
199
199
200 'unchanged', start, end
200 'unchanged', start, end
201 Take a region of base[start:end]
201 Take a region of base[start:end]
202
202
203 'same', astart, aend
203 'same', astart, aend
204 b and a are different from base but give the same result
204 b and a are different from base but give the same result
205
205
206 'a', start, end
206 'a', start, end
207 Non-clashing insertion from a[start:end]
207 Non-clashing insertion from a[start:end]
208
208
209 'conflict', zstart, zend, astart, aend, bstart, bend
209 'conflict', zstart, zend, astart, aend, bstart, bend
210 Conflict between a and b, with z as common ancestor
210 Conflict between a and b, with z as common ancestor
211
211
212 Method is as follows:
212 Method is as follows:
213
213
214 The two sequences align only on regions which match the base
214 The two sequences align only on regions which match the base
215 and both descendants. These are found by doing a two-way diff
215 and both descendants. These are found by doing a two-way diff
216 of each one against the base, and then finding the
216 of each one against the base, and then finding the
217 intersections between those regions. These "sync regions"
217 intersections between those regions. These "sync regions"
218 are by definition unchanged in both and easily dealt with.
218 are by definition unchanged in both and easily dealt with.
219
219
220 The regions in between can be in any of three cases:
220 The regions in between can be in any of three cases:
221 conflicted, or changed on only one side.
221 conflicted, or changed on only one side.
222 """
222 """
223
223
224 # section a[0:ia] has been disposed of, etc
224 # section a[0:ia] has been disposed of, etc
225 iz = ia = ib = 0
225 iz = ia = ib = 0
226
226
227 for region in self.find_sync_regions():
227 for region in self.find_sync_regions():
228 zmatch, zend, amatch, aend, bmatch, bend = region
228 zmatch, zend, amatch, aend, bmatch, bend = region
229 # print 'match base [%d:%d]' % (zmatch, zend)
229 # print 'match base [%d:%d]' % (zmatch, zend)
230
230
231 matchlen = zend - zmatch
231 matchlen = zend - zmatch
232 assert matchlen >= 0
232 assert matchlen >= 0
233 assert matchlen == (aend - amatch)
233 assert matchlen == (aend - amatch)
234 assert matchlen == (bend - bmatch)
234 assert matchlen == (bend - bmatch)
235
235
236 len_a = amatch - ia
236 len_a = amatch - ia
237 len_b = bmatch - ib
237 len_b = bmatch - ib
238 len_base = zmatch - iz
238 len_base = zmatch - iz
239 assert len_a >= 0
239 assert len_a >= 0
240 assert len_b >= 0
240 assert len_b >= 0
241 assert len_base >= 0
241 assert len_base >= 0
242
242
243 # print 'unmatched a=%d, b=%d' % (len_a, len_b)
243 # print 'unmatched a=%d, b=%d' % (len_a, len_b)
244
244
245 if len_a or len_b:
245 if len_a or len_b:
246 # try to avoid actually slicing the lists
246 # try to avoid actually slicing the lists
247 equal_a = compare_range(
247 equal_a = compare_range(
248 self.a, ia, amatch, self.base, iz, zmatch
248 self.a, ia, amatch, self.base, iz, zmatch
249 )
249 )
250 equal_b = compare_range(
250 equal_b = compare_range(
251 self.b, ib, bmatch, self.base, iz, zmatch
251 self.b, ib, bmatch, self.base, iz, zmatch
252 )
252 )
253 same = compare_range(self.a, ia, amatch, self.b, ib, bmatch)
253 same = compare_range(self.a, ia, amatch, self.b, ib, bmatch)
254
254
255 if same:
255 if same:
256 yield b'same', ia, amatch
256 yield b'same', ia, amatch
257 elif equal_a and not equal_b:
257 elif equal_a and not equal_b:
258 yield b'b', ib, bmatch
258 yield b'b', ib, bmatch
259 elif equal_b and not equal_a:
259 elif equal_b and not equal_a:
260 yield b'a', ia, amatch
260 yield b'a', ia, amatch
261 elif not equal_a and not equal_b:
261 elif not equal_a and not equal_b:
262 yield b'conflict', iz, zmatch, ia, amatch, ib, bmatch
262 yield b'conflict', iz, zmatch, ia, amatch, ib, bmatch
263 else:
263 else:
264 raise AssertionError(b"can't handle a=b=base but unmatched")
264 raise AssertionError(b"can't handle a=b=base but unmatched")
265
265
266 ia = amatch
266 ia = amatch
267 ib = bmatch
267 ib = bmatch
268 iz = zmatch
268 iz = zmatch
269
269
270 # if the same part of the base was deleted on both sides
270 # if the same part of the base was deleted on both sides
271 # that's OK, we can just skip it.
271 # that's OK, we can just skip it.
272
272
273 if matchlen > 0:
273 if matchlen > 0:
274 assert ia == amatch
274 assert ia == amatch
275 assert ib == bmatch
275 assert ib == bmatch
276 assert iz == zmatch
276 assert iz == zmatch
277
277
278 yield b'unchanged', zmatch, zend
278 yield b'unchanged', zmatch, zend
279 iz = zend
279 iz = zend
280 ia = aend
280 ia = aend
281 ib = bend
281 ib = bend
282
282
283 def minimize(self, merge_regions):
283 def minimize(self, merge_regions):
284 """Trim conflict regions of lines where A and B sides match.
284 """Trim conflict regions of lines where A and B sides match.
285
285
286 Lines where both A and B have made the same changes at the beginning
286 Lines where both A and B have made the same changes at the beginning
287 or the end of each merge region are eliminated from the conflict
287 or the end of each merge region are eliminated from the conflict
288 region and are instead considered the same.
288 region and are instead considered the same.
289 """
289 """
290 for region in merge_regions:
290 for region in merge_regions:
291 if region[0] != b"conflict":
291 if region[0] != b"conflict":
292 yield region
292 yield region
293 continue
293 continue
294 # pytype thinks this tuple contains only 3 things, but
294 # pytype thinks this tuple contains only 3 things, but
295 # that's clearly not true because this code successfully
295 # that's clearly not true because this code successfully
296 # executes. It might be wise to rework merge_regions to be
296 # executes. It might be wise to rework merge_regions to be
297 # some kind of attrs type.
297 # some kind of attrs type.
298 (
298 (
299 issue,
299 issue,
300 z1,
300 z1,
301 z2,
301 z2,
302 a1,
302 a1,
303 a2,
303 a2,
304 b1,
304 b1,
305 b2,
305 b2,
306 ) = region # pytype: disable=bad-unpacking
306 ) = region # pytype: disable=bad-unpacking
307 alen = a2 - a1
307 alen = a2 - a1
308 blen = b2 - b1
308 blen = b2 - b1
309
309
310 # find matches at the front
310 # find matches at the front
311 ii = 0
311 ii = 0
312 while (
312 while (
313 ii < alen and ii < blen and self.a[a1 + ii] == self.b[b1 + ii]
313 ii < alen and ii < blen and self.a[a1 + ii] == self.b[b1 + ii]
314 ):
314 ):
315 ii += 1
315 ii += 1
316 startmatches = ii
316 startmatches = ii
317
317
318 # find matches at the end
318 # find matches at the end
319 ii = 0
319 ii = 0
320 while (
320 while (
321 ii < alen
321 ii < alen
322 and ii < blen
322 and ii < blen
323 and self.a[a2 - ii - 1] == self.b[b2 - ii - 1]
323 and self.a[a2 - ii - 1] == self.b[b2 - ii - 1]
324 ):
324 ):
325 ii += 1
325 ii += 1
326 endmatches = ii
326 endmatches = ii
327
327
328 if startmatches > 0:
328 if startmatches > 0:
329 yield b'same', a1, a1 + startmatches
329 yield b'same', a1, a1 + startmatches
330
330
331 yield (
331 yield (
332 b'conflict',
332 b'conflict',
333 z1,
333 z1,
334 z2,
334 z2,
335 a1 + startmatches,
335 a1 + startmatches,
336 a2 - endmatches,
336 a2 - endmatches,
337 b1 + startmatches,
337 b1 + startmatches,
338 b2 - endmatches,
338 b2 - endmatches,
339 )
339 )
340
340
341 if endmatches > 0:
341 if endmatches > 0:
342 yield b'same', a2 - endmatches, a2
342 yield b'same', a2 - endmatches, a2
343
343
344 def find_sync_regions(self):
344 def find_sync_regions(self):
345 """Return a list of sync regions, where both descendants match the base.
345 """Return a list of sync regions, where both descendants match the base.
346
346
347 Generates a list of (base1, base2, a1, a2, b1, b2). There is
347 Generates a list of (base1, base2, a1, a2, b1, b2). There is
348 always a zero-length sync region at the end of all the files.
348 always a zero-length sync region at the end of all the files.
349 """
349 """
350
350
351 ia = ib = 0
351 ia = ib = 0
352 amatches = mdiff.get_matching_blocks(self.basetext, self.atext)
352 amatches = mdiff.get_matching_blocks(self.basetext, self.atext)
353 bmatches = mdiff.get_matching_blocks(self.basetext, self.btext)
353 bmatches = mdiff.get_matching_blocks(self.basetext, self.btext)
354 len_a = len(amatches)
354 len_a = len(amatches)
355 len_b = len(bmatches)
355 len_b = len(bmatches)
356
356
357 sl = []
357 sl = []
358
358
359 while ia < len_a and ib < len_b:
359 while ia < len_a and ib < len_b:
360 abase, amatch, alen = amatches[ia]
360 abase, amatch, alen = amatches[ia]
361 bbase, bmatch, blen = bmatches[ib]
361 bbase, bmatch, blen = bmatches[ib]
362
362
363 # there is an unconflicted block at i; how long does it
363 # there is an unconflicted block at i; how long does it
364 # extend? until whichever one ends earlier.
364 # extend? until whichever one ends earlier.
365 i = intersect((abase, abase + alen), (bbase, bbase + blen))
365 i = intersect((abase, abase + alen), (bbase, bbase + blen))
366 if i:
366 if i:
367 intbase = i[0]
367 intbase = i[0]
368 intend = i[1]
368 intend = i[1]
369 intlen = intend - intbase
369 intlen = intend - intbase
370
370
371 # found a match of base[i[0], i[1]]; this may be less than
371 # found a match of base[i[0], i[1]]; this may be less than
372 # the region that matches in either one
372 # the region that matches in either one
373 assert intlen <= alen
373 assert intlen <= alen
374 assert intlen <= blen
374 assert intlen <= blen
375 assert abase <= intbase
375 assert abase <= intbase
376 assert bbase <= intbase
376 assert bbase <= intbase
377
377
378 asub = amatch + (intbase - abase)
378 asub = amatch + (intbase - abase)
379 bsub = bmatch + (intbase - bbase)
379 bsub = bmatch + (intbase - bbase)
380 aend = asub + intlen
380 aend = asub + intlen
381 bend = bsub + intlen
381 bend = bsub + intlen
382
382
383 assert self.base[intbase:intend] == self.a[asub:aend], (
383 assert self.base[intbase:intend] == self.a[asub:aend], (
384 self.base[intbase:intend],
384 self.base[intbase:intend],
385 self.a[asub:aend],
385 self.a[asub:aend],
386 )
386 )
387
387
388 assert self.base[intbase:intend] == self.b[bsub:bend]
388 assert self.base[intbase:intend] == self.b[bsub:bend]
389
389
390 sl.append((intbase, intend, asub, aend, bsub, bend))
390 sl.append((intbase, intend, asub, aend, bsub, bend))
391
391
392 # advance whichever one ends first in the base text
392 # advance whichever one ends first in the base text
393 if (abase + alen) < (bbase + blen):
393 if (abase + alen) < (bbase + blen):
394 ia += 1
394 ia += 1
395 else:
395 else:
396 ib += 1
396 ib += 1
397
397
398 intbase = len(self.base)
398 intbase = len(self.base)
399 abase = len(self.a)
399 abase = len(self.a)
400 bbase = len(self.b)
400 bbase = len(self.b)
401 sl.append((intbase, intbase, abase, abase, bbase, bbase))
401 sl.append((intbase, intbase, abase, abase, bbase, bbase))
402
402
403 return sl
403 return sl
404
404
405 def find_unconflicted(self):
405 def find_unconflicted(self):
406 """Return a list of ranges in base that are not conflicted."""
406 """Return a list of ranges in base that are not conflicted."""
407 am = mdiff.get_matching_blocks(self.basetext, self.atext)
407 am = mdiff.get_matching_blocks(self.basetext, self.atext)
408 bm = mdiff.get_matching_blocks(self.basetext, self.btext)
408 bm = mdiff.get_matching_blocks(self.basetext, self.btext)
409
409
410 unc = []
410 unc = []
411
411
412 while am and bm:
412 while am and bm:
413 # there is an unconflicted block at i; how long does it
413 # there is an unconflicted block at i; how long does it
414 # extend? until whichever one ends earlier.
414 # extend? until whichever one ends earlier.
415 a1 = am[0][0]
415 a1 = am[0][0]
416 a2 = a1 + am[0][2]
416 a2 = a1 + am[0][2]
417 b1 = bm[0][0]
417 b1 = bm[0][0]
418 b2 = b1 + bm[0][2]
418 b2 = b1 + bm[0][2]
419 i = intersect((a1, a2), (b1, b2))
419 i = intersect((a1, a2), (b1, b2))
420 if i:
420 if i:
421 unc.append(i)
421 unc.append(i)
422
422
423 if a2 < b2:
423 if a2 < b2:
424 del am[0]
424 del am[0]
425 else:
425 else:
426 del bm[0]
426 del bm[0]
427
427
428 return unc
428 return unc
429
429
430
430
431 def _verifytext(text, path, ui, opts):
431 def _verifytext(text, path, ui, opts):
432 """verifies that text is non-binary (unless opts[text] is passed,
432 """verifies that text is non-binary (unless opts[text] is passed,
433 then we just warn)"""
433 then we just warn)"""
434 if stringutil.binary(text):
434 if stringutil.binary(text):
435 msg = _(b"%s looks like a binary file.") % path
435 msg = _(b"%s looks like a binary file.") % path
436 if not opts.get('quiet'):
436 if not opts.get('quiet'):
437 ui.warn(_(b'warning: %s\n') % msg)
437 ui.warn(_(b'warning: %s\n') % msg)
438 if not opts.get('text'):
438 if not opts.get('text'):
439 raise error.Abort(msg)
439 raise error.Abort(msg)
440 return text
440 return text
441
441
442
442
443 def _picklabels(defaults, overrides):
443 def _picklabels(defaults, overrides):
444 if len(overrides) > 3:
444 if len(overrides) > 3:
445 raise error.Abort(_(b"can only specify three labels."))
445 raise error.Abort(_(b"can only specify three labels."))
446 result = defaults[:]
446 result = defaults[:]
447 for i, override in enumerate(overrides):
447 for i, override in enumerate(overrides):
448 result[i] = override
448 result[i] = override
449 return result
449 return result
450
450
451
451
452 def is_not_null(ctx):
452 def is_not_null(ctx):
453 if not util.safehasattr(ctx, "node"):
453 if not util.safehasattr(ctx, "node"):
454 return False
454 return False
455 return ctx.node() != nodemod.nullid
455 return ctx.node() != nodemod.nullid
456
456
457
457
458 def _mergediff(m3, name_a, name_b, name_base):
459 lines = []
460 conflicts = False
461 for group in m3.merge_groups():
462 if group[0] == b'conflict':
463 base_lines, a_lines, b_lines = group[1:]
464 base_text = b''.join(base_lines)
465 b_blocks = list(
466 mdiff.allblocks(
467 base_text,
468 b''.join(b_lines),
469 lines1=base_lines,
470 lines2=b_lines,
471 )
472 )
473 a_blocks = list(
474 mdiff.allblocks(
475 base_text,
476 b''.join(a_lines),
477 lines1=base_lines,
478 lines2=b_lines,
479 )
480 )
481
482 def matching_lines(blocks):
483 return sum(
484 block[1] - block[0]
485 for block, kind in blocks
486 if kind == b'='
487 )
488
489 def diff_lines(blocks, lines1, lines2):
490 for block, kind in blocks:
491 if kind == b'=':
492 for line in lines1[block[0] : block[1]]:
493 yield b' ' + line
494 else:
495 for line in lines1[block[0] : block[1]]:
496 yield b'-' + line
497 for line in lines2[block[2] : block[3]]:
498 yield b'+' + line
499
500 lines.append(b"<<<<<<<\n")
501 if matching_lines(a_blocks) < matching_lines(b_blocks):
502 lines.append(b"======= %s\n" % name_a)
503 lines.extend(a_lines)
504 lines.append(b"------- %s\n" % name_base)
505 lines.append(b"+++++++ %s\n" % name_b)
506 lines.extend(diff_lines(b_blocks, base_lines, b_lines))
507 else:
508 lines.append(b"------- %s\n" % name_base)
509 lines.append(b"+++++++ %s\n" % name_a)
510 lines.extend(diff_lines(a_blocks, base_lines, a_lines))
511 lines.append(b"======= %s\n" % name_b)
512 lines.extend(b_lines)
513 lines.append(b">>>>>>>\n")
514 conflicts = True
515 else:
516 lines.extend(group[1])
517 return lines, conflicts
518
519
458 def simplemerge(ui, localctx, basectx, otherctx, **opts):
520 def simplemerge(ui, localctx, basectx, otherctx, **opts):
459 """Performs the simplemerge algorithm.
521 """Performs the simplemerge algorithm.
460
522
461 The merged result is written into `localctx`.
523 The merged result is written into `localctx`.
462 """
524 """
463
525
464 def readctx(ctx):
526 def readctx(ctx):
465 # Merges were always run in the working copy before, which means
527 # Merges were always run in the working copy before, which means
466 # they used decoded data, if the user defined any repository
528 # they used decoded data, if the user defined any repository
467 # filters.
529 # filters.
468 #
530 #
469 # Maintain that behavior today for BC, though perhaps in the future
531 # Maintain that behavior today for BC, though perhaps in the future
470 # it'd be worth considering whether merging encoded data (what the
532 # it'd be worth considering whether merging encoded data (what the
471 # repository usually sees) might be more useful.
533 # repository usually sees) might be more useful.
472 return _verifytext(ctx.decodeddata(), ctx.path(), ui, opts)
534 return _verifytext(ctx.decodeddata(), ctx.path(), ui, opts)
473
535
474 mode = opts.get('mode', b'merge')
536 mode = opts.get('mode', b'merge')
475 name_a, name_b, name_base = None, None, None
537 name_a, name_b, name_base = None, None, None
476 if mode != b'union':
538 if mode != b'union':
477 name_a, name_b, name_base = _picklabels(
539 name_a, name_b, name_base = _picklabels(
478 [localctx.path(), otherctx.path(), None], opts.get('label', [])
540 [localctx.path(), otherctx.path(), None], opts.get('label', [])
479 )
541 )
480
542
481 try:
543 try:
482 localtext = readctx(localctx)
544 localtext = readctx(localctx)
483 basetext = readctx(basectx)
545 basetext = readctx(basectx)
484 othertext = readctx(otherctx)
546 othertext = readctx(otherctx)
485 except error.Abort:
547 except error.Abort:
486 return 1
548 return 1
487
549
488 m3 = Merge3Text(basetext, localtext, othertext)
550 m3 = Merge3Text(basetext, localtext, othertext)
489 extrakwargs = {
551 extrakwargs = {
490 b"localorother": opts.get("localorother", None),
552 b"localorother": opts.get("localorother", None),
491 b'minimize': True,
553 b'minimize': True,
492 }
554 }
493 if mode == b'union':
555 if mode == b'union':
494 extrakwargs[b'start_marker'] = None
556 extrakwargs[b'start_marker'] = None
495 extrakwargs[b'mid_marker'] = None
557 extrakwargs[b'mid_marker'] = None
496 extrakwargs[b'end_marker'] = None
558 extrakwargs[b'end_marker'] = None
497 elif name_base is not None:
559 elif name_base is not None:
498 extrakwargs[b'base_marker'] = b'|||||||'
560 extrakwargs[b'base_marker'] = b'|||||||'
499 extrakwargs[b'name_base'] = name_base
561 extrakwargs[b'name_base'] = name_base
500 extrakwargs[b'minimize'] = False
562 extrakwargs[b'minimize'] = False
501
563
502 lines = m3.merge_lines(
564 if mode == b'mergediff':
503 name_a=name_a, name_b=name_b, **pycompat.strkwargs(extrakwargs)
565 lines, conflicts = _mergediff(m3, name_a, name_b, name_base)
504 )
566 else:
567 lines = list(
568 m3.merge_lines(
569 name_a=name_a, name_b=name_b, **pycompat.strkwargs(extrakwargs)
570 )
571 )
572 conflicts = m3.conflicts
505
573
506 # merge flags if necessary
574 # merge flags if necessary
507 flags = localctx.flags()
575 flags = localctx.flags()
508 localflags = set(pycompat.iterbytestr(flags))
576 localflags = set(pycompat.iterbytestr(flags))
509 otherflags = set(pycompat.iterbytestr(otherctx.flags()))
577 otherflags = set(pycompat.iterbytestr(otherctx.flags()))
510 if is_not_null(basectx) and localflags != otherflags:
578 if is_not_null(basectx) and localflags != otherflags:
511 baseflags = set(pycompat.iterbytestr(basectx.flags()))
579 baseflags = set(pycompat.iterbytestr(basectx.flags()))
512 commonflags = localflags & otherflags
580 commonflags = localflags & otherflags
513 addedflags = (localflags ^ otherflags) - baseflags
581 addedflags = (localflags ^ otherflags) - baseflags
514 flags = b''.join(sorted(commonflags | addedflags))
582 flags = b''.join(sorted(commonflags | addedflags))
515
583
516 mergedtext = b''.join(lines)
584 mergedtext = b''.join(lines)
517 if opts.get('print'):
585 if opts.get('print'):
518 ui.fout.write(mergedtext)
586 ui.fout.write(mergedtext)
519 else:
587 else:
520 localctx.write(mergedtext, flags)
588 localctx.write(mergedtext, flags)
521
589
522 if m3.conflicts and not mode == b'union':
590 if conflicts and not mode == b'union':
523 return 1
591 return 1
@@ -1,49 +1,56 b''
1 == New Features ==
1 == New Features ==
2
2
3 * There is a new config section for templates used by hg commands. It
3 * There is a new config section for templates used by hg commands. It
4 is called `[command-templates]`. Some existing config options have
4 is called `[command-templates]`. Some existing config options have
5 been deprecated in favor of config options in the new
5 been deprecated in favor of config options in the new
6 section. These are: `ui.logtemplate` to `command-templates.log`,
6 section. These are: `ui.logtemplate` to `command-templates.log`,
7 `ui.graphnodetemplate` to `command-templates.graphnode`,
7 `ui.graphnodetemplate` to `command-templates.graphnode`,
8 `ui.mergemarkertemplate` to `command-templates.mergemarker`,
8 `ui.mergemarkertemplate` to `command-templates.mergemarker`,
9 `ui.pre-merge-tool-output-template` to
9 `ui.pre-merge-tool-output-template` to
10 `command-templates.pre-merge-tool-output`.
10 `command-templates.pre-merge-tool-output`.
11
11
12 * There is a new set of config options for the template used for the
12 * There is a new set of config options for the template used for the
13 one-line commit summary displayed by various commands, such as `hg
13 one-line commit summary displayed by various commands, such as `hg
14 rebase`. The main one is `command-templates.oneline-summary`. That
14 rebase`. The main one is `command-templates.oneline-summary`. That
15 can be overridden per command with
15 can be overridden per command with
16 `command-templates.oneline-summary.<command>`, where `<command>`
16 `command-templates.oneline-summary.<command>`, where `<command>`
17 can be e.g. `rebase`. As part of this effort, the default format
17 can be e.g. `rebase`. As part of this effort, the default format
18 from `hg rebase` was reorganized a bit.
18 from `hg rebase` was reorganized a bit.
19
19
20 * `hg strip`, from the strip extension, is now a core command, `hg
20 * `hg strip`, from the strip extension, is now a core command, `hg
21 debugstrip`. The extension remains for compatibility.
21 debugstrip`. The extension remains for compatibility.
22
22
23 * `hg diff` now supports `--from <rev>` and `--to <rev>` arguments as
23 * `hg diff` now supports `--from <rev>` and `--to <rev>` arguments as
24 clearer alternatives to `-r <revs>`. `-r <revs>` has been
24 clearer alternatives to `-r <revs>`. `-r <revs>` has been
25 deprecated.
25 deprecated.
26
26
27 * The memory footprint per changeset during pull/unbundle
27 * The memory footprint per changeset during pull/unbundle
28 operations has been further reduced.
28 operations has been further reduced.
29
29
30 * There is a new internal merge tool called `internal:mergediff` (can
31 be set as the value for the `merge` config in the `[ui]`
32 section). It resolves merges the same was as `internal:merge` and
33 `internal:merge3`, but it shows conflicts differently. Instead of
34 showing 2 or 3 snapshots of the conflicting pieces of code, it
35 shows one snapshot and a diff. This may be useful when at least one
36 side of the conflict is similar to the base.
30
37
31 == New Experimental Features ==
38 == New Experimental Features ==
32
39
33 * `experimental.single-head-per-branch:public-changes-only` can be used
40 * `experimental.single-head-per-branch:public-changes-only` can be used
34 restrict the single head check to public revision. This is useful for
41 restrict the single head check to public revision. This is useful for
35 overlay repository that have both a publishing and non-publishing view
42 overlay repository that have both a publishing and non-publishing view
36 of the same storage.
43 of the same storage.
37
44
38
45
39 == Bug Fixes ==
46 == Bug Fixes ==
40
47
41
48
42
49
43 == Backwards Compatibility Changes ==
50 == Backwards Compatibility Changes ==
44
51
45
52
46
53
47 == Internal API Changes ==
54 == Internal API Changes ==
48
55
49
56
@@ -1,348 +1,422 b''
1 $ hg init
1 $ hg init
2 $ cat << EOF > a
2 $ cat << EOF > a
3 > Small Mathematical Series.
3 > Small Mathematical Series.
4 > One
4 > One
5 > Two
5 > Two
6 > Three
6 > Three
7 > Four
7 > Four
8 > Five
8 > Five
9 > Hop we are done.
9 > Hop we are done.
10 > EOF
10 > EOF
11 $ hg add a
11 $ hg add a
12 $ hg commit -m ancestor
12 $ hg commit -m ancestor
13 $ cat << EOF > a
13 $ cat << EOF > a
14 > Small Mathematical Series.
14 > Small Mathematical Series.
15 > 1
15 > 1
16 > 2
16 > 2
17 > 3
17 > 3
18 > 4
18 > 4
19 > 5
19 > 5
20 > Hop we are done.
20 > Hop we are done.
21 > EOF
21 > EOF
22 $ hg commit -m branch1
22 $ hg commit -m branch1
23 $ hg co 0
23 $ hg co 0
24 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
24 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
25 $ cat << EOF > a
25 $ cat << EOF > a
26 > Small Mathematical Series.
26 > Small Mathematical Series.
27 > 1
27 > 1
28 > 2
28 > 2
29 > 3
29 > 3
30 > 6
30 > 6
31 > 8
31 > 8
32 > Hop we are done.
32 > Hop we are done.
33 > EOF
33 > EOF
34 $ hg commit -m branch2
34 $ hg commit -m branch2
35 created new head
35 created new head
36
36
37 $ hg merge 1
37 $ hg merge 1
38 merging a
38 merging a
39 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
39 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
40 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
40 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
41 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
41 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
42 [1]
42 [1]
43
43
44 $ hg id
44 $ hg id
45 618808747361+c0c68e4fe667+ tip
45 618808747361+c0c68e4fe667+ tip
46
46
47 $ echo "[commands]" >> $HGRCPATH
47 $ echo "[commands]" >> $HGRCPATH
48 $ echo "status.verbose=true" >> $HGRCPATH
48 $ echo "status.verbose=true" >> $HGRCPATH
49 $ hg status
49 $ hg status
50 M a
50 M a
51 ? a.orig
51 ? a.orig
52 # The repository is in an unfinished *merge* state.
52 # The repository is in an unfinished *merge* state.
53
53
54 # Unresolved merge conflicts:
54 # Unresolved merge conflicts:
55 #
55 #
56 # a
56 # a
57 #
57 #
58 # To mark files as resolved: hg resolve --mark FILE
58 # To mark files as resolved: hg resolve --mark FILE
59
59
60 # To continue: hg commit
60 # To continue: hg commit
61 # To abort: hg merge --abort
61 # To abort: hg merge --abort
62
62
63 $ hg status -Tjson
63 $ hg status -Tjson
64 [
64 [
65 {
65 {
66 "itemtype": "file",
66 "itemtype": "file",
67 "path": "a",
67 "path": "a",
68 "status": "M",
68 "status": "M",
69 "unresolved": true
69 "unresolved": true
70 },
70 },
71 {
71 {
72 "itemtype": "file",
72 "itemtype": "file",
73 "path": "a.orig",
73 "path": "a.orig",
74 "status": "?"
74 "status": "?"
75 },
75 },
76 {
76 {
77 "itemtype": "morestatus",
77 "itemtype": "morestatus",
78 "unfinished": "merge",
78 "unfinished": "merge",
79 "unfinishedmsg": "To continue: hg commit\nTo abort: hg merge --abort"
79 "unfinishedmsg": "To continue: hg commit\nTo abort: hg merge --abort"
80 }
80 }
81 ]
81 ]
82
82
83 $ hg status -0
83 $ hg status -0
84 M a\x00? a.orig\x00 (no-eol) (esc)
84 M a\x00? a.orig\x00 (no-eol) (esc)
85 $ cat a
85 $ cat a
86 Small Mathematical Series.
86 Small Mathematical Series.
87 1
87 1
88 2
88 2
89 3
89 3
90 <<<<<<< working copy: 618808747361 - test: branch2
90 <<<<<<< working copy: 618808747361 - test: branch2
91 6
91 6
92 8
92 8
93 =======
93 =======
94 4
94 4
95 5
95 5
96 >>>>>>> merge rev: c0c68e4fe667 - test: branch1
96 >>>>>>> merge rev: c0c68e4fe667 - test: branch1
97 Hop we are done.
97 Hop we are done.
98
98
99 $ hg status --config commands.status.verbose=0
99 $ hg status --config commands.status.verbose=0
100 M a
100 M a
101 ? a.orig
101 ? a.orig
102
102
103 Verify custom conflict markers
103 Verify custom conflict markers
104
104
105 $ hg up -q --clean .
105 $ hg up -q --clean .
106 $ cat <<EOF >> .hg/hgrc
106 $ cat <<EOF >> .hg/hgrc
107 > [command-templates]
107 > [command-templates]
108 > mergemarker = '{author} {rev}'
108 > mergemarker = '{author} {rev}'
109 > EOF
109 > EOF
110
110
111 $ hg merge 1
111 $ hg merge 1
112 merging a
112 merging a
113 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
113 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
114 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
114 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
115 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
115 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
116 [1]
116 [1]
117
117
118 $ cat a
118 $ cat a
119 Small Mathematical Series.
119 Small Mathematical Series.
120 1
120 1
121 2
121 2
122 3
122 3
123 <<<<<<< working copy: test 2
123 <<<<<<< working copy: test 2
124 6
124 6
125 8
125 8
126 =======
126 =======
127 4
127 4
128 5
128 5
129 >>>>>>> merge rev: test 1
129 >>>>>>> merge rev: test 1
130 Hop we are done.
130 Hop we are done.
131
131
132 Verify custom conflict markers with legacy config name
132 Verify custom conflict markers with legacy config name
133
133
134 $ hg up -q --clean .
134 $ hg up -q --clean .
135 $ cat <<EOF >> .hg/hgrc
135 $ cat <<EOF >> .hg/hgrc
136 > [ui]
136 > [ui]
137 > mergemarkertemplate = '{author} {rev}'
137 > mergemarkertemplate = '{author} {rev}'
138 > EOF
138 > EOF
139
139
140 $ hg merge 1
140 $ hg merge 1
141 merging a
141 merging a
142 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
142 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
143 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
143 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
144 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
144 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
145 [1]
145 [1]
146
146
147 $ cat a
147 $ cat a
148 Small Mathematical Series.
148 Small Mathematical Series.
149 1
149 1
150 2
150 2
151 3
151 3
152 <<<<<<< working copy: test 2
152 <<<<<<< working copy: test 2
153 6
153 6
154 8
154 8
155 =======
155 =======
156 4
156 4
157 5
157 5
158 >>>>>>> merge rev: test 1
158 >>>>>>> merge rev: test 1
159 Hop we are done.
159 Hop we are done.
160
160
161 Verify line splitting of custom conflict marker which causes multiple lines
161 Verify line splitting of custom conflict marker which causes multiple lines
162
162
163 $ hg up -q --clean .
163 $ hg up -q --clean .
164 $ cat >> .hg/hgrc <<EOF
164 $ cat >> .hg/hgrc <<EOF
165 > [command-templates]
165 > [command-templates]
166 > mergemarker={author} {rev}\nfoo\nbar\nbaz
166 > mergemarker={author} {rev}\nfoo\nbar\nbaz
167 > EOF
167 > EOF
168
168
169 $ hg -q merge 1
169 $ hg -q merge 1
170 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
170 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
171 [1]
171 [1]
172
172
173 $ cat a
173 $ cat a
174 Small Mathematical Series.
174 Small Mathematical Series.
175 1
175 1
176 2
176 2
177 3
177 3
178 <<<<<<< working copy: test 2
178 <<<<<<< working copy: test 2
179 6
179 6
180 8
180 8
181 =======
181 =======
182 4
182 4
183 5
183 5
184 >>>>>>> merge rev: test 1
184 >>>>>>> merge rev: test 1
185 Hop we are done.
185 Hop we are done.
186
186
187 Verify line trimming of custom conflict marker using multi-byte characters
187 Verify line trimming of custom conflict marker using multi-byte characters
188
188
189 $ hg up -q --clean .
189 $ hg up -q --clean .
190 $ "$PYTHON" <<EOF
190 $ "$PYTHON" <<EOF
191 > fp = open('logfile', 'wb')
191 > fp = open('logfile', 'wb')
192 > fp.write(b'12345678901234567890123456789012345678901234567890' +
192 > fp.write(b'12345678901234567890123456789012345678901234567890' +
193 > b'1234567890') # there are 5 more columns for 80 columns
193 > b'1234567890') # there are 5 more columns for 80 columns
194 >
194 >
195 > # 2 x 4 = 8 columns, but 3 x 4 = 12 bytes
195 > # 2 x 4 = 8 columns, but 3 x 4 = 12 bytes
196 > fp.write(u'\u3042\u3044\u3046\u3048'.encode('utf-8'))
196 > fp.write(u'\u3042\u3044\u3046\u3048'.encode('utf-8'))
197 >
197 >
198 > fp.close()
198 > fp.close()
199 > EOF
199 > EOF
200 $ hg add logfile
200 $ hg add logfile
201 $ hg --encoding utf-8 commit --logfile logfile
201 $ hg --encoding utf-8 commit --logfile logfile
202
202
203 $ cat >> .hg/hgrc <<EOF
203 $ cat >> .hg/hgrc <<EOF
204 > [command-templates]
204 > [command-templates]
205 > mergemarker={desc|firstline}
205 > mergemarker={desc|firstline}
206 > EOF
206 > EOF
207
207
208 $ hg -q --encoding utf-8 merge 1
208 $ hg -q --encoding utf-8 merge 1
209 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
209 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
210 [1]
210 [1]
211
211
212 $ cat a
212 $ cat a
213 Small Mathematical Series.
213 Small Mathematical Series.
214 1
214 1
215 2
215 2
216 3
216 3
217 <<<<<<< working copy: 1234567890123456789012345678901234567890123456789012345...
217 <<<<<<< working copy: 1234567890123456789012345678901234567890123456789012345...
218 6
218 6
219 8
219 8
220 =======
220 =======
221 4
221 4
222 5
222 5
223 >>>>>>> merge rev: branch1
223 >>>>>>> merge rev: branch1
224 Hop we are done.
224 Hop we are done.
225
225
226 Verify basic conflict markers
226 Verify basic conflict markers
227
227
228 $ hg up -q --clean 2
228 $ hg up -q --clean 2
229 $ printf "\n[ui]\nmergemarkers=basic\n" >> .hg/hgrc
229 $ printf "\n[ui]\nmergemarkers=basic\n" >> .hg/hgrc
230
230
231 $ hg merge 1
231 $ hg merge 1
232 merging a
232 merging a
233 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
233 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
234 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
234 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
235 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
235 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
236 [1]
236 [1]
237
237
238 $ cat a
238 $ cat a
239 Small Mathematical Series.
239 Small Mathematical Series.
240 1
240 1
241 2
241 2
242 3
242 3
243 <<<<<<< working copy
243 <<<<<<< working copy
244 6
244 6
245 8
245 8
246 =======
246 =======
247 4
247 4
248 5
248 5
249 >>>>>>> merge rev
249 >>>>>>> merge rev
250 Hop we are done.
250 Hop we are done.
251
251
252 internal:merge3
252 internal:merge3
253
253
254 $ hg up -q --clean .
254 $ hg up -q --clean .
255
255
256 $ hg merge 1 --tool internal:merge3
256 $ hg merge 1 --tool internal:merge3
257 merging a
257 merging a
258 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
258 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
259 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
259 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
260 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
260 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
261 [1]
261 [1]
262 $ cat a
262 $ cat a
263 Small Mathematical Series.
263 Small Mathematical Series.
264 <<<<<<< working copy
264 <<<<<<< working copy
265 1
265 1
266 2
266 2
267 3
267 3
268 6
268 6
269 8
269 8
270 ||||||| base
270 ||||||| base
271 One
271 One
272 Two
272 Two
273 Three
273 Three
274 Four
274 Four
275 Five
275 Five
276 =======
276 =======
277 1
277 1
278 2
278 2
279 3
279 3
280 4
280 4
281 5
281 5
282 >>>>>>> merge rev
282 >>>>>>> merge rev
283 Hop we are done.
283 Hop we are done.
284
284
285 internal:mergediff
286
287 $ hg co -C 1
288 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
289 $ cat << EOF > a
290 > Small Mathematical Series.
291 > 1
292 > 2
293 > 3
294 > 4
295 > 4.5
296 > 5
297 > Hop we are done.
298 > EOF
299 $ hg co -m 2 -t internal:mergediff
300 merging a
301 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
302 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
303 use 'hg resolve' to retry unresolved file merges
304 [1]
305 $ cat a
306 Small Mathematical Series.
307 1
308 2
309 3
310 <<<<<<<
311 ------- base
312 +++++++ working copy
313 4
314 +4.5
315 5
316 ======= destination
317 6
318 8
319 >>>>>>>
320 Hop we are done.
321 Test the same thing as above but modify a bit more so we instead get the working
322 copy in full and the diff from base to destination.
323 $ hg co -C 1
324 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
325 $ cat << EOF > a
326 > Small Mathematical Series.
327 > 1
328 > 2
329 > 3.5
330 > 4.5
331 > 5.5
332 > Hop we are done.
333 > EOF
334 $ hg co -m 2 -t internal:mergediff
335 merging a
336 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
337 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
338 use 'hg resolve' to retry unresolved file merges
339 [1]
340 $ cat a
341 Small Mathematical Series.
342 1
343 2
344 <<<<<<<
345 ======= working copy
346 3.5
347 4.5
348 5.5
349 ------- base
350 +++++++ destination
351 3
352 -4
353 -5
354 +6
355 +8
356 >>>>>>>
357 Hop we are done.
358
285 Add some unconflicting changes on each head, to make sure we really
359 Add some unconflicting changes on each head, to make sure we really
286 are merging, unlike :local and :other
360 are merging, unlike :local and :other
287
361
288 $ hg up -C
362 $ hg up -C
289 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
363 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
290 updated to "e0693e20f496: 123456789012345678901234567890123456789012345678901234567890????"
364 updated to "e0693e20f496: 123456789012345678901234567890123456789012345678901234567890????"
291 1 other heads for branch "default"
365 1 other heads for branch "default"
292 $ printf "\n\nEnd of file\n" >> a
366 $ printf "\n\nEnd of file\n" >> a
293 $ hg ci -m "Add some stuff at the end"
367 $ hg ci -m "Add some stuff at the end"
294 $ hg up -r 1
368 $ hg up -r 1
295 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
369 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
296 $ printf "Start of file\n\n\n" > tmp
370 $ printf "Start of file\n\n\n" > tmp
297 $ cat a >> tmp
371 $ cat a >> tmp
298 $ mv tmp a
372 $ mv tmp a
299 $ hg ci -m "Add some stuff at the beginning"
373 $ hg ci -m "Add some stuff at the beginning"
300
374
301 Now test :merge-other and :merge-local
375 Now test :merge-other and :merge-local
302
376
303 $ hg merge
377 $ hg merge
304 merging a
378 merging a
305 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
379 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
306 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
380 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
307 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
381 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
308 [1]
382 [1]
309 $ hg resolve --tool :merge-other a
383 $ hg resolve --tool :merge-other a
310 merging a
384 merging a
311 (no more unresolved files)
385 (no more unresolved files)
312 $ cat a
386 $ cat a
313 Start of file
387 Start of file
314
388
315
389
316 Small Mathematical Series.
390 Small Mathematical Series.
317 1
391 1
318 2
392 2
319 3
393 3
320 6
394 6
321 8
395 8
322 Hop we are done.
396 Hop we are done.
323
397
324
398
325 End of file
399 End of file
326
400
327 $ hg up -C
401 $ hg up -C
328 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
402 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
329 updated to "18b51d585961: Add some stuff at the beginning"
403 updated to "18b51d585961: Add some stuff at the beginning"
330 1 other heads for branch "default"
404 1 other heads for branch "default"
331 $ hg merge --tool :merge-local
405 $ hg merge --tool :merge-local
332 merging a
406 merging a
333 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
407 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
334 (branch merge, don't forget to commit)
408 (branch merge, don't forget to commit)
335 $ cat a
409 $ cat a
336 Start of file
410 Start of file
337
411
338
412
339 Small Mathematical Series.
413 Small Mathematical Series.
340 1
414 1
341 2
415 2
342 3
416 3
343 4
417 4
344 5
418 5
345 Hop we are done.
419 Hop we are done.
346
420
347
421
348 End of file
422 End of file
@@ -1,3924 +1,3931 b''
1 Short help:
1 Short help:
2
2
3 $ hg
3 $ hg
4 Mercurial Distributed SCM
4 Mercurial Distributed SCM
5
5
6 basic commands:
6 basic commands:
7
7
8 add add the specified files on the next commit
8 add add the specified files on the next commit
9 annotate show changeset information by line for each file
9 annotate show changeset information by line for each file
10 clone make a copy of an existing repository
10 clone make a copy of an existing repository
11 commit commit the specified files or all outstanding changes
11 commit commit the specified files or all outstanding changes
12 diff diff repository (or selected files)
12 diff diff repository (or selected files)
13 export dump the header and diffs for one or more changesets
13 export dump the header and diffs for one or more changesets
14 forget forget the specified files on the next commit
14 forget forget the specified files on the next commit
15 init create a new repository in the given directory
15 init create a new repository in the given directory
16 log show revision history of entire repository or files
16 log show revision history of entire repository or files
17 merge merge another revision into working directory
17 merge merge another revision into working directory
18 pull pull changes from the specified source
18 pull pull changes from the specified source
19 push push changes to the specified destination
19 push push changes to the specified destination
20 remove remove the specified files on the next commit
20 remove remove the specified files on the next commit
21 serve start stand-alone webserver
21 serve start stand-alone webserver
22 status show changed files in the working directory
22 status show changed files in the working directory
23 summary summarize working directory state
23 summary summarize working directory state
24 update update working directory (or switch revisions)
24 update update working directory (or switch revisions)
25
25
26 (use 'hg help' for the full list of commands or 'hg -v' for details)
26 (use 'hg help' for the full list of commands or 'hg -v' for details)
27
27
28 $ hg -q
28 $ hg -q
29 add add the specified files on the next commit
29 add add the specified files on the next commit
30 annotate show changeset information by line for each file
30 annotate show changeset information by line for each file
31 clone make a copy of an existing repository
31 clone make a copy of an existing repository
32 commit commit the specified files or all outstanding changes
32 commit commit the specified files or all outstanding changes
33 diff diff repository (or selected files)
33 diff diff repository (or selected files)
34 export dump the header and diffs for one or more changesets
34 export dump the header and diffs for one or more changesets
35 forget forget the specified files on the next commit
35 forget forget the specified files on the next commit
36 init create a new repository in the given directory
36 init create a new repository in the given directory
37 log show revision history of entire repository or files
37 log show revision history of entire repository or files
38 merge merge another revision into working directory
38 merge merge another revision into working directory
39 pull pull changes from the specified source
39 pull pull changes from the specified source
40 push push changes to the specified destination
40 push push changes to the specified destination
41 remove remove the specified files on the next commit
41 remove remove the specified files on the next commit
42 serve start stand-alone webserver
42 serve start stand-alone webserver
43 status show changed files in the working directory
43 status show changed files in the working directory
44 summary summarize working directory state
44 summary summarize working directory state
45 update update working directory (or switch revisions)
45 update update working directory (or switch revisions)
46
46
47 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 Repository creation:
56 Repository creation:
57
57
58 clone make a copy of an existing repository
58 clone make a copy of an existing repository
59 init create a new repository in the given directory
59 init create a new repository in the given directory
60
60
61 Remote repository management:
61 Remote repository management:
62
62
63 incoming show new changesets found in source
63 incoming show new changesets found in source
64 outgoing show changesets not found in the destination
64 outgoing show changesets not found in the destination
65 paths show aliases for remote repositories
65 paths show aliases for remote repositories
66 pull pull changes from the specified source
66 pull pull changes from the specified source
67 push push changes to the specified destination
67 push push changes to the specified destination
68 serve start stand-alone webserver
68 serve start stand-alone webserver
69
69
70 Change creation:
70 Change creation:
71
71
72 commit commit the specified files or all outstanding changes
72 commit commit the specified files or all outstanding changes
73
73
74 Change manipulation:
74 Change manipulation:
75
75
76 backout reverse effect of earlier changeset
76 backout reverse effect of earlier changeset
77 graft copy changes from other branches onto the current branch
77 graft copy changes from other branches onto the current branch
78 merge merge another revision into working directory
78 merge merge another revision into working directory
79
79
80 Change organization:
80 Change organization:
81
81
82 bookmarks create a new bookmark or list existing bookmarks
82 bookmarks create a new bookmark or list existing bookmarks
83 branch set or show the current branch name
83 branch set or show the current branch name
84 branches list repository named branches
84 branches list repository named branches
85 phase set or show the current phase name
85 phase set or show the current phase name
86 tag add one or more tags for the current or given revision
86 tag add one or more tags for the current or given revision
87 tags list repository tags
87 tags list repository tags
88
88
89 File content management:
89 File content management:
90
90
91 annotate show changeset information by line for each file
91 annotate show changeset information by line for each file
92 cat output the current or given revision of files
92 cat output the current or given revision of files
93 copy mark files as copied for the next commit
93 copy mark files as copied for the next commit
94 diff diff repository (or selected files)
94 diff diff repository (or selected files)
95 grep search for a pattern in specified files
95 grep search for a pattern in specified files
96
96
97 Change navigation:
97 Change navigation:
98
98
99 bisect subdivision search of changesets
99 bisect subdivision search of changesets
100 heads show branch heads
100 heads show branch heads
101 identify identify the working directory or specified revision
101 identify identify the working directory or specified revision
102 log show revision history of entire repository or files
102 log show revision history of entire repository or files
103
103
104 Working directory management:
104 Working directory management:
105
105
106 add add the specified files on the next commit
106 add add the specified files on the next commit
107 addremove add all new files, delete all missing files
107 addremove add all new files, delete all missing files
108 files list tracked files
108 files list tracked files
109 forget forget the specified files on the next commit
109 forget forget the specified files on the next commit
110 remove remove the specified files on the next commit
110 remove remove the specified files on the next commit
111 rename rename files; equivalent of copy + remove
111 rename rename files; equivalent of copy + remove
112 resolve redo merges or set/view the merge status of files
112 resolve redo merges or set/view the merge status of files
113 revert restore files to their checkout state
113 revert restore files to their checkout state
114 root print the root (top) of the current working directory
114 root print the root (top) of the current working directory
115 shelve save and set aside changes from the working directory
115 shelve save and set aside changes from the working directory
116 status show changed files in the working directory
116 status show changed files in the working directory
117 summary summarize working directory state
117 summary summarize working directory state
118 unshelve restore a shelved change to the working directory
118 unshelve restore a shelved change to the working directory
119 update update working directory (or switch revisions)
119 update update working directory (or switch revisions)
120
120
121 Change import/export:
121 Change import/export:
122
122
123 archive create an unversioned archive of a repository revision
123 archive create an unversioned archive of a repository revision
124 bundle create a bundle file
124 bundle create a bundle file
125 export dump the header and diffs for one or more changesets
125 export dump the header and diffs for one or more changesets
126 import import an ordered set of patches
126 import import an ordered set of patches
127 unbundle apply one or more bundle files
127 unbundle apply one or more bundle files
128
128
129 Repository maintenance:
129 Repository maintenance:
130
130
131 manifest output the current or given revision of the project manifest
131 manifest output the current or given revision of the project manifest
132 recover roll back an interrupted transaction
132 recover roll back an interrupted transaction
133 verify verify the integrity of the repository
133 verify verify the integrity of the repository
134
134
135 Help:
135 Help:
136
136
137 config show combined config settings from all hgrc files
137 config show combined config settings from all hgrc files
138 help show help for a given topic or a help overview
138 help show help for a given topic or a help overview
139 version output version and copyright information
139 version output version and copyright information
140
140
141 additional help topics:
141 additional help topics:
142
142
143 Mercurial identifiers:
143 Mercurial identifiers:
144
144
145 filesets Specifying File Sets
145 filesets Specifying File Sets
146 hgignore Syntax for Mercurial Ignore Files
146 hgignore Syntax for Mercurial Ignore Files
147 patterns File Name Patterns
147 patterns File Name Patterns
148 revisions Specifying Revisions
148 revisions Specifying Revisions
149 urls URL Paths
149 urls URL Paths
150
150
151 Mercurial output:
151 Mercurial output:
152
152
153 color Colorizing Outputs
153 color Colorizing Outputs
154 dates Date Formats
154 dates Date Formats
155 diffs Diff Formats
155 diffs Diff Formats
156 templating Template Usage
156 templating Template Usage
157
157
158 Mercurial configuration:
158 Mercurial configuration:
159
159
160 config Configuration Files
160 config Configuration Files
161 environment Environment Variables
161 environment Environment Variables
162 extensions Using Additional Features
162 extensions Using Additional Features
163 flags Command-line flags
163 flags Command-line flags
164 hgweb Configuring hgweb
164 hgweb Configuring hgweb
165 merge-tools Merge Tools
165 merge-tools Merge Tools
166 pager Pager Support
166 pager Pager Support
167
167
168 Concepts:
168 Concepts:
169
169
170 bundlespec Bundle File Formats
170 bundlespec Bundle File Formats
171 glossary Glossary
171 glossary Glossary
172 phases Working with Phases
172 phases Working with Phases
173 subrepos Subrepositories
173 subrepos Subrepositories
174
174
175 Miscellaneous:
175 Miscellaneous:
176
176
177 deprecated Deprecated Features
177 deprecated Deprecated Features
178 internals Technical implementation topics
178 internals Technical implementation topics
179 scripting Using Mercurial from scripts and automation
179 scripting Using Mercurial from scripts and automation
180
180
181 (use 'hg help -v' to show built-in aliases and global options)
181 (use 'hg help -v' to show built-in aliases and global options)
182
182
183 $ hg -q help
183 $ hg -q help
184 Repository creation:
184 Repository creation:
185
185
186 clone make a copy of an existing repository
186 clone make a copy of an existing repository
187 init create a new repository in the given directory
187 init create a new repository in the given directory
188
188
189 Remote repository management:
189 Remote repository management:
190
190
191 incoming show new changesets found in source
191 incoming show new changesets found in source
192 outgoing show changesets not found in the destination
192 outgoing show changesets not found in the destination
193 paths show aliases for remote repositories
193 paths show aliases for remote repositories
194 pull pull changes from the specified source
194 pull pull changes from the specified source
195 push push changes to the specified destination
195 push push changes to the specified destination
196 serve start stand-alone webserver
196 serve start stand-alone webserver
197
197
198 Change creation:
198 Change creation:
199
199
200 commit commit the specified files or all outstanding changes
200 commit commit the specified files or all outstanding changes
201
201
202 Change manipulation:
202 Change manipulation:
203
203
204 backout reverse effect of earlier changeset
204 backout reverse effect of earlier changeset
205 graft copy changes from other branches onto the current branch
205 graft copy changes from other branches onto the current branch
206 merge merge another revision into working directory
206 merge merge another revision into working directory
207
207
208 Change organization:
208 Change organization:
209
209
210 bookmarks create a new bookmark or list existing bookmarks
210 bookmarks create a new bookmark or list existing bookmarks
211 branch set or show the current branch name
211 branch set or show the current branch name
212 branches list repository named branches
212 branches list repository named branches
213 phase set or show the current phase name
213 phase set or show the current phase name
214 tag add one or more tags for the current or given revision
214 tag add one or more tags for the current or given revision
215 tags list repository tags
215 tags list repository tags
216
216
217 File content management:
217 File content management:
218
218
219 annotate show changeset information by line for each file
219 annotate show changeset information by line for each file
220 cat output the current or given revision of files
220 cat output the current or given revision of files
221 copy mark files as copied for the next commit
221 copy mark files as copied for the next commit
222 diff diff repository (or selected files)
222 diff diff repository (or selected files)
223 grep search for a pattern in specified files
223 grep search for a pattern in specified files
224
224
225 Change navigation:
225 Change navigation:
226
226
227 bisect subdivision search of changesets
227 bisect subdivision search of changesets
228 heads show branch heads
228 heads show branch heads
229 identify identify the working directory or specified revision
229 identify identify the working directory or specified revision
230 log show revision history of entire repository or files
230 log show revision history of entire repository or files
231
231
232 Working directory management:
232 Working directory management:
233
233
234 add add the specified files on the next commit
234 add add the specified files on the next commit
235 addremove add all new files, delete all missing files
235 addremove add all new files, delete all missing files
236 files list tracked files
236 files list tracked files
237 forget forget the specified files on the next commit
237 forget forget the specified files on the next commit
238 remove remove the specified files on the next commit
238 remove remove the specified files on the next commit
239 rename rename files; equivalent of copy + remove
239 rename rename files; equivalent of copy + remove
240 resolve redo merges or set/view the merge status of files
240 resolve redo merges or set/view the merge status of files
241 revert restore files to their checkout state
241 revert restore files to their checkout state
242 root print the root (top) of the current working directory
242 root print the root (top) of the current working directory
243 shelve save and set aside changes from the working directory
243 shelve save and set aside changes from the working directory
244 status show changed files in the working directory
244 status show changed files in the working directory
245 summary summarize working directory state
245 summary summarize working directory state
246 unshelve restore a shelved change to the working directory
246 unshelve restore a shelved change to the working directory
247 update update working directory (or switch revisions)
247 update update working directory (or switch revisions)
248
248
249 Change import/export:
249 Change import/export:
250
250
251 archive create an unversioned archive of a repository revision
251 archive create an unversioned archive of a repository revision
252 bundle create a bundle file
252 bundle create a bundle file
253 export dump the header and diffs for one or more changesets
253 export dump the header and diffs for one or more changesets
254 import import an ordered set of patches
254 import import an ordered set of patches
255 unbundle apply one or more bundle files
255 unbundle apply one or more bundle files
256
256
257 Repository maintenance:
257 Repository maintenance:
258
258
259 manifest output the current or given revision of the project manifest
259 manifest output the current or given revision of the project manifest
260 recover roll back an interrupted transaction
260 recover roll back an interrupted transaction
261 verify verify the integrity of the repository
261 verify verify the integrity of the repository
262
262
263 Help:
263 Help:
264
264
265 config show combined config settings from all hgrc files
265 config show combined config settings from all hgrc files
266 help show help for a given topic or a help overview
266 help show help for a given topic or a help overview
267 version output version and copyright information
267 version output version and copyright information
268
268
269 additional help topics:
269 additional help topics:
270
270
271 Mercurial identifiers:
271 Mercurial identifiers:
272
272
273 filesets Specifying File Sets
273 filesets Specifying File Sets
274 hgignore Syntax for Mercurial Ignore Files
274 hgignore Syntax for Mercurial Ignore Files
275 patterns File Name Patterns
275 patterns File Name Patterns
276 revisions Specifying Revisions
276 revisions Specifying Revisions
277 urls URL Paths
277 urls URL Paths
278
278
279 Mercurial output:
279 Mercurial output:
280
280
281 color Colorizing Outputs
281 color Colorizing Outputs
282 dates Date Formats
282 dates Date Formats
283 diffs Diff Formats
283 diffs Diff Formats
284 templating Template Usage
284 templating Template Usage
285
285
286 Mercurial configuration:
286 Mercurial configuration:
287
287
288 config Configuration Files
288 config Configuration Files
289 environment Environment Variables
289 environment Environment Variables
290 extensions Using Additional Features
290 extensions Using Additional Features
291 flags Command-line flags
291 flags Command-line flags
292 hgweb Configuring hgweb
292 hgweb Configuring hgweb
293 merge-tools Merge Tools
293 merge-tools Merge Tools
294 pager Pager Support
294 pager Pager Support
295
295
296 Concepts:
296 Concepts:
297
297
298 bundlespec Bundle File Formats
298 bundlespec Bundle File Formats
299 glossary Glossary
299 glossary Glossary
300 phases Working with Phases
300 phases Working with Phases
301 subrepos Subrepositories
301 subrepos Subrepositories
302
302
303 Miscellaneous:
303 Miscellaneous:
304
304
305 deprecated Deprecated Features
305 deprecated Deprecated Features
306 internals Technical implementation topics
306 internals Technical implementation topics
307 scripting Using Mercurial from scripts and automation
307 scripting Using Mercurial from scripts and automation
308
308
309 Test extension help:
309 Test extension help:
310 $ hg help extensions --config extensions.rebase= --config extensions.children=
310 $ hg help extensions --config extensions.rebase= --config extensions.children=
311 Using Additional Features
311 Using Additional Features
312 """""""""""""""""""""""""
312 """""""""""""""""""""""""
313
313
314 Mercurial has the ability to add new features through the use of
314 Mercurial has the ability to add new features through the use of
315 extensions. Extensions may add new commands, add options to existing
315 extensions. Extensions may add new commands, add options to existing
316 commands, change the default behavior of commands, or implement hooks.
316 commands, change the default behavior of commands, or implement hooks.
317
317
318 To enable the "foo" extension, either shipped with Mercurial or in the
318 To enable the "foo" extension, either shipped with Mercurial or in the
319 Python search path, create an entry for it in your configuration file,
319 Python search path, create an entry for it in your configuration file,
320 like this:
320 like this:
321
321
322 [extensions]
322 [extensions]
323 foo =
323 foo =
324
324
325 You may also specify the full path to an extension:
325 You may also specify the full path to an extension:
326
326
327 [extensions]
327 [extensions]
328 myfeature = ~/.hgext/myfeature.py
328 myfeature = ~/.hgext/myfeature.py
329
329
330 See 'hg help config' for more information on configuration files.
330 See 'hg help config' for more information on configuration files.
331
331
332 Extensions are not loaded by default for a variety of reasons: they can
332 Extensions are not loaded by default for a variety of reasons: they can
333 increase startup overhead; they may be meant for advanced usage only; they
333 increase startup overhead; they may be meant for advanced usage only; they
334 may provide potentially dangerous abilities (such as letting you destroy
334 may provide potentially dangerous abilities (such as letting you destroy
335 or modify history); they might not be ready for prime time; or they may
335 or modify history); they might not be ready for prime time; or they may
336 alter some usual behaviors of stock Mercurial. It is thus up to the user
336 alter some usual behaviors of stock Mercurial. It is thus up to the user
337 to activate extensions as needed.
337 to activate extensions as needed.
338
338
339 To explicitly disable an extension enabled in a configuration file of
339 To explicitly disable an extension enabled in a configuration file of
340 broader scope, prepend its path with !:
340 broader scope, prepend its path with !:
341
341
342 [extensions]
342 [extensions]
343 # disabling extension bar residing in /path/to/extension/bar.py
343 # disabling extension bar residing in /path/to/extension/bar.py
344 bar = !/path/to/extension/bar.py
344 bar = !/path/to/extension/bar.py
345 # ditto, but no path was supplied for extension baz
345 # ditto, but no path was supplied for extension baz
346 baz = !
346 baz = !
347
347
348 enabled extensions:
348 enabled extensions:
349
349
350 children command to display child changesets (DEPRECATED)
350 children command to display child changesets (DEPRECATED)
351 rebase command to move sets of revisions to a different ancestor
351 rebase command to move sets of revisions to a different ancestor
352
352
353 disabled extensions:
353 disabled extensions:
354
354
355 acl hooks for controlling repository access
355 acl hooks for controlling repository access
356 blackbox log repository events to a blackbox for debugging
356 blackbox log repository events to a blackbox for debugging
357 bugzilla hooks for integrating with the Bugzilla bug tracker
357 bugzilla hooks for integrating with the Bugzilla bug tracker
358 censor erase file content at a given revision
358 censor erase file content at a given revision
359 churn command to display statistics about repository history
359 churn command to display statistics about repository history
360 clonebundles advertise pre-generated bundles to seed clones
360 clonebundles advertise pre-generated bundles to seed clones
361 closehead close arbitrary heads without checking them out first
361 closehead close arbitrary heads without checking them out first
362 convert import revisions from foreign VCS repositories into
362 convert import revisions from foreign VCS repositories into
363 Mercurial
363 Mercurial
364 eol automatically manage newlines in repository files
364 eol automatically manage newlines in repository files
365 extdiff command to allow external programs to compare revisions
365 extdiff command to allow external programs to compare revisions
366 factotum http authentication with factotum
366 factotum http authentication with factotum
367 fastexport export repositories as git fast-import stream
367 fastexport export repositories as git fast-import stream
368 githelp try mapping git commands to Mercurial commands
368 githelp try mapping git commands to Mercurial commands
369 gpg commands to sign and verify changesets
369 gpg commands to sign and verify changesets
370 hgk browse the repository in a graphical way
370 hgk browse the repository in a graphical way
371 highlight syntax highlighting for hgweb (requires Pygments)
371 highlight syntax highlighting for hgweb (requires Pygments)
372 histedit interactive history editing
372 histedit interactive history editing
373 keyword expand keywords in tracked files
373 keyword expand keywords in tracked files
374 largefiles track large binary files
374 largefiles track large binary files
375 mq manage a stack of patches
375 mq manage a stack of patches
376 notify hooks for sending email push notifications
376 notify hooks for sending email push notifications
377 patchbomb command to send changesets as (a series of) patch emails
377 patchbomb command to send changesets as (a series of) patch emails
378 purge command to delete untracked files from the working
378 purge command to delete untracked files from the working
379 directory
379 directory
380 relink recreates hardlinks between repository clones
380 relink recreates hardlinks between repository clones
381 schemes extend schemes with shortcuts to repository swarms
381 schemes extend schemes with shortcuts to repository swarms
382 share share a common history between several working directories
382 share share a common history between several working directories
383 transplant command to transplant changesets from another branch
383 transplant command to transplant changesets from another branch
384 win32mbcs allow the use of MBCS paths with problematic encodings
384 win32mbcs allow the use of MBCS paths with problematic encodings
385 zeroconf discover and advertise repositories on the local network
385 zeroconf discover and advertise repositories on the local network
386
386
387 #endif
387 #endif
388
388
389 Verify that deprecated extensions are included if --verbose:
389 Verify that deprecated extensions are included if --verbose:
390
390
391 $ hg -v help extensions | grep children
391 $ hg -v help extensions | grep children
392 children command to display child changesets (DEPRECATED)
392 children command to display child changesets (DEPRECATED)
393
393
394 Verify that extension keywords appear in help templates
394 Verify that extension keywords appear in help templates
395
395
396 $ hg help --config extensions.transplant= templating|grep transplant > /dev/null
396 $ hg help --config extensions.transplant= templating|grep transplant > /dev/null
397
397
398 Test short command list with verbose option
398 Test short command list with verbose option
399
399
400 $ hg -v help shortlist
400 $ hg -v help shortlist
401 Mercurial Distributed SCM
401 Mercurial Distributed SCM
402
402
403 basic commands:
403 basic commands:
404
404
405 abort abort an unfinished operation (EXPERIMENTAL)
405 abort abort an unfinished operation (EXPERIMENTAL)
406 add add the specified files on the next commit
406 add add the specified files on the next commit
407 annotate, blame
407 annotate, blame
408 show changeset information by line for each file
408 show changeset information by line for each file
409 clone make a copy of an existing repository
409 clone make a copy of an existing repository
410 commit, ci commit the specified files or all outstanding changes
410 commit, ci commit the specified files or all outstanding changes
411 continue resumes an interrupted operation (EXPERIMENTAL)
411 continue resumes an interrupted operation (EXPERIMENTAL)
412 diff diff repository (or selected files)
412 diff diff repository (or selected files)
413 export dump the header and diffs for one or more changesets
413 export dump the header and diffs for one or more changesets
414 forget forget the specified files on the next commit
414 forget forget the specified files on the next commit
415 init create a new repository in the given directory
415 init create a new repository in the given directory
416 log, history show revision history of entire repository or files
416 log, history show revision history of entire repository or files
417 merge merge another revision into working directory
417 merge merge another revision into working directory
418 pull pull changes from the specified source
418 pull pull changes from the specified source
419 push push changes to the specified destination
419 push push changes to the specified destination
420 remove, rm remove the specified files on the next commit
420 remove, rm remove the specified files on the next commit
421 serve start stand-alone webserver
421 serve start stand-alone webserver
422 status, st show changed files in the working directory
422 status, st show changed files in the working directory
423 summary, sum summarize working directory state
423 summary, sum summarize working directory state
424 update, up, checkout, co
424 update, up, checkout, co
425 update working directory (or switch revisions)
425 update working directory (or switch revisions)
426
426
427 global options ([+] can be repeated):
427 global options ([+] can be repeated):
428
428
429 -R --repository REPO repository root directory or name of overlay bundle
429 -R --repository REPO repository root directory or name of overlay bundle
430 file
430 file
431 --cwd DIR change working directory
431 --cwd DIR change working directory
432 -y --noninteractive do not prompt, automatically pick the first choice for
432 -y --noninteractive do not prompt, automatically pick the first choice for
433 all prompts
433 all prompts
434 -q --quiet suppress output
434 -q --quiet suppress output
435 -v --verbose enable additional output
435 -v --verbose enable additional output
436 --color TYPE when to colorize (boolean, always, auto, never, or
436 --color TYPE when to colorize (boolean, always, auto, never, or
437 debug)
437 debug)
438 --config CONFIG [+] set/override config option (use 'section.name=value')
438 --config CONFIG [+] set/override config option (use 'section.name=value')
439 --debug enable debugging output
439 --debug enable debugging output
440 --debugger start debugger
440 --debugger start debugger
441 --encoding ENCODE set the charset encoding (default: ascii)
441 --encoding ENCODE set the charset encoding (default: ascii)
442 --encodingmode MODE set the charset encoding mode (default: strict)
442 --encodingmode MODE set the charset encoding mode (default: strict)
443 --traceback always print a traceback on exception
443 --traceback always print a traceback on exception
444 --time time how long the command takes
444 --time time how long the command takes
445 --profile print command execution profile
445 --profile print command execution profile
446 --version output version information and exit
446 --version output version information and exit
447 -h --help display help and exit
447 -h --help display help and exit
448 --hidden consider hidden changesets
448 --hidden consider hidden changesets
449 --pager TYPE when to paginate (boolean, always, auto, or never)
449 --pager TYPE when to paginate (boolean, always, auto, or never)
450 (default: auto)
450 (default: auto)
451
451
452 (use 'hg help' for the full list of commands)
452 (use 'hg help' for the full list of commands)
453
453
454 $ hg add -h
454 $ hg add -h
455 hg add [OPTION]... [FILE]...
455 hg add [OPTION]... [FILE]...
456
456
457 add the specified files on the next commit
457 add the specified files on the next commit
458
458
459 Schedule files to be version controlled and added to the repository.
459 Schedule files to be version controlled and added to the repository.
460
460
461 The files will be added to the repository at the next commit. To undo an
461 The files will be added to the repository at the next commit. To undo an
462 add before that, see 'hg forget'.
462 add before that, see 'hg forget'.
463
463
464 If no names are given, add all files to the repository (except files
464 If no names are given, add all files to the repository (except files
465 matching ".hgignore").
465 matching ".hgignore").
466
466
467 Returns 0 if all files are successfully added.
467 Returns 0 if all files are successfully added.
468
468
469 options ([+] can be repeated):
469 options ([+] can be repeated):
470
470
471 -I --include PATTERN [+] include names matching the given patterns
471 -I --include PATTERN [+] include names matching the given patterns
472 -X --exclude PATTERN [+] exclude names matching the given patterns
472 -X --exclude PATTERN [+] exclude names matching the given patterns
473 -S --subrepos recurse into subrepositories
473 -S --subrepos recurse into subrepositories
474 -n --dry-run do not perform actions, just print output
474 -n --dry-run do not perform actions, just print output
475
475
476 (some details hidden, use --verbose to show complete help)
476 (some details hidden, use --verbose to show complete help)
477
477
478 Verbose help for add
478 Verbose help for add
479
479
480 $ hg add -hv
480 $ hg add -hv
481 hg add [OPTION]... [FILE]...
481 hg add [OPTION]... [FILE]...
482
482
483 add the specified files on the next commit
483 add the specified files on the next commit
484
484
485 Schedule files to be version controlled and added to the repository.
485 Schedule files to be version controlled and added to the repository.
486
486
487 The files will be added to the repository at the next commit. To undo an
487 The files will be added to the repository at the next commit. To undo an
488 add before that, see 'hg forget'.
488 add before that, see 'hg forget'.
489
489
490 If no names are given, add all files to the repository (except files
490 If no names are given, add all files to the repository (except files
491 matching ".hgignore").
491 matching ".hgignore").
492
492
493 Examples:
493 Examples:
494
494
495 - New (unknown) files are added automatically by 'hg add':
495 - New (unknown) files are added automatically by 'hg add':
496
496
497 $ ls
497 $ ls
498 foo.c
498 foo.c
499 $ hg status
499 $ hg status
500 ? foo.c
500 ? foo.c
501 $ hg add
501 $ hg add
502 adding foo.c
502 adding foo.c
503 $ hg status
503 $ hg status
504 A foo.c
504 A foo.c
505
505
506 - Specific files to be added can be specified:
506 - Specific files to be added can be specified:
507
507
508 $ ls
508 $ ls
509 bar.c foo.c
509 bar.c foo.c
510 $ hg status
510 $ hg status
511 ? bar.c
511 ? bar.c
512 ? foo.c
512 ? foo.c
513 $ hg add bar.c
513 $ hg add bar.c
514 $ hg status
514 $ hg status
515 A bar.c
515 A bar.c
516 ? foo.c
516 ? foo.c
517
517
518 Returns 0 if all files are successfully added.
518 Returns 0 if all files are successfully added.
519
519
520 options ([+] can be repeated):
520 options ([+] can be repeated):
521
521
522 -I --include PATTERN [+] include names matching the given patterns
522 -I --include PATTERN [+] include names matching the given patterns
523 -X --exclude PATTERN [+] exclude names matching the given patterns
523 -X --exclude PATTERN [+] exclude names matching the given patterns
524 -S --subrepos recurse into subrepositories
524 -S --subrepos recurse into subrepositories
525 -n --dry-run do not perform actions, just print output
525 -n --dry-run do not perform actions, just print output
526
526
527 global options ([+] can be repeated):
527 global options ([+] can be repeated):
528
528
529 -R --repository REPO repository root directory or name of overlay bundle
529 -R --repository REPO repository root directory or name of overlay bundle
530 file
530 file
531 --cwd DIR change working directory
531 --cwd DIR change working directory
532 -y --noninteractive do not prompt, automatically pick the first choice for
532 -y --noninteractive do not prompt, automatically pick the first choice for
533 all prompts
533 all prompts
534 -q --quiet suppress output
534 -q --quiet suppress output
535 -v --verbose enable additional output
535 -v --verbose enable additional output
536 --color TYPE when to colorize (boolean, always, auto, never, or
536 --color TYPE when to colorize (boolean, always, auto, never, or
537 debug)
537 debug)
538 --config CONFIG [+] set/override config option (use 'section.name=value')
538 --config CONFIG [+] set/override config option (use 'section.name=value')
539 --debug enable debugging output
539 --debug enable debugging output
540 --debugger start debugger
540 --debugger start debugger
541 --encoding ENCODE set the charset encoding (default: ascii)
541 --encoding ENCODE set the charset encoding (default: ascii)
542 --encodingmode MODE set the charset encoding mode (default: strict)
542 --encodingmode MODE set the charset encoding mode (default: strict)
543 --traceback always print a traceback on exception
543 --traceback always print a traceback on exception
544 --time time how long the command takes
544 --time time how long the command takes
545 --profile print command execution profile
545 --profile print command execution profile
546 --version output version information and exit
546 --version output version information and exit
547 -h --help display help and exit
547 -h --help display help and exit
548 --hidden consider hidden changesets
548 --hidden consider hidden changesets
549 --pager TYPE when to paginate (boolean, always, auto, or never)
549 --pager TYPE when to paginate (boolean, always, auto, or never)
550 (default: auto)
550 (default: auto)
551
551
552 Test the textwidth config option
552 Test the textwidth config option
553
553
554 $ hg root -h --config ui.textwidth=50
554 $ hg root -h --config ui.textwidth=50
555 hg root
555 hg root
556
556
557 print the root (top) of the current working
557 print the root (top) of the current working
558 directory
558 directory
559
559
560 Print the root directory of the current
560 Print the root directory of the current
561 repository.
561 repository.
562
562
563 Returns 0 on success.
563 Returns 0 on success.
564
564
565 options:
565 options:
566
566
567 -T --template TEMPLATE display with template
567 -T --template TEMPLATE display with template
568
568
569 (some details hidden, use --verbose to show
569 (some details hidden, use --verbose to show
570 complete help)
570 complete help)
571
571
572 Test help option with version option
572 Test help option with version option
573
573
574 $ hg add -h --version
574 $ hg add -h --version
575 Mercurial Distributed SCM (version *) (glob)
575 Mercurial Distributed SCM (version *) (glob)
576 (see https://mercurial-scm.org for more information)
576 (see https://mercurial-scm.org for more information)
577
577
578 Copyright (C) 2005-* Matt Mackall and others (glob)
578 Copyright (C) 2005-* Matt Mackall and others (glob)
579 This is free software; see the source for copying conditions. There is NO
579 This is free software; see the source for copying conditions. There is NO
580 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
580 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
581
581
582 $ hg add --skjdfks
582 $ hg add --skjdfks
583 hg add: option --skjdfks not recognized
583 hg add: option --skjdfks not recognized
584 hg add [OPTION]... [FILE]...
584 hg add [OPTION]... [FILE]...
585
585
586 add the specified files on the next commit
586 add the specified files on the next commit
587
587
588 options ([+] can be repeated):
588 options ([+] can be repeated):
589
589
590 -I --include PATTERN [+] include names matching the given patterns
590 -I --include PATTERN [+] include names matching the given patterns
591 -X --exclude PATTERN [+] exclude names matching the given patterns
591 -X --exclude PATTERN [+] exclude names matching the given patterns
592 -S --subrepos recurse into subrepositories
592 -S --subrepos recurse into subrepositories
593 -n --dry-run do not perform actions, just print output
593 -n --dry-run do not perform actions, just print output
594
594
595 (use 'hg add -h' to show more help)
595 (use 'hg add -h' to show more help)
596 [255]
596 [255]
597
597
598 Test ambiguous command help
598 Test ambiguous command help
599
599
600 $ hg help ad
600 $ hg help ad
601 list of commands:
601 list of commands:
602
602
603 add add the specified files on the next commit
603 add add the specified files on the next commit
604 addremove add all new files, delete all missing files
604 addremove add all new files, delete all missing files
605
605
606 (use 'hg help -v ad' to show built-in aliases and global options)
606 (use 'hg help -v ad' to show built-in aliases and global options)
607
607
608 Test command without options
608 Test command without options
609
609
610 $ hg help verify
610 $ hg help verify
611 hg verify
611 hg verify
612
612
613 verify the integrity of the repository
613 verify the integrity of the repository
614
614
615 Verify the integrity of the current repository.
615 Verify the integrity of the current repository.
616
616
617 This will perform an extensive check of the repository's integrity,
617 This will perform an extensive check of the repository's integrity,
618 validating the hashes and checksums of each entry in the changelog,
618 validating the hashes and checksums of each entry in the changelog,
619 manifest, and tracked files, as well as the integrity of their crosslinks
619 manifest, and tracked files, as well as the integrity of their crosslinks
620 and indices.
620 and indices.
621
621
622 Please see https://mercurial-scm.org/wiki/RepositoryCorruption for more
622 Please see https://mercurial-scm.org/wiki/RepositoryCorruption for more
623 information about recovery from corruption of the repository.
623 information about recovery from corruption of the repository.
624
624
625 Returns 0 on success, 1 if errors are encountered.
625 Returns 0 on success, 1 if errors are encountered.
626
626
627 options:
627 options:
628
628
629 (some details hidden, use --verbose to show complete help)
629 (some details hidden, use --verbose to show complete help)
630
630
631 $ hg help diff
631 $ hg help diff
632 hg diff [OPTION]... ([-c REV] | [--from REV1] [--to REV2]) [FILE]...
632 hg diff [OPTION]... ([-c REV] | [--from REV1] [--to REV2]) [FILE]...
633
633
634 diff repository (or selected files)
634 diff repository (or selected files)
635
635
636 Show differences between revisions for the specified files.
636 Show differences between revisions for the specified files.
637
637
638 Differences between files are shown using the unified diff format.
638 Differences between files are shown using the unified diff format.
639
639
640 Note:
640 Note:
641 'hg diff' may generate unexpected results for merges, as it will
641 'hg diff' may generate unexpected results for merges, as it will
642 default to comparing against the working directory's first parent
642 default to comparing against the working directory's first parent
643 changeset if no revisions are specified.
643 changeset if no revisions are specified.
644
644
645 By default, the working directory files are compared to its first parent.
645 By default, the working directory files are compared to its first parent.
646 To see the differences from another revision, use --from. To see the
646 To see the differences from another revision, use --from. To see the
647 difference to another revision, use --to. For example, 'hg diff --from .^'
647 difference to another revision, use --to. For example, 'hg diff --from .^'
648 will show the differences from the working copy's grandparent to the
648 will show the differences from the working copy's grandparent to the
649 working copy, 'hg diff --to .' will show the diff from the working copy to
649 working copy, 'hg diff --to .' will show the diff from the working copy to
650 its parent (i.e. the reverse of the default), and 'hg diff --from 1.0 --to
650 its parent (i.e. the reverse of the default), and 'hg diff --from 1.0 --to
651 1.2' will show the diff between those two revisions.
651 1.2' will show the diff between those two revisions.
652
652
653 Alternatively you can specify -c/--change with a revision to see the
653 Alternatively you can specify -c/--change with a revision to see the
654 changes in that changeset relative to its first parent (i.e. 'hg diff -c
654 changes in that changeset relative to its first parent (i.e. 'hg diff -c
655 42' is equivalent to 'hg diff --from 42^ --to 42')
655 42' is equivalent to 'hg diff --from 42^ --to 42')
656
656
657 Without the -a/--text option, diff will avoid generating diffs of files it
657 Without the -a/--text option, diff will avoid generating diffs of files it
658 detects as binary. With -a, diff will generate a diff anyway, probably
658 detects as binary. With -a, diff will generate a diff anyway, probably
659 with undesirable results.
659 with undesirable results.
660
660
661 Use the -g/--git option to generate diffs in the git extended diff format.
661 Use the -g/--git option to generate diffs in the git extended diff format.
662 For more information, read 'hg help diffs'.
662 For more information, read 'hg help diffs'.
663
663
664 Returns 0 on success.
664 Returns 0 on success.
665
665
666 options ([+] can be repeated):
666 options ([+] can be repeated):
667
667
668 --from REV1 revision to diff from
668 --from REV1 revision to diff from
669 --to REV2 revision to diff to
669 --to REV2 revision to diff to
670 -c --change REV change made by revision
670 -c --change REV change made by revision
671 -a --text treat all files as text
671 -a --text treat all files as text
672 -g --git use git extended diff format
672 -g --git use git extended diff format
673 --binary generate binary diffs in git mode (default)
673 --binary generate binary diffs in git mode (default)
674 --nodates omit dates from diff headers
674 --nodates omit dates from diff headers
675 --noprefix omit a/ and b/ prefixes from filenames
675 --noprefix omit a/ and b/ prefixes from filenames
676 -p --show-function show which function each change is in
676 -p --show-function show which function each change is in
677 --reverse produce a diff that undoes the changes
677 --reverse produce a diff that undoes the changes
678 -w --ignore-all-space ignore white space when comparing lines
678 -w --ignore-all-space ignore white space when comparing lines
679 -b --ignore-space-change ignore changes in the amount of white space
679 -b --ignore-space-change ignore changes in the amount of white space
680 -B --ignore-blank-lines ignore changes whose lines are all blank
680 -B --ignore-blank-lines ignore changes whose lines are all blank
681 -Z --ignore-space-at-eol ignore changes in whitespace at EOL
681 -Z --ignore-space-at-eol ignore changes in whitespace at EOL
682 -U --unified NUM number of lines of context to show
682 -U --unified NUM number of lines of context to show
683 --stat output diffstat-style summary of changes
683 --stat output diffstat-style summary of changes
684 --root DIR produce diffs relative to subdirectory
684 --root DIR produce diffs relative to subdirectory
685 -I --include PATTERN [+] include names matching the given patterns
685 -I --include PATTERN [+] include names matching the given patterns
686 -X --exclude PATTERN [+] exclude names matching the given patterns
686 -X --exclude PATTERN [+] exclude names matching the given patterns
687 -S --subrepos recurse into subrepositories
687 -S --subrepos recurse into subrepositories
688
688
689 (some details hidden, use --verbose to show complete help)
689 (some details hidden, use --verbose to show complete help)
690
690
691 $ hg help status
691 $ hg help status
692 hg status [OPTION]... [FILE]...
692 hg status [OPTION]... [FILE]...
693
693
694 aliases: st
694 aliases: st
695
695
696 show changed files in the working directory
696 show changed files in the working directory
697
697
698 Show status of files in the repository. If names are given, only files
698 Show status of files in the repository. If names are given, only files
699 that match are shown. Files that are clean or ignored or the source of a
699 that match are shown. Files that are clean or ignored or the source of a
700 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
700 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
701 -C/--copies or -A/--all are given. Unless options described with "show
701 -C/--copies or -A/--all are given. Unless options described with "show
702 only ..." are given, the options -mardu are used.
702 only ..." are given, the options -mardu are used.
703
703
704 Option -q/--quiet hides untracked (unknown and ignored) files unless
704 Option -q/--quiet hides untracked (unknown and ignored) files unless
705 explicitly requested with -u/--unknown or -i/--ignored.
705 explicitly requested with -u/--unknown or -i/--ignored.
706
706
707 Note:
707 Note:
708 'hg status' may appear to disagree with diff if permissions have
708 'hg status' may appear to disagree with diff if permissions have
709 changed or a merge has occurred. The standard diff format does not
709 changed or a merge has occurred. The standard diff format does not
710 report permission changes and diff only reports changes relative to one
710 report permission changes and diff only reports changes relative to one
711 merge parent.
711 merge parent.
712
712
713 If one revision is given, it is used as the base revision. If two
713 If one revision is given, it is used as the base revision. If two
714 revisions are given, the differences between them are shown. The --change
714 revisions are given, the differences between them are shown. The --change
715 option can also be used as a shortcut to list the changed files of a
715 option can also be used as a shortcut to list the changed files of a
716 revision from its first parent.
716 revision from its first parent.
717
717
718 The codes used to show the status of files are:
718 The codes used to show the status of files are:
719
719
720 M = modified
720 M = modified
721 A = added
721 A = added
722 R = removed
722 R = removed
723 C = clean
723 C = clean
724 ! = missing (deleted by non-hg command, but still tracked)
724 ! = missing (deleted by non-hg command, but still tracked)
725 ? = not tracked
725 ? = not tracked
726 I = ignored
726 I = ignored
727 = origin of the previous file (with --copies)
727 = origin of the previous file (with --copies)
728
728
729 Returns 0 on success.
729 Returns 0 on success.
730
730
731 options ([+] can be repeated):
731 options ([+] can be repeated):
732
732
733 -A --all show status of all files
733 -A --all show status of all files
734 -m --modified show only modified files
734 -m --modified show only modified files
735 -a --added show only added files
735 -a --added show only added files
736 -r --removed show only removed files
736 -r --removed show only removed files
737 -d --deleted show only missing files
737 -d --deleted show only missing files
738 -c --clean show only files without changes
738 -c --clean show only files without changes
739 -u --unknown show only unknown (not tracked) files
739 -u --unknown show only unknown (not tracked) files
740 -i --ignored show only ignored files
740 -i --ignored show only ignored files
741 -n --no-status hide status prefix
741 -n --no-status hide status prefix
742 -C --copies show source of copied files
742 -C --copies show source of copied files
743 -0 --print0 end filenames with NUL, for use with xargs
743 -0 --print0 end filenames with NUL, for use with xargs
744 --rev REV [+] show difference from revision
744 --rev REV [+] show difference from revision
745 --change REV list the changed files of a revision
745 --change REV list the changed files of a revision
746 -I --include PATTERN [+] include names matching the given patterns
746 -I --include PATTERN [+] include names matching the given patterns
747 -X --exclude PATTERN [+] exclude names matching the given patterns
747 -X --exclude PATTERN [+] exclude names matching the given patterns
748 -S --subrepos recurse into subrepositories
748 -S --subrepos recurse into subrepositories
749 -T --template TEMPLATE display with template
749 -T --template TEMPLATE display with template
750
750
751 (some details hidden, use --verbose to show complete help)
751 (some details hidden, use --verbose to show complete help)
752
752
753 $ hg -q help status
753 $ hg -q help status
754 hg status [OPTION]... [FILE]...
754 hg status [OPTION]... [FILE]...
755
755
756 show changed files in the working directory
756 show changed files in the working directory
757
757
758 $ hg help foo
758 $ hg help foo
759 abort: no such help topic: foo
759 abort: no such help topic: foo
760 (try 'hg help --keyword foo')
760 (try 'hg help --keyword foo')
761 [255]
761 [255]
762
762
763 $ hg skjdfks
763 $ hg skjdfks
764 hg: unknown command 'skjdfks'
764 hg: unknown command 'skjdfks'
765 (use 'hg help' for a list of commands)
765 (use 'hg help' for a list of commands)
766 [255]
766 [255]
767
767
768 Typoed command gives suggestion
768 Typoed command gives suggestion
769 $ hg puls
769 $ hg puls
770 hg: unknown command 'puls'
770 hg: unknown command 'puls'
771 (did you mean one of pull, push?)
771 (did you mean one of pull, push?)
772 [255]
772 [255]
773
773
774 Not enabled extension gets suggested
774 Not enabled extension gets suggested
775
775
776 $ hg rebase
776 $ hg rebase
777 hg: unknown command 'rebase'
777 hg: unknown command 'rebase'
778 'rebase' is provided by the following extension:
778 'rebase' is provided by the following extension:
779
779
780 rebase command to move sets of revisions to a different ancestor
780 rebase command to move sets of revisions to a different ancestor
781
781
782 (use 'hg help extensions' for information on enabling extensions)
782 (use 'hg help extensions' for information on enabling extensions)
783 [255]
783 [255]
784
784
785 Disabled extension gets suggested
785 Disabled extension gets suggested
786 $ hg --config extensions.rebase=! rebase
786 $ hg --config extensions.rebase=! rebase
787 hg: unknown command 'rebase'
787 hg: unknown command 'rebase'
788 'rebase' is provided by the following extension:
788 'rebase' is provided by the following extension:
789
789
790 rebase command to move sets of revisions to a different ancestor
790 rebase command to move sets of revisions to a different ancestor
791
791
792 (use 'hg help extensions' for information on enabling extensions)
792 (use 'hg help extensions' for information on enabling extensions)
793 [255]
793 [255]
794
794
795 Checking that help adapts based on the config:
795 Checking that help adapts based on the config:
796
796
797 $ hg help diff --config ui.tweakdefaults=true | egrep -e '^ *(-g|config)'
797 $ hg help diff --config ui.tweakdefaults=true | egrep -e '^ *(-g|config)'
798 -g --[no-]git use git extended diff format (default: on from
798 -g --[no-]git use git extended diff format (default: on from
799 config)
799 config)
800
800
801 Make sure that we don't run afoul of the help system thinking that
801 Make sure that we don't run afoul of the help system thinking that
802 this is a section and erroring out weirdly.
802 this is a section and erroring out weirdly.
803
803
804 $ hg .log
804 $ hg .log
805 hg: unknown command '.log'
805 hg: unknown command '.log'
806 (did you mean log?)
806 (did you mean log?)
807 [255]
807 [255]
808
808
809 $ hg log.
809 $ hg log.
810 hg: unknown command 'log.'
810 hg: unknown command 'log.'
811 (did you mean log?)
811 (did you mean log?)
812 [255]
812 [255]
813 $ hg pu.lh
813 $ hg pu.lh
814 hg: unknown command 'pu.lh'
814 hg: unknown command 'pu.lh'
815 (did you mean one of pull, push?)
815 (did you mean one of pull, push?)
816 [255]
816 [255]
817
817
818 $ cat > helpext.py <<EOF
818 $ cat > helpext.py <<EOF
819 > import os
819 > import os
820 > from mercurial import commands, fancyopts, registrar
820 > from mercurial import commands, fancyopts, registrar
821 >
821 >
822 > def func(arg):
822 > def func(arg):
823 > return '%sfoo' % arg
823 > return '%sfoo' % arg
824 > class customopt(fancyopts.customopt):
824 > class customopt(fancyopts.customopt):
825 > def newstate(self, oldstate, newparam, abort):
825 > def newstate(self, oldstate, newparam, abort):
826 > return '%sbar' % oldstate
826 > return '%sbar' % oldstate
827 > cmdtable = {}
827 > cmdtable = {}
828 > command = registrar.command(cmdtable)
828 > command = registrar.command(cmdtable)
829 >
829 >
830 > @command(b'nohelp',
830 > @command(b'nohelp',
831 > [(b'', b'longdesc', 3, b'x'*67),
831 > [(b'', b'longdesc', 3, b'x'*67),
832 > (b'n', b'', None, b'normal desc'),
832 > (b'n', b'', None, b'normal desc'),
833 > (b'', b'newline', b'', b'line1\nline2'),
833 > (b'', b'newline', b'', b'line1\nline2'),
834 > (b'', b'default-off', False, b'enable X'),
834 > (b'', b'default-off', False, b'enable X'),
835 > (b'', b'default-on', True, b'enable Y'),
835 > (b'', b'default-on', True, b'enable Y'),
836 > (b'', b'callableopt', func, b'adds foo'),
836 > (b'', b'callableopt', func, b'adds foo'),
837 > (b'', b'customopt', customopt(''), b'adds bar'),
837 > (b'', b'customopt', customopt(''), b'adds bar'),
838 > (b'', b'customopt-withdefault', customopt('foo'), b'adds bar')],
838 > (b'', b'customopt-withdefault', customopt('foo'), b'adds bar')],
839 > b'hg nohelp',
839 > b'hg nohelp',
840 > norepo=True)
840 > norepo=True)
841 > @command(b'debugoptADV', [(b'', b'aopt', None, b'option is (ADVANCED)')])
841 > @command(b'debugoptADV', [(b'', b'aopt', None, b'option is (ADVANCED)')])
842 > @command(b'debugoptDEP', [(b'', b'dopt', None, b'option is (DEPRECATED)')])
842 > @command(b'debugoptDEP', [(b'', b'dopt', None, b'option is (DEPRECATED)')])
843 > @command(b'debugoptEXP', [(b'', b'eopt', None, b'option is (EXPERIMENTAL)')])
843 > @command(b'debugoptEXP', [(b'', b'eopt', None, b'option is (EXPERIMENTAL)')])
844 > def nohelp(ui, *args, **kwargs):
844 > def nohelp(ui, *args, **kwargs):
845 > pass
845 > pass
846 >
846 >
847 > @command(b'hashelp', [], b'hg hashelp', norepo=True)
847 > @command(b'hashelp', [], b'hg hashelp', norepo=True)
848 > def hashelp(ui, *args, **kwargs):
848 > def hashelp(ui, *args, **kwargs):
849 > """Extension command's help"""
849 > """Extension command's help"""
850 >
850 >
851 > def uisetup(ui):
851 > def uisetup(ui):
852 > ui.setconfig(b'alias', b'shellalias', b'!echo hi', b'helpext')
852 > ui.setconfig(b'alias', b'shellalias', b'!echo hi', b'helpext')
853 > ui.setconfig(b'alias', b'hgalias', b'summary', b'helpext')
853 > ui.setconfig(b'alias', b'hgalias', b'summary', b'helpext')
854 > ui.setconfig(b'alias', b'hgalias:doc', b'My doc', b'helpext')
854 > ui.setconfig(b'alias', b'hgalias:doc', b'My doc', b'helpext')
855 > ui.setconfig(b'alias', b'hgalias:category', b'navigation', b'helpext')
855 > ui.setconfig(b'alias', b'hgalias:category', b'navigation', b'helpext')
856 > ui.setconfig(b'alias', b'hgaliasnodoc', b'summary', b'helpext')
856 > ui.setconfig(b'alias', b'hgaliasnodoc', b'summary', b'helpext')
857 >
857 >
858 > EOF
858 > EOF
859 $ echo '[extensions]' >> $HGRCPATH
859 $ echo '[extensions]' >> $HGRCPATH
860 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
860 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
861
861
862 Test for aliases
862 Test for aliases
863
863
864 $ hg help | grep hgalias
864 $ hg help | grep hgalias
865 hgalias My doc
865 hgalias My doc
866
866
867 $ hg help hgalias
867 $ hg help hgalias
868 hg hgalias [--remote]
868 hg hgalias [--remote]
869
869
870 alias for: hg summary
870 alias for: hg summary
871
871
872 My doc
872 My doc
873
873
874 defined by: helpext
874 defined by: helpext
875
875
876 options:
876 options:
877
877
878 --remote check for push and pull
878 --remote check for push and pull
879
879
880 (some details hidden, use --verbose to show complete help)
880 (some details hidden, use --verbose to show complete help)
881 $ hg help hgaliasnodoc
881 $ hg help hgaliasnodoc
882 hg hgaliasnodoc [--remote]
882 hg hgaliasnodoc [--remote]
883
883
884 alias for: hg summary
884 alias for: hg summary
885
885
886 summarize working directory state
886 summarize working directory state
887
887
888 This generates a brief summary of the working directory state, including
888 This generates a brief summary of the working directory state, including
889 parents, branch, commit status, phase and available updates.
889 parents, branch, commit status, phase and available updates.
890
890
891 With the --remote option, this will check the default paths for incoming
891 With the --remote option, this will check the default paths for incoming
892 and outgoing changes. This can be time-consuming.
892 and outgoing changes. This can be time-consuming.
893
893
894 Returns 0 on success.
894 Returns 0 on success.
895
895
896 defined by: helpext
896 defined by: helpext
897
897
898 options:
898 options:
899
899
900 --remote check for push and pull
900 --remote check for push and pull
901
901
902 (some details hidden, use --verbose to show complete help)
902 (some details hidden, use --verbose to show complete help)
903
903
904 $ hg help shellalias
904 $ hg help shellalias
905 hg shellalias
905 hg shellalias
906
906
907 shell alias for: echo hi
907 shell alias for: echo hi
908
908
909 (no help text available)
909 (no help text available)
910
910
911 defined by: helpext
911 defined by: helpext
912
912
913 (some details hidden, use --verbose to show complete help)
913 (some details hidden, use --verbose to show complete help)
914
914
915 Test command with no help text
915 Test command with no help text
916
916
917 $ hg help nohelp
917 $ hg help nohelp
918 hg nohelp
918 hg nohelp
919
919
920 (no help text available)
920 (no help text available)
921
921
922 options:
922 options:
923
923
924 --longdesc VALUE
924 --longdesc VALUE
925 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
925 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
926 xxxxxxxxxxxxxxxxxxxxxxx (default: 3)
926 xxxxxxxxxxxxxxxxxxxxxxx (default: 3)
927 -n -- normal desc
927 -n -- normal desc
928 --newline VALUE line1 line2
928 --newline VALUE line1 line2
929 --default-off enable X
929 --default-off enable X
930 --[no-]default-on enable Y (default: on)
930 --[no-]default-on enable Y (default: on)
931 --callableopt VALUE adds foo
931 --callableopt VALUE adds foo
932 --customopt VALUE adds bar
932 --customopt VALUE adds bar
933 --customopt-withdefault VALUE adds bar (default: foo)
933 --customopt-withdefault VALUE adds bar (default: foo)
934
934
935 (some details hidden, use --verbose to show complete help)
935 (some details hidden, use --verbose to show complete help)
936
936
937 Test that default list of commands includes extension commands that have help,
937 Test that default list of commands includes extension commands that have help,
938 but not those that don't, except in verbose mode, when a keyword is passed, or
938 but not those that don't, except in verbose mode, when a keyword is passed, or
939 when help about the extension is requested.
939 when help about the extension is requested.
940
940
941 #if no-extraextensions
941 #if no-extraextensions
942
942
943 $ hg help | grep hashelp
943 $ hg help | grep hashelp
944 hashelp Extension command's help
944 hashelp Extension command's help
945 $ hg help | grep nohelp
945 $ hg help | grep nohelp
946 [1]
946 [1]
947 $ hg help -v | grep nohelp
947 $ hg help -v | grep nohelp
948 nohelp (no help text available)
948 nohelp (no help text available)
949
949
950 $ hg help -k nohelp
950 $ hg help -k nohelp
951 Commands:
951 Commands:
952
952
953 nohelp hg nohelp
953 nohelp hg nohelp
954
954
955 Extension Commands:
955 Extension Commands:
956
956
957 nohelp (no help text available)
957 nohelp (no help text available)
958
958
959 $ hg help helpext
959 $ hg help helpext
960 helpext extension - no help text available
960 helpext extension - no help text available
961
961
962 list of commands:
962 list of commands:
963
963
964 hashelp Extension command's help
964 hashelp Extension command's help
965 nohelp (no help text available)
965 nohelp (no help text available)
966
966
967 (use 'hg help -v helpext' to show built-in aliases and global options)
967 (use 'hg help -v helpext' to show built-in aliases and global options)
968
968
969 #endif
969 #endif
970
970
971 Test list of internal help commands
971 Test list of internal help commands
972
972
973 $ hg help debug
973 $ hg help debug
974 debug commands (internal and unsupported):
974 debug commands (internal and unsupported):
975
975
976 debugancestor
976 debugancestor
977 find the ancestor revision of two revisions in a given index
977 find the ancestor revision of two revisions in a given index
978 debugantivirusrunning
978 debugantivirusrunning
979 attempt to trigger an antivirus scanner to see if one is active
979 attempt to trigger an antivirus scanner to see if one is active
980 debugapplystreamclonebundle
980 debugapplystreamclonebundle
981 apply a stream clone bundle file
981 apply a stream clone bundle file
982 debugbackupbundle
982 debugbackupbundle
983 lists the changesets available in backup bundles
983 lists the changesets available in backup bundles
984 debugbuilddag
984 debugbuilddag
985 builds a repo with a given DAG from scratch in the current
985 builds a repo with a given DAG from scratch in the current
986 empty repo
986 empty repo
987 debugbundle lists the contents of a bundle
987 debugbundle lists the contents of a bundle
988 debugcapabilities
988 debugcapabilities
989 lists the capabilities of a remote peer
989 lists the capabilities of a remote peer
990 debugchangedfiles
990 debugchangedfiles
991 list the stored files changes for a revision
991 list the stored files changes for a revision
992 debugcheckstate
992 debugcheckstate
993 validate the correctness of the current dirstate
993 validate the correctness of the current dirstate
994 debugcolor show available color, effects or style
994 debugcolor show available color, effects or style
995 debugcommands
995 debugcommands
996 list all available commands and options
996 list all available commands and options
997 debugcomplete
997 debugcomplete
998 returns the completion list associated with the given command
998 returns the completion list associated with the given command
999 debugcreatestreamclonebundle
999 debugcreatestreamclonebundle
1000 create a stream clone bundle file
1000 create a stream clone bundle file
1001 debugdag format the changelog or an index DAG as a concise textual
1001 debugdag format the changelog or an index DAG as a concise textual
1002 description
1002 description
1003 debugdata dump the contents of a data file revision
1003 debugdata dump the contents of a data file revision
1004 debugdate parse and display a date
1004 debugdate parse and display a date
1005 debugdeltachain
1005 debugdeltachain
1006 dump information about delta chains in a revlog
1006 dump information about delta chains in a revlog
1007 debugdirstate
1007 debugdirstate
1008 show the contents of the current dirstate
1008 show the contents of the current dirstate
1009 debugdiscovery
1009 debugdiscovery
1010 runs the changeset discovery protocol in isolation
1010 runs the changeset discovery protocol in isolation
1011 debugdownload
1011 debugdownload
1012 download a resource using Mercurial logic and config
1012 download a resource using Mercurial logic and config
1013 debugextensions
1013 debugextensions
1014 show information about active extensions
1014 show information about active extensions
1015 debugfileset parse and apply a fileset specification
1015 debugfileset parse and apply a fileset specification
1016 debugformat display format information about the current repository
1016 debugformat display format information about the current repository
1017 debugfsinfo show information detected about current filesystem
1017 debugfsinfo show information detected about current filesystem
1018 debuggetbundle
1018 debuggetbundle
1019 retrieves a bundle from a repo
1019 retrieves a bundle from a repo
1020 debugignore display the combined ignore pattern and information about
1020 debugignore display the combined ignore pattern and information about
1021 ignored files
1021 ignored files
1022 debugindex dump index data for a storage primitive
1022 debugindex dump index data for a storage primitive
1023 debugindexdot
1023 debugindexdot
1024 dump an index DAG as a graphviz dot file
1024 dump an index DAG as a graphviz dot file
1025 debugindexstats
1025 debugindexstats
1026 show stats related to the changelog index
1026 show stats related to the changelog index
1027 debuginstall test Mercurial installation
1027 debuginstall test Mercurial installation
1028 debugknown test whether node ids are known to a repo
1028 debugknown test whether node ids are known to a repo
1029 debuglocks show or modify state of locks
1029 debuglocks show or modify state of locks
1030 debugmanifestfulltextcache
1030 debugmanifestfulltextcache
1031 show, clear or amend the contents of the manifest fulltext
1031 show, clear or amend the contents of the manifest fulltext
1032 cache
1032 cache
1033 debugmergestate
1033 debugmergestate
1034 print merge state
1034 print merge state
1035 debugnamecomplete
1035 debugnamecomplete
1036 complete "names" - tags, open branch names, bookmark names
1036 complete "names" - tags, open branch names, bookmark names
1037 debugnodemap write and inspect on disk nodemap
1037 debugnodemap write and inspect on disk nodemap
1038 debugobsolete
1038 debugobsolete
1039 create arbitrary obsolete marker
1039 create arbitrary obsolete marker
1040 debugoptADV (no help text available)
1040 debugoptADV (no help text available)
1041 debugoptDEP (no help text available)
1041 debugoptDEP (no help text available)
1042 debugoptEXP (no help text available)
1042 debugoptEXP (no help text available)
1043 debugp1copies
1043 debugp1copies
1044 dump copy information compared to p1
1044 dump copy information compared to p1
1045 debugp2copies
1045 debugp2copies
1046 dump copy information compared to p2
1046 dump copy information compared to p2
1047 debugpathcomplete
1047 debugpathcomplete
1048 complete part or all of a tracked path
1048 complete part or all of a tracked path
1049 debugpathcopies
1049 debugpathcopies
1050 show copies between two revisions
1050 show copies between two revisions
1051 debugpeer establish a connection to a peer repository
1051 debugpeer establish a connection to a peer repository
1052 debugpickmergetool
1052 debugpickmergetool
1053 examine which merge tool is chosen for specified file
1053 examine which merge tool is chosen for specified file
1054 debugpushkey access the pushkey key/value protocol
1054 debugpushkey access the pushkey key/value protocol
1055 debugpvec (no help text available)
1055 debugpvec (no help text available)
1056 debugrebuilddirstate
1056 debugrebuilddirstate
1057 rebuild the dirstate as it would look like for the given
1057 rebuild the dirstate as it would look like for the given
1058 revision
1058 revision
1059 debugrebuildfncache
1059 debugrebuildfncache
1060 rebuild the fncache file
1060 rebuild the fncache file
1061 debugrename dump rename information
1061 debugrename dump rename information
1062 debugrequires
1062 debugrequires
1063 print the current repo requirements
1063 print the current repo requirements
1064 debugrevlog show data and statistics about a revlog
1064 debugrevlog show data and statistics about a revlog
1065 debugrevlogindex
1065 debugrevlogindex
1066 dump the contents of a revlog index
1066 dump the contents of a revlog index
1067 debugrevspec parse and apply a revision specification
1067 debugrevspec parse and apply a revision specification
1068 debugserve run a server with advanced settings
1068 debugserve run a server with advanced settings
1069 debugsetparents
1069 debugsetparents
1070 manually set the parents of the current working directory
1070 manually set the parents of the current working directory
1071 debugsidedata
1071 debugsidedata
1072 dump the side data for a cl/manifest/file revision
1072 dump the side data for a cl/manifest/file revision
1073 debugssl test a secure connection to a server
1073 debugssl test a secure connection to a server
1074 debugstrip strip changesets and all their descendants from the repository
1074 debugstrip strip changesets and all their descendants from the repository
1075 debugsub (no help text available)
1075 debugsub (no help text available)
1076 debugsuccessorssets
1076 debugsuccessorssets
1077 show set of successors for revision
1077 show set of successors for revision
1078 debugtagscache
1078 debugtagscache
1079 display the contents of .hg/cache/hgtagsfnodes1
1079 display the contents of .hg/cache/hgtagsfnodes1
1080 debugtemplate
1080 debugtemplate
1081 parse and apply a template
1081 parse and apply a template
1082 debuguigetpass
1082 debuguigetpass
1083 show prompt to type password
1083 show prompt to type password
1084 debuguiprompt
1084 debuguiprompt
1085 show plain prompt
1085 show plain prompt
1086 debugupdatecaches
1086 debugupdatecaches
1087 warm all known caches in the repository
1087 warm all known caches in the repository
1088 debugupgraderepo
1088 debugupgraderepo
1089 upgrade a repository to use different features
1089 upgrade a repository to use different features
1090 debugwalk show how files match on given patterns
1090 debugwalk show how files match on given patterns
1091 debugwhyunstable
1091 debugwhyunstable
1092 explain instabilities of a changeset
1092 explain instabilities of a changeset
1093 debugwireargs
1093 debugwireargs
1094 (no help text available)
1094 (no help text available)
1095 debugwireproto
1095 debugwireproto
1096 send wire protocol commands to a server
1096 send wire protocol commands to a server
1097
1097
1098 (use 'hg help -v debug' to show built-in aliases and global options)
1098 (use 'hg help -v debug' to show built-in aliases and global options)
1099
1099
1100 internals topic renders index of available sub-topics
1100 internals topic renders index of available sub-topics
1101
1101
1102 $ hg help internals
1102 $ hg help internals
1103 Technical implementation topics
1103 Technical implementation topics
1104 """""""""""""""""""""""""""""""
1104 """""""""""""""""""""""""""""""
1105
1105
1106 To access a subtopic, use "hg help internals.{subtopic-name}"
1106 To access a subtopic, use "hg help internals.{subtopic-name}"
1107
1107
1108 bid-merge Bid Merge Algorithm
1108 bid-merge Bid Merge Algorithm
1109 bundle2 Bundle2
1109 bundle2 Bundle2
1110 bundles Bundles
1110 bundles Bundles
1111 cbor CBOR
1111 cbor CBOR
1112 censor Censor
1112 censor Censor
1113 changegroups Changegroups
1113 changegroups Changegroups
1114 config Config Registrar
1114 config Config Registrar
1115 extensions Extension API
1115 extensions Extension API
1116 mergestate Mergestate
1116 mergestate Mergestate
1117 requirements Repository Requirements
1117 requirements Repository Requirements
1118 revlogs Revision Logs
1118 revlogs Revision Logs
1119 wireprotocol Wire Protocol
1119 wireprotocol Wire Protocol
1120 wireprotocolrpc
1120 wireprotocolrpc
1121 Wire Protocol RPC
1121 Wire Protocol RPC
1122 wireprotocolv2
1122 wireprotocolv2
1123 Wire Protocol Version 2
1123 Wire Protocol Version 2
1124
1124
1125 sub-topics can be accessed
1125 sub-topics can be accessed
1126
1126
1127 $ hg help internals.changegroups
1127 $ hg help internals.changegroups
1128 Changegroups
1128 Changegroups
1129 """"""""""""
1129 """"""""""""
1130
1130
1131 Changegroups are representations of repository revlog data, specifically
1131 Changegroups are representations of repository revlog data, specifically
1132 the changelog data, root/flat manifest data, treemanifest data, and
1132 the changelog data, root/flat manifest data, treemanifest data, and
1133 filelogs.
1133 filelogs.
1134
1134
1135 There are 3 versions of changegroups: "1", "2", and "3". From a high-
1135 There are 3 versions of changegroups: "1", "2", and "3". From a high-
1136 level, versions "1" and "2" are almost exactly the same, with the only
1136 level, versions "1" and "2" are almost exactly the same, with the only
1137 difference being an additional item in the *delta header*. Version "3"
1137 difference being an additional item in the *delta header*. Version "3"
1138 adds support for storage flags in the *delta header* and optionally
1138 adds support for storage flags in the *delta header* and optionally
1139 exchanging treemanifests (enabled by setting an option on the
1139 exchanging treemanifests (enabled by setting an option on the
1140 "changegroup" part in the bundle2).
1140 "changegroup" part in the bundle2).
1141
1141
1142 Changegroups when not exchanging treemanifests consist of 3 logical
1142 Changegroups when not exchanging treemanifests consist of 3 logical
1143 segments:
1143 segments:
1144
1144
1145 +---------------------------------+
1145 +---------------------------------+
1146 | | | |
1146 | | | |
1147 | changeset | manifest | filelogs |
1147 | changeset | manifest | filelogs |
1148 | | | |
1148 | | | |
1149 | | | |
1149 | | | |
1150 +---------------------------------+
1150 +---------------------------------+
1151
1151
1152 When exchanging treemanifests, there are 4 logical segments:
1152 When exchanging treemanifests, there are 4 logical segments:
1153
1153
1154 +-------------------------------------------------+
1154 +-------------------------------------------------+
1155 | | | | |
1155 | | | | |
1156 | changeset | root | treemanifests | filelogs |
1156 | changeset | root | treemanifests | filelogs |
1157 | | manifest | | |
1157 | | manifest | | |
1158 | | | | |
1158 | | | | |
1159 +-------------------------------------------------+
1159 +-------------------------------------------------+
1160
1160
1161 The principle building block of each segment is a *chunk*. A *chunk* is a
1161 The principle building block of each segment is a *chunk*. A *chunk* is a
1162 framed piece of data:
1162 framed piece of data:
1163
1163
1164 +---------------------------------------+
1164 +---------------------------------------+
1165 | | |
1165 | | |
1166 | length | data |
1166 | length | data |
1167 | (4 bytes) | (<length - 4> bytes) |
1167 | (4 bytes) | (<length - 4> bytes) |
1168 | | |
1168 | | |
1169 +---------------------------------------+
1169 +---------------------------------------+
1170
1170
1171 All integers are big-endian signed integers. Each chunk starts with a
1171 All integers are big-endian signed integers. Each chunk starts with a
1172 32-bit integer indicating the length of the entire chunk (including the
1172 32-bit integer indicating the length of the entire chunk (including the
1173 length field itself).
1173 length field itself).
1174
1174
1175 There is a special case chunk that has a value of 0 for the length
1175 There is a special case chunk that has a value of 0 for the length
1176 ("0x00000000"). We call this an *empty chunk*.
1176 ("0x00000000"). We call this an *empty chunk*.
1177
1177
1178 Delta Groups
1178 Delta Groups
1179 ============
1179 ============
1180
1180
1181 A *delta group* expresses the content of a revlog as a series of deltas,
1181 A *delta group* expresses the content of a revlog as a series of deltas,
1182 or patches against previous revisions.
1182 or patches against previous revisions.
1183
1183
1184 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
1184 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
1185 to signal the end of the delta group:
1185 to signal the end of the delta group:
1186
1186
1187 +------------------------------------------------------------------------+
1187 +------------------------------------------------------------------------+
1188 | | | | | |
1188 | | | | | |
1189 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
1189 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
1190 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
1190 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
1191 | | | | | |
1191 | | | | | |
1192 +------------------------------------------------------------------------+
1192 +------------------------------------------------------------------------+
1193
1193
1194 Each *chunk*'s data consists of the following:
1194 Each *chunk*'s data consists of the following:
1195
1195
1196 +---------------------------------------+
1196 +---------------------------------------+
1197 | | |
1197 | | |
1198 | delta header | delta data |
1198 | delta header | delta data |
1199 | (various by version) | (various) |
1199 | (various by version) | (various) |
1200 | | |
1200 | | |
1201 +---------------------------------------+
1201 +---------------------------------------+
1202
1202
1203 The *delta data* is a series of *delta*s that describe a diff from an
1203 The *delta data* is a series of *delta*s that describe a diff from an
1204 existing entry (either that the recipient already has, or previously
1204 existing entry (either that the recipient already has, or previously
1205 specified in the bundle/changegroup).
1205 specified in the bundle/changegroup).
1206
1206
1207 The *delta header* is different between versions "1", "2", and "3" of the
1207 The *delta header* is different between versions "1", "2", and "3" of the
1208 changegroup format.
1208 changegroup format.
1209
1209
1210 Version 1 (headerlen=80):
1210 Version 1 (headerlen=80):
1211
1211
1212 +------------------------------------------------------+
1212 +------------------------------------------------------+
1213 | | | | |
1213 | | | | |
1214 | node | p1 node | p2 node | link node |
1214 | node | p1 node | p2 node | link node |
1215 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1215 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1216 | | | | |
1216 | | | | |
1217 +------------------------------------------------------+
1217 +------------------------------------------------------+
1218
1218
1219 Version 2 (headerlen=100):
1219 Version 2 (headerlen=100):
1220
1220
1221 +------------------------------------------------------------------+
1221 +------------------------------------------------------------------+
1222 | | | | | |
1222 | | | | | |
1223 | node | p1 node | p2 node | base node | link node |
1223 | node | p1 node | p2 node | base node | link node |
1224 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1224 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
1225 | | | | | |
1225 | | | | | |
1226 +------------------------------------------------------------------+
1226 +------------------------------------------------------------------+
1227
1227
1228 Version 3 (headerlen=102):
1228 Version 3 (headerlen=102):
1229
1229
1230 +------------------------------------------------------------------------------+
1230 +------------------------------------------------------------------------------+
1231 | | | | | | |
1231 | | | | | | |
1232 | node | p1 node | p2 node | base node | link node | flags |
1232 | node | p1 node | p2 node | base node | link node | flags |
1233 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
1233 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
1234 | | | | | | |
1234 | | | | | | |
1235 +------------------------------------------------------------------------------+
1235 +------------------------------------------------------------------------------+
1236
1236
1237 The *delta data* consists of "chunklen - 4 - headerlen" bytes, which
1237 The *delta data* consists of "chunklen - 4 - headerlen" bytes, which
1238 contain a series of *delta*s, densely packed (no separators). These deltas
1238 contain a series of *delta*s, densely packed (no separators). These deltas
1239 describe a diff from an existing entry (either that the recipient already
1239 describe a diff from an existing entry (either that the recipient already
1240 has, or previously specified in the bundle/changegroup). The format is
1240 has, or previously specified in the bundle/changegroup). The format is
1241 described more fully in "hg help internals.bdiff", but briefly:
1241 described more fully in "hg help internals.bdiff", but briefly:
1242
1242
1243 +---------------------------------------------------------------+
1243 +---------------------------------------------------------------+
1244 | | | | |
1244 | | | | |
1245 | start offset | end offset | new length | content |
1245 | start offset | end offset | new length | content |
1246 | (4 bytes) | (4 bytes) | (4 bytes) | (<new length> bytes) |
1246 | (4 bytes) | (4 bytes) | (4 bytes) | (<new length> bytes) |
1247 | | | | |
1247 | | | | |
1248 +---------------------------------------------------------------+
1248 +---------------------------------------------------------------+
1249
1249
1250 Please note that the length field in the delta data does *not* include
1250 Please note that the length field in the delta data does *not* include
1251 itself.
1251 itself.
1252
1252
1253 In version 1, the delta is always applied against the previous node from
1253 In version 1, the delta is always applied against the previous node from
1254 the changegroup or the first parent if this is the first entry in the
1254 the changegroup or the first parent if this is the first entry in the
1255 changegroup.
1255 changegroup.
1256
1256
1257 In version 2 and up, the delta base node is encoded in the entry in the
1257 In version 2 and up, the delta base node is encoded in the entry in the
1258 changegroup. This allows the delta to be expressed against any parent,
1258 changegroup. This allows the delta to be expressed against any parent,
1259 which can result in smaller deltas and more efficient encoding of data.
1259 which can result in smaller deltas and more efficient encoding of data.
1260
1260
1261 The *flags* field holds bitwise flags affecting the processing of revision
1261 The *flags* field holds bitwise flags affecting the processing of revision
1262 data. The following flags are defined:
1262 data. The following flags are defined:
1263
1263
1264 32768
1264 32768
1265 Censored revision. The revision's fulltext has been replaced by censor
1265 Censored revision. The revision's fulltext has been replaced by censor
1266 metadata. May only occur on file revisions.
1266 metadata. May only occur on file revisions.
1267
1267
1268 16384
1268 16384
1269 Ellipsis revision. Revision hash does not match data (likely due to
1269 Ellipsis revision. Revision hash does not match data (likely due to
1270 rewritten parents).
1270 rewritten parents).
1271
1271
1272 8192
1272 8192
1273 Externally stored. The revision fulltext contains "key:value" "\n"
1273 Externally stored. The revision fulltext contains "key:value" "\n"
1274 delimited metadata defining an object stored elsewhere. Used by the LFS
1274 delimited metadata defining an object stored elsewhere. Used by the LFS
1275 extension.
1275 extension.
1276
1276
1277 For historical reasons, the integer values are identical to revlog version
1277 For historical reasons, the integer values are identical to revlog version
1278 1 per-revision storage flags and correspond to bits being set in this
1278 1 per-revision storage flags and correspond to bits being set in this
1279 2-byte field. Bits were allocated starting from the most-significant bit,
1279 2-byte field. Bits were allocated starting from the most-significant bit,
1280 hence the reverse ordering and allocation of these flags.
1280 hence the reverse ordering and allocation of these flags.
1281
1281
1282 Changeset Segment
1282 Changeset Segment
1283 =================
1283 =================
1284
1284
1285 The *changeset segment* consists of a single *delta group* holding
1285 The *changeset segment* consists of a single *delta group* holding
1286 changelog data. The *empty chunk* at the end of the *delta group* denotes
1286 changelog data. The *empty chunk* at the end of the *delta group* denotes
1287 the boundary to the *manifest segment*.
1287 the boundary to the *manifest segment*.
1288
1288
1289 Manifest Segment
1289 Manifest Segment
1290 ================
1290 ================
1291
1291
1292 The *manifest segment* consists of a single *delta group* holding manifest
1292 The *manifest segment* consists of a single *delta group* holding manifest
1293 data. If treemanifests are in use, it contains only the manifest for the
1293 data. If treemanifests are in use, it contains only the manifest for the
1294 root directory of the repository. Otherwise, it contains the entire
1294 root directory of the repository. Otherwise, it contains the entire
1295 manifest data. The *empty chunk* at the end of the *delta group* denotes
1295 manifest data. The *empty chunk* at the end of the *delta group* denotes
1296 the boundary to the next segment (either the *treemanifests segment* or
1296 the boundary to the next segment (either the *treemanifests segment* or
1297 the *filelogs segment*, depending on version and the request options).
1297 the *filelogs segment*, depending on version and the request options).
1298
1298
1299 Treemanifests Segment
1299 Treemanifests Segment
1300 ---------------------
1300 ---------------------
1301
1301
1302 The *treemanifests segment* only exists in changegroup version "3", and
1302 The *treemanifests segment* only exists in changegroup version "3", and
1303 only if the 'treemanifest' param is part of the bundle2 changegroup part
1303 only if the 'treemanifest' param is part of the bundle2 changegroup part
1304 (it is not possible to use changegroup version 3 outside of bundle2).
1304 (it is not possible to use changegroup version 3 outside of bundle2).
1305 Aside from the filenames in the *treemanifests segment* containing a
1305 Aside from the filenames in the *treemanifests segment* containing a
1306 trailing "/" character, it behaves identically to the *filelogs segment*
1306 trailing "/" character, it behaves identically to the *filelogs segment*
1307 (see below). The final sub-segment is followed by an *empty chunk*
1307 (see below). The final sub-segment is followed by an *empty chunk*
1308 (logically, a sub-segment with filename size 0). This denotes the boundary
1308 (logically, a sub-segment with filename size 0). This denotes the boundary
1309 to the *filelogs segment*.
1309 to the *filelogs segment*.
1310
1310
1311 Filelogs Segment
1311 Filelogs Segment
1312 ================
1312 ================
1313
1313
1314 The *filelogs segment* consists of multiple sub-segments, each
1314 The *filelogs segment* consists of multiple sub-segments, each
1315 corresponding to an individual file whose data is being described:
1315 corresponding to an individual file whose data is being described:
1316
1316
1317 +--------------------------------------------------+
1317 +--------------------------------------------------+
1318 | | | | | |
1318 | | | | | |
1319 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
1319 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
1320 | | | | | (4 bytes) |
1320 | | | | | (4 bytes) |
1321 | | | | | |
1321 | | | | | |
1322 +--------------------------------------------------+
1322 +--------------------------------------------------+
1323
1323
1324 The final filelog sub-segment is followed by an *empty chunk* (logically,
1324 The final filelog sub-segment is followed by an *empty chunk* (logically,
1325 a sub-segment with filename size 0). This denotes the end of the segment
1325 a sub-segment with filename size 0). This denotes the end of the segment
1326 and of the overall changegroup.
1326 and of the overall changegroup.
1327
1327
1328 Each filelog sub-segment consists of the following:
1328 Each filelog sub-segment consists of the following:
1329
1329
1330 +------------------------------------------------------+
1330 +------------------------------------------------------+
1331 | | | |
1331 | | | |
1332 | filename length | filename | delta group |
1332 | filename length | filename | delta group |
1333 | (4 bytes) | (<length - 4> bytes) | (various) |
1333 | (4 bytes) | (<length - 4> bytes) | (various) |
1334 | | | |
1334 | | | |
1335 +------------------------------------------------------+
1335 +------------------------------------------------------+
1336
1336
1337 That is, a *chunk* consisting of the filename (not terminated or padded)
1337 That is, a *chunk* consisting of the filename (not terminated or padded)
1338 followed by N chunks constituting the *delta group* for this file. The
1338 followed by N chunks constituting the *delta group* for this file. The
1339 *empty chunk* at the end of each *delta group* denotes the boundary to the
1339 *empty chunk* at the end of each *delta group* denotes the boundary to the
1340 next filelog sub-segment.
1340 next filelog sub-segment.
1341
1341
1342 non-existent subtopics print an error
1342 non-existent subtopics print an error
1343
1343
1344 $ hg help internals.foo
1344 $ hg help internals.foo
1345 abort: no such help topic: internals.foo
1345 abort: no such help topic: internals.foo
1346 (try 'hg help --keyword foo')
1346 (try 'hg help --keyword foo')
1347 [255]
1347 [255]
1348
1348
1349 test advanced, deprecated and experimental options are hidden in command help
1349 test advanced, deprecated and experimental options are hidden in command help
1350 $ hg help debugoptADV
1350 $ hg help debugoptADV
1351 hg debugoptADV
1351 hg debugoptADV
1352
1352
1353 (no help text available)
1353 (no help text available)
1354
1354
1355 options:
1355 options:
1356
1356
1357 (some details hidden, use --verbose to show complete help)
1357 (some details hidden, use --verbose to show complete help)
1358 $ hg help debugoptDEP
1358 $ hg help debugoptDEP
1359 hg debugoptDEP
1359 hg debugoptDEP
1360
1360
1361 (no help text available)
1361 (no help text available)
1362
1362
1363 options:
1363 options:
1364
1364
1365 (some details hidden, use --verbose to show complete help)
1365 (some details hidden, use --verbose to show complete help)
1366
1366
1367 $ hg help debugoptEXP
1367 $ hg help debugoptEXP
1368 hg debugoptEXP
1368 hg debugoptEXP
1369
1369
1370 (no help text available)
1370 (no help text available)
1371
1371
1372 options:
1372 options:
1373
1373
1374 (some details hidden, use --verbose to show complete help)
1374 (some details hidden, use --verbose to show complete help)
1375
1375
1376 test advanced, deprecated and experimental options are shown with -v
1376 test advanced, deprecated and experimental options are shown with -v
1377 $ hg help -v debugoptADV | grep aopt
1377 $ hg help -v debugoptADV | grep aopt
1378 --aopt option is (ADVANCED)
1378 --aopt option is (ADVANCED)
1379 $ hg help -v debugoptDEP | grep dopt
1379 $ hg help -v debugoptDEP | grep dopt
1380 --dopt option is (DEPRECATED)
1380 --dopt option is (DEPRECATED)
1381 $ hg help -v debugoptEXP | grep eopt
1381 $ hg help -v debugoptEXP | grep eopt
1382 --eopt option is (EXPERIMENTAL)
1382 --eopt option is (EXPERIMENTAL)
1383
1383
1384 #if gettext
1384 #if gettext
1385 test deprecated option is hidden with translation with untranslated description
1385 test deprecated option is hidden with translation with untranslated description
1386 (use many globy for not failing on changed transaction)
1386 (use many globy for not failing on changed transaction)
1387 $ LANGUAGE=sv hg help debugoptDEP
1387 $ LANGUAGE=sv hg help debugoptDEP
1388 hg debugoptDEP
1388 hg debugoptDEP
1389
1389
1390 (*) (glob)
1390 (*) (glob)
1391
1391
1392 options:
1392 options:
1393
1393
1394 (some details hidden, use --verbose to show complete help)
1394 (some details hidden, use --verbose to show complete help)
1395 #endif
1395 #endif
1396
1396
1397 Test commands that collide with topics (issue4240)
1397 Test commands that collide with topics (issue4240)
1398
1398
1399 $ hg config -hq
1399 $ hg config -hq
1400 hg config [-u] [NAME]...
1400 hg config [-u] [NAME]...
1401
1401
1402 show combined config settings from all hgrc files
1402 show combined config settings from all hgrc files
1403 $ hg showconfig -hq
1403 $ hg showconfig -hq
1404 hg config [-u] [NAME]...
1404 hg config [-u] [NAME]...
1405
1405
1406 show combined config settings from all hgrc files
1406 show combined config settings from all hgrc files
1407
1407
1408 Test a help topic
1408 Test a help topic
1409
1409
1410 $ hg help dates
1410 $ hg help dates
1411 Date Formats
1411 Date Formats
1412 """"""""""""
1412 """"""""""""
1413
1413
1414 Some commands allow the user to specify a date, e.g.:
1414 Some commands allow the user to specify a date, e.g.:
1415
1415
1416 - backout, commit, import, tag: Specify the commit date.
1416 - backout, commit, import, tag: Specify the commit date.
1417 - log, revert, update: Select revision(s) by date.
1417 - log, revert, update: Select revision(s) by date.
1418
1418
1419 Many date formats are valid. Here are some examples:
1419 Many date formats are valid. Here are some examples:
1420
1420
1421 - "Wed Dec 6 13:18:29 2006" (local timezone assumed)
1421 - "Wed Dec 6 13:18:29 2006" (local timezone assumed)
1422 - "Dec 6 13:18 -0600" (year assumed, time offset provided)
1422 - "Dec 6 13:18 -0600" (year assumed, time offset provided)
1423 - "Dec 6 13:18 UTC" (UTC and GMT are aliases for +0000)
1423 - "Dec 6 13:18 UTC" (UTC and GMT are aliases for +0000)
1424 - "Dec 6" (midnight)
1424 - "Dec 6" (midnight)
1425 - "13:18" (today assumed)
1425 - "13:18" (today assumed)
1426 - "3:39" (3:39AM assumed)
1426 - "3:39" (3:39AM assumed)
1427 - "3:39pm" (15:39)
1427 - "3:39pm" (15:39)
1428 - "2006-12-06 13:18:29" (ISO 8601 format)
1428 - "2006-12-06 13:18:29" (ISO 8601 format)
1429 - "2006-12-6 13:18"
1429 - "2006-12-6 13:18"
1430 - "2006-12-6"
1430 - "2006-12-6"
1431 - "12-6"
1431 - "12-6"
1432 - "12/6"
1432 - "12/6"
1433 - "12/6/6" (Dec 6 2006)
1433 - "12/6/6" (Dec 6 2006)
1434 - "today" (midnight)
1434 - "today" (midnight)
1435 - "yesterday" (midnight)
1435 - "yesterday" (midnight)
1436 - "now" - right now
1436 - "now" - right now
1437
1437
1438 Lastly, there is Mercurial's internal format:
1438 Lastly, there is Mercurial's internal format:
1439
1439
1440 - "1165411109 0" (Wed Dec 6 13:18:29 2006 UTC)
1440 - "1165411109 0" (Wed Dec 6 13:18:29 2006 UTC)
1441
1441
1442 This is the internal representation format for dates. The first number is
1442 This is the internal representation format for dates. The first number is
1443 the number of seconds since the epoch (1970-01-01 00:00 UTC). The second
1443 the number of seconds since the epoch (1970-01-01 00:00 UTC). The second
1444 is the offset of the local timezone, in seconds west of UTC (negative if
1444 is the offset of the local timezone, in seconds west of UTC (negative if
1445 the timezone is east of UTC).
1445 the timezone is east of UTC).
1446
1446
1447 The log command also accepts date ranges:
1447 The log command also accepts date ranges:
1448
1448
1449 - "<DATE" - at or before a given date/time
1449 - "<DATE" - at or before a given date/time
1450 - ">DATE" - on or after a given date/time
1450 - ">DATE" - on or after a given date/time
1451 - "DATE to DATE" - a date range, inclusive
1451 - "DATE to DATE" - a date range, inclusive
1452 - "-DAYS" - within a given number of days from today
1452 - "-DAYS" - within a given number of days from today
1453
1453
1454 Test repeated config section name
1454 Test repeated config section name
1455
1455
1456 $ hg help config.host
1456 $ hg help config.host
1457 "http_proxy.host"
1457 "http_proxy.host"
1458 Host name and (optional) port of the proxy server, for example
1458 Host name and (optional) port of the proxy server, for example
1459 "myproxy:8000".
1459 "myproxy:8000".
1460
1460
1461 "smtp.host"
1461 "smtp.host"
1462 Host name of mail server, e.g. "mail.example.com".
1462 Host name of mail server, e.g. "mail.example.com".
1463
1463
1464
1464
1465 Test section name with dot
1465 Test section name with dot
1466
1466
1467 $ hg help config.ui.username
1467 $ hg help config.ui.username
1468 "ui.username"
1468 "ui.username"
1469 The committer of a changeset created when running "commit". Typically
1469 The committer of a changeset created when running "commit". Typically
1470 a person's name and email address, e.g. "Fred Widget
1470 a person's name and email address, e.g. "Fred Widget
1471 <fred@example.com>". Environment variables in the username are
1471 <fred@example.com>". Environment variables in the username are
1472 expanded.
1472 expanded.
1473
1473
1474 (default: "$EMAIL" or "username@hostname". If the username in hgrc is
1474 (default: "$EMAIL" or "username@hostname". If the username in hgrc is
1475 empty, e.g. if the system admin set "username =" in the system hgrc,
1475 empty, e.g. if the system admin set "username =" in the system hgrc,
1476 it has to be specified manually or in a different hgrc file)
1476 it has to be specified manually or in a different hgrc file)
1477
1477
1478
1478
1479 $ hg help config.annotate.git
1479 $ hg help config.annotate.git
1480 abort: help section not found: config.annotate.git
1480 abort: help section not found: config.annotate.git
1481 [255]
1481 [255]
1482
1482
1483 $ hg help config.update.check
1483 $ hg help config.update.check
1484 "commands.update.check"
1484 "commands.update.check"
1485 Determines what level of checking 'hg update' will perform before
1485 Determines what level of checking 'hg update' will perform before
1486 moving to a destination revision. Valid values are "abort", "none",
1486 moving to a destination revision. Valid values are "abort", "none",
1487 "linear", and "noconflict". "abort" always fails if the working
1487 "linear", and "noconflict". "abort" always fails if the working
1488 directory has uncommitted changes. "none" performs no checking, and
1488 directory has uncommitted changes. "none" performs no checking, and
1489 may result in a merge with uncommitted changes. "linear" allows any
1489 may result in a merge with uncommitted changes. "linear" allows any
1490 update as long as it follows a straight line in the revision history,
1490 update as long as it follows a straight line in the revision history,
1491 and may trigger a merge with uncommitted changes. "noconflict" will
1491 and may trigger a merge with uncommitted changes. "noconflict" will
1492 allow any update which would not trigger a merge with uncommitted
1492 allow any update which would not trigger a merge with uncommitted
1493 changes, if any are present. (default: "linear")
1493 changes, if any are present. (default: "linear")
1494
1494
1495
1495
1496 $ hg help config.commands.update.check
1496 $ hg help config.commands.update.check
1497 "commands.update.check"
1497 "commands.update.check"
1498 Determines what level of checking 'hg update' will perform before
1498 Determines what level of checking 'hg update' will perform before
1499 moving to a destination revision. Valid values are "abort", "none",
1499 moving to a destination revision. Valid values are "abort", "none",
1500 "linear", and "noconflict". "abort" always fails if the working
1500 "linear", and "noconflict". "abort" always fails if the working
1501 directory has uncommitted changes. "none" performs no checking, and
1501 directory has uncommitted changes. "none" performs no checking, and
1502 may result in a merge with uncommitted changes. "linear" allows any
1502 may result in a merge with uncommitted changes. "linear" allows any
1503 update as long as it follows a straight line in the revision history,
1503 update as long as it follows a straight line in the revision history,
1504 and may trigger a merge with uncommitted changes. "noconflict" will
1504 and may trigger a merge with uncommitted changes. "noconflict" will
1505 allow any update which would not trigger a merge with uncommitted
1505 allow any update which would not trigger a merge with uncommitted
1506 changes, if any are present. (default: "linear")
1506 changes, if any are present. (default: "linear")
1507
1507
1508
1508
1509 $ hg help config.ommands.update.check
1509 $ hg help config.ommands.update.check
1510 abort: help section not found: config.ommands.update.check
1510 abort: help section not found: config.ommands.update.check
1511 [255]
1511 [255]
1512
1512
1513 Unrelated trailing paragraphs shouldn't be included
1513 Unrelated trailing paragraphs shouldn't be included
1514
1514
1515 $ hg help config.extramsg | grep '^$'
1515 $ hg help config.extramsg | grep '^$'
1516
1516
1517
1517
1518 Test capitalized section name
1518 Test capitalized section name
1519
1519
1520 $ hg help scripting.HGPLAIN > /dev/null
1520 $ hg help scripting.HGPLAIN > /dev/null
1521
1521
1522 Help subsection:
1522 Help subsection:
1523
1523
1524 $ hg help config.charsets |grep "Email example:" > /dev/null
1524 $ hg help config.charsets |grep "Email example:" > /dev/null
1525 [1]
1525 [1]
1526
1526
1527 Show nested definitions
1527 Show nested definitions
1528 ("profiling.type"[break]"ls"[break]"stat"[break])
1528 ("profiling.type"[break]"ls"[break]"stat"[break])
1529
1529
1530 $ hg help config.type | egrep '^$'|wc -l
1530 $ hg help config.type | egrep '^$'|wc -l
1531 \s*3 (re)
1531 \s*3 (re)
1532
1532
1533 $ hg help config.profiling.type.ls
1533 $ hg help config.profiling.type.ls
1534 "profiling.type.ls"
1534 "profiling.type.ls"
1535 Use Python's built-in instrumenting profiler. This profiler works on
1535 Use Python's built-in instrumenting profiler. This profiler works on
1536 all platforms, but each line number it reports is the first line of
1536 all platforms, but each line number it reports is the first line of
1537 a function. This restriction makes it difficult to identify the
1537 a function. This restriction makes it difficult to identify the
1538 expensive parts of a non-trivial function.
1538 expensive parts of a non-trivial function.
1539
1539
1540
1540
1541 Separate sections from subsections
1541 Separate sections from subsections
1542
1542
1543 $ hg help config.format | egrep '^ ("|-)|^\s*$' | uniq
1543 $ hg help config.format | egrep '^ ("|-)|^\s*$' | uniq
1544 "format"
1544 "format"
1545 --------
1545 --------
1546
1546
1547 "usegeneraldelta"
1547 "usegeneraldelta"
1548
1548
1549 "dotencode"
1549 "dotencode"
1550
1550
1551 "usefncache"
1551 "usefncache"
1552
1552
1553 "usestore"
1553 "usestore"
1554
1554
1555 "sparse-revlog"
1555 "sparse-revlog"
1556
1556
1557 "revlog-compression"
1557 "revlog-compression"
1558
1558
1559 "bookmarks-in-store"
1559 "bookmarks-in-store"
1560
1560
1561 "profiling"
1561 "profiling"
1562 -----------
1562 -----------
1563
1563
1564 "format"
1564 "format"
1565
1565
1566 "progress"
1566 "progress"
1567 ----------
1567 ----------
1568
1568
1569 "format"
1569 "format"
1570
1570
1571
1571
1572 Last item in help config.*:
1572 Last item in help config.*:
1573
1573
1574 $ hg help config.`hg help config|grep '^ "'| \
1574 $ hg help config.`hg help config|grep '^ "'| \
1575 > tail -1|sed 's![ "]*!!g'`| \
1575 > tail -1|sed 's![ "]*!!g'`| \
1576 > grep 'hg help -c config' > /dev/null
1576 > grep 'hg help -c config' > /dev/null
1577 [1]
1577 [1]
1578
1578
1579 note to use help -c for general hg help config:
1579 note to use help -c for general hg help config:
1580
1580
1581 $ hg help config |grep 'hg help -c config' > /dev/null
1581 $ hg help config |grep 'hg help -c config' > /dev/null
1582
1582
1583 Test templating help
1583 Test templating help
1584
1584
1585 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
1585 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
1586 desc String. The text of the changeset description.
1586 desc String. The text of the changeset description.
1587 diffstat String. Statistics of changes with the following format:
1587 diffstat String. Statistics of changes with the following format:
1588 firstline Any text. Returns the first line of text.
1588 firstline Any text. Returns the first line of text.
1589 nonempty Any text. Returns '(none)' if the string is empty.
1589 nonempty Any text. Returns '(none)' if the string is empty.
1590
1590
1591 Test deprecated items
1591 Test deprecated items
1592
1592
1593 $ hg help -v templating | grep currentbookmark
1593 $ hg help -v templating | grep currentbookmark
1594 currentbookmark
1594 currentbookmark
1595 $ hg help templating | (grep currentbookmark || true)
1595 $ hg help templating | (grep currentbookmark || true)
1596
1596
1597 Test help hooks
1597 Test help hooks
1598
1598
1599 $ cat > helphook1.py <<EOF
1599 $ cat > helphook1.py <<EOF
1600 > from mercurial import help
1600 > from mercurial import help
1601 >
1601 >
1602 > def rewrite(ui, topic, doc):
1602 > def rewrite(ui, topic, doc):
1603 > return doc + b'\nhelphook1\n'
1603 > return doc + b'\nhelphook1\n'
1604 >
1604 >
1605 > def extsetup(ui):
1605 > def extsetup(ui):
1606 > help.addtopichook(b'revisions', rewrite)
1606 > help.addtopichook(b'revisions', rewrite)
1607 > EOF
1607 > EOF
1608 $ cat > helphook2.py <<EOF
1608 $ cat > helphook2.py <<EOF
1609 > from mercurial import help
1609 > from mercurial import help
1610 >
1610 >
1611 > def rewrite(ui, topic, doc):
1611 > def rewrite(ui, topic, doc):
1612 > return doc + b'\nhelphook2\n'
1612 > return doc + b'\nhelphook2\n'
1613 >
1613 >
1614 > def extsetup(ui):
1614 > def extsetup(ui):
1615 > help.addtopichook(b'revisions', rewrite)
1615 > help.addtopichook(b'revisions', rewrite)
1616 > EOF
1616 > EOF
1617 $ echo '[extensions]' >> $HGRCPATH
1617 $ echo '[extensions]' >> $HGRCPATH
1618 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
1618 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
1619 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
1619 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
1620 $ hg help revsets | grep helphook
1620 $ hg help revsets | grep helphook
1621 helphook1
1621 helphook1
1622 helphook2
1622 helphook2
1623
1623
1624 help -c should only show debug --debug
1624 help -c should only show debug --debug
1625
1625
1626 $ hg help -c --debug|egrep debug|wc -l|egrep '^\s*0\s*$'
1626 $ hg help -c --debug|egrep debug|wc -l|egrep '^\s*0\s*$'
1627 [1]
1627 [1]
1628
1628
1629 help -c should only show deprecated for -v
1629 help -c should only show deprecated for -v
1630
1630
1631 $ hg help -c -v|egrep DEPRECATED|wc -l|egrep '^\s*0\s*$'
1631 $ hg help -c -v|egrep DEPRECATED|wc -l|egrep '^\s*0\s*$'
1632 [1]
1632 [1]
1633
1633
1634 Test -s / --system
1634 Test -s / --system
1635
1635
1636 $ hg help config.files -s windows |grep 'etc/mercurial' | \
1636 $ hg help config.files -s windows |grep 'etc/mercurial' | \
1637 > wc -l | sed -e 's/ //g'
1637 > wc -l | sed -e 's/ //g'
1638 0
1638 0
1639 $ hg help config.files --system unix | grep 'USER' | \
1639 $ hg help config.files --system unix | grep 'USER' | \
1640 > wc -l | sed -e 's/ //g'
1640 > wc -l | sed -e 's/ //g'
1641 0
1641 0
1642
1642
1643 Test -e / -c / -k combinations
1643 Test -e / -c / -k combinations
1644
1644
1645 $ hg help -c|egrep '^[A-Z].*:|^ debug'
1645 $ hg help -c|egrep '^[A-Z].*:|^ debug'
1646 Commands:
1646 Commands:
1647 $ hg help -e|egrep '^[A-Z].*:|^ debug'
1647 $ hg help -e|egrep '^[A-Z].*:|^ debug'
1648 Extensions:
1648 Extensions:
1649 $ hg help -k|egrep '^[A-Z].*:|^ debug'
1649 $ hg help -k|egrep '^[A-Z].*:|^ debug'
1650 Topics:
1650 Topics:
1651 Commands:
1651 Commands:
1652 Extensions:
1652 Extensions:
1653 Extension Commands:
1653 Extension Commands:
1654 $ hg help -c schemes
1654 $ hg help -c schemes
1655 abort: no such help topic: schemes
1655 abort: no such help topic: schemes
1656 (try 'hg help --keyword schemes')
1656 (try 'hg help --keyword schemes')
1657 [255]
1657 [255]
1658 $ hg help -e schemes |head -1
1658 $ hg help -e schemes |head -1
1659 schemes extension - extend schemes with shortcuts to repository swarms
1659 schemes extension - extend schemes with shortcuts to repository swarms
1660 $ hg help -c -k dates |egrep '^(Topics|Extensions|Commands):'
1660 $ hg help -c -k dates |egrep '^(Topics|Extensions|Commands):'
1661 Commands:
1661 Commands:
1662 $ hg help -e -k a |egrep '^(Topics|Extensions|Commands):'
1662 $ hg help -e -k a |egrep '^(Topics|Extensions|Commands):'
1663 Extensions:
1663 Extensions:
1664 $ hg help -e -c -k date |egrep '^(Topics|Extensions|Commands):'
1664 $ hg help -e -c -k date |egrep '^(Topics|Extensions|Commands):'
1665 Extensions:
1665 Extensions:
1666 Commands:
1666 Commands:
1667 $ hg help -c commit > /dev/null
1667 $ hg help -c commit > /dev/null
1668 $ hg help -e -c commit > /dev/null
1668 $ hg help -e -c commit > /dev/null
1669 $ hg help -e commit
1669 $ hg help -e commit
1670 abort: no such help topic: commit
1670 abort: no such help topic: commit
1671 (try 'hg help --keyword commit')
1671 (try 'hg help --keyword commit')
1672 [255]
1672 [255]
1673
1673
1674 Test keyword search help
1674 Test keyword search help
1675
1675
1676 $ cat > prefixedname.py <<EOF
1676 $ cat > prefixedname.py <<EOF
1677 > '''matched against word "clone"
1677 > '''matched against word "clone"
1678 > '''
1678 > '''
1679 > EOF
1679 > EOF
1680 $ echo '[extensions]' >> $HGRCPATH
1680 $ echo '[extensions]' >> $HGRCPATH
1681 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
1681 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
1682 $ hg help -k clone
1682 $ hg help -k clone
1683 Topics:
1683 Topics:
1684
1684
1685 config Configuration Files
1685 config Configuration Files
1686 extensions Using Additional Features
1686 extensions Using Additional Features
1687 glossary Glossary
1687 glossary Glossary
1688 phases Working with Phases
1688 phases Working with Phases
1689 subrepos Subrepositories
1689 subrepos Subrepositories
1690 urls URL Paths
1690 urls URL Paths
1691
1691
1692 Commands:
1692 Commands:
1693
1693
1694 bookmarks create a new bookmark or list existing bookmarks
1694 bookmarks create a new bookmark or list existing bookmarks
1695 clone make a copy of an existing repository
1695 clone make a copy of an existing repository
1696 paths show aliases for remote repositories
1696 paths show aliases for remote repositories
1697 pull pull changes from the specified source
1697 pull pull changes from the specified source
1698 update update working directory (or switch revisions)
1698 update update working directory (or switch revisions)
1699
1699
1700 Extensions:
1700 Extensions:
1701
1701
1702 clonebundles advertise pre-generated bundles to seed clones
1702 clonebundles advertise pre-generated bundles to seed clones
1703 narrow create clones which fetch history data for subset of files
1703 narrow create clones which fetch history data for subset of files
1704 (EXPERIMENTAL)
1704 (EXPERIMENTAL)
1705 prefixedname matched against word "clone"
1705 prefixedname matched against word "clone"
1706 relink recreates hardlinks between repository clones
1706 relink recreates hardlinks between repository clones
1707
1707
1708 Extension Commands:
1708 Extension Commands:
1709
1709
1710 qclone clone main and patch repository at same time
1710 qclone clone main and patch repository at same time
1711
1711
1712 Test unfound topic
1712 Test unfound topic
1713
1713
1714 $ hg help nonexistingtopicthatwillneverexisteverever
1714 $ hg help nonexistingtopicthatwillneverexisteverever
1715 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
1715 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
1716 (try 'hg help --keyword nonexistingtopicthatwillneverexisteverever')
1716 (try 'hg help --keyword nonexistingtopicthatwillneverexisteverever')
1717 [255]
1717 [255]
1718
1718
1719 Test unfound keyword
1719 Test unfound keyword
1720
1720
1721 $ hg help --keyword nonexistingwordthatwillneverexisteverever
1721 $ hg help --keyword nonexistingwordthatwillneverexisteverever
1722 abort: no matches
1722 abort: no matches
1723 (try 'hg help' for a list of topics)
1723 (try 'hg help' for a list of topics)
1724 [255]
1724 [255]
1725
1725
1726 Test omit indicating for help
1726 Test omit indicating for help
1727
1727
1728 $ cat > addverboseitems.py <<EOF
1728 $ cat > addverboseitems.py <<EOF
1729 > r'''extension to test omit indicating.
1729 > r'''extension to test omit indicating.
1730 >
1730 >
1731 > This paragraph is never omitted (for extension)
1731 > This paragraph is never omitted (for extension)
1732 >
1732 >
1733 > .. container:: verbose
1733 > .. container:: verbose
1734 >
1734 >
1735 > This paragraph is omitted,
1735 > This paragraph is omitted,
1736 > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension)
1736 > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension)
1737 >
1737 >
1738 > This paragraph is never omitted, too (for extension)
1738 > This paragraph is never omitted, too (for extension)
1739 > '''
1739 > '''
1740 > from __future__ import absolute_import
1740 > from __future__ import absolute_import
1741 > from mercurial import commands, help
1741 > from mercurial import commands, help
1742 > testtopic = br"""This paragraph is never omitted (for topic).
1742 > testtopic = br"""This paragraph is never omitted (for topic).
1743 >
1743 >
1744 > .. container:: verbose
1744 > .. container:: verbose
1745 >
1745 >
1746 > This paragraph is omitted,
1746 > This paragraph is omitted,
1747 > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic)
1747 > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic)
1748 >
1748 >
1749 > This paragraph is never omitted, too (for topic)
1749 > This paragraph is never omitted, too (for topic)
1750 > """
1750 > """
1751 > def extsetup(ui):
1751 > def extsetup(ui):
1752 > help.helptable.append(([b"topic-containing-verbose"],
1752 > help.helptable.append(([b"topic-containing-verbose"],
1753 > b"This is the topic to test omit indicating.",
1753 > b"This is the topic to test omit indicating.",
1754 > lambda ui: testtopic))
1754 > lambda ui: testtopic))
1755 > EOF
1755 > EOF
1756 $ echo '[extensions]' >> $HGRCPATH
1756 $ echo '[extensions]' >> $HGRCPATH
1757 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1757 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1758 $ hg help addverboseitems
1758 $ hg help addverboseitems
1759 addverboseitems extension - extension to test omit indicating.
1759 addverboseitems extension - extension to test omit indicating.
1760
1760
1761 This paragraph is never omitted (for extension)
1761 This paragraph is never omitted (for extension)
1762
1762
1763 This paragraph is never omitted, too (for extension)
1763 This paragraph is never omitted, too (for extension)
1764
1764
1765 (some details hidden, use --verbose to show complete help)
1765 (some details hidden, use --verbose to show complete help)
1766
1766
1767 no commands defined
1767 no commands defined
1768 $ hg help -v addverboseitems
1768 $ hg help -v addverboseitems
1769 addverboseitems extension - extension to test omit indicating.
1769 addverboseitems extension - extension to test omit indicating.
1770
1770
1771 This paragraph is never omitted (for extension)
1771 This paragraph is never omitted (for extension)
1772
1772
1773 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1773 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1774 extension)
1774 extension)
1775
1775
1776 This paragraph is never omitted, too (for extension)
1776 This paragraph is never omitted, too (for extension)
1777
1777
1778 no commands defined
1778 no commands defined
1779 $ hg help topic-containing-verbose
1779 $ hg help topic-containing-verbose
1780 This is the topic to test omit indicating.
1780 This is the topic to test omit indicating.
1781 """"""""""""""""""""""""""""""""""""""""""
1781 """"""""""""""""""""""""""""""""""""""""""
1782
1782
1783 This paragraph is never omitted (for topic).
1783 This paragraph is never omitted (for topic).
1784
1784
1785 This paragraph is never omitted, too (for topic)
1785 This paragraph is never omitted, too (for topic)
1786
1786
1787 (some details hidden, use --verbose to show complete help)
1787 (some details hidden, use --verbose to show complete help)
1788 $ hg help -v topic-containing-verbose
1788 $ hg help -v topic-containing-verbose
1789 This is the topic to test omit indicating.
1789 This is the topic to test omit indicating.
1790 """"""""""""""""""""""""""""""""""""""""""
1790 """"""""""""""""""""""""""""""""""""""""""
1791
1791
1792 This paragraph is never omitted (for topic).
1792 This paragraph is never omitted (for topic).
1793
1793
1794 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1794 This paragraph is omitted, if 'hg help' is invoked without "-v" (for
1795 topic)
1795 topic)
1796
1796
1797 This paragraph is never omitted, too (for topic)
1797 This paragraph is never omitted, too (for topic)
1798
1798
1799 Test section lookup
1799 Test section lookup
1800
1800
1801 $ hg help revset.merge
1801 $ hg help revset.merge
1802 "merge()"
1802 "merge()"
1803 Changeset is a merge changeset.
1803 Changeset is a merge changeset.
1804
1804
1805 $ hg help glossary.dag
1805 $ hg help glossary.dag
1806 DAG
1806 DAG
1807 The repository of changesets of a distributed version control system
1807 The repository of changesets of a distributed version control system
1808 (DVCS) can be described as a directed acyclic graph (DAG), consisting
1808 (DVCS) can be described as a directed acyclic graph (DAG), consisting
1809 of nodes and edges, where nodes correspond to changesets and edges
1809 of nodes and edges, where nodes correspond to changesets and edges
1810 imply a parent -> child relation. This graph can be visualized by
1810 imply a parent -> child relation. This graph can be visualized by
1811 graphical tools such as 'hg log --graph'. In Mercurial, the DAG is
1811 graphical tools such as 'hg log --graph'. In Mercurial, the DAG is
1812 limited by the requirement for children to have at most two parents.
1812 limited by the requirement for children to have at most two parents.
1813
1813
1814
1814
1815 $ hg help hgrc.paths
1815 $ hg help hgrc.paths
1816 "paths"
1816 "paths"
1817 -------
1817 -------
1818
1818
1819 Assigns symbolic names and behavior to repositories.
1819 Assigns symbolic names and behavior to repositories.
1820
1820
1821 Options are symbolic names defining the URL or directory that is the
1821 Options are symbolic names defining the URL or directory that is the
1822 location of the repository. Example:
1822 location of the repository. Example:
1823
1823
1824 [paths]
1824 [paths]
1825 my_server = https://example.com/my_repo
1825 my_server = https://example.com/my_repo
1826 local_path = /home/me/repo
1826 local_path = /home/me/repo
1827
1827
1828 These symbolic names can be used from the command line. To pull from
1828 These symbolic names can be used from the command line. To pull from
1829 "my_server": 'hg pull my_server'. To push to "local_path": 'hg push
1829 "my_server": 'hg pull my_server'. To push to "local_path": 'hg push
1830 local_path'.
1830 local_path'.
1831
1831
1832 Options containing colons (":") denote sub-options that can influence
1832 Options containing colons (":") denote sub-options that can influence
1833 behavior for that specific path. Example:
1833 behavior for that specific path. Example:
1834
1834
1835 [paths]
1835 [paths]
1836 my_server = https://example.com/my_path
1836 my_server = https://example.com/my_path
1837 my_server:pushurl = ssh://example.com/my_path
1837 my_server:pushurl = ssh://example.com/my_path
1838
1838
1839 The following sub-options can be defined:
1839 The following sub-options can be defined:
1840
1840
1841 "pushurl"
1841 "pushurl"
1842 The URL to use for push operations. If not defined, the location
1842 The URL to use for push operations. If not defined, the location
1843 defined by the path's main entry is used.
1843 defined by the path's main entry is used.
1844
1844
1845 "pushrev"
1845 "pushrev"
1846 A revset defining which revisions to push by default.
1846 A revset defining which revisions to push by default.
1847
1847
1848 When 'hg push' is executed without a "-r" argument, the revset defined
1848 When 'hg push' is executed without a "-r" argument, the revset defined
1849 by this sub-option is evaluated to determine what to push.
1849 by this sub-option is evaluated to determine what to push.
1850
1850
1851 For example, a value of "." will push the working directory's revision
1851 For example, a value of "." will push the working directory's revision
1852 by default.
1852 by default.
1853
1853
1854 Revsets specifying bookmarks will not result in the bookmark being
1854 Revsets specifying bookmarks will not result in the bookmark being
1855 pushed.
1855 pushed.
1856
1856
1857 The following special named paths exist:
1857 The following special named paths exist:
1858
1858
1859 "default"
1859 "default"
1860 The URL or directory to use when no source or remote is specified.
1860 The URL or directory to use when no source or remote is specified.
1861
1861
1862 'hg clone' will automatically define this path to the location the
1862 'hg clone' will automatically define this path to the location the
1863 repository was cloned from.
1863 repository was cloned from.
1864
1864
1865 "default-push"
1865 "default-push"
1866 (deprecated) The URL or directory for the default 'hg push' location.
1866 (deprecated) The URL or directory for the default 'hg push' location.
1867 "default:pushurl" should be used instead.
1867 "default:pushurl" should be used instead.
1868
1868
1869 $ hg help glossary.mcguffin
1869 $ hg help glossary.mcguffin
1870 abort: help section not found: glossary.mcguffin
1870 abort: help section not found: glossary.mcguffin
1871 [255]
1871 [255]
1872
1872
1873 $ hg help glossary.mc.guffin
1873 $ hg help glossary.mc.guffin
1874 abort: help section not found: glossary.mc.guffin
1874 abort: help section not found: glossary.mc.guffin
1875 [255]
1875 [255]
1876
1876
1877 $ hg help template.files
1877 $ hg help template.files
1878 files List of strings. All files modified, added, or removed by
1878 files List of strings. All files modified, added, or removed by
1879 this changeset.
1879 this changeset.
1880 files(pattern)
1880 files(pattern)
1881 All files of the current changeset matching the pattern. See
1881 All files of the current changeset matching the pattern. See
1882 'hg help patterns'.
1882 'hg help patterns'.
1883
1883
1884 Test section lookup by translated message
1884 Test section lookup by translated message
1885
1885
1886 str.lower() instead of encoding.lower(str) on translated message might
1886 str.lower() instead of encoding.lower(str) on translated message might
1887 make message meaningless, because some encoding uses 0x41(A) - 0x5a(Z)
1887 make message meaningless, because some encoding uses 0x41(A) - 0x5a(Z)
1888 as the second or later byte of multi-byte character.
1888 as the second or later byte of multi-byte character.
1889
1889
1890 For example, "\x8bL\x98^" (translation of "record" in ja_JP.cp932)
1890 For example, "\x8bL\x98^" (translation of "record" in ja_JP.cp932)
1891 contains 0x4c (L). str.lower() replaces 0x4c(L) by 0x6c(l) and this
1891 contains 0x4c (L). str.lower() replaces 0x4c(L) by 0x6c(l) and this
1892 replacement makes message meaningless.
1892 replacement makes message meaningless.
1893
1893
1894 This tests that section lookup by translated string isn't broken by
1894 This tests that section lookup by translated string isn't broken by
1895 such str.lower().
1895 such str.lower().
1896
1896
1897 $ "$PYTHON" <<EOF
1897 $ "$PYTHON" <<EOF
1898 > def escape(s):
1898 > def escape(s):
1899 > return b''.join(b'\\u%x' % ord(uc) for uc in s.decode('cp932'))
1899 > return b''.join(b'\\u%x' % ord(uc) for uc in s.decode('cp932'))
1900 > # translation of "record" in ja_JP.cp932
1900 > # translation of "record" in ja_JP.cp932
1901 > upper = b"\x8bL\x98^"
1901 > upper = b"\x8bL\x98^"
1902 > # str.lower()-ed section name should be treated as different one
1902 > # str.lower()-ed section name should be treated as different one
1903 > lower = b"\x8bl\x98^"
1903 > lower = b"\x8bl\x98^"
1904 > with open('ambiguous.py', 'wb') as fp:
1904 > with open('ambiguous.py', 'wb') as fp:
1905 > fp.write(b"""# ambiguous section names in ja_JP.cp932
1905 > fp.write(b"""# ambiguous section names in ja_JP.cp932
1906 > u'''summary of extension
1906 > u'''summary of extension
1907 >
1907 >
1908 > %s
1908 > %s
1909 > ----
1909 > ----
1910 >
1910 >
1911 > Upper name should show only this message
1911 > Upper name should show only this message
1912 >
1912 >
1913 > %s
1913 > %s
1914 > ----
1914 > ----
1915 >
1915 >
1916 > Lower name should show only this message
1916 > Lower name should show only this message
1917 >
1917 >
1918 > subsequent section
1918 > subsequent section
1919 > ------------------
1919 > ------------------
1920 >
1920 >
1921 > This should be hidden at 'hg help ambiguous' with section name.
1921 > This should be hidden at 'hg help ambiguous' with section name.
1922 > '''
1922 > '''
1923 > """ % (escape(upper), escape(lower)))
1923 > """ % (escape(upper), escape(lower)))
1924 > EOF
1924 > EOF
1925
1925
1926 $ cat >> $HGRCPATH <<EOF
1926 $ cat >> $HGRCPATH <<EOF
1927 > [extensions]
1927 > [extensions]
1928 > ambiguous = ./ambiguous.py
1928 > ambiguous = ./ambiguous.py
1929 > EOF
1929 > EOF
1930
1930
1931 $ "$PYTHON" <<EOF | sh
1931 $ "$PYTHON" <<EOF | sh
1932 > from mercurial.utils import procutil
1932 > from mercurial.utils import procutil
1933 > upper = b"\x8bL\x98^"
1933 > upper = b"\x8bL\x98^"
1934 > procutil.stdout.write(b"hg --encoding cp932 help -e ambiguous.%s\n" % upper)
1934 > procutil.stdout.write(b"hg --encoding cp932 help -e ambiguous.%s\n" % upper)
1935 > EOF
1935 > EOF
1936 \x8bL\x98^ (esc)
1936 \x8bL\x98^ (esc)
1937 ----
1937 ----
1938
1938
1939 Upper name should show only this message
1939 Upper name should show only this message
1940
1940
1941
1941
1942 $ "$PYTHON" <<EOF | sh
1942 $ "$PYTHON" <<EOF | sh
1943 > from mercurial.utils import procutil
1943 > from mercurial.utils import procutil
1944 > lower = b"\x8bl\x98^"
1944 > lower = b"\x8bl\x98^"
1945 > procutil.stdout.write(b"hg --encoding cp932 help -e ambiguous.%s\n" % lower)
1945 > procutil.stdout.write(b"hg --encoding cp932 help -e ambiguous.%s\n" % lower)
1946 > EOF
1946 > EOF
1947 \x8bl\x98^ (esc)
1947 \x8bl\x98^ (esc)
1948 ----
1948 ----
1949
1949
1950 Lower name should show only this message
1950 Lower name should show only this message
1951
1951
1952
1952
1953 $ cat >> $HGRCPATH <<EOF
1953 $ cat >> $HGRCPATH <<EOF
1954 > [extensions]
1954 > [extensions]
1955 > ambiguous = !
1955 > ambiguous = !
1956 > EOF
1956 > EOF
1957
1957
1958 Show help content of disabled extensions
1958 Show help content of disabled extensions
1959
1959
1960 $ cat >> $HGRCPATH <<EOF
1960 $ cat >> $HGRCPATH <<EOF
1961 > [extensions]
1961 > [extensions]
1962 > ambiguous = !./ambiguous.py
1962 > ambiguous = !./ambiguous.py
1963 > EOF
1963 > EOF
1964 $ hg help -e ambiguous
1964 $ hg help -e ambiguous
1965 ambiguous extension - (no help text available)
1965 ambiguous extension - (no help text available)
1966
1966
1967 (use 'hg help extensions' for information on enabling extensions)
1967 (use 'hg help extensions' for information on enabling extensions)
1968
1968
1969 Test dynamic list of merge tools only shows up once
1969 Test dynamic list of merge tools only shows up once
1970 $ hg help merge-tools
1970 $ hg help merge-tools
1971 Merge Tools
1971 Merge Tools
1972 """""""""""
1972 """""""""""
1973
1973
1974 To merge files Mercurial uses merge tools.
1974 To merge files Mercurial uses merge tools.
1975
1975
1976 A merge tool combines two different versions of a file into a merged file.
1976 A merge tool combines two different versions of a file into a merged file.
1977 Merge tools are given the two files and the greatest common ancestor of
1977 Merge tools are given the two files and the greatest common ancestor of
1978 the two file versions, so they can determine the changes made on both
1978 the two file versions, so they can determine the changes made on both
1979 branches.
1979 branches.
1980
1980
1981 Merge tools are used both for 'hg resolve', 'hg merge', 'hg update', 'hg
1981 Merge tools are used both for 'hg resolve', 'hg merge', 'hg update', 'hg
1982 backout' and in several extensions.
1982 backout' and in several extensions.
1983
1983
1984 Usually, the merge tool tries to automatically reconcile the files by
1984 Usually, the merge tool tries to automatically reconcile the files by
1985 combining all non-overlapping changes that occurred separately in the two
1985 combining all non-overlapping changes that occurred separately in the two
1986 different evolutions of the same initial base file. Furthermore, some
1986 different evolutions of the same initial base file. Furthermore, some
1987 interactive merge programs make it easier to manually resolve conflicting
1987 interactive merge programs make it easier to manually resolve conflicting
1988 merges, either in a graphical way, or by inserting some conflict markers.
1988 merges, either in a graphical way, or by inserting some conflict markers.
1989 Mercurial does not include any interactive merge programs but relies on
1989 Mercurial does not include any interactive merge programs but relies on
1990 external tools for that.
1990 external tools for that.
1991
1991
1992 Available merge tools
1992 Available merge tools
1993 =====================
1993 =====================
1994
1994
1995 External merge tools and their properties are configured in the merge-
1995 External merge tools and their properties are configured in the merge-
1996 tools configuration section - see hgrc(5) - but they can often just be
1996 tools configuration section - see hgrc(5) - but they can often just be
1997 named by their executable.
1997 named by their executable.
1998
1998
1999 A merge tool is generally usable if its executable can be found on the
1999 A merge tool is generally usable if its executable can be found on the
2000 system and if it can handle the merge. The executable is found if it is an
2000 system and if it can handle the merge. The executable is found if it is an
2001 absolute or relative executable path or the name of an application in the
2001 absolute or relative executable path or the name of an application in the
2002 executable search path. The tool is assumed to be able to handle the merge
2002 executable search path. The tool is assumed to be able to handle the merge
2003 if it can handle symlinks if the file is a symlink, if it can handle
2003 if it can handle symlinks if the file is a symlink, if it can handle
2004 binary files if the file is binary, and if a GUI is available if the tool
2004 binary files if the file is binary, and if a GUI is available if the tool
2005 requires a GUI.
2005 requires a GUI.
2006
2006
2007 There are some internal merge tools which can be used. The internal merge
2007 There are some internal merge tools which can be used. The internal merge
2008 tools are:
2008 tools are:
2009
2009
2010 ":dump"
2010 ":dump"
2011 Creates three versions of the files to merge, containing the contents of
2011 Creates three versions of the files to merge, containing the contents of
2012 local, other and base. These files can then be used to perform a merge
2012 local, other and base. These files can then be used to perform a merge
2013 manually. If the file to be merged is named "a.txt", these files will
2013 manually. If the file to be merged is named "a.txt", these files will
2014 accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and
2014 accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and
2015 they will be placed in the same directory as "a.txt".
2015 they will be placed in the same directory as "a.txt".
2016
2016
2017 This implies premerge. Therefore, files aren't dumped, if premerge runs
2017 This implies premerge. Therefore, files aren't dumped, if premerge runs
2018 successfully. Use :forcedump to forcibly write files out.
2018 successfully. Use :forcedump to forcibly write files out.
2019
2019
2020 (actual capabilities: binary, symlink)
2020 (actual capabilities: binary, symlink)
2021
2021
2022 ":fail"
2022 ":fail"
2023 Rather than attempting to merge files that were modified on both
2023 Rather than attempting to merge files that were modified on both
2024 branches, it marks them as unresolved. The resolve command must be used
2024 branches, it marks them as unresolved. The resolve command must be used
2025 to resolve these conflicts.
2025 to resolve these conflicts.
2026
2026
2027 (actual capabilities: binary, symlink)
2027 (actual capabilities: binary, symlink)
2028
2028
2029 ":forcedump"
2029 ":forcedump"
2030 Creates three versions of the files as same as :dump, but omits
2030 Creates three versions of the files as same as :dump, but omits
2031 premerge.
2031 premerge.
2032
2032
2033 (actual capabilities: binary, symlink)
2033 (actual capabilities: binary, symlink)
2034
2034
2035 ":local"
2035 ":local"
2036 Uses the local 'p1()' version of files as the merged version.
2036 Uses the local 'p1()' version of files as the merged version.
2037
2037
2038 (actual capabilities: binary, symlink)
2038 (actual capabilities: binary, symlink)
2039
2039
2040 ":merge"
2040 ":merge"
2041 Uses the internal non-interactive simple merge algorithm for merging
2041 Uses the internal non-interactive simple merge algorithm for merging
2042 files. It will fail if there are any conflicts and leave markers in the
2042 files. It will fail if there are any conflicts and leave markers in the
2043 partially merged file. Markers will have two sections, one for each side
2043 partially merged file. Markers will have two sections, one for each side
2044 of merge.
2044 of merge.
2045
2045
2046 ":merge-local"
2046 ":merge-local"
2047 Like :merge, but resolve all conflicts non-interactively in favor of the
2047 Like :merge, but resolve all conflicts non-interactively in favor of the
2048 local 'p1()' changes.
2048 local 'p1()' changes.
2049
2049
2050 ":merge-other"
2050 ":merge-other"
2051 Like :merge, but resolve all conflicts non-interactively in favor of the
2051 Like :merge, but resolve all conflicts non-interactively in favor of the
2052 other 'p2()' changes.
2052 other 'p2()' changes.
2053
2053
2054 ":merge3"
2054 ":merge3"
2055 Uses the internal non-interactive simple merge algorithm for merging
2055 Uses the internal non-interactive simple merge algorithm for merging
2056 files. It will fail if there are any conflicts and leave markers in the
2056 files. It will fail if there are any conflicts and leave markers in the
2057 partially merged file. Marker will have three sections, one from each
2057 partially merged file. Marker will have three sections, one from each
2058 side of the merge and one for the base content.
2058 side of the merge and one for the base content.
2059
2059
2060 ":mergediff"
2061 Uses the internal non-interactive simple merge algorithm for merging
2062 files. It will fail if there are any conflicts and leave markers in the
2063 partially merged file. The marker will have two sections, one with the
2064 content from one side of the merge, and one with a diff from the base
2065 content to the content on the other side. (experimental)
2066
2060 ":other"
2067 ":other"
2061 Uses the other 'p2()' version of files as the merged version.
2068 Uses the other 'p2()' version of files as the merged version.
2062
2069
2063 (actual capabilities: binary, symlink)
2070 (actual capabilities: binary, symlink)
2064
2071
2065 ":prompt"
2072 ":prompt"
2066 Asks the user which of the local 'p1()' or the other 'p2()' version to
2073 Asks the user which of the local 'p1()' or the other 'p2()' version to
2067 keep as the merged version.
2074 keep as the merged version.
2068
2075
2069 (actual capabilities: binary, symlink)
2076 (actual capabilities: binary, symlink)
2070
2077
2071 ":tagmerge"
2078 ":tagmerge"
2072 Uses the internal tag merge algorithm (experimental).
2079 Uses the internal tag merge algorithm (experimental).
2073
2080
2074 ":union"
2081 ":union"
2075 Uses the internal non-interactive simple merge algorithm for merging
2082 Uses the internal non-interactive simple merge algorithm for merging
2076 files. It will use both left and right sides for conflict regions. No
2083 files. It will use both left and right sides for conflict regions. No
2077 markers are inserted.
2084 markers are inserted.
2078
2085
2079 Internal tools are always available and do not require a GUI but will by
2086 Internal tools are always available and do not require a GUI but will by
2080 default not handle symlinks or binary files. See next section for detail
2087 default not handle symlinks or binary files. See next section for detail
2081 about "actual capabilities" described above.
2088 about "actual capabilities" described above.
2082
2089
2083 Choosing a merge tool
2090 Choosing a merge tool
2084 =====================
2091 =====================
2085
2092
2086 Mercurial uses these rules when deciding which merge tool to use:
2093 Mercurial uses these rules when deciding which merge tool to use:
2087
2094
2088 1. If a tool has been specified with the --tool option to merge or
2095 1. If a tool has been specified with the --tool option to merge or
2089 resolve, it is used. If it is the name of a tool in the merge-tools
2096 resolve, it is used. If it is the name of a tool in the merge-tools
2090 configuration, its configuration is used. Otherwise the specified tool
2097 configuration, its configuration is used. Otherwise the specified tool
2091 must be executable by the shell.
2098 must be executable by the shell.
2092 2. If the "HGMERGE" environment variable is present, its value is used and
2099 2. If the "HGMERGE" environment variable is present, its value is used and
2093 must be executable by the shell.
2100 must be executable by the shell.
2094 3. If the filename of the file to be merged matches any of the patterns in
2101 3. If the filename of the file to be merged matches any of the patterns in
2095 the merge-patterns configuration section, the first usable merge tool
2102 the merge-patterns configuration section, the first usable merge tool
2096 corresponding to a matching pattern is used.
2103 corresponding to a matching pattern is used.
2097 4. If ui.merge is set it will be considered next. If the value is not the
2104 4. If ui.merge is set it will be considered next. If the value is not the
2098 name of a configured tool, the specified value is used and must be
2105 name of a configured tool, the specified value is used and must be
2099 executable by the shell. Otherwise the named tool is used if it is
2106 executable by the shell. Otherwise the named tool is used if it is
2100 usable.
2107 usable.
2101 5. If any usable merge tools are present in the merge-tools configuration
2108 5. If any usable merge tools are present in the merge-tools configuration
2102 section, the one with the highest priority is used.
2109 section, the one with the highest priority is used.
2103 6. If a program named "hgmerge" can be found on the system, it is used -
2110 6. If a program named "hgmerge" can be found on the system, it is used -
2104 but it will by default not be used for symlinks and binary files.
2111 but it will by default not be used for symlinks and binary files.
2105 7. If the file to be merged is not binary and is not a symlink, then
2112 7. If the file to be merged is not binary and is not a symlink, then
2106 internal ":merge" is used.
2113 internal ":merge" is used.
2107 8. Otherwise, ":prompt" is used.
2114 8. Otherwise, ":prompt" is used.
2108
2115
2109 For historical reason, Mercurial treats merge tools as below while
2116 For historical reason, Mercurial treats merge tools as below while
2110 examining rules above.
2117 examining rules above.
2111
2118
2112 step specified via binary symlink
2119 step specified via binary symlink
2113 ----------------------------------
2120 ----------------------------------
2114 1. --tool o/o o/o
2121 1. --tool o/o o/o
2115 2. HGMERGE o/o o/o
2122 2. HGMERGE o/o o/o
2116 3. merge-patterns o/o(*) x/?(*)
2123 3. merge-patterns o/o(*) x/?(*)
2117 4. ui.merge x/?(*) x/?(*)
2124 4. ui.merge x/?(*) x/?(*)
2118
2125
2119 Each capability column indicates Mercurial behavior for internal/external
2126 Each capability column indicates Mercurial behavior for internal/external
2120 merge tools at examining each rule.
2127 merge tools at examining each rule.
2121
2128
2122 - "o": "assume that a tool has capability"
2129 - "o": "assume that a tool has capability"
2123 - "x": "assume that a tool does not have capability"
2130 - "x": "assume that a tool does not have capability"
2124 - "?": "check actual capability of a tool"
2131 - "?": "check actual capability of a tool"
2125
2132
2126 If "merge.strict-capability-check" configuration is true, Mercurial checks
2133 If "merge.strict-capability-check" configuration is true, Mercurial checks
2127 capabilities of merge tools strictly in (*) cases above (= each capability
2134 capabilities of merge tools strictly in (*) cases above (= each capability
2128 column becomes "?/?"). It is false by default for backward compatibility.
2135 column becomes "?/?"). It is false by default for backward compatibility.
2129
2136
2130 Note:
2137 Note:
2131 After selecting a merge program, Mercurial will by default attempt to
2138 After selecting a merge program, Mercurial will by default attempt to
2132 merge the files using a simple merge algorithm first. Only if it
2139 merge the files using a simple merge algorithm first. Only if it
2133 doesn't succeed because of conflicting changes will Mercurial actually
2140 doesn't succeed because of conflicting changes will Mercurial actually
2134 execute the merge program. Whether to use the simple merge algorithm
2141 execute the merge program. Whether to use the simple merge algorithm
2135 first can be controlled by the premerge setting of the merge tool.
2142 first can be controlled by the premerge setting of the merge tool.
2136 Premerge is enabled by default unless the file is binary or a symlink.
2143 Premerge is enabled by default unless the file is binary or a symlink.
2137
2144
2138 See the merge-tools and ui sections of hgrc(5) for details on the
2145 See the merge-tools and ui sections of hgrc(5) for details on the
2139 configuration of merge tools.
2146 configuration of merge tools.
2140
2147
2141 Compression engines listed in `hg help bundlespec`
2148 Compression engines listed in `hg help bundlespec`
2142
2149
2143 $ hg help bundlespec | grep gzip
2150 $ hg help bundlespec | grep gzip
2144 "v1" bundles can only use the "gzip", "bzip2", and "none" compression
2151 "v1" bundles can only use the "gzip", "bzip2", and "none" compression
2145 An algorithm that produces smaller bundles than "gzip".
2152 An algorithm that produces smaller bundles than "gzip".
2146 This engine will likely produce smaller bundles than "gzip" but will be
2153 This engine will likely produce smaller bundles than "gzip" but will be
2147 "gzip"
2154 "gzip"
2148 better compression than "gzip". It also frequently yields better (?)
2155 better compression than "gzip". It also frequently yields better (?)
2149
2156
2150 Test usage of section marks in help documents
2157 Test usage of section marks in help documents
2151
2158
2152 $ cd "$TESTDIR"/../doc
2159 $ cd "$TESTDIR"/../doc
2153 $ "$PYTHON" check-seclevel.py
2160 $ "$PYTHON" check-seclevel.py
2154 $ cd $TESTTMP
2161 $ cd $TESTTMP
2155
2162
2156 #if serve
2163 #if serve
2157
2164
2158 Test the help pages in hgweb.
2165 Test the help pages in hgweb.
2159
2166
2160 Dish up an empty repo; serve it cold.
2167 Dish up an empty repo; serve it cold.
2161
2168
2162 $ hg init "$TESTTMP/test"
2169 $ hg init "$TESTTMP/test"
2163 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
2170 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
2164 $ cat hg.pid >> $DAEMON_PIDS
2171 $ cat hg.pid >> $DAEMON_PIDS
2165
2172
2166 $ get-with-headers.py $LOCALIP:$HGPORT "help"
2173 $ get-with-headers.py $LOCALIP:$HGPORT "help"
2167 200 Script output follows
2174 200 Script output follows
2168
2175
2169 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2176 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2170 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2177 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2171 <head>
2178 <head>
2172 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2179 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2173 <meta name="robots" content="index, nofollow" />
2180 <meta name="robots" content="index, nofollow" />
2174 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2181 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2175 <script type="text/javascript" src="/static/mercurial.js"></script>
2182 <script type="text/javascript" src="/static/mercurial.js"></script>
2176
2183
2177 <title>Help: Index</title>
2184 <title>Help: Index</title>
2178 </head>
2185 </head>
2179 <body>
2186 <body>
2180
2187
2181 <div class="container">
2188 <div class="container">
2182 <div class="menu">
2189 <div class="menu">
2183 <div class="logo">
2190 <div class="logo">
2184 <a href="https://mercurial-scm.org/">
2191 <a href="https://mercurial-scm.org/">
2185 <img src="/static/hglogo.png" alt="mercurial" /></a>
2192 <img src="/static/hglogo.png" alt="mercurial" /></a>
2186 </div>
2193 </div>
2187 <ul>
2194 <ul>
2188 <li><a href="/shortlog">log</a></li>
2195 <li><a href="/shortlog">log</a></li>
2189 <li><a href="/graph">graph</a></li>
2196 <li><a href="/graph">graph</a></li>
2190 <li><a href="/tags">tags</a></li>
2197 <li><a href="/tags">tags</a></li>
2191 <li><a href="/bookmarks">bookmarks</a></li>
2198 <li><a href="/bookmarks">bookmarks</a></li>
2192 <li><a href="/branches">branches</a></li>
2199 <li><a href="/branches">branches</a></li>
2193 </ul>
2200 </ul>
2194 <ul>
2201 <ul>
2195 <li class="active">help</li>
2202 <li class="active">help</li>
2196 </ul>
2203 </ul>
2197 </div>
2204 </div>
2198
2205
2199 <div class="main">
2206 <div class="main">
2200 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2207 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2201
2208
2202 <form class="search" action="/log">
2209 <form class="search" action="/log">
2203
2210
2204 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2211 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2205 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2212 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2206 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2213 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2207 </form>
2214 </form>
2208 <table class="bigtable">
2215 <table class="bigtable">
2209 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
2216 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
2210
2217
2211 <tr><td>
2218 <tr><td>
2212 <a href="/help/bundlespec">
2219 <a href="/help/bundlespec">
2213 bundlespec
2220 bundlespec
2214 </a>
2221 </a>
2215 </td><td>
2222 </td><td>
2216 Bundle File Formats
2223 Bundle File Formats
2217 </td></tr>
2224 </td></tr>
2218 <tr><td>
2225 <tr><td>
2219 <a href="/help/color">
2226 <a href="/help/color">
2220 color
2227 color
2221 </a>
2228 </a>
2222 </td><td>
2229 </td><td>
2223 Colorizing Outputs
2230 Colorizing Outputs
2224 </td></tr>
2231 </td></tr>
2225 <tr><td>
2232 <tr><td>
2226 <a href="/help/config">
2233 <a href="/help/config">
2227 config
2234 config
2228 </a>
2235 </a>
2229 </td><td>
2236 </td><td>
2230 Configuration Files
2237 Configuration Files
2231 </td></tr>
2238 </td></tr>
2232 <tr><td>
2239 <tr><td>
2233 <a href="/help/dates">
2240 <a href="/help/dates">
2234 dates
2241 dates
2235 </a>
2242 </a>
2236 </td><td>
2243 </td><td>
2237 Date Formats
2244 Date Formats
2238 </td></tr>
2245 </td></tr>
2239 <tr><td>
2246 <tr><td>
2240 <a href="/help/deprecated">
2247 <a href="/help/deprecated">
2241 deprecated
2248 deprecated
2242 </a>
2249 </a>
2243 </td><td>
2250 </td><td>
2244 Deprecated Features
2251 Deprecated Features
2245 </td></tr>
2252 </td></tr>
2246 <tr><td>
2253 <tr><td>
2247 <a href="/help/diffs">
2254 <a href="/help/diffs">
2248 diffs
2255 diffs
2249 </a>
2256 </a>
2250 </td><td>
2257 </td><td>
2251 Diff Formats
2258 Diff Formats
2252 </td></tr>
2259 </td></tr>
2253 <tr><td>
2260 <tr><td>
2254 <a href="/help/environment">
2261 <a href="/help/environment">
2255 environment
2262 environment
2256 </a>
2263 </a>
2257 </td><td>
2264 </td><td>
2258 Environment Variables
2265 Environment Variables
2259 </td></tr>
2266 </td></tr>
2260 <tr><td>
2267 <tr><td>
2261 <a href="/help/extensions">
2268 <a href="/help/extensions">
2262 extensions
2269 extensions
2263 </a>
2270 </a>
2264 </td><td>
2271 </td><td>
2265 Using Additional Features
2272 Using Additional Features
2266 </td></tr>
2273 </td></tr>
2267 <tr><td>
2274 <tr><td>
2268 <a href="/help/filesets">
2275 <a href="/help/filesets">
2269 filesets
2276 filesets
2270 </a>
2277 </a>
2271 </td><td>
2278 </td><td>
2272 Specifying File Sets
2279 Specifying File Sets
2273 </td></tr>
2280 </td></tr>
2274 <tr><td>
2281 <tr><td>
2275 <a href="/help/flags">
2282 <a href="/help/flags">
2276 flags
2283 flags
2277 </a>
2284 </a>
2278 </td><td>
2285 </td><td>
2279 Command-line flags
2286 Command-line flags
2280 </td></tr>
2287 </td></tr>
2281 <tr><td>
2288 <tr><td>
2282 <a href="/help/glossary">
2289 <a href="/help/glossary">
2283 glossary
2290 glossary
2284 </a>
2291 </a>
2285 </td><td>
2292 </td><td>
2286 Glossary
2293 Glossary
2287 </td></tr>
2294 </td></tr>
2288 <tr><td>
2295 <tr><td>
2289 <a href="/help/hgignore">
2296 <a href="/help/hgignore">
2290 hgignore
2297 hgignore
2291 </a>
2298 </a>
2292 </td><td>
2299 </td><td>
2293 Syntax for Mercurial Ignore Files
2300 Syntax for Mercurial Ignore Files
2294 </td></tr>
2301 </td></tr>
2295 <tr><td>
2302 <tr><td>
2296 <a href="/help/hgweb">
2303 <a href="/help/hgweb">
2297 hgweb
2304 hgweb
2298 </a>
2305 </a>
2299 </td><td>
2306 </td><td>
2300 Configuring hgweb
2307 Configuring hgweb
2301 </td></tr>
2308 </td></tr>
2302 <tr><td>
2309 <tr><td>
2303 <a href="/help/internals">
2310 <a href="/help/internals">
2304 internals
2311 internals
2305 </a>
2312 </a>
2306 </td><td>
2313 </td><td>
2307 Technical implementation topics
2314 Technical implementation topics
2308 </td></tr>
2315 </td></tr>
2309 <tr><td>
2316 <tr><td>
2310 <a href="/help/merge-tools">
2317 <a href="/help/merge-tools">
2311 merge-tools
2318 merge-tools
2312 </a>
2319 </a>
2313 </td><td>
2320 </td><td>
2314 Merge Tools
2321 Merge Tools
2315 </td></tr>
2322 </td></tr>
2316 <tr><td>
2323 <tr><td>
2317 <a href="/help/pager">
2324 <a href="/help/pager">
2318 pager
2325 pager
2319 </a>
2326 </a>
2320 </td><td>
2327 </td><td>
2321 Pager Support
2328 Pager Support
2322 </td></tr>
2329 </td></tr>
2323 <tr><td>
2330 <tr><td>
2324 <a href="/help/patterns">
2331 <a href="/help/patterns">
2325 patterns
2332 patterns
2326 </a>
2333 </a>
2327 </td><td>
2334 </td><td>
2328 File Name Patterns
2335 File Name Patterns
2329 </td></tr>
2336 </td></tr>
2330 <tr><td>
2337 <tr><td>
2331 <a href="/help/phases">
2338 <a href="/help/phases">
2332 phases
2339 phases
2333 </a>
2340 </a>
2334 </td><td>
2341 </td><td>
2335 Working with Phases
2342 Working with Phases
2336 </td></tr>
2343 </td></tr>
2337 <tr><td>
2344 <tr><td>
2338 <a href="/help/revisions">
2345 <a href="/help/revisions">
2339 revisions
2346 revisions
2340 </a>
2347 </a>
2341 </td><td>
2348 </td><td>
2342 Specifying Revisions
2349 Specifying Revisions
2343 </td></tr>
2350 </td></tr>
2344 <tr><td>
2351 <tr><td>
2345 <a href="/help/scripting">
2352 <a href="/help/scripting">
2346 scripting
2353 scripting
2347 </a>
2354 </a>
2348 </td><td>
2355 </td><td>
2349 Using Mercurial from scripts and automation
2356 Using Mercurial from scripts and automation
2350 </td></tr>
2357 </td></tr>
2351 <tr><td>
2358 <tr><td>
2352 <a href="/help/subrepos">
2359 <a href="/help/subrepos">
2353 subrepos
2360 subrepos
2354 </a>
2361 </a>
2355 </td><td>
2362 </td><td>
2356 Subrepositories
2363 Subrepositories
2357 </td></tr>
2364 </td></tr>
2358 <tr><td>
2365 <tr><td>
2359 <a href="/help/templating">
2366 <a href="/help/templating">
2360 templating
2367 templating
2361 </a>
2368 </a>
2362 </td><td>
2369 </td><td>
2363 Template Usage
2370 Template Usage
2364 </td></tr>
2371 </td></tr>
2365 <tr><td>
2372 <tr><td>
2366 <a href="/help/urls">
2373 <a href="/help/urls">
2367 urls
2374 urls
2368 </a>
2375 </a>
2369 </td><td>
2376 </td><td>
2370 URL Paths
2377 URL Paths
2371 </td></tr>
2378 </td></tr>
2372 <tr><td>
2379 <tr><td>
2373 <a href="/help/topic-containing-verbose">
2380 <a href="/help/topic-containing-verbose">
2374 topic-containing-verbose
2381 topic-containing-verbose
2375 </a>
2382 </a>
2376 </td><td>
2383 </td><td>
2377 This is the topic to test omit indicating.
2384 This is the topic to test omit indicating.
2378 </td></tr>
2385 </td></tr>
2379
2386
2380
2387
2381 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
2388 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
2382
2389
2383 <tr><td>
2390 <tr><td>
2384 <a href="/help/abort">
2391 <a href="/help/abort">
2385 abort
2392 abort
2386 </a>
2393 </a>
2387 </td><td>
2394 </td><td>
2388 abort an unfinished operation (EXPERIMENTAL)
2395 abort an unfinished operation (EXPERIMENTAL)
2389 </td></tr>
2396 </td></tr>
2390 <tr><td>
2397 <tr><td>
2391 <a href="/help/add">
2398 <a href="/help/add">
2392 add
2399 add
2393 </a>
2400 </a>
2394 </td><td>
2401 </td><td>
2395 add the specified files on the next commit
2402 add the specified files on the next commit
2396 </td></tr>
2403 </td></tr>
2397 <tr><td>
2404 <tr><td>
2398 <a href="/help/annotate">
2405 <a href="/help/annotate">
2399 annotate
2406 annotate
2400 </a>
2407 </a>
2401 </td><td>
2408 </td><td>
2402 show changeset information by line for each file
2409 show changeset information by line for each file
2403 </td></tr>
2410 </td></tr>
2404 <tr><td>
2411 <tr><td>
2405 <a href="/help/clone">
2412 <a href="/help/clone">
2406 clone
2413 clone
2407 </a>
2414 </a>
2408 </td><td>
2415 </td><td>
2409 make a copy of an existing repository
2416 make a copy of an existing repository
2410 </td></tr>
2417 </td></tr>
2411 <tr><td>
2418 <tr><td>
2412 <a href="/help/commit">
2419 <a href="/help/commit">
2413 commit
2420 commit
2414 </a>
2421 </a>
2415 </td><td>
2422 </td><td>
2416 commit the specified files or all outstanding changes
2423 commit the specified files or all outstanding changes
2417 </td></tr>
2424 </td></tr>
2418 <tr><td>
2425 <tr><td>
2419 <a href="/help/continue">
2426 <a href="/help/continue">
2420 continue
2427 continue
2421 </a>
2428 </a>
2422 </td><td>
2429 </td><td>
2423 resumes an interrupted operation (EXPERIMENTAL)
2430 resumes an interrupted operation (EXPERIMENTAL)
2424 </td></tr>
2431 </td></tr>
2425 <tr><td>
2432 <tr><td>
2426 <a href="/help/diff">
2433 <a href="/help/diff">
2427 diff
2434 diff
2428 </a>
2435 </a>
2429 </td><td>
2436 </td><td>
2430 diff repository (or selected files)
2437 diff repository (or selected files)
2431 </td></tr>
2438 </td></tr>
2432 <tr><td>
2439 <tr><td>
2433 <a href="/help/export">
2440 <a href="/help/export">
2434 export
2441 export
2435 </a>
2442 </a>
2436 </td><td>
2443 </td><td>
2437 dump the header and diffs for one or more changesets
2444 dump the header and diffs for one or more changesets
2438 </td></tr>
2445 </td></tr>
2439 <tr><td>
2446 <tr><td>
2440 <a href="/help/forget">
2447 <a href="/help/forget">
2441 forget
2448 forget
2442 </a>
2449 </a>
2443 </td><td>
2450 </td><td>
2444 forget the specified files on the next commit
2451 forget the specified files on the next commit
2445 </td></tr>
2452 </td></tr>
2446 <tr><td>
2453 <tr><td>
2447 <a href="/help/init">
2454 <a href="/help/init">
2448 init
2455 init
2449 </a>
2456 </a>
2450 </td><td>
2457 </td><td>
2451 create a new repository in the given directory
2458 create a new repository in the given directory
2452 </td></tr>
2459 </td></tr>
2453 <tr><td>
2460 <tr><td>
2454 <a href="/help/log">
2461 <a href="/help/log">
2455 log
2462 log
2456 </a>
2463 </a>
2457 </td><td>
2464 </td><td>
2458 show revision history of entire repository or files
2465 show revision history of entire repository or files
2459 </td></tr>
2466 </td></tr>
2460 <tr><td>
2467 <tr><td>
2461 <a href="/help/merge">
2468 <a href="/help/merge">
2462 merge
2469 merge
2463 </a>
2470 </a>
2464 </td><td>
2471 </td><td>
2465 merge another revision into working directory
2472 merge another revision into working directory
2466 </td></tr>
2473 </td></tr>
2467 <tr><td>
2474 <tr><td>
2468 <a href="/help/pull">
2475 <a href="/help/pull">
2469 pull
2476 pull
2470 </a>
2477 </a>
2471 </td><td>
2478 </td><td>
2472 pull changes from the specified source
2479 pull changes from the specified source
2473 </td></tr>
2480 </td></tr>
2474 <tr><td>
2481 <tr><td>
2475 <a href="/help/push">
2482 <a href="/help/push">
2476 push
2483 push
2477 </a>
2484 </a>
2478 </td><td>
2485 </td><td>
2479 push changes to the specified destination
2486 push changes to the specified destination
2480 </td></tr>
2487 </td></tr>
2481 <tr><td>
2488 <tr><td>
2482 <a href="/help/remove">
2489 <a href="/help/remove">
2483 remove
2490 remove
2484 </a>
2491 </a>
2485 </td><td>
2492 </td><td>
2486 remove the specified files on the next commit
2493 remove the specified files on the next commit
2487 </td></tr>
2494 </td></tr>
2488 <tr><td>
2495 <tr><td>
2489 <a href="/help/serve">
2496 <a href="/help/serve">
2490 serve
2497 serve
2491 </a>
2498 </a>
2492 </td><td>
2499 </td><td>
2493 start stand-alone webserver
2500 start stand-alone webserver
2494 </td></tr>
2501 </td></tr>
2495 <tr><td>
2502 <tr><td>
2496 <a href="/help/status">
2503 <a href="/help/status">
2497 status
2504 status
2498 </a>
2505 </a>
2499 </td><td>
2506 </td><td>
2500 show changed files in the working directory
2507 show changed files in the working directory
2501 </td></tr>
2508 </td></tr>
2502 <tr><td>
2509 <tr><td>
2503 <a href="/help/summary">
2510 <a href="/help/summary">
2504 summary
2511 summary
2505 </a>
2512 </a>
2506 </td><td>
2513 </td><td>
2507 summarize working directory state
2514 summarize working directory state
2508 </td></tr>
2515 </td></tr>
2509 <tr><td>
2516 <tr><td>
2510 <a href="/help/update">
2517 <a href="/help/update">
2511 update
2518 update
2512 </a>
2519 </a>
2513 </td><td>
2520 </td><td>
2514 update working directory (or switch revisions)
2521 update working directory (or switch revisions)
2515 </td></tr>
2522 </td></tr>
2516
2523
2517
2524
2518
2525
2519 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
2526 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
2520
2527
2521 <tr><td>
2528 <tr><td>
2522 <a href="/help/addremove">
2529 <a href="/help/addremove">
2523 addremove
2530 addremove
2524 </a>
2531 </a>
2525 </td><td>
2532 </td><td>
2526 add all new files, delete all missing files
2533 add all new files, delete all missing files
2527 </td></tr>
2534 </td></tr>
2528 <tr><td>
2535 <tr><td>
2529 <a href="/help/archive">
2536 <a href="/help/archive">
2530 archive
2537 archive
2531 </a>
2538 </a>
2532 </td><td>
2539 </td><td>
2533 create an unversioned archive of a repository revision
2540 create an unversioned archive of a repository revision
2534 </td></tr>
2541 </td></tr>
2535 <tr><td>
2542 <tr><td>
2536 <a href="/help/backout">
2543 <a href="/help/backout">
2537 backout
2544 backout
2538 </a>
2545 </a>
2539 </td><td>
2546 </td><td>
2540 reverse effect of earlier changeset
2547 reverse effect of earlier changeset
2541 </td></tr>
2548 </td></tr>
2542 <tr><td>
2549 <tr><td>
2543 <a href="/help/bisect">
2550 <a href="/help/bisect">
2544 bisect
2551 bisect
2545 </a>
2552 </a>
2546 </td><td>
2553 </td><td>
2547 subdivision search of changesets
2554 subdivision search of changesets
2548 </td></tr>
2555 </td></tr>
2549 <tr><td>
2556 <tr><td>
2550 <a href="/help/bookmarks">
2557 <a href="/help/bookmarks">
2551 bookmarks
2558 bookmarks
2552 </a>
2559 </a>
2553 </td><td>
2560 </td><td>
2554 create a new bookmark or list existing bookmarks
2561 create a new bookmark or list existing bookmarks
2555 </td></tr>
2562 </td></tr>
2556 <tr><td>
2563 <tr><td>
2557 <a href="/help/branch">
2564 <a href="/help/branch">
2558 branch
2565 branch
2559 </a>
2566 </a>
2560 </td><td>
2567 </td><td>
2561 set or show the current branch name
2568 set or show the current branch name
2562 </td></tr>
2569 </td></tr>
2563 <tr><td>
2570 <tr><td>
2564 <a href="/help/branches">
2571 <a href="/help/branches">
2565 branches
2572 branches
2566 </a>
2573 </a>
2567 </td><td>
2574 </td><td>
2568 list repository named branches
2575 list repository named branches
2569 </td></tr>
2576 </td></tr>
2570 <tr><td>
2577 <tr><td>
2571 <a href="/help/bundle">
2578 <a href="/help/bundle">
2572 bundle
2579 bundle
2573 </a>
2580 </a>
2574 </td><td>
2581 </td><td>
2575 create a bundle file
2582 create a bundle file
2576 </td></tr>
2583 </td></tr>
2577 <tr><td>
2584 <tr><td>
2578 <a href="/help/cat">
2585 <a href="/help/cat">
2579 cat
2586 cat
2580 </a>
2587 </a>
2581 </td><td>
2588 </td><td>
2582 output the current or given revision of files
2589 output the current or given revision of files
2583 </td></tr>
2590 </td></tr>
2584 <tr><td>
2591 <tr><td>
2585 <a href="/help/config">
2592 <a href="/help/config">
2586 config
2593 config
2587 </a>
2594 </a>
2588 </td><td>
2595 </td><td>
2589 show combined config settings from all hgrc files
2596 show combined config settings from all hgrc files
2590 </td></tr>
2597 </td></tr>
2591 <tr><td>
2598 <tr><td>
2592 <a href="/help/copy">
2599 <a href="/help/copy">
2593 copy
2600 copy
2594 </a>
2601 </a>
2595 </td><td>
2602 </td><td>
2596 mark files as copied for the next commit
2603 mark files as copied for the next commit
2597 </td></tr>
2604 </td></tr>
2598 <tr><td>
2605 <tr><td>
2599 <a href="/help/files">
2606 <a href="/help/files">
2600 files
2607 files
2601 </a>
2608 </a>
2602 </td><td>
2609 </td><td>
2603 list tracked files
2610 list tracked files
2604 </td></tr>
2611 </td></tr>
2605 <tr><td>
2612 <tr><td>
2606 <a href="/help/graft">
2613 <a href="/help/graft">
2607 graft
2614 graft
2608 </a>
2615 </a>
2609 </td><td>
2616 </td><td>
2610 copy changes from other branches onto the current branch
2617 copy changes from other branches onto the current branch
2611 </td></tr>
2618 </td></tr>
2612 <tr><td>
2619 <tr><td>
2613 <a href="/help/grep">
2620 <a href="/help/grep">
2614 grep
2621 grep
2615 </a>
2622 </a>
2616 </td><td>
2623 </td><td>
2617 search for a pattern in specified files
2624 search for a pattern in specified files
2618 </td></tr>
2625 </td></tr>
2619 <tr><td>
2626 <tr><td>
2620 <a href="/help/hashelp">
2627 <a href="/help/hashelp">
2621 hashelp
2628 hashelp
2622 </a>
2629 </a>
2623 </td><td>
2630 </td><td>
2624 Extension command's help
2631 Extension command's help
2625 </td></tr>
2632 </td></tr>
2626 <tr><td>
2633 <tr><td>
2627 <a href="/help/heads">
2634 <a href="/help/heads">
2628 heads
2635 heads
2629 </a>
2636 </a>
2630 </td><td>
2637 </td><td>
2631 show branch heads
2638 show branch heads
2632 </td></tr>
2639 </td></tr>
2633 <tr><td>
2640 <tr><td>
2634 <a href="/help/help">
2641 <a href="/help/help">
2635 help
2642 help
2636 </a>
2643 </a>
2637 </td><td>
2644 </td><td>
2638 show help for a given topic or a help overview
2645 show help for a given topic or a help overview
2639 </td></tr>
2646 </td></tr>
2640 <tr><td>
2647 <tr><td>
2641 <a href="/help/hgalias">
2648 <a href="/help/hgalias">
2642 hgalias
2649 hgalias
2643 </a>
2650 </a>
2644 </td><td>
2651 </td><td>
2645 My doc
2652 My doc
2646 </td></tr>
2653 </td></tr>
2647 <tr><td>
2654 <tr><td>
2648 <a href="/help/hgaliasnodoc">
2655 <a href="/help/hgaliasnodoc">
2649 hgaliasnodoc
2656 hgaliasnodoc
2650 </a>
2657 </a>
2651 </td><td>
2658 </td><td>
2652 summarize working directory state
2659 summarize working directory state
2653 </td></tr>
2660 </td></tr>
2654 <tr><td>
2661 <tr><td>
2655 <a href="/help/identify">
2662 <a href="/help/identify">
2656 identify
2663 identify
2657 </a>
2664 </a>
2658 </td><td>
2665 </td><td>
2659 identify the working directory or specified revision
2666 identify the working directory or specified revision
2660 </td></tr>
2667 </td></tr>
2661 <tr><td>
2668 <tr><td>
2662 <a href="/help/import">
2669 <a href="/help/import">
2663 import
2670 import
2664 </a>
2671 </a>
2665 </td><td>
2672 </td><td>
2666 import an ordered set of patches
2673 import an ordered set of patches
2667 </td></tr>
2674 </td></tr>
2668 <tr><td>
2675 <tr><td>
2669 <a href="/help/incoming">
2676 <a href="/help/incoming">
2670 incoming
2677 incoming
2671 </a>
2678 </a>
2672 </td><td>
2679 </td><td>
2673 show new changesets found in source
2680 show new changesets found in source
2674 </td></tr>
2681 </td></tr>
2675 <tr><td>
2682 <tr><td>
2676 <a href="/help/manifest">
2683 <a href="/help/manifest">
2677 manifest
2684 manifest
2678 </a>
2685 </a>
2679 </td><td>
2686 </td><td>
2680 output the current or given revision of the project manifest
2687 output the current or given revision of the project manifest
2681 </td></tr>
2688 </td></tr>
2682 <tr><td>
2689 <tr><td>
2683 <a href="/help/nohelp">
2690 <a href="/help/nohelp">
2684 nohelp
2691 nohelp
2685 </a>
2692 </a>
2686 </td><td>
2693 </td><td>
2687 (no help text available)
2694 (no help text available)
2688 </td></tr>
2695 </td></tr>
2689 <tr><td>
2696 <tr><td>
2690 <a href="/help/outgoing">
2697 <a href="/help/outgoing">
2691 outgoing
2698 outgoing
2692 </a>
2699 </a>
2693 </td><td>
2700 </td><td>
2694 show changesets not found in the destination
2701 show changesets not found in the destination
2695 </td></tr>
2702 </td></tr>
2696 <tr><td>
2703 <tr><td>
2697 <a href="/help/paths">
2704 <a href="/help/paths">
2698 paths
2705 paths
2699 </a>
2706 </a>
2700 </td><td>
2707 </td><td>
2701 show aliases for remote repositories
2708 show aliases for remote repositories
2702 </td></tr>
2709 </td></tr>
2703 <tr><td>
2710 <tr><td>
2704 <a href="/help/phase">
2711 <a href="/help/phase">
2705 phase
2712 phase
2706 </a>
2713 </a>
2707 </td><td>
2714 </td><td>
2708 set or show the current phase name
2715 set or show the current phase name
2709 </td></tr>
2716 </td></tr>
2710 <tr><td>
2717 <tr><td>
2711 <a href="/help/recover">
2718 <a href="/help/recover">
2712 recover
2719 recover
2713 </a>
2720 </a>
2714 </td><td>
2721 </td><td>
2715 roll back an interrupted transaction
2722 roll back an interrupted transaction
2716 </td></tr>
2723 </td></tr>
2717 <tr><td>
2724 <tr><td>
2718 <a href="/help/rename">
2725 <a href="/help/rename">
2719 rename
2726 rename
2720 </a>
2727 </a>
2721 </td><td>
2728 </td><td>
2722 rename files; equivalent of copy + remove
2729 rename files; equivalent of copy + remove
2723 </td></tr>
2730 </td></tr>
2724 <tr><td>
2731 <tr><td>
2725 <a href="/help/resolve">
2732 <a href="/help/resolve">
2726 resolve
2733 resolve
2727 </a>
2734 </a>
2728 </td><td>
2735 </td><td>
2729 redo merges or set/view the merge status of files
2736 redo merges or set/view the merge status of files
2730 </td></tr>
2737 </td></tr>
2731 <tr><td>
2738 <tr><td>
2732 <a href="/help/revert">
2739 <a href="/help/revert">
2733 revert
2740 revert
2734 </a>
2741 </a>
2735 </td><td>
2742 </td><td>
2736 restore files to their checkout state
2743 restore files to their checkout state
2737 </td></tr>
2744 </td></tr>
2738 <tr><td>
2745 <tr><td>
2739 <a href="/help/root">
2746 <a href="/help/root">
2740 root
2747 root
2741 </a>
2748 </a>
2742 </td><td>
2749 </td><td>
2743 print the root (top) of the current working directory
2750 print the root (top) of the current working directory
2744 </td></tr>
2751 </td></tr>
2745 <tr><td>
2752 <tr><td>
2746 <a href="/help/shellalias">
2753 <a href="/help/shellalias">
2747 shellalias
2754 shellalias
2748 </a>
2755 </a>
2749 </td><td>
2756 </td><td>
2750 (no help text available)
2757 (no help text available)
2751 </td></tr>
2758 </td></tr>
2752 <tr><td>
2759 <tr><td>
2753 <a href="/help/shelve">
2760 <a href="/help/shelve">
2754 shelve
2761 shelve
2755 </a>
2762 </a>
2756 </td><td>
2763 </td><td>
2757 save and set aside changes from the working directory
2764 save and set aside changes from the working directory
2758 </td></tr>
2765 </td></tr>
2759 <tr><td>
2766 <tr><td>
2760 <a href="/help/tag">
2767 <a href="/help/tag">
2761 tag
2768 tag
2762 </a>
2769 </a>
2763 </td><td>
2770 </td><td>
2764 add one or more tags for the current or given revision
2771 add one or more tags for the current or given revision
2765 </td></tr>
2772 </td></tr>
2766 <tr><td>
2773 <tr><td>
2767 <a href="/help/tags">
2774 <a href="/help/tags">
2768 tags
2775 tags
2769 </a>
2776 </a>
2770 </td><td>
2777 </td><td>
2771 list repository tags
2778 list repository tags
2772 </td></tr>
2779 </td></tr>
2773 <tr><td>
2780 <tr><td>
2774 <a href="/help/unbundle">
2781 <a href="/help/unbundle">
2775 unbundle
2782 unbundle
2776 </a>
2783 </a>
2777 </td><td>
2784 </td><td>
2778 apply one or more bundle files
2785 apply one or more bundle files
2779 </td></tr>
2786 </td></tr>
2780 <tr><td>
2787 <tr><td>
2781 <a href="/help/unshelve">
2788 <a href="/help/unshelve">
2782 unshelve
2789 unshelve
2783 </a>
2790 </a>
2784 </td><td>
2791 </td><td>
2785 restore a shelved change to the working directory
2792 restore a shelved change to the working directory
2786 </td></tr>
2793 </td></tr>
2787 <tr><td>
2794 <tr><td>
2788 <a href="/help/verify">
2795 <a href="/help/verify">
2789 verify
2796 verify
2790 </a>
2797 </a>
2791 </td><td>
2798 </td><td>
2792 verify the integrity of the repository
2799 verify the integrity of the repository
2793 </td></tr>
2800 </td></tr>
2794 <tr><td>
2801 <tr><td>
2795 <a href="/help/version">
2802 <a href="/help/version">
2796 version
2803 version
2797 </a>
2804 </a>
2798 </td><td>
2805 </td><td>
2799 output version and copyright information
2806 output version and copyright information
2800 </td></tr>
2807 </td></tr>
2801
2808
2802
2809
2803 </table>
2810 </table>
2804 </div>
2811 </div>
2805 </div>
2812 </div>
2806
2813
2807
2814
2808
2815
2809 </body>
2816 </body>
2810 </html>
2817 </html>
2811
2818
2812
2819
2813 $ get-with-headers.py $LOCALIP:$HGPORT "help/add"
2820 $ get-with-headers.py $LOCALIP:$HGPORT "help/add"
2814 200 Script output follows
2821 200 Script output follows
2815
2822
2816 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2823 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2817 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2824 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2818 <head>
2825 <head>
2819 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2826 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2820 <meta name="robots" content="index, nofollow" />
2827 <meta name="robots" content="index, nofollow" />
2821 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2828 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2822 <script type="text/javascript" src="/static/mercurial.js"></script>
2829 <script type="text/javascript" src="/static/mercurial.js"></script>
2823
2830
2824 <title>Help: add</title>
2831 <title>Help: add</title>
2825 </head>
2832 </head>
2826 <body>
2833 <body>
2827
2834
2828 <div class="container">
2835 <div class="container">
2829 <div class="menu">
2836 <div class="menu">
2830 <div class="logo">
2837 <div class="logo">
2831 <a href="https://mercurial-scm.org/">
2838 <a href="https://mercurial-scm.org/">
2832 <img src="/static/hglogo.png" alt="mercurial" /></a>
2839 <img src="/static/hglogo.png" alt="mercurial" /></a>
2833 </div>
2840 </div>
2834 <ul>
2841 <ul>
2835 <li><a href="/shortlog">log</a></li>
2842 <li><a href="/shortlog">log</a></li>
2836 <li><a href="/graph">graph</a></li>
2843 <li><a href="/graph">graph</a></li>
2837 <li><a href="/tags">tags</a></li>
2844 <li><a href="/tags">tags</a></li>
2838 <li><a href="/bookmarks">bookmarks</a></li>
2845 <li><a href="/bookmarks">bookmarks</a></li>
2839 <li><a href="/branches">branches</a></li>
2846 <li><a href="/branches">branches</a></li>
2840 </ul>
2847 </ul>
2841 <ul>
2848 <ul>
2842 <li class="active"><a href="/help">help</a></li>
2849 <li class="active"><a href="/help">help</a></li>
2843 </ul>
2850 </ul>
2844 </div>
2851 </div>
2845
2852
2846 <div class="main">
2853 <div class="main">
2847 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2854 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2848 <h3>Help: add</h3>
2855 <h3>Help: add</h3>
2849
2856
2850 <form class="search" action="/log">
2857 <form class="search" action="/log">
2851
2858
2852 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2859 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
2853 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2860 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2854 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2861 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2855 </form>
2862 </form>
2856 <div id="doc">
2863 <div id="doc">
2857 <p>
2864 <p>
2858 hg add [OPTION]... [FILE]...
2865 hg add [OPTION]... [FILE]...
2859 </p>
2866 </p>
2860 <p>
2867 <p>
2861 add the specified files on the next commit
2868 add the specified files on the next commit
2862 </p>
2869 </p>
2863 <p>
2870 <p>
2864 Schedule files to be version controlled and added to the
2871 Schedule files to be version controlled and added to the
2865 repository.
2872 repository.
2866 </p>
2873 </p>
2867 <p>
2874 <p>
2868 The files will be added to the repository at the next commit. To
2875 The files will be added to the repository at the next commit. To
2869 undo an add before that, see 'hg forget'.
2876 undo an add before that, see 'hg forget'.
2870 </p>
2877 </p>
2871 <p>
2878 <p>
2872 If no names are given, add all files to the repository (except
2879 If no names are given, add all files to the repository (except
2873 files matching &quot;.hgignore&quot;).
2880 files matching &quot;.hgignore&quot;).
2874 </p>
2881 </p>
2875 <p>
2882 <p>
2876 Examples:
2883 Examples:
2877 </p>
2884 </p>
2878 <ul>
2885 <ul>
2879 <li> New (unknown) files are added automatically by 'hg add':
2886 <li> New (unknown) files are added automatically by 'hg add':
2880 <pre>
2887 <pre>
2881 \$ ls (re)
2888 \$ ls (re)
2882 foo.c
2889 foo.c
2883 \$ hg status (re)
2890 \$ hg status (re)
2884 ? foo.c
2891 ? foo.c
2885 \$ hg add (re)
2892 \$ hg add (re)
2886 adding foo.c
2893 adding foo.c
2887 \$ hg status (re)
2894 \$ hg status (re)
2888 A foo.c
2895 A foo.c
2889 </pre>
2896 </pre>
2890 <li> Specific files to be added can be specified:
2897 <li> Specific files to be added can be specified:
2891 <pre>
2898 <pre>
2892 \$ ls (re)
2899 \$ ls (re)
2893 bar.c foo.c
2900 bar.c foo.c
2894 \$ hg status (re)
2901 \$ hg status (re)
2895 ? bar.c
2902 ? bar.c
2896 ? foo.c
2903 ? foo.c
2897 \$ hg add bar.c (re)
2904 \$ hg add bar.c (re)
2898 \$ hg status (re)
2905 \$ hg status (re)
2899 A bar.c
2906 A bar.c
2900 ? foo.c
2907 ? foo.c
2901 </pre>
2908 </pre>
2902 </ul>
2909 </ul>
2903 <p>
2910 <p>
2904 Returns 0 if all files are successfully added.
2911 Returns 0 if all files are successfully added.
2905 </p>
2912 </p>
2906 <p>
2913 <p>
2907 options ([+] can be repeated):
2914 options ([+] can be repeated):
2908 </p>
2915 </p>
2909 <table>
2916 <table>
2910 <tr><td>-I</td>
2917 <tr><td>-I</td>
2911 <td>--include PATTERN [+]</td>
2918 <td>--include PATTERN [+]</td>
2912 <td>include names matching the given patterns</td></tr>
2919 <td>include names matching the given patterns</td></tr>
2913 <tr><td>-X</td>
2920 <tr><td>-X</td>
2914 <td>--exclude PATTERN [+]</td>
2921 <td>--exclude PATTERN [+]</td>
2915 <td>exclude names matching the given patterns</td></tr>
2922 <td>exclude names matching the given patterns</td></tr>
2916 <tr><td>-S</td>
2923 <tr><td>-S</td>
2917 <td>--subrepos</td>
2924 <td>--subrepos</td>
2918 <td>recurse into subrepositories</td></tr>
2925 <td>recurse into subrepositories</td></tr>
2919 <tr><td>-n</td>
2926 <tr><td>-n</td>
2920 <td>--dry-run</td>
2927 <td>--dry-run</td>
2921 <td>do not perform actions, just print output</td></tr>
2928 <td>do not perform actions, just print output</td></tr>
2922 </table>
2929 </table>
2923 <p>
2930 <p>
2924 global options ([+] can be repeated):
2931 global options ([+] can be repeated):
2925 </p>
2932 </p>
2926 <table>
2933 <table>
2927 <tr><td>-R</td>
2934 <tr><td>-R</td>
2928 <td>--repository REPO</td>
2935 <td>--repository REPO</td>
2929 <td>repository root directory or name of overlay bundle file</td></tr>
2936 <td>repository root directory or name of overlay bundle file</td></tr>
2930 <tr><td></td>
2937 <tr><td></td>
2931 <td>--cwd DIR</td>
2938 <td>--cwd DIR</td>
2932 <td>change working directory</td></tr>
2939 <td>change working directory</td></tr>
2933 <tr><td>-y</td>
2940 <tr><td>-y</td>
2934 <td>--noninteractive</td>
2941 <td>--noninteractive</td>
2935 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2942 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2936 <tr><td>-q</td>
2943 <tr><td>-q</td>
2937 <td>--quiet</td>
2944 <td>--quiet</td>
2938 <td>suppress output</td></tr>
2945 <td>suppress output</td></tr>
2939 <tr><td>-v</td>
2946 <tr><td>-v</td>
2940 <td>--verbose</td>
2947 <td>--verbose</td>
2941 <td>enable additional output</td></tr>
2948 <td>enable additional output</td></tr>
2942 <tr><td></td>
2949 <tr><td></td>
2943 <td>--color TYPE</td>
2950 <td>--color TYPE</td>
2944 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2951 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2945 <tr><td></td>
2952 <tr><td></td>
2946 <td>--config CONFIG [+]</td>
2953 <td>--config CONFIG [+]</td>
2947 <td>set/override config option (use 'section.name=value')</td></tr>
2954 <td>set/override config option (use 'section.name=value')</td></tr>
2948 <tr><td></td>
2955 <tr><td></td>
2949 <td>--debug</td>
2956 <td>--debug</td>
2950 <td>enable debugging output</td></tr>
2957 <td>enable debugging output</td></tr>
2951 <tr><td></td>
2958 <tr><td></td>
2952 <td>--debugger</td>
2959 <td>--debugger</td>
2953 <td>start debugger</td></tr>
2960 <td>start debugger</td></tr>
2954 <tr><td></td>
2961 <tr><td></td>
2955 <td>--encoding ENCODE</td>
2962 <td>--encoding ENCODE</td>
2956 <td>set the charset encoding (default: ascii)</td></tr>
2963 <td>set the charset encoding (default: ascii)</td></tr>
2957 <tr><td></td>
2964 <tr><td></td>
2958 <td>--encodingmode MODE</td>
2965 <td>--encodingmode MODE</td>
2959 <td>set the charset encoding mode (default: strict)</td></tr>
2966 <td>set the charset encoding mode (default: strict)</td></tr>
2960 <tr><td></td>
2967 <tr><td></td>
2961 <td>--traceback</td>
2968 <td>--traceback</td>
2962 <td>always print a traceback on exception</td></tr>
2969 <td>always print a traceback on exception</td></tr>
2963 <tr><td></td>
2970 <tr><td></td>
2964 <td>--time</td>
2971 <td>--time</td>
2965 <td>time how long the command takes</td></tr>
2972 <td>time how long the command takes</td></tr>
2966 <tr><td></td>
2973 <tr><td></td>
2967 <td>--profile</td>
2974 <td>--profile</td>
2968 <td>print command execution profile</td></tr>
2975 <td>print command execution profile</td></tr>
2969 <tr><td></td>
2976 <tr><td></td>
2970 <td>--version</td>
2977 <td>--version</td>
2971 <td>output version information and exit</td></tr>
2978 <td>output version information and exit</td></tr>
2972 <tr><td>-h</td>
2979 <tr><td>-h</td>
2973 <td>--help</td>
2980 <td>--help</td>
2974 <td>display help and exit</td></tr>
2981 <td>display help and exit</td></tr>
2975 <tr><td></td>
2982 <tr><td></td>
2976 <td>--hidden</td>
2983 <td>--hidden</td>
2977 <td>consider hidden changesets</td></tr>
2984 <td>consider hidden changesets</td></tr>
2978 <tr><td></td>
2985 <tr><td></td>
2979 <td>--pager TYPE</td>
2986 <td>--pager TYPE</td>
2980 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2987 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2981 </table>
2988 </table>
2982
2989
2983 </div>
2990 </div>
2984 </div>
2991 </div>
2985 </div>
2992 </div>
2986
2993
2987
2994
2988
2995
2989 </body>
2996 </body>
2990 </html>
2997 </html>
2991
2998
2992
2999
2993 $ get-with-headers.py $LOCALIP:$HGPORT "help/remove"
3000 $ get-with-headers.py $LOCALIP:$HGPORT "help/remove"
2994 200 Script output follows
3001 200 Script output follows
2995
3002
2996 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3003 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2997 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3004 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2998 <head>
3005 <head>
2999 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3006 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3000 <meta name="robots" content="index, nofollow" />
3007 <meta name="robots" content="index, nofollow" />
3001 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3008 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3002 <script type="text/javascript" src="/static/mercurial.js"></script>
3009 <script type="text/javascript" src="/static/mercurial.js"></script>
3003
3010
3004 <title>Help: remove</title>
3011 <title>Help: remove</title>
3005 </head>
3012 </head>
3006 <body>
3013 <body>
3007
3014
3008 <div class="container">
3015 <div class="container">
3009 <div class="menu">
3016 <div class="menu">
3010 <div class="logo">
3017 <div class="logo">
3011 <a href="https://mercurial-scm.org/">
3018 <a href="https://mercurial-scm.org/">
3012 <img src="/static/hglogo.png" alt="mercurial" /></a>
3019 <img src="/static/hglogo.png" alt="mercurial" /></a>
3013 </div>
3020 </div>
3014 <ul>
3021 <ul>
3015 <li><a href="/shortlog">log</a></li>
3022 <li><a href="/shortlog">log</a></li>
3016 <li><a href="/graph">graph</a></li>
3023 <li><a href="/graph">graph</a></li>
3017 <li><a href="/tags">tags</a></li>
3024 <li><a href="/tags">tags</a></li>
3018 <li><a href="/bookmarks">bookmarks</a></li>
3025 <li><a href="/bookmarks">bookmarks</a></li>
3019 <li><a href="/branches">branches</a></li>
3026 <li><a href="/branches">branches</a></li>
3020 </ul>
3027 </ul>
3021 <ul>
3028 <ul>
3022 <li class="active"><a href="/help">help</a></li>
3029 <li class="active"><a href="/help">help</a></li>
3023 </ul>
3030 </ul>
3024 </div>
3031 </div>
3025
3032
3026 <div class="main">
3033 <div class="main">
3027 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3034 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3028 <h3>Help: remove</h3>
3035 <h3>Help: remove</h3>
3029
3036
3030 <form class="search" action="/log">
3037 <form class="search" action="/log">
3031
3038
3032 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3039 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3033 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3040 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3034 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3041 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3035 </form>
3042 </form>
3036 <div id="doc">
3043 <div id="doc">
3037 <p>
3044 <p>
3038 hg remove [OPTION]... FILE...
3045 hg remove [OPTION]... FILE...
3039 </p>
3046 </p>
3040 <p>
3047 <p>
3041 aliases: rm
3048 aliases: rm
3042 </p>
3049 </p>
3043 <p>
3050 <p>
3044 remove the specified files on the next commit
3051 remove the specified files on the next commit
3045 </p>
3052 </p>
3046 <p>
3053 <p>
3047 Schedule the indicated files for removal from the current branch.
3054 Schedule the indicated files for removal from the current branch.
3048 </p>
3055 </p>
3049 <p>
3056 <p>
3050 This command schedules the files to be removed at the next commit.
3057 This command schedules the files to be removed at the next commit.
3051 To undo a remove before that, see 'hg revert'. To undo added
3058 To undo a remove before that, see 'hg revert'. To undo added
3052 files, see 'hg forget'.
3059 files, see 'hg forget'.
3053 </p>
3060 </p>
3054 <p>
3061 <p>
3055 -A/--after can be used to remove only files that have already
3062 -A/--after can be used to remove only files that have already
3056 been deleted, -f/--force can be used to force deletion, and -Af
3063 been deleted, -f/--force can be used to force deletion, and -Af
3057 can be used to remove files from the next revision without
3064 can be used to remove files from the next revision without
3058 deleting them from the working directory.
3065 deleting them from the working directory.
3059 </p>
3066 </p>
3060 <p>
3067 <p>
3061 The following table details the behavior of remove for different
3068 The following table details the behavior of remove for different
3062 file states (columns) and option combinations (rows). The file
3069 file states (columns) and option combinations (rows). The file
3063 states are Added [A], Clean [C], Modified [M] and Missing [!]
3070 states are Added [A], Clean [C], Modified [M] and Missing [!]
3064 (as reported by 'hg status'). The actions are Warn, Remove
3071 (as reported by 'hg status'). The actions are Warn, Remove
3065 (from branch) and Delete (from disk):
3072 (from branch) and Delete (from disk):
3066 </p>
3073 </p>
3067 <table>
3074 <table>
3068 <tr><td>opt/state</td>
3075 <tr><td>opt/state</td>
3069 <td>A</td>
3076 <td>A</td>
3070 <td>C</td>
3077 <td>C</td>
3071 <td>M</td>
3078 <td>M</td>
3072 <td>!</td></tr>
3079 <td>!</td></tr>
3073 <tr><td>none</td>
3080 <tr><td>none</td>
3074 <td>W</td>
3081 <td>W</td>
3075 <td>RD</td>
3082 <td>RD</td>
3076 <td>W</td>
3083 <td>W</td>
3077 <td>R</td></tr>
3084 <td>R</td></tr>
3078 <tr><td>-f</td>
3085 <tr><td>-f</td>
3079 <td>R</td>
3086 <td>R</td>
3080 <td>RD</td>
3087 <td>RD</td>
3081 <td>RD</td>
3088 <td>RD</td>
3082 <td>R</td></tr>
3089 <td>R</td></tr>
3083 <tr><td>-A</td>
3090 <tr><td>-A</td>
3084 <td>W</td>
3091 <td>W</td>
3085 <td>W</td>
3092 <td>W</td>
3086 <td>W</td>
3093 <td>W</td>
3087 <td>R</td></tr>
3094 <td>R</td></tr>
3088 <tr><td>-Af</td>
3095 <tr><td>-Af</td>
3089 <td>R</td>
3096 <td>R</td>
3090 <td>R</td>
3097 <td>R</td>
3091 <td>R</td>
3098 <td>R</td>
3092 <td>R</td></tr>
3099 <td>R</td></tr>
3093 </table>
3100 </table>
3094 <p>
3101 <p>
3095 <b>Note:</b>
3102 <b>Note:</b>
3096 </p>
3103 </p>
3097 <p>
3104 <p>
3098 'hg remove' never deletes files in Added [A] state from the
3105 'hg remove' never deletes files in Added [A] state from the
3099 working directory, not even if &quot;--force&quot; is specified.
3106 working directory, not even if &quot;--force&quot; is specified.
3100 </p>
3107 </p>
3101 <p>
3108 <p>
3102 Returns 0 on success, 1 if any warnings encountered.
3109 Returns 0 on success, 1 if any warnings encountered.
3103 </p>
3110 </p>
3104 <p>
3111 <p>
3105 options ([+] can be repeated):
3112 options ([+] can be repeated):
3106 </p>
3113 </p>
3107 <table>
3114 <table>
3108 <tr><td>-A</td>
3115 <tr><td>-A</td>
3109 <td>--after</td>
3116 <td>--after</td>
3110 <td>record delete for missing files</td></tr>
3117 <td>record delete for missing files</td></tr>
3111 <tr><td>-f</td>
3118 <tr><td>-f</td>
3112 <td>--force</td>
3119 <td>--force</td>
3113 <td>forget added files, delete modified files</td></tr>
3120 <td>forget added files, delete modified files</td></tr>
3114 <tr><td>-S</td>
3121 <tr><td>-S</td>
3115 <td>--subrepos</td>
3122 <td>--subrepos</td>
3116 <td>recurse into subrepositories</td></tr>
3123 <td>recurse into subrepositories</td></tr>
3117 <tr><td>-I</td>
3124 <tr><td>-I</td>
3118 <td>--include PATTERN [+]</td>
3125 <td>--include PATTERN [+]</td>
3119 <td>include names matching the given patterns</td></tr>
3126 <td>include names matching the given patterns</td></tr>
3120 <tr><td>-X</td>
3127 <tr><td>-X</td>
3121 <td>--exclude PATTERN [+]</td>
3128 <td>--exclude PATTERN [+]</td>
3122 <td>exclude names matching the given patterns</td></tr>
3129 <td>exclude names matching the given patterns</td></tr>
3123 <tr><td>-n</td>
3130 <tr><td>-n</td>
3124 <td>--dry-run</td>
3131 <td>--dry-run</td>
3125 <td>do not perform actions, just print output</td></tr>
3132 <td>do not perform actions, just print output</td></tr>
3126 </table>
3133 </table>
3127 <p>
3134 <p>
3128 global options ([+] can be repeated):
3135 global options ([+] can be repeated):
3129 </p>
3136 </p>
3130 <table>
3137 <table>
3131 <tr><td>-R</td>
3138 <tr><td>-R</td>
3132 <td>--repository REPO</td>
3139 <td>--repository REPO</td>
3133 <td>repository root directory or name of overlay bundle file</td></tr>
3140 <td>repository root directory or name of overlay bundle file</td></tr>
3134 <tr><td></td>
3141 <tr><td></td>
3135 <td>--cwd DIR</td>
3142 <td>--cwd DIR</td>
3136 <td>change working directory</td></tr>
3143 <td>change working directory</td></tr>
3137 <tr><td>-y</td>
3144 <tr><td>-y</td>
3138 <td>--noninteractive</td>
3145 <td>--noninteractive</td>
3139 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
3146 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
3140 <tr><td>-q</td>
3147 <tr><td>-q</td>
3141 <td>--quiet</td>
3148 <td>--quiet</td>
3142 <td>suppress output</td></tr>
3149 <td>suppress output</td></tr>
3143 <tr><td>-v</td>
3150 <tr><td>-v</td>
3144 <td>--verbose</td>
3151 <td>--verbose</td>
3145 <td>enable additional output</td></tr>
3152 <td>enable additional output</td></tr>
3146 <tr><td></td>
3153 <tr><td></td>
3147 <td>--color TYPE</td>
3154 <td>--color TYPE</td>
3148 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
3155 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
3149 <tr><td></td>
3156 <tr><td></td>
3150 <td>--config CONFIG [+]</td>
3157 <td>--config CONFIG [+]</td>
3151 <td>set/override config option (use 'section.name=value')</td></tr>
3158 <td>set/override config option (use 'section.name=value')</td></tr>
3152 <tr><td></td>
3159 <tr><td></td>
3153 <td>--debug</td>
3160 <td>--debug</td>
3154 <td>enable debugging output</td></tr>
3161 <td>enable debugging output</td></tr>
3155 <tr><td></td>
3162 <tr><td></td>
3156 <td>--debugger</td>
3163 <td>--debugger</td>
3157 <td>start debugger</td></tr>
3164 <td>start debugger</td></tr>
3158 <tr><td></td>
3165 <tr><td></td>
3159 <td>--encoding ENCODE</td>
3166 <td>--encoding ENCODE</td>
3160 <td>set the charset encoding (default: ascii)</td></tr>
3167 <td>set the charset encoding (default: ascii)</td></tr>
3161 <tr><td></td>
3168 <tr><td></td>
3162 <td>--encodingmode MODE</td>
3169 <td>--encodingmode MODE</td>
3163 <td>set the charset encoding mode (default: strict)</td></tr>
3170 <td>set the charset encoding mode (default: strict)</td></tr>
3164 <tr><td></td>
3171 <tr><td></td>
3165 <td>--traceback</td>
3172 <td>--traceback</td>
3166 <td>always print a traceback on exception</td></tr>
3173 <td>always print a traceback on exception</td></tr>
3167 <tr><td></td>
3174 <tr><td></td>
3168 <td>--time</td>
3175 <td>--time</td>
3169 <td>time how long the command takes</td></tr>
3176 <td>time how long the command takes</td></tr>
3170 <tr><td></td>
3177 <tr><td></td>
3171 <td>--profile</td>
3178 <td>--profile</td>
3172 <td>print command execution profile</td></tr>
3179 <td>print command execution profile</td></tr>
3173 <tr><td></td>
3180 <tr><td></td>
3174 <td>--version</td>
3181 <td>--version</td>
3175 <td>output version information and exit</td></tr>
3182 <td>output version information and exit</td></tr>
3176 <tr><td>-h</td>
3183 <tr><td>-h</td>
3177 <td>--help</td>
3184 <td>--help</td>
3178 <td>display help and exit</td></tr>
3185 <td>display help and exit</td></tr>
3179 <tr><td></td>
3186 <tr><td></td>
3180 <td>--hidden</td>
3187 <td>--hidden</td>
3181 <td>consider hidden changesets</td></tr>
3188 <td>consider hidden changesets</td></tr>
3182 <tr><td></td>
3189 <tr><td></td>
3183 <td>--pager TYPE</td>
3190 <td>--pager TYPE</td>
3184 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
3191 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
3185 </table>
3192 </table>
3186
3193
3187 </div>
3194 </div>
3188 </div>
3195 </div>
3189 </div>
3196 </div>
3190
3197
3191
3198
3192
3199
3193 </body>
3200 </body>
3194 </html>
3201 </html>
3195
3202
3196
3203
3197 $ get-with-headers.py $LOCALIP:$HGPORT "help/dates"
3204 $ get-with-headers.py $LOCALIP:$HGPORT "help/dates"
3198 200 Script output follows
3205 200 Script output follows
3199
3206
3200 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3207 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3201 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3208 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3202 <head>
3209 <head>
3203 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3210 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3204 <meta name="robots" content="index, nofollow" />
3211 <meta name="robots" content="index, nofollow" />
3205 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3212 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3206 <script type="text/javascript" src="/static/mercurial.js"></script>
3213 <script type="text/javascript" src="/static/mercurial.js"></script>
3207
3214
3208 <title>Help: dates</title>
3215 <title>Help: dates</title>
3209 </head>
3216 </head>
3210 <body>
3217 <body>
3211
3218
3212 <div class="container">
3219 <div class="container">
3213 <div class="menu">
3220 <div class="menu">
3214 <div class="logo">
3221 <div class="logo">
3215 <a href="https://mercurial-scm.org/">
3222 <a href="https://mercurial-scm.org/">
3216 <img src="/static/hglogo.png" alt="mercurial" /></a>
3223 <img src="/static/hglogo.png" alt="mercurial" /></a>
3217 </div>
3224 </div>
3218 <ul>
3225 <ul>
3219 <li><a href="/shortlog">log</a></li>
3226 <li><a href="/shortlog">log</a></li>
3220 <li><a href="/graph">graph</a></li>
3227 <li><a href="/graph">graph</a></li>
3221 <li><a href="/tags">tags</a></li>
3228 <li><a href="/tags">tags</a></li>
3222 <li><a href="/bookmarks">bookmarks</a></li>
3229 <li><a href="/bookmarks">bookmarks</a></li>
3223 <li><a href="/branches">branches</a></li>
3230 <li><a href="/branches">branches</a></li>
3224 </ul>
3231 </ul>
3225 <ul>
3232 <ul>
3226 <li class="active"><a href="/help">help</a></li>
3233 <li class="active"><a href="/help">help</a></li>
3227 </ul>
3234 </ul>
3228 </div>
3235 </div>
3229
3236
3230 <div class="main">
3237 <div class="main">
3231 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3238 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3232 <h3>Help: dates</h3>
3239 <h3>Help: dates</h3>
3233
3240
3234 <form class="search" action="/log">
3241 <form class="search" action="/log">
3235
3242
3236 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3243 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3237 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3244 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3238 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3245 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3239 </form>
3246 </form>
3240 <div id="doc">
3247 <div id="doc">
3241 <h1>Date Formats</h1>
3248 <h1>Date Formats</h1>
3242 <p>
3249 <p>
3243 Some commands allow the user to specify a date, e.g.:
3250 Some commands allow the user to specify a date, e.g.:
3244 </p>
3251 </p>
3245 <ul>
3252 <ul>
3246 <li> backout, commit, import, tag: Specify the commit date.
3253 <li> backout, commit, import, tag: Specify the commit date.
3247 <li> log, revert, update: Select revision(s) by date.
3254 <li> log, revert, update: Select revision(s) by date.
3248 </ul>
3255 </ul>
3249 <p>
3256 <p>
3250 Many date formats are valid. Here are some examples:
3257 Many date formats are valid. Here are some examples:
3251 </p>
3258 </p>
3252 <ul>
3259 <ul>
3253 <li> &quot;Wed Dec 6 13:18:29 2006&quot; (local timezone assumed)
3260 <li> &quot;Wed Dec 6 13:18:29 2006&quot; (local timezone assumed)
3254 <li> &quot;Dec 6 13:18 -0600&quot; (year assumed, time offset provided)
3261 <li> &quot;Dec 6 13:18 -0600&quot; (year assumed, time offset provided)
3255 <li> &quot;Dec 6 13:18 UTC&quot; (UTC and GMT are aliases for +0000)
3262 <li> &quot;Dec 6 13:18 UTC&quot; (UTC and GMT are aliases for +0000)
3256 <li> &quot;Dec 6&quot; (midnight)
3263 <li> &quot;Dec 6&quot; (midnight)
3257 <li> &quot;13:18&quot; (today assumed)
3264 <li> &quot;13:18&quot; (today assumed)
3258 <li> &quot;3:39&quot; (3:39AM assumed)
3265 <li> &quot;3:39&quot; (3:39AM assumed)
3259 <li> &quot;3:39pm&quot; (15:39)
3266 <li> &quot;3:39pm&quot; (15:39)
3260 <li> &quot;2006-12-06 13:18:29&quot; (ISO 8601 format)
3267 <li> &quot;2006-12-06 13:18:29&quot; (ISO 8601 format)
3261 <li> &quot;2006-12-6 13:18&quot;
3268 <li> &quot;2006-12-6 13:18&quot;
3262 <li> &quot;2006-12-6&quot;
3269 <li> &quot;2006-12-6&quot;
3263 <li> &quot;12-6&quot;
3270 <li> &quot;12-6&quot;
3264 <li> &quot;12/6&quot;
3271 <li> &quot;12/6&quot;
3265 <li> &quot;12/6/6&quot; (Dec 6 2006)
3272 <li> &quot;12/6/6&quot; (Dec 6 2006)
3266 <li> &quot;today&quot; (midnight)
3273 <li> &quot;today&quot; (midnight)
3267 <li> &quot;yesterday&quot; (midnight)
3274 <li> &quot;yesterday&quot; (midnight)
3268 <li> &quot;now&quot; - right now
3275 <li> &quot;now&quot; - right now
3269 </ul>
3276 </ul>
3270 <p>
3277 <p>
3271 Lastly, there is Mercurial's internal format:
3278 Lastly, there is Mercurial's internal format:
3272 </p>
3279 </p>
3273 <ul>
3280 <ul>
3274 <li> &quot;1165411109 0&quot; (Wed Dec 6 13:18:29 2006 UTC)
3281 <li> &quot;1165411109 0&quot; (Wed Dec 6 13:18:29 2006 UTC)
3275 </ul>
3282 </ul>
3276 <p>
3283 <p>
3277 This is the internal representation format for dates. The first number
3284 This is the internal representation format for dates. The first number
3278 is the number of seconds since the epoch (1970-01-01 00:00 UTC). The
3285 is the number of seconds since the epoch (1970-01-01 00:00 UTC). The
3279 second is the offset of the local timezone, in seconds west of UTC
3286 second is the offset of the local timezone, in seconds west of UTC
3280 (negative if the timezone is east of UTC).
3287 (negative if the timezone is east of UTC).
3281 </p>
3288 </p>
3282 <p>
3289 <p>
3283 The log command also accepts date ranges:
3290 The log command also accepts date ranges:
3284 </p>
3291 </p>
3285 <ul>
3292 <ul>
3286 <li> &quot;&lt;DATE&quot; - at or before a given date/time
3293 <li> &quot;&lt;DATE&quot; - at or before a given date/time
3287 <li> &quot;&gt;DATE&quot; - on or after a given date/time
3294 <li> &quot;&gt;DATE&quot; - on or after a given date/time
3288 <li> &quot;DATE to DATE&quot; - a date range, inclusive
3295 <li> &quot;DATE to DATE&quot; - a date range, inclusive
3289 <li> &quot;-DAYS&quot; - within a given number of days from today
3296 <li> &quot;-DAYS&quot; - within a given number of days from today
3290 </ul>
3297 </ul>
3291
3298
3292 </div>
3299 </div>
3293 </div>
3300 </div>
3294 </div>
3301 </div>
3295
3302
3296
3303
3297
3304
3298 </body>
3305 </body>
3299 </html>
3306 </html>
3300
3307
3301
3308
3302 $ get-with-headers.py $LOCALIP:$HGPORT "help/pager"
3309 $ get-with-headers.py $LOCALIP:$HGPORT "help/pager"
3303 200 Script output follows
3310 200 Script output follows
3304
3311
3305 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3312 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3306 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3313 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3307 <head>
3314 <head>
3308 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3315 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3309 <meta name="robots" content="index, nofollow" />
3316 <meta name="robots" content="index, nofollow" />
3310 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3317 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3311 <script type="text/javascript" src="/static/mercurial.js"></script>
3318 <script type="text/javascript" src="/static/mercurial.js"></script>
3312
3319
3313 <title>Help: pager</title>
3320 <title>Help: pager</title>
3314 </head>
3321 </head>
3315 <body>
3322 <body>
3316
3323
3317 <div class="container">
3324 <div class="container">
3318 <div class="menu">
3325 <div class="menu">
3319 <div class="logo">
3326 <div class="logo">
3320 <a href="https://mercurial-scm.org/">
3327 <a href="https://mercurial-scm.org/">
3321 <img src="/static/hglogo.png" alt="mercurial" /></a>
3328 <img src="/static/hglogo.png" alt="mercurial" /></a>
3322 </div>
3329 </div>
3323 <ul>
3330 <ul>
3324 <li><a href="/shortlog">log</a></li>
3331 <li><a href="/shortlog">log</a></li>
3325 <li><a href="/graph">graph</a></li>
3332 <li><a href="/graph">graph</a></li>
3326 <li><a href="/tags">tags</a></li>
3333 <li><a href="/tags">tags</a></li>
3327 <li><a href="/bookmarks">bookmarks</a></li>
3334 <li><a href="/bookmarks">bookmarks</a></li>
3328 <li><a href="/branches">branches</a></li>
3335 <li><a href="/branches">branches</a></li>
3329 </ul>
3336 </ul>
3330 <ul>
3337 <ul>
3331 <li class="active"><a href="/help">help</a></li>
3338 <li class="active"><a href="/help">help</a></li>
3332 </ul>
3339 </ul>
3333 </div>
3340 </div>
3334
3341
3335 <div class="main">
3342 <div class="main">
3336 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3343 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3337 <h3>Help: pager</h3>
3344 <h3>Help: pager</h3>
3338
3345
3339 <form class="search" action="/log">
3346 <form class="search" action="/log">
3340
3347
3341 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3348 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3342 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3349 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3343 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3350 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3344 </form>
3351 </form>
3345 <div id="doc">
3352 <div id="doc">
3346 <h1>Pager Support</h1>
3353 <h1>Pager Support</h1>
3347 <p>
3354 <p>
3348 Some Mercurial commands can produce a lot of output, and Mercurial will
3355 Some Mercurial commands can produce a lot of output, and Mercurial will
3349 attempt to use a pager to make those commands more pleasant.
3356 attempt to use a pager to make those commands more pleasant.
3350 </p>
3357 </p>
3351 <p>
3358 <p>
3352 To set the pager that should be used, set the application variable:
3359 To set the pager that should be used, set the application variable:
3353 </p>
3360 </p>
3354 <pre>
3361 <pre>
3355 [pager]
3362 [pager]
3356 pager = less -FRX
3363 pager = less -FRX
3357 </pre>
3364 </pre>
3358 <p>
3365 <p>
3359 If no pager is set in the user or repository configuration, Mercurial uses the
3366 If no pager is set in the user or repository configuration, Mercurial uses the
3360 environment variable $PAGER. If $PAGER is not set, pager.pager from the default
3367 environment variable $PAGER. If $PAGER is not set, pager.pager from the default
3361 or system configuration is used. If none of these are set, a default pager will
3368 or system configuration is used. If none of these are set, a default pager will
3362 be used, typically 'less' on Unix and 'more' on Windows.
3369 be used, typically 'less' on Unix and 'more' on Windows.
3363 </p>
3370 </p>
3364 <p>
3371 <p>
3365 You can disable the pager for certain commands by adding them to the
3372 You can disable the pager for certain commands by adding them to the
3366 pager.ignore list:
3373 pager.ignore list:
3367 </p>
3374 </p>
3368 <pre>
3375 <pre>
3369 [pager]
3376 [pager]
3370 ignore = version, help, update
3377 ignore = version, help, update
3371 </pre>
3378 </pre>
3372 <p>
3379 <p>
3373 To ignore global commands like 'hg version' or 'hg help', you have
3380 To ignore global commands like 'hg version' or 'hg help', you have
3374 to specify them in your user configuration file.
3381 to specify them in your user configuration file.
3375 </p>
3382 </p>
3376 <p>
3383 <p>
3377 To control whether the pager is used at all for an individual command,
3384 To control whether the pager is used at all for an individual command,
3378 you can use --pager=&lt;value&gt;:
3385 you can use --pager=&lt;value&gt;:
3379 </p>
3386 </p>
3380 <ul>
3387 <ul>
3381 <li> use as needed: 'auto'.
3388 <li> use as needed: 'auto'.
3382 <li> require the pager: 'yes' or 'on'.
3389 <li> require the pager: 'yes' or 'on'.
3383 <li> suppress the pager: 'no' or 'off' (any unrecognized value will also work).
3390 <li> suppress the pager: 'no' or 'off' (any unrecognized value will also work).
3384 </ul>
3391 </ul>
3385 <p>
3392 <p>
3386 To globally turn off all attempts to use a pager, set:
3393 To globally turn off all attempts to use a pager, set:
3387 </p>
3394 </p>
3388 <pre>
3395 <pre>
3389 [ui]
3396 [ui]
3390 paginate = never
3397 paginate = never
3391 </pre>
3398 </pre>
3392 <p>
3399 <p>
3393 which will prevent the pager from running.
3400 which will prevent the pager from running.
3394 </p>
3401 </p>
3395
3402
3396 </div>
3403 </div>
3397 </div>
3404 </div>
3398 </div>
3405 </div>
3399
3406
3400
3407
3401
3408
3402 </body>
3409 </body>
3403 </html>
3410 </html>
3404
3411
3405
3412
3406 Sub-topic indexes rendered properly
3413 Sub-topic indexes rendered properly
3407
3414
3408 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals"
3415 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals"
3409 200 Script output follows
3416 200 Script output follows
3410
3417
3411 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3418 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3412 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3419 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3413 <head>
3420 <head>
3414 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3421 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3415 <meta name="robots" content="index, nofollow" />
3422 <meta name="robots" content="index, nofollow" />
3416 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3423 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3417 <script type="text/javascript" src="/static/mercurial.js"></script>
3424 <script type="text/javascript" src="/static/mercurial.js"></script>
3418
3425
3419 <title>Help: internals</title>
3426 <title>Help: internals</title>
3420 </head>
3427 </head>
3421 <body>
3428 <body>
3422
3429
3423 <div class="container">
3430 <div class="container">
3424 <div class="menu">
3431 <div class="menu">
3425 <div class="logo">
3432 <div class="logo">
3426 <a href="https://mercurial-scm.org/">
3433 <a href="https://mercurial-scm.org/">
3427 <img src="/static/hglogo.png" alt="mercurial" /></a>
3434 <img src="/static/hglogo.png" alt="mercurial" /></a>
3428 </div>
3435 </div>
3429 <ul>
3436 <ul>
3430 <li><a href="/shortlog">log</a></li>
3437 <li><a href="/shortlog">log</a></li>
3431 <li><a href="/graph">graph</a></li>
3438 <li><a href="/graph">graph</a></li>
3432 <li><a href="/tags">tags</a></li>
3439 <li><a href="/tags">tags</a></li>
3433 <li><a href="/bookmarks">bookmarks</a></li>
3440 <li><a href="/bookmarks">bookmarks</a></li>
3434 <li><a href="/branches">branches</a></li>
3441 <li><a href="/branches">branches</a></li>
3435 </ul>
3442 </ul>
3436 <ul>
3443 <ul>
3437 <li><a href="/help">help</a></li>
3444 <li><a href="/help">help</a></li>
3438 </ul>
3445 </ul>
3439 </div>
3446 </div>
3440
3447
3441 <div class="main">
3448 <div class="main">
3442 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3449 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3443
3450
3444 <form class="search" action="/log">
3451 <form class="search" action="/log">
3445
3452
3446 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3453 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3447 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3454 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3448 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3455 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3449 </form>
3456 </form>
3450 <table class="bigtable">
3457 <table class="bigtable">
3451 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
3458 <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr>
3452
3459
3453 <tr><td>
3460 <tr><td>
3454 <a href="/help/internals.bid-merge">
3461 <a href="/help/internals.bid-merge">
3455 bid-merge
3462 bid-merge
3456 </a>
3463 </a>
3457 </td><td>
3464 </td><td>
3458 Bid Merge Algorithm
3465 Bid Merge Algorithm
3459 </td></tr>
3466 </td></tr>
3460 <tr><td>
3467 <tr><td>
3461 <a href="/help/internals.bundle2">
3468 <a href="/help/internals.bundle2">
3462 bundle2
3469 bundle2
3463 </a>
3470 </a>
3464 </td><td>
3471 </td><td>
3465 Bundle2
3472 Bundle2
3466 </td></tr>
3473 </td></tr>
3467 <tr><td>
3474 <tr><td>
3468 <a href="/help/internals.bundles">
3475 <a href="/help/internals.bundles">
3469 bundles
3476 bundles
3470 </a>
3477 </a>
3471 </td><td>
3478 </td><td>
3472 Bundles
3479 Bundles
3473 </td></tr>
3480 </td></tr>
3474 <tr><td>
3481 <tr><td>
3475 <a href="/help/internals.cbor">
3482 <a href="/help/internals.cbor">
3476 cbor
3483 cbor
3477 </a>
3484 </a>
3478 </td><td>
3485 </td><td>
3479 CBOR
3486 CBOR
3480 </td></tr>
3487 </td></tr>
3481 <tr><td>
3488 <tr><td>
3482 <a href="/help/internals.censor">
3489 <a href="/help/internals.censor">
3483 censor
3490 censor
3484 </a>
3491 </a>
3485 </td><td>
3492 </td><td>
3486 Censor
3493 Censor
3487 </td></tr>
3494 </td></tr>
3488 <tr><td>
3495 <tr><td>
3489 <a href="/help/internals.changegroups">
3496 <a href="/help/internals.changegroups">
3490 changegroups
3497 changegroups
3491 </a>
3498 </a>
3492 </td><td>
3499 </td><td>
3493 Changegroups
3500 Changegroups
3494 </td></tr>
3501 </td></tr>
3495 <tr><td>
3502 <tr><td>
3496 <a href="/help/internals.config">
3503 <a href="/help/internals.config">
3497 config
3504 config
3498 </a>
3505 </a>
3499 </td><td>
3506 </td><td>
3500 Config Registrar
3507 Config Registrar
3501 </td></tr>
3508 </td></tr>
3502 <tr><td>
3509 <tr><td>
3503 <a href="/help/internals.extensions">
3510 <a href="/help/internals.extensions">
3504 extensions
3511 extensions
3505 </a>
3512 </a>
3506 </td><td>
3513 </td><td>
3507 Extension API
3514 Extension API
3508 </td></tr>
3515 </td></tr>
3509 <tr><td>
3516 <tr><td>
3510 <a href="/help/internals.mergestate">
3517 <a href="/help/internals.mergestate">
3511 mergestate
3518 mergestate
3512 </a>
3519 </a>
3513 </td><td>
3520 </td><td>
3514 Mergestate
3521 Mergestate
3515 </td></tr>
3522 </td></tr>
3516 <tr><td>
3523 <tr><td>
3517 <a href="/help/internals.requirements">
3524 <a href="/help/internals.requirements">
3518 requirements
3525 requirements
3519 </a>
3526 </a>
3520 </td><td>
3527 </td><td>
3521 Repository Requirements
3528 Repository Requirements
3522 </td></tr>
3529 </td></tr>
3523 <tr><td>
3530 <tr><td>
3524 <a href="/help/internals.revlogs">
3531 <a href="/help/internals.revlogs">
3525 revlogs
3532 revlogs
3526 </a>
3533 </a>
3527 </td><td>
3534 </td><td>
3528 Revision Logs
3535 Revision Logs
3529 </td></tr>
3536 </td></tr>
3530 <tr><td>
3537 <tr><td>
3531 <a href="/help/internals.wireprotocol">
3538 <a href="/help/internals.wireprotocol">
3532 wireprotocol
3539 wireprotocol
3533 </a>
3540 </a>
3534 </td><td>
3541 </td><td>
3535 Wire Protocol
3542 Wire Protocol
3536 </td></tr>
3543 </td></tr>
3537 <tr><td>
3544 <tr><td>
3538 <a href="/help/internals.wireprotocolrpc">
3545 <a href="/help/internals.wireprotocolrpc">
3539 wireprotocolrpc
3546 wireprotocolrpc
3540 </a>
3547 </a>
3541 </td><td>
3548 </td><td>
3542 Wire Protocol RPC
3549 Wire Protocol RPC
3543 </td></tr>
3550 </td></tr>
3544 <tr><td>
3551 <tr><td>
3545 <a href="/help/internals.wireprotocolv2">
3552 <a href="/help/internals.wireprotocolv2">
3546 wireprotocolv2
3553 wireprotocolv2
3547 </a>
3554 </a>
3548 </td><td>
3555 </td><td>
3549 Wire Protocol Version 2
3556 Wire Protocol Version 2
3550 </td></tr>
3557 </td></tr>
3551
3558
3552
3559
3553
3560
3554
3561
3555
3562
3556 </table>
3563 </table>
3557 </div>
3564 </div>
3558 </div>
3565 </div>
3559
3566
3560
3567
3561
3568
3562 </body>
3569 </body>
3563 </html>
3570 </html>
3564
3571
3565
3572
3566 Sub-topic topics rendered properly
3573 Sub-topic topics rendered properly
3567
3574
3568 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals.changegroups"
3575 $ get-with-headers.py $LOCALIP:$HGPORT "help/internals.changegroups"
3569 200 Script output follows
3576 200 Script output follows
3570
3577
3571 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3578 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3572 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3579 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3573 <head>
3580 <head>
3574 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3581 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3575 <meta name="robots" content="index, nofollow" />
3582 <meta name="robots" content="index, nofollow" />
3576 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3583 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3577 <script type="text/javascript" src="/static/mercurial.js"></script>
3584 <script type="text/javascript" src="/static/mercurial.js"></script>
3578
3585
3579 <title>Help: internals.changegroups</title>
3586 <title>Help: internals.changegroups</title>
3580 </head>
3587 </head>
3581 <body>
3588 <body>
3582
3589
3583 <div class="container">
3590 <div class="container">
3584 <div class="menu">
3591 <div class="menu">
3585 <div class="logo">
3592 <div class="logo">
3586 <a href="https://mercurial-scm.org/">
3593 <a href="https://mercurial-scm.org/">
3587 <img src="/static/hglogo.png" alt="mercurial" /></a>
3594 <img src="/static/hglogo.png" alt="mercurial" /></a>
3588 </div>
3595 </div>
3589 <ul>
3596 <ul>
3590 <li><a href="/shortlog">log</a></li>
3597 <li><a href="/shortlog">log</a></li>
3591 <li><a href="/graph">graph</a></li>
3598 <li><a href="/graph">graph</a></li>
3592 <li><a href="/tags">tags</a></li>
3599 <li><a href="/tags">tags</a></li>
3593 <li><a href="/bookmarks">bookmarks</a></li>
3600 <li><a href="/bookmarks">bookmarks</a></li>
3594 <li><a href="/branches">branches</a></li>
3601 <li><a href="/branches">branches</a></li>
3595 </ul>
3602 </ul>
3596 <ul>
3603 <ul>
3597 <li class="active"><a href="/help">help</a></li>
3604 <li class="active"><a href="/help">help</a></li>
3598 </ul>
3605 </ul>
3599 </div>
3606 </div>
3600
3607
3601 <div class="main">
3608 <div class="main">
3602 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3609 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3603 <h3>Help: internals.changegroups</h3>
3610 <h3>Help: internals.changegroups</h3>
3604
3611
3605 <form class="search" action="/log">
3612 <form class="search" action="/log">
3606
3613
3607 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3614 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3608 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3615 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3609 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3616 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3610 </form>
3617 </form>
3611 <div id="doc">
3618 <div id="doc">
3612 <h1>Changegroups</h1>
3619 <h1>Changegroups</h1>
3613 <p>
3620 <p>
3614 Changegroups are representations of repository revlog data, specifically
3621 Changegroups are representations of repository revlog data, specifically
3615 the changelog data, root/flat manifest data, treemanifest data, and
3622 the changelog data, root/flat manifest data, treemanifest data, and
3616 filelogs.
3623 filelogs.
3617 </p>
3624 </p>
3618 <p>
3625 <p>
3619 There are 3 versions of changegroups: &quot;1&quot;, &quot;2&quot;, and &quot;3&quot;. From a
3626 There are 3 versions of changegroups: &quot;1&quot;, &quot;2&quot;, and &quot;3&quot;. From a
3620 high-level, versions &quot;1&quot; and &quot;2&quot; are almost exactly the same, with the
3627 high-level, versions &quot;1&quot; and &quot;2&quot; are almost exactly the same, with the
3621 only difference being an additional item in the *delta header*. Version
3628 only difference being an additional item in the *delta header*. Version
3622 &quot;3&quot; adds support for storage flags in the *delta header* and optionally
3629 &quot;3&quot; adds support for storage flags in the *delta header* and optionally
3623 exchanging treemanifests (enabled by setting an option on the
3630 exchanging treemanifests (enabled by setting an option on the
3624 &quot;changegroup&quot; part in the bundle2).
3631 &quot;changegroup&quot; part in the bundle2).
3625 </p>
3632 </p>
3626 <p>
3633 <p>
3627 Changegroups when not exchanging treemanifests consist of 3 logical
3634 Changegroups when not exchanging treemanifests consist of 3 logical
3628 segments:
3635 segments:
3629 </p>
3636 </p>
3630 <pre>
3637 <pre>
3631 +---------------------------------+
3638 +---------------------------------+
3632 | | | |
3639 | | | |
3633 | changeset | manifest | filelogs |
3640 | changeset | manifest | filelogs |
3634 | | | |
3641 | | | |
3635 | | | |
3642 | | | |
3636 +---------------------------------+
3643 +---------------------------------+
3637 </pre>
3644 </pre>
3638 <p>
3645 <p>
3639 When exchanging treemanifests, there are 4 logical segments:
3646 When exchanging treemanifests, there are 4 logical segments:
3640 </p>
3647 </p>
3641 <pre>
3648 <pre>
3642 +-------------------------------------------------+
3649 +-------------------------------------------------+
3643 | | | | |
3650 | | | | |
3644 | changeset | root | treemanifests | filelogs |
3651 | changeset | root | treemanifests | filelogs |
3645 | | manifest | | |
3652 | | manifest | | |
3646 | | | | |
3653 | | | | |
3647 +-------------------------------------------------+
3654 +-------------------------------------------------+
3648 </pre>
3655 </pre>
3649 <p>
3656 <p>
3650 The principle building block of each segment is a *chunk*. A *chunk*
3657 The principle building block of each segment is a *chunk*. A *chunk*
3651 is a framed piece of data:
3658 is a framed piece of data:
3652 </p>
3659 </p>
3653 <pre>
3660 <pre>
3654 +---------------------------------------+
3661 +---------------------------------------+
3655 | | |
3662 | | |
3656 | length | data |
3663 | length | data |
3657 | (4 bytes) | (&lt;length - 4&gt; bytes) |
3664 | (4 bytes) | (&lt;length - 4&gt; bytes) |
3658 | | |
3665 | | |
3659 +---------------------------------------+
3666 +---------------------------------------+
3660 </pre>
3667 </pre>
3661 <p>
3668 <p>
3662 All integers are big-endian signed integers. Each chunk starts with a 32-bit
3669 All integers are big-endian signed integers. Each chunk starts with a 32-bit
3663 integer indicating the length of the entire chunk (including the length field
3670 integer indicating the length of the entire chunk (including the length field
3664 itself).
3671 itself).
3665 </p>
3672 </p>
3666 <p>
3673 <p>
3667 There is a special case chunk that has a value of 0 for the length
3674 There is a special case chunk that has a value of 0 for the length
3668 (&quot;0x00000000&quot;). We call this an *empty chunk*.
3675 (&quot;0x00000000&quot;). We call this an *empty chunk*.
3669 </p>
3676 </p>
3670 <h2>Delta Groups</h2>
3677 <h2>Delta Groups</h2>
3671 <p>
3678 <p>
3672 A *delta group* expresses the content of a revlog as a series of deltas,
3679 A *delta group* expresses the content of a revlog as a series of deltas,
3673 or patches against previous revisions.
3680 or patches against previous revisions.
3674 </p>
3681 </p>
3675 <p>
3682 <p>
3676 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
3683 Delta groups consist of 0 or more *chunks* followed by the *empty chunk*
3677 to signal the end of the delta group:
3684 to signal the end of the delta group:
3678 </p>
3685 </p>
3679 <pre>
3686 <pre>
3680 +------------------------------------------------------------------------+
3687 +------------------------------------------------------------------------+
3681 | | | | | |
3688 | | | | | |
3682 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
3689 | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 |
3683 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
3690 | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) |
3684 | | | | | |
3691 | | | | | |
3685 +------------------------------------------------------------------------+
3692 +------------------------------------------------------------------------+
3686 </pre>
3693 </pre>
3687 <p>
3694 <p>
3688 Each *chunk*'s data consists of the following:
3695 Each *chunk*'s data consists of the following:
3689 </p>
3696 </p>
3690 <pre>
3697 <pre>
3691 +---------------------------------------+
3698 +---------------------------------------+
3692 | | |
3699 | | |
3693 | delta header | delta data |
3700 | delta header | delta data |
3694 | (various by version) | (various) |
3701 | (various by version) | (various) |
3695 | | |
3702 | | |
3696 +---------------------------------------+
3703 +---------------------------------------+
3697 </pre>
3704 </pre>
3698 <p>
3705 <p>
3699 The *delta data* is a series of *delta*s that describe a diff from an existing
3706 The *delta data* is a series of *delta*s that describe a diff from an existing
3700 entry (either that the recipient already has, or previously specified in the
3707 entry (either that the recipient already has, or previously specified in the
3701 bundle/changegroup).
3708 bundle/changegroup).
3702 </p>
3709 </p>
3703 <p>
3710 <p>
3704 The *delta header* is different between versions &quot;1&quot;, &quot;2&quot;, and
3711 The *delta header* is different between versions &quot;1&quot;, &quot;2&quot;, and
3705 &quot;3&quot; of the changegroup format.
3712 &quot;3&quot; of the changegroup format.
3706 </p>
3713 </p>
3707 <p>
3714 <p>
3708 Version 1 (headerlen=80):
3715 Version 1 (headerlen=80):
3709 </p>
3716 </p>
3710 <pre>
3717 <pre>
3711 +------------------------------------------------------+
3718 +------------------------------------------------------+
3712 | | | | |
3719 | | | | |
3713 | node | p1 node | p2 node | link node |
3720 | node | p1 node | p2 node | link node |
3714 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3721 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3715 | | | | |
3722 | | | | |
3716 +------------------------------------------------------+
3723 +------------------------------------------------------+
3717 </pre>
3724 </pre>
3718 <p>
3725 <p>
3719 Version 2 (headerlen=100):
3726 Version 2 (headerlen=100):
3720 </p>
3727 </p>
3721 <pre>
3728 <pre>
3722 +------------------------------------------------------------------+
3729 +------------------------------------------------------------------+
3723 | | | | | |
3730 | | | | | |
3724 | node | p1 node | p2 node | base node | link node |
3731 | node | p1 node | p2 node | base node | link node |
3725 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3732 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) |
3726 | | | | | |
3733 | | | | | |
3727 +------------------------------------------------------------------+
3734 +------------------------------------------------------------------+
3728 </pre>
3735 </pre>
3729 <p>
3736 <p>
3730 Version 3 (headerlen=102):
3737 Version 3 (headerlen=102):
3731 </p>
3738 </p>
3732 <pre>
3739 <pre>
3733 +------------------------------------------------------------------------------+
3740 +------------------------------------------------------------------------------+
3734 | | | | | | |
3741 | | | | | | |
3735 | node | p1 node | p2 node | base node | link node | flags |
3742 | node | p1 node | p2 node | base node | link node | flags |
3736 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
3743 | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) |
3737 | | | | | | |
3744 | | | | | | |
3738 +------------------------------------------------------------------------------+
3745 +------------------------------------------------------------------------------+
3739 </pre>
3746 </pre>
3740 <p>
3747 <p>
3741 The *delta data* consists of &quot;chunklen - 4 - headerlen&quot; bytes, which contain a
3748 The *delta data* consists of &quot;chunklen - 4 - headerlen&quot; bytes, which contain a
3742 series of *delta*s, densely packed (no separators). These deltas describe a diff
3749 series of *delta*s, densely packed (no separators). These deltas describe a diff
3743 from an existing entry (either that the recipient already has, or previously
3750 from an existing entry (either that the recipient already has, or previously
3744 specified in the bundle/changegroup). The format is described more fully in
3751 specified in the bundle/changegroup). The format is described more fully in
3745 &quot;hg help internals.bdiff&quot;, but briefly:
3752 &quot;hg help internals.bdiff&quot;, but briefly:
3746 </p>
3753 </p>
3747 <pre>
3754 <pre>
3748 +---------------------------------------------------------------+
3755 +---------------------------------------------------------------+
3749 | | | | |
3756 | | | | |
3750 | start offset | end offset | new length | content |
3757 | start offset | end offset | new length | content |
3751 | (4 bytes) | (4 bytes) | (4 bytes) | (&lt;new length&gt; bytes) |
3758 | (4 bytes) | (4 bytes) | (4 bytes) | (&lt;new length&gt; bytes) |
3752 | | | | |
3759 | | | | |
3753 +---------------------------------------------------------------+
3760 +---------------------------------------------------------------+
3754 </pre>
3761 </pre>
3755 <p>
3762 <p>
3756 Please note that the length field in the delta data does *not* include itself.
3763 Please note that the length field in the delta data does *not* include itself.
3757 </p>
3764 </p>
3758 <p>
3765 <p>
3759 In version 1, the delta is always applied against the previous node from
3766 In version 1, the delta is always applied against the previous node from
3760 the changegroup or the first parent if this is the first entry in the
3767 the changegroup or the first parent if this is the first entry in the
3761 changegroup.
3768 changegroup.
3762 </p>
3769 </p>
3763 <p>
3770 <p>
3764 In version 2 and up, the delta base node is encoded in the entry in the
3771 In version 2 and up, the delta base node is encoded in the entry in the
3765 changegroup. This allows the delta to be expressed against any parent,
3772 changegroup. This allows the delta to be expressed against any parent,
3766 which can result in smaller deltas and more efficient encoding of data.
3773 which can result in smaller deltas and more efficient encoding of data.
3767 </p>
3774 </p>
3768 <p>
3775 <p>
3769 The *flags* field holds bitwise flags affecting the processing of revision
3776 The *flags* field holds bitwise flags affecting the processing of revision
3770 data. The following flags are defined:
3777 data. The following flags are defined:
3771 </p>
3778 </p>
3772 <dl>
3779 <dl>
3773 <dt>32768
3780 <dt>32768
3774 <dd>Censored revision. The revision's fulltext has been replaced by censor metadata. May only occur on file revisions.
3781 <dd>Censored revision. The revision's fulltext has been replaced by censor metadata. May only occur on file revisions.
3775 <dt>16384
3782 <dt>16384
3776 <dd>Ellipsis revision. Revision hash does not match data (likely due to rewritten parents).
3783 <dd>Ellipsis revision. Revision hash does not match data (likely due to rewritten parents).
3777 <dt>8192
3784 <dt>8192
3778 <dd>Externally stored. The revision fulltext contains &quot;key:value&quot; &quot;\n&quot; delimited metadata defining an object stored elsewhere. Used by the LFS extension.
3785 <dd>Externally stored. The revision fulltext contains &quot;key:value&quot; &quot;\n&quot; delimited metadata defining an object stored elsewhere. Used by the LFS extension.
3779 </dl>
3786 </dl>
3780 <p>
3787 <p>
3781 For historical reasons, the integer values are identical to revlog version 1
3788 For historical reasons, the integer values are identical to revlog version 1
3782 per-revision storage flags and correspond to bits being set in this 2-byte
3789 per-revision storage flags and correspond to bits being set in this 2-byte
3783 field. Bits were allocated starting from the most-significant bit, hence the
3790 field. Bits were allocated starting from the most-significant bit, hence the
3784 reverse ordering and allocation of these flags.
3791 reverse ordering and allocation of these flags.
3785 </p>
3792 </p>
3786 <h2>Changeset Segment</h2>
3793 <h2>Changeset Segment</h2>
3787 <p>
3794 <p>
3788 The *changeset segment* consists of a single *delta group* holding
3795 The *changeset segment* consists of a single *delta group* holding
3789 changelog data. The *empty chunk* at the end of the *delta group* denotes
3796 changelog data. The *empty chunk* at the end of the *delta group* denotes
3790 the boundary to the *manifest segment*.
3797 the boundary to the *manifest segment*.
3791 </p>
3798 </p>
3792 <h2>Manifest Segment</h2>
3799 <h2>Manifest Segment</h2>
3793 <p>
3800 <p>
3794 The *manifest segment* consists of a single *delta group* holding manifest
3801 The *manifest segment* consists of a single *delta group* holding manifest
3795 data. If treemanifests are in use, it contains only the manifest for the
3802 data. If treemanifests are in use, it contains only the manifest for the
3796 root directory of the repository. Otherwise, it contains the entire
3803 root directory of the repository. Otherwise, it contains the entire
3797 manifest data. The *empty chunk* at the end of the *delta group* denotes
3804 manifest data. The *empty chunk* at the end of the *delta group* denotes
3798 the boundary to the next segment (either the *treemanifests segment* or the
3805 the boundary to the next segment (either the *treemanifests segment* or the
3799 *filelogs segment*, depending on version and the request options).
3806 *filelogs segment*, depending on version and the request options).
3800 </p>
3807 </p>
3801 <h3>Treemanifests Segment</h3>
3808 <h3>Treemanifests Segment</h3>
3802 <p>
3809 <p>
3803 The *treemanifests segment* only exists in changegroup version &quot;3&quot;, and
3810 The *treemanifests segment* only exists in changegroup version &quot;3&quot;, and
3804 only if the 'treemanifest' param is part of the bundle2 changegroup part
3811 only if the 'treemanifest' param is part of the bundle2 changegroup part
3805 (it is not possible to use changegroup version 3 outside of bundle2).
3812 (it is not possible to use changegroup version 3 outside of bundle2).
3806 Aside from the filenames in the *treemanifests segment* containing a
3813 Aside from the filenames in the *treemanifests segment* containing a
3807 trailing &quot;/&quot; character, it behaves identically to the *filelogs segment*
3814 trailing &quot;/&quot; character, it behaves identically to the *filelogs segment*
3808 (see below). The final sub-segment is followed by an *empty chunk* (logically,
3815 (see below). The final sub-segment is followed by an *empty chunk* (logically,
3809 a sub-segment with filename size 0). This denotes the boundary to the
3816 a sub-segment with filename size 0). This denotes the boundary to the
3810 *filelogs segment*.
3817 *filelogs segment*.
3811 </p>
3818 </p>
3812 <h2>Filelogs Segment</h2>
3819 <h2>Filelogs Segment</h2>
3813 <p>
3820 <p>
3814 The *filelogs segment* consists of multiple sub-segments, each
3821 The *filelogs segment* consists of multiple sub-segments, each
3815 corresponding to an individual file whose data is being described:
3822 corresponding to an individual file whose data is being described:
3816 </p>
3823 </p>
3817 <pre>
3824 <pre>
3818 +--------------------------------------------------+
3825 +--------------------------------------------------+
3819 | | | | | |
3826 | | | | | |
3820 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
3827 | filelog0 | filelog1 | filelog2 | ... | 0x0 |
3821 | | | | | (4 bytes) |
3828 | | | | | (4 bytes) |
3822 | | | | | |
3829 | | | | | |
3823 +--------------------------------------------------+
3830 +--------------------------------------------------+
3824 </pre>
3831 </pre>
3825 <p>
3832 <p>
3826 The final filelog sub-segment is followed by an *empty chunk* (logically,
3833 The final filelog sub-segment is followed by an *empty chunk* (logically,
3827 a sub-segment with filename size 0). This denotes the end of the segment
3834 a sub-segment with filename size 0). This denotes the end of the segment
3828 and of the overall changegroup.
3835 and of the overall changegroup.
3829 </p>
3836 </p>
3830 <p>
3837 <p>
3831 Each filelog sub-segment consists of the following:
3838 Each filelog sub-segment consists of the following:
3832 </p>
3839 </p>
3833 <pre>
3840 <pre>
3834 +------------------------------------------------------+
3841 +------------------------------------------------------+
3835 | | | |
3842 | | | |
3836 | filename length | filename | delta group |
3843 | filename length | filename | delta group |
3837 | (4 bytes) | (&lt;length - 4&gt; bytes) | (various) |
3844 | (4 bytes) | (&lt;length - 4&gt; bytes) | (various) |
3838 | | | |
3845 | | | |
3839 +------------------------------------------------------+
3846 +------------------------------------------------------+
3840 </pre>
3847 </pre>
3841 <p>
3848 <p>
3842 That is, a *chunk* consisting of the filename (not terminated or padded)
3849 That is, a *chunk* consisting of the filename (not terminated or padded)
3843 followed by N chunks constituting the *delta group* for this file. The
3850 followed by N chunks constituting the *delta group* for this file. The
3844 *empty chunk* at the end of each *delta group* denotes the boundary to the
3851 *empty chunk* at the end of each *delta group* denotes the boundary to the
3845 next filelog sub-segment.
3852 next filelog sub-segment.
3846 </p>
3853 </p>
3847
3854
3848 </div>
3855 </div>
3849 </div>
3856 </div>
3850 </div>
3857 </div>
3851
3858
3852
3859
3853
3860
3854 </body>
3861 </body>
3855 </html>
3862 </html>
3856
3863
3857
3864
3858 $ get-with-headers.py 127.0.0.1:$HGPORT "help/unknowntopic"
3865 $ get-with-headers.py 127.0.0.1:$HGPORT "help/unknowntopic"
3859 404 Not Found
3866 404 Not Found
3860
3867
3861 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3868 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3862 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3869 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
3863 <head>
3870 <head>
3864 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3871 <link rel="icon" href="/static/hgicon.png" type="image/png" />
3865 <meta name="robots" content="index, nofollow" />
3872 <meta name="robots" content="index, nofollow" />
3866 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3873 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
3867 <script type="text/javascript" src="/static/mercurial.js"></script>
3874 <script type="text/javascript" src="/static/mercurial.js"></script>
3868
3875
3869 <title>test: error</title>
3876 <title>test: error</title>
3870 </head>
3877 </head>
3871 <body>
3878 <body>
3872
3879
3873 <div class="container">
3880 <div class="container">
3874 <div class="menu">
3881 <div class="menu">
3875 <div class="logo">
3882 <div class="logo">
3876 <a href="https://mercurial-scm.org/">
3883 <a href="https://mercurial-scm.org/">
3877 <img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial" /></a>
3884 <img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial" /></a>
3878 </div>
3885 </div>
3879 <ul>
3886 <ul>
3880 <li><a href="/shortlog">log</a></li>
3887 <li><a href="/shortlog">log</a></li>
3881 <li><a href="/graph">graph</a></li>
3888 <li><a href="/graph">graph</a></li>
3882 <li><a href="/tags">tags</a></li>
3889 <li><a href="/tags">tags</a></li>
3883 <li><a href="/bookmarks">bookmarks</a></li>
3890 <li><a href="/bookmarks">bookmarks</a></li>
3884 <li><a href="/branches">branches</a></li>
3891 <li><a href="/branches">branches</a></li>
3885 </ul>
3892 </ul>
3886 <ul>
3893 <ul>
3887 <li><a href="/help">help</a></li>
3894 <li><a href="/help">help</a></li>
3888 </ul>
3895 </ul>
3889 </div>
3896 </div>
3890
3897
3891 <div class="main">
3898 <div class="main">
3892
3899
3893 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3900 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
3894 <h3>error</h3>
3901 <h3>error</h3>
3895
3902
3896
3903
3897 <form class="search" action="/log">
3904 <form class="search" action="/log">
3898
3905
3899 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3906 <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
3900 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3907 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
3901 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3908 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
3902 </form>
3909 </form>
3903
3910
3904 <div class="description">
3911 <div class="description">
3905 <p>
3912 <p>
3906 An error occurred while processing your request:
3913 An error occurred while processing your request:
3907 </p>
3914 </p>
3908 <p>
3915 <p>
3909 Not Found
3916 Not Found
3910 </p>
3917 </p>
3911 </div>
3918 </div>
3912 </div>
3919 </div>
3913 </div>
3920 </div>
3914
3921
3915
3922
3916
3923
3917 </body>
3924 </body>
3918 </html>
3925 </html>
3919
3926
3920 [1]
3927 [1]
3921
3928
3922 $ killdaemons.py
3929 $ killdaemons.py
3923
3930
3924 #endif
3931 #endif
General Comments 0
You need to be logged in to leave comments. Login now