##// END OF EJS Templates
help: pass around ui to doc loader (API)...
Yuya Nishihara -
r26413:e0c572d4 default
parent child Browse files
Show More
@@ -1,165 +1,165 b''
1 #!/usr/bin/env python
1 #!/usr/bin/env python
2 #
2 #
3 # checkseclevel - checking section title levels in each online help document
3 # checkseclevel - checking section title levels in each online help document
4
4
5 import sys, os
5 import sys, os
6 import optparse
6 import optparse
7
7
8 # import from the live mercurial repo
8 # import from the live mercurial repo
9 sys.path.insert(0, "..")
9 sys.path.insert(0, "..")
10 # fall back to pure modules if required C extensions are not available
10 # fall back to pure modules if required C extensions are not available
11 sys.path.append(os.path.join('..', 'mercurial', 'pure'))
11 sys.path.append(os.path.join('..', 'mercurial', 'pure'))
12 from mercurial import demandimport; demandimport.enable()
12 from mercurial import demandimport; demandimport.enable()
13 from mercurial.commands import table
13 from mercurial.commands import table
14 from mercurial.help import helptable
14 from mercurial.help import helptable
15 from mercurial import extensions
15 from mercurial import extensions
16 from mercurial import minirst
16 from mercurial import minirst
17 from mercurial import ui as uimod
17 from mercurial import ui as uimod
18
18
19 level2mark = ['"', '=', '-', '.', '#']
19 level2mark = ['"', '=', '-', '.', '#']
20 reservedmarks = ['"']
20 reservedmarks = ['"']
21
21
22 mark2level = {}
22 mark2level = {}
23 for m, l in zip(level2mark, xrange(len(level2mark))):
23 for m, l in zip(level2mark, xrange(len(level2mark))):
24 if m not in reservedmarks:
24 if m not in reservedmarks:
25 mark2level[m] = l
25 mark2level[m] = l
26
26
27 initlevel_topic = 0
27 initlevel_topic = 0
28 initlevel_cmd = 1
28 initlevel_cmd = 1
29 initlevel_ext = 1
29 initlevel_ext = 1
30 initlevel_ext_cmd = 3
30 initlevel_ext_cmd = 3
31
31
32 def showavailables(ui, initlevel):
32 def showavailables(ui, initlevel):
33 ui.warn((' available marks and order of them in this help: %s\n') %
33 ui.warn((' available marks and order of them in this help: %s\n') %
34 (', '.join(['%r' % (m * 4) for m in level2mark[initlevel + 1:]])))
34 (', '.join(['%r' % (m * 4) for m in level2mark[initlevel + 1:]])))
35
35
36 def checkseclevel(ui, doc, name, initlevel):
36 def checkseclevel(ui, doc, name, initlevel):
37 ui.note(('checking "%s"\n') % name)
37 ui.note(('checking "%s"\n') % name)
38 blocks, pruned = minirst.parse(doc, 0, ['verbose'])
38 blocks, pruned = minirst.parse(doc, 0, ['verbose'])
39 errorcnt = 0
39 errorcnt = 0
40 curlevel = initlevel
40 curlevel = initlevel
41 for block in blocks:
41 for block in blocks:
42 if block['type'] != 'section':
42 if block['type'] != 'section':
43 continue
43 continue
44 mark = block['underline']
44 mark = block['underline']
45 title = block['lines'][0]
45 title = block['lines'][0]
46 if (mark not in mark2level) or (mark2level[mark] <= initlevel):
46 if (mark not in mark2level) or (mark2level[mark] <= initlevel):
47 ui.warn(('invalid section mark %r for "%s" of %s\n') %
47 ui.warn(('invalid section mark %r for "%s" of %s\n') %
48 (mark * 4, title, name))
48 (mark * 4, title, name))
49 showavailables(ui, initlevel)
49 showavailables(ui, initlevel)
50 errorcnt += 1
50 errorcnt += 1
51 continue
51 continue
52 nextlevel = mark2level[mark]
52 nextlevel = mark2level[mark]
53 if curlevel < nextlevel and curlevel + 1 != nextlevel:
53 if curlevel < nextlevel and curlevel + 1 != nextlevel:
54 ui.warn(('gap of section level at "%s" of %s\n') %
54 ui.warn(('gap of section level at "%s" of %s\n') %
55 (title, name))
55 (title, name))
56 showavailables(ui, initlevel)
56 showavailables(ui, initlevel)
57 errorcnt += 1
57 errorcnt += 1
58 continue
58 continue
59 ui.note(('appropriate section level for "%s %s"\n') %
59 ui.note(('appropriate section level for "%s %s"\n') %
60 (mark * (nextlevel * 2), title))
60 (mark * (nextlevel * 2), title))
61 curlevel = nextlevel
61 curlevel = nextlevel
62
62
63 return errorcnt
63 return errorcnt
64
64
65 def checkcmdtable(ui, cmdtable, namefmt, initlevel):
65 def checkcmdtable(ui, cmdtable, namefmt, initlevel):
66 errorcnt = 0
66 errorcnt = 0
67 for k, entry in cmdtable.items():
67 for k, entry in cmdtable.items():
68 name = k.split("|")[0].lstrip("^")
68 name = k.split("|")[0].lstrip("^")
69 if not entry[0].__doc__:
69 if not entry[0].__doc__:
70 ui.note(('skip checking %s: no help document\n') %
70 ui.note(('skip checking %s: no help document\n') %
71 (namefmt % name))
71 (namefmt % name))
72 continue
72 continue
73 errorcnt += checkseclevel(ui, entry[0].__doc__,
73 errorcnt += checkseclevel(ui, entry[0].__doc__,
74 namefmt % name,
74 namefmt % name,
75 initlevel)
75 initlevel)
76 return errorcnt
76 return errorcnt
77
77
78 def checkhghelps(ui):
78 def checkhghelps(ui):
79 errorcnt = 0
79 errorcnt = 0
80 for names, sec, doc in helptable:
80 for names, sec, doc in helptable:
81 if callable(doc):
81 if callable(doc):
82 doc = doc()
82 doc = doc(ui)
83 errorcnt += checkseclevel(ui, doc,
83 errorcnt += checkseclevel(ui, doc,
84 '%s help topic' % names[0],
84 '%s help topic' % names[0],
85 initlevel_topic)
85 initlevel_topic)
86
86
87 errorcnt += checkcmdtable(ui, table, '%s command', initlevel_cmd)
87 errorcnt += checkcmdtable(ui, table, '%s command', initlevel_cmd)
88
88
89 for name in sorted(extensions.enabled().keys() +
89 for name in sorted(extensions.enabled().keys() +
90 extensions.disabled().keys()):
90 extensions.disabled().keys()):
91 mod = extensions.load(None, name, None)
91 mod = extensions.load(None, name, None)
92 if not mod.__doc__:
92 if not mod.__doc__:
93 ui.note(('skip checking %s extension: no help document\n') % name)
93 ui.note(('skip checking %s extension: no help document\n') % name)
94 continue
94 continue
95 errorcnt += checkseclevel(ui, mod.__doc__,
95 errorcnt += checkseclevel(ui, mod.__doc__,
96 '%s extension' % name,
96 '%s extension' % name,
97 initlevel_ext)
97 initlevel_ext)
98
98
99 cmdtable = getattr(mod, 'cmdtable', None)
99 cmdtable = getattr(mod, 'cmdtable', None)
100 if cmdtable:
100 if cmdtable:
101 errorcnt += checkcmdtable(ui, cmdtable,
101 errorcnt += checkcmdtable(ui, cmdtable,
102 '%s command of ' + name + ' extension',
102 '%s command of ' + name + ' extension',
103 initlevel_ext_cmd)
103 initlevel_ext_cmd)
104 return errorcnt
104 return errorcnt
105
105
106 def checkfile(ui, filename, initlevel):
106 def checkfile(ui, filename, initlevel):
107 if filename == '-':
107 if filename == '-':
108 filename = 'stdin'
108 filename = 'stdin'
109 doc = sys.stdin.read()
109 doc = sys.stdin.read()
110 else:
110 else:
111 fp = open(filename)
111 fp = open(filename)
112 try:
112 try:
113 doc = fp.read()
113 doc = fp.read()
114 finally:
114 finally:
115 fp.close()
115 fp.close()
116
116
117 ui.note(('checking input from %s with initlevel %d\n') %
117 ui.note(('checking input from %s with initlevel %d\n') %
118 (filename, initlevel))
118 (filename, initlevel))
119 return checkseclevel(ui, doc, 'input from %s' % filename, initlevel)
119 return checkseclevel(ui, doc, 'input from %s' % filename, initlevel)
120
120
121 def main():
121 def main():
122 optparser = optparse.OptionParser("""%prog [options]
122 optparser = optparse.OptionParser("""%prog [options]
123
123
124 This checks all help documents of Mercurial (topics, commands,
124 This checks all help documents of Mercurial (topics, commands,
125 extensions and commands of them), if no file is specified by --file
125 extensions and commands of them), if no file is specified by --file
126 option.
126 option.
127 """)
127 """)
128 optparser.add_option("-v", "--verbose",
128 optparser.add_option("-v", "--verbose",
129 help="enable additional output",
129 help="enable additional output",
130 action="store_true")
130 action="store_true")
131 optparser.add_option("-f", "--file",
131 optparser.add_option("-f", "--file",
132 help="filename to read in (or '-' for stdin)",
132 help="filename to read in (or '-' for stdin)",
133 action="store", default="")
133 action="store", default="")
134
134
135 optparser.add_option("-t", "--topic",
135 optparser.add_option("-t", "--topic",
136 help="parse file as help topic",
136 help="parse file as help topic",
137 action="store_const", dest="initlevel", const=0)
137 action="store_const", dest="initlevel", const=0)
138 optparser.add_option("-c", "--command",
138 optparser.add_option("-c", "--command",
139 help="parse file as help of core command",
139 help="parse file as help of core command",
140 action="store_const", dest="initlevel", const=1)
140 action="store_const", dest="initlevel", const=1)
141 optparser.add_option("-e", "--extension",
141 optparser.add_option("-e", "--extension",
142 help="parse file as help of extension",
142 help="parse file as help of extension",
143 action="store_const", dest="initlevel", const=1)
143 action="store_const", dest="initlevel", const=1)
144 optparser.add_option("-C", "--extension-command",
144 optparser.add_option("-C", "--extension-command",
145 help="parse file as help of extension command",
145 help="parse file as help of extension command",
146 action="store_const", dest="initlevel", const=3)
146 action="store_const", dest="initlevel", const=3)
147
147
148 optparser.add_option("-l", "--initlevel",
148 optparser.add_option("-l", "--initlevel",
149 help="set initial section level manually",
149 help="set initial section level manually",
150 action="store", type="int", default=0)
150 action="store", type="int", default=0)
151
151
152 (options, args) = optparser.parse_args()
152 (options, args) = optparser.parse_args()
153
153
154 ui = uimod.ui()
154 ui = uimod.ui()
155 ui.setconfig('ui', 'verbose', options.verbose, '--verbose')
155 ui.setconfig('ui', 'verbose', options.verbose, '--verbose')
156
156
157 if options.file:
157 if options.file:
158 if checkfile(ui, options.file, options.initlevel):
158 if checkfile(ui, options.file, options.initlevel):
159 sys.exit(1)
159 sys.exit(1)
160 else:
160 else:
161 if checkhghelps(ui):
161 if checkhghelps(ui):
162 sys.exit(1)
162 sys.exit(1)
163
163
164 if __name__ == "__main__":
164 if __name__ == "__main__":
165 main()
165 main()
@@ -1,206 +1,206 b''
1 """usage: %s DOC ...
1 """usage: %s DOC ...
2
2
3 where DOC is the name of a document
3 where DOC is the name of a document
4 """
4 """
5
5
6 import os, sys, textwrap
6 import os, sys, textwrap
7 # import from the live mercurial repo
7 # import from the live mercurial repo
8 sys.path.insert(0, "..")
8 sys.path.insert(0, "..")
9 # fall back to pure modules if required C extensions are not available
9 # fall back to pure modules if required C extensions are not available
10 sys.path.append(os.path.join('..', 'mercurial', 'pure'))
10 sys.path.append(os.path.join('..', 'mercurial', 'pure'))
11 from mercurial import demandimport; demandimport.enable()
11 from mercurial import demandimport; demandimport.enable()
12 from mercurial import minirst
12 from mercurial import minirst
13 from mercurial.commands import table, globalopts
13 from mercurial.commands import table, globalopts
14 from mercurial.i18n import gettext, _
14 from mercurial.i18n import gettext, _
15 from mercurial.help import helptable, loaddoc
15 from mercurial.help import helptable, loaddoc
16 from mercurial import extensions
16 from mercurial import extensions
17 from mercurial import ui as uimod
17 from mercurial import ui as uimod
18
18
19 def get_desc(docstr):
19 def get_desc(docstr):
20 if not docstr:
20 if not docstr:
21 return "", ""
21 return "", ""
22 # sanitize
22 # sanitize
23 docstr = docstr.strip("\n")
23 docstr = docstr.strip("\n")
24 docstr = docstr.rstrip()
24 docstr = docstr.rstrip()
25 shortdesc = docstr.splitlines()[0].strip()
25 shortdesc = docstr.splitlines()[0].strip()
26
26
27 i = docstr.find("\n")
27 i = docstr.find("\n")
28 if i != -1:
28 if i != -1:
29 desc = docstr[i + 2:]
29 desc = docstr[i + 2:]
30 else:
30 else:
31 desc = shortdesc
31 desc = shortdesc
32
32
33 desc = textwrap.dedent(desc)
33 desc = textwrap.dedent(desc)
34
34
35 return (shortdesc, desc)
35 return (shortdesc, desc)
36
36
37 def get_opts(opts):
37 def get_opts(opts):
38 for opt in opts:
38 for opt in opts:
39 if len(opt) == 5:
39 if len(opt) == 5:
40 shortopt, longopt, default, desc, optlabel = opt
40 shortopt, longopt, default, desc, optlabel = opt
41 else:
41 else:
42 shortopt, longopt, default, desc = opt
42 shortopt, longopt, default, desc = opt
43 optlabel = _("VALUE")
43 optlabel = _("VALUE")
44 allopts = []
44 allopts = []
45 if shortopt:
45 if shortopt:
46 allopts.append("-%s" % shortopt)
46 allopts.append("-%s" % shortopt)
47 if longopt:
47 if longopt:
48 allopts.append("--%s" % longopt)
48 allopts.append("--%s" % longopt)
49 if isinstance(default, list):
49 if isinstance(default, list):
50 allopts[-1] += " <%s[+]>" % optlabel
50 allopts[-1] += " <%s[+]>" % optlabel
51 elif (default is not None) and not isinstance(default, bool):
51 elif (default is not None) and not isinstance(default, bool):
52 allopts[-1] += " <%s>" % optlabel
52 allopts[-1] += " <%s>" % optlabel
53 if '\n' in desc:
53 if '\n' in desc:
54 # only remove line breaks and indentation
54 # only remove line breaks and indentation
55 desc = ' '.join(l.lstrip() for l in desc.split('\n'))
55 desc = ' '.join(l.lstrip() for l in desc.split('\n'))
56 desc += default and _(" (default: %s)") % default or ""
56 desc += default and _(" (default: %s)") % default or ""
57 yield (", ".join(allopts), desc)
57 yield (", ".join(allopts), desc)
58
58
59 def get_cmd(cmd, cmdtable):
59 def get_cmd(cmd, cmdtable):
60 d = {}
60 d = {}
61 attr = cmdtable[cmd]
61 attr = cmdtable[cmd]
62 cmds = cmd.lstrip("^").split("|")
62 cmds = cmd.lstrip("^").split("|")
63
63
64 d['cmd'] = cmds[0]
64 d['cmd'] = cmds[0]
65 d['aliases'] = cmd.split("|")[1:]
65 d['aliases'] = cmd.split("|")[1:]
66 d['desc'] = get_desc(gettext(attr[0].__doc__))
66 d['desc'] = get_desc(gettext(attr[0].__doc__))
67 d['opts'] = list(get_opts(attr[1]))
67 d['opts'] = list(get_opts(attr[1]))
68
68
69 s = 'hg ' + cmds[0]
69 s = 'hg ' + cmds[0]
70 if len(attr) > 2:
70 if len(attr) > 2:
71 if not attr[2].startswith('hg'):
71 if not attr[2].startswith('hg'):
72 s += ' ' + attr[2]
72 s += ' ' + attr[2]
73 else:
73 else:
74 s = attr[2]
74 s = attr[2]
75 d['synopsis'] = s.strip()
75 d['synopsis'] = s.strip()
76
76
77 return d
77 return d
78
78
79 def showdoc(ui):
79 def showdoc(ui):
80 # print options
80 # print options
81 ui.write(minirst.section(_("Options")))
81 ui.write(minirst.section(_("Options")))
82 multioccur = False
82 multioccur = False
83 for optstr, desc in get_opts(globalopts):
83 for optstr, desc in get_opts(globalopts):
84 ui.write("%s\n %s\n\n" % (optstr, desc))
84 ui.write("%s\n %s\n\n" % (optstr, desc))
85 if optstr.endswith("[+]>"):
85 if optstr.endswith("[+]>"):
86 multioccur = True
86 multioccur = True
87 if multioccur:
87 if multioccur:
88 ui.write(_("\n[+] marked option can be specified multiple times\n"))
88 ui.write(_("\n[+] marked option can be specified multiple times\n"))
89 ui.write("\n")
89 ui.write("\n")
90
90
91 # print cmds
91 # print cmds
92 ui.write(minirst.section(_("Commands")))
92 ui.write(minirst.section(_("Commands")))
93 commandprinter(ui, table, minirst.subsection)
93 commandprinter(ui, table, minirst.subsection)
94
94
95 # print help topics
95 # print help topics
96 # The config help topic is included in the hgrc.5 man page.
96 # The config help topic is included in the hgrc.5 man page.
97 helpprinter(ui, helptable, minirst.section, exclude=['config'])
97 helpprinter(ui, helptable, minirst.section, exclude=['config'])
98
98
99 ui.write(minirst.section(_("Extensions")))
99 ui.write(minirst.section(_("Extensions")))
100 ui.write(_("This section contains help for extensions that are "
100 ui.write(_("This section contains help for extensions that are "
101 "distributed together with Mercurial. Help for other "
101 "distributed together with Mercurial. Help for other "
102 "extensions is available in the help system."))
102 "extensions is available in the help system."))
103 ui.write("\n\n"
103 ui.write("\n\n"
104 ".. contents::\n"
104 ".. contents::\n"
105 " :class: htmlonly\n"
105 " :class: htmlonly\n"
106 " :local:\n"
106 " :local:\n"
107 " :depth: 1\n\n")
107 " :depth: 1\n\n")
108
108
109 for extensionname in sorted(allextensionnames()):
109 for extensionname in sorted(allextensionnames()):
110 mod = extensions.load(None, extensionname, None)
110 mod = extensions.load(None, extensionname, None)
111 ui.write(minirst.subsection(extensionname))
111 ui.write(minirst.subsection(extensionname))
112 ui.write("%s\n\n" % gettext(mod.__doc__))
112 ui.write("%s\n\n" % gettext(mod.__doc__))
113 cmdtable = getattr(mod, 'cmdtable', None)
113 cmdtable = getattr(mod, 'cmdtable', None)
114 if cmdtable:
114 if cmdtable:
115 ui.write(minirst.subsubsection(_('Commands')))
115 ui.write(minirst.subsubsection(_('Commands')))
116 commandprinter(ui, cmdtable, minirst.subsubsubsection)
116 commandprinter(ui, cmdtable, minirst.subsubsubsection)
117
117
118 def showtopic(ui, topic):
118 def showtopic(ui, topic):
119 extrahelptable = [
119 extrahelptable = [
120 (["common"], '', loaddoc('common')),
120 (["common"], '', loaddoc('common')),
121 (["hg.1"], '', loaddoc('hg.1')),
121 (["hg.1"], '', loaddoc('hg.1')),
122 (["hgignore.5"], '', loaddoc('hgignore.5')),
122 (["hgignore.5"], '', loaddoc('hgignore.5')),
123 (["hgrc.5"], '', loaddoc('hgrc.5')),
123 (["hgrc.5"], '', loaddoc('hgrc.5')),
124 (["hgignore.5.gendoc"], '', loaddoc('hgignore')),
124 (["hgignore.5.gendoc"], '', loaddoc('hgignore')),
125 (["hgrc.5.gendoc"], '', loaddoc('config')),
125 (["hgrc.5.gendoc"], '', loaddoc('config')),
126 ]
126 ]
127 helpprinter(ui, helptable + extrahelptable, None, include=[topic])
127 helpprinter(ui, helptable + extrahelptable, None, include=[topic])
128
128
129 def helpprinter(ui, helptable, sectionfunc, include=[], exclude=[]):
129 def helpprinter(ui, helptable, sectionfunc, include=[], exclude=[]):
130 for names, sec, doc in helptable:
130 for names, sec, doc in helptable:
131 if exclude and names[0] in exclude:
131 if exclude and names[0] in exclude:
132 continue
132 continue
133 if include and names[0] not in include:
133 if include and names[0] not in include:
134 continue
134 continue
135 for name in names:
135 for name in names:
136 ui.write(".. _%s:\n" % name)
136 ui.write(".. _%s:\n" % name)
137 ui.write("\n")
137 ui.write("\n")
138 if sectionfunc:
138 if sectionfunc:
139 ui.write(sectionfunc(sec))
139 ui.write(sectionfunc(sec))
140 if callable(doc):
140 if callable(doc):
141 doc = doc()
141 doc = doc(ui)
142 ui.write(doc)
142 ui.write(doc)
143 ui.write("\n")
143 ui.write("\n")
144
144
145 def commandprinter(ui, cmdtable, sectionfunc):
145 def commandprinter(ui, cmdtable, sectionfunc):
146 h = {}
146 h = {}
147 for c, attr in cmdtable.items():
147 for c, attr in cmdtable.items():
148 f = c.split("|")[0]
148 f = c.split("|")[0]
149 f = f.lstrip("^")
149 f = f.lstrip("^")
150 h[f] = c
150 h[f] = c
151 cmds = h.keys()
151 cmds = h.keys()
152 cmds.sort()
152 cmds.sort()
153
153
154 for f in cmds:
154 for f in cmds:
155 if f.startswith("debug"):
155 if f.startswith("debug"):
156 continue
156 continue
157 d = get_cmd(h[f], cmdtable)
157 d = get_cmd(h[f], cmdtable)
158 ui.write(sectionfunc(d['cmd']))
158 ui.write(sectionfunc(d['cmd']))
159 # short description
159 # short description
160 ui.write(d['desc'][0])
160 ui.write(d['desc'][0])
161 # synopsis
161 # synopsis
162 ui.write("::\n\n")
162 ui.write("::\n\n")
163 synopsislines = d['synopsis'].splitlines()
163 synopsislines = d['synopsis'].splitlines()
164 for line in synopsislines:
164 for line in synopsislines:
165 # some commands (such as rebase) have a multi-line
165 # some commands (such as rebase) have a multi-line
166 # synopsis
166 # synopsis
167 ui.write(" %s\n" % line)
167 ui.write(" %s\n" % line)
168 ui.write('\n')
168 ui.write('\n')
169 # description
169 # description
170 ui.write("%s\n\n" % d['desc'][1])
170 ui.write("%s\n\n" % d['desc'][1])
171 # options
171 # options
172 opt_output = list(d['opts'])
172 opt_output = list(d['opts'])
173 if opt_output:
173 if opt_output:
174 opts_len = max([len(line[0]) for line in opt_output])
174 opts_len = max([len(line[0]) for line in opt_output])
175 ui.write(_("Options:\n\n"))
175 ui.write(_("Options:\n\n"))
176 multioccur = False
176 multioccur = False
177 for optstr, desc in opt_output:
177 for optstr, desc in opt_output:
178 if desc:
178 if desc:
179 s = "%-*s %s" % (opts_len, optstr, desc)
179 s = "%-*s %s" % (opts_len, optstr, desc)
180 else:
180 else:
181 s = optstr
181 s = optstr
182 ui.write("%s\n" % s)
182 ui.write("%s\n" % s)
183 if optstr.endswith("[+]>"):
183 if optstr.endswith("[+]>"):
184 multioccur = True
184 multioccur = True
185 if multioccur:
185 if multioccur:
186 ui.write(_("\n[+] marked option can be specified"
186 ui.write(_("\n[+] marked option can be specified"
187 " multiple times\n"))
187 " multiple times\n"))
188 ui.write("\n")
188 ui.write("\n")
189 # aliases
189 # aliases
190 if d['aliases']:
190 if d['aliases']:
191 ui.write(_(" aliases: %s\n\n") % " ".join(d['aliases']))
191 ui.write(_(" aliases: %s\n\n") % " ".join(d['aliases']))
192
192
193
193
194 def allextensionnames():
194 def allextensionnames():
195 return extensions.enabled().keys() + extensions.disabled().keys()
195 return extensions.enabled().keys() + extensions.disabled().keys()
196
196
197 if __name__ == "__main__":
197 if __name__ == "__main__":
198 doc = 'hg.1.gendoc'
198 doc = 'hg.1.gendoc'
199 if len(sys.argv) > 1:
199 if len(sys.argv) > 1:
200 doc = sys.argv[1]
200 doc = sys.argv[1]
201
201
202 ui = uimod.ui()
202 ui = uimod.ui()
203 if doc == 'hg.1.gendoc':
203 if doc == 'hg.1.gendoc':
204 showdoc(ui)
204 showdoc(ui)
205 else:
205 else:
206 showtopic(ui, sys.argv[1])
206 showtopic(ui, sys.argv[1])
@@ -1,534 +1,534 b''
1 # help.py - help data for mercurial
1 # help.py - help data for mercurial
2 #
2 #
3 # Copyright 2006 Matt Mackall <mpm@selenic.com>
3 # Copyright 2006 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 i18n import gettext, _
8 from i18n import gettext, _
9 import itertools, os, textwrap
9 import itertools, os, textwrap
10 import error
10 import error
11 import extensions, revset, fileset, templatekw, templatefilters, filemerge
11 import extensions, revset, fileset, templatekw, templatefilters, filemerge
12 import templater
12 import templater
13 import encoding, util, minirst
13 import encoding, util, minirst
14 import cmdutil
14 import cmdutil
15 import hgweb.webcommands as webcommands
15 import hgweb.webcommands as webcommands
16
16
17 _exclkeywords = [
17 _exclkeywords = [
18 "(DEPRECATED)",
18 "(DEPRECATED)",
19 "(EXPERIMENTAL)",
19 "(EXPERIMENTAL)",
20 # i18n: "(DEPRECATED)" is a keyword, must be translated consistently
20 # i18n: "(DEPRECATED)" is a keyword, must be translated consistently
21 _("(DEPRECATED)"),
21 _("(DEPRECATED)"),
22 # i18n: "(EXPERIMENTAL)" is a keyword, must be translated consistently
22 # i18n: "(EXPERIMENTAL)" is a keyword, must be translated consistently
23 _("(EXPERIMENTAL)"),
23 _("(EXPERIMENTAL)"),
24 ]
24 ]
25
25
26 def listexts(header, exts, indent=1, showdeprecated=False):
26 def listexts(header, exts, indent=1, showdeprecated=False):
27 '''return a text listing of the given extensions'''
27 '''return a text listing of the given extensions'''
28 rst = []
28 rst = []
29 if exts:
29 if exts:
30 rst.append('\n%s\n\n' % header)
30 rst.append('\n%s\n\n' % header)
31 for name, desc in sorted(exts.iteritems()):
31 for name, desc in sorted(exts.iteritems()):
32 if not showdeprecated and any(w in desc for w in _exclkeywords):
32 if not showdeprecated and any(w in desc for w in _exclkeywords):
33 continue
33 continue
34 rst.append('%s:%s: %s\n' % (' ' * indent, name, desc))
34 rst.append('%s:%s: %s\n' % (' ' * indent, name, desc))
35 return rst
35 return rst
36
36
37 def extshelp():
37 def extshelp(ui):
38 rst = loaddoc('extensions')().splitlines(True)
38 rst = loaddoc('extensions')(ui).splitlines(True)
39 rst.extend(listexts(
39 rst.extend(listexts(
40 _('enabled extensions:'), extensions.enabled(), showdeprecated=True))
40 _('enabled extensions:'), extensions.enabled(), showdeprecated=True))
41 rst.extend(listexts(_('disabled extensions:'), extensions.disabled()))
41 rst.extend(listexts(_('disabled extensions:'), extensions.disabled()))
42 doc = ''.join(rst)
42 doc = ''.join(rst)
43 return doc
43 return doc
44
44
45 def optrst(header, options, verbose):
45 def optrst(header, options, verbose):
46 data = []
46 data = []
47 multioccur = False
47 multioccur = False
48 for option in options:
48 for option in options:
49 if len(option) == 5:
49 if len(option) == 5:
50 shortopt, longopt, default, desc, optlabel = option
50 shortopt, longopt, default, desc, optlabel = option
51 else:
51 else:
52 shortopt, longopt, default, desc = option
52 shortopt, longopt, default, desc = option
53 optlabel = _("VALUE") # default label
53 optlabel = _("VALUE") # default label
54
54
55 if not verbose and any(w in desc for w in _exclkeywords):
55 if not verbose and any(w in desc for w in _exclkeywords):
56 continue
56 continue
57
57
58 so = ''
58 so = ''
59 if shortopt:
59 if shortopt:
60 so = '-' + shortopt
60 so = '-' + shortopt
61 lo = '--' + longopt
61 lo = '--' + longopt
62 if default:
62 if default:
63 desc += _(" (default: %s)") % default
63 desc += _(" (default: %s)") % default
64
64
65 if isinstance(default, list):
65 if isinstance(default, list):
66 lo += " %s [+]" % optlabel
66 lo += " %s [+]" % optlabel
67 multioccur = True
67 multioccur = True
68 elif (default is not None) and not isinstance(default, bool):
68 elif (default is not None) and not isinstance(default, bool):
69 lo += " %s" % optlabel
69 lo += " %s" % optlabel
70
70
71 data.append((so, lo, desc))
71 data.append((so, lo, desc))
72
72
73 if multioccur:
73 if multioccur:
74 header += (_(" ([+] can be repeated)"))
74 header += (_(" ([+] can be repeated)"))
75
75
76 rst = ['\n%s:\n\n' % header]
76 rst = ['\n%s:\n\n' % header]
77 rst.extend(minirst.maketable(data, 1))
77 rst.extend(minirst.maketable(data, 1))
78
78
79 return ''.join(rst)
79 return ''.join(rst)
80
80
81 def indicateomitted(rst, omitted, notomitted=None):
81 def indicateomitted(rst, omitted, notomitted=None):
82 rst.append('\n\n.. container:: omitted\n\n %s\n\n' % omitted)
82 rst.append('\n\n.. container:: omitted\n\n %s\n\n' % omitted)
83 if notomitted:
83 if notomitted:
84 rst.append('\n\n.. container:: notomitted\n\n %s\n\n' % notomitted)
84 rst.append('\n\n.. container:: notomitted\n\n %s\n\n' % notomitted)
85
85
86 def topicmatch(kw):
86 def topicmatch(ui, kw):
87 """Return help topics matching kw.
87 """Return help topics matching kw.
88
88
89 Returns {'section': [(name, summary), ...], ...} where section is
89 Returns {'section': [(name, summary), ...], ...} where section is
90 one of topics, commands, extensions, or extensioncommands.
90 one of topics, commands, extensions, or extensioncommands.
91 """
91 """
92 kw = encoding.lower(kw)
92 kw = encoding.lower(kw)
93 def lowercontains(container):
93 def lowercontains(container):
94 return kw in encoding.lower(container) # translated in helptable
94 return kw in encoding.lower(container) # translated in helptable
95 results = {'topics': [],
95 results = {'topics': [],
96 'commands': [],
96 'commands': [],
97 'extensions': [],
97 'extensions': [],
98 'extensioncommands': [],
98 'extensioncommands': [],
99 }
99 }
100 for names, header, doc in helptable:
100 for names, header, doc in helptable:
101 # Old extensions may use a str as doc.
101 # Old extensions may use a str as doc.
102 if (sum(map(lowercontains, names))
102 if (sum(map(lowercontains, names))
103 or lowercontains(header)
103 or lowercontains(header)
104 or (callable(doc) and lowercontains(doc()))):
104 or (callable(doc) and lowercontains(doc(ui)))):
105 results['topics'].append((names[0], header))
105 results['topics'].append((names[0], header))
106 import commands # avoid cycle
106 import commands # avoid cycle
107 for cmd, entry in commands.table.iteritems():
107 for cmd, entry in commands.table.iteritems():
108 if len(entry) == 3:
108 if len(entry) == 3:
109 summary = entry[2]
109 summary = entry[2]
110 else:
110 else:
111 summary = ''
111 summary = ''
112 # translate docs *before* searching there
112 # translate docs *before* searching there
113 docs = _(getattr(entry[0], '__doc__', None)) or ''
113 docs = _(getattr(entry[0], '__doc__', None)) or ''
114 if kw in cmd or lowercontains(summary) or lowercontains(docs):
114 if kw in cmd or lowercontains(summary) or lowercontains(docs):
115 doclines = docs.splitlines()
115 doclines = docs.splitlines()
116 if doclines:
116 if doclines:
117 summary = doclines[0]
117 summary = doclines[0]
118 cmdname = cmd.split('|')[0].lstrip('^')
118 cmdname = cmd.split('|')[0].lstrip('^')
119 results['commands'].append((cmdname, summary))
119 results['commands'].append((cmdname, summary))
120 for name, docs in itertools.chain(
120 for name, docs in itertools.chain(
121 extensions.enabled(False).iteritems(),
121 extensions.enabled(False).iteritems(),
122 extensions.disabled().iteritems()):
122 extensions.disabled().iteritems()):
123 # extensions.load ignores the UI argument
123 # extensions.load ignores the UI argument
124 mod = extensions.load(None, name, '')
124 mod = extensions.load(None, name, '')
125 name = name.split('.')[-1]
125 name = name.split('.')[-1]
126 if lowercontains(name) or lowercontains(docs):
126 if lowercontains(name) or lowercontains(docs):
127 # extension docs are already translated
127 # extension docs are already translated
128 results['extensions'].append((name, docs.splitlines()[0]))
128 results['extensions'].append((name, docs.splitlines()[0]))
129 for cmd, entry in getattr(mod, 'cmdtable', {}).iteritems():
129 for cmd, entry in getattr(mod, 'cmdtable', {}).iteritems():
130 if kw in cmd or (len(entry) > 2 and lowercontains(entry[2])):
130 if kw in cmd or (len(entry) > 2 and lowercontains(entry[2])):
131 cmdname = cmd.split('|')[0].lstrip('^')
131 cmdname = cmd.split('|')[0].lstrip('^')
132 if entry[0].__doc__:
132 if entry[0].__doc__:
133 cmddoc = gettext(entry[0].__doc__).splitlines()[0]
133 cmddoc = gettext(entry[0].__doc__).splitlines()[0]
134 else:
134 else:
135 cmddoc = _('(no help text available)')
135 cmddoc = _('(no help text available)')
136 results['extensioncommands'].append((cmdname, cmddoc))
136 results['extensioncommands'].append((cmdname, cmddoc))
137 return results
137 return results
138
138
139 def loaddoc(topic):
139 def loaddoc(topic):
140 """Return a delayed loader for help/topic.txt."""
140 """Return a delayed loader for help/topic.txt."""
141
141
142 def loader():
142 def loader(ui):
143 docdir = os.path.join(util.datapath, 'help')
143 docdir = os.path.join(util.datapath, 'help')
144 path = os.path.join(docdir, topic + ".txt")
144 path = os.path.join(docdir, topic + ".txt")
145 doc = gettext(util.readfile(path))
145 doc = gettext(util.readfile(path))
146 for rewriter in helphooks.get(topic, []):
146 for rewriter in helphooks.get(topic, []):
147 doc = rewriter(topic, doc)
147 doc = rewriter(topic, doc)
148 return doc
148 return doc
149
149
150 return loader
150 return loader
151
151
152 helptable = sorted([
152 helptable = sorted([
153 (["config", "hgrc"], _("Configuration Files"), loaddoc('config')),
153 (["config", "hgrc"], _("Configuration Files"), loaddoc('config')),
154 (["dates"], _("Date Formats"), loaddoc('dates')),
154 (["dates"], _("Date Formats"), loaddoc('dates')),
155 (["patterns"], _("File Name Patterns"), loaddoc('patterns')),
155 (["patterns"], _("File Name Patterns"), loaddoc('patterns')),
156 (['environment', 'env'], _('Environment Variables'),
156 (['environment', 'env'], _('Environment Variables'),
157 loaddoc('environment')),
157 loaddoc('environment')),
158 (['revisions', 'revs'], _('Specifying Single Revisions'),
158 (['revisions', 'revs'], _('Specifying Single Revisions'),
159 loaddoc('revisions')),
159 loaddoc('revisions')),
160 (['multirevs', 'mrevs'], _('Specifying Multiple Revisions'),
160 (['multirevs', 'mrevs'], _('Specifying Multiple Revisions'),
161 loaddoc('multirevs')),
161 loaddoc('multirevs')),
162 (['revsets', 'revset'], _("Specifying Revision Sets"), loaddoc('revsets')),
162 (['revsets', 'revset'], _("Specifying Revision Sets"), loaddoc('revsets')),
163 (['filesets', 'fileset'], _("Specifying File Sets"), loaddoc('filesets')),
163 (['filesets', 'fileset'], _("Specifying File Sets"), loaddoc('filesets')),
164 (['diffs'], _('Diff Formats'), loaddoc('diffs')),
164 (['diffs'], _('Diff Formats'), loaddoc('diffs')),
165 (['merge-tools', 'mergetools'], _('Merge Tools'), loaddoc('merge-tools')),
165 (['merge-tools', 'mergetools'], _('Merge Tools'), loaddoc('merge-tools')),
166 (['templating', 'templates', 'template', 'style'], _('Template Usage'),
166 (['templating', 'templates', 'template', 'style'], _('Template Usage'),
167 loaddoc('templates')),
167 loaddoc('templates')),
168 (['urls'], _('URL Paths'), loaddoc('urls')),
168 (['urls'], _('URL Paths'), loaddoc('urls')),
169 (["extensions"], _("Using Additional Features"), extshelp),
169 (["extensions"], _("Using Additional Features"), extshelp),
170 (["subrepos", "subrepo"], _("Subrepositories"), loaddoc('subrepos')),
170 (["subrepos", "subrepo"], _("Subrepositories"), loaddoc('subrepos')),
171 (["hgweb"], _("Configuring hgweb"), loaddoc('hgweb')),
171 (["hgweb"], _("Configuring hgweb"), loaddoc('hgweb')),
172 (["glossary"], _("Glossary"), loaddoc('glossary')),
172 (["glossary"], _("Glossary"), loaddoc('glossary')),
173 (["hgignore", "ignore"], _("Syntax for Mercurial Ignore Files"),
173 (["hgignore", "ignore"], _("Syntax for Mercurial Ignore Files"),
174 loaddoc('hgignore')),
174 loaddoc('hgignore')),
175 (["phases"], _("Working with Phases"), loaddoc('phases')),
175 (["phases"], _("Working with Phases"), loaddoc('phases')),
176 (['scripting'], _('Using Mercurial from scripts and automation'),
176 (['scripting'], _('Using Mercurial from scripts and automation'),
177 loaddoc('scripting')),
177 loaddoc('scripting')),
178 ])
178 ])
179
179
180 # Map topics to lists of callable taking the current topic help and
180 # Map topics to lists of callable taking the current topic help and
181 # returning the updated version
181 # returning the updated version
182 helphooks = {}
182 helphooks = {}
183
183
184 def addtopichook(topic, rewriter):
184 def addtopichook(topic, rewriter):
185 helphooks.setdefault(topic, []).append(rewriter)
185 helphooks.setdefault(topic, []).append(rewriter)
186
186
187 def makeitemsdoc(topic, doc, marker, items, dedent=False):
187 def makeitemsdoc(topic, doc, marker, items, dedent=False):
188 """Extract docstring from the items key to function mapping, build a
188 """Extract docstring from the items key to function mapping, build a
189 single documentation block and use it to overwrite the marker in doc.
189 single documentation block and use it to overwrite the marker in doc.
190 """
190 """
191 entries = []
191 entries = []
192 for name in sorted(items):
192 for name in sorted(items):
193 text = (items[name].__doc__ or '').rstrip()
193 text = (items[name].__doc__ or '').rstrip()
194 if not text:
194 if not text:
195 continue
195 continue
196 text = gettext(text)
196 text = gettext(text)
197 if dedent:
197 if dedent:
198 text = textwrap.dedent(text)
198 text = textwrap.dedent(text)
199 lines = text.splitlines()
199 lines = text.splitlines()
200 doclines = [(lines[0])]
200 doclines = [(lines[0])]
201 for l in lines[1:]:
201 for l in lines[1:]:
202 # Stop once we find some Python doctest
202 # Stop once we find some Python doctest
203 if l.strip().startswith('>>>'):
203 if l.strip().startswith('>>>'):
204 break
204 break
205 if dedent:
205 if dedent:
206 doclines.append(l.rstrip())
206 doclines.append(l.rstrip())
207 else:
207 else:
208 doclines.append(' ' + l.strip())
208 doclines.append(' ' + l.strip())
209 entries.append('\n'.join(doclines))
209 entries.append('\n'.join(doclines))
210 entries = '\n\n'.join(entries)
210 entries = '\n\n'.join(entries)
211 return doc.replace(marker, entries)
211 return doc.replace(marker, entries)
212
212
213 def addtopicsymbols(topic, marker, symbols, dedent=False):
213 def addtopicsymbols(topic, marker, symbols, dedent=False):
214 def add(topic, doc):
214 def add(topic, doc):
215 return makeitemsdoc(topic, doc, marker, symbols, dedent=dedent)
215 return makeitemsdoc(topic, doc, marker, symbols, dedent=dedent)
216 addtopichook(topic, add)
216 addtopichook(topic, add)
217
217
218 addtopicsymbols('filesets', '.. predicatesmarker', fileset.symbols)
218 addtopicsymbols('filesets', '.. predicatesmarker', fileset.symbols)
219 addtopicsymbols('merge-tools', '.. internaltoolsmarker',
219 addtopicsymbols('merge-tools', '.. internaltoolsmarker',
220 filemerge.internalsdoc)
220 filemerge.internalsdoc)
221 addtopicsymbols('revsets', '.. predicatesmarker', revset.symbols)
221 addtopicsymbols('revsets', '.. predicatesmarker', revset.symbols)
222 addtopicsymbols('templates', '.. keywordsmarker', templatekw.dockeywords)
222 addtopicsymbols('templates', '.. keywordsmarker', templatekw.dockeywords)
223 addtopicsymbols('templates', '.. filtersmarker', templatefilters.filters)
223 addtopicsymbols('templates', '.. filtersmarker', templatefilters.filters)
224 addtopicsymbols('templates', '.. functionsmarker', templater.funcs)
224 addtopicsymbols('templates', '.. functionsmarker', templater.funcs)
225 addtopicsymbols('hgweb', '.. webcommandsmarker', webcommands.commands,
225 addtopicsymbols('hgweb', '.. webcommandsmarker', webcommands.commands,
226 dedent=True)
226 dedent=True)
227
227
228 def help_(ui, name, unknowncmd=False, full=True, **opts):
228 def help_(ui, name, unknowncmd=False, full=True, **opts):
229 '''
229 '''
230 Generate the help for 'name' as unformatted restructured text. If
230 Generate the help for 'name' as unformatted restructured text. If
231 'name' is None, describe the commands available.
231 'name' is None, describe the commands available.
232 '''
232 '''
233
233
234 import commands # avoid cycle
234 import commands # avoid cycle
235
235
236 def helpcmd(name):
236 def helpcmd(name):
237 try:
237 try:
238 aliases, entry = cmdutil.findcmd(name, commands.table,
238 aliases, entry = cmdutil.findcmd(name, commands.table,
239 strict=unknowncmd)
239 strict=unknowncmd)
240 except error.AmbiguousCommand as inst:
240 except error.AmbiguousCommand as inst:
241 # py3k fix: except vars can't be used outside the scope of the
241 # py3k fix: except vars can't be used outside the scope of the
242 # except block, nor can be used inside a lambda. python issue4617
242 # except block, nor can be used inside a lambda. python issue4617
243 prefix = inst.args[0]
243 prefix = inst.args[0]
244 select = lambda c: c.lstrip('^').startswith(prefix)
244 select = lambda c: c.lstrip('^').startswith(prefix)
245 rst = helplist(select)
245 rst = helplist(select)
246 return rst
246 return rst
247
247
248 rst = []
248 rst = []
249
249
250 # check if it's an invalid alias and display its error if it is
250 # check if it's an invalid alias and display its error if it is
251 if getattr(entry[0], 'badalias', None):
251 if getattr(entry[0], 'badalias', None):
252 rst.append(entry[0].badalias + '\n')
252 rst.append(entry[0].badalias + '\n')
253 if entry[0].unknowncmd:
253 if entry[0].unknowncmd:
254 try:
254 try:
255 rst.extend(helpextcmd(entry[0].cmdname))
255 rst.extend(helpextcmd(entry[0].cmdname))
256 except error.UnknownCommand:
256 except error.UnknownCommand:
257 pass
257 pass
258 return rst
258 return rst
259
259
260 # synopsis
260 # synopsis
261 if len(entry) > 2:
261 if len(entry) > 2:
262 if entry[2].startswith('hg'):
262 if entry[2].startswith('hg'):
263 rst.append("%s\n" % entry[2])
263 rst.append("%s\n" % entry[2])
264 else:
264 else:
265 rst.append('hg %s %s\n' % (aliases[0], entry[2]))
265 rst.append('hg %s %s\n' % (aliases[0], entry[2]))
266 else:
266 else:
267 rst.append('hg %s\n' % aliases[0])
267 rst.append('hg %s\n' % aliases[0])
268 # aliases
268 # aliases
269 if full and not ui.quiet and len(aliases) > 1:
269 if full and not ui.quiet and len(aliases) > 1:
270 rst.append(_("\naliases: %s\n") % ', '.join(aliases[1:]))
270 rst.append(_("\naliases: %s\n") % ', '.join(aliases[1:]))
271 rst.append('\n')
271 rst.append('\n')
272
272
273 # description
273 # description
274 doc = gettext(entry[0].__doc__)
274 doc = gettext(entry[0].__doc__)
275 if not doc:
275 if not doc:
276 doc = _("(no help text available)")
276 doc = _("(no help text available)")
277 if util.safehasattr(entry[0], 'definition'): # aliased command
277 if util.safehasattr(entry[0], 'definition'): # aliased command
278 if entry[0].definition.startswith('!'): # shell alias
278 if entry[0].definition.startswith('!'): # shell alias
279 doc = _('shell alias for::\n\n %s') % entry[0].definition[1:]
279 doc = _('shell alias for::\n\n %s') % entry[0].definition[1:]
280 else:
280 else:
281 doc = _('alias for: hg %s\n\n%s') % (entry[0].definition, doc)
281 doc = _('alias for: hg %s\n\n%s') % (entry[0].definition, doc)
282 doc = doc.splitlines(True)
282 doc = doc.splitlines(True)
283 if ui.quiet or not full:
283 if ui.quiet or not full:
284 rst.append(doc[0])
284 rst.append(doc[0])
285 else:
285 else:
286 rst.extend(doc)
286 rst.extend(doc)
287 rst.append('\n')
287 rst.append('\n')
288
288
289 # check if this command shadows a non-trivial (multi-line)
289 # check if this command shadows a non-trivial (multi-line)
290 # extension help text
290 # extension help text
291 try:
291 try:
292 mod = extensions.find(name)
292 mod = extensions.find(name)
293 doc = gettext(mod.__doc__) or ''
293 doc = gettext(mod.__doc__) or ''
294 if '\n' in doc.strip():
294 if '\n' in doc.strip():
295 msg = _('(use "hg help -e %s" to show help for '
295 msg = _('(use "hg help -e %s" to show help for '
296 'the %s extension)') % (name, name)
296 'the %s extension)') % (name, name)
297 rst.append('\n%s\n' % msg)
297 rst.append('\n%s\n' % msg)
298 except KeyError:
298 except KeyError:
299 pass
299 pass
300
300
301 # options
301 # options
302 if not ui.quiet and entry[1]:
302 if not ui.quiet and entry[1]:
303 rst.append(optrst(_("options"), entry[1], ui.verbose))
303 rst.append(optrst(_("options"), entry[1], ui.verbose))
304
304
305 if ui.verbose:
305 if ui.verbose:
306 rst.append(optrst(_("global options"),
306 rst.append(optrst(_("global options"),
307 commands.globalopts, ui.verbose))
307 commands.globalopts, ui.verbose))
308
308
309 if not ui.verbose:
309 if not ui.verbose:
310 if not full:
310 if not full:
311 rst.append(_('\n(use "hg %s -h" to show more help)\n')
311 rst.append(_('\n(use "hg %s -h" to show more help)\n')
312 % name)
312 % name)
313 elif not ui.quiet:
313 elif not ui.quiet:
314 rst.append(_('\n(some details hidden, use --verbose '
314 rst.append(_('\n(some details hidden, use --verbose '
315 'to show complete help)'))
315 'to show complete help)'))
316
316
317 return rst
317 return rst
318
318
319
319
320 def helplist(select=None):
320 def helplist(select=None):
321 # list of commands
321 # list of commands
322 if name == "shortlist":
322 if name == "shortlist":
323 header = _('basic commands:\n\n')
323 header = _('basic commands:\n\n')
324 elif name == "debug":
324 elif name == "debug":
325 header = _('debug commands (internal and unsupported):\n\n')
325 header = _('debug commands (internal and unsupported):\n\n')
326 else:
326 else:
327 header = _('list of commands:\n\n')
327 header = _('list of commands:\n\n')
328
328
329 h = {}
329 h = {}
330 cmds = {}
330 cmds = {}
331 for c, e in commands.table.iteritems():
331 for c, e in commands.table.iteritems():
332 f = c.split("|", 1)[0]
332 f = c.split("|", 1)[0]
333 if select and not select(f):
333 if select and not select(f):
334 continue
334 continue
335 if (not select and name != 'shortlist' and
335 if (not select and name != 'shortlist' and
336 e[0].__module__ != commands.__name__):
336 e[0].__module__ != commands.__name__):
337 continue
337 continue
338 if name == "shortlist" and not f.startswith("^"):
338 if name == "shortlist" and not f.startswith("^"):
339 continue
339 continue
340 f = f.lstrip("^")
340 f = f.lstrip("^")
341 if not ui.debugflag and f.startswith("debug") and name != "debug":
341 if not ui.debugflag and f.startswith("debug") and name != "debug":
342 continue
342 continue
343 doc = e[0].__doc__
343 doc = e[0].__doc__
344 if not ui.verbose and doc and any(w in doc for w in _exclkeywords):
344 if not ui.verbose and doc and any(w in doc for w in _exclkeywords):
345 continue
345 continue
346 doc = gettext(doc)
346 doc = gettext(doc)
347 if not doc:
347 if not doc:
348 doc = _("(no help text available)")
348 doc = _("(no help text available)")
349 h[f] = doc.splitlines()[0].rstrip()
349 h[f] = doc.splitlines()[0].rstrip()
350 cmds[f] = c.lstrip("^")
350 cmds[f] = c.lstrip("^")
351
351
352 rst = []
352 rst = []
353 if not h:
353 if not h:
354 if not ui.quiet:
354 if not ui.quiet:
355 rst.append(_('no commands defined\n'))
355 rst.append(_('no commands defined\n'))
356 return rst
356 return rst
357
357
358 if not ui.quiet:
358 if not ui.quiet:
359 rst.append(header)
359 rst.append(header)
360 fns = sorted(h)
360 fns = sorted(h)
361 for f in fns:
361 for f in fns:
362 if ui.verbose:
362 if ui.verbose:
363 commacmds = cmds[f].replace("|",", ")
363 commacmds = cmds[f].replace("|",", ")
364 rst.append(" :%s: %s\n" % (commacmds, h[f]))
364 rst.append(" :%s: %s\n" % (commacmds, h[f]))
365 else:
365 else:
366 rst.append(' :%s: %s\n' % (f, h[f]))
366 rst.append(' :%s: %s\n' % (f, h[f]))
367
367
368 if not name:
368 if not name:
369 exts = listexts(_('enabled extensions:'), extensions.enabled())
369 exts = listexts(_('enabled extensions:'), extensions.enabled())
370 if exts:
370 if exts:
371 rst.append('\n')
371 rst.append('\n')
372 rst.extend(exts)
372 rst.extend(exts)
373
373
374 rst.append(_("\nadditional help topics:\n\n"))
374 rst.append(_("\nadditional help topics:\n\n"))
375 topics = []
375 topics = []
376 for names, header, doc in helptable:
376 for names, header, doc in helptable:
377 topics.append((names[0], header))
377 topics.append((names[0], header))
378 for t, desc in topics:
378 for t, desc in topics:
379 rst.append(" :%s: %s\n" % (t, desc))
379 rst.append(" :%s: %s\n" % (t, desc))
380
380
381 if ui.quiet:
381 if ui.quiet:
382 pass
382 pass
383 elif ui.verbose:
383 elif ui.verbose:
384 rst.append('\n%s\n' % optrst(_("global options"),
384 rst.append('\n%s\n' % optrst(_("global options"),
385 commands.globalopts, ui.verbose))
385 commands.globalopts, ui.verbose))
386 if name == 'shortlist':
386 if name == 'shortlist':
387 rst.append(_('\n(use "hg help" for the full list '
387 rst.append(_('\n(use "hg help" for the full list '
388 'of commands)\n'))
388 'of commands)\n'))
389 else:
389 else:
390 if name == 'shortlist':
390 if name == 'shortlist':
391 rst.append(_('\n(use "hg help" for the full list of commands '
391 rst.append(_('\n(use "hg help" for the full list of commands '
392 'or "hg -v" for details)\n'))
392 'or "hg -v" for details)\n'))
393 elif name and not full:
393 elif name and not full:
394 rst.append(_('\n(use "hg help %s" to show the full help '
394 rst.append(_('\n(use "hg help %s" to show the full help '
395 'text)\n') % name)
395 'text)\n') % name)
396 elif name and cmds and name in cmds.keys():
396 elif name and cmds and name in cmds.keys():
397 rst.append(_('\n(use "hg help -v -e %s" to show built-in '
397 rst.append(_('\n(use "hg help -v -e %s" to show built-in '
398 'aliases and global options)\n') % name)
398 'aliases and global options)\n') % name)
399 else:
399 else:
400 rst.append(_('\n(use "hg help -v%s" to show built-in aliases '
400 rst.append(_('\n(use "hg help -v%s" to show built-in aliases '
401 'and global options)\n')
401 'and global options)\n')
402 % (name and " " + name or ""))
402 % (name and " " + name or ""))
403 return rst
403 return rst
404
404
405 def helptopic(name):
405 def helptopic(name):
406 for names, header, doc in helptable:
406 for names, header, doc in helptable:
407 if name in names:
407 if name in names:
408 break
408 break
409 else:
409 else:
410 raise error.UnknownCommand(name)
410 raise error.UnknownCommand(name)
411
411
412 rst = [minirst.section(header)]
412 rst = [minirst.section(header)]
413
413
414 # description
414 # description
415 if not doc:
415 if not doc:
416 rst.append(" %s\n" % _("(no help text available)"))
416 rst.append(" %s\n" % _("(no help text available)"))
417 if callable(doc):
417 if callable(doc):
418 rst += [" %s\n" % l for l in doc().splitlines()]
418 rst += [" %s\n" % l for l in doc(ui).splitlines()]
419
419
420 if not ui.verbose:
420 if not ui.verbose:
421 omitted = _('(some details hidden, use --verbose'
421 omitted = _('(some details hidden, use --verbose'
422 ' to show complete help)')
422 ' to show complete help)')
423 indicateomitted(rst, omitted)
423 indicateomitted(rst, omitted)
424
424
425 try:
425 try:
426 cmdutil.findcmd(name, commands.table)
426 cmdutil.findcmd(name, commands.table)
427 rst.append(_('\nuse "hg help -c %s" to see help for '
427 rst.append(_('\nuse "hg help -c %s" to see help for '
428 'the %s command\n') % (name, name))
428 'the %s command\n') % (name, name))
429 except error.UnknownCommand:
429 except error.UnknownCommand:
430 pass
430 pass
431 return rst
431 return rst
432
432
433 def helpext(name):
433 def helpext(name):
434 try:
434 try:
435 mod = extensions.find(name)
435 mod = extensions.find(name)
436 doc = gettext(mod.__doc__) or _('no help text available')
436 doc = gettext(mod.__doc__) or _('no help text available')
437 except KeyError:
437 except KeyError:
438 mod = None
438 mod = None
439 doc = extensions.disabledext(name)
439 doc = extensions.disabledext(name)
440 if not doc:
440 if not doc:
441 raise error.UnknownCommand(name)
441 raise error.UnknownCommand(name)
442
442
443 if '\n' not in doc:
443 if '\n' not in doc:
444 head, tail = doc, ""
444 head, tail = doc, ""
445 else:
445 else:
446 head, tail = doc.split('\n', 1)
446 head, tail = doc.split('\n', 1)
447 rst = [_('%s extension - %s\n\n') % (name.split('.')[-1], head)]
447 rst = [_('%s extension - %s\n\n') % (name.split('.')[-1], head)]
448 if tail:
448 if tail:
449 rst.extend(tail.splitlines(True))
449 rst.extend(tail.splitlines(True))
450 rst.append('\n')
450 rst.append('\n')
451
451
452 if not ui.verbose:
452 if not ui.verbose:
453 omitted = _('(some details hidden, use --verbose'
453 omitted = _('(some details hidden, use --verbose'
454 ' to show complete help)')
454 ' to show complete help)')
455 indicateomitted(rst, omitted)
455 indicateomitted(rst, omitted)
456
456
457 if mod:
457 if mod:
458 try:
458 try:
459 ct = mod.cmdtable
459 ct = mod.cmdtable
460 except AttributeError:
460 except AttributeError:
461 ct = {}
461 ct = {}
462 modcmds = set([c.split('|', 1)[0] for c in ct])
462 modcmds = set([c.split('|', 1)[0] for c in ct])
463 rst.extend(helplist(modcmds.__contains__))
463 rst.extend(helplist(modcmds.__contains__))
464 else:
464 else:
465 rst.append(_('(use "hg help extensions" for information on enabling'
465 rst.append(_('(use "hg help extensions" for information on enabling'
466 ' extensions)\n'))
466 ' extensions)\n'))
467 return rst
467 return rst
468
468
469 def helpextcmd(name):
469 def helpextcmd(name):
470 cmd, ext, mod = extensions.disabledcmd(ui, name,
470 cmd, ext, mod = extensions.disabledcmd(ui, name,
471 ui.configbool('ui', 'strict'))
471 ui.configbool('ui', 'strict'))
472 doc = gettext(mod.__doc__).splitlines()[0]
472 doc = gettext(mod.__doc__).splitlines()[0]
473
473
474 rst = listexts(_("'%s' is provided by the following "
474 rst = listexts(_("'%s' is provided by the following "
475 "extension:") % cmd, {ext: doc}, indent=4)
475 "extension:") % cmd, {ext: doc}, indent=4)
476 rst.append('\n')
476 rst.append('\n')
477 rst.append(_('(use "hg help extensions" for information on enabling '
477 rst.append(_('(use "hg help extensions" for information on enabling '
478 'extensions)\n'))
478 'extensions)\n'))
479 return rst
479 return rst
480
480
481
481
482 rst = []
482 rst = []
483 kw = opts.get('keyword')
483 kw = opts.get('keyword')
484 if kw:
484 if kw:
485 matches = topicmatch(name)
485 matches = topicmatch(ui, name)
486 helpareas = []
486 helpareas = []
487 if opts.get('extension'):
487 if opts.get('extension'):
488 helpareas += [('extensions', _('Extensions'))]
488 helpareas += [('extensions', _('Extensions'))]
489 if opts.get('command'):
489 if opts.get('command'):
490 helpareas += [('commands', _('Commands'))]
490 helpareas += [('commands', _('Commands'))]
491 if not helpareas:
491 if not helpareas:
492 helpareas = [('topics', _('Topics')),
492 helpareas = [('topics', _('Topics')),
493 ('commands', _('Commands')),
493 ('commands', _('Commands')),
494 ('extensions', _('Extensions')),
494 ('extensions', _('Extensions')),
495 ('extensioncommands', _('Extension Commands'))]
495 ('extensioncommands', _('Extension Commands'))]
496 for t, title in helpareas:
496 for t, title in helpareas:
497 if matches[t]:
497 if matches[t]:
498 rst.append('%s:\n\n' % title)
498 rst.append('%s:\n\n' % title)
499 rst.extend(minirst.maketable(sorted(matches[t]), 1))
499 rst.extend(minirst.maketable(sorted(matches[t]), 1))
500 rst.append('\n')
500 rst.append('\n')
501 if not rst:
501 if not rst:
502 msg = _('no matches')
502 msg = _('no matches')
503 hint = _('try "hg help" for a list of topics')
503 hint = _('try "hg help" for a list of topics')
504 raise util.Abort(msg, hint=hint)
504 raise util.Abort(msg, hint=hint)
505 elif name and name != 'shortlist':
505 elif name and name != 'shortlist':
506 queries = []
506 queries = []
507 if unknowncmd:
507 if unknowncmd:
508 queries += [helpextcmd]
508 queries += [helpextcmd]
509 if opts.get('extension'):
509 if opts.get('extension'):
510 queries += [helpext]
510 queries += [helpext]
511 if opts.get('command'):
511 if opts.get('command'):
512 queries += [helpcmd]
512 queries += [helpcmd]
513 if not queries:
513 if not queries:
514 queries = (helptopic, helpcmd, helpext, helpextcmd)
514 queries = (helptopic, helpcmd, helpext, helpextcmd)
515 for f in queries:
515 for f in queries:
516 try:
516 try:
517 rst = f(name)
517 rst = f(name)
518 break
518 break
519 except error.UnknownCommand:
519 except error.UnknownCommand:
520 pass
520 pass
521 else:
521 else:
522 if unknowncmd:
522 if unknowncmd:
523 raise error.UnknownCommand(name)
523 raise error.UnknownCommand(name)
524 else:
524 else:
525 msg = _('no such help topic: %s') % name
525 msg = _('no such help topic: %s') % name
526 hint = _('try "hg help --keyword %s"') % name
526 hint = _('try "hg help --keyword %s"') % name
527 raise util.Abort(msg, hint=hint)
527 raise util.Abort(msg, hint=hint)
528 else:
528 else:
529 # program name
529 # program name
530 if not ui.quiet:
530 if not ui.quiet:
531 rst = [_("Mercurial Distributed SCM\n"), '\n']
531 rst = [_("Mercurial Distributed SCM\n"), '\n']
532 rst.extend(helplist())
532 rst.extend(helplist())
533
533
534 return ''.join(rst)
534 return ''.join(rst)
@@ -1,2364 +1,2364 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 merge-tools Merge Tools
114 merge-tools Merge Tools
115 multirevs Specifying Multiple Revisions
115 multirevs Specifying Multiple Revisions
116 patterns File Name Patterns
116 patterns File Name Patterns
117 phases Working with Phases
117 phases Working with Phases
118 revisions Specifying Single Revisions
118 revisions Specifying Single Revisions
119 revsets Specifying Revision Sets
119 revsets Specifying Revision Sets
120 scripting Using Mercurial from scripts and automation
120 scripting Using Mercurial from scripts and automation
121 subrepos Subrepositories
121 subrepos Subrepositories
122 templating Template Usage
122 templating Template Usage
123 urls URL Paths
123 urls URL Paths
124
124
125 (use "hg help -v" to show built-in aliases and global options)
125 (use "hg help -v" to show built-in aliases and global options)
126
126
127 $ hg -q help
127 $ hg -q help
128 add add the specified files on the next commit
128 add add the specified files on the next commit
129 addremove add all new files, delete all missing files
129 addremove add all new files, delete all missing files
130 annotate show changeset information by line for each file
130 annotate show changeset information by line for each file
131 archive create an unversioned archive of a repository revision
131 archive create an unversioned archive of a repository revision
132 backout reverse effect of earlier changeset
132 backout reverse effect of earlier changeset
133 bisect subdivision search of changesets
133 bisect subdivision search of changesets
134 bookmarks create a new bookmark or list existing bookmarks
134 bookmarks create a new bookmark or list existing bookmarks
135 branch set or show the current branch name
135 branch set or show the current branch name
136 branches list repository named branches
136 branches list repository named branches
137 bundle create a changegroup file
137 bundle create a changegroup file
138 cat output the current or given revision of files
138 cat output the current or given revision of files
139 clone make a copy of an existing repository
139 clone make a copy of an existing repository
140 commit commit the specified files or all outstanding changes
140 commit commit the specified files or all outstanding changes
141 config show combined config settings from all hgrc files
141 config show combined config settings from all hgrc files
142 copy mark files as copied for the next commit
142 copy mark files as copied for the next commit
143 diff diff repository (or selected files)
143 diff diff repository (or selected files)
144 export dump the header and diffs for one or more changesets
144 export dump the header and diffs for one or more changesets
145 files list tracked files
145 files list tracked files
146 forget forget the specified files on the next commit
146 forget forget the specified files on the next commit
147 graft copy changes from other branches onto the current branch
147 graft copy changes from other branches onto the current branch
148 grep search for a pattern in specified files and revisions
148 grep search for a pattern in specified files and revisions
149 heads show branch heads
149 heads show branch heads
150 help show help for a given topic or a help overview
150 help show help for a given topic or a help overview
151 identify identify the working directory or specified revision
151 identify identify the working directory or specified revision
152 import import an ordered set of patches
152 import import an ordered set of patches
153 incoming show new changesets found in source
153 incoming show new changesets found in source
154 init create a new repository in the given directory
154 init create a new repository in the given directory
155 log show revision history of entire repository or files
155 log show revision history of entire repository or files
156 manifest output the current or given revision of the project manifest
156 manifest output the current or given revision of the project manifest
157 merge merge another revision into working directory
157 merge merge another revision into working directory
158 outgoing show changesets not found in the destination
158 outgoing show changesets not found in the destination
159 paths show aliases for remote repositories
159 paths show aliases for remote repositories
160 phase set or show the current phase name
160 phase set or show the current phase name
161 pull pull changes from the specified source
161 pull pull changes from the specified source
162 push push changes to the specified destination
162 push push changes to the specified destination
163 recover roll back an interrupted transaction
163 recover roll back an interrupted transaction
164 remove remove the specified files on the next commit
164 remove remove the specified files on the next commit
165 rename rename files; equivalent of copy + remove
165 rename rename files; equivalent of copy + remove
166 resolve redo merges or set/view the merge status of files
166 resolve redo merges or set/view the merge status of files
167 revert restore files to their checkout state
167 revert restore files to their checkout state
168 root print the root (top) of the current working directory
168 root print the root (top) of the current working directory
169 serve start stand-alone webserver
169 serve start stand-alone webserver
170 status show changed files in the working directory
170 status show changed files in the working directory
171 summary summarize working directory state
171 summary summarize working directory state
172 tag add one or more tags for the current or given revision
172 tag add one or more tags for the current or given revision
173 tags list repository tags
173 tags list repository tags
174 unbundle apply one or more changegroup files
174 unbundle apply one or more changegroup files
175 update update working directory (or switch revisions)
175 update update working directory (or switch revisions)
176 verify verify the integrity of the repository
176 verify verify the integrity of the repository
177 version output version and copyright information
177 version output version and copyright information
178
178
179 additional help topics:
179 additional help topics:
180
180
181 config Configuration Files
181 config Configuration Files
182 dates Date Formats
182 dates Date Formats
183 diffs Diff Formats
183 diffs Diff Formats
184 environment Environment Variables
184 environment Environment Variables
185 extensions Using Additional Features
185 extensions Using Additional Features
186 filesets Specifying File Sets
186 filesets Specifying File Sets
187 glossary Glossary
187 glossary Glossary
188 hgignore Syntax for Mercurial Ignore Files
188 hgignore Syntax for Mercurial Ignore Files
189 hgweb Configuring hgweb
189 hgweb Configuring hgweb
190 merge-tools Merge Tools
190 merge-tools Merge Tools
191 multirevs Specifying Multiple Revisions
191 multirevs Specifying Multiple Revisions
192 patterns File Name Patterns
192 patterns File Name Patterns
193 phases Working with Phases
193 phases Working with Phases
194 revisions Specifying Single Revisions
194 revisions Specifying Single Revisions
195 revsets Specifying Revision Sets
195 revsets Specifying Revision Sets
196 scripting Using Mercurial from scripts and automation
196 scripting Using Mercurial from scripts and automation
197 subrepos Subrepositories
197 subrepos Subrepositories
198 templating Template Usage
198 templating Template Usage
199 urls URL Paths
199 urls URL Paths
200
200
201 Test extension help:
201 Test extension help:
202 $ hg help extensions --config extensions.rebase= --config extensions.children=
202 $ hg help extensions --config extensions.rebase= --config extensions.children=
203 Using Additional Features
203 Using Additional Features
204 """""""""""""""""""""""""
204 """""""""""""""""""""""""
205
205
206 Mercurial has the ability to add new features through the use of
206 Mercurial has the ability to add new features through the use of
207 extensions. Extensions may add new commands, add options to existing
207 extensions. Extensions may add new commands, add options to existing
208 commands, change the default behavior of commands, or implement hooks.
208 commands, change the default behavior of commands, or implement hooks.
209
209
210 To enable the "foo" extension, either shipped with Mercurial or in the
210 To enable the "foo" extension, either shipped with Mercurial or in the
211 Python search path, create an entry for it in your configuration file,
211 Python search path, create an entry for it in your configuration file,
212 like this:
212 like this:
213
213
214 [extensions]
214 [extensions]
215 foo =
215 foo =
216
216
217 You may also specify the full path to an extension:
217 You may also specify the full path to an extension:
218
218
219 [extensions]
219 [extensions]
220 myfeature = ~/.hgext/myfeature.py
220 myfeature = ~/.hgext/myfeature.py
221
221
222 See "hg help config" for more information on configuration files.
222 See "hg help config" for more information on configuration files.
223
223
224 Extensions are not loaded by default for a variety of reasons: they can
224 Extensions are not loaded by default for a variety of reasons: they can
225 increase startup overhead; they may be meant for advanced usage only; they
225 increase startup overhead; they may be meant for advanced usage only; they
226 may provide potentially dangerous abilities (such as letting you destroy
226 may provide potentially dangerous abilities (such as letting you destroy
227 or modify history); they might not be ready for prime time; or they may
227 or modify history); they might not be ready for prime time; or they may
228 alter some usual behaviors of stock Mercurial. It is thus up to the user
228 alter some usual behaviors of stock Mercurial. It is thus up to the user
229 to activate extensions as needed.
229 to activate extensions as needed.
230
230
231 To explicitly disable an extension enabled in a configuration file of
231 To explicitly disable an extension enabled in a configuration file of
232 broader scope, prepend its path with !:
232 broader scope, prepend its path with !:
233
233
234 [extensions]
234 [extensions]
235 # disabling extension bar residing in /path/to/extension/bar.py
235 # disabling extension bar residing in /path/to/extension/bar.py
236 bar = !/path/to/extension/bar.py
236 bar = !/path/to/extension/bar.py
237 # ditto, but no path was supplied for extension baz
237 # ditto, but no path was supplied for extension baz
238 baz = !
238 baz = !
239
239
240 enabled extensions:
240 enabled extensions:
241
241
242 children command to display child changesets (DEPRECATED)
242 children command to display child changesets (DEPRECATED)
243 rebase command to move sets of revisions to a different ancestor
243 rebase command to move sets of revisions to a different ancestor
244
244
245 disabled extensions:
245 disabled extensions:
246
246
247 acl hooks for controlling repository access
247 acl hooks for controlling repository access
248 blackbox log repository events to a blackbox for debugging
248 blackbox log repository events to a blackbox for debugging
249 bugzilla hooks for integrating with the Bugzilla bug tracker
249 bugzilla hooks for integrating with the Bugzilla bug tracker
250 censor erase file content at a given revision
250 censor erase file content at a given revision
251 churn command to display statistics about repository history
251 churn command to display statistics about repository history
252 color colorize output from some commands
252 color colorize output from some commands
253 convert import revisions from foreign VCS repositories into
253 convert import revisions from foreign VCS repositories into
254 Mercurial
254 Mercurial
255 eol automatically manage newlines in repository files
255 eol automatically manage newlines in repository files
256 extdiff command to allow external programs to compare revisions
256 extdiff command to allow external programs to compare revisions
257 factotum http authentication with factotum
257 factotum http authentication with factotum
258 gpg commands to sign and verify changesets
258 gpg commands to sign and verify changesets
259 hgcia hooks for integrating with the CIA.vc notification service
259 hgcia hooks for integrating with the CIA.vc notification service
260 hgk browse the repository in a graphical way
260 hgk browse the repository in a graphical way
261 highlight syntax highlighting for hgweb (requires Pygments)
261 highlight syntax highlighting for hgweb (requires Pygments)
262 histedit interactive history editing
262 histedit interactive history editing
263 keyword expand keywords in tracked files
263 keyword expand keywords in tracked files
264 largefiles track large binary files
264 largefiles track large binary files
265 mq manage a stack of patches
265 mq manage a stack of patches
266 notify hooks for sending email push notifications
266 notify hooks for sending email push notifications
267 pager browse command output with an external pager
267 pager browse command output with an external pager
268 patchbomb command to send changesets as (a series of) patch emails
268 patchbomb command to send changesets as (a series of) patch emails
269 purge command to delete untracked files from the working
269 purge command to delete untracked files from the working
270 directory
270 directory
271 record commands to interactively select changes for
271 record commands to interactively select changes for
272 commit/qrefresh
272 commit/qrefresh
273 relink recreates hardlinks between repository clones
273 relink recreates hardlinks between repository clones
274 schemes extend schemes with shortcuts to repository swarms
274 schemes extend schemes with shortcuts to repository swarms
275 share share a common history between several working directories
275 share share a common history between several working directories
276 shelve save and restore changes to the working directory
276 shelve save and restore changes to the working directory
277 strip strip changesets and their descendants from history
277 strip strip changesets and their descendants from history
278 transplant command to transplant changesets from another branch
278 transplant command to transplant changesets from another branch
279 win32mbcs allow the use of MBCS paths with problematic encodings
279 win32mbcs allow the use of MBCS paths with problematic encodings
280 zeroconf discover and advertise repositories on the local network
280 zeroconf discover and advertise repositories on the local network
281 Test short command list with verbose option
281 Test short command list with verbose option
282
282
283 $ hg -v help shortlist
283 $ hg -v help shortlist
284 Mercurial Distributed SCM
284 Mercurial Distributed SCM
285
285
286 basic commands:
286 basic commands:
287
287
288 add add the specified files on the next commit
288 add add the specified files on the next commit
289 annotate, blame
289 annotate, blame
290 show changeset information by line for each file
290 show changeset information by line for each file
291 clone make a copy of an existing repository
291 clone make a copy of an existing repository
292 commit, ci commit the specified files or all outstanding changes
292 commit, ci commit the specified files or all outstanding changes
293 diff diff repository (or selected files)
293 diff diff repository (or selected files)
294 export dump the header and diffs for one or more changesets
294 export dump the header and diffs for one or more changesets
295 forget forget the specified files on the next commit
295 forget forget the specified files on the next commit
296 init create a new repository in the given directory
296 init create a new repository in the given directory
297 log, history show revision history of entire repository or files
297 log, history show revision history of entire repository or files
298 merge merge another revision into working directory
298 merge merge another revision into working directory
299 pull pull changes from the specified source
299 pull pull changes from the specified source
300 push push changes to the specified destination
300 push push changes to the specified destination
301 remove, rm remove the specified files on the next commit
301 remove, rm remove the specified files on the next commit
302 serve start stand-alone webserver
302 serve start stand-alone webserver
303 status, st show changed files in the working directory
303 status, st show changed files in the working directory
304 summary, sum summarize working directory state
304 summary, sum summarize working directory state
305 update, up, checkout, co
305 update, up, checkout, co
306 update working directory (or switch revisions)
306 update working directory (or switch revisions)
307
307
308 global options ([+] can be repeated):
308 global options ([+] can be repeated):
309
309
310 -R --repository REPO repository root directory or name of overlay bundle
310 -R --repository REPO repository root directory or name of overlay bundle
311 file
311 file
312 --cwd DIR change working directory
312 --cwd DIR change working directory
313 -y --noninteractive do not prompt, automatically pick the first choice for
313 -y --noninteractive do not prompt, automatically pick the first choice for
314 all prompts
314 all prompts
315 -q --quiet suppress output
315 -q --quiet suppress output
316 -v --verbose enable additional output
316 -v --verbose enable additional output
317 --config CONFIG [+] set/override config option (use 'section.name=value')
317 --config CONFIG [+] set/override config option (use 'section.name=value')
318 --debug enable debugging output
318 --debug enable debugging output
319 --debugger start debugger
319 --debugger start debugger
320 --encoding ENCODE set the charset encoding (default: ascii)
320 --encoding ENCODE set the charset encoding (default: ascii)
321 --encodingmode MODE set the charset encoding mode (default: strict)
321 --encodingmode MODE set the charset encoding mode (default: strict)
322 --traceback always print a traceback on exception
322 --traceback always print a traceback on exception
323 --time time how long the command takes
323 --time time how long the command takes
324 --profile print command execution profile
324 --profile print command execution profile
325 --version output version information and exit
325 --version output version information and exit
326 -h --help display help and exit
326 -h --help display help and exit
327 --hidden consider hidden changesets
327 --hidden consider hidden changesets
328
328
329 (use "hg help" for the full list of commands)
329 (use "hg help" for the full list of commands)
330
330
331 $ hg add -h
331 $ hg add -h
332 hg add [OPTION]... [FILE]...
332 hg add [OPTION]... [FILE]...
333
333
334 add the specified files on the next commit
334 add the specified files on the next commit
335
335
336 Schedule files to be version controlled and added to the repository.
336 Schedule files to be version controlled and added to the repository.
337
337
338 The files will be added to the repository at the next commit. To undo an
338 The files will be added to the repository at the next commit. To undo an
339 add before that, see "hg forget".
339 add before that, see "hg forget".
340
340
341 If no names are given, add all files to the repository.
341 If no names are given, add all files to the repository.
342
342
343 Returns 0 if all files are successfully added.
343 Returns 0 if all files are successfully added.
344
344
345 options ([+] can be repeated):
345 options ([+] can be repeated):
346
346
347 -I --include PATTERN [+] include names matching the given patterns
347 -I --include PATTERN [+] include names matching the given patterns
348 -X --exclude PATTERN [+] exclude names matching the given patterns
348 -X --exclude PATTERN [+] exclude names matching the given patterns
349 -S --subrepos recurse into subrepositories
349 -S --subrepos recurse into subrepositories
350 -n --dry-run do not perform actions, just print output
350 -n --dry-run do not perform actions, just print output
351
351
352 (some details hidden, use --verbose to show complete help)
352 (some details hidden, use --verbose to show complete help)
353
353
354 Verbose help for add
354 Verbose help for add
355
355
356 $ hg add -hv
356 $ hg add -hv
357 hg add [OPTION]... [FILE]...
357 hg add [OPTION]... [FILE]...
358
358
359 add the specified files on the next commit
359 add the specified files on the next commit
360
360
361 Schedule files to be version controlled and added to the repository.
361 Schedule files to be version controlled and added to the repository.
362
362
363 The files will be added to the repository at the next commit. To undo an
363 The files will be added to the repository at the next commit. To undo an
364 add before that, see "hg forget".
364 add before that, see "hg forget".
365
365
366 If no names are given, add all files to the repository.
366 If no names are given, add all files to the repository.
367
367
368 An example showing how new (unknown) files are added automatically by "hg
368 An example showing how new (unknown) files are added automatically by "hg
369 add":
369 add":
370
370
371 $ ls
371 $ ls
372 foo.c
372 foo.c
373 $ hg status
373 $ hg status
374 ? foo.c
374 ? foo.c
375 $ hg add
375 $ hg add
376 adding foo.c
376 adding foo.c
377 $ hg status
377 $ hg status
378 A foo.c
378 A foo.c
379
379
380 Returns 0 if all files are successfully added.
380 Returns 0 if all files are successfully added.
381
381
382 options ([+] can be repeated):
382 options ([+] can be repeated):
383
383
384 -I --include PATTERN [+] include names matching the given patterns
384 -I --include PATTERN [+] include names matching the given patterns
385 -X --exclude PATTERN [+] exclude names matching the given patterns
385 -X --exclude PATTERN [+] exclude names matching the given patterns
386 -S --subrepos recurse into subrepositories
386 -S --subrepos recurse into subrepositories
387 -n --dry-run do not perform actions, just print output
387 -n --dry-run do not perform actions, just print output
388
388
389 global options ([+] can be repeated):
389 global options ([+] can be repeated):
390
390
391 -R --repository REPO repository root directory or name of overlay bundle
391 -R --repository REPO repository root directory or name of overlay bundle
392 file
392 file
393 --cwd DIR change working directory
393 --cwd DIR change working directory
394 -y --noninteractive do not prompt, automatically pick the first choice for
394 -y --noninteractive do not prompt, automatically pick the first choice for
395 all prompts
395 all prompts
396 -q --quiet suppress output
396 -q --quiet suppress output
397 -v --verbose enable additional output
397 -v --verbose enable additional output
398 --config CONFIG [+] set/override config option (use 'section.name=value')
398 --config CONFIG [+] set/override config option (use 'section.name=value')
399 --debug enable debugging output
399 --debug enable debugging output
400 --debugger start debugger
400 --debugger start debugger
401 --encoding ENCODE set the charset encoding (default: ascii)
401 --encoding ENCODE set the charset encoding (default: ascii)
402 --encodingmode MODE set the charset encoding mode (default: strict)
402 --encodingmode MODE set the charset encoding mode (default: strict)
403 --traceback always print a traceback on exception
403 --traceback always print a traceback on exception
404 --time time how long the command takes
404 --time time how long the command takes
405 --profile print command execution profile
405 --profile print command execution profile
406 --version output version information and exit
406 --version output version information and exit
407 -h --help display help and exit
407 -h --help display help and exit
408 --hidden consider hidden changesets
408 --hidden consider hidden changesets
409
409
410 Test help option with version option
410 Test help option with version option
411
411
412 $ hg add -h --version
412 $ hg add -h --version
413 Mercurial Distributed SCM (version *) (glob)
413 Mercurial Distributed SCM (version *) (glob)
414 (see http://mercurial.selenic.com for more information)
414 (see http://mercurial.selenic.com for more information)
415
415
416 Copyright (C) 2005-2015 Matt Mackall and others
416 Copyright (C) 2005-2015 Matt Mackall and others
417 This is free software; see the source for copying conditions. There is NO
417 This is free software; see the source for copying conditions. There is NO
418 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
418 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
419
419
420 $ hg add --skjdfks
420 $ hg add --skjdfks
421 hg add: option --skjdfks not recognized
421 hg add: option --skjdfks not recognized
422 hg add [OPTION]... [FILE]...
422 hg add [OPTION]... [FILE]...
423
423
424 add the specified files on the next commit
424 add the specified files on the next commit
425
425
426 options ([+] can be repeated):
426 options ([+] can be repeated):
427
427
428 -I --include PATTERN [+] include names matching the given patterns
428 -I --include PATTERN [+] include names matching the given patterns
429 -X --exclude PATTERN [+] exclude names matching the given patterns
429 -X --exclude PATTERN [+] exclude names matching the given patterns
430 -S --subrepos recurse into subrepositories
430 -S --subrepos recurse into subrepositories
431 -n --dry-run do not perform actions, just print output
431 -n --dry-run do not perform actions, just print output
432
432
433 (use "hg add -h" to show more help)
433 (use "hg add -h" to show more help)
434 [255]
434 [255]
435
435
436 Test ambiguous command help
436 Test ambiguous command help
437
437
438 $ hg help ad
438 $ hg help ad
439 list of commands:
439 list of commands:
440
440
441 add add the specified files on the next commit
441 add add the specified files on the next commit
442 addremove add all new files, delete all missing files
442 addremove add all new files, delete all missing files
443
443
444 (use "hg help -v ad" to show built-in aliases and global options)
444 (use "hg help -v ad" to show built-in aliases and global options)
445
445
446 Test command without options
446 Test command without options
447
447
448 $ hg help verify
448 $ hg help verify
449 hg verify
449 hg verify
450
450
451 verify the integrity of the repository
451 verify the integrity of the repository
452
452
453 Verify the integrity of the current repository.
453 Verify the integrity of the current repository.
454
454
455 This will perform an extensive check of the repository's integrity,
455 This will perform an extensive check of the repository's integrity,
456 validating the hashes and checksums of each entry in the changelog,
456 validating the hashes and checksums of each entry in the changelog,
457 manifest, and tracked files, as well as the integrity of their crosslinks
457 manifest, and tracked files, as well as the integrity of their crosslinks
458 and indices.
458 and indices.
459
459
460 Please see http://mercurial.selenic.com/wiki/RepositoryCorruption for more
460 Please see http://mercurial.selenic.com/wiki/RepositoryCorruption for more
461 information about recovery from corruption of the repository.
461 information about recovery from corruption of the repository.
462
462
463 Returns 0 on success, 1 if errors are encountered.
463 Returns 0 on success, 1 if errors are encountered.
464
464
465 (some details hidden, use --verbose to show complete help)
465 (some details hidden, use --verbose to show complete help)
466
466
467 $ hg help diff
467 $ hg help diff
468 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
468 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
469
469
470 diff repository (or selected files)
470 diff repository (or selected files)
471
471
472 Show differences between revisions for the specified files.
472 Show differences between revisions for the specified files.
473
473
474 Differences between files are shown using the unified diff format.
474 Differences between files are shown using the unified diff format.
475
475
476 Note:
476 Note:
477 diff may generate unexpected results for merges, as it will default to
477 diff may generate unexpected results for merges, as it will default to
478 comparing against the working directory's first parent changeset if no
478 comparing against the working directory's first parent changeset if no
479 revisions are specified.
479 revisions are specified.
480
480
481 When two revision arguments are given, then changes are shown between
481 When two revision arguments are given, then changes are shown between
482 those revisions. If only one revision is specified then that revision is
482 those revisions. If only one revision is specified then that revision is
483 compared to the working directory, and, when no revisions are specified,
483 compared to the working directory, and, when no revisions are specified,
484 the working directory files are compared to its parent.
484 the working directory files are compared to its parent.
485
485
486 Alternatively you can specify -c/--change with a revision to see the
486 Alternatively you can specify -c/--change with a revision to see the
487 changes in that changeset relative to its first parent.
487 changes in that changeset relative to its first parent.
488
488
489 Without the -a/--text option, diff will avoid generating diffs of files it
489 Without the -a/--text option, diff will avoid generating diffs of files it
490 detects as binary. With -a, diff will generate a diff anyway, probably
490 detects as binary. With -a, diff will generate a diff anyway, probably
491 with undesirable results.
491 with undesirable results.
492
492
493 Use the -g/--git option to generate diffs in the git extended diff format.
493 Use the -g/--git option to generate diffs in the git extended diff format.
494 For more information, read "hg help diffs".
494 For more information, read "hg help diffs".
495
495
496 Returns 0 on success.
496 Returns 0 on success.
497
497
498 options ([+] can be repeated):
498 options ([+] can be repeated):
499
499
500 -r --rev REV [+] revision
500 -r --rev REV [+] revision
501 -c --change REV change made by revision
501 -c --change REV change made by revision
502 -a --text treat all files as text
502 -a --text treat all files as text
503 -g --git use git extended diff format
503 -g --git use git extended diff format
504 --nodates omit dates from diff headers
504 --nodates omit dates from diff headers
505 --noprefix omit a/ and b/ prefixes from filenames
505 --noprefix omit a/ and b/ prefixes from filenames
506 -p --show-function show which function each change is in
506 -p --show-function show which function each change is in
507 --reverse produce a diff that undoes the changes
507 --reverse produce a diff that undoes the changes
508 -w --ignore-all-space ignore white space when comparing lines
508 -w --ignore-all-space ignore white space when comparing lines
509 -b --ignore-space-change ignore changes in the amount of white space
509 -b --ignore-space-change ignore changes in the amount of white space
510 -B --ignore-blank-lines ignore changes whose lines are all blank
510 -B --ignore-blank-lines ignore changes whose lines are all blank
511 -U --unified NUM number of lines of context to show
511 -U --unified NUM number of lines of context to show
512 --stat output diffstat-style summary of changes
512 --stat output diffstat-style summary of changes
513 --root DIR produce diffs relative to subdirectory
513 --root DIR produce diffs relative to subdirectory
514 -I --include PATTERN [+] include names matching the given patterns
514 -I --include PATTERN [+] include names matching the given patterns
515 -X --exclude PATTERN [+] exclude names matching the given patterns
515 -X --exclude PATTERN [+] exclude names matching the given patterns
516 -S --subrepos recurse into subrepositories
516 -S --subrepos recurse into subrepositories
517
517
518 (some details hidden, use --verbose to show complete help)
518 (some details hidden, use --verbose to show complete help)
519
519
520 $ hg help status
520 $ hg help status
521 hg status [OPTION]... [FILE]...
521 hg status [OPTION]... [FILE]...
522
522
523 aliases: st
523 aliases: st
524
524
525 show changed files in the working directory
525 show changed files in the working directory
526
526
527 Show status of files in the repository. If names are given, only files
527 Show status of files in the repository. If names are given, only files
528 that match are shown. Files that are clean or ignored or the source of a
528 that match are shown. Files that are clean or ignored or the source of a
529 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
529 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
530 -C/--copies or -A/--all are given. Unless options described with "show
530 -C/--copies or -A/--all are given. Unless options described with "show
531 only ..." are given, the options -mardu are used.
531 only ..." are given, the options -mardu are used.
532
532
533 Option -q/--quiet hides untracked (unknown and ignored) files unless
533 Option -q/--quiet hides untracked (unknown and ignored) files unless
534 explicitly requested with -u/--unknown or -i/--ignored.
534 explicitly requested with -u/--unknown or -i/--ignored.
535
535
536 Note:
536 Note:
537 status may appear to disagree with diff if permissions have changed or
537 status may appear to disagree with diff if permissions have changed or
538 a merge has occurred. The standard diff format does not report
538 a merge has occurred. The standard diff format does not report
539 permission changes and diff only reports changes relative to one merge
539 permission changes and diff only reports changes relative to one merge
540 parent.
540 parent.
541
541
542 If one revision is given, it is used as the base revision. If two
542 If one revision is given, it is used as the base revision. If two
543 revisions are given, the differences between them are shown. The --change
543 revisions are given, the differences between them are shown. The --change
544 option can also be used as a shortcut to list the changed files of a
544 option can also be used as a shortcut to list the changed files of a
545 revision from its first parent.
545 revision from its first parent.
546
546
547 The codes used to show the status of files are:
547 The codes used to show the status of files are:
548
548
549 M = modified
549 M = modified
550 A = added
550 A = added
551 R = removed
551 R = removed
552 C = clean
552 C = clean
553 ! = missing (deleted by non-hg command, but still tracked)
553 ! = missing (deleted by non-hg command, but still tracked)
554 ? = not tracked
554 ? = not tracked
555 I = ignored
555 I = ignored
556 = origin of the previous file (with --copies)
556 = origin of the previous file (with --copies)
557
557
558 Returns 0 on success.
558 Returns 0 on success.
559
559
560 options ([+] can be repeated):
560 options ([+] can be repeated):
561
561
562 -A --all show status of all files
562 -A --all show status of all files
563 -m --modified show only modified files
563 -m --modified show only modified files
564 -a --added show only added files
564 -a --added show only added files
565 -r --removed show only removed files
565 -r --removed show only removed files
566 -d --deleted show only deleted (but tracked) files
566 -d --deleted show only deleted (but tracked) files
567 -c --clean show only files without changes
567 -c --clean show only files without changes
568 -u --unknown show only unknown (not tracked) files
568 -u --unknown show only unknown (not tracked) files
569 -i --ignored show only ignored files
569 -i --ignored show only ignored files
570 -n --no-status hide status prefix
570 -n --no-status hide status prefix
571 -C --copies show source of copied files
571 -C --copies show source of copied files
572 -0 --print0 end filenames with NUL, for use with xargs
572 -0 --print0 end filenames with NUL, for use with xargs
573 --rev REV [+] show difference from revision
573 --rev REV [+] show difference from revision
574 --change REV list the changed files of a revision
574 --change REV list the changed files of a revision
575 -I --include PATTERN [+] include names matching the given patterns
575 -I --include PATTERN [+] include names matching the given patterns
576 -X --exclude PATTERN [+] exclude names matching the given patterns
576 -X --exclude PATTERN [+] exclude names matching the given patterns
577 -S --subrepos recurse into subrepositories
577 -S --subrepos recurse into subrepositories
578
578
579 (some details hidden, use --verbose to show complete help)
579 (some details hidden, use --verbose to show complete help)
580
580
581 $ hg -q help status
581 $ hg -q help status
582 hg status [OPTION]... [FILE]...
582 hg status [OPTION]... [FILE]...
583
583
584 show changed files in the working directory
584 show changed files in the working directory
585
585
586 $ hg help foo
586 $ hg help foo
587 abort: no such help topic: foo
587 abort: no such help topic: foo
588 (try "hg help --keyword foo")
588 (try "hg help --keyword foo")
589 [255]
589 [255]
590
590
591 $ hg skjdfks
591 $ hg skjdfks
592 hg: unknown command 'skjdfks'
592 hg: unknown command 'skjdfks'
593 Mercurial Distributed SCM
593 Mercurial Distributed SCM
594
594
595 basic commands:
595 basic commands:
596
596
597 add add the specified files on the next commit
597 add add the specified files on the next commit
598 annotate show changeset information by line for each file
598 annotate show changeset information by line for each file
599 clone make a copy of an existing repository
599 clone make a copy of an existing repository
600 commit commit the specified files or all outstanding changes
600 commit commit the specified files or all outstanding changes
601 diff diff repository (or selected files)
601 diff diff repository (or selected files)
602 export dump the header and diffs for one or more changesets
602 export dump the header and diffs for one or more changesets
603 forget forget the specified files on the next commit
603 forget forget the specified files on the next commit
604 init create a new repository in the given directory
604 init create a new repository in the given directory
605 log show revision history of entire repository or files
605 log show revision history of entire repository or files
606 merge merge another revision into working directory
606 merge merge another revision into working directory
607 pull pull changes from the specified source
607 pull pull changes from the specified source
608 push push changes to the specified destination
608 push push changes to the specified destination
609 remove remove the specified files on the next commit
609 remove remove the specified files on the next commit
610 serve start stand-alone webserver
610 serve start stand-alone webserver
611 status show changed files in the working directory
611 status show changed files in the working directory
612 summary summarize working directory state
612 summary summarize working directory state
613 update update working directory (or switch revisions)
613 update update working directory (or switch revisions)
614
614
615 (use "hg help" for the full list of commands or "hg -v" for details)
615 (use "hg help" for the full list of commands or "hg -v" for details)
616 [255]
616 [255]
617
617
618
618
619 Make sure that we don't run afoul of the help system thinking that
619 Make sure that we don't run afoul of the help system thinking that
620 this is a section and erroring out weirdly.
620 this is a section and erroring out weirdly.
621
621
622 $ hg .log
622 $ hg .log
623 hg: unknown command '.log'
623 hg: unknown command '.log'
624 (did you mean one of log?)
624 (did you mean one of log?)
625 [255]
625 [255]
626
626
627 $ hg log.
627 $ hg log.
628 hg: unknown command 'log.'
628 hg: unknown command 'log.'
629 (did you mean one of log?)
629 (did you mean one of log?)
630 [255]
630 [255]
631 $ hg pu.lh
631 $ hg pu.lh
632 hg: unknown command 'pu.lh'
632 hg: unknown command 'pu.lh'
633 (did you mean one of pull, push?)
633 (did you mean one of pull, push?)
634 [255]
634 [255]
635
635
636 $ cat > helpext.py <<EOF
636 $ cat > helpext.py <<EOF
637 > import os
637 > import os
638 > from mercurial import cmdutil, commands
638 > from mercurial import cmdutil, commands
639 >
639 >
640 > cmdtable = {}
640 > cmdtable = {}
641 > command = cmdutil.command(cmdtable)
641 > command = cmdutil.command(cmdtable)
642 >
642 >
643 > @command('nohelp',
643 > @command('nohelp',
644 > [('', 'longdesc', 3, 'x'*90),
644 > [('', 'longdesc', 3, 'x'*90),
645 > ('n', '', None, 'normal desc'),
645 > ('n', '', None, 'normal desc'),
646 > ('', 'newline', '', 'line1\nline2')],
646 > ('', 'newline', '', 'line1\nline2')],
647 > 'hg nohelp',
647 > 'hg nohelp',
648 > norepo=True)
648 > norepo=True)
649 > @command('debugoptDEP', [('', 'dopt', None, 'option is (DEPRECATED)')])
649 > @command('debugoptDEP', [('', 'dopt', None, 'option is (DEPRECATED)')])
650 > @command('debugoptEXP', [('', 'eopt', None, 'option is (EXPERIMENTAL)')])
650 > @command('debugoptEXP', [('', 'eopt', None, 'option is (EXPERIMENTAL)')])
651 > def nohelp(ui, *args, **kwargs):
651 > def nohelp(ui, *args, **kwargs):
652 > pass
652 > pass
653 >
653 >
654 > EOF
654 > EOF
655 $ echo '[extensions]' >> $HGRCPATH
655 $ echo '[extensions]' >> $HGRCPATH
656 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
656 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
657
657
658 Test command with no help text
658 Test command with no help text
659
659
660 $ hg help nohelp
660 $ hg help nohelp
661 hg nohelp
661 hg nohelp
662
662
663 (no help text available)
663 (no help text available)
664
664
665 options:
665 options:
666
666
667 --longdesc VALUE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
667 --longdesc VALUE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
668 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (default: 3)
668 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (default: 3)
669 -n -- normal desc
669 -n -- normal desc
670 --newline VALUE line1 line2
670 --newline VALUE line1 line2
671
671
672 (some details hidden, use --verbose to show complete help)
672 (some details hidden, use --verbose to show complete help)
673
673
674 $ hg help -k nohelp
674 $ hg help -k nohelp
675 Commands:
675 Commands:
676
676
677 nohelp hg nohelp
677 nohelp hg nohelp
678
678
679 Extension Commands:
679 Extension Commands:
680
680
681 nohelp (no help text available)
681 nohelp (no help text available)
682
682
683 Test that default list of commands omits extension commands
683 Test that default list of commands omits extension commands
684
684
685 $ hg help
685 $ hg help
686 Mercurial Distributed SCM
686 Mercurial Distributed SCM
687
687
688 list of commands:
688 list of commands:
689
689
690 add add the specified files on the next commit
690 add add the specified files on the next commit
691 addremove add all new files, delete all missing files
691 addremove add all new files, delete all missing files
692 annotate show changeset information by line for each file
692 annotate show changeset information by line for each file
693 archive create an unversioned archive of a repository revision
693 archive create an unversioned archive of a repository revision
694 backout reverse effect of earlier changeset
694 backout reverse effect of earlier changeset
695 bisect subdivision search of changesets
695 bisect subdivision search of changesets
696 bookmarks create a new bookmark or list existing bookmarks
696 bookmarks create a new bookmark or list existing bookmarks
697 branch set or show the current branch name
697 branch set or show the current branch name
698 branches list repository named branches
698 branches list repository named branches
699 bundle create a changegroup file
699 bundle create a changegroup file
700 cat output the current or given revision of files
700 cat output the current or given revision of files
701 clone make a copy of an existing repository
701 clone make a copy of an existing repository
702 commit commit the specified files or all outstanding changes
702 commit commit the specified files or all outstanding changes
703 config show combined config settings from all hgrc files
703 config show combined config settings from all hgrc files
704 copy mark files as copied for the next commit
704 copy mark files as copied for the next commit
705 diff diff repository (or selected files)
705 diff diff repository (or selected files)
706 export dump the header and diffs for one or more changesets
706 export dump the header and diffs for one or more changesets
707 files list tracked files
707 files list tracked files
708 forget forget the specified files on the next commit
708 forget forget the specified files on the next commit
709 graft copy changes from other branches onto the current branch
709 graft copy changes from other branches onto the current branch
710 grep search for a pattern in specified files and revisions
710 grep search for a pattern in specified files and revisions
711 heads show branch heads
711 heads show branch heads
712 help show help for a given topic or a help overview
712 help show help for a given topic or a help overview
713 identify identify the working directory or specified revision
713 identify identify the working directory or specified revision
714 import import an ordered set of patches
714 import import an ordered set of patches
715 incoming show new changesets found in source
715 incoming show new changesets found in source
716 init create a new repository in the given directory
716 init create a new repository in the given directory
717 log show revision history of entire repository or files
717 log show revision history of entire repository or files
718 manifest output the current or given revision of the project manifest
718 manifest output the current or given revision of the project manifest
719 merge merge another revision into working directory
719 merge merge another revision into working directory
720 outgoing show changesets not found in the destination
720 outgoing show changesets not found in the destination
721 paths show aliases for remote repositories
721 paths show aliases for remote repositories
722 phase set or show the current phase name
722 phase set or show the current phase name
723 pull pull changes from the specified source
723 pull pull changes from the specified source
724 push push changes to the specified destination
724 push push changes to the specified destination
725 recover roll back an interrupted transaction
725 recover roll back an interrupted transaction
726 remove remove the specified files on the next commit
726 remove remove the specified files on the next commit
727 rename rename files; equivalent of copy + remove
727 rename rename files; equivalent of copy + remove
728 resolve redo merges or set/view the merge status of files
728 resolve redo merges or set/view the merge status of files
729 revert restore files to their checkout state
729 revert restore files to their checkout state
730 root print the root (top) of the current working directory
730 root print the root (top) of the current working directory
731 serve start stand-alone webserver
731 serve start stand-alone webserver
732 status show changed files in the working directory
732 status show changed files in the working directory
733 summary summarize working directory state
733 summary summarize working directory state
734 tag add one or more tags for the current or given revision
734 tag add one or more tags for the current or given revision
735 tags list repository tags
735 tags list repository tags
736 unbundle apply one or more changegroup files
736 unbundle apply one or more changegroup files
737 update update working directory (or switch revisions)
737 update update working directory (or switch revisions)
738 verify verify the integrity of the repository
738 verify verify the integrity of the repository
739 version output version and copyright information
739 version output version and copyright information
740
740
741 enabled extensions:
741 enabled extensions:
742
742
743 helpext (no help text available)
743 helpext (no help text available)
744
744
745 additional help topics:
745 additional help topics:
746
746
747 config Configuration Files
747 config Configuration Files
748 dates Date Formats
748 dates Date Formats
749 diffs Diff Formats
749 diffs Diff Formats
750 environment Environment Variables
750 environment Environment Variables
751 extensions Using Additional Features
751 extensions Using Additional Features
752 filesets Specifying File Sets
752 filesets Specifying File Sets
753 glossary Glossary
753 glossary Glossary
754 hgignore Syntax for Mercurial Ignore Files
754 hgignore Syntax for Mercurial Ignore Files
755 hgweb Configuring hgweb
755 hgweb Configuring hgweb
756 merge-tools Merge Tools
756 merge-tools Merge Tools
757 multirevs Specifying Multiple Revisions
757 multirevs Specifying Multiple Revisions
758 patterns File Name Patterns
758 patterns File Name Patterns
759 phases Working with Phases
759 phases Working with Phases
760 revisions Specifying Single Revisions
760 revisions Specifying Single Revisions
761 revsets Specifying Revision Sets
761 revsets Specifying Revision Sets
762 scripting Using Mercurial from scripts and automation
762 scripting Using Mercurial from scripts and automation
763 subrepos Subrepositories
763 subrepos Subrepositories
764 templating Template Usage
764 templating Template Usage
765 urls URL Paths
765 urls URL Paths
766
766
767 (use "hg help -v" to show built-in aliases and global options)
767 (use "hg help -v" to show built-in aliases and global options)
768
768
769
769
770 Test list of internal help commands
770 Test list of internal help commands
771
771
772 $ hg help debug
772 $ hg help debug
773 debug commands (internal and unsupported):
773 debug commands (internal and unsupported):
774
774
775 debugancestor
775 debugancestor
776 find the ancestor revision of two revisions in a given index
776 find the ancestor revision of two revisions in a given index
777 debugbuilddag
777 debugbuilddag
778 builds a repo with a given DAG from scratch in the current
778 builds a repo with a given DAG from scratch in the current
779 empty repo
779 empty repo
780 debugbundle lists the contents of a bundle
780 debugbundle lists the contents of a bundle
781 debugcheckstate
781 debugcheckstate
782 validate the correctness of the current dirstate
782 validate the correctness of the current dirstate
783 debugcommands
783 debugcommands
784 list all available commands and options
784 list all available commands and options
785 debugcomplete
785 debugcomplete
786 returns the completion list associated with the given command
786 returns the completion list associated with the given command
787 debugdag format the changelog or an index DAG as a concise textual
787 debugdag format the changelog or an index DAG as a concise textual
788 description
788 description
789 debugdata dump the contents of a data file revision
789 debugdata dump the contents of a data file revision
790 debugdate parse and display a date
790 debugdate parse and display a date
791 debugdirstate
791 debugdirstate
792 show the contents of the current dirstate
792 show the contents of the current dirstate
793 debugdiscovery
793 debugdiscovery
794 runs the changeset discovery protocol in isolation
794 runs the changeset discovery protocol in isolation
795 debugextensions
795 debugextensions
796 show information about active extensions
796 show information about active extensions
797 debugfileset parse and apply a fileset specification
797 debugfileset parse and apply a fileset specification
798 debugfsinfo show information detected about current filesystem
798 debugfsinfo show information detected about current filesystem
799 debuggetbundle
799 debuggetbundle
800 retrieves a bundle from a repo
800 retrieves a bundle from a repo
801 debugignore display the combined ignore pattern
801 debugignore display the combined ignore pattern
802 debugindex dump the contents of an index file
802 debugindex dump the contents of an index file
803 debugindexdot
803 debugindexdot
804 dump an index DAG as a graphviz dot file
804 dump an index DAG as a graphviz dot file
805 debuginstall test Mercurial installation
805 debuginstall test Mercurial installation
806 debugknown test whether node ids are known to a repo
806 debugknown test whether node ids are known to a repo
807 debuglocks show or modify state of locks
807 debuglocks show or modify state of locks
808 debugnamecomplete
808 debugnamecomplete
809 complete "names" - tags, open branch names, bookmark names
809 complete "names" - tags, open branch names, bookmark names
810 debugobsolete
810 debugobsolete
811 create arbitrary obsolete marker
811 create arbitrary obsolete marker
812 debugoptDEP (no help text available)
812 debugoptDEP (no help text available)
813 debugoptEXP (no help text available)
813 debugoptEXP (no help text available)
814 debugpathcomplete
814 debugpathcomplete
815 complete part or all of a tracked path
815 complete part or all of a tracked path
816 debugpushkey access the pushkey key/value protocol
816 debugpushkey access the pushkey key/value protocol
817 debugpvec (no help text available)
817 debugpvec (no help text available)
818 debugrebuilddirstate
818 debugrebuilddirstate
819 rebuild the dirstate as it would look like for the given
819 rebuild the dirstate as it would look like for the given
820 revision
820 revision
821 debugrebuildfncache
821 debugrebuildfncache
822 rebuild the fncache file
822 rebuild the fncache file
823 debugrename dump rename information
823 debugrename dump rename information
824 debugrevlog show data and statistics about a revlog
824 debugrevlog show data and statistics about a revlog
825 debugrevspec parse and apply a revision specification
825 debugrevspec parse and apply a revision specification
826 debugsetparents
826 debugsetparents
827 manually set the parents of the current working directory
827 manually set the parents of the current working directory
828 debugsub (no help text available)
828 debugsub (no help text available)
829 debugsuccessorssets
829 debugsuccessorssets
830 show set of successors for revision
830 show set of successors for revision
831 debugwalk show how files match on given patterns
831 debugwalk show how files match on given patterns
832 debugwireargs
832 debugwireargs
833 (no help text available)
833 (no help text available)
834
834
835 (use "hg help -v debug" to show built-in aliases and global options)
835 (use "hg help -v debug" to show built-in aliases and global options)
836
836
837
837
838 Test list of commands with command with no help text
838 Test list of commands with command with no help text
839
839
840 $ hg help helpext
840 $ hg help helpext
841 helpext extension - no help text available
841 helpext extension - no help text available
842
842
843 list of commands:
843 list of commands:
844
844
845 nohelp (no help text available)
845 nohelp (no help text available)
846
846
847 (use "hg help -v helpext" to show built-in aliases and global options)
847 (use "hg help -v helpext" to show built-in aliases and global options)
848
848
849
849
850 test deprecated and experimental options are hidden in command help
850 test deprecated and experimental options are hidden in command help
851 $ hg help debugoptDEP
851 $ hg help debugoptDEP
852 hg debugoptDEP
852 hg debugoptDEP
853
853
854 (no help text available)
854 (no help text available)
855
855
856 options:
856 options:
857
857
858 (some details hidden, use --verbose to show complete help)
858 (some details hidden, use --verbose to show complete help)
859
859
860 $ hg help debugoptEXP
860 $ hg help debugoptEXP
861 hg debugoptEXP
861 hg debugoptEXP
862
862
863 (no help text available)
863 (no help text available)
864
864
865 options:
865 options:
866
866
867 (some details hidden, use --verbose to show complete help)
867 (some details hidden, use --verbose to show complete help)
868
868
869 test deprecated and experimental options is shown with -v
869 test deprecated and experimental options is shown with -v
870 $ hg help -v debugoptDEP | grep dopt
870 $ hg help -v debugoptDEP | grep dopt
871 --dopt option is (DEPRECATED)
871 --dopt option is (DEPRECATED)
872 $ hg help -v debugoptEXP | grep eopt
872 $ hg help -v debugoptEXP | grep eopt
873 --eopt option is (EXPERIMENTAL)
873 --eopt option is (EXPERIMENTAL)
874
874
875 #if gettext
875 #if gettext
876 test deprecated option is hidden with translation with untranslated description
876 test deprecated option is hidden with translation with untranslated description
877 (use many globy for not failing on changed transaction)
877 (use many globy for not failing on changed transaction)
878 $ LANGUAGE=sv hg help debugoptDEP
878 $ LANGUAGE=sv hg help debugoptDEP
879 hg debugoptDEP
879 hg debugoptDEP
880
880
881 (*) (glob)
881 (*) (glob)
882
882
883 options:
883 options:
884
884
885 (some details hidden, use --verbose to show complete help)
885 (some details hidden, use --verbose to show complete help)
886 #endif
886 #endif
887
887
888 Test commands that collide with topics (issue4240)
888 Test commands that collide with topics (issue4240)
889
889
890 $ hg config -hq
890 $ hg config -hq
891 hg config [-u] [NAME]...
891 hg config [-u] [NAME]...
892
892
893 show combined config settings from all hgrc files
893 show combined config settings from all hgrc files
894 $ hg showconfig -hq
894 $ hg showconfig -hq
895 hg config [-u] [NAME]...
895 hg config [-u] [NAME]...
896
896
897 show combined config settings from all hgrc files
897 show combined config settings from all hgrc files
898
898
899 Test a help topic
899 Test a help topic
900
900
901 $ hg help revs
901 $ hg help revs
902 Specifying Single Revisions
902 Specifying Single Revisions
903 """""""""""""""""""""""""""
903 """""""""""""""""""""""""""
904
904
905 Mercurial supports several ways to specify individual revisions.
905 Mercurial supports several ways to specify individual revisions.
906
906
907 A plain integer is treated as a revision number. Negative integers are
907 A plain integer is treated as a revision number. Negative integers are
908 treated as sequential offsets from the tip, with -1 denoting the tip, -2
908 treated as sequential offsets from the tip, with -1 denoting the tip, -2
909 denoting the revision prior to the tip, and so forth.
909 denoting the revision prior to the tip, and so forth.
910
910
911 A 40-digit hexadecimal string is treated as a unique revision identifier.
911 A 40-digit hexadecimal string is treated as a unique revision identifier.
912
912
913 A hexadecimal string less than 40 characters long is treated as a unique
913 A hexadecimal string less than 40 characters long is treated as a unique
914 revision identifier and is referred to as a short-form identifier. A
914 revision identifier and is referred to as a short-form identifier. A
915 short-form identifier is only valid if it is the prefix of exactly one
915 short-form identifier is only valid if it is the prefix of exactly one
916 full-length identifier.
916 full-length identifier.
917
917
918 Any other string is treated as a bookmark, tag, or branch name. A bookmark
918 Any other string is treated as a bookmark, tag, or branch name. A bookmark
919 is a movable pointer to a revision. A tag is a permanent name associated
919 is a movable pointer to a revision. A tag is a permanent name associated
920 with a revision. A branch name denotes the tipmost open branch head of
920 with a revision. A branch name denotes the tipmost open branch head of
921 that branch - or if they are all closed, the tipmost closed head of the
921 that branch - or if they are all closed, the tipmost closed head of the
922 branch. Bookmark, tag, and branch names must not contain the ":"
922 branch. Bookmark, tag, and branch names must not contain the ":"
923 character.
923 character.
924
924
925 The reserved name "tip" always identifies the most recent revision.
925 The reserved name "tip" always identifies the most recent revision.
926
926
927 The reserved name "null" indicates the null revision. This is the revision
927 The reserved name "null" indicates the null revision. This is the revision
928 of an empty repository, and the parent of revision 0.
928 of an empty repository, and the parent of revision 0.
929
929
930 The reserved name "." indicates the working directory parent. If no
930 The reserved name "." indicates the working directory parent. If no
931 working directory is checked out, it is equivalent to null. If an
931 working directory is checked out, it is equivalent to null. If an
932 uncommitted merge is in progress, "." is the revision of the first parent.
932 uncommitted merge is in progress, "." is the revision of the first parent.
933
933
934 Test repeated config section name
934 Test repeated config section name
935
935
936 $ hg help config.host
936 $ hg help config.host
937 "http_proxy.host"
937 "http_proxy.host"
938 Host name and (optional) port of the proxy server, for example
938 Host name and (optional) port of the proxy server, for example
939 "myproxy:8000".
939 "myproxy:8000".
940
940
941 "smtp.host"
941 "smtp.host"
942 Host name of mail server, e.g. "mail.example.com".
942 Host name of mail server, e.g. "mail.example.com".
943
943
944 Unrelated trailing paragraphs shouldn't be included
944 Unrelated trailing paragraphs shouldn't be included
945
945
946 $ hg help config.extramsg | grep '^$'
946 $ hg help config.extramsg | grep '^$'
947
947
948
948
949 Test capitalized section name
949 Test capitalized section name
950
950
951 $ hg help scripting.HGPLAIN > /dev/null
951 $ hg help scripting.HGPLAIN > /dev/null
952
952
953 Help subsection:
953 Help subsection:
954
954
955 $ hg help config.charsets |grep "Email example:" > /dev/null
955 $ hg help config.charsets |grep "Email example:" > /dev/null
956 [1]
956 [1]
957
957
958 Show nested definitions
958 Show nested definitions
959 ("profiling.type"[break]"ls"[break]"stat"[break])
959 ("profiling.type"[break]"ls"[break]"stat"[break])
960
960
961 $ hg help config.type | egrep '^$'|wc -l
961 $ hg help config.type | egrep '^$'|wc -l
962 \s*3 (re)
962 \s*3 (re)
963
963
964 Last item in help config.*:
964 Last item in help config.*:
965
965
966 $ hg help config.`hg help config|grep '^ "'| \
966 $ hg help config.`hg help config|grep '^ "'| \
967 > tail -1|sed 's![ "]*!!g'`| \
967 > tail -1|sed 's![ "]*!!g'`| \
968 > grep "hg help -c config" > /dev/null
968 > grep "hg help -c config" > /dev/null
969 [1]
969 [1]
970
970
971 note to use help -c for general hg help config:
971 note to use help -c for general hg help config:
972
972
973 $ hg help config |grep "hg help -c config" > /dev/null
973 $ hg help config |grep "hg help -c config" > /dev/null
974
974
975 Test templating help
975 Test templating help
976
976
977 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
977 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
978 desc String. The text of the changeset description.
978 desc String. The text of the changeset description.
979 diffstat String. Statistics of changes with the following format:
979 diffstat String. Statistics of changes with the following format:
980 firstline Any text. Returns the first line of text.
980 firstline Any text. Returns the first line of text.
981 nonempty Any text. Returns '(none)' if the string is empty.
981 nonempty Any text. Returns '(none)' if the string is empty.
982
982
983 Test help hooks
983 Test help hooks
984
984
985 $ cat > helphook1.py <<EOF
985 $ cat > helphook1.py <<EOF
986 > from mercurial import help
986 > from mercurial import help
987 >
987 >
988 > def rewrite(topic, doc):
988 > def rewrite(topic, doc):
989 > return doc + '\nhelphook1\n'
989 > return doc + '\nhelphook1\n'
990 >
990 >
991 > def extsetup(ui):
991 > def extsetup(ui):
992 > help.addtopichook('revsets', rewrite)
992 > help.addtopichook('revsets', rewrite)
993 > EOF
993 > EOF
994 $ cat > helphook2.py <<EOF
994 $ cat > helphook2.py <<EOF
995 > from mercurial import help
995 > from mercurial import help
996 >
996 >
997 > def rewrite(topic, doc):
997 > def rewrite(topic, doc):
998 > return doc + '\nhelphook2\n'
998 > return doc + '\nhelphook2\n'
999 >
999 >
1000 > def extsetup(ui):
1000 > def extsetup(ui):
1001 > help.addtopichook('revsets', rewrite)
1001 > help.addtopichook('revsets', rewrite)
1002 > EOF
1002 > EOF
1003 $ echo '[extensions]' >> $HGRCPATH
1003 $ echo '[extensions]' >> $HGRCPATH
1004 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
1004 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
1005 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
1005 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
1006 $ hg help revsets | grep helphook
1006 $ hg help revsets | grep helphook
1007 helphook1
1007 helphook1
1008 helphook2
1008 helphook2
1009
1009
1010 Test -e / -c / -k combinations
1010 Test -e / -c / -k combinations
1011
1011
1012 $ hg help -c progress
1012 $ hg help -c progress
1013 abort: no such help topic: progress
1013 abort: no such help topic: progress
1014 (try "hg help --keyword progress")
1014 (try "hg help --keyword progress")
1015 [255]
1015 [255]
1016 $ hg help -e progress |head -1
1016 $ hg help -e progress |head -1
1017 progress extension - show progress bars for some actions (DEPRECATED)
1017 progress extension - show progress bars for some actions (DEPRECATED)
1018 $ hg help -c -k dates |egrep '^(Topics|Extensions|Commands):'
1018 $ hg help -c -k dates |egrep '^(Topics|Extensions|Commands):'
1019 Commands:
1019 Commands:
1020 $ hg help -e -k a |egrep '^(Topics|Extensions|Commands):'
1020 $ hg help -e -k a |egrep '^(Topics|Extensions|Commands):'
1021 Extensions:
1021 Extensions:
1022 $ hg help -e -c -k date |egrep '^(Topics|Extensions|Commands):'
1022 $ hg help -e -c -k date |egrep '^(Topics|Extensions|Commands):'
1023 Extensions:
1023 Extensions:
1024 Commands:
1024 Commands:
1025 $ hg help -c commit > /dev/null
1025 $ hg help -c commit > /dev/null
1026 $ hg help -e -c commit > /dev/null
1026 $ hg help -e -c commit > /dev/null
1027 $ hg help -e commit > /dev/null
1027 $ hg help -e commit > /dev/null
1028 abort: no such help topic: commit
1028 abort: no such help topic: commit
1029 (try "hg help --keyword commit")
1029 (try "hg help --keyword commit")
1030 [255]
1030 [255]
1031
1031
1032 Test keyword search help
1032 Test keyword search help
1033
1033
1034 $ cat > prefixedname.py <<EOF
1034 $ cat > prefixedname.py <<EOF
1035 > '''matched against word "clone"
1035 > '''matched against word "clone"
1036 > '''
1036 > '''
1037 > EOF
1037 > EOF
1038 $ echo '[extensions]' >> $HGRCPATH
1038 $ echo '[extensions]' >> $HGRCPATH
1039 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
1039 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
1040 $ hg help -k clone
1040 $ hg help -k clone
1041 Topics:
1041 Topics:
1042
1042
1043 config Configuration Files
1043 config Configuration Files
1044 extensions Using Additional Features
1044 extensions Using Additional Features
1045 glossary Glossary
1045 glossary Glossary
1046 phases Working with Phases
1046 phases Working with Phases
1047 subrepos Subrepositories
1047 subrepos Subrepositories
1048 urls URL Paths
1048 urls URL Paths
1049
1049
1050 Commands:
1050 Commands:
1051
1051
1052 bookmarks create a new bookmark or list existing bookmarks
1052 bookmarks create a new bookmark or list existing bookmarks
1053 clone make a copy of an existing repository
1053 clone make a copy of an existing repository
1054 paths show aliases for remote repositories
1054 paths show aliases for remote repositories
1055 update update working directory (or switch revisions)
1055 update update working directory (or switch revisions)
1056
1056
1057 Extensions:
1057 Extensions:
1058
1058
1059 prefixedname matched against word "clone"
1059 prefixedname matched against word "clone"
1060 relink recreates hardlinks between repository clones
1060 relink recreates hardlinks between repository clones
1061
1061
1062 Extension Commands:
1062 Extension Commands:
1063
1063
1064 qclone clone main and patch repository at same time
1064 qclone clone main and patch repository at same time
1065
1065
1066 Test unfound topic
1066 Test unfound topic
1067
1067
1068 $ hg help nonexistingtopicthatwillneverexisteverever
1068 $ hg help nonexistingtopicthatwillneverexisteverever
1069 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
1069 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
1070 (try "hg help --keyword nonexistingtopicthatwillneverexisteverever")
1070 (try "hg help --keyword nonexistingtopicthatwillneverexisteverever")
1071 [255]
1071 [255]
1072
1072
1073 Test unfound keyword
1073 Test unfound keyword
1074
1074
1075 $ hg help --keyword nonexistingwordthatwillneverexisteverever
1075 $ hg help --keyword nonexistingwordthatwillneverexisteverever
1076 abort: no matches
1076 abort: no matches
1077 (try "hg help" for a list of topics)
1077 (try "hg help" for a list of topics)
1078 [255]
1078 [255]
1079
1079
1080 Test omit indicating for help
1080 Test omit indicating for help
1081
1081
1082 $ cat > addverboseitems.py <<EOF
1082 $ cat > addverboseitems.py <<EOF
1083 > '''extension to test omit indicating.
1083 > '''extension to test omit indicating.
1084 >
1084 >
1085 > This paragraph is never omitted (for extension)
1085 > This paragraph is never omitted (for extension)
1086 >
1086 >
1087 > .. container:: verbose
1087 > .. container:: verbose
1088 >
1088 >
1089 > This paragraph is omitted,
1089 > This paragraph is omitted,
1090 > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension)
1090 > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension)
1091 >
1091 >
1092 > This paragraph is never omitted, too (for extension)
1092 > This paragraph is never omitted, too (for extension)
1093 > '''
1093 > '''
1094 >
1094 >
1095 > from mercurial import help, commands
1095 > from mercurial import help, commands
1096 > testtopic = """This paragraph is never omitted (for topic).
1096 > testtopic = """This paragraph is never omitted (for topic).
1097 >
1097 >
1098 > .. container:: verbose
1098 > .. container:: verbose
1099 >
1099 >
1100 > This paragraph is omitted,
1100 > This paragraph is omitted,
1101 > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic)
1101 > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic)
1102 >
1102 >
1103 > This paragraph is never omitted, too (for topic)
1103 > This paragraph is never omitted, too (for topic)
1104 > """
1104 > """
1105 > def extsetup(ui):
1105 > def extsetup(ui):
1106 > help.helptable.append((["topic-containing-verbose"],
1106 > help.helptable.append((["topic-containing-verbose"],
1107 > "This is the topic to test omit indicating.",
1107 > "This is the topic to test omit indicating.",
1108 > lambda : testtopic))
1108 > lambda ui: testtopic))
1109 > EOF
1109 > EOF
1110 $ echo '[extensions]' >> $HGRCPATH
1110 $ echo '[extensions]' >> $HGRCPATH
1111 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1111 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1112 $ hg help addverboseitems
1112 $ hg help addverboseitems
1113 addverboseitems extension - extension to test omit indicating.
1113 addverboseitems extension - extension to test omit indicating.
1114
1114
1115 This paragraph is never omitted (for extension)
1115 This paragraph is never omitted (for extension)
1116
1116
1117 This paragraph is never omitted, too (for extension)
1117 This paragraph is never omitted, too (for extension)
1118
1118
1119 (some details hidden, use --verbose to show complete help)
1119 (some details hidden, use --verbose to show complete help)
1120
1120
1121 no commands defined
1121 no commands defined
1122 $ hg help -v addverboseitems
1122 $ hg help -v addverboseitems
1123 addverboseitems extension - extension to test omit indicating.
1123 addverboseitems extension - extension to test omit indicating.
1124
1124
1125 This paragraph is never omitted (for extension)
1125 This paragraph is never omitted (for extension)
1126
1126
1127 This paragraph is omitted, if "hg help" is invoked without "-v" (for
1127 This paragraph is omitted, if "hg help" is invoked without "-v" (for
1128 extension)
1128 extension)
1129
1129
1130 This paragraph is never omitted, too (for extension)
1130 This paragraph is never omitted, too (for extension)
1131
1131
1132 no commands defined
1132 no commands defined
1133 $ hg help topic-containing-verbose
1133 $ hg help topic-containing-verbose
1134 This is the topic to test omit indicating.
1134 This is the topic to test omit indicating.
1135 """"""""""""""""""""""""""""""""""""""""""
1135 """"""""""""""""""""""""""""""""""""""""""
1136
1136
1137 This paragraph is never omitted (for topic).
1137 This paragraph is never omitted (for topic).
1138
1138
1139 This paragraph is never omitted, too (for topic)
1139 This paragraph is never omitted, too (for topic)
1140
1140
1141 (some details hidden, use --verbose to show complete help)
1141 (some details hidden, use --verbose to show complete help)
1142 $ hg help -v topic-containing-verbose
1142 $ hg help -v topic-containing-verbose
1143 This is the topic to test omit indicating.
1143 This is the topic to test omit indicating.
1144 """"""""""""""""""""""""""""""""""""""""""
1144 """"""""""""""""""""""""""""""""""""""""""
1145
1145
1146 This paragraph is never omitted (for topic).
1146 This paragraph is never omitted (for topic).
1147
1147
1148 This paragraph is omitted, if "hg help" is invoked without "-v" (for
1148 This paragraph is omitted, if "hg help" is invoked without "-v" (for
1149 topic)
1149 topic)
1150
1150
1151 This paragraph is never omitted, too (for topic)
1151 This paragraph is never omitted, too (for topic)
1152
1152
1153 Test section lookup
1153 Test section lookup
1154
1154
1155 $ hg help revset.merge
1155 $ hg help revset.merge
1156 "merge()"
1156 "merge()"
1157 Changeset is a merge changeset.
1157 Changeset is a merge changeset.
1158
1158
1159 $ hg help glossary.dag
1159 $ hg help glossary.dag
1160 DAG
1160 DAG
1161 The repository of changesets of a distributed version control system
1161 The repository of changesets of a distributed version control system
1162 (DVCS) can be described as a directed acyclic graph (DAG), consisting
1162 (DVCS) can be described as a directed acyclic graph (DAG), consisting
1163 of nodes and edges, where nodes correspond to changesets and edges
1163 of nodes and edges, where nodes correspond to changesets and edges
1164 imply a parent -> child relation. This graph can be visualized by
1164 imply a parent -> child relation. This graph can be visualized by
1165 graphical tools such as "hg log --graph". In Mercurial, the DAG is
1165 graphical tools such as "hg log --graph". In Mercurial, the DAG is
1166 limited by the requirement for children to have at most two parents.
1166 limited by the requirement for children to have at most two parents.
1167
1167
1168
1168
1169 $ hg help hgrc.paths
1169 $ hg help hgrc.paths
1170 "paths"
1170 "paths"
1171 -------
1171 -------
1172
1172
1173 Assigns symbolic names to repositories. The left side is the symbolic
1173 Assigns symbolic names to repositories. The left side is the symbolic
1174 name, and the right gives the directory or URL that is the location of the
1174 name, and the right gives the directory or URL that is the location of the
1175 repository. Default paths can be declared by setting the following
1175 repository. Default paths can be declared by setting the following
1176 entries.
1176 entries.
1177
1177
1178 "default"
1178 "default"
1179 Directory or URL to use when pulling if no source is specified.
1179 Directory or URL to use when pulling if no source is specified.
1180 (default: repository from which the current repository was cloned)
1180 (default: repository from which the current repository was cloned)
1181
1181
1182 "default-push"
1182 "default-push"
1183 Optional. Directory or URL to use when pushing if no destination is
1183 Optional. Directory or URL to use when pushing if no destination is
1184 specified.
1184 specified.
1185
1185
1186 Custom paths can be defined by assigning the path to a name that later can
1186 Custom paths can be defined by assigning the path to a name that later can
1187 be used from the command line. Example:
1187 be used from the command line. Example:
1188
1188
1189 [paths]
1189 [paths]
1190 my_path = http://example.com/path
1190 my_path = http://example.com/path
1191
1191
1192 To push to the path defined in "my_path" run the command:
1192 To push to the path defined in "my_path" run the command:
1193
1193
1194 hg push my_path
1194 hg push my_path
1195
1195
1196 $ hg help glossary.mcguffin
1196 $ hg help glossary.mcguffin
1197 abort: help section not found
1197 abort: help section not found
1198 [255]
1198 [255]
1199
1199
1200 $ hg help glossary.mc.guffin
1200 $ hg help glossary.mc.guffin
1201 abort: help section not found
1201 abort: help section not found
1202 [255]
1202 [255]
1203
1203
1204 $ hg help template.files
1204 $ hg help template.files
1205 files List of strings. All files modified, added, or removed by
1205 files List of strings. All files modified, added, or removed by
1206 this changeset.
1206 this changeset.
1207
1207
1208 Test dynamic list of merge tools only shows up once
1208 Test dynamic list of merge tools only shows up once
1209 $ hg help merge-tools
1209 $ hg help merge-tools
1210 Merge Tools
1210 Merge Tools
1211 """""""""""
1211 """""""""""
1212
1212
1213 To merge files Mercurial uses merge tools.
1213 To merge files Mercurial uses merge tools.
1214
1214
1215 A merge tool combines two different versions of a file into a merged file.
1215 A merge tool combines two different versions of a file into a merged file.
1216 Merge tools are given the two files and the greatest common ancestor of
1216 Merge tools are given the two files and the greatest common ancestor of
1217 the two file versions, so they can determine the changes made on both
1217 the two file versions, so they can determine the changes made on both
1218 branches.
1218 branches.
1219
1219
1220 Merge tools are used both for "hg resolve", "hg merge", "hg update", "hg
1220 Merge tools are used both for "hg resolve", "hg merge", "hg update", "hg
1221 backout" and in several extensions.
1221 backout" and in several extensions.
1222
1222
1223 Usually, the merge tool tries to automatically reconcile the files by
1223 Usually, the merge tool tries to automatically reconcile the files by
1224 combining all non-overlapping changes that occurred separately in the two
1224 combining all non-overlapping changes that occurred separately in the two
1225 different evolutions of the same initial base file. Furthermore, some
1225 different evolutions of the same initial base file. Furthermore, some
1226 interactive merge programs make it easier to manually resolve conflicting
1226 interactive merge programs make it easier to manually resolve conflicting
1227 merges, either in a graphical way, or by inserting some conflict markers.
1227 merges, either in a graphical way, or by inserting some conflict markers.
1228 Mercurial does not include any interactive merge programs but relies on
1228 Mercurial does not include any interactive merge programs but relies on
1229 external tools for that.
1229 external tools for that.
1230
1230
1231 Available merge tools
1231 Available merge tools
1232 =====================
1232 =====================
1233
1233
1234 External merge tools and their properties are configured in the merge-
1234 External merge tools and their properties are configured in the merge-
1235 tools configuration section - see hgrc(5) - but they can often just be
1235 tools configuration section - see hgrc(5) - but they can often just be
1236 named by their executable.
1236 named by their executable.
1237
1237
1238 A merge tool is generally usable if its executable can be found on the
1238 A merge tool is generally usable if its executable can be found on the
1239 system and if it can handle the merge. The executable is found if it is an
1239 system and if it can handle the merge. The executable is found if it is an
1240 absolute or relative executable path or the name of an application in the
1240 absolute or relative executable path or the name of an application in the
1241 executable search path. The tool is assumed to be able to handle the merge
1241 executable search path. The tool is assumed to be able to handle the merge
1242 if it can handle symlinks if the file is a symlink, if it can handle
1242 if it can handle symlinks if the file is a symlink, if it can handle
1243 binary files if the file is binary, and if a GUI is available if the tool
1243 binary files if the file is binary, and if a GUI is available if the tool
1244 requires a GUI.
1244 requires a GUI.
1245
1245
1246 There are some internal merge tools which can be used. The internal merge
1246 There are some internal merge tools which can be used. The internal merge
1247 tools are:
1247 tools are:
1248
1248
1249 ":dump"
1249 ":dump"
1250 Creates three versions of the files to merge, containing the contents of
1250 Creates three versions of the files to merge, containing the contents of
1251 local, other and base. These files can then be used to perform a merge
1251 local, other and base. These files can then be used to perform a merge
1252 manually. If the file to be merged is named "a.txt", these files will
1252 manually. If the file to be merged is named "a.txt", these files will
1253 accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and
1253 accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and
1254 they will be placed in the same directory as "a.txt".
1254 they will be placed in the same directory as "a.txt".
1255
1255
1256 ":fail"
1256 ":fail"
1257 Rather than attempting to merge files that were modified on both
1257 Rather than attempting to merge files that were modified on both
1258 branches, it marks them as unresolved. The resolve command must be used
1258 branches, it marks them as unresolved. The resolve command must be used
1259 to resolve these conflicts.
1259 to resolve these conflicts.
1260
1260
1261 ":local"
1261 ":local"
1262 Uses the local version of files as the merged version.
1262 Uses the local version of files as the merged version.
1263
1263
1264 ":merge"
1264 ":merge"
1265 Uses the internal non-interactive simple merge algorithm for merging
1265 Uses the internal non-interactive simple merge algorithm for merging
1266 files. It will fail if there are any conflicts and leave markers in the
1266 files. It will fail if there are any conflicts and leave markers in the
1267 partially merged file. Markers will have two sections, one for each side
1267 partially merged file. Markers will have two sections, one for each side
1268 of merge.
1268 of merge.
1269
1269
1270 ":merge-local"
1270 ":merge-local"
1271 Like :merge, but resolve all conflicts non-interactively in favor of the
1271 Like :merge, but resolve all conflicts non-interactively in favor of the
1272 local changes.
1272 local changes.
1273
1273
1274 ":merge-other"
1274 ":merge-other"
1275 Like :merge, but resolve all conflicts non-interactively in favor of the
1275 Like :merge, but resolve all conflicts non-interactively in favor of the
1276 other changes.
1276 other changes.
1277
1277
1278 ":merge3"
1278 ":merge3"
1279 Uses the internal non-interactive simple merge algorithm for merging
1279 Uses the internal non-interactive simple merge algorithm for merging
1280 files. It will fail if there are any conflicts and leave markers in the
1280 files. It will fail if there are any conflicts and leave markers in the
1281 partially merged file. Marker will have three sections, one from each
1281 partially merged file. Marker will have three sections, one from each
1282 side of the merge and one for the base content.
1282 side of the merge and one for the base content.
1283
1283
1284 ":other"
1284 ":other"
1285 Uses the other version of files as the merged version.
1285 Uses the other version of files as the merged version.
1286
1286
1287 ":prompt"
1287 ":prompt"
1288 Asks the user which of the local or the other version to keep as the
1288 Asks the user which of the local or the other version to keep as the
1289 merged version.
1289 merged version.
1290
1290
1291 ":tagmerge"
1291 ":tagmerge"
1292 Uses the internal tag merge algorithm (experimental).
1292 Uses the internal tag merge algorithm (experimental).
1293
1293
1294 ":union"
1294 ":union"
1295 Uses the internal non-interactive simple merge algorithm for merging
1295 Uses the internal non-interactive simple merge algorithm for merging
1296 files. It will use both left and right sides for conflict regions. No
1296 files. It will use both left and right sides for conflict regions. No
1297 markers are inserted.
1297 markers are inserted.
1298
1298
1299 Internal tools are always available and do not require a GUI but will by
1299 Internal tools are always available and do not require a GUI but will by
1300 default not handle symlinks or binary files.
1300 default not handle symlinks or binary files.
1301
1301
1302 Choosing a merge tool
1302 Choosing a merge tool
1303 =====================
1303 =====================
1304
1304
1305 Mercurial uses these rules when deciding which merge tool to use:
1305 Mercurial uses these rules when deciding which merge tool to use:
1306
1306
1307 1. If a tool has been specified with the --tool option to merge or
1307 1. If a tool has been specified with the --tool option to merge or
1308 resolve, it is used. If it is the name of a tool in the merge-tools
1308 resolve, it is used. If it is the name of a tool in the merge-tools
1309 configuration, its configuration is used. Otherwise the specified tool
1309 configuration, its configuration is used. Otherwise the specified tool
1310 must be executable by the shell.
1310 must be executable by the shell.
1311 2. If the "HGMERGE" environment variable is present, its value is used and
1311 2. If the "HGMERGE" environment variable is present, its value is used and
1312 must be executable by the shell.
1312 must be executable by the shell.
1313 3. If the filename of the file to be merged matches any of the patterns in
1313 3. If the filename of the file to be merged matches any of the patterns in
1314 the merge-patterns configuration section, the first usable merge tool
1314 the merge-patterns configuration section, the first usable merge tool
1315 corresponding to a matching pattern is used. Here, binary capabilities
1315 corresponding to a matching pattern is used. Here, binary capabilities
1316 of the merge tool are not considered.
1316 of the merge tool are not considered.
1317 4. If ui.merge is set it will be considered next. If the value is not the
1317 4. If ui.merge is set it will be considered next. If the value is not the
1318 name of a configured tool, the specified value is used and must be
1318 name of a configured tool, the specified value is used and must be
1319 executable by the shell. Otherwise the named tool is used if it is
1319 executable by the shell. Otherwise the named tool is used if it is
1320 usable.
1320 usable.
1321 5. If any usable merge tools are present in the merge-tools configuration
1321 5. If any usable merge tools are present in the merge-tools configuration
1322 section, the one with the highest priority is used.
1322 section, the one with the highest priority is used.
1323 6. If a program named "hgmerge" can be found on the system, it is used -
1323 6. If a program named "hgmerge" can be found on the system, it is used -
1324 but it will by default not be used for symlinks and binary files.
1324 but it will by default not be used for symlinks and binary files.
1325 7. If the file to be merged is not binary and is not a symlink, then
1325 7. If the file to be merged is not binary and is not a symlink, then
1326 internal ":merge" is used.
1326 internal ":merge" is used.
1327 8. The merge of the file fails and must be resolved before commit.
1327 8. The merge of the file fails and must be resolved before commit.
1328
1328
1329 Note:
1329 Note:
1330 After selecting a merge program, Mercurial will by default attempt to
1330 After selecting a merge program, Mercurial will by default attempt to
1331 merge the files using a simple merge algorithm first. Only if it
1331 merge the files using a simple merge algorithm first. Only if it
1332 doesn't succeed because of conflicting changes Mercurial will actually
1332 doesn't succeed because of conflicting changes Mercurial will actually
1333 execute the merge program. Whether to use the simple merge algorithm
1333 execute the merge program. Whether to use the simple merge algorithm
1334 first can be controlled by the premerge setting of the merge tool.
1334 first can be controlled by the premerge setting of the merge tool.
1335 Premerge is enabled by default unless the file is binary or a symlink.
1335 Premerge is enabled by default unless the file is binary or a symlink.
1336
1336
1337 See the merge-tools and ui sections of hgrc(5) for details on the
1337 See the merge-tools and ui sections of hgrc(5) for details on the
1338 configuration of merge tools.
1338 configuration of merge tools.
1339
1339
1340 Test usage of section marks in help documents
1340 Test usage of section marks in help documents
1341
1341
1342 $ cd "$TESTDIR"/../doc
1342 $ cd "$TESTDIR"/../doc
1343 $ python check-seclevel.py
1343 $ python check-seclevel.py
1344 $ cd $TESTTMP
1344 $ cd $TESTTMP
1345
1345
1346 #if serve
1346 #if serve
1347
1347
1348 Test the help pages in hgweb.
1348 Test the help pages in hgweb.
1349
1349
1350 Dish up an empty repo; serve it cold.
1350 Dish up an empty repo; serve it cold.
1351
1351
1352 $ hg init "$TESTTMP/test"
1352 $ hg init "$TESTTMP/test"
1353 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
1353 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
1354 $ cat hg.pid >> $DAEMON_PIDS
1354 $ cat hg.pid >> $DAEMON_PIDS
1355
1355
1356 $ get-with-headers.py 127.0.0.1:$HGPORT "help"
1356 $ get-with-headers.py 127.0.0.1:$HGPORT "help"
1357 200 Script output follows
1357 200 Script output follows
1358
1358
1359 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1359 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1360 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1360 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1361 <head>
1361 <head>
1362 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1362 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1363 <meta name="robots" content="index, nofollow" />
1363 <meta name="robots" content="index, nofollow" />
1364 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1364 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1365 <script type="text/javascript" src="/static/mercurial.js"></script>
1365 <script type="text/javascript" src="/static/mercurial.js"></script>
1366
1366
1367 <title>Help: Index</title>
1367 <title>Help: Index</title>
1368 </head>
1368 </head>
1369 <body>
1369 <body>
1370
1370
1371 <div class="container">
1371 <div class="container">
1372 <div class="menu">
1372 <div class="menu">
1373 <div class="logo">
1373 <div class="logo">
1374 <a href="http://mercurial.selenic.com/">
1374 <a href="http://mercurial.selenic.com/">
1375 <img src="/static/hglogo.png" alt="mercurial" /></a>
1375 <img src="/static/hglogo.png" alt="mercurial" /></a>
1376 </div>
1376 </div>
1377 <ul>
1377 <ul>
1378 <li><a href="/shortlog">log</a></li>
1378 <li><a href="/shortlog">log</a></li>
1379 <li><a href="/graph">graph</a></li>
1379 <li><a href="/graph">graph</a></li>
1380 <li><a href="/tags">tags</a></li>
1380 <li><a href="/tags">tags</a></li>
1381 <li><a href="/bookmarks">bookmarks</a></li>
1381 <li><a href="/bookmarks">bookmarks</a></li>
1382 <li><a href="/branches">branches</a></li>
1382 <li><a href="/branches">branches</a></li>
1383 </ul>
1383 </ul>
1384 <ul>
1384 <ul>
1385 <li class="active">help</li>
1385 <li class="active">help</li>
1386 </ul>
1386 </ul>
1387 </div>
1387 </div>
1388
1388
1389 <div class="main">
1389 <div class="main">
1390 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1390 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1391 <form class="search" action="/log">
1391 <form class="search" action="/log">
1392
1392
1393 <p><input name="rev" id="search1" type="text" size="30" /></p>
1393 <p><input name="rev" id="search1" type="text" size="30" /></p>
1394 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1394 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1395 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1395 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1396 </form>
1396 </form>
1397 <table class="bigtable">
1397 <table class="bigtable">
1398 <tr><td colspan="2"><h2><a name="main" href="#topics">Topics</a></h2></td></tr>
1398 <tr><td colspan="2"><h2><a name="main" href="#topics">Topics</a></h2></td></tr>
1399
1399
1400 <tr><td>
1400 <tr><td>
1401 <a href="/help/config">
1401 <a href="/help/config">
1402 config
1402 config
1403 </a>
1403 </a>
1404 </td><td>
1404 </td><td>
1405 Configuration Files
1405 Configuration Files
1406 </td></tr>
1406 </td></tr>
1407 <tr><td>
1407 <tr><td>
1408 <a href="/help/dates">
1408 <a href="/help/dates">
1409 dates
1409 dates
1410 </a>
1410 </a>
1411 </td><td>
1411 </td><td>
1412 Date Formats
1412 Date Formats
1413 </td></tr>
1413 </td></tr>
1414 <tr><td>
1414 <tr><td>
1415 <a href="/help/diffs">
1415 <a href="/help/diffs">
1416 diffs
1416 diffs
1417 </a>
1417 </a>
1418 </td><td>
1418 </td><td>
1419 Diff Formats
1419 Diff Formats
1420 </td></tr>
1420 </td></tr>
1421 <tr><td>
1421 <tr><td>
1422 <a href="/help/environment">
1422 <a href="/help/environment">
1423 environment
1423 environment
1424 </a>
1424 </a>
1425 </td><td>
1425 </td><td>
1426 Environment Variables
1426 Environment Variables
1427 </td></tr>
1427 </td></tr>
1428 <tr><td>
1428 <tr><td>
1429 <a href="/help/extensions">
1429 <a href="/help/extensions">
1430 extensions
1430 extensions
1431 </a>
1431 </a>
1432 </td><td>
1432 </td><td>
1433 Using Additional Features
1433 Using Additional Features
1434 </td></tr>
1434 </td></tr>
1435 <tr><td>
1435 <tr><td>
1436 <a href="/help/filesets">
1436 <a href="/help/filesets">
1437 filesets
1437 filesets
1438 </a>
1438 </a>
1439 </td><td>
1439 </td><td>
1440 Specifying File Sets
1440 Specifying File Sets
1441 </td></tr>
1441 </td></tr>
1442 <tr><td>
1442 <tr><td>
1443 <a href="/help/glossary">
1443 <a href="/help/glossary">
1444 glossary
1444 glossary
1445 </a>
1445 </a>
1446 </td><td>
1446 </td><td>
1447 Glossary
1447 Glossary
1448 </td></tr>
1448 </td></tr>
1449 <tr><td>
1449 <tr><td>
1450 <a href="/help/hgignore">
1450 <a href="/help/hgignore">
1451 hgignore
1451 hgignore
1452 </a>
1452 </a>
1453 </td><td>
1453 </td><td>
1454 Syntax for Mercurial Ignore Files
1454 Syntax for Mercurial Ignore Files
1455 </td></tr>
1455 </td></tr>
1456 <tr><td>
1456 <tr><td>
1457 <a href="/help/hgweb">
1457 <a href="/help/hgweb">
1458 hgweb
1458 hgweb
1459 </a>
1459 </a>
1460 </td><td>
1460 </td><td>
1461 Configuring hgweb
1461 Configuring hgweb
1462 </td></tr>
1462 </td></tr>
1463 <tr><td>
1463 <tr><td>
1464 <a href="/help/merge-tools">
1464 <a href="/help/merge-tools">
1465 merge-tools
1465 merge-tools
1466 </a>
1466 </a>
1467 </td><td>
1467 </td><td>
1468 Merge Tools
1468 Merge Tools
1469 </td></tr>
1469 </td></tr>
1470 <tr><td>
1470 <tr><td>
1471 <a href="/help/multirevs">
1471 <a href="/help/multirevs">
1472 multirevs
1472 multirevs
1473 </a>
1473 </a>
1474 </td><td>
1474 </td><td>
1475 Specifying Multiple Revisions
1475 Specifying Multiple Revisions
1476 </td></tr>
1476 </td></tr>
1477 <tr><td>
1477 <tr><td>
1478 <a href="/help/patterns">
1478 <a href="/help/patterns">
1479 patterns
1479 patterns
1480 </a>
1480 </a>
1481 </td><td>
1481 </td><td>
1482 File Name Patterns
1482 File Name Patterns
1483 </td></tr>
1483 </td></tr>
1484 <tr><td>
1484 <tr><td>
1485 <a href="/help/phases">
1485 <a href="/help/phases">
1486 phases
1486 phases
1487 </a>
1487 </a>
1488 </td><td>
1488 </td><td>
1489 Working with Phases
1489 Working with Phases
1490 </td></tr>
1490 </td></tr>
1491 <tr><td>
1491 <tr><td>
1492 <a href="/help/revisions">
1492 <a href="/help/revisions">
1493 revisions
1493 revisions
1494 </a>
1494 </a>
1495 </td><td>
1495 </td><td>
1496 Specifying Single Revisions
1496 Specifying Single Revisions
1497 </td></tr>
1497 </td></tr>
1498 <tr><td>
1498 <tr><td>
1499 <a href="/help/revsets">
1499 <a href="/help/revsets">
1500 revsets
1500 revsets
1501 </a>
1501 </a>
1502 </td><td>
1502 </td><td>
1503 Specifying Revision Sets
1503 Specifying Revision Sets
1504 </td></tr>
1504 </td></tr>
1505 <tr><td>
1505 <tr><td>
1506 <a href="/help/scripting">
1506 <a href="/help/scripting">
1507 scripting
1507 scripting
1508 </a>
1508 </a>
1509 </td><td>
1509 </td><td>
1510 Using Mercurial from scripts and automation
1510 Using Mercurial from scripts and automation
1511 </td></tr>
1511 </td></tr>
1512 <tr><td>
1512 <tr><td>
1513 <a href="/help/subrepos">
1513 <a href="/help/subrepos">
1514 subrepos
1514 subrepos
1515 </a>
1515 </a>
1516 </td><td>
1516 </td><td>
1517 Subrepositories
1517 Subrepositories
1518 </td></tr>
1518 </td></tr>
1519 <tr><td>
1519 <tr><td>
1520 <a href="/help/templating">
1520 <a href="/help/templating">
1521 templating
1521 templating
1522 </a>
1522 </a>
1523 </td><td>
1523 </td><td>
1524 Template Usage
1524 Template Usage
1525 </td></tr>
1525 </td></tr>
1526 <tr><td>
1526 <tr><td>
1527 <a href="/help/urls">
1527 <a href="/help/urls">
1528 urls
1528 urls
1529 </a>
1529 </a>
1530 </td><td>
1530 </td><td>
1531 URL Paths
1531 URL Paths
1532 </td></tr>
1532 </td></tr>
1533 <tr><td>
1533 <tr><td>
1534 <a href="/help/topic-containing-verbose">
1534 <a href="/help/topic-containing-verbose">
1535 topic-containing-verbose
1535 topic-containing-verbose
1536 </a>
1536 </a>
1537 </td><td>
1537 </td><td>
1538 This is the topic to test omit indicating.
1538 This is the topic to test omit indicating.
1539 </td></tr>
1539 </td></tr>
1540
1540
1541 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
1541 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
1542
1542
1543 <tr><td>
1543 <tr><td>
1544 <a href="/help/add">
1544 <a href="/help/add">
1545 add
1545 add
1546 </a>
1546 </a>
1547 </td><td>
1547 </td><td>
1548 add the specified files on the next commit
1548 add the specified files on the next commit
1549 </td></tr>
1549 </td></tr>
1550 <tr><td>
1550 <tr><td>
1551 <a href="/help/annotate">
1551 <a href="/help/annotate">
1552 annotate
1552 annotate
1553 </a>
1553 </a>
1554 </td><td>
1554 </td><td>
1555 show changeset information by line for each file
1555 show changeset information by line for each file
1556 </td></tr>
1556 </td></tr>
1557 <tr><td>
1557 <tr><td>
1558 <a href="/help/clone">
1558 <a href="/help/clone">
1559 clone
1559 clone
1560 </a>
1560 </a>
1561 </td><td>
1561 </td><td>
1562 make a copy of an existing repository
1562 make a copy of an existing repository
1563 </td></tr>
1563 </td></tr>
1564 <tr><td>
1564 <tr><td>
1565 <a href="/help/commit">
1565 <a href="/help/commit">
1566 commit
1566 commit
1567 </a>
1567 </a>
1568 </td><td>
1568 </td><td>
1569 commit the specified files or all outstanding changes
1569 commit the specified files or all outstanding changes
1570 </td></tr>
1570 </td></tr>
1571 <tr><td>
1571 <tr><td>
1572 <a href="/help/diff">
1572 <a href="/help/diff">
1573 diff
1573 diff
1574 </a>
1574 </a>
1575 </td><td>
1575 </td><td>
1576 diff repository (or selected files)
1576 diff repository (or selected files)
1577 </td></tr>
1577 </td></tr>
1578 <tr><td>
1578 <tr><td>
1579 <a href="/help/export">
1579 <a href="/help/export">
1580 export
1580 export
1581 </a>
1581 </a>
1582 </td><td>
1582 </td><td>
1583 dump the header and diffs for one or more changesets
1583 dump the header and diffs for one or more changesets
1584 </td></tr>
1584 </td></tr>
1585 <tr><td>
1585 <tr><td>
1586 <a href="/help/forget">
1586 <a href="/help/forget">
1587 forget
1587 forget
1588 </a>
1588 </a>
1589 </td><td>
1589 </td><td>
1590 forget the specified files on the next commit
1590 forget the specified files on the next commit
1591 </td></tr>
1591 </td></tr>
1592 <tr><td>
1592 <tr><td>
1593 <a href="/help/init">
1593 <a href="/help/init">
1594 init
1594 init
1595 </a>
1595 </a>
1596 </td><td>
1596 </td><td>
1597 create a new repository in the given directory
1597 create a new repository in the given directory
1598 </td></tr>
1598 </td></tr>
1599 <tr><td>
1599 <tr><td>
1600 <a href="/help/log">
1600 <a href="/help/log">
1601 log
1601 log
1602 </a>
1602 </a>
1603 </td><td>
1603 </td><td>
1604 show revision history of entire repository or files
1604 show revision history of entire repository or files
1605 </td></tr>
1605 </td></tr>
1606 <tr><td>
1606 <tr><td>
1607 <a href="/help/merge">
1607 <a href="/help/merge">
1608 merge
1608 merge
1609 </a>
1609 </a>
1610 </td><td>
1610 </td><td>
1611 merge another revision into working directory
1611 merge another revision into working directory
1612 </td></tr>
1612 </td></tr>
1613 <tr><td>
1613 <tr><td>
1614 <a href="/help/pull">
1614 <a href="/help/pull">
1615 pull
1615 pull
1616 </a>
1616 </a>
1617 </td><td>
1617 </td><td>
1618 pull changes from the specified source
1618 pull changes from the specified source
1619 </td></tr>
1619 </td></tr>
1620 <tr><td>
1620 <tr><td>
1621 <a href="/help/push">
1621 <a href="/help/push">
1622 push
1622 push
1623 </a>
1623 </a>
1624 </td><td>
1624 </td><td>
1625 push changes to the specified destination
1625 push changes to the specified destination
1626 </td></tr>
1626 </td></tr>
1627 <tr><td>
1627 <tr><td>
1628 <a href="/help/remove">
1628 <a href="/help/remove">
1629 remove
1629 remove
1630 </a>
1630 </a>
1631 </td><td>
1631 </td><td>
1632 remove the specified files on the next commit
1632 remove the specified files on the next commit
1633 </td></tr>
1633 </td></tr>
1634 <tr><td>
1634 <tr><td>
1635 <a href="/help/serve">
1635 <a href="/help/serve">
1636 serve
1636 serve
1637 </a>
1637 </a>
1638 </td><td>
1638 </td><td>
1639 start stand-alone webserver
1639 start stand-alone webserver
1640 </td></tr>
1640 </td></tr>
1641 <tr><td>
1641 <tr><td>
1642 <a href="/help/status">
1642 <a href="/help/status">
1643 status
1643 status
1644 </a>
1644 </a>
1645 </td><td>
1645 </td><td>
1646 show changed files in the working directory
1646 show changed files in the working directory
1647 </td></tr>
1647 </td></tr>
1648 <tr><td>
1648 <tr><td>
1649 <a href="/help/summary">
1649 <a href="/help/summary">
1650 summary
1650 summary
1651 </a>
1651 </a>
1652 </td><td>
1652 </td><td>
1653 summarize working directory state
1653 summarize working directory state
1654 </td></tr>
1654 </td></tr>
1655 <tr><td>
1655 <tr><td>
1656 <a href="/help/update">
1656 <a href="/help/update">
1657 update
1657 update
1658 </a>
1658 </a>
1659 </td><td>
1659 </td><td>
1660 update working directory (or switch revisions)
1660 update working directory (or switch revisions)
1661 </td></tr>
1661 </td></tr>
1662
1662
1663 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
1663 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
1664
1664
1665 <tr><td>
1665 <tr><td>
1666 <a href="/help/addremove">
1666 <a href="/help/addremove">
1667 addremove
1667 addremove
1668 </a>
1668 </a>
1669 </td><td>
1669 </td><td>
1670 add all new files, delete all missing files
1670 add all new files, delete all missing files
1671 </td></tr>
1671 </td></tr>
1672 <tr><td>
1672 <tr><td>
1673 <a href="/help/archive">
1673 <a href="/help/archive">
1674 archive
1674 archive
1675 </a>
1675 </a>
1676 </td><td>
1676 </td><td>
1677 create an unversioned archive of a repository revision
1677 create an unversioned archive of a repository revision
1678 </td></tr>
1678 </td></tr>
1679 <tr><td>
1679 <tr><td>
1680 <a href="/help/backout">
1680 <a href="/help/backout">
1681 backout
1681 backout
1682 </a>
1682 </a>
1683 </td><td>
1683 </td><td>
1684 reverse effect of earlier changeset
1684 reverse effect of earlier changeset
1685 </td></tr>
1685 </td></tr>
1686 <tr><td>
1686 <tr><td>
1687 <a href="/help/bisect">
1687 <a href="/help/bisect">
1688 bisect
1688 bisect
1689 </a>
1689 </a>
1690 </td><td>
1690 </td><td>
1691 subdivision search of changesets
1691 subdivision search of changesets
1692 </td></tr>
1692 </td></tr>
1693 <tr><td>
1693 <tr><td>
1694 <a href="/help/bookmarks">
1694 <a href="/help/bookmarks">
1695 bookmarks
1695 bookmarks
1696 </a>
1696 </a>
1697 </td><td>
1697 </td><td>
1698 create a new bookmark or list existing bookmarks
1698 create a new bookmark or list existing bookmarks
1699 </td></tr>
1699 </td></tr>
1700 <tr><td>
1700 <tr><td>
1701 <a href="/help/branch">
1701 <a href="/help/branch">
1702 branch
1702 branch
1703 </a>
1703 </a>
1704 </td><td>
1704 </td><td>
1705 set or show the current branch name
1705 set or show the current branch name
1706 </td></tr>
1706 </td></tr>
1707 <tr><td>
1707 <tr><td>
1708 <a href="/help/branches">
1708 <a href="/help/branches">
1709 branches
1709 branches
1710 </a>
1710 </a>
1711 </td><td>
1711 </td><td>
1712 list repository named branches
1712 list repository named branches
1713 </td></tr>
1713 </td></tr>
1714 <tr><td>
1714 <tr><td>
1715 <a href="/help/bundle">
1715 <a href="/help/bundle">
1716 bundle
1716 bundle
1717 </a>
1717 </a>
1718 </td><td>
1718 </td><td>
1719 create a changegroup file
1719 create a changegroup file
1720 </td></tr>
1720 </td></tr>
1721 <tr><td>
1721 <tr><td>
1722 <a href="/help/cat">
1722 <a href="/help/cat">
1723 cat
1723 cat
1724 </a>
1724 </a>
1725 </td><td>
1725 </td><td>
1726 output the current or given revision of files
1726 output the current or given revision of files
1727 </td></tr>
1727 </td></tr>
1728 <tr><td>
1728 <tr><td>
1729 <a href="/help/config">
1729 <a href="/help/config">
1730 config
1730 config
1731 </a>
1731 </a>
1732 </td><td>
1732 </td><td>
1733 show combined config settings from all hgrc files
1733 show combined config settings from all hgrc files
1734 </td></tr>
1734 </td></tr>
1735 <tr><td>
1735 <tr><td>
1736 <a href="/help/copy">
1736 <a href="/help/copy">
1737 copy
1737 copy
1738 </a>
1738 </a>
1739 </td><td>
1739 </td><td>
1740 mark files as copied for the next commit
1740 mark files as copied for the next commit
1741 </td></tr>
1741 </td></tr>
1742 <tr><td>
1742 <tr><td>
1743 <a href="/help/files">
1743 <a href="/help/files">
1744 files
1744 files
1745 </a>
1745 </a>
1746 </td><td>
1746 </td><td>
1747 list tracked files
1747 list tracked files
1748 </td></tr>
1748 </td></tr>
1749 <tr><td>
1749 <tr><td>
1750 <a href="/help/graft">
1750 <a href="/help/graft">
1751 graft
1751 graft
1752 </a>
1752 </a>
1753 </td><td>
1753 </td><td>
1754 copy changes from other branches onto the current branch
1754 copy changes from other branches onto the current branch
1755 </td></tr>
1755 </td></tr>
1756 <tr><td>
1756 <tr><td>
1757 <a href="/help/grep">
1757 <a href="/help/grep">
1758 grep
1758 grep
1759 </a>
1759 </a>
1760 </td><td>
1760 </td><td>
1761 search for a pattern in specified files and revisions
1761 search for a pattern in specified files and revisions
1762 </td></tr>
1762 </td></tr>
1763 <tr><td>
1763 <tr><td>
1764 <a href="/help/heads">
1764 <a href="/help/heads">
1765 heads
1765 heads
1766 </a>
1766 </a>
1767 </td><td>
1767 </td><td>
1768 show branch heads
1768 show branch heads
1769 </td></tr>
1769 </td></tr>
1770 <tr><td>
1770 <tr><td>
1771 <a href="/help/help">
1771 <a href="/help/help">
1772 help
1772 help
1773 </a>
1773 </a>
1774 </td><td>
1774 </td><td>
1775 show help for a given topic or a help overview
1775 show help for a given topic or a help overview
1776 </td></tr>
1776 </td></tr>
1777 <tr><td>
1777 <tr><td>
1778 <a href="/help/identify">
1778 <a href="/help/identify">
1779 identify
1779 identify
1780 </a>
1780 </a>
1781 </td><td>
1781 </td><td>
1782 identify the working directory or specified revision
1782 identify the working directory or specified revision
1783 </td></tr>
1783 </td></tr>
1784 <tr><td>
1784 <tr><td>
1785 <a href="/help/import">
1785 <a href="/help/import">
1786 import
1786 import
1787 </a>
1787 </a>
1788 </td><td>
1788 </td><td>
1789 import an ordered set of patches
1789 import an ordered set of patches
1790 </td></tr>
1790 </td></tr>
1791 <tr><td>
1791 <tr><td>
1792 <a href="/help/incoming">
1792 <a href="/help/incoming">
1793 incoming
1793 incoming
1794 </a>
1794 </a>
1795 </td><td>
1795 </td><td>
1796 show new changesets found in source
1796 show new changesets found in source
1797 </td></tr>
1797 </td></tr>
1798 <tr><td>
1798 <tr><td>
1799 <a href="/help/manifest">
1799 <a href="/help/manifest">
1800 manifest
1800 manifest
1801 </a>
1801 </a>
1802 </td><td>
1802 </td><td>
1803 output the current or given revision of the project manifest
1803 output the current or given revision of the project manifest
1804 </td></tr>
1804 </td></tr>
1805 <tr><td>
1805 <tr><td>
1806 <a href="/help/nohelp">
1806 <a href="/help/nohelp">
1807 nohelp
1807 nohelp
1808 </a>
1808 </a>
1809 </td><td>
1809 </td><td>
1810 (no help text available)
1810 (no help text available)
1811 </td></tr>
1811 </td></tr>
1812 <tr><td>
1812 <tr><td>
1813 <a href="/help/outgoing">
1813 <a href="/help/outgoing">
1814 outgoing
1814 outgoing
1815 </a>
1815 </a>
1816 </td><td>
1816 </td><td>
1817 show changesets not found in the destination
1817 show changesets not found in the destination
1818 </td></tr>
1818 </td></tr>
1819 <tr><td>
1819 <tr><td>
1820 <a href="/help/paths">
1820 <a href="/help/paths">
1821 paths
1821 paths
1822 </a>
1822 </a>
1823 </td><td>
1823 </td><td>
1824 show aliases for remote repositories
1824 show aliases for remote repositories
1825 </td></tr>
1825 </td></tr>
1826 <tr><td>
1826 <tr><td>
1827 <a href="/help/phase">
1827 <a href="/help/phase">
1828 phase
1828 phase
1829 </a>
1829 </a>
1830 </td><td>
1830 </td><td>
1831 set or show the current phase name
1831 set or show the current phase name
1832 </td></tr>
1832 </td></tr>
1833 <tr><td>
1833 <tr><td>
1834 <a href="/help/recover">
1834 <a href="/help/recover">
1835 recover
1835 recover
1836 </a>
1836 </a>
1837 </td><td>
1837 </td><td>
1838 roll back an interrupted transaction
1838 roll back an interrupted transaction
1839 </td></tr>
1839 </td></tr>
1840 <tr><td>
1840 <tr><td>
1841 <a href="/help/rename">
1841 <a href="/help/rename">
1842 rename
1842 rename
1843 </a>
1843 </a>
1844 </td><td>
1844 </td><td>
1845 rename files; equivalent of copy + remove
1845 rename files; equivalent of copy + remove
1846 </td></tr>
1846 </td></tr>
1847 <tr><td>
1847 <tr><td>
1848 <a href="/help/resolve">
1848 <a href="/help/resolve">
1849 resolve
1849 resolve
1850 </a>
1850 </a>
1851 </td><td>
1851 </td><td>
1852 redo merges or set/view the merge status of files
1852 redo merges or set/view the merge status of files
1853 </td></tr>
1853 </td></tr>
1854 <tr><td>
1854 <tr><td>
1855 <a href="/help/revert">
1855 <a href="/help/revert">
1856 revert
1856 revert
1857 </a>
1857 </a>
1858 </td><td>
1858 </td><td>
1859 restore files to their checkout state
1859 restore files to their checkout state
1860 </td></tr>
1860 </td></tr>
1861 <tr><td>
1861 <tr><td>
1862 <a href="/help/root">
1862 <a href="/help/root">
1863 root
1863 root
1864 </a>
1864 </a>
1865 </td><td>
1865 </td><td>
1866 print the root (top) of the current working directory
1866 print the root (top) of the current working directory
1867 </td></tr>
1867 </td></tr>
1868 <tr><td>
1868 <tr><td>
1869 <a href="/help/tag">
1869 <a href="/help/tag">
1870 tag
1870 tag
1871 </a>
1871 </a>
1872 </td><td>
1872 </td><td>
1873 add one or more tags for the current or given revision
1873 add one or more tags for the current or given revision
1874 </td></tr>
1874 </td></tr>
1875 <tr><td>
1875 <tr><td>
1876 <a href="/help/tags">
1876 <a href="/help/tags">
1877 tags
1877 tags
1878 </a>
1878 </a>
1879 </td><td>
1879 </td><td>
1880 list repository tags
1880 list repository tags
1881 </td></tr>
1881 </td></tr>
1882 <tr><td>
1882 <tr><td>
1883 <a href="/help/unbundle">
1883 <a href="/help/unbundle">
1884 unbundle
1884 unbundle
1885 </a>
1885 </a>
1886 </td><td>
1886 </td><td>
1887 apply one or more changegroup files
1887 apply one or more changegroup files
1888 </td></tr>
1888 </td></tr>
1889 <tr><td>
1889 <tr><td>
1890 <a href="/help/verify">
1890 <a href="/help/verify">
1891 verify
1891 verify
1892 </a>
1892 </a>
1893 </td><td>
1893 </td><td>
1894 verify the integrity of the repository
1894 verify the integrity of the repository
1895 </td></tr>
1895 </td></tr>
1896 <tr><td>
1896 <tr><td>
1897 <a href="/help/version">
1897 <a href="/help/version">
1898 version
1898 version
1899 </a>
1899 </a>
1900 </td><td>
1900 </td><td>
1901 output version and copyright information
1901 output version and copyright information
1902 </td></tr>
1902 </td></tr>
1903 </table>
1903 </table>
1904 </div>
1904 </div>
1905 </div>
1905 </div>
1906
1906
1907 <script type="text/javascript">process_dates()</script>
1907 <script type="text/javascript">process_dates()</script>
1908
1908
1909
1909
1910 </body>
1910 </body>
1911 </html>
1911 </html>
1912
1912
1913
1913
1914 $ get-with-headers.py 127.0.0.1:$HGPORT "help/add"
1914 $ get-with-headers.py 127.0.0.1:$HGPORT "help/add"
1915 200 Script output follows
1915 200 Script output follows
1916
1916
1917 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1917 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1918 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1918 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1919 <head>
1919 <head>
1920 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1920 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1921 <meta name="robots" content="index, nofollow" />
1921 <meta name="robots" content="index, nofollow" />
1922 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1922 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1923 <script type="text/javascript" src="/static/mercurial.js"></script>
1923 <script type="text/javascript" src="/static/mercurial.js"></script>
1924
1924
1925 <title>Help: add</title>
1925 <title>Help: add</title>
1926 </head>
1926 </head>
1927 <body>
1927 <body>
1928
1928
1929 <div class="container">
1929 <div class="container">
1930 <div class="menu">
1930 <div class="menu">
1931 <div class="logo">
1931 <div class="logo">
1932 <a href="http://mercurial.selenic.com/">
1932 <a href="http://mercurial.selenic.com/">
1933 <img src="/static/hglogo.png" alt="mercurial" /></a>
1933 <img src="/static/hglogo.png" alt="mercurial" /></a>
1934 </div>
1934 </div>
1935 <ul>
1935 <ul>
1936 <li><a href="/shortlog">log</a></li>
1936 <li><a href="/shortlog">log</a></li>
1937 <li><a href="/graph">graph</a></li>
1937 <li><a href="/graph">graph</a></li>
1938 <li><a href="/tags">tags</a></li>
1938 <li><a href="/tags">tags</a></li>
1939 <li><a href="/bookmarks">bookmarks</a></li>
1939 <li><a href="/bookmarks">bookmarks</a></li>
1940 <li><a href="/branches">branches</a></li>
1940 <li><a href="/branches">branches</a></li>
1941 </ul>
1941 </ul>
1942 <ul>
1942 <ul>
1943 <li class="active"><a href="/help">help</a></li>
1943 <li class="active"><a href="/help">help</a></li>
1944 </ul>
1944 </ul>
1945 </div>
1945 </div>
1946
1946
1947 <div class="main">
1947 <div class="main">
1948 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1948 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1949 <h3>Help: add</h3>
1949 <h3>Help: add</h3>
1950
1950
1951 <form class="search" action="/log">
1951 <form class="search" action="/log">
1952
1952
1953 <p><input name="rev" id="search1" type="text" size="30" /></p>
1953 <p><input name="rev" id="search1" type="text" size="30" /></p>
1954 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1954 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1955 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1955 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1956 </form>
1956 </form>
1957 <div id="doc">
1957 <div id="doc">
1958 <p>
1958 <p>
1959 hg add [OPTION]... [FILE]...
1959 hg add [OPTION]... [FILE]...
1960 </p>
1960 </p>
1961 <p>
1961 <p>
1962 add the specified files on the next commit
1962 add the specified files on the next commit
1963 </p>
1963 </p>
1964 <p>
1964 <p>
1965 Schedule files to be version controlled and added to the
1965 Schedule files to be version controlled and added to the
1966 repository.
1966 repository.
1967 </p>
1967 </p>
1968 <p>
1968 <p>
1969 The files will be added to the repository at the next commit. To
1969 The files will be added to the repository at the next commit. To
1970 undo an add before that, see &quot;hg forget&quot;.
1970 undo an add before that, see &quot;hg forget&quot;.
1971 </p>
1971 </p>
1972 <p>
1972 <p>
1973 If no names are given, add all files to the repository.
1973 If no names are given, add all files to the repository.
1974 </p>
1974 </p>
1975 <p>
1975 <p>
1976 An example showing how new (unknown) files are added
1976 An example showing how new (unknown) files are added
1977 automatically by &quot;hg add&quot;:
1977 automatically by &quot;hg add&quot;:
1978 </p>
1978 </p>
1979 <pre>
1979 <pre>
1980 \$ ls (re)
1980 \$ ls (re)
1981 foo.c
1981 foo.c
1982 \$ hg status (re)
1982 \$ hg status (re)
1983 ? foo.c
1983 ? foo.c
1984 \$ hg add (re)
1984 \$ hg add (re)
1985 adding foo.c
1985 adding foo.c
1986 \$ hg status (re)
1986 \$ hg status (re)
1987 A foo.c
1987 A foo.c
1988 </pre>
1988 </pre>
1989 <p>
1989 <p>
1990 Returns 0 if all files are successfully added.
1990 Returns 0 if all files are successfully added.
1991 </p>
1991 </p>
1992 <p>
1992 <p>
1993 options ([+] can be repeated):
1993 options ([+] can be repeated):
1994 </p>
1994 </p>
1995 <table>
1995 <table>
1996 <tr><td>-I</td>
1996 <tr><td>-I</td>
1997 <td>--include PATTERN [+]</td>
1997 <td>--include PATTERN [+]</td>
1998 <td>include names matching the given patterns</td></tr>
1998 <td>include names matching the given patterns</td></tr>
1999 <tr><td>-X</td>
1999 <tr><td>-X</td>
2000 <td>--exclude PATTERN [+]</td>
2000 <td>--exclude PATTERN [+]</td>
2001 <td>exclude names matching the given patterns</td></tr>
2001 <td>exclude names matching the given patterns</td></tr>
2002 <tr><td>-S</td>
2002 <tr><td>-S</td>
2003 <td>--subrepos</td>
2003 <td>--subrepos</td>
2004 <td>recurse into subrepositories</td></tr>
2004 <td>recurse into subrepositories</td></tr>
2005 <tr><td>-n</td>
2005 <tr><td>-n</td>
2006 <td>--dry-run</td>
2006 <td>--dry-run</td>
2007 <td>do not perform actions, just print output</td></tr>
2007 <td>do not perform actions, just print output</td></tr>
2008 </table>
2008 </table>
2009 <p>
2009 <p>
2010 global options ([+] can be repeated):
2010 global options ([+] can be repeated):
2011 </p>
2011 </p>
2012 <table>
2012 <table>
2013 <tr><td>-R</td>
2013 <tr><td>-R</td>
2014 <td>--repository REPO</td>
2014 <td>--repository REPO</td>
2015 <td>repository root directory or name of overlay bundle file</td></tr>
2015 <td>repository root directory or name of overlay bundle file</td></tr>
2016 <tr><td></td>
2016 <tr><td></td>
2017 <td>--cwd DIR</td>
2017 <td>--cwd DIR</td>
2018 <td>change working directory</td></tr>
2018 <td>change working directory</td></tr>
2019 <tr><td>-y</td>
2019 <tr><td>-y</td>
2020 <td>--noninteractive</td>
2020 <td>--noninteractive</td>
2021 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2021 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2022 <tr><td>-q</td>
2022 <tr><td>-q</td>
2023 <td>--quiet</td>
2023 <td>--quiet</td>
2024 <td>suppress output</td></tr>
2024 <td>suppress output</td></tr>
2025 <tr><td>-v</td>
2025 <tr><td>-v</td>
2026 <td>--verbose</td>
2026 <td>--verbose</td>
2027 <td>enable additional output</td></tr>
2027 <td>enable additional output</td></tr>
2028 <tr><td></td>
2028 <tr><td></td>
2029 <td>--config CONFIG [+]</td>
2029 <td>--config CONFIG [+]</td>
2030 <td>set/override config option (use 'section.name=value')</td></tr>
2030 <td>set/override config option (use 'section.name=value')</td></tr>
2031 <tr><td></td>
2031 <tr><td></td>
2032 <td>--debug</td>
2032 <td>--debug</td>
2033 <td>enable debugging output</td></tr>
2033 <td>enable debugging output</td></tr>
2034 <tr><td></td>
2034 <tr><td></td>
2035 <td>--debugger</td>
2035 <td>--debugger</td>
2036 <td>start debugger</td></tr>
2036 <td>start debugger</td></tr>
2037 <tr><td></td>
2037 <tr><td></td>
2038 <td>--encoding ENCODE</td>
2038 <td>--encoding ENCODE</td>
2039 <td>set the charset encoding (default: ascii)</td></tr>
2039 <td>set the charset encoding (default: ascii)</td></tr>
2040 <tr><td></td>
2040 <tr><td></td>
2041 <td>--encodingmode MODE</td>
2041 <td>--encodingmode MODE</td>
2042 <td>set the charset encoding mode (default: strict)</td></tr>
2042 <td>set the charset encoding mode (default: strict)</td></tr>
2043 <tr><td></td>
2043 <tr><td></td>
2044 <td>--traceback</td>
2044 <td>--traceback</td>
2045 <td>always print a traceback on exception</td></tr>
2045 <td>always print a traceback on exception</td></tr>
2046 <tr><td></td>
2046 <tr><td></td>
2047 <td>--time</td>
2047 <td>--time</td>
2048 <td>time how long the command takes</td></tr>
2048 <td>time how long the command takes</td></tr>
2049 <tr><td></td>
2049 <tr><td></td>
2050 <td>--profile</td>
2050 <td>--profile</td>
2051 <td>print command execution profile</td></tr>
2051 <td>print command execution profile</td></tr>
2052 <tr><td></td>
2052 <tr><td></td>
2053 <td>--version</td>
2053 <td>--version</td>
2054 <td>output version information and exit</td></tr>
2054 <td>output version information and exit</td></tr>
2055 <tr><td>-h</td>
2055 <tr><td>-h</td>
2056 <td>--help</td>
2056 <td>--help</td>
2057 <td>display help and exit</td></tr>
2057 <td>display help and exit</td></tr>
2058 <tr><td></td>
2058 <tr><td></td>
2059 <td>--hidden</td>
2059 <td>--hidden</td>
2060 <td>consider hidden changesets</td></tr>
2060 <td>consider hidden changesets</td></tr>
2061 </table>
2061 </table>
2062
2062
2063 </div>
2063 </div>
2064 </div>
2064 </div>
2065 </div>
2065 </div>
2066
2066
2067 <script type="text/javascript">process_dates()</script>
2067 <script type="text/javascript">process_dates()</script>
2068
2068
2069
2069
2070 </body>
2070 </body>
2071 </html>
2071 </html>
2072
2072
2073
2073
2074 $ get-with-headers.py 127.0.0.1:$HGPORT "help/remove"
2074 $ get-with-headers.py 127.0.0.1:$HGPORT "help/remove"
2075 200 Script output follows
2075 200 Script output follows
2076
2076
2077 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2077 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2078 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2078 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2079 <head>
2079 <head>
2080 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2080 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2081 <meta name="robots" content="index, nofollow" />
2081 <meta name="robots" content="index, nofollow" />
2082 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2082 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2083 <script type="text/javascript" src="/static/mercurial.js"></script>
2083 <script type="text/javascript" src="/static/mercurial.js"></script>
2084
2084
2085 <title>Help: remove</title>
2085 <title>Help: remove</title>
2086 </head>
2086 </head>
2087 <body>
2087 <body>
2088
2088
2089 <div class="container">
2089 <div class="container">
2090 <div class="menu">
2090 <div class="menu">
2091 <div class="logo">
2091 <div class="logo">
2092 <a href="http://mercurial.selenic.com/">
2092 <a href="http://mercurial.selenic.com/">
2093 <img src="/static/hglogo.png" alt="mercurial" /></a>
2093 <img src="/static/hglogo.png" alt="mercurial" /></a>
2094 </div>
2094 </div>
2095 <ul>
2095 <ul>
2096 <li><a href="/shortlog">log</a></li>
2096 <li><a href="/shortlog">log</a></li>
2097 <li><a href="/graph">graph</a></li>
2097 <li><a href="/graph">graph</a></li>
2098 <li><a href="/tags">tags</a></li>
2098 <li><a href="/tags">tags</a></li>
2099 <li><a href="/bookmarks">bookmarks</a></li>
2099 <li><a href="/bookmarks">bookmarks</a></li>
2100 <li><a href="/branches">branches</a></li>
2100 <li><a href="/branches">branches</a></li>
2101 </ul>
2101 </ul>
2102 <ul>
2102 <ul>
2103 <li class="active"><a href="/help">help</a></li>
2103 <li class="active"><a href="/help">help</a></li>
2104 </ul>
2104 </ul>
2105 </div>
2105 </div>
2106
2106
2107 <div class="main">
2107 <div class="main">
2108 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2108 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2109 <h3>Help: remove</h3>
2109 <h3>Help: remove</h3>
2110
2110
2111 <form class="search" action="/log">
2111 <form class="search" action="/log">
2112
2112
2113 <p><input name="rev" id="search1" type="text" size="30" /></p>
2113 <p><input name="rev" id="search1" type="text" size="30" /></p>
2114 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2114 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2115 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2115 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2116 </form>
2116 </form>
2117 <div id="doc">
2117 <div id="doc">
2118 <p>
2118 <p>
2119 hg remove [OPTION]... FILE...
2119 hg remove [OPTION]... FILE...
2120 </p>
2120 </p>
2121 <p>
2121 <p>
2122 aliases: rm
2122 aliases: rm
2123 </p>
2123 </p>
2124 <p>
2124 <p>
2125 remove the specified files on the next commit
2125 remove the specified files on the next commit
2126 </p>
2126 </p>
2127 <p>
2127 <p>
2128 Schedule the indicated files for removal from the current branch.
2128 Schedule the indicated files for removal from the current branch.
2129 </p>
2129 </p>
2130 <p>
2130 <p>
2131 This command schedules the files to be removed at the next commit.
2131 This command schedules the files to be removed at the next commit.
2132 To undo a remove before that, see &quot;hg revert&quot;. To undo added
2132 To undo a remove before that, see &quot;hg revert&quot;. To undo added
2133 files, see &quot;hg forget&quot;.
2133 files, see &quot;hg forget&quot;.
2134 </p>
2134 </p>
2135 <p>
2135 <p>
2136 -A/--after can be used to remove only files that have already
2136 -A/--after can be used to remove only files that have already
2137 been deleted, -f/--force can be used to force deletion, and -Af
2137 been deleted, -f/--force can be used to force deletion, and -Af
2138 can be used to remove files from the next revision without
2138 can be used to remove files from the next revision without
2139 deleting them from the working directory.
2139 deleting them from the working directory.
2140 </p>
2140 </p>
2141 <p>
2141 <p>
2142 The following table details the behavior of remove for different
2142 The following table details the behavior of remove for different
2143 file states (columns) and option combinations (rows). The file
2143 file states (columns) and option combinations (rows). The file
2144 states are Added [A], Clean [C], Modified [M] and Missing [!]
2144 states are Added [A], Clean [C], Modified [M] and Missing [!]
2145 (as reported by &quot;hg status&quot;). The actions are Warn, Remove
2145 (as reported by &quot;hg status&quot;). The actions are Warn, Remove
2146 (from branch) and Delete (from disk):
2146 (from branch) and Delete (from disk):
2147 </p>
2147 </p>
2148 <table>
2148 <table>
2149 <tr><td>opt/state</td>
2149 <tr><td>opt/state</td>
2150 <td>A</td>
2150 <td>A</td>
2151 <td>C</td>
2151 <td>C</td>
2152 <td>M</td>
2152 <td>M</td>
2153 <td>!</td></tr>
2153 <td>!</td></tr>
2154 <tr><td>none</td>
2154 <tr><td>none</td>
2155 <td>W</td>
2155 <td>W</td>
2156 <td>RD</td>
2156 <td>RD</td>
2157 <td>W</td>
2157 <td>W</td>
2158 <td>R</td></tr>
2158 <td>R</td></tr>
2159 <tr><td>-f</td>
2159 <tr><td>-f</td>
2160 <td>R</td>
2160 <td>R</td>
2161 <td>RD</td>
2161 <td>RD</td>
2162 <td>RD</td>
2162 <td>RD</td>
2163 <td>R</td></tr>
2163 <td>R</td></tr>
2164 <tr><td>-A</td>
2164 <tr><td>-A</td>
2165 <td>W</td>
2165 <td>W</td>
2166 <td>W</td>
2166 <td>W</td>
2167 <td>W</td>
2167 <td>W</td>
2168 <td>R</td></tr>
2168 <td>R</td></tr>
2169 <tr><td>-Af</td>
2169 <tr><td>-Af</td>
2170 <td>R</td>
2170 <td>R</td>
2171 <td>R</td>
2171 <td>R</td>
2172 <td>R</td>
2172 <td>R</td>
2173 <td>R</td></tr>
2173 <td>R</td></tr>
2174 </table>
2174 </table>
2175 <p>
2175 <p>
2176 Note that remove never deletes files in Added [A] state from the
2176 Note that remove never deletes files in Added [A] state from the
2177 working directory, not even if option --force is specified.
2177 working directory, not even if option --force is specified.
2178 </p>
2178 </p>
2179 <p>
2179 <p>
2180 Returns 0 on success, 1 if any warnings encountered.
2180 Returns 0 on success, 1 if any warnings encountered.
2181 </p>
2181 </p>
2182 <p>
2182 <p>
2183 options ([+] can be repeated):
2183 options ([+] can be repeated):
2184 </p>
2184 </p>
2185 <table>
2185 <table>
2186 <tr><td>-A</td>
2186 <tr><td>-A</td>
2187 <td>--after</td>
2187 <td>--after</td>
2188 <td>record delete for missing files</td></tr>
2188 <td>record delete for missing files</td></tr>
2189 <tr><td>-f</td>
2189 <tr><td>-f</td>
2190 <td>--force</td>
2190 <td>--force</td>
2191 <td>remove (and delete) file even if added or modified</td></tr>
2191 <td>remove (and delete) file even if added or modified</td></tr>
2192 <tr><td>-S</td>
2192 <tr><td>-S</td>
2193 <td>--subrepos</td>
2193 <td>--subrepos</td>
2194 <td>recurse into subrepositories</td></tr>
2194 <td>recurse into subrepositories</td></tr>
2195 <tr><td>-I</td>
2195 <tr><td>-I</td>
2196 <td>--include PATTERN [+]</td>
2196 <td>--include PATTERN [+]</td>
2197 <td>include names matching the given patterns</td></tr>
2197 <td>include names matching the given patterns</td></tr>
2198 <tr><td>-X</td>
2198 <tr><td>-X</td>
2199 <td>--exclude PATTERN [+]</td>
2199 <td>--exclude PATTERN [+]</td>
2200 <td>exclude names matching the given patterns</td></tr>
2200 <td>exclude names matching the given patterns</td></tr>
2201 </table>
2201 </table>
2202 <p>
2202 <p>
2203 global options ([+] can be repeated):
2203 global options ([+] can be repeated):
2204 </p>
2204 </p>
2205 <table>
2205 <table>
2206 <tr><td>-R</td>
2206 <tr><td>-R</td>
2207 <td>--repository REPO</td>
2207 <td>--repository REPO</td>
2208 <td>repository root directory or name of overlay bundle file</td></tr>
2208 <td>repository root directory or name of overlay bundle file</td></tr>
2209 <tr><td></td>
2209 <tr><td></td>
2210 <td>--cwd DIR</td>
2210 <td>--cwd DIR</td>
2211 <td>change working directory</td></tr>
2211 <td>change working directory</td></tr>
2212 <tr><td>-y</td>
2212 <tr><td>-y</td>
2213 <td>--noninteractive</td>
2213 <td>--noninteractive</td>
2214 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2214 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2215 <tr><td>-q</td>
2215 <tr><td>-q</td>
2216 <td>--quiet</td>
2216 <td>--quiet</td>
2217 <td>suppress output</td></tr>
2217 <td>suppress output</td></tr>
2218 <tr><td>-v</td>
2218 <tr><td>-v</td>
2219 <td>--verbose</td>
2219 <td>--verbose</td>
2220 <td>enable additional output</td></tr>
2220 <td>enable additional output</td></tr>
2221 <tr><td></td>
2221 <tr><td></td>
2222 <td>--config CONFIG [+]</td>
2222 <td>--config CONFIG [+]</td>
2223 <td>set/override config option (use 'section.name=value')</td></tr>
2223 <td>set/override config option (use 'section.name=value')</td></tr>
2224 <tr><td></td>
2224 <tr><td></td>
2225 <td>--debug</td>
2225 <td>--debug</td>
2226 <td>enable debugging output</td></tr>
2226 <td>enable debugging output</td></tr>
2227 <tr><td></td>
2227 <tr><td></td>
2228 <td>--debugger</td>
2228 <td>--debugger</td>
2229 <td>start debugger</td></tr>
2229 <td>start debugger</td></tr>
2230 <tr><td></td>
2230 <tr><td></td>
2231 <td>--encoding ENCODE</td>
2231 <td>--encoding ENCODE</td>
2232 <td>set the charset encoding (default: ascii)</td></tr>
2232 <td>set the charset encoding (default: ascii)</td></tr>
2233 <tr><td></td>
2233 <tr><td></td>
2234 <td>--encodingmode MODE</td>
2234 <td>--encodingmode MODE</td>
2235 <td>set the charset encoding mode (default: strict)</td></tr>
2235 <td>set the charset encoding mode (default: strict)</td></tr>
2236 <tr><td></td>
2236 <tr><td></td>
2237 <td>--traceback</td>
2237 <td>--traceback</td>
2238 <td>always print a traceback on exception</td></tr>
2238 <td>always print a traceback on exception</td></tr>
2239 <tr><td></td>
2239 <tr><td></td>
2240 <td>--time</td>
2240 <td>--time</td>
2241 <td>time how long the command takes</td></tr>
2241 <td>time how long the command takes</td></tr>
2242 <tr><td></td>
2242 <tr><td></td>
2243 <td>--profile</td>
2243 <td>--profile</td>
2244 <td>print command execution profile</td></tr>
2244 <td>print command execution profile</td></tr>
2245 <tr><td></td>
2245 <tr><td></td>
2246 <td>--version</td>
2246 <td>--version</td>
2247 <td>output version information and exit</td></tr>
2247 <td>output version information and exit</td></tr>
2248 <tr><td>-h</td>
2248 <tr><td>-h</td>
2249 <td>--help</td>
2249 <td>--help</td>
2250 <td>display help and exit</td></tr>
2250 <td>display help and exit</td></tr>
2251 <tr><td></td>
2251 <tr><td></td>
2252 <td>--hidden</td>
2252 <td>--hidden</td>
2253 <td>consider hidden changesets</td></tr>
2253 <td>consider hidden changesets</td></tr>
2254 </table>
2254 </table>
2255
2255
2256 </div>
2256 </div>
2257 </div>
2257 </div>
2258 </div>
2258 </div>
2259
2259
2260 <script type="text/javascript">process_dates()</script>
2260 <script type="text/javascript">process_dates()</script>
2261
2261
2262
2262
2263 </body>
2263 </body>
2264 </html>
2264 </html>
2265
2265
2266
2266
2267 $ get-with-headers.py 127.0.0.1:$HGPORT "help/revisions"
2267 $ get-with-headers.py 127.0.0.1:$HGPORT "help/revisions"
2268 200 Script output follows
2268 200 Script output follows
2269
2269
2270 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2270 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2271 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2271 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2272 <head>
2272 <head>
2273 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2273 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2274 <meta name="robots" content="index, nofollow" />
2274 <meta name="robots" content="index, nofollow" />
2275 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2275 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2276 <script type="text/javascript" src="/static/mercurial.js"></script>
2276 <script type="text/javascript" src="/static/mercurial.js"></script>
2277
2277
2278 <title>Help: revisions</title>
2278 <title>Help: revisions</title>
2279 </head>
2279 </head>
2280 <body>
2280 <body>
2281
2281
2282 <div class="container">
2282 <div class="container">
2283 <div class="menu">
2283 <div class="menu">
2284 <div class="logo">
2284 <div class="logo">
2285 <a href="http://mercurial.selenic.com/">
2285 <a href="http://mercurial.selenic.com/">
2286 <img src="/static/hglogo.png" alt="mercurial" /></a>
2286 <img src="/static/hglogo.png" alt="mercurial" /></a>
2287 </div>
2287 </div>
2288 <ul>
2288 <ul>
2289 <li><a href="/shortlog">log</a></li>
2289 <li><a href="/shortlog">log</a></li>
2290 <li><a href="/graph">graph</a></li>
2290 <li><a href="/graph">graph</a></li>
2291 <li><a href="/tags">tags</a></li>
2291 <li><a href="/tags">tags</a></li>
2292 <li><a href="/bookmarks">bookmarks</a></li>
2292 <li><a href="/bookmarks">bookmarks</a></li>
2293 <li><a href="/branches">branches</a></li>
2293 <li><a href="/branches">branches</a></li>
2294 </ul>
2294 </ul>
2295 <ul>
2295 <ul>
2296 <li class="active"><a href="/help">help</a></li>
2296 <li class="active"><a href="/help">help</a></li>
2297 </ul>
2297 </ul>
2298 </div>
2298 </div>
2299
2299
2300 <div class="main">
2300 <div class="main">
2301 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2301 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2302 <h3>Help: revisions</h3>
2302 <h3>Help: revisions</h3>
2303
2303
2304 <form class="search" action="/log">
2304 <form class="search" action="/log">
2305
2305
2306 <p><input name="rev" id="search1" type="text" size="30" /></p>
2306 <p><input name="rev" id="search1" type="text" size="30" /></p>
2307 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2307 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2308 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2308 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2309 </form>
2309 </form>
2310 <div id="doc">
2310 <div id="doc">
2311 <h1>Specifying Single Revisions</h1>
2311 <h1>Specifying Single Revisions</h1>
2312 <p>
2312 <p>
2313 Mercurial supports several ways to specify individual revisions.
2313 Mercurial supports several ways to specify individual revisions.
2314 </p>
2314 </p>
2315 <p>
2315 <p>
2316 A plain integer is treated as a revision number. Negative integers are
2316 A plain integer is treated as a revision number. Negative integers are
2317 treated as sequential offsets from the tip, with -1 denoting the tip,
2317 treated as sequential offsets from the tip, with -1 denoting the tip,
2318 -2 denoting the revision prior to the tip, and so forth.
2318 -2 denoting the revision prior to the tip, and so forth.
2319 </p>
2319 </p>
2320 <p>
2320 <p>
2321 A 40-digit hexadecimal string is treated as a unique revision
2321 A 40-digit hexadecimal string is treated as a unique revision
2322 identifier.
2322 identifier.
2323 </p>
2323 </p>
2324 <p>
2324 <p>
2325 A hexadecimal string less than 40 characters long is treated as a
2325 A hexadecimal string less than 40 characters long is treated as a
2326 unique revision identifier and is referred to as a short-form
2326 unique revision identifier and is referred to as a short-form
2327 identifier. A short-form identifier is only valid if it is the prefix
2327 identifier. A short-form identifier is only valid if it is the prefix
2328 of exactly one full-length identifier.
2328 of exactly one full-length identifier.
2329 </p>
2329 </p>
2330 <p>
2330 <p>
2331 Any other string is treated as a bookmark, tag, or branch name. A
2331 Any other string is treated as a bookmark, tag, or branch name. A
2332 bookmark is a movable pointer to a revision. A tag is a permanent name
2332 bookmark is a movable pointer to a revision. A tag is a permanent name
2333 associated with a revision. A branch name denotes the tipmost open branch head
2333 associated with a revision. A branch name denotes the tipmost open branch head
2334 of that branch - or if they are all closed, the tipmost closed head of the
2334 of that branch - or if they are all closed, the tipmost closed head of the
2335 branch. Bookmark, tag, and branch names must not contain the &quot;:&quot; character.
2335 branch. Bookmark, tag, and branch names must not contain the &quot;:&quot; character.
2336 </p>
2336 </p>
2337 <p>
2337 <p>
2338 The reserved name &quot;tip&quot; always identifies the most recent revision.
2338 The reserved name &quot;tip&quot; always identifies the most recent revision.
2339 </p>
2339 </p>
2340 <p>
2340 <p>
2341 The reserved name &quot;null&quot; indicates the null revision. This is the
2341 The reserved name &quot;null&quot; indicates the null revision. This is the
2342 revision of an empty repository, and the parent of revision 0.
2342 revision of an empty repository, and the parent of revision 0.
2343 </p>
2343 </p>
2344 <p>
2344 <p>
2345 The reserved name &quot;.&quot; indicates the working directory parent. If no
2345 The reserved name &quot;.&quot; indicates the working directory parent. If no
2346 working directory is checked out, it is equivalent to null. If an
2346 working directory is checked out, it is equivalent to null. If an
2347 uncommitted merge is in progress, &quot;.&quot; is the revision of the first
2347 uncommitted merge is in progress, &quot;.&quot; is the revision of the first
2348 parent.
2348 parent.
2349 </p>
2349 </p>
2350
2350
2351 </div>
2351 </div>
2352 </div>
2352 </div>
2353 </div>
2353 </div>
2354
2354
2355 <script type="text/javascript">process_dates()</script>
2355 <script type="text/javascript">process_dates()</script>
2356
2356
2357
2357
2358 </body>
2358 </body>
2359 </html>
2359 </html>
2360
2360
2361
2361
2362 $ killdaemons.py
2362 $ killdaemons.py
2363
2363
2364 #endif
2364 #endif
General Comments 0
You need to be logged in to leave comments. Login now