##// END OF EJS Templates
tests: define norepo in command decorator
Gregory Szorc -
r21773:26d2fb89 default
parent child Browse files
Show More
@@ -1,358 +1,357 b''
1 1 import sys, os, struct, subprocess, cStringIO, re, shutil
2 2
3 3 def connect(path=None):
4 4 cmdline = ['hg', 'serve', '--cmdserver', 'pipe']
5 5 if path:
6 6 cmdline += ['-R', path]
7 7
8 8 server = subprocess.Popen(cmdline, stdin=subprocess.PIPE,
9 9 stdout=subprocess.PIPE)
10 10
11 11 return server
12 12
13 13 def writeblock(server, data):
14 14 server.stdin.write(struct.pack('>I', len(data)))
15 15 server.stdin.write(data)
16 16 server.stdin.flush()
17 17
18 18 def readchannel(server):
19 19 data = server.stdout.read(5)
20 20 if not data:
21 21 raise EOFError
22 22 channel, length = struct.unpack('>cI', data)
23 23 if channel in 'IL':
24 24 return channel, length
25 25 else:
26 26 return channel, server.stdout.read(length)
27 27
28 28 def sep(text):
29 29 return text.replace('\\', '/')
30 30
31 31 def runcommand(server, args, output=sys.stdout, error=sys.stderr, input=None,
32 32 outfilter=lambda x: x):
33 33 print ' runcommand', ' '.join(args)
34 34 sys.stdout.flush()
35 35 server.stdin.write('runcommand\n')
36 36 writeblock(server, '\0'.join(args))
37 37
38 38 if not input:
39 39 input = cStringIO.StringIO()
40 40
41 41 while True:
42 42 ch, data = readchannel(server)
43 43 if ch == 'o':
44 44 output.write(outfilter(data))
45 45 output.flush()
46 46 elif ch == 'e':
47 47 error.write(data)
48 48 error.flush()
49 49 elif ch == 'I':
50 50 writeblock(server, input.read(data))
51 51 elif ch == 'L':
52 52 writeblock(server, input.readline(data))
53 53 elif ch == 'r':
54 54 ret, = struct.unpack('>i', data)
55 55 if ret != 0:
56 56 print ' [%d]' % ret
57 57 return ret
58 58 else:
59 59 print "unexpected channel %c: %r" % (ch, data)
60 60 if ch.isupper():
61 61 return
62 62
63 63 def check(func, repopath=None):
64 64 print
65 65 print 'testing %s:' % func.__name__
66 66 print
67 67 sys.stdout.flush()
68 68 server = connect(repopath)
69 69 try:
70 70 return func(server)
71 71 finally:
72 72 server.stdin.close()
73 73 server.wait()
74 74
75 75 def unknowncommand(server):
76 76 server.stdin.write('unknowncommand\n')
77 77
78 78 def hellomessage(server):
79 79 ch, data = readchannel(server)
80 80 # escaping python tests output not supported
81 81 print '%c, %r' % (ch, re.sub('encoding: [a-zA-Z0-9-]+', 'encoding: ***',
82 82 data))
83 83
84 84 # run an arbitrary command to make sure the next thing the server sends
85 85 # isn't part of the hello message
86 86 runcommand(server, ['id'])
87 87
88 88 def checkruncommand(server):
89 89 # hello block
90 90 readchannel(server)
91 91
92 92 # no args
93 93 runcommand(server, [])
94 94
95 95 # global options
96 96 runcommand(server, ['id', '--quiet'])
97 97
98 98 # make sure global options don't stick through requests
99 99 runcommand(server, ['id'])
100 100
101 101 # --config
102 102 runcommand(server, ['id', '--config', 'ui.quiet=True'])
103 103
104 104 # make sure --config doesn't stick
105 105 runcommand(server, ['id'])
106 106
107 107 # negative return code should be masked
108 108 runcommand(server, ['id', '-runknown'])
109 109
110 110 def inputeof(server):
111 111 readchannel(server)
112 112 server.stdin.write('runcommand\n')
113 113 # close stdin while server is waiting for input
114 114 server.stdin.close()
115 115
116 116 # server exits with 1 if the pipe closed while reading the command
117 117 print 'server exit code =', server.wait()
118 118
119 119 def serverinput(server):
120 120 readchannel(server)
121 121
122 122 patch = """
123 123 # HG changeset patch
124 124 # User test
125 125 # Date 0 0
126 126 # Node ID c103a3dec114d882c98382d684d8af798d09d857
127 127 # Parent 0000000000000000000000000000000000000000
128 128 1
129 129
130 130 diff -r 000000000000 -r c103a3dec114 a
131 131 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
132 132 +++ b/a Thu Jan 01 00:00:00 1970 +0000
133 133 @@ -0,0 +1,1 @@
134 134 +1
135 135 """
136 136
137 137 runcommand(server, ['import', '-'], input=cStringIO.StringIO(patch))
138 138 runcommand(server, ['log'])
139 139
140 140 def cwd(server):
141 141 """ check that --cwd doesn't persist between requests """
142 142 readchannel(server)
143 143 os.mkdir('foo')
144 144 f = open('foo/bar', 'wb')
145 145 f.write('a')
146 146 f.close()
147 147 runcommand(server, ['--cwd', 'foo', 'st', 'bar'])
148 148 runcommand(server, ['st', 'foo/bar'])
149 149 os.remove('foo/bar')
150 150
151 151 def localhgrc(server):
152 152 """ check that local configs for the cached repo aren't inherited when -R
153 153 is used """
154 154 readchannel(server)
155 155
156 156 # the cached repo local hgrc contains ui.foo=bar, so showconfig should
157 157 # show it
158 158 runcommand(server, ['showconfig'])
159 159
160 160 # but not for this repo
161 161 runcommand(server, ['init', 'foo'])
162 162 runcommand(server, ['-R', 'foo', 'showconfig', 'ui', 'defaults'])
163 163 shutil.rmtree('foo')
164 164
165 165 def hook(**args):
166 166 print 'hook talking'
167 167 print 'now try to read something: %r' % sys.stdin.read()
168 168
169 169 def hookoutput(server):
170 170 readchannel(server)
171 171 runcommand(server, ['--config',
172 172 'hooks.pre-identify=python:test-commandserver.hook',
173 173 'id'],
174 174 input=cStringIO.StringIO('some input'))
175 175
176 176 def outsidechanges(server):
177 177 readchannel(server)
178 178 f = open('a', 'ab')
179 179 f.write('a\n')
180 180 f.close()
181 181 runcommand(server, ['status'])
182 182 os.system('hg ci -Am2')
183 183 runcommand(server, ['tip'])
184 184 runcommand(server, ['status'])
185 185
186 186 def bookmarks(server):
187 187 readchannel(server)
188 188 runcommand(server, ['bookmarks'])
189 189
190 190 # changes .hg/bookmarks
191 191 os.system('hg bookmark -i bm1')
192 192 os.system('hg bookmark -i bm2')
193 193 runcommand(server, ['bookmarks'])
194 194
195 195 # changes .hg/bookmarks.current
196 196 os.system('hg upd bm1 -q')
197 197 runcommand(server, ['bookmarks'])
198 198
199 199 runcommand(server, ['bookmarks', 'bm3'])
200 200 f = open('a', 'ab')
201 201 f.write('a\n')
202 202 f.close()
203 203 runcommand(server, ['commit', '-Amm'])
204 204 runcommand(server, ['bookmarks'])
205 205
206 206 def tagscache(server):
207 207 readchannel(server)
208 208 runcommand(server, ['id', '-t', '-r', '0'])
209 209 os.system('hg tag -r 0 foo')
210 210 runcommand(server, ['id', '-t', '-r', '0'])
211 211
212 212 def setphase(server):
213 213 readchannel(server)
214 214 runcommand(server, ['phase', '-r', '.'])
215 215 os.system('hg phase -r . -p')
216 216 runcommand(server, ['phase', '-r', '.'])
217 217
218 218 def rollback(server):
219 219 readchannel(server)
220 220 runcommand(server, ['phase', '-r', '.', '-p'])
221 221 f = open('a', 'ab')
222 222 f.write('a\n')
223 223 f.close()
224 224 runcommand(server, ['commit', '-Am.'])
225 225 runcommand(server, ['rollback'])
226 226 runcommand(server, ['phase', '-r', '.'])
227 227
228 228 def branch(server):
229 229 readchannel(server)
230 230 runcommand(server, ['branch'])
231 231 os.system('hg branch foo')
232 232 runcommand(server, ['branch'])
233 233 os.system('hg branch default')
234 234
235 235 def hgignore(server):
236 236 readchannel(server)
237 237 f = open('.hgignore', 'ab')
238 238 f.write('')
239 239 f.close()
240 240 runcommand(server, ['commit', '-Am.'])
241 241 f = open('ignored-file', 'ab')
242 242 f.write('')
243 243 f.close()
244 244 f = open('.hgignore', 'ab')
245 245 f.write('ignored-file')
246 246 f.close()
247 247 runcommand(server, ['status', '-i', '-u'])
248 248
249 249 def phasecacheafterstrip(server):
250 250 readchannel(server)
251 251
252 252 # create new head, 5:731265503d86
253 253 runcommand(server, ['update', '-C', '0'])
254 254 f = open('a', 'ab')
255 255 f.write('a\n')
256 256 f.close()
257 257 runcommand(server, ['commit', '-Am.', 'a'])
258 258 runcommand(server, ['log', '-Gq'])
259 259
260 260 # make it public; draft marker moves to 4:7966c8e3734d
261 261 runcommand(server, ['phase', '-p', '.'])
262 262 # load _phasecache.phaseroots
263 263 runcommand(server, ['phase', '.'], outfilter=sep)
264 264
265 265 # strip 1::4 outside server
266 266 os.system('hg -q --config extensions.mq= strip 1')
267 267
268 268 # shouldn't raise "7966c8e3734d: no node!"
269 269 runcommand(server, ['branches'])
270 270
271 271 def obsolete(server):
272 272 readchannel(server)
273 273
274 274 runcommand(server, ['up', 'null'])
275 275 runcommand(server, ['phase', '-df', 'tip'])
276 276 cmd = 'hg debugobsolete `hg log -r tip --template {node}`'
277 277 if os.name == 'nt':
278 278 cmd = 'sh -c "%s"' % cmd # run in sh, not cmd.exe
279 279 os.system(cmd)
280 280 runcommand(server, ['log', '--hidden'])
281 281 runcommand(server, ['log'])
282 282
283 283 def mqoutsidechanges(server):
284 284 readchannel(server)
285 285
286 286 # load repo.mq
287 287 runcommand(server, ['qapplied'])
288 288 os.system('hg qnew 0.diff')
289 289 # repo.mq should be invalidated
290 290 runcommand(server, ['qapplied'])
291 291
292 292 runcommand(server, ['qpop', '--all'])
293 293 os.system('hg qqueue --create foo')
294 294 # repo.mq should be recreated to point to new queue
295 295 runcommand(server, ['qqueue', '--active'])
296 296
297 297 def getpass(server):
298 298 readchannel(server)
299 299 runcommand(server, ['debuggetpass', '--config', 'ui.interactive=True'],
300 300 input=cStringIO.StringIO('1234\n'))
301 301
302 302 def startwithoutrepo(server):
303 303 readchannel(server)
304 304 runcommand(server, ['init', 'repo2'])
305 305 runcommand(server, ['id', '-R', 'repo2'])
306 306
307 307 if __name__ == '__main__':
308 308 os.system('hg init repo')
309 309 os.chdir('repo')
310 310
311 311 check(hellomessage)
312 312 check(unknowncommand)
313 313 check(checkruncommand)
314 314 check(inputeof)
315 315 check(serverinput)
316 316 check(cwd)
317 317
318 318 hgrc = open('.hg/hgrc', 'a')
319 319 hgrc.write('[ui]\nfoo=bar\n')
320 320 hgrc.close()
321 321 check(localhgrc)
322 322 check(hookoutput)
323 323 check(outsidechanges)
324 324 check(bookmarks)
325 325 check(tagscache)
326 326 check(setphase)
327 327 check(rollback)
328 328 check(branch)
329 329 check(hgignore)
330 330 check(phasecacheafterstrip)
331 331 obs = open('obs.py', 'w')
332 332 obs.write('import mercurial.obsolete\nmercurial.obsolete._enabled = True\n')
333 333 obs.close()
334 334 hgrc = open('.hg/hgrc', 'a')
335 335 hgrc.write('[extensions]\nobs=obs.py\n')
336 336 hgrc.close()
337 337 check(obsolete)
338 338 hgrc = open('.hg/hgrc', 'a')
339 339 hgrc.write('[extensions]\nmq=\n')
340 340 hgrc.close()
341 341 check(mqoutsidechanges)
342 342 dbg = open('dbgui.py', 'w')
343 343 dbg.write('from mercurial import cmdutil, commands\n'
344 'commands.norepo += " debuggetpass"\n'
345 344 'cmdtable = {}\n'
346 345 'command = cmdutil.command(cmdtable)\n'
347 '@command("debuggetpass")\n'
346 '@command("debuggetpass", norepo=True)\n'
348 347 'def debuggetpass(ui):\n'
349 348 ' ui.write("%s\\n" % ui.getpass())\n')
350 349 dbg.close()
351 350 hgrc = open('.hg/hgrc', 'a')
352 351 hgrc.write('[extensions]\ndbgui=dbgui.py\n')
353 352 hgrc.close()
354 353 check(getpass)
355 354
356 355 os.chdir('..')
357 356 check(hellomessage)
358 357 check(startwithoutrepo)
@@ -1,850 +1,846 b''
1 1 Test basic extension support
2 2
3 3 $ cat > foobar.py <<EOF
4 4 > import os
5 5 > from mercurial import cmdutil, commands
6 6 >
7 7 > cmdtable = {}
8 8 > command = cmdutil.command(cmdtable)
9 9 >
10 10 > def uisetup(ui):
11 11 > ui.write("uisetup called\\n")
12 12 >
13 13 > def reposetup(ui, repo):
14 14 > ui.write("reposetup called for %s\\n" % os.path.basename(repo.root))
15 15 > ui.write("ui %s= repo.ui\\n" % (ui == repo.ui and "=" or "!"))
16 16 >
17 17 > @command('foo', [], 'hg foo')
18 18 > def foo(ui, *args, **kwargs):
19 19 > ui.write("Foo\\n")
20 20 >
21 > @command('bar', [], 'hg bar')
21 > @command('bar', [], 'hg bar', norepo=True)
22 22 > def bar(ui, *args, **kwargs):
23 23 > ui.write("Bar\\n")
24 24 >
25 > commands.norepo += ' bar'
26 25 > EOF
27 26 $ abspath=`pwd`/foobar.py
28 27
29 28 $ mkdir barfoo
30 29 $ cp foobar.py barfoo/__init__.py
31 30 $ barfoopath=`pwd`/barfoo
32 31
33 32 $ hg init a
34 33 $ cd a
35 34 $ echo foo > file
36 35 $ hg add file
37 36 $ hg commit -m 'add file'
38 37
39 38 $ echo '[extensions]' >> $HGRCPATH
40 39 $ echo "foobar = $abspath" >> $HGRCPATH
41 40 $ hg foo
42 41 uisetup called
43 42 reposetup called for a
44 43 ui == repo.ui
45 44 Foo
46 45
47 46 $ cd ..
48 47 $ hg clone a b
49 48 uisetup called
50 49 reposetup called for a
51 50 ui == repo.ui
52 51 reposetup called for b
53 52 ui == repo.ui
54 53 updating to branch default
55 54 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
56 55
57 56 $ hg bar
58 57 uisetup called
59 58 Bar
60 59 $ echo 'foobar = !' >> $HGRCPATH
61 60
62 61 module/__init__.py-style
63 62
64 63 $ echo "barfoo = $barfoopath" >> $HGRCPATH
65 64 $ cd a
66 65 $ hg foo
67 66 uisetup called
68 67 reposetup called for a
69 68 ui == repo.ui
70 69 Foo
71 70 $ echo 'barfoo = !' >> $HGRCPATH
72 71
73 72 Check that extensions are loaded in phases:
74 73
75 74 $ cat > foo.py <<EOF
76 75 > import os
77 76 > name = os.path.basename(__file__).rsplit('.', 1)[0]
78 77 > print "1) %s imported" % name
79 78 > def uisetup(ui):
80 79 > print "2) %s uisetup" % name
81 80 > def extsetup():
82 81 > print "3) %s extsetup" % name
83 82 > def reposetup(ui, repo):
84 83 > print "4) %s reposetup" % name
85 84 > EOF
86 85
87 86 $ cp foo.py bar.py
88 87 $ echo 'foo = foo.py' >> $HGRCPATH
89 88 $ echo 'bar = bar.py' >> $HGRCPATH
90 89
91 90 Command with no output, we just want to see the extensions loaded:
92 91
93 92 $ hg paths
94 93 1) foo imported
95 94 1) bar imported
96 95 2) foo uisetup
97 96 2) bar uisetup
98 97 3) foo extsetup
99 98 3) bar extsetup
100 99 4) foo reposetup
101 100 4) bar reposetup
102 101
103 102 Check hgweb's load order:
104 103
105 104 $ cat > hgweb.cgi <<EOF
106 105 > #!/usr/bin/env python
107 106 > from mercurial import demandimport; demandimport.enable()
108 107 > from mercurial.hgweb import hgweb
109 108 > from mercurial.hgweb import wsgicgi
110 109 >
111 110 > application = hgweb('.', 'test repo')
112 111 > wsgicgi.launch(application)
113 112 > EOF
114 113
115 114 $ REQUEST_METHOD='GET' PATH_INFO='/' SCRIPT_NAME='' QUERY_STRING='' \
116 115 > SERVER_PORT='80' SERVER_NAME='localhost' python hgweb.cgi \
117 116 > | grep '^[0-9]) ' # ignores HTML output
118 117 1) foo imported
119 118 1) bar imported
120 119 2) foo uisetup
121 120 2) bar uisetup
122 121 3) foo extsetup
123 122 3) bar extsetup
124 123 4) foo reposetup
125 124 4) bar reposetup
126 125 4) foo reposetup
127 126 4) bar reposetup
128 127
129 128 $ echo 'foo = !' >> $HGRCPATH
130 129 $ echo 'bar = !' >> $HGRCPATH
131 130
132 131 Check "from __future__ import absolute_import" support for external libraries
133 132
134 133 #if windows
135 134 $ PATHSEP=";"
136 135 #else
137 136 $ PATHSEP=":"
138 137 #endif
139 138 $ export PATHSEP
140 139
141 140 $ mkdir $TESTTMP/libroot
142 141 $ echo "s = 'libroot/ambig.py'" > $TESTTMP/libroot/ambig.py
143 142 $ mkdir $TESTTMP/libroot/mod
144 143 $ touch $TESTTMP/libroot/mod/__init__.py
145 144 $ echo "s = 'libroot/mod/ambig.py'" > $TESTTMP/libroot/mod/ambig.py
146 145
147 146 #if absimport
148 147 $ cat > $TESTTMP/libroot/mod/ambigabs.py <<EOF
149 148 > from __future__ import absolute_import
150 149 > import ambig # should load "libroot/ambig.py"
151 150 > s = ambig.s
152 151 > EOF
153 152 $ cat > loadabs.py <<EOF
154 153 > import mod.ambigabs as ambigabs
155 154 > def extsetup():
156 155 > print 'ambigabs.s=%s' % ambigabs.s
157 156 > EOF
158 157 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadabs=loadabs.py root)
159 158 ambigabs.s=libroot/ambig.py
160 159 $TESTTMP/a (glob)
161 160 #endif
162 161
163 162 #if no-py3k
164 163 $ cat > $TESTTMP/libroot/mod/ambigrel.py <<EOF
165 164 > import ambig # should load "libroot/mod/ambig.py"
166 165 > s = ambig.s
167 166 > EOF
168 167 $ cat > loadrel.py <<EOF
169 168 > import mod.ambigrel as ambigrel
170 169 > def extsetup():
171 170 > print 'ambigrel.s=%s' % ambigrel.s
172 171 > EOF
173 172 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadrel=loadrel.py root)
174 173 ambigrel.s=libroot/mod/ambig.py
175 174 $TESTTMP/a (glob)
176 175 #endif
177 176
178 177 Check absolute/relative import of extension specific modules
179 178
180 179 $ mkdir $TESTTMP/extroot
181 180 $ cat > $TESTTMP/extroot/bar.py <<EOF
182 181 > s = 'this is extroot.bar'
183 182 > EOF
184 183 $ mkdir $TESTTMP/extroot/sub1
185 184 $ cat > $TESTTMP/extroot/sub1/__init__.py <<EOF
186 185 > s = 'this is extroot.sub1.__init__'
187 186 > EOF
188 187 $ cat > $TESTTMP/extroot/sub1/baz.py <<EOF
189 188 > s = 'this is extroot.sub1.baz'
190 189 > EOF
191 190 $ cat > $TESTTMP/extroot/__init__.py <<EOF
192 191 > s = 'this is extroot.__init__'
193 192 > import foo
194 193 > def extsetup(ui):
195 194 > ui.write('(extroot) ', foo.func(), '\n')
196 195 > EOF
197 196
198 197 $ cat > $TESTTMP/extroot/foo.py <<EOF
199 198 > # test absolute import
200 199 > buf = []
201 200 > def func():
202 201 > # "not locals" case
203 202 > import extroot.bar
204 203 > buf.append('import extroot.bar in func(): %s' % extroot.bar.s)
205 204 >
206 205 > return '\n(extroot) '.join(buf)
207 206 >
208 207 > # "fromlist == ('*',)" case
209 208 > from extroot.bar import *
210 209 > buf.append('from extroot.bar import *: %s' % s)
211 210 >
212 211 > # "not fromlist" and "if '.' in name" case
213 212 > import extroot.sub1.baz
214 213 > buf.append('import extroot.sub1.baz: %s' % extroot.sub1.baz.s)
215 214 >
216 215 > # "not fromlist" and NOT "if '.' in name" case
217 216 > import extroot
218 217 > buf.append('import extroot: %s' % extroot.s)
219 218 >
220 219 > # NOT "not fromlist" and NOT "level != -1" case
221 220 > from extroot.bar import s
222 221 > buf.append('from extroot.bar import s: %s' % s)
223 222 > EOF
224 223 $ hg --config extensions.extroot=$TESTTMP/extroot root
225 224 (extroot) from extroot.bar import *: this is extroot.bar
226 225 (extroot) import extroot.sub1.baz: this is extroot.sub1.baz
227 226 (extroot) import extroot: this is extroot.__init__
228 227 (extroot) from extroot.bar import s: this is extroot.bar
229 228 (extroot) import extroot.bar in func(): this is extroot.bar
230 229 $TESTTMP/a (glob)
231 230
232 231 #if no-py3k
233 232 $ rm "$TESTTMP"/extroot/foo.*
234 233 $ cat > $TESTTMP/extroot/foo.py <<EOF
235 234 > # test relative import
236 235 > buf = []
237 236 > def func():
238 237 > # "not locals" case
239 238 > import bar
240 239 > buf.append('import bar in func(): %s' % bar.s)
241 240 >
242 241 > return '\n(extroot) '.join(buf)
243 242 >
244 243 > # "fromlist == ('*',)" case
245 244 > from bar import *
246 245 > buf.append('from bar import *: %s' % s)
247 246 >
248 247 > # "not fromlist" and "if '.' in name" case
249 248 > import sub1.baz
250 249 > buf.append('import sub1.baz: %s' % sub1.baz.s)
251 250 >
252 251 > # "not fromlist" and NOT "if '.' in name" case
253 252 > import sub1
254 253 > buf.append('import sub1: %s' % sub1.s)
255 254 >
256 255 > # NOT "not fromlist" and NOT "level != -1" case
257 256 > from bar import s
258 257 > buf.append('from bar import s: %s' % s)
259 258 > EOF
260 259 $ hg --config extensions.extroot=$TESTTMP/extroot root
261 260 (extroot) from bar import *: this is extroot.bar
262 261 (extroot) import sub1.baz: this is extroot.sub1.baz
263 262 (extroot) import sub1: this is extroot.sub1.__init__
264 263 (extroot) from bar import s: this is extroot.bar
265 264 (extroot) import bar in func(): this is extroot.bar
266 265 $TESTTMP/a (glob)
267 266 #endif
268 267
269 268 $ cd ..
270 269
271 270 hide outer repo
272 271 $ hg init
273 272
274 273 $ cat > empty.py <<EOF
275 274 > '''empty cmdtable
276 275 > '''
277 276 > cmdtable = {}
278 277 > EOF
279 278 $ emptypath=`pwd`/empty.py
280 279 $ echo "empty = $emptypath" >> $HGRCPATH
281 280 $ hg help empty
282 281 empty extension - empty cmdtable
283 282
284 283 no commands defined
285 284
286 285 $ echo 'empty = !' >> $HGRCPATH
287 286
288 287 $ cat > debugextension.py <<EOF
289 288 > '''only debugcommands
290 289 > '''
291 290 > from mercurial import cmdutil
292 291 > cmdtable = {}
293 292 > command = cmdutil.command(cmdtable)
294 293 >
295 294 > @command('debugfoobar', [], 'hg debugfoobar')
296 295 > def debugfoobar(ui, repo, *args, **opts):
297 296 > "yet another debug command"
298 297 > pass
299 298 >
300 299 > @command('foo', [], 'hg foo')
301 300 > def foo(ui, repo, *args, **opts):
302 301 > """yet another foo command
303 302 >
304 303 > This command has been DEPRECATED since forever.
305 304 > """
306 305 > pass
307 306 > EOF
308 307 $ debugpath=`pwd`/debugextension.py
309 308 $ echo "debugextension = $debugpath" >> $HGRCPATH
310 309
311 310 $ hg help debugextension
312 311 debugextension extension - only debugcommands
313 312
314 313 no commands defined
315 314
316 315 $ hg --verbose help debugextension
317 316 debugextension extension - only debugcommands
318 317
319 318 list of commands:
320 319
321 320 foo yet another foo command
322 321
323 322 global options:
324 323
325 324 -R --repository REPO repository root directory or name of overlay bundle
326 325 file
327 326 --cwd DIR change working directory
328 327 -y --noninteractive do not prompt, automatically pick the first choice for
329 328 all prompts
330 329 -q --quiet suppress output
331 330 -v --verbose enable additional output
332 331 --config CONFIG [+] set/override config option (use 'section.name=value')
333 332 --debug enable debugging output
334 333 --debugger start debugger
335 334 --encoding ENCODE set the charset encoding (default: ascii)
336 335 --encodingmode MODE set the charset encoding mode (default: strict)
337 336 --traceback always print a traceback on exception
338 337 --time time how long the command takes
339 338 --profile print command execution profile
340 339 --version output version information and exit
341 340 -h --help display help and exit
342 341 --hidden consider hidden changesets
343 342
344 343 [+] marked option can be specified multiple times
345 344
346 345 $ hg --debug help debugextension
347 346 debugextension extension - only debugcommands
348 347
349 348 list of commands:
350 349
351 350 debugfoobar yet another debug command
352 351 foo yet another foo command
353 352
354 353 global options:
355 354
356 355 -R --repository REPO repository root directory or name of overlay bundle
357 356 file
358 357 --cwd DIR change working directory
359 358 -y --noninteractive do not prompt, automatically pick the first choice for
360 359 all prompts
361 360 -q --quiet suppress output
362 361 -v --verbose enable additional output
363 362 --config CONFIG [+] set/override config option (use 'section.name=value')
364 363 --debug enable debugging output
365 364 --debugger start debugger
366 365 --encoding ENCODE set the charset encoding (default: ascii)
367 366 --encodingmode MODE set the charset encoding mode (default: strict)
368 367 --traceback always print a traceback on exception
369 368 --time time how long the command takes
370 369 --profile print command execution profile
371 370 --version output version information and exit
372 371 -h --help display help and exit
373 372 --hidden consider hidden changesets
374 373
375 374 [+] marked option can be specified multiple times
376 375 $ echo 'debugextension = !' >> $HGRCPATH
377 376
378 377 Extension module help vs command help:
379 378
380 379 $ echo 'extdiff =' >> $HGRCPATH
381 380 $ hg help extdiff
382 381 hg extdiff [OPT]... [FILE]...
383 382
384 383 use external program to diff repository (or selected files)
385 384
386 385 Show differences between revisions for the specified files, using an
387 386 external program. The default program used is diff, with default options
388 387 "-Npru".
389 388
390 389 To select a different program, use the -p/--program option. The program
391 390 will be passed the names of two directories to compare. To pass additional
392 391 options to the program, use -o/--option. These will be passed before the
393 392 names of the directories to compare.
394 393
395 394 When two revision arguments are given, then changes are shown between
396 395 those revisions. If only one revision is specified then that revision is
397 396 compared to the working directory, and, when no revisions are specified,
398 397 the working directory files are compared to its parent.
399 398
400 399 use "hg help -e extdiff" to show help for the extdiff extension
401 400
402 401 options:
403 402
404 403 -p --program CMD comparison program to run
405 404 -o --option OPT [+] pass option to comparison program
406 405 -r --rev REV [+] revision
407 406 -c --change REV change made by revision
408 407 -I --include PATTERN [+] include names matching the given patterns
409 408 -X --exclude PATTERN [+] exclude names matching the given patterns
410 409
411 410 [+] marked option can be specified multiple times
412 411
413 412 use "hg -v help extdiff" to show the global options
414 413
415 414 $ hg help --extension extdiff
416 415 extdiff extension - command to allow external programs to compare revisions
417 416
418 417 The extdiff Mercurial extension allows you to use external programs to compare
419 418 revisions, or revision with working directory. The external diff programs are
420 419 called with a configurable set of options and two non-option arguments: paths
421 420 to directories containing snapshots of files to compare.
422 421
423 422 The extdiff extension also allows you to configure new diff commands, so you
424 423 do not need to type "hg extdiff -p kdiff3" always.
425 424
426 425 [extdiff]
427 426 # add new command that runs GNU diff(1) in 'context diff' mode
428 427 cdiff = gdiff -Nprc5
429 428 ## or the old way:
430 429 #cmd.cdiff = gdiff
431 430 #opts.cdiff = -Nprc5
432 431
433 432 # add new command called vdiff, runs kdiff3
434 433 vdiff = kdiff3
435 434
436 435 # add new command called meld, runs meld (no need to name twice)
437 436 meld =
438 437
439 438 # add new command called vimdiff, runs gvimdiff with DirDiff plugin
440 439 # (see http://www.vim.org/scripts/script.php?script_id=102) Non
441 440 # English user, be sure to put "let g:DirDiffDynamicDiffText = 1" in
442 441 # your .vimrc
443 442 vimdiff = gvim -f "+next" \
444 443 "+execute 'DirDiff' fnameescape(argv(0)) fnameescape(argv(1))"
445 444
446 445 Tool arguments can include variables that are expanded at runtime:
447 446
448 447 $parent1, $plabel1 - filename, descriptive label of first parent
449 448 $child, $clabel - filename, descriptive label of child revision
450 449 $parent2, $plabel2 - filename, descriptive label of second parent
451 450 $root - repository root
452 451 $parent is an alias for $parent1.
453 452
454 453 The extdiff extension will look in your [diff-tools] and [merge-tools]
455 454 sections for diff tool arguments, when none are specified in [extdiff].
456 455
457 456 [extdiff]
458 457 kdiff3 =
459 458
460 459 [diff-tools]
461 460 kdiff3.diffargs=--L1 '$plabel1' --L2 '$clabel' $parent $child
462 461
463 462 You can use -I/-X and list of file or directory names like normal "hg diff"
464 463 command. The extdiff extension makes snapshots of only needed files, so
465 464 running the external diff program will actually be pretty fast (at least
466 465 faster than having to compare the entire tree).
467 466
468 467 list of commands:
469 468
470 469 extdiff use external program to diff repository (or selected files)
471 470
472 471 use "hg -v help extdiff" to show builtin aliases and global options
473 472
474 473 $ echo 'extdiff = !' >> $HGRCPATH
475 474
476 475 Test help topic with same name as extension
477 476
478 477 $ cat > multirevs.py <<EOF
479 478 > from mercurial import cmdutil, commands
480 479 > cmdtable = {}
481 480 > command = cmdutil.command(cmdtable)
482 481 > """multirevs extension
483 482 > Big multi-line module docstring."""
484 > @command('multirevs', [], 'ARG')
483 > @command('multirevs', [], 'ARG', norepo=True)
485 484 > def multirevs(ui, repo, arg, *args, **opts):
486 485 > """multirevs command"""
487 486 > pass
488 > commands.norepo += ' multirevs'
489 487 > EOF
490 488 $ echo "multirevs = multirevs.py" >> $HGRCPATH
491 489
492 490 $ hg help multirevs
493 491 Specifying Multiple Revisions
494 492 """""""""""""""""""""""""""""
495 493
496 494 When Mercurial accepts more than one revision, they may be specified
497 495 individually, or provided as a topologically continuous range, separated
498 496 by the ":" character.
499 497
500 498 The syntax of range notation is [BEGIN]:[END], where BEGIN and END are
501 499 revision identifiers. Both BEGIN and END are optional. If BEGIN is not
502 500 specified, it defaults to revision number 0. If END is not specified, it
503 501 defaults to the tip. The range ":" thus means "all revisions".
504 502
505 503 If BEGIN is greater than END, revisions are treated in reverse order.
506 504
507 505 A range acts as a closed interval. This means that a range of 3:5 gives 3,
508 506 4 and 5. Similarly, a range of 9:6 gives 9, 8, 7, and 6.
509 507
510 508 use "hg help -c multirevs" to see help for the multirevs command
511 509
512 510 $ hg help -c multirevs
513 511 hg multirevs ARG
514 512
515 513 multirevs command
516 514
517 515 use "hg -v help multirevs" to show the global options
518 516
519 517 $ hg multirevs
520 518 hg multirevs: invalid arguments
521 519 hg multirevs ARG
522 520
523 521 multirevs command
524 522
525 523 use "hg help multirevs" to show the full help text
526 524 [255]
527 525
528 526 $ echo "multirevs = !" >> $HGRCPATH
529 527
530 528 Issue811: Problem loading extensions twice (by site and by user)
531 529
532 530 $ debugpath=`pwd`/debugissue811.py
533 531 $ cat > debugissue811.py <<EOF
534 532 > '''show all loaded extensions
535 533 > '''
536 534 > from mercurial import cmdutil, commands, extensions
537 535 > cmdtable = {}
538 536 > command = cmdutil.command(cmdtable)
539 537 >
540 > @command('debugextensions', [], 'hg debugextensions')
538 > @command('debugextensions', [], 'hg debugextensions', norepo=True)
541 539 > def debugextensions(ui):
542 540 > "yet another debug command"
543 541 > ui.write("%s\n" % '\n'.join([x for x, y in extensions.extensions()]))
544 542 >
545 > commands.norepo += " debugextensions"
546 543 > EOF
547 544 $ echo "debugissue811 = $debugpath" >> $HGRCPATH
548 545 $ echo "mq=" >> $HGRCPATH
549 546 $ echo "strip=" >> $HGRCPATH
550 547 $ echo "hgext.mq=" >> $HGRCPATH
551 548 $ echo "hgext/mq=" >> $HGRCPATH
552 549
553 550 Show extensions:
554 551 (note that mq force load strip, also checking it's not loaded twice)
555 552
556 553 $ hg debugextensions
557 554 debugissue811
558 555 strip
559 556 mq
560 557
561 558 Disabled extension commands:
562 559
563 560 $ ORGHGRCPATH=$HGRCPATH
564 561 $ HGRCPATH=
565 562 $ export HGRCPATH
566 563 $ hg help email
567 564 'email' is provided by the following extension:
568 565
569 566 patchbomb command to send changesets as (a series of) patch emails
570 567
571 568 use "hg help extensions" for information on enabling extensions
572 569 $ hg qdel
573 570 hg: unknown command 'qdel'
574 571 'qdelete' is provided by the following extension:
575 572
576 573 mq manage a stack of patches
577 574
578 575 use "hg help extensions" for information on enabling extensions
579 576 [255]
580 577 $ hg churn
581 578 hg: unknown command 'churn'
582 579 'churn' is provided by the following extension:
583 580
584 581 churn command to display statistics about repository history
585 582
586 583 use "hg help extensions" for information on enabling extensions
587 584 [255]
588 585
589 586 Disabled extensions:
590 587
591 588 $ hg help churn
592 589 churn extension - command to display statistics about repository history
593 590
594 591 use "hg help extensions" for information on enabling extensions
595 592 $ hg help patchbomb
596 593 patchbomb extension - command to send changesets as (a series of) patch emails
597 594
598 595 use "hg help extensions" for information on enabling extensions
599 596
600 597 Broken disabled extension and command:
601 598
602 599 $ mkdir hgext
603 600 $ echo > hgext/__init__.py
604 601 $ cat > hgext/broken.py <<EOF
605 602 > "broken extension'
606 603 > EOF
607 604 $ cat > path.py <<EOF
608 605 > import os, sys
609 606 > sys.path.insert(0, os.environ['HGEXTPATH'])
610 607 > EOF
611 608 $ HGEXTPATH=`pwd`
612 609 $ export HGEXTPATH
613 610
614 611 $ hg --config extensions.path=./path.py help broken
615 612 broken extension - (no help text available)
616 613
617 614 use "hg help extensions" for information on enabling extensions
618 615
619 616 $ cat > hgext/forest.py <<EOF
620 617 > cmdtable = None
621 618 > EOF
622 619 $ hg --config extensions.path=./path.py help foo > /dev/null
623 620 warning: error finding commands in $TESTTMP/hgext/forest.py (glob)
624 621 abort: no such help topic: foo
625 622 (try "hg help --keyword foo")
626 623 [255]
627 624
628 625 $ cat > throw.py <<EOF
629 626 > from mercurial import cmdutil, commands
630 627 > cmdtable = {}
631 628 > command = cmdutil.command(cmdtable)
632 629 > class Bogon(Exception): pass
633 630 >
634 > @command('throw', [], 'hg throw')
631 > @command('throw', [], 'hg throw', norepo=True)
635 632 > def throw(ui, **opts):
636 633 > """throws an exception"""
637 634 > raise Bogon()
638 > commands.norepo += " throw"
639 635 > EOF
640 636 No declared supported version, extension complains:
641 637 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
642 638 ** Unknown exception encountered with possibly-broken third-party extension throw
643 639 ** which supports versions unknown of Mercurial.
644 640 ** Please disable throw and try your action again.
645 641 ** If that fixes the bug please report it to the extension author.
646 642 ** Python * (glob)
647 643 ** Mercurial Distributed SCM * (glob)
648 644 ** Extensions loaded: throw
649 645 empty declaration of supported version, extension complains:
650 646 $ echo "testedwith = ''" >> throw.py
651 647 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
652 648 ** Unknown exception encountered with possibly-broken third-party extension throw
653 649 ** which supports versions unknown of Mercurial.
654 650 ** Please disable throw and try your action again.
655 651 ** If that fixes the bug please report it to the extension author.
656 652 ** Python * (glob)
657 653 ** Mercurial Distributed SCM (*) (glob)
658 654 ** Extensions loaded: throw
659 655 If the extension specifies a buglink, show that:
660 656 $ echo 'buglink = "http://example.com/bts"' >> throw.py
661 657 $ rm -f throw.pyc throw.pyo
662 658 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
663 659 ** Unknown exception encountered with possibly-broken third-party extension throw
664 660 ** which supports versions unknown of Mercurial.
665 661 ** Please disable throw and try your action again.
666 662 ** If that fixes the bug please report it to http://example.com/bts
667 663 ** Python * (glob)
668 664 ** Mercurial Distributed SCM (*) (glob)
669 665 ** Extensions loaded: throw
670 666 If the extensions declare outdated versions, accuse the older extension first:
671 667 $ echo "from mercurial import util" >> older.py
672 668 $ echo "util.version = lambda:'2.2'" >> older.py
673 669 $ echo "testedwith = '1.9.3'" >> older.py
674 670 $ echo "testedwith = '2.1.1'" >> throw.py
675 671 $ rm -f throw.pyc throw.pyo
676 672 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
677 673 > throw 2>&1 | egrep '^\*\*'
678 674 ** Unknown exception encountered with possibly-broken third-party extension older
679 675 ** which supports versions 1.9.3 of Mercurial.
680 676 ** Please disable older and try your action again.
681 677 ** If that fixes the bug please report it to the extension author.
682 678 ** Python * (glob)
683 679 ** Mercurial Distributed SCM (version 2.2)
684 680 ** Extensions loaded: throw, older
685 681 One extension only tested with older, one only with newer versions:
686 682 $ echo "util.version = lambda:'2.1.0'" >> older.py
687 683 $ rm -f older.pyc older.pyo
688 684 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
689 685 > throw 2>&1 | egrep '^\*\*'
690 686 ** Unknown exception encountered with possibly-broken third-party extension older
691 687 ** which supports versions 1.9.3 of Mercurial.
692 688 ** Please disable older and try your action again.
693 689 ** If that fixes the bug please report it to the extension author.
694 690 ** Python * (glob)
695 691 ** Mercurial Distributed SCM (version 2.1.0)
696 692 ** Extensions loaded: throw, older
697 693 Older extension is tested with current version, the other only with newer:
698 694 $ echo "util.version = lambda:'1.9.3'" >> older.py
699 695 $ rm -f older.pyc older.pyo
700 696 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
701 697 > throw 2>&1 | egrep '^\*\*'
702 698 ** Unknown exception encountered with possibly-broken third-party extension throw
703 699 ** which supports versions 2.1.1 of Mercurial.
704 700 ** Please disable throw and try your action again.
705 701 ** If that fixes the bug please report it to http://example.com/bts
706 702 ** Python * (glob)
707 703 ** Mercurial Distributed SCM (version 1.9.3)
708 704 ** Extensions loaded: throw, older
709 705
710 706 Declare the version as supporting this hg version, show regular bts link:
711 707 $ hgver=`python -c 'from mercurial import util; print util.version().split("+")[0]'`
712 708 $ echo 'testedwith = """'"$hgver"'"""' >> throw.py
713 709 $ rm -f throw.pyc throw.pyo
714 710 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
715 711 ** unknown exception encountered, please report by visiting
716 712 ** http://mercurial.selenic.com/wiki/BugTracker
717 713 ** Python * (glob)
718 714 ** Mercurial Distributed SCM (*) (glob)
719 715 ** Extensions loaded: throw
720 716
721 717 Restore HGRCPATH
722 718
723 719 $ HGRCPATH=$ORGHGRCPATH
724 720 $ export HGRCPATH
725 721
726 722 Commands handling multiple repositories at a time should invoke only
727 723 "reposetup()" of extensions enabling in the target repository.
728 724
729 725 $ mkdir reposetup-test
730 726 $ cd reposetup-test
731 727
732 728 $ cat > $TESTTMP/reposetuptest.py <<EOF
733 729 > from mercurial import extensions
734 730 > def reposetup(ui, repo):
735 731 > ui.write('reposetup() for %s\n' % (repo.root))
736 732 > EOF
737 733 $ hg init src
738 734 $ echo a > src/a
739 735 $ hg -R src commit -Am '#0 at src/a'
740 736 adding a
741 737 $ echo '[extensions]' >> src/.hg/hgrc
742 738 $ echo '# enable extension locally' >> src/.hg/hgrc
743 739 $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> src/.hg/hgrc
744 740 $ hg -R src status
745 741 reposetup() for $TESTTMP/reposetup-test/src (glob)
746 742
747 743 $ hg clone -U src clone-dst1
748 744 reposetup() for $TESTTMP/reposetup-test/src (glob)
749 745 $ hg init push-dst1
750 746 $ hg -q -R src push push-dst1
751 747 reposetup() for $TESTTMP/reposetup-test/src (glob)
752 748 $ hg init pull-src1
753 749 $ hg -q -R pull-src1 pull src
754 750 reposetup() for $TESTTMP/reposetup-test/src (glob)
755 751
756 752 $ echo '[extensions]' >> $HGRCPATH
757 753 $ echo '# disable extension globally and explicitly' >> $HGRCPATH
758 754 $ echo 'reposetuptest = !' >> $HGRCPATH
759 755 $ hg clone -U src clone-dst2
760 756 reposetup() for $TESTTMP/reposetup-test/src (glob)
761 757 $ hg init push-dst2
762 758 $ hg -q -R src push push-dst2
763 759 reposetup() for $TESTTMP/reposetup-test/src (glob)
764 760 $ hg init pull-src2
765 761 $ hg -q -R pull-src2 pull src
766 762 reposetup() for $TESTTMP/reposetup-test/src (glob)
767 763
768 764 $ echo '[extensions]' >> $HGRCPATH
769 765 $ echo '# enable extension globally' >> $HGRCPATH
770 766 $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> $HGRCPATH
771 767 $ hg clone -U src clone-dst3
772 768 reposetup() for $TESTTMP/reposetup-test/src (glob)
773 769 reposetup() for $TESTTMP/reposetup-test/clone-dst3 (glob)
774 770 $ hg init push-dst3
775 771 reposetup() for $TESTTMP/reposetup-test/push-dst3 (glob)
776 772 $ hg -q -R src push push-dst3
777 773 reposetup() for $TESTTMP/reposetup-test/src (glob)
778 774 reposetup() for $TESTTMP/reposetup-test/push-dst3 (glob)
779 775 $ hg init pull-src3
780 776 reposetup() for $TESTTMP/reposetup-test/pull-src3 (glob)
781 777 $ hg -q -R pull-src3 pull src
782 778 reposetup() for $TESTTMP/reposetup-test/pull-src3 (glob)
783 779 reposetup() for $TESTTMP/reposetup-test/src (glob)
784 780
785 781 $ echo '[extensions]' >> src/.hg/hgrc
786 782 $ echo '# disable extension locally' >> src/.hg/hgrc
787 783 $ echo 'reposetuptest = !' >> src/.hg/hgrc
788 784 $ hg clone -U src clone-dst4
789 785 reposetup() for $TESTTMP/reposetup-test/clone-dst4 (glob)
790 786 $ hg init push-dst4
791 787 reposetup() for $TESTTMP/reposetup-test/push-dst4 (glob)
792 788 $ hg -q -R src push push-dst4
793 789 reposetup() for $TESTTMP/reposetup-test/push-dst4 (glob)
794 790 $ hg init pull-src4
795 791 reposetup() for $TESTTMP/reposetup-test/pull-src4 (glob)
796 792 $ hg -q -R pull-src4 pull src
797 793 reposetup() for $TESTTMP/reposetup-test/pull-src4 (glob)
798 794
799 795 disabling in command line overlays with all configuration
800 796 $ hg --config extensions.reposetuptest=! clone -U src clone-dst5
801 797 $ hg --config extensions.reposetuptest=! init push-dst5
802 798 $ hg --config extensions.reposetuptest=! -q -R src push push-dst5
803 799 $ hg --config extensions.reposetuptest=! init pull-src5
804 800 $ hg --config extensions.reposetuptest=! -q -R pull-src5 pull src
805 801
806 802 $ echo '[extensions]' >> $HGRCPATH
807 803 $ echo '# disable extension globally and explicitly' >> $HGRCPATH
808 804 $ echo 'reposetuptest = !' >> $HGRCPATH
809 805 $ hg init parent
810 806 $ hg init parent/sub1
811 807 $ echo 1 > parent/sub1/1
812 808 $ hg -R parent/sub1 commit -Am '#0 at parent/sub1'
813 809 adding 1
814 810 $ hg init parent/sub2
815 811 $ hg init parent/sub2/sub21
816 812 $ echo 21 > parent/sub2/sub21/21
817 813 $ hg -R parent/sub2/sub21 commit -Am '#0 at parent/sub2/sub21'
818 814 adding 21
819 815 $ cat > parent/sub2/.hgsub <<EOF
820 816 > sub21 = sub21
821 817 > EOF
822 818 $ hg -R parent/sub2 commit -Am '#0 at parent/sub2'
823 819 adding .hgsub
824 820 $ hg init parent/sub3
825 821 $ echo 3 > parent/sub3/3
826 822 $ hg -R parent/sub3 commit -Am '#0 at parent/sub3'
827 823 adding 3
828 824 $ cat > parent/.hgsub <<EOF
829 825 > sub1 = sub1
830 826 > sub2 = sub2
831 827 > sub3 = sub3
832 828 > EOF
833 829 $ hg -R parent commit -Am '#0 at parent'
834 830 adding .hgsub
835 831 $ echo '[extensions]' >> parent/.hg/hgrc
836 832 $ echo '# enable extension locally' >> parent/.hg/hgrc
837 833 $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> parent/.hg/hgrc
838 834 $ cp parent/.hg/hgrc parent/sub2/.hg/hgrc
839 835 $ hg -R parent status -S -A
840 836 reposetup() for $TESTTMP/reposetup-test/parent (glob)
841 837 reposetup() for $TESTTMP/reposetup-test/parent/sub2 (glob)
842 838 C .hgsub
843 839 C .hgsubstate
844 840 C sub1/1
845 841 C sub2/.hgsub
846 842 C sub2/.hgsubstate
847 843 C sub2/sub21/21
848 844 C sub3/3
849 845
850 846 $ cd ..
@@ -1,2087 +1,2087 b''
1 1 Short help:
2 2
3 3 $ hg
4 4 Mercurial Distributed SCM
5 5
6 6 basic commands:
7 7
8 8 add add the specified files on the next commit
9 9 annotate show changeset information by line for each file
10 10 clone make a copy of an existing repository
11 11 commit commit the specified files or all outstanding changes
12 12 diff diff repository (or selected files)
13 13 export dump the header and diffs for one or more changesets
14 14 forget forget the specified files on the next commit
15 15 init create a new repository in the given directory
16 16 log show revision history of entire repository or files
17 17 merge merge working directory with another revision
18 18 pull pull changes from the specified source
19 19 push push changes to the specified destination
20 20 remove remove the specified files on the next commit
21 21 serve start stand-alone webserver
22 22 status show changed files in the working directory
23 23 summary summarize working directory state
24 24 update update working directory (or switch revisions)
25 25
26 26 use "hg help" for the full list of commands or "hg -v" for details
27 27
28 28 $ hg -q
29 29 add add the specified files on the next commit
30 30 annotate show changeset information by line for each file
31 31 clone make a copy of an existing repository
32 32 commit commit the specified files or all outstanding changes
33 33 diff diff repository (or selected files)
34 34 export dump the header and diffs for one or more changesets
35 35 forget forget the specified files on the next commit
36 36 init create a new repository in the given directory
37 37 log show revision history of entire repository or files
38 38 merge merge working directory with another revision
39 39 pull pull changes from the specified source
40 40 push push changes to the specified destination
41 41 remove remove the specified files on the next commit
42 42 serve start stand-alone webserver
43 43 status show changed files in the working directory
44 44 summary summarize working directory state
45 45 update update working directory (or switch revisions)
46 46
47 47 $ hg help
48 48 Mercurial Distributed SCM
49 49
50 50 list of commands:
51 51
52 52 add add the specified files on the next commit
53 53 addremove add all new files, delete all missing files
54 54 annotate show changeset information by line for each file
55 55 archive create an unversioned archive of a repository revision
56 56 backout reverse effect of earlier changeset
57 57 bisect subdivision search of changesets
58 58 bookmarks create a new bookmark or list existing bookmarks
59 59 branch set or show the current branch name
60 60 branches list repository named branches
61 61 bundle create a changegroup file
62 62 cat output the current or given revision of files
63 63 clone make a copy of an existing repository
64 64 commit commit the specified files or all outstanding changes
65 65 config show combined config settings from all hgrc files
66 66 copy mark files as copied for the next commit
67 67 diff diff repository (or selected files)
68 68 export dump the header and diffs for one or more changesets
69 69 forget forget the specified files on the next commit
70 70 graft copy changes from other branches onto the current branch
71 71 grep search for a pattern in specified files and revisions
72 72 heads show branch heads
73 73 help show help for a given topic or a help overview
74 74 identify identify the working copy or specified revision
75 75 import import an ordered set of patches
76 76 incoming show new changesets found in source
77 77 init create a new repository in the given directory
78 78 locate locate files matching specific patterns
79 79 log show revision history of entire repository or files
80 80 manifest output the current or given revision of the project manifest
81 81 merge merge working directory with another revision
82 82 outgoing show changesets not found in the destination
83 83 parents show the parents of the working directory or revision
84 84 paths show aliases for remote repositories
85 85 phase set or show the current phase name
86 86 pull pull changes from the specified source
87 87 push push changes to the specified destination
88 88 recover roll back an interrupted transaction
89 89 remove remove the specified files on the next commit
90 90 rename rename files; equivalent of copy + remove
91 91 resolve redo merges or set/view the merge status of files
92 92 revert restore files to their checkout state
93 93 root print the root (top) of the current working directory
94 94 serve start stand-alone webserver
95 95 status show changed files in the working directory
96 96 summary summarize working directory state
97 97 tag add one or more tags for the current or given revision
98 98 tags list repository tags
99 99 unbundle apply one or more changegroup files
100 100 update update working directory (or switch revisions)
101 101 verify verify the integrity of the repository
102 102 version output version and copyright information
103 103
104 104 additional help topics:
105 105
106 106 config Configuration Files
107 107 dates Date Formats
108 108 diffs Diff Formats
109 109 environment Environment Variables
110 110 extensions Using Additional Features
111 111 filesets Specifying File Sets
112 112 glossary Glossary
113 113 hgignore Syntax for Mercurial Ignore Files
114 114 hgweb Configuring hgweb
115 115 merge-tools Merge Tools
116 116 multirevs Specifying Multiple Revisions
117 117 patterns File Name Patterns
118 118 phases Working with Phases
119 119 revisions Specifying Single Revisions
120 120 revsets Specifying Revision Sets
121 121 subrepos Subrepositories
122 122 templating Template Usage
123 123 urls URL Paths
124 124
125 125 use "hg -v help" to show builtin aliases and global options
126 126
127 127 $ hg -q help
128 128 add add the specified files on the next commit
129 129 addremove add all new files, delete all missing files
130 130 annotate show changeset information by line for each file
131 131 archive create an unversioned archive of a repository revision
132 132 backout reverse effect of earlier changeset
133 133 bisect subdivision search of changesets
134 134 bookmarks create a new bookmark or list existing bookmarks
135 135 branch set or show the current branch name
136 136 branches list repository named branches
137 137 bundle create a changegroup file
138 138 cat output the current or given revision of files
139 139 clone make a copy of an existing repository
140 140 commit commit the specified files or all outstanding changes
141 141 config show combined config settings from all hgrc files
142 142 copy mark files as copied for the next commit
143 143 diff diff repository (or selected files)
144 144 export dump the header and diffs for one or more changesets
145 145 forget forget the specified files on the next commit
146 146 graft copy changes from other branches onto the current branch
147 147 grep search for a pattern in specified files and revisions
148 148 heads show branch heads
149 149 help show help for a given topic or a help overview
150 150 identify identify the working copy or specified revision
151 151 import import an ordered set of patches
152 152 incoming show new changesets found in source
153 153 init create a new repository in the given directory
154 154 locate locate files matching specific patterns
155 155 log show revision history of entire repository or files
156 156 manifest output the current or given revision of the project manifest
157 157 merge merge working directory with another revision
158 158 outgoing show changesets not found in the destination
159 159 parents show the parents of the working directory or revision
160 160 paths show aliases for remote repositories
161 161 phase set or show the current phase name
162 162 pull pull changes from the specified source
163 163 push push changes to the specified destination
164 164 recover roll back an interrupted transaction
165 165 remove remove the specified files on the next commit
166 166 rename rename files; equivalent of copy + remove
167 167 resolve redo merges or set/view the merge status of files
168 168 revert restore files to their checkout state
169 169 root print the root (top) of the current working directory
170 170 serve start stand-alone webserver
171 171 status show changed files in the working directory
172 172 summary summarize working directory state
173 173 tag add one or more tags for the current or given revision
174 174 tags list repository tags
175 175 unbundle apply one or more changegroup files
176 176 update update working directory (or switch revisions)
177 177 verify verify the integrity of the repository
178 178 version output version and copyright information
179 179
180 180 additional help topics:
181 181
182 182 config Configuration Files
183 183 dates Date Formats
184 184 diffs Diff Formats
185 185 environment Environment Variables
186 186 extensions Using Additional Features
187 187 filesets Specifying File Sets
188 188 glossary Glossary
189 189 hgignore Syntax for Mercurial Ignore Files
190 190 hgweb Configuring hgweb
191 191 merge-tools Merge Tools
192 192 multirevs Specifying Multiple Revisions
193 193 patterns File Name Patterns
194 194 phases Working with Phases
195 195 revisions Specifying Single Revisions
196 196 revsets Specifying Revision Sets
197 197 subrepos Subrepositories
198 198 templating Template Usage
199 199 urls URL Paths
200 200
201 201 Test extension help:
202 202 $ hg help extensions --config extensions.rebase= --config extensions.children=
203 203 Using Additional Features
204 204 """""""""""""""""""""""""
205 205
206 206 Mercurial has the ability to add new features through the use of
207 207 extensions. Extensions may add new commands, add options to existing
208 208 commands, change the default behavior of commands, or implement hooks.
209 209
210 210 To enable the "foo" extension, either shipped with Mercurial or in the
211 211 Python search path, create an entry for it in your configuration file,
212 212 like this:
213 213
214 214 [extensions]
215 215 foo =
216 216
217 217 You may also specify the full path to an extension:
218 218
219 219 [extensions]
220 220 myfeature = ~/.hgext/myfeature.py
221 221
222 222 See "hg help config" for more information on configuration files.
223 223
224 224 Extensions are not loaded by default for a variety of reasons: they can
225 225 increase startup overhead; they may be meant for advanced usage only; they
226 226 may provide potentially dangerous abilities (such as letting you destroy
227 227 or modify history); they might not be ready for prime time; or they may
228 228 alter some usual behaviors of stock Mercurial. It is thus up to the user
229 229 to activate extensions as needed.
230 230
231 231 To explicitly disable an extension enabled in a configuration file of
232 232 broader scope, prepend its path with !:
233 233
234 234 [extensions]
235 235 # disabling extension bar residing in /path/to/extension/bar.py
236 236 bar = !/path/to/extension/bar.py
237 237 # ditto, but no path was supplied for extension baz
238 238 baz = !
239 239
240 240 enabled extensions:
241 241
242 242 children command to display child changesets (DEPRECATED)
243 243 rebase command to move sets of revisions to a different ancestor
244 244
245 245 disabled extensions:
246 246
247 247 acl hooks for controlling repository access
248 248 blackbox log repository events to a blackbox for debugging
249 249 bugzilla hooks for integrating with the Bugzilla bug tracker
250 250 churn command to display statistics about repository history
251 251 color colorize output from some commands
252 252 convert import revisions from foreign VCS repositories into
253 253 Mercurial
254 254 eol automatically manage newlines in repository files
255 255 extdiff command to allow external programs to compare revisions
256 256 factotum http authentication with factotum
257 257 gpg commands to sign and verify changesets
258 258 hgcia hooks for integrating with the CIA.vc notification service
259 259 hgk browse the repository in a graphical way
260 260 highlight syntax highlighting for hgweb (requires Pygments)
261 261 histedit interactive history editing
262 262 keyword expand keywords in tracked files
263 263 largefiles track large binary files
264 264 mq manage a stack of patches
265 265 notify hooks for sending email push notifications
266 266 pager browse command output with an external pager
267 267 patchbomb command to send changesets as (a series of) patch emails
268 268 progress show progress bars for some actions
269 269 purge command to delete untracked files from the working
270 270 directory
271 271 record commands to interactively select changes for
272 272 commit/qrefresh
273 273 relink recreates hardlinks between repository clones
274 274 schemes extend schemes with shortcuts to repository swarms
275 275 share share a common history between several working directories
276 276 shelve save and restore changes to the working directory
277 277 strip strip changesets and their descendents from history
278 278 transplant command to transplant changesets from another branch
279 279 win32mbcs allow the use of MBCS paths with problematic encodings
280 280 zeroconf discover and advertise repositories on the local network
281 281 Test short command list with verbose option
282 282
283 283 $ hg -v help shortlist
284 284 Mercurial Distributed SCM
285 285
286 286 basic commands:
287 287
288 288 add add the specified files on the next commit
289 289 annotate, blame
290 290 show changeset information by line for each file
291 291 clone make a copy of an existing repository
292 292 commit, ci commit the specified files or all outstanding changes
293 293 diff diff repository (or selected files)
294 294 export dump the header and diffs for one or more changesets
295 295 forget forget the specified files on the next commit
296 296 init create a new repository in the given directory
297 297 log, history show revision history of entire repository or files
298 298 merge merge working directory with another revision
299 299 pull pull changes from the specified source
300 300 push push changes to the specified destination
301 301 remove, rm remove the specified files on the next commit
302 302 serve start stand-alone webserver
303 303 status, st show changed files in the working directory
304 304 summary, sum summarize working directory state
305 305 update, up, checkout, co
306 306 update working directory (or switch revisions)
307 307
308 308 global options:
309 309
310 310 -R --repository REPO repository root directory or name of overlay bundle
311 311 file
312 312 --cwd DIR change working directory
313 313 -y --noninteractive do not prompt, automatically pick the first choice for
314 314 all prompts
315 315 -q --quiet suppress output
316 316 -v --verbose enable additional output
317 317 --config CONFIG [+] set/override config option (use 'section.name=value')
318 318 --debug enable debugging output
319 319 --debugger start debugger
320 320 --encoding ENCODE set the charset encoding (default: ascii)
321 321 --encodingmode MODE set the charset encoding mode (default: strict)
322 322 --traceback always print a traceback on exception
323 323 --time time how long the command takes
324 324 --profile print command execution profile
325 325 --version output version information and exit
326 326 -h --help display help and exit
327 327 --hidden consider hidden changesets
328 328
329 329 [+] marked option can be specified multiple times
330 330
331 331 use "hg help" for the full list of commands
332 332
333 333 $ hg add -h
334 334 hg add [OPTION]... [FILE]...
335 335
336 336 add the specified files on the next commit
337 337
338 338 Schedule files to be version controlled and added to the repository.
339 339
340 340 The files will be added to the repository at the next commit. To undo an
341 341 add before that, see "hg forget".
342 342
343 343 If no names are given, add all files to the repository.
344 344
345 345 Returns 0 if all files are successfully added.
346 346
347 347 options:
348 348
349 349 -I --include PATTERN [+] include names matching the given patterns
350 350 -X --exclude PATTERN [+] exclude names matching the given patterns
351 351 -S --subrepos recurse into subrepositories
352 352 -n --dry-run do not perform actions, just print output
353 353
354 354 [+] marked option can be specified multiple times
355 355
356 356 use "hg -v help add" to show more complete help and the global options
357 357
358 358 Verbose help for add
359 359
360 360 $ hg add -hv
361 361 hg add [OPTION]... [FILE]...
362 362
363 363 add the specified files on the next commit
364 364
365 365 Schedule files to be version controlled and added to the repository.
366 366
367 367 The files will be added to the repository at the next commit. To undo an
368 368 add before that, see "hg forget".
369 369
370 370 If no names are given, add all files to the repository.
371 371
372 372 An example showing how new (unknown) files are added automatically by "hg
373 373 add":
374 374
375 375 $ ls
376 376 foo.c
377 377 $ hg status
378 378 ? foo.c
379 379 $ hg add
380 380 adding foo.c
381 381 $ hg status
382 382 A foo.c
383 383
384 384 Returns 0 if all files are successfully added.
385 385
386 386 options:
387 387
388 388 -I --include PATTERN [+] include names matching the given patterns
389 389 -X --exclude PATTERN [+] exclude names matching the given patterns
390 390 -S --subrepos recurse into subrepositories
391 391 -n --dry-run do not perform actions, just print output
392 392
393 393 [+] marked option can be specified multiple times
394 394
395 395 global options:
396 396
397 397 -R --repository REPO repository root directory or name of overlay bundle
398 398 file
399 399 --cwd DIR change working directory
400 400 -y --noninteractive do not prompt, automatically pick the first choice for
401 401 all prompts
402 402 -q --quiet suppress output
403 403 -v --verbose enable additional output
404 404 --config CONFIG [+] set/override config option (use 'section.name=value')
405 405 --debug enable debugging output
406 406 --debugger start debugger
407 407 --encoding ENCODE set the charset encoding (default: ascii)
408 408 --encodingmode MODE set the charset encoding mode (default: strict)
409 409 --traceback always print a traceback on exception
410 410 --time time how long the command takes
411 411 --profile print command execution profile
412 412 --version output version information and exit
413 413 -h --help display help and exit
414 414 --hidden consider hidden changesets
415 415
416 416 [+] marked option can be specified multiple times
417 417
418 418 Test help option with version option
419 419
420 420 $ hg add -h --version
421 421 Mercurial Distributed SCM (version *) (glob)
422 422 (see http://mercurial.selenic.com for more information)
423 423
424 424 Copyright (C) 2005-2014 Matt Mackall and others
425 425 This is free software; see the source for copying conditions. There is NO
426 426 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
427 427
428 428 $ hg add --skjdfks
429 429 hg add: option --skjdfks not recognized
430 430 hg add [OPTION]... [FILE]...
431 431
432 432 add the specified files on the next commit
433 433
434 434 options:
435 435
436 436 -I --include PATTERN [+] include names matching the given patterns
437 437 -X --exclude PATTERN [+] exclude names matching the given patterns
438 438 -S --subrepos recurse into subrepositories
439 439 -n --dry-run do not perform actions, just print output
440 440
441 441 [+] marked option can be specified multiple times
442 442
443 443 use "hg help add" to show the full help text
444 444 [255]
445 445
446 446 Test ambiguous command help
447 447
448 448 $ hg help ad
449 449 list of commands:
450 450
451 451 add add the specified files on the next commit
452 452 addremove add all new files, delete all missing files
453 453
454 454 use "hg -v help ad" to show builtin aliases and global options
455 455
456 456 Test command without options
457 457
458 458 $ hg help verify
459 459 hg verify
460 460
461 461 verify the integrity of the repository
462 462
463 463 Verify the integrity of the current repository.
464 464
465 465 This will perform an extensive check of the repository's integrity,
466 466 validating the hashes and checksums of each entry in the changelog,
467 467 manifest, and tracked files, as well as the integrity of their crosslinks
468 468 and indices.
469 469
470 470 Please see http://mercurial.selenic.com/wiki/RepositoryCorruption for more
471 471 information about recovery from corruption of the repository.
472 472
473 473 Returns 0 on success, 1 if errors are encountered.
474 474
475 475 use "hg -v help verify" to show the global options
476 476
477 477 $ hg help diff
478 478 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
479 479
480 480 diff repository (or selected files)
481 481
482 482 Show differences between revisions for the specified files.
483 483
484 484 Differences between files are shown using the unified diff format.
485 485
486 486 Note:
487 487 diff may generate unexpected results for merges, as it will default to
488 488 comparing against the working directory's first parent changeset if no
489 489 revisions are specified.
490 490
491 491 When two revision arguments are given, then changes are shown between
492 492 those revisions. If only one revision is specified then that revision is
493 493 compared to the working directory, and, when no revisions are specified,
494 494 the working directory files are compared to its parent.
495 495
496 496 Alternatively you can specify -c/--change with a revision to see the
497 497 changes in that changeset relative to its first parent.
498 498
499 499 Without the -a/--text option, diff will avoid generating diffs of files it
500 500 detects as binary. With -a, diff will generate a diff anyway, probably
501 501 with undesirable results.
502 502
503 503 Use the -g/--git option to generate diffs in the git extended diff format.
504 504 For more information, read "hg help diffs".
505 505
506 506 Returns 0 on success.
507 507
508 508 options:
509 509
510 510 -r --rev REV [+] revision
511 511 -c --change REV change made by revision
512 512 -a --text treat all files as text
513 513 -g --git use git extended diff format
514 514 --nodates omit dates from diff headers
515 515 -p --show-function show which function each change is in
516 516 --reverse produce a diff that undoes the changes
517 517 -w --ignore-all-space ignore white space when comparing lines
518 518 -b --ignore-space-change ignore changes in the amount of white space
519 519 -B --ignore-blank-lines ignore changes whose lines are all blank
520 520 -U --unified NUM number of lines of context to show
521 521 --stat output diffstat-style summary of changes
522 522 -I --include PATTERN [+] include names matching the given patterns
523 523 -X --exclude PATTERN [+] exclude names matching the given patterns
524 524 -S --subrepos recurse into subrepositories
525 525
526 526 [+] marked option can be specified multiple times
527 527
528 528 use "hg -v help diff" to show more complete help and the global options
529 529
530 530 $ hg help status
531 531 hg status [OPTION]... [FILE]...
532 532
533 533 aliases: st
534 534
535 535 show changed files in the working directory
536 536
537 537 Show status of files in the repository. If names are given, only files
538 538 that match are shown. Files that are clean or ignored or the source of a
539 539 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
540 540 -C/--copies or -A/--all are given. Unless options described with "show
541 541 only ..." are given, the options -mardu are used.
542 542
543 543 Option -q/--quiet hides untracked (unknown and ignored) files unless
544 544 explicitly requested with -u/--unknown or -i/--ignored.
545 545
546 546 Note:
547 547 status may appear to disagree with diff if permissions have changed or
548 548 a merge has occurred. The standard diff format does not report
549 549 permission changes and diff only reports changes relative to one merge
550 550 parent.
551 551
552 552 If one revision is given, it is used as the base revision. If two
553 553 revisions are given, the differences between them are shown. The --change
554 554 option can also be used as a shortcut to list the changed files of a
555 555 revision from its first parent.
556 556
557 557 The codes used to show the status of files are:
558 558
559 559 M = modified
560 560 A = added
561 561 R = removed
562 562 C = clean
563 563 ! = missing (deleted by non-hg command, but still tracked)
564 564 ? = not tracked
565 565 I = ignored
566 566 = origin of the previous file (with --copies)
567 567
568 568 Returns 0 on success.
569 569
570 570 options:
571 571
572 572 -A --all show status of all files
573 573 -m --modified show only modified files
574 574 -a --added show only added files
575 575 -r --removed show only removed files
576 576 -d --deleted show only deleted (but tracked) files
577 577 -c --clean show only files without changes
578 578 -u --unknown show only unknown (not tracked) files
579 579 -i --ignored show only ignored files
580 580 -n --no-status hide status prefix
581 581 -C --copies show source of copied files
582 582 -0 --print0 end filenames with NUL, for use with xargs
583 583 --rev REV [+] show difference from revision
584 584 --change REV list the changed files of a revision
585 585 -I --include PATTERN [+] include names matching the given patterns
586 586 -X --exclude PATTERN [+] exclude names matching the given patterns
587 587 -S --subrepos recurse into subrepositories
588 588
589 589 [+] marked option can be specified multiple times
590 590
591 591 use "hg -v help status" to show more complete help and the global options
592 592
593 593 $ hg -q help status
594 594 hg status [OPTION]... [FILE]...
595 595
596 596 show changed files in the working directory
597 597
598 598 $ hg help foo
599 599 abort: no such help topic: foo
600 600 (try "hg help --keyword foo")
601 601 [255]
602 602
603 603 $ hg skjdfks
604 604 hg: unknown command 'skjdfks'
605 605 Mercurial Distributed SCM
606 606
607 607 basic commands:
608 608
609 609 add add the specified files on the next commit
610 610 annotate show changeset information by line for each file
611 611 clone make a copy of an existing repository
612 612 commit commit the specified files or all outstanding changes
613 613 diff diff repository (or selected files)
614 614 export dump the header and diffs for one or more changesets
615 615 forget forget the specified files on the next commit
616 616 init create a new repository in the given directory
617 617 log show revision history of entire repository or files
618 618 merge merge working directory with another revision
619 619 pull pull changes from the specified source
620 620 push push changes to the specified destination
621 621 remove remove the specified files on the next commit
622 622 serve start stand-alone webserver
623 623 status show changed files in the working directory
624 624 summary summarize working directory state
625 625 update update working directory (or switch revisions)
626 626
627 627 use "hg help" for the full list of commands or "hg -v" for details
628 628 [255]
629 629
630 630
631 631 $ cat > helpext.py <<EOF
632 632 > import os
633 633 > from mercurial import cmdutil, commands
634 634 >
635 635 > cmdtable = {}
636 636 > command = cmdutil.command(cmdtable)
637 637 >
638 638 > @command('nohelp',
639 639 > [('', 'longdesc', 3, 'x'*90),
640 640 > ('n', '', None, 'normal desc'),
641 641 > ('', 'newline', '', 'line1\nline2')],
642 > 'hg nohelp')
642 > 'hg nohelp',
643 > norepo=True)
643 644 > @command('debugoptDEP', [('', 'dopt', None, 'option is DEPRECATED')])
644 645 > def nohelp(ui, *args, **kwargs):
645 646 > pass
646 647 >
647 > commands.norepo += ' nohelp'
648 648 > EOF
649 649 $ echo '[extensions]' >> $HGRCPATH
650 650 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
651 651
652 652 Test command with no help text
653 653
654 654 $ hg help nohelp
655 655 hg nohelp
656 656
657 657 (no help text available)
658 658
659 659 options:
660 660
661 661 --longdesc VALUE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
662 662 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (default: 3)
663 663 -n -- normal desc
664 664 --newline VALUE line1 line2
665 665
666 666 use "hg -v help nohelp" to show the global options
667 667
668 668 $ hg help -k nohelp
669 669 Commands:
670 670
671 671 nohelp hg nohelp
672 672
673 673 Extension Commands:
674 674
675 675 nohelp (no help text available)
676 676
677 677 Test that default list of commands omits extension commands
678 678
679 679 $ hg help
680 680 Mercurial Distributed SCM
681 681
682 682 list of commands:
683 683
684 684 add add the specified files on the next commit
685 685 addremove add all new files, delete all missing files
686 686 annotate show changeset information by line for each file
687 687 archive create an unversioned archive of a repository revision
688 688 backout reverse effect of earlier changeset
689 689 bisect subdivision search of changesets
690 690 bookmarks create a new bookmark or list existing bookmarks
691 691 branch set or show the current branch name
692 692 branches list repository named branches
693 693 bundle create a changegroup file
694 694 cat output the current or given revision of files
695 695 clone make a copy of an existing repository
696 696 commit commit the specified files or all outstanding changes
697 697 config show combined config settings from all hgrc files
698 698 copy mark files as copied for the next commit
699 699 diff diff repository (or selected files)
700 700 export dump the header and diffs for one or more changesets
701 701 forget forget the specified files on the next commit
702 702 graft copy changes from other branches onto the current branch
703 703 grep search for a pattern in specified files and revisions
704 704 heads show branch heads
705 705 help show help for a given topic or a help overview
706 706 identify identify the working copy or specified revision
707 707 import import an ordered set of patches
708 708 incoming show new changesets found in source
709 709 init create a new repository in the given directory
710 710 locate locate files matching specific patterns
711 711 log show revision history of entire repository or files
712 712 manifest output the current or given revision of the project manifest
713 713 merge merge working directory with another revision
714 714 outgoing show changesets not found in the destination
715 715 parents show the parents of the working directory or revision
716 716 paths show aliases for remote repositories
717 717 phase set or show the current phase name
718 718 pull pull changes from the specified source
719 719 push push changes to the specified destination
720 720 recover roll back an interrupted transaction
721 721 remove remove the specified files on the next commit
722 722 rename rename files; equivalent of copy + remove
723 723 resolve redo merges or set/view the merge status of files
724 724 revert restore files to their checkout state
725 725 root print the root (top) of the current working directory
726 726 serve start stand-alone webserver
727 727 status show changed files in the working directory
728 728 summary summarize working directory state
729 729 tag add one or more tags for the current or given revision
730 730 tags list repository tags
731 731 unbundle apply one or more changegroup files
732 732 update update working directory (or switch revisions)
733 733 verify verify the integrity of the repository
734 734 version output version and copyright information
735 735
736 736 enabled extensions:
737 737
738 738 helpext (no help text available)
739 739
740 740 additional help topics:
741 741
742 742 config Configuration Files
743 743 dates Date Formats
744 744 diffs Diff Formats
745 745 environment Environment Variables
746 746 extensions Using Additional Features
747 747 filesets Specifying File Sets
748 748 glossary Glossary
749 749 hgignore Syntax for Mercurial Ignore Files
750 750 hgweb Configuring hgweb
751 751 merge-tools Merge Tools
752 752 multirevs Specifying Multiple Revisions
753 753 patterns File Name Patterns
754 754 phases Working with Phases
755 755 revisions Specifying Single Revisions
756 756 revsets Specifying Revision Sets
757 757 subrepos Subrepositories
758 758 templating Template Usage
759 759 urls URL Paths
760 760
761 761 use "hg -v help" to show builtin aliases and global options
762 762
763 763
764 764 Test list of internal help commands
765 765
766 766 $ hg help debug
767 767 debug commands (internal and unsupported):
768 768
769 769 debugancestor
770 770 find the ancestor revision of two revisions in a given index
771 771 debugbuilddag
772 772 builds a repo with a given DAG from scratch in the current
773 773 empty repo
774 774 debugbundle lists the contents of a bundle
775 775 debugcheckstate
776 776 validate the correctness of the current dirstate
777 777 debugcommands
778 778 list all available commands and options
779 779 debugcomplete
780 780 returns the completion list associated with the given command
781 781 debugdag format the changelog or an index DAG as a concise textual
782 782 description
783 783 debugdata dump the contents of a data file revision
784 784 debugdate parse and display a date
785 785 debugdirstate
786 786 show the contents of the current dirstate
787 787 debugdiscovery
788 788 runs the changeset discovery protocol in isolation
789 789 debugfileset parse and apply a fileset specification
790 790 debugfsinfo show information detected about current filesystem
791 791 debuggetbundle
792 792 retrieves a bundle from a repo
793 793 debugignore display the combined ignore pattern
794 794 debugindex dump the contents of an index file
795 795 debugindexdot
796 796 dump an index DAG as a graphviz dot file
797 797 debuginstall test Mercurial installation
798 798 debugknown test whether node ids are known to a repo
799 799 debuglabelcomplete
800 800 complete "labels" - tags, open branch names, bookmark names
801 801 debugobsolete
802 802 create arbitrary obsolete marker
803 803 debugoptDEP (no help text available)
804 804 debugpathcomplete
805 805 complete part or all of a tracked path
806 806 debugpushkey access the pushkey key/value protocol
807 807 debugpvec (no help text available)
808 808 debugrebuilddirstate
809 809 rebuild the dirstate as it would look like for the given
810 810 revision
811 811 debugrename dump rename information
812 812 debugrevlog show data and statistics about a revlog
813 813 debugrevspec parse and apply a revision specification
814 814 debugsetparents
815 815 manually set the parents of the current working directory
816 816 debugsub (no help text available)
817 817 debugsuccessorssets
818 818 show set of successors for revision
819 819 debugwalk show how files match on given patterns
820 820 debugwireargs
821 821 (no help text available)
822 822
823 823 use "hg -v help debug" to show builtin aliases and global options
824 824
825 825
826 826 Test list of commands with command with no help text
827 827
828 828 $ hg help helpext
829 829 helpext extension - no help text available
830 830
831 831 list of commands:
832 832
833 833 nohelp (no help text available)
834 834
835 835 use "hg -v help helpext" to show builtin aliases and global options
836 836
837 837
838 838 test deprecated option is hidden in command help
839 839 $ hg help debugoptDEP
840 840 hg debugoptDEP
841 841
842 842 (no help text available)
843 843
844 844 options:
845 845
846 846 use "hg -v help debugoptDEP" to show the global options
847 847
848 848 test deprecated option is shown with -v
849 849 $ hg help -v debugoptDEP | grep dopt
850 850 --dopt option is DEPRECATED
851 851
852 852 #if gettext
853 853 test deprecated option is hidden with translation with untranslated description
854 854 (use many globy for not failing on changed transaction)
855 855 $ LANGUAGE=sv hg help debugoptDEP
856 856 hg debugoptDEP
857 857
858 858 (*) (glob)
859 859
860 860 flaggor:
861 861
862 862 *"hg -v help debugoptDEP"* (glob)
863 863 #endif
864 864
865 865 Test a help topic
866 866
867 867 $ hg help revs
868 868 Specifying Single Revisions
869 869 """""""""""""""""""""""""""
870 870
871 871 Mercurial supports several ways to specify individual revisions.
872 872
873 873 A plain integer is treated as a revision number. Negative integers are
874 874 treated as sequential offsets from the tip, with -1 denoting the tip, -2
875 875 denoting the revision prior to the tip, and so forth.
876 876
877 877 A 40-digit hexadecimal string is treated as a unique revision identifier.
878 878
879 879 A hexadecimal string less than 40 characters long is treated as a unique
880 880 revision identifier and is referred to as a short-form identifier. A
881 881 short-form identifier is only valid if it is the prefix of exactly one
882 882 full-length identifier.
883 883
884 884 Any other string is treated as a bookmark, tag, or branch name. A bookmark
885 885 is a movable pointer to a revision. A tag is a permanent name associated
886 886 with a revision. A branch name denotes the tipmost open branch head of
887 887 that branch - or if they are all closed, the tipmost closed head of the
888 888 branch. Bookmark, tag, and branch names must not contain the ":"
889 889 character.
890 890
891 891 The reserved name "tip" always identifies the most recent revision.
892 892
893 893 The reserved name "null" indicates the null revision. This is the revision
894 894 of an empty repository, and the parent of revision 0.
895 895
896 896 The reserved name "." indicates the working directory parent. If no
897 897 working directory is checked out, it is equivalent to null. If an
898 898 uncommitted merge is in progress, "." is the revision of the first parent.
899 899
900 900 Test templating help
901 901
902 902 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
903 903 desc String. The text of the changeset description.
904 904 diffstat String. Statistics of changes with the following format:
905 905 firstline Any text. Returns the first line of text.
906 906 nonempty Any text. Returns '(none)' if the string is empty.
907 907
908 908 Test help hooks
909 909
910 910 $ cat > helphook1.py <<EOF
911 911 > from mercurial import help
912 912 >
913 913 > def rewrite(topic, doc):
914 914 > return doc + '\nhelphook1\n'
915 915 >
916 916 > def extsetup(ui):
917 917 > help.addtopichook('revsets', rewrite)
918 918 > EOF
919 919 $ cat > helphook2.py <<EOF
920 920 > from mercurial import help
921 921 >
922 922 > def rewrite(topic, doc):
923 923 > return doc + '\nhelphook2\n'
924 924 >
925 925 > def extsetup(ui):
926 926 > help.addtopichook('revsets', rewrite)
927 927 > EOF
928 928 $ echo '[extensions]' >> $HGRCPATH
929 929 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
930 930 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
931 931 $ hg help revsets | grep helphook
932 932 helphook1
933 933 helphook2
934 934
935 935 Test keyword search help
936 936
937 937 $ cat > prefixedname.py <<EOF
938 938 > '''matched against word "clone"
939 939 > '''
940 940 > EOF
941 941 $ echo '[extensions]' >> $HGRCPATH
942 942 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
943 943 $ hg help -k clone
944 944 Topics:
945 945
946 946 config Configuration Files
947 947 extensions Using Additional Features
948 948 glossary Glossary
949 949 phases Working with Phases
950 950 subrepos Subrepositories
951 951 urls URL Paths
952 952
953 953 Commands:
954 954
955 955 bookmarks create a new bookmark or list existing bookmarks
956 956 clone make a copy of an existing repository
957 957 paths show aliases for remote repositories
958 958 update update working directory (or switch revisions)
959 959
960 960 Extensions:
961 961
962 962 prefixedname matched against word "clone"
963 963 relink recreates hardlinks between repository clones
964 964
965 965 Extension Commands:
966 966
967 967 qclone clone main and patch repository at same time
968 968
969 969 Test unfound topic
970 970
971 971 $ hg help nonexistingtopicthatwillneverexisteverever
972 972 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
973 973 (try "hg help --keyword nonexistingtopicthatwillneverexisteverever")
974 974 [255]
975 975
976 976 Test unfound keyword
977 977
978 978 $ hg help --keyword nonexistingwordthatwillneverexisteverever
979 979 abort: no matches
980 980 (try "hg help" for a list of topics)
981 981 [255]
982 982
983 983 Test omit indicating for help
984 984
985 985 $ cat > addverboseitems.py <<EOF
986 986 > '''extension to test omit indicating.
987 987 >
988 988 > This paragraph is never omitted (for extension)
989 989 >
990 990 > .. container:: verbose
991 991 >
992 992 > This paragraph is omitted,
993 993 > if :hg:\`help\` is invoked witout \`\`-v\`\` (for extension)
994 994 >
995 995 > This paragraph is never omitted, too (for extension)
996 996 > '''
997 997 >
998 998 > from mercurial import help, commands
999 999 > testtopic = """This paragraph is never omitted (for topic).
1000 1000 >
1001 1001 > .. container:: verbose
1002 1002 >
1003 1003 > This paragraph is omitted,
1004 1004 > if :hg:\`help\` is invoked witout \`\`-v\`\` (for topic)
1005 1005 >
1006 1006 > This paragraph is never omitted, too (for topic)
1007 1007 > """
1008 1008 > def extsetup(ui):
1009 1009 > help.helptable.append((["topic-containing-verbose"],
1010 1010 > "This is the topic to test omit indicating.",
1011 1011 > lambda : testtopic))
1012 1012 > EOF
1013 1013 $ echo '[extensions]' >> $HGRCPATH
1014 1014 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1015 1015 $ hg help addverboseitems
1016 1016 addverboseitems extension - extension to test omit indicating.
1017 1017
1018 1018 This paragraph is never omitted (for extension)
1019 1019
1020 1020 This paragraph is never omitted, too (for extension)
1021 1021
1022 1022 use "hg help -v addverboseitems" to show more complete help
1023 1023
1024 1024 no commands defined
1025 1025 $ hg help -v addverboseitems
1026 1026 addverboseitems extension - extension to test omit indicating.
1027 1027
1028 1028 This paragraph is never omitted (for extension)
1029 1029
1030 1030 This paragraph is omitted, if "hg help" is invoked witout "-v" (for extension)
1031 1031
1032 1032 This paragraph is never omitted, too (for extension)
1033 1033
1034 1034 no commands defined
1035 1035 $ hg help topic-containing-verbose
1036 1036 This is the topic to test omit indicating.
1037 1037 """"""""""""""""""""""""""""""""""""""""""
1038 1038
1039 1039 This paragraph is never omitted (for topic).
1040 1040
1041 1041 This paragraph is never omitted, too (for topic)
1042 1042
1043 1043 use "hg help -v topic-containing-verbose" to show more complete help
1044 1044 $ hg help -v topic-containing-verbose
1045 1045 This is the topic to test omit indicating.
1046 1046 """"""""""""""""""""""""""""""""""""""""""
1047 1047
1048 1048 This paragraph is never omitted (for topic).
1049 1049
1050 1050 This paragraph is omitted, if "hg help" is invoked witout "-v" (for topic)
1051 1051
1052 1052 This paragraph is never omitted, too (for topic)
1053 1053
1054 1054 Test usage of section marks in help documents
1055 1055
1056 1056 $ cd "$TESTDIR"/../doc
1057 1057 $ python check-seclevel.py
1058 1058 $ cd $TESTTMP
1059 1059
1060 1060 #if serve
1061 1061
1062 1062 Test the help pages in hgweb.
1063 1063
1064 1064 Dish up an empty repo; serve it cold.
1065 1065
1066 1066 $ hg init "$TESTTMP/test"
1067 1067 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
1068 1068 $ cat hg.pid >> $DAEMON_PIDS
1069 1069
1070 1070 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help"
1071 1071 200 Script output follows
1072 1072
1073 1073 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1074 1074 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1075 1075 <head>
1076 1076 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1077 1077 <meta name="robots" content="index, nofollow" />
1078 1078 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1079 1079 <script type="text/javascript" src="/static/mercurial.js"></script>
1080 1080
1081 1081 <title>Help: Index</title>
1082 1082 </head>
1083 1083 <body>
1084 1084
1085 1085 <div class="container">
1086 1086 <div class="menu">
1087 1087 <div class="logo">
1088 1088 <a href="http://mercurial.selenic.com/">
1089 1089 <img src="/static/hglogo.png" alt="mercurial" /></a>
1090 1090 </div>
1091 1091 <ul>
1092 1092 <li><a href="/shortlog">log</a></li>
1093 1093 <li><a href="/graph">graph</a></li>
1094 1094 <li><a href="/tags">tags</a></li>
1095 1095 <li><a href="/bookmarks">bookmarks</a></li>
1096 1096 <li><a href="/branches">branches</a></li>
1097 1097 </ul>
1098 1098 <ul>
1099 1099 <li class="active">help</li>
1100 1100 </ul>
1101 1101 </div>
1102 1102
1103 1103 <div class="main">
1104 1104 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1105 1105 <form class="search" action="/log">
1106 1106
1107 1107 <p><input name="rev" id="search1" type="text" size="30" /></p>
1108 1108 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1109 1109 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1110 1110 </form>
1111 1111 <table class="bigtable">
1112 1112 <tr><td colspan="2"><h2><a name="main" href="#topics">Topics</a></h2></td></tr>
1113 1113
1114 1114 <tr><td>
1115 1115 <a href="/help/config">
1116 1116 config
1117 1117 </a>
1118 1118 </td><td>
1119 1119 Configuration Files
1120 1120 </td></tr>
1121 1121 <tr><td>
1122 1122 <a href="/help/dates">
1123 1123 dates
1124 1124 </a>
1125 1125 </td><td>
1126 1126 Date Formats
1127 1127 </td></tr>
1128 1128 <tr><td>
1129 1129 <a href="/help/diffs">
1130 1130 diffs
1131 1131 </a>
1132 1132 </td><td>
1133 1133 Diff Formats
1134 1134 </td></tr>
1135 1135 <tr><td>
1136 1136 <a href="/help/environment">
1137 1137 environment
1138 1138 </a>
1139 1139 </td><td>
1140 1140 Environment Variables
1141 1141 </td></tr>
1142 1142 <tr><td>
1143 1143 <a href="/help/extensions">
1144 1144 extensions
1145 1145 </a>
1146 1146 </td><td>
1147 1147 Using Additional Features
1148 1148 </td></tr>
1149 1149 <tr><td>
1150 1150 <a href="/help/filesets">
1151 1151 filesets
1152 1152 </a>
1153 1153 </td><td>
1154 1154 Specifying File Sets
1155 1155 </td></tr>
1156 1156 <tr><td>
1157 1157 <a href="/help/glossary">
1158 1158 glossary
1159 1159 </a>
1160 1160 </td><td>
1161 1161 Glossary
1162 1162 </td></tr>
1163 1163 <tr><td>
1164 1164 <a href="/help/hgignore">
1165 1165 hgignore
1166 1166 </a>
1167 1167 </td><td>
1168 1168 Syntax for Mercurial Ignore Files
1169 1169 </td></tr>
1170 1170 <tr><td>
1171 1171 <a href="/help/hgweb">
1172 1172 hgweb
1173 1173 </a>
1174 1174 </td><td>
1175 1175 Configuring hgweb
1176 1176 </td></tr>
1177 1177 <tr><td>
1178 1178 <a href="/help/merge-tools">
1179 1179 merge-tools
1180 1180 </a>
1181 1181 </td><td>
1182 1182 Merge Tools
1183 1183 </td></tr>
1184 1184 <tr><td>
1185 1185 <a href="/help/multirevs">
1186 1186 multirevs
1187 1187 </a>
1188 1188 </td><td>
1189 1189 Specifying Multiple Revisions
1190 1190 </td></tr>
1191 1191 <tr><td>
1192 1192 <a href="/help/patterns">
1193 1193 patterns
1194 1194 </a>
1195 1195 </td><td>
1196 1196 File Name Patterns
1197 1197 </td></tr>
1198 1198 <tr><td>
1199 1199 <a href="/help/phases">
1200 1200 phases
1201 1201 </a>
1202 1202 </td><td>
1203 1203 Working with Phases
1204 1204 </td></tr>
1205 1205 <tr><td>
1206 1206 <a href="/help/revisions">
1207 1207 revisions
1208 1208 </a>
1209 1209 </td><td>
1210 1210 Specifying Single Revisions
1211 1211 </td></tr>
1212 1212 <tr><td>
1213 1213 <a href="/help/revsets">
1214 1214 revsets
1215 1215 </a>
1216 1216 </td><td>
1217 1217 Specifying Revision Sets
1218 1218 </td></tr>
1219 1219 <tr><td>
1220 1220 <a href="/help/subrepos">
1221 1221 subrepos
1222 1222 </a>
1223 1223 </td><td>
1224 1224 Subrepositories
1225 1225 </td></tr>
1226 1226 <tr><td>
1227 1227 <a href="/help/templating">
1228 1228 templating
1229 1229 </a>
1230 1230 </td><td>
1231 1231 Template Usage
1232 1232 </td></tr>
1233 1233 <tr><td>
1234 1234 <a href="/help/urls">
1235 1235 urls
1236 1236 </a>
1237 1237 </td><td>
1238 1238 URL Paths
1239 1239 </td></tr>
1240 1240 <tr><td>
1241 1241 <a href="/help/topic-containing-verbose">
1242 1242 topic-containing-verbose
1243 1243 </a>
1244 1244 </td><td>
1245 1245 This is the topic to test omit indicating.
1246 1246 </td></tr>
1247 1247
1248 1248 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
1249 1249
1250 1250 <tr><td>
1251 1251 <a href="/help/add">
1252 1252 add
1253 1253 </a>
1254 1254 </td><td>
1255 1255 add the specified files on the next commit
1256 1256 </td></tr>
1257 1257 <tr><td>
1258 1258 <a href="/help/annotate">
1259 1259 annotate
1260 1260 </a>
1261 1261 </td><td>
1262 1262 show changeset information by line for each file
1263 1263 </td></tr>
1264 1264 <tr><td>
1265 1265 <a href="/help/clone">
1266 1266 clone
1267 1267 </a>
1268 1268 </td><td>
1269 1269 make a copy of an existing repository
1270 1270 </td></tr>
1271 1271 <tr><td>
1272 1272 <a href="/help/commit">
1273 1273 commit
1274 1274 </a>
1275 1275 </td><td>
1276 1276 commit the specified files or all outstanding changes
1277 1277 </td></tr>
1278 1278 <tr><td>
1279 1279 <a href="/help/diff">
1280 1280 diff
1281 1281 </a>
1282 1282 </td><td>
1283 1283 diff repository (or selected files)
1284 1284 </td></tr>
1285 1285 <tr><td>
1286 1286 <a href="/help/export">
1287 1287 export
1288 1288 </a>
1289 1289 </td><td>
1290 1290 dump the header and diffs for one or more changesets
1291 1291 </td></tr>
1292 1292 <tr><td>
1293 1293 <a href="/help/forget">
1294 1294 forget
1295 1295 </a>
1296 1296 </td><td>
1297 1297 forget the specified files on the next commit
1298 1298 </td></tr>
1299 1299 <tr><td>
1300 1300 <a href="/help/init">
1301 1301 init
1302 1302 </a>
1303 1303 </td><td>
1304 1304 create a new repository in the given directory
1305 1305 </td></tr>
1306 1306 <tr><td>
1307 1307 <a href="/help/log">
1308 1308 log
1309 1309 </a>
1310 1310 </td><td>
1311 1311 show revision history of entire repository or files
1312 1312 </td></tr>
1313 1313 <tr><td>
1314 1314 <a href="/help/merge">
1315 1315 merge
1316 1316 </a>
1317 1317 </td><td>
1318 1318 merge working directory with another revision
1319 1319 </td></tr>
1320 1320 <tr><td>
1321 1321 <a href="/help/pull">
1322 1322 pull
1323 1323 </a>
1324 1324 </td><td>
1325 1325 pull changes from the specified source
1326 1326 </td></tr>
1327 1327 <tr><td>
1328 1328 <a href="/help/push">
1329 1329 push
1330 1330 </a>
1331 1331 </td><td>
1332 1332 push changes to the specified destination
1333 1333 </td></tr>
1334 1334 <tr><td>
1335 1335 <a href="/help/remove">
1336 1336 remove
1337 1337 </a>
1338 1338 </td><td>
1339 1339 remove the specified files on the next commit
1340 1340 </td></tr>
1341 1341 <tr><td>
1342 1342 <a href="/help/serve">
1343 1343 serve
1344 1344 </a>
1345 1345 </td><td>
1346 1346 start stand-alone webserver
1347 1347 </td></tr>
1348 1348 <tr><td>
1349 1349 <a href="/help/status">
1350 1350 status
1351 1351 </a>
1352 1352 </td><td>
1353 1353 show changed files in the working directory
1354 1354 </td></tr>
1355 1355 <tr><td>
1356 1356 <a href="/help/summary">
1357 1357 summary
1358 1358 </a>
1359 1359 </td><td>
1360 1360 summarize working directory state
1361 1361 </td></tr>
1362 1362 <tr><td>
1363 1363 <a href="/help/update">
1364 1364 update
1365 1365 </a>
1366 1366 </td><td>
1367 1367 update working directory (or switch revisions)
1368 1368 </td></tr>
1369 1369
1370 1370 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
1371 1371
1372 1372 <tr><td>
1373 1373 <a href="/help/addremove">
1374 1374 addremove
1375 1375 </a>
1376 1376 </td><td>
1377 1377 add all new files, delete all missing files
1378 1378 </td></tr>
1379 1379 <tr><td>
1380 1380 <a href="/help/archive">
1381 1381 archive
1382 1382 </a>
1383 1383 </td><td>
1384 1384 create an unversioned archive of a repository revision
1385 1385 </td></tr>
1386 1386 <tr><td>
1387 1387 <a href="/help/backout">
1388 1388 backout
1389 1389 </a>
1390 1390 </td><td>
1391 1391 reverse effect of earlier changeset
1392 1392 </td></tr>
1393 1393 <tr><td>
1394 1394 <a href="/help/bisect">
1395 1395 bisect
1396 1396 </a>
1397 1397 </td><td>
1398 1398 subdivision search of changesets
1399 1399 </td></tr>
1400 1400 <tr><td>
1401 1401 <a href="/help/bookmarks">
1402 1402 bookmarks
1403 1403 </a>
1404 1404 </td><td>
1405 1405 create a new bookmark or list existing bookmarks
1406 1406 </td></tr>
1407 1407 <tr><td>
1408 1408 <a href="/help/branch">
1409 1409 branch
1410 1410 </a>
1411 1411 </td><td>
1412 1412 set or show the current branch name
1413 1413 </td></tr>
1414 1414 <tr><td>
1415 1415 <a href="/help/branches">
1416 1416 branches
1417 1417 </a>
1418 1418 </td><td>
1419 1419 list repository named branches
1420 1420 </td></tr>
1421 1421 <tr><td>
1422 1422 <a href="/help/bundle">
1423 1423 bundle
1424 1424 </a>
1425 1425 </td><td>
1426 1426 create a changegroup file
1427 1427 </td></tr>
1428 1428 <tr><td>
1429 1429 <a href="/help/cat">
1430 1430 cat
1431 1431 </a>
1432 1432 </td><td>
1433 1433 output the current or given revision of files
1434 1434 </td></tr>
1435 1435 <tr><td>
1436 1436 <a href="/help/config">
1437 1437 config
1438 1438 </a>
1439 1439 </td><td>
1440 1440 show combined config settings from all hgrc files
1441 1441 </td></tr>
1442 1442 <tr><td>
1443 1443 <a href="/help/copy">
1444 1444 copy
1445 1445 </a>
1446 1446 </td><td>
1447 1447 mark files as copied for the next commit
1448 1448 </td></tr>
1449 1449 <tr><td>
1450 1450 <a href="/help/graft">
1451 1451 graft
1452 1452 </a>
1453 1453 </td><td>
1454 1454 copy changes from other branches onto the current branch
1455 1455 </td></tr>
1456 1456 <tr><td>
1457 1457 <a href="/help/grep">
1458 1458 grep
1459 1459 </a>
1460 1460 </td><td>
1461 1461 search for a pattern in specified files and revisions
1462 1462 </td></tr>
1463 1463 <tr><td>
1464 1464 <a href="/help/heads">
1465 1465 heads
1466 1466 </a>
1467 1467 </td><td>
1468 1468 show branch heads
1469 1469 </td></tr>
1470 1470 <tr><td>
1471 1471 <a href="/help/help">
1472 1472 help
1473 1473 </a>
1474 1474 </td><td>
1475 1475 show help for a given topic or a help overview
1476 1476 </td></tr>
1477 1477 <tr><td>
1478 1478 <a href="/help/identify">
1479 1479 identify
1480 1480 </a>
1481 1481 </td><td>
1482 1482 identify the working copy or specified revision
1483 1483 </td></tr>
1484 1484 <tr><td>
1485 1485 <a href="/help/import">
1486 1486 import
1487 1487 </a>
1488 1488 </td><td>
1489 1489 import an ordered set of patches
1490 1490 </td></tr>
1491 1491 <tr><td>
1492 1492 <a href="/help/incoming">
1493 1493 incoming
1494 1494 </a>
1495 1495 </td><td>
1496 1496 show new changesets found in source
1497 1497 </td></tr>
1498 1498 <tr><td>
1499 1499 <a href="/help/locate">
1500 1500 locate
1501 1501 </a>
1502 1502 </td><td>
1503 1503 locate files matching specific patterns
1504 1504 </td></tr>
1505 1505 <tr><td>
1506 1506 <a href="/help/manifest">
1507 1507 manifest
1508 1508 </a>
1509 1509 </td><td>
1510 1510 output the current or given revision of the project manifest
1511 1511 </td></tr>
1512 1512 <tr><td>
1513 1513 <a href="/help/nohelp">
1514 1514 nohelp
1515 1515 </a>
1516 1516 </td><td>
1517 1517 (no help text available)
1518 1518 </td></tr>
1519 1519 <tr><td>
1520 1520 <a href="/help/outgoing">
1521 1521 outgoing
1522 1522 </a>
1523 1523 </td><td>
1524 1524 show changesets not found in the destination
1525 1525 </td></tr>
1526 1526 <tr><td>
1527 1527 <a href="/help/parents">
1528 1528 parents
1529 1529 </a>
1530 1530 </td><td>
1531 1531 show the parents of the working directory or revision
1532 1532 </td></tr>
1533 1533 <tr><td>
1534 1534 <a href="/help/paths">
1535 1535 paths
1536 1536 </a>
1537 1537 </td><td>
1538 1538 show aliases for remote repositories
1539 1539 </td></tr>
1540 1540 <tr><td>
1541 1541 <a href="/help/phase">
1542 1542 phase
1543 1543 </a>
1544 1544 </td><td>
1545 1545 set or show the current phase name
1546 1546 </td></tr>
1547 1547 <tr><td>
1548 1548 <a href="/help/recover">
1549 1549 recover
1550 1550 </a>
1551 1551 </td><td>
1552 1552 roll back an interrupted transaction
1553 1553 </td></tr>
1554 1554 <tr><td>
1555 1555 <a href="/help/rename">
1556 1556 rename
1557 1557 </a>
1558 1558 </td><td>
1559 1559 rename files; equivalent of copy + remove
1560 1560 </td></tr>
1561 1561 <tr><td>
1562 1562 <a href="/help/resolve">
1563 1563 resolve
1564 1564 </a>
1565 1565 </td><td>
1566 1566 redo merges or set/view the merge status of files
1567 1567 </td></tr>
1568 1568 <tr><td>
1569 1569 <a href="/help/revert">
1570 1570 revert
1571 1571 </a>
1572 1572 </td><td>
1573 1573 restore files to their checkout state
1574 1574 </td></tr>
1575 1575 <tr><td>
1576 1576 <a href="/help/root">
1577 1577 root
1578 1578 </a>
1579 1579 </td><td>
1580 1580 print the root (top) of the current working directory
1581 1581 </td></tr>
1582 1582 <tr><td>
1583 1583 <a href="/help/tag">
1584 1584 tag
1585 1585 </a>
1586 1586 </td><td>
1587 1587 add one or more tags for the current or given revision
1588 1588 </td></tr>
1589 1589 <tr><td>
1590 1590 <a href="/help/tags">
1591 1591 tags
1592 1592 </a>
1593 1593 </td><td>
1594 1594 list repository tags
1595 1595 </td></tr>
1596 1596 <tr><td>
1597 1597 <a href="/help/unbundle">
1598 1598 unbundle
1599 1599 </a>
1600 1600 </td><td>
1601 1601 apply one or more changegroup files
1602 1602 </td></tr>
1603 1603 <tr><td>
1604 1604 <a href="/help/verify">
1605 1605 verify
1606 1606 </a>
1607 1607 </td><td>
1608 1608 verify the integrity of the repository
1609 1609 </td></tr>
1610 1610 <tr><td>
1611 1611 <a href="/help/version">
1612 1612 version
1613 1613 </a>
1614 1614 </td><td>
1615 1615 output version and copyright information
1616 1616 </td></tr>
1617 1617 </table>
1618 1618 </div>
1619 1619 </div>
1620 1620
1621 1621 <script type="text/javascript">process_dates()</script>
1622 1622
1623 1623
1624 1624 </body>
1625 1625 </html>
1626 1626
1627 1627
1628 1628 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help/add"
1629 1629 200 Script output follows
1630 1630
1631 1631 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1632 1632 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1633 1633 <head>
1634 1634 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1635 1635 <meta name="robots" content="index, nofollow" />
1636 1636 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1637 1637 <script type="text/javascript" src="/static/mercurial.js"></script>
1638 1638
1639 1639 <title>Help: add</title>
1640 1640 </head>
1641 1641 <body>
1642 1642
1643 1643 <div class="container">
1644 1644 <div class="menu">
1645 1645 <div class="logo">
1646 1646 <a href="http://mercurial.selenic.com/">
1647 1647 <img src="/static/hglogo.png" alt="mercurial" /></a>
1648 1648 </div>
1649 1649 <ul>
1650 1650 <li><a href="/shortlog">log</a></li>
1651 1651 <li><a href="/graph">graph</a></li>
1652 1652 <li><a href="/tags">tags</a></li>
1653 1653 <li><a href="/bookmarks">bookmarks</a></li>
1654 1654 <li><a href="/branches">branches</a></li>
1655 1655 </ul>
1656 1656 <ul>
1657 1657 <li class="active"><a href="/help">help</a></li>
1658 1658 </ul>
1659 1659 </div>
1660 1660
1661 1661 <div class="main">
1662 1662 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1663 1663 <h3>Help: add</h3>
1664 1664
1665 1665 <form class="search" action="/log">
1666 1666
1667 1667 <p><input name="rev" id="search1" type="text" size="30" /></p>
1668 1668 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1669 1669 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1670 1670 </form>
1671 1671 <div id="doc">
1672 1672 <p>
1673 1673 hg add [OPTION]... [FILE]...
1674 1674 </p>
1675 1675 <p>
1676 1676 add the specified files on the next commit
1677 1677 </p>
1678 1678 <p>
1679 1679 Schedule files to be version controlled and added to the
1680 1680 repository.
1681 1681 </p>
1682 1682 <p>
1683 1683 The files will be added to the repository at the next commit. To
1684 1684 undo an add before that, see &quot;hg forget&quot;.
1685 1685 </p>
1686 1686 <p>
1687 1687 If no names are given, add all files to the repository.
1688 1688 </p>
1689 1689 <p>
1690 1690 An example showing how new (unknown) files are added
1691 1691 automatically by &quot;hg add&quot;:
1692 1692 </p>
1693 1693 <pre>
1694 1694 \$ ls (re)
1695 1695 foo.c
1696 1696 \$ hg status (re)
1697 1697 ? foo.c
1698 1698 \$ hg add (re)
1699 1699 adding foo.c
1700 1700 \$ hg status (re)
1701 1701 A foo.c
1702 1702 </pre>
1703 1703 <p>
1704 1704 Returns 0 if all files are successfully added.
1705 1705 </p>
1706 1706 <p>
1707 1707 options:
1708 1708 </p>
1709 1709 <table>
1710 1710 <tr><td>-I</td>
1711 1711 <td>--include PATTERN [+]</td>
1712 1712 <td>include names matching the given patterns</td></tr>
1713 1713 <tr><td>-X</td>
1714 1714 <td>--exclude PATTERN [+]</td>
1715 1715 <td>exclude names matching the given patterns</td></tr>
1716 1716 <tr><td>-S</td>
1717 1717 <td>--subrepos</td>
1718 1718 <td>recurse into subrepositories</td></tr>
1719 1719 <tr><td>-n</td>
1720 1720 <td>--dry-run</td>
1721 1721 <td>do not perform actions, just print output</td></tr>
1722 1722 </table>
1723 1723 <p>
1724 1724 [+] marked option can be specified multiple times
1725 1725 </p>
1726 1726 <p>
1727 1727 global options:
1728 1728 </p>
1729 1729 <table>
1730 1730 <tr><td>-R</td>
1731 1731 <td>--repository REPO</td>
1732 1732 <td>repository root directory or name of overlay bundle file</td></tr>
1733 1733 <tr><td></td>
1734 1734 <td>--cwd DIR</td>
1735 1735 <td>change working directory</td></tr>
1736 1736 <tr><td>-y</td>
1737 1737 <td>--noninteractive</td>
1738 1738 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
1739 1739 <tr><td>-q</td>
1740 1740 <td>--quiet</td>
1741 1741 <td>suppress output</td></tr>
1742 1742 <tr><td>-v</td>
1743 1743 <td>--verbose</td>
1744 1744 <td>enable additional output</td></tr>
1745 1745 <tr><td></td>
1746 1746 <td>--config CONFIG [+]</td>
1747 1747 <td>set/override config option (use 'section.name=value')</td></tr>
1748 1748 <tr><td></td>
1749 1749 <td>--debug</td>
1750 1750 <td>enable debugging output</td></tr>
1751 1751 <tr><td></td>
1752 1752 <td>--debugger</td>
1753 1753 <td>start debugger</td></tr>
1754 1754 <tr><td></td>
1755 1755 <td>--encoding ENCODE</td>
1756 1756 <td>set the charset encoding (default: ascii)</td></tr>
1757 1757 <tr><td></td>
1758 1758 <td>--encodingmode MODE</td>
1759 1759 <td>set the charset encoding mode (default: strict)</td></tr>
1760 1760 <tr><td></td>
1761 1761 <td>--traceback</td>
1762 1762 <td>always print a traceback on exception</td></tr>
1763 1763 <tr><td></td>
1764 1764 <td>--time</td>
1765 1765 <td>time how long the command takes</td></tr>
1766 1766 <tr><td></td>
1767 1767 <td>--profile</td>
1768 1768 <td>print command execution profile</td></tr>
1769 1769 <tr><td></td>
1770 1770 <td>--version</td>
1771 1771 <td>output version information and exit</td></tr>
1772 1772 <tr><td>-h</td>
1773 1773 <td>--help</td>
1774 1774 <td>display help and exit</td></tr>
1775 1775 <tr><td></td>
1776 1776 <td>--hidden</td>
1777 1777 <td>consider hidden changesets</td></tr>
1778 1778 </table>
1779 1779 <p>
1780 1780 [+] marked option can be specified multiple times
1781 1781 </p>
1782 1782
1783 1783 </div>
1784 1784 </div>
1785 1785 </div>
1786 1786
1787 1787 <script type="text/javascript">process_dates()</script>
1788 1788
1789 1789
1790 1790 </body>
1791 1791 </html>
1792 1792
1793 1793
1794 1794 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help/remove"
1795 1795 200 Script output follows
1796 1796
1797 1797 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1798 1798 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1799 1799 <head>
1800 1800 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1801 1801 <meta name="robots" content="index, nofollow" />
1802 1802 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1803 1803 <script type="text/javascript" src="/static/mercurial.js"></script>
1804 1804
1805 1805 <title>Help: remove</title>
1806 1806 </head>
1807 1807 <body>
1808 1808
1809 1809 <div class="container">
1810 1810 <div class="menu">
1811 1811 <div class="logo">
1812 1812 <a href="http://mercurial.selenic.com/">
1813 1813 <img src="/static/hglogo.png" alt="mercurial" /></a>
1814 1814 </div>
1815 1815 <ul>
1816 1816 <li><a href="/shortlog">log</a></li>
1817 1817 <li><a href="/graph">graph</a></li>
1818 1818 <li><a href="/tags">tags</a></li>
1819 1819 <li><a href="/bookmarks">bookmarks</a></li>
1820 1820 <li><a href="/branches">branches</a></li>
1821 1821 </ul>
1822 1822 <ul>
1823 1823 <li class="active"><a href="/help">help</a></li>
1824 1824 </ul>
1825 1825 </div>
1826 1826
1827 1827 <div class="main">
1828 1828 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1829 1829 <h3>Help: remove</h3>
1830 1830
1831 1831 <form class="search" action="/log">
1832 1832
1833 1833 <p><input name="rev" id="search1" type="text" size="30" /></p>
1834 1834 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1835 1835 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1836 1836 </form>
1837 1837 <div id="doc">
1838 1838 <p>
1839 1839 hg remove [OPTION]... FILE...
1840 1840 </p>
1841 1841 <p>
1842 1842 aliases: rm
1843 1843 </p>
1844 1844 <p>
1845 1845 remove the specified files on the next commit
1846 1846 </p>
1847 1847 <p>
1848 1848 Schedule the indicated files for removal from the current branch.
1849 1849 </p>
1850 1850 <p>
1851 1851 This command schedules the files to be removed at the next commit.
1852 1852 To undo a remove before that, see &quot;hg revert&quot;. To undo added
1853 1853 files, see &quot;hg forget&quot;.
1854 1854 </p>
1855 1855 <p>
1856 1856 -A/--after can be used to remove only files that have already
1857 1857 been deleted, -f/--force can be used to force deletion, and -Af
1858 1858 can be used to remove files from the next revision without
1859 1859 deleting them from the working directory.
1860 1860 </p>
1861 1861 <p>
1862 1862 The following table details the behavior of remove for different
1863 1863 file states (columns) and option combinations (rows). The file
1864 1864 states are Added [A], Clean [C], Modified [M] and Missing [!]
1865 1865 (as reported by &quot;hg status&quot;). The actions are Warn, Remove
1866 1866 (from branch) and Delete (from disk):
1867 1867 </p>
1868 1868 <table>
1869 1869 <tr><td>opt/state</td>
1870 1870 <td>A</td>
1871 1871 <td>C</td>
1872 1872 <td>M</td>
1873 1873 <td>!</td></tr>
1874 1874 <tr><td>none</td>
1875 1875 <td>W</td>
1876 1876 <td>RD</td>
1877 1877 <td>W</td>
1878 1878 <td>R</td></tr>
1879 1879 <tr><td>-f</td>
1880 1880 <td>R</td>
1881 1881 <td>RD</td>
1882 1882 <td>RD</td>
1883 1883 <td>R</td></tr>
1884 1884 <tr><td>-A</td>
1885 1885 <td>W</td>
1886 1886 <td>W</td>
1887 1887 <td>W</td>
1888 1888 <td>R</td></tr>
1889 1889 <tr><td>-Af</td>
1890 1890 <td>R</td>
1891 1891 <td>R</td>
1892 1892 <td>R</td>
1893 1893 <td>R</td></tr>
1894 1894 </table>
1895 1895 <p>
1896 1896 Note that remove never deletes files in Added [A] state from the
1897 1897 working directory, not even if option --force is specified.
1898 1898 </p>
1899 1899 <p>
1900 1900 Returns 0 on success, 1 if any warnings encountered.
1901 1901 </p>
1902 1902 <p>
1903 1903 options:
1904 1904 </p>
1905 1905 <table>
1906 1906 <tr><td>-A</td>
1907 1907 <td>--after</td>
1908 1908 <td>record delete for missing files</td></tr>
1909 1909 <tr><td>-f</td>
1910 1910 <td>--force</td>
1911 1911 <td>remove (and delete) file even if added or modified</td></tr>
1912 1912 <tr><td>-I</td>
1913 1913 <td>--include PATTERN [+]</td>
1914 1914 <td>include names matching the given patterns</td></tr>
1915 1915 <tr><td>-X</td>
1916 1916 <td>--exclude PATTERN [+]</td>
1917 1917 <td>exclude names matching the given patterns</td></tr>
1918 1918 </table>
1919 1919 <p>
1920 1920 [+] marked option can be specified multiple times
1921 1921 </p>
1922 1922 <p>
1923 1923 global options:
1924 1924 </p>
1925 1925 <table>
1926 1926 <tr><td>-R</td>
1927 1927 <td>--repository REPO</td>
1928 1928 <td>repository root directory or name of overlay bundle file</td></tr>
1929 1929 <tr><td></td>
1930 1930 <td>--cwd DIR</td>
1931 1931 <td>change working directory</td></tr>
1932 1932 <tr><td>-y</td>
1933 1933 <td>--noninteractive</td>
1934 1934 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
1935 1935 <tr><td>-q</td>
1936 1936 <td>--quiet</td>
1937 1937 <td>suppress output</td></tr>
1938 1938 <tr><td>-v</td>
1939 1939 <td>--verbose</td>
1940 1940 <td>enable additional output</td></tr>
1941 1941 <tr><td></td>
1942 1942 <td>--config CONFIG [+]</td>
1943 1943 <td>set/override config option (use 'section.name=value')</td></tr>
1944 1944 <tr><td></td>
1945 1945 <td>--debug</td>
1946 1946 <td>enable debugging output</td></tr>
1947 1947 <tr><td></td>
1948 1948 <td>--debugger</td>
1949 1949 <td>start debugger</td></tr>
1950 1950 <tr><td></td>
1951 1951 <td>--encoding ENCODE</td>
1952 1952 <td>set the charset encoding (default: ascii)</td></tr>
1953 1953 <tr><td></td>
1954 1954 <td>--encodingmode MODE</td>
1955 1955 <td>set the charset encoding mode (default: strict)</td></tr>
1956 1956 <tr><td></td>
1957 1957 <td>--traceback</td>
1958 1958 <td>always print a traceback on exception</td></tr>
1959 1959 <tr><td></td>
1960 1960 <td>--time</td>
1961 1961 <td>time how long the command takes</td></tr>
1962 1962 <tr><td></td>
1963 1963 <td>--profile</td>
1964 1964 <td>print command execution profile</td></tr>
1965 1965 <tr><td></td>
1966 1966 <td>--version</td>
1967 1967 <td>output version information and exit</td></tr>
1968 1968 <tr><td>-h</td>
1969 1969 <td>--help</td>
1970 1970 <td>display help and exit</td></tr>
1971 1971 <tr><td></td>
1972 1972 <td>--hidden</td>
1973 1973 <td>consider hidden changesets</td></tr>
1974 1974 </table>
1975 1975 <p>
1976 1976 [+] marked option can be specified multiple times
1977 1977 </p>
1978 1978
1979 1979 </div>
1980 1980 </div>
1981 1981 </div>
1982 1982
1983 1983 <script type="text/javascript">process_dates()</script>
1984 1984
1985 1985
1986 1986 </body>
1987 1987 </html>
1988 1988
1989 1989
1990 1990 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help/revisions"
1991 1991 200 Script output follows
1992 1992
1993 1993 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1994 1994 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1995 1995 <head>
1996 1996 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1997 1997 <meta name="robots" content="index, nofollow" />
1998 1998 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1999 1999 <script type="text/javascript" src="/static/mercurial.js"></script>
2000 2000
2001 2001 <title>Help: revisions</title>
2002 2002 </head>
2003 2003 <body>
2004 2004
2005 2005 <div class="container">
2006 2006 <div class="menu">
2007 2007 <div class="logo">
2008 2008 <a href="http://mercurial.selenic.com/">
2009 2009 <img src="/static/hglogo.png" alt="mercurial" /></a>
2010 2010 </div>
2011 2011 <ul>
2012 2012 <li><a href="/shortlog">log</a></li>
2013 2013 <li><a href="/graph">graph</a></li>
2014 2014 <li><a href="/tags">tags</a></li>
2015 2015 <li><a href="/bookmarks">bookmarks</a></li>
2016 2016 <li><a href="/branches">branches</a></li>
2017 2017 </ul>
2018 2018 <ul>
2019 2019 <li class="active"><a href="/help">help</a></li>
2020 2020 </ul>
2021 2021 </div>
2022 2022
2023 2023 <div class="main">
2024 2024 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2025 2025 <h3>Help: revisions</h3>
2026 2026
2027 2027 <form class="search" action="/log">
2028 2028
2029 2029 <p><input name="rev" id="search1" type="text" size="30" /></p>
2030 2030 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2031 2031 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2032 2032 </form>
2033 2033 <div id="doc">
2034 2034 <h1>Specifying Single Revisions</h1>
2035 2035 <p>
2036 2036 Mercurial supports several ways to specify individual revisions.
2037 2037 </p>
2038 2038 <p>
2039 2039 A plain integer is treated as a revision number. Negative integers are
2040 2040 treated as sequential offsets from the tip, with -1 denoting the tip,
2041 2041 -2 denoting the revision prior to the tip, and so forth.
2042 2042 </p>
2043 2043 <p>
2044 2044 A 40-digit hexadecimal string is treated as a unique revision
2045 2045 identifier.
2046 2046 </p>
2047 2047 <p>
2048 2048 A hexadecimal string less than 40 characters long is treated as a
2049 2049 unique revision identifier and is referred to as a short-form
2050 2050 identifier. A short-form identifier is only valid if it is the prefix
2051 2051 of exactly one full-length identifier.
2052 2052 </p>
2053 2053 <p>
2054 2054 Any other string is treated as a bookmark, tag, or branch name. A
2055 2055 bookmark is a movable pointer to a revision. A tag is a permanent name
2056 2056 associated with a revision. A branch name denotes the tipmost open branch head
2057 2057 of that branch - or if they are all closed, the tipmost closed head of the
2058 2058 branch. Bookmark, tag, and branch names must not contain the &quot;:&quot; character.
2059 2059 </p>
2060 2060 <p>
2061 2061 The reserved name &quot;tip&quot; always identifies the most recent revision.
2062 2062 </p>
2063 2063 <p>
2064 2064 The reserved name &quot;null&quot; indicates the null revision. This is the
2065 2065 revision of an empty repository, and the parent of revision 0.
2066 2066 </p>
2067 2067 <p>
2068 2068 The reserved name &quot;.&quot; indicates the working directory parent. If no
2069 2069 working directory is checked out, it is equivalent to null. If an
2070 2070 uncommitted merge is in progress, &quot;.&quot; is the revision of the first
2071 2071 parent.
2072 2072 </p>
2073 2073
2074 2074 </div>
2075 2075 </div>
2076 2076 </div>
2077 2077
2078 2078 <script type="text/javascript">process_dates()</script>
2079 2079
2080 2080
2081 2081 </body>
2082 2082 </html>
2083 2083
2084 2084
2085 2085 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
2086 2086
2087 2087 #endif
@@ -1,240 +1,240 b''
1 1
2 2 $ cat > loop.py <<EOF
3 3 > from mercurial import cmdutil, commands
4 4 > import time
5 5 >
6 6 > cmdtable = {}
7 7 > command = cmdutil.command(cmdtable)
8 8 >
9 9 > class incrementingtime(object):
10 10 > def __init__(self):
11 11 > self._time = 0.0
12 12 > def __call__(self):
13 13 > self._time += 0.25
14 14 > return self._time
15 15 > time.time = incrementingtime()
16 16 >
17 17 > @command('loop',
18 18 > [('', 'total', '', 'override for total'),
19 19 > ('', 'nested', False, 'show nested results'),
20 20 > ('', 'parallel', False, 'show parallel sets of results')],
21 > 'hg loop LOOPS')
21 > 'hg loop LOOPS',
22 > norepo=True)
22 23 > def loop(ui, loops, **opts):
23 24 > loops = int(loops)
24 25 > total = None
25 26 > if loops >= 0:
26 27 > total = loops
27 28 > if opts.get('total', None):
28 29 > total = int(opts.get('total'))
29 30 > nested = False
30 31 > if opts.get('nested', None):
31 32 > nested = True
32 33 > loops = abs(loops)
33 34 >
34 35 > for i in range(loops):
35 36 > ui.progress('loop', i, 'loop.%d' % i, 'loopnum', total)
36 37 > if opts.get('parallel'):
37 38 > ui.progress('other', i, 'other.%d' % i, 'othernum', total)
38 39 > if nested:
39 40 > nested_steps = 2
40 41 > if i and i % 4 == 0:
41 42 > nested_steps = 5
42 43 > for j in range(nested_steps):
43 44 > ui.progress(
44 45 > 'nested', j, 'nested.%d' % j, 'nestnum', nested_steps)
45 46 > ui.progress(
46 47 > 'nested', None, 'nested.done', 'nestnum', nested_steps)
47 48 > ui.progress('loop', None, 'loop.done', 'loopnum', total)
48 49 >
49 > commands.norepo += " loop"
50 50 > EOF
51 51
52 52 $ cp $HGRCPATH $HGRCPATH.orig
53 53 $ echo "[extensions]" >> $HGRCPATH
54 54 $ echo "progress=" >> $HGRCPATH
55 55 $ echo "loop=`pwd`/loop.py" >> $HGRCPATH
56 56 $ echo "[progress]" >> $HGRCPATH
57 57 $ echo "format = topic bar number" >> $HGRCPATH
58 58 $ echo "assume-tty=1" >> $HGRCPATH
59 59 $ echo "width=60" >> $HGRCPATH
60 60
61 61 test default params, display nothing because of delay
62 62
63 63 $ hg -y loop 3
64 64 $ echo "delay=0" >> $HGRCPATH
65 65 $ echo "refresh=0" >> $HGRCPATH
66 66
67 67 test with delay=0, refresh=0
68 68
69 69 $ hg -y loop 3
70 70 \r (no-eol) (esc)
71 71 loop [ ] 0/3\r (no-eol) (esc)
72 72 loop [===============> ] 1/3\r (no-eol) (esc)
73 73 loop [===============================> ] 2/3\r (no-eol) (esc)
74 74 \r (no-eol) (esc)
75 75
76 76
77 77 test nested short-lived topics (which shouldn't display with nestdelay):
78 78
79 79 $ hg -y loop 3 --nested
80 80 \r (no-eol) (esc)
81 81 loop [ ] 0/3\r (no-eol) (esc)
82 82 loop [===============> ] 1/3\r (no-eol) (esc)
83 83 loop [===============================> ] 2/3\r (no-eol) (esc)
84 84 \r (no-eol) (esc)
85 85
86 86 Test nested long-lived topic which has the same name as a short-lived
87 87 peer. We shouldn't get stuck showing the short-lived inner steps, and
88 88 should go back to skipping the inner steps when the slow nested step
89 89 finishes.
90 90
91 91 $ hg -y loop 7 --nested
92 92 \r (no-eol) (esc)
93 93 loop [ ] 0/7\r (no-eol) (esc)
94 94 loop [=====> ] 1/7\r (no-eol) (esc)
95 95 loop [============> ] 2/7\r (no-eol) (esc)
96 96 loop [===================> ] 3/7\r (no-eol) (esc)
97 97 loop [==========================> ] 4/7\r (no-eol) (esc)
98 98 nested [==========================> ] 3/5\r (no-eol) (esc)
99 99 nested [===================================> ] 4/5\r (no-eol) (esc)
100 100 loop [=================================> ] 5/7\r (no-eol) (esc)
101 101 loop [========================================> ] 6/7\r (no-eol) (esc)
102 102 \r (no-eol) (esc)
103 103
104 104
105 105 $ hg --config progress.changedelay=0 -y loop 3 --nested
106 106 \r (no-eol) (esc)
107 107 loop [ ] 0/3\r (no-eol) (esc)
108 108 nested [ ] 0/2\r (no-eol) (esc)
109 109 nested [======================> ] 1/2\r (no-eol) (esc)
110 110 loop [===============> ] 1/3\r (no-eol) (esc)
111 111 nested [ ] 0/2\r (no-eol) (esc)
112 112 nested [======================> ] 1/2\r (no-eol) (esc)
113 113 loop [===============================> ] 2/3\r (no-eol) (esc)
114 114 nested [ ] 0/2\r (no-eol) (esc)
115 115 nested [======================> ] 1/2\r (no-eol) (esc)
116 116 \r (no-eol) (esc)
117 117
118 118
119 119 test two topics being printed in parallel (as when we're doing a local
120 120 --pull clone, where you get the unbundle and bundle progress at the
121 121 same time):
122 122 $ hg loop 3 --parallel
123 123 \r (no-eol) (esc)
124 124 loop [ ] 0/3\r (no-eol) (esc)
125 125 loop [===============> ] 1/3\r (no-eol) (esc)
126 126 loop [===============================> ] 2/3\r (no-eol) (esc)
127 127 \r (no-eol) (esc)
128 128 test refresh is taken in account
129 129
130 130 $ hg -y --config progress.refresh=100 loop 3
131 131
132 132 test format options 1
133 133
134 134 $ hg -y --config 'progress.format=number topic item+2' loop 2
135 135 \r (no-eol) (esc)
136 136 0/2 loop lo\r (no-eol) (esc)
137 137 1/2 loop lo\r (no-eol) (esc)
138 138 \r (no-eol) (esc)
139 139
140 140 test format options 2
141 141
142 142 $ hg -y --config 'progress.format=number item-3 bar' loop 2
143 143 \r (no-eol) (esc)
144 144 0/2 p.0 [ ]\r (no-eol) (esc)
145 145 1/2 p.1 [=======================> ]\r (no-eol) (esc)
146 146 \r (no-eol) (esc)
147 147
148 148 test format options and indeterminate progress
149 149
150 150 $ hg -y --config 'progress.format=number item bar' loop -- -2
151 151 \r (no-eol) (esc)
152 152 0 loop.0 [ <=> ]\r (no-eol) (esc)
153 153 1 loop.1 [ <=> ]\r (no-eol) (esc)
154 154 \r (no-eol) (esc)
155 155
156 156 make sure things don't fall over if count > total
157 157
158 158 $ hg -y loop --total 4 6
159 159 \r (no-eol) (esc)
160 160 loop [ ] 0/4\r (no-eol) (esc)
161 161 loop [===========> ] 1/4\r (no-eol) (esc)
162 162 loop [=======================> ] 2/4\r (no-eol) (esc)
163 163 loop [===================================> ] 3/4\r (no-eol) (esc)
164 164 loop [===============================================>] 4/4\r (no-eol) (esc)
165 165 loop [ <=> ] 5/4\r (no-eol) (esc)
166 166 \r (no-eol) (esc)
167 167
168 168 test immediate progress completion
169 169
170 170 $ hg -y loop 0
171 171
172 172 test delay time estimates
173 173
174 174 $ cat > mocktime.py <<EOF
175 175 > import os
176 176 > import time
177 177 >
178 178 > class mocktime(object):
179 179 > def __init__(self, increment):
180 180 > self.time = 0
181 181 > self.increment = increment
182 182 > def __call__(self):
183 183 > self.time += self.increment
184 184 > return self.time
185 185 >
186 186 > def uisetup(ui):
187 187 > time.time = mocktime(int(os.environ.get('MOCKTIME', '11')))
188 188 > EOF
189 189
190 190 $ cp $HGRCPATH.orig $HGRCPATH
191 191 $ echo "[extensions]" >> $HGRCPATH
192 192 $ echo "mocktime=`pwd`/mocktime.py" >> $HGRCPATH
193 193 $ echo "progress=" >> $HGRCPATH
194 194 $ echo "loop=`pwd`/loop.py" >> $HGRCPATH
195 195 $ echo "[progress]" >> $HGRCPATH
196 196 $ echo "assume-tty=1" >> $HGRCPATH
197 197 $ echo "delay=25" >> $HGRCPATH
198 198 $ echo "width=60" >> $HGRCPATH
199 199
200 200 $ hg -y loop 8
201 201 \r (no-eol) (esc)
202 202 loop [=========> ] 2/8 1m07s\r (no-eol) (esc)
203 203 loop [===============> ] 3/8 56s\r (no-eol) (esc)
204 204 loop [=====================> ] 4/8 45s\r (no-eol) (esc)
205 205 loop [==========================> ] 5/8 34s\r (no-eol) (esc)
206 206 loop [================================> ] 6/8 23s\r (no-eol) (esc)
207 207 loop [=====================================> ] 7/8 12s\r (no-eol) (esc)
208 208 \r (no-eol) (esc)
209 209
210 210 $ MOCKTIME=10000 hg -y loop 4
211 211 \r (no-eol) (esc)
212 212 loop [ ] 0/4\r (no-eol) (esc)
213 213 loop [=========> ] 1/4 8h21m\r (no-eol) (esc)
214 214 loop [====================> ] 2/4 5h34m\r (no-eol) (esc)
215 215 loop [==============================> ] 3/4 2h47m\r (no-eol) (esc)
216 216 \r (no-eol) (esc)
217 217
218 218 $ MOCKTIME=1000000 hg -y loop 4
219 219 \r (no-eol) (esc)
220 220 loop [ ] 0/4\r (no-eol) (esc)
221 221 loop [=========> ] 1/4 5w00d\r (no-eol) (esc)
222 222 loop [====================> ] 2/4 3w03d\r (no-eol) (esc)
223 223 loop [=============================> ] 3/4 11d14h\r (no-eol) (esc)
224 224 \r (no-eol) (esc)
225 225
226 226
227 227 $ MOCKTIME=14000000 hg -y loop 4
228 228 \r (no-eol) (esc)
229 229 loop [ ] 0/4\r (no-eol) (esc)
230 230 loop [=========> ] 1/4 1y18w\r (no-eol) (esc)
231 231 loop [===================> ] 2/4 46w03d\r (no-eol) (esc)
232 232 loop [=============================> ] 3/4 23w02d\r (no-eol) (esc)
233 233 \r (no-eol) (esc)
234 234
235 235 Time estimates should not fail when there's no end point:
236 236 $ hg -y loop -- -4
237 237 \r (no-eol) (esc)
238 238 loop [ <=> ] 2\r (no-eol) (esc)
239 239 loop [ <=> ] 3\r (no-eol) (esc)
240 240 \r (no-eol) (esc)
General Comments 0
You need to be logged in to leave comments. Login now