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