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