Show More
@@ -1,1368 +1,1375 b'' | |||
|
1 | 1 | # dispatch.py - command dispatching for mercurial |
|
2 | 2 | # |
|
3 | 3 | # Copyright 2005-2007 Matt Mackall <mpm@selenic.com> |
|
4 | 4 | # |
|
5 | 5 | # This software may be used and distributed according to the terms of the |
|
6 | 6 | # GNU General Public License version 2 or any later version. |
|
7 | 7 | |
|
8 | 8 | from __future__ import absolute_import, print_function |
|
9 | 9 | |
|
10 | 10 | import errno |
|
11 | 11 | import getopt |
|
12 | 12 | import io |
|
13 | 13 | import os |
|
14 | 14 | import pdb |
|
15 | 15 | import re |
|
16 | 16 | import signal |
|
17 | 17 | import sys |
|
18 | 18 | import traceback |
|
19 | 19 | |
|
20 | 20 | |
|
21 | 21 | from .i18n import _ |
|
22 | 22 | from .pycompat import getattr |
|
23 | 23 | |
|
24 | 24 | from hgdemandimport import tracing |
|
25 | 25 | |
|
26 | 26 | from . import ( |
|
27 | 27 | cmdutil, |
|
28 | 28 | color, |
|
29 | 29 | commands, |
|
30 | 30 | demandimport, |
|
31 | 31 | encoding, |
|
32 | 32 | error, |
|
33 | 33 | extensions, |
|
34 | 34 | fancyopts, |
|
35 | 35 | help, |
|
36 | 36 | hg, |
|
37 | 37 | hook, |
|
38 | 38 | localrepo, |
|
39 | 39 | profiling, |
|
40 | 40 | pycompat, |
|
41 | 41 | rcutil, |
|
42 | 42 | registrar, |
|
43 | 43 | requirements as requirementsmod, |
|
44 | 44 | scmutil, |
|
45 | 45 | ui as uimod, |
|
46 | 46 | util, |
|
47 | 47 | vfs, |
|
48 | 48 | ) |
|
49 | 49 | |
|
50 | 50 | from .utils import ( |
|
51 | 51 | procutil, |
|
52 | 52 | stringutil, |
|
53 | 53 | ) |
|
54 | 54 | |
|
55 | 55 | |
|
56 | 56 | class request(object): |
|
57 | 57 | def __init__( |
|
58 | 58 | self, |
|
59 | 59 | args, |
|
60 | 60 | ui=None, |
|
61 | 61 | repo=None, |
|
62 | 62 | fin=None, |
|
63 | 63 | fout=None, |
|
64 | 64 | ferr=None, |
|
65 | 65 | fmsg=None, |
|
66 | 66 | prereposetups=None, |
|
67 | 67 | ): |
|
68 | 68 | self.args = args |
|
69 | 69 | self.ui = ui |
|
70 | 70 | self.repo = repo |
|
71 | 71 | |
|
72 | 72 | # input/output/error streams |
|
73 | 73 | self.fin = fin |
|
74 | 74 | self.fout = fout |
|
75 | 75 | self.ferr = ferr |
|
76 | 76 | # separate stream for status/error messages |
|
77 | 77 | self.fmsg = fmsg |
|
78 | 78 | |
|
79 | 79 | # remember options pre-parsed by _earlyparseopts() |
|
80 | 80 | self.earlyoptions = {} |
|
81 | 81 | |
|
82 | 82 | # reposetups which run before extensions, useful for chg to pre-fill |
|
83 | 83 | # low-level repo state (for example, changelog) before extensions. |
|
84 | 84 | self.prereposetups = prereposetups or [] |
|
85 | 85 | |
|
86 | 86 | # store the parsed and canonical command |
|
87 | 87 | self.canonical_command = None |
|
88 | 88 | |
|
89 | 89 | def _runexithandlers(self): |
|
90 | 90 | exc = None |
|
91 | 91 | handlers = self.ui._exithandlers |
|
92 | 92 | try: |
|
93 | 93 | while handlers: |
|
94 | 94 | func, args, kwargs = handlers.pop() |
|
95 | 95 | try: |
|
96 | 96 | func(*args, **kwargs) |
|
97 | 97 | except: # re-raises below |
|
98 | 98 | if exc is None: |
|
99 | 99 | exc = sys.exc_info()[1] |
|
100 | 100 | self.ui.warnnoi18n(b'error in exit handlers:\n') |
|
101 | 101 | self.ui.traceback(force=True) |
|
102 | 102 | finally: |
|
103 | 103 | if exc is not None: |
|
104 | 104 | raise exc |
|
105 | 105 | |
|
106 | 106 | |
|
107 | 107 | def _flushstdio(ui, err): |
|
108 | 108 | status = None |
|
109 | 109 | # In all cases we try to flush stdio streams. |
|
110 | 110 | if util.safehasattr(ui, b'fout'): |
|
111 | 111 | assert ui is not None # help pytype |
|
112 | 112 | assert ui.fout is not None # help pytype |
|
113 | 113 | try: |
|
114 | 114 | ui.fout.flush() |
|
115 | 115 | except IOError as e: |
|
116 | 116 | err = e |
|
117 | 117 | status = -1 |
|
118 | 118 | |
|
119 | 119 | if util.safehasattr(ui, b'ferr'): |
|
120 | 120 | assert ui is not None # help pytype |
|
121 | 121 | assert ui.ferr is not None # help pytype |
|
122 | 122 | try: |
|
123 | 123 | if err is not None and err.errno != errno.EPIPE: |
|
124 | 124 | ui.ferr.write( |
|
125 | 125 | b'abort: %s\n' % encoding.strtolocal(err.strerror) |
|
126 | 126 | ) |
|
127 | 127 | ui.ferr.flush() |
|
128 | 128 | # There's not much we can do about an I/O error here. So (possibly) |
|
129 | 129 | # change the status code and move on. |
|
130 | 130 | except IOError: |
|
131 | 131 | status = -1 |
|
132 | 132 | |
|
133 | 133 | return status |
|
134 | 134 | |
|
135 | 135 | |
|
136 | 136 | def run(): |
|
137 | 137 | """run the command in sys.argv""" |
|
138 | 138 | try: |
|
139 | 139 | initstdio() |
|
140 | 140 | with tracing.log('parse args into request'): |
|
141 | 141 | req = request(pycompat.sysargv[1:]) |
|
142 | 142 | |
|
143 | 143 | status = dispatch(req) |
|
144 | 144 | _silencestdio() |
|
145 | 145 | except KeyboardInterrupt: |
|
146 | 146 | # Catch early/late KeyboardInterrupt as last ditch. Here nothing will |
|
147 | 147 | # be printed to console to avoid another IOError/KeyboardInterrupt. |
|
148 | 148 | status = -1 |
|
149 | 149 | sys.exit(status & 255) |
|
150 | 150 | |
|
151 | 151 | |
|
152 | 152 | if pycompat.ispy3: |
|
153 | 153 | |
|
154 | 154 | def initstdio(): |
|
155 | 155 | # stdio streams on Python 3 are io.TextIOWrapper instances proxying another |
|
156 | 156 | # buffer. These streams will normalize \n to \r\n by default. Mercurial's |
|
157 | 157 | # preferred mechanism for writing output (ui.write()) uses io.BufferedWriter |
|
158 | 158 | # instances, which write to the underlying stdio file descriptor in binary |
|
159 | 159 | # mode. ui.write() uses \n for line endings and no line ending normalization |
|
160 | 160 | # is attempted through this interface. This "just works," even if the system |
|
161 | 161 | # preferred line ending is not \n. |
|
162 | 162 | # |
|
163 | 163 | # But some parts of Mercurial (e.g. hooks) can still send data to sys.stdout |
|
164 | 164 | # and sys.stderr. They will inherit the line ending normalization settings, |
|
165 | 165 | # potentially causing e.g. \r\n to be emitted. Since emitting \n should |
|
166 | 166 | # "just work," here we change the sys.* streams to disable line ending |
|
167 | 167 | # normalization, ensuring compatibility with our ui type. |
|
168 | 168 | |
|
169 | 169 | if sys.stdout is not None: |
|
170 | 170 | # write_through is new in Python 3.7. |
|
171 | 171 | kwargs = { |
|
172 | 172 | "newline": "\n", |
|
173 | 173 | "line_buffering": sys.stdout.line_buffering, |
|
174 | 174 | } |
|
175 | 175 | if util.safehasattr(sys.stdout, "write_through"): |
|
176 | 176 | kwargs["write_through"] = sys.stdout.write_through |
|
177 | 177 | sys.stdout = io.TextIOWrapper( |
|
178 | 178 | sys.stdout.buffer, |
|
179 | 179 | sys.stdout.encoding, |
|
180 | 180 | sys.stdout.errors, |
|
181 | 181 | **kwargs |
|
182 | 182 | ) |
|
183 | 183 | |
|
184 | 184 | if sys.stderr is not None: |
|
185 | 185 | kwargs = { |
|
186 | 186 | "newline": "\n", |
|
187 | 187 | "line_buffering": sys.stderr.line_buffering, |
|
188 | 188 | } |
|
189 | 189 | if util.safehasattr(sys.stderr, "write_through"): |
|
190 | 190 | kwargs["write_through"] = sys.stderr.write_through |
|
191 | 191 | sys.stderr = io.TextIOWrapper( |
|
192 | 192 | sys.stderr.buffer, |
|
193 | 193 | sys.stderr.encoding, |
|
194 | 194 | sys.stderr.errors, |
|
195 | 195 | **kwargs |
|
196 | 196 | ) |
|
197 | 197 | |
|
198 | 198 | if sys.stdin is not None: |
|
199 | 199 | # No write_through on read-only stream. |
|
200 | 200 | sys.stdin = io.TextIOWrapper( |
|
201 | 201 | sys.stdin.buffer, |
|
202 | 202 | sys.stdin.encoding, |
|
203 | 203 | sys.stdin.errors, |
|
204 | 204 | # None is universal newlines mode. |
|
205 | 205 | newline=None, |
|
206 | 206 | line_buffering=sys.stdin.line_buffering, |
|
207 | 207 | ) |
|
208 | 208 | |
|
209 | 209 | def _silencestdio(): |
|
210 | 210 | for fp in (sys.stdout, sys.stderr): |
|
211 | 211 | if fp is None: |
|
212 | 212 | continue |
|
213 | 213 | # Check if the file is okay |
|
214 | 214 | try: |
|
215 | 215 | fp.flush() |
|
216 | 216 | continue |
|
217 | 217 | except IOError: |
|
218 | 218 | pass |
|
219 | 219 | # Otherwise mark it as closed to silence "Exception ignored in" |
|
220 | 220 | # message emitted by the interpreter finalizer. |
|
221 | 221 | try: |
|
222 | 222 | fp.close() |
|
223 | 223 | except IOError: |
|
224 | 224 | pass |
|
225 | 225 | |
|
226 | 226 | |
|
227 | 227 | else: |
|
228 | 228 | |
|
229 | 229 | def initstdio(): |
|
230 | 230 | for fp in (sys.stdin, sys.stdout, sys.stderr): |
|
231 | 231 | procutil.setbinary(fp) |
|
232 | 232 | |
|
233 | 233 | def _silencestdio(): |
|
234 | 234 | pass |
|
235 | 235 | |
|
236 | 236 | |
|
237 | 237 | def _formatargs(args): |
|
238 | 238 | return b' '.join(procutil.shellquote(a) for a in args) |
|
239 | 239 | |
|
240 | 240 | |
|
241 | 241 | def dispatch(req): |
|
242 | 242 | """run the command specified in req.args; returns an integer status code""" |
|
243 | 243 | err = None |
|
244 | 244 | try: |
|
245 | 245 | status = _rundispatch(req) |
|
246 | 246 | except error.StdioError as e: |
|
247 | 247 | err = e |
|
248 | 248 | status = -1 |
|
249 | 249 | |
|
250 | 250 | ret = _flushstdio(req.ui, err) |
|
251 | 251 | if ret: |
|
252 | 252 | status = ret |
|
253 | 253 | return status |
|
254 | 254 | |
|
255 | 255 | |
|
256 | 256 | def _rundispatch(req): |
|
257 | 257 | with tracing.log('dispatch._rundispatch'): |
|
258 | 258 | if req.ferr: |
|
259 | 259 | ferr = req.ferr |
|
260 | 260 | elif req.ui: |
|
261 | 261 | ferr = req.ui.ferr |
|
262 | 262 | else: |
|
263 | 263 | ferr = procutil.stderr |
|
264 | 264 | |
|
265 | 265 | try: |
|
266 | 266 | if not req.ui: |
|
267 | 267 | req.ui = uimod.ui.load() |
|
268 | 268 | req.earlyoptions.update(_earlyparseopts(req.ui, req.args)) |
|
269 | 269 | if req.earlyoptions[b'traceback']: |
|
270 | 270 | req.ui.setconfig(b'ui', b'traceback', b'on', b'--traceback') |
|
271 | 271 | |
|
272 | 272 | # set ui streams from the request |
|
273 | 273 | if req.fin: |
|
274 | 274 | req.ui.fin = req.fin |
|
275 | 275 | if req.fout: |
|
276 | 276 | req.ui.fout = req.fout |
|
277 | 277 | if req.ferr: |
|
278 | 278 | req.ui.ferr = req.ferr |
|
279 | 279 | if req.fmsg: |
|
280 | 280 | req.ui.fmsg = req.fmsg |
|
281 | 281 | except error.Abort as inst: |
|
282 | 282 | ferr.write(inst.format()) |
|
283 | 283 | return -1 |
|
284 | 284 | |
|
285 | 285 | msg = _formatargs(req.args) |
|
286 | 286 | starttime = util.timer() |
|
287 | 287 | ret = 1 # default of Python exit code on unhandled exception |
|
288 | 288 | try: |
|
289 | 289 | ret = _runcatch(req) or 0 |
|
290 | 290 | except error.ProgrammingError as inst: |
|
291 | 291 | req.ui.error(_(b'** ProgrammingError: %s\n') % inst) |
|
292 | 292 | if inst.hint: |
|
293 | 293 | req.ui.error(_(b'** (%s)\n') % inst.hint) |
|
294 | 294 | raise |
|
295 | 295 | except KeyboardInterrupt as inst: |
|
296 | 296 | try: |
|
297 | 297 | if isinstance(inst, error.SignalInterrupt): |
|
298 | 298 | msg = _(b"killed!\n") |
|
299 | 299 | else: |
|
300 | 300 | msg = _(b"interrupted!\n") |
|
301 | 301 | req.ui.error(msg) |
|
302 | 302 | except error.SignalInterrupt: |
|
303 | 303 | # maybe pager would quit without consuming all the output, and |
|
304 | 304 | # SIGPIPE was raised. we cannot print anything in this case. |
|
305 | 305 | pass |
|
306 | 306 | except IOError as inst: |
|
307 | 307 | if inst.errno != errno.EPIPE: |
|
308 | 308 | raise |
|
309 | 309 | ret = -1 |
|
310 | 310 | finally: |
|
311 | 311 | duration = util.timer() - starttime |
|
312 | 312 | req.ui.flush() # record blocked times |
|
313 | 313 | if req.ui.logblockedtimes: |
|
314 | 314 | req.ui._blockedtimes[b'command_duration'] = duration * 1000 |
|
315 | 315 | req.ui.log( |
|
316 | 316 | b'uiblocked', |
|
317 | 317 | b'ui blocked ms\n', |
|
318 | 318 | **pycompat.strkwargs(req.ui._blockedtimes) |
|
319 | 319 | ) |
|
320 | 320 | return_code = ret & 255 |
|
321 | 321 | req.ui.log( |
|
322 | 322 | b"commandfinish", |
|
323 | 323 | b"%s exited %d after %0.2f seconds\n", |
|
324 | 324 | msg, |
|
325 | 325 | return_code, |
|
326 | 326 | duration, |
|
327 | 327 | return_code=return_code, |
|
328 | 328 | duration=duration, |
|
329 | 329 | canonical_command=req.canonical_command, |
|
330 | 330 | ) |
|
331 | 331 | try: |
|
332 | 332 | req._runexithandlers() |
|
333 | 333 | except: # exiting, so no re-raises |
|
334 | 334 | ret = ret or -1 |
|
335 | 335 | # do flush again since ui.log() and exit handlers may write to ui |
|
336 | 336 | req.ui.flush() |
|
337 | 337 | return ret |
|
338 | 338 | |
|
339 | 339 | |
|
340 | 340 | def _runcatch(req): |
|
341 | 341 | with tracing.log('dispatch._runcatch'): |
|
342 | 342 | |
|
343 | 343 | def catchterm(*args): |
|
344 | 344 | raise error.SignalInterrupt |
|
345 | 345 | |
|
346 | 346 | ui = req.ui |
|
347 | 347 | try: |
|
348 | 348 | for name in b'SIGBREAK', b'SIGHUP', b'SIGTERM': |
|
349 | 349 | num = getattr(signal, name, None) |
|
350 | 350 | if num: |
|
351 | 351 | signal.signal(num, catchterm) |
|
352 | 352 | except ValueError: |
|
353 | 353 | pass # happens if called in a thread |
|
354 | 354 | |
|
355 | 355 | def _runcatchfunc(): |
|
356 | 356 | realcmd = None |
|
357 | 357 | try: |
|
358 | 358 | cmdargs = fancyopts.fancyopts( |
|
359 | 359 | req.args[:], commands.globalopts, {} |
|
360 | 360 | ) |
|
361 | 361 | cmd = cmdargs[0] |
|
362 | 362 | aliases, entry = cmdutil.findcmd(cmd, commands.table, False) |
|
363 | 363 | realcmd = aliases[0] |
|
364 | 364 | except ( |
|
365 | 365 | error.UnknownCommand, |
|
366 | 366 | error.AmbiguousCommand, |
|
367 | 367 | IndexError, |
|
368 | 368 | getopt.GetoptError, |
|
369 | 369 | ): |
|
370 | 370 | # Don't handle this here. We know the command is |
|
371 | 371 | # invalid, but all we're worried about for now is that |
|
372 | 372 | # it's not a command that server operators expect to |
|
373 | 373 | # be safe to offer to users in a sandbox. |
|
374 | 374 | pass |
|
375 | 375 | if realcmd == b'serve' and b'--stdio' in cmdargs: |
|
376 | 376 | # We want to constrain 'hg serve --stdio' instances pretty |
|
377 | 377 | # closely, as many shared-ssh access tools want to grant |
|
378 | 378 | # access to run *only* 'hg -R $repo serve --stdio'. We |
|
379 | 379 | # restrict to exactly that set of arguments, and prohibit |
|
380 | 380 | # any repo name that starts with '--' to prevent |
|
381 | 381 | # shenanigans wherein a user does something like pass |
|
382 | 382 | # --debugger or --config=ui.debugger=1 as a repo |
|
383 | 383 | # name. This used to actually run the debugger. |
|
384 | 384 | if ( |
|
385 | 385 | len(req.args) != 4 |
|
386 | 386 | or req.args[0] != b'-R' |
|
387 | 387 | or req.args[1].startswith(b'--') |
|
388 | 388 | or req.args[2] != b'serve' |
|
389 | 389 | or req.args[3] != b'--stdio' |
|
390 | 390 | ): |
|
391 | 391 | raise error.Abort( |
|
392 | 392 | _(b'potentially unsafe serve --stdio invocation: %s') |
|
393 | 393 | % (stringutil.pprint(req.args),) |
|
394 | 394 | ) |
|
395 | 395 | |
|
396 | 396 | try: |
|
397 | 397 | debugger = b'pdb' |
|
398 | 398 | debugtrace = {b'pdb': pdb.set_trace} |
|
399 | 399 | debugmortem = {b'pdb': pdb.post_mortem} |
|
400 | 400 | |
|
401 | 401 | # read --config before doing anything else |
|
402 | 402 | # (e.g. to change trust settings for reading .hg/hgrc) |
|
403 | 403 | cfgs = _parseconfig(req.ui, req.earlyoptions[b'config']) |
|
404 | 404 | |
|
405 | 405 | if req.repo: |
|
406 | 406 | # copy configs that were passed on the cmdline (--config) to |
|
407 | 407 | # the repo ui |
|
408 | 408 | for sec, name, val in cfgs: |
|
409 | 409 | req.repo.ui.setconfig( |
|
410 | 410 | sec, name, val, source=b'--config' |
|
411 | 411 | ) |
|
412 | 412 | |
|
413 | 413 | # developer config: ui.debugger |
|
414 | 414 | debugger = ui.config(b"ui", b"debugger") |
|
415 | 415 | debugmod = pdb |
|
416 | 416 | if not debugger or ui.plain(): |
|
417 | 417 | # if we are in HGPLAIN mode, then disable custom debugging |
|
418 | 418 | debugger = b'pdb' |
|
419 | 419 | elif req.earlyoptions[b'debugger']: |
|
420 | 420 | # This import can be slow for fancy debuggers, so only |
|
421 | 421 | # do it when absolutely necessary, i.e. when actual |
|
422 | 422 | # debugging has been requested |
|
423 | 423 | with demandimport.deactivated(): |
|
424 | 424 | try: |
|
425 | 425 | debugmod = __import__(debugger) |
|
426 | 426 | except ImportError: |
|
427 | 427 | pass # Leave debugmod = pdb |
|
428 | 428 | |
|
429 | 429 | debugtrace[debugger] = debugmod.set_trace |
|
430 | 430 | debugmortem[debugger] = debugmod.post_mortem |
|
431 | 431 | |
|
432 | 432 | # enter the debugger before command execution |
|
433 | 433 | if req.earlyoptions[b'debugger']: |
|
434 | 434 | ui.warn( |
|
435 | 435 | _( |
|
436 | 436 | b"entering debugger - " |
|
437 | 437 | b"type c to continue starting hg or h for help\n" |
|
438 | 438 | ) |
|
439 | 439 | ) |
|
440 | 440 | |
|
441 | 441 | if ( |
|
442 | 442 | debugger != b'pdb' |
|
443 | 443 | and debugtrace[debugger] == debugtrace[b'pdb'] |
|
444 | 444 | ): |
|
445 | 445 | ui.warn( |
|
446 | 446 | _( |
|
447 | 447 | b"%s debugger specified " |
|
448 | 448 | b"but its module was not found\n" |
|
449 | 449 | ) |
|
450 | 450 | % debugger |
|
451 | 451 | ) |
|
452 | 452 | with demandimport.deactivated(): |
|
453 | 453 | debugtrace[debugger]() |
|
454 | 454 | try: |
|
455 | 455 | return _dispatch(req) |
|
456 | 456 | finally: |
|
457 | 457 | ui.flush() |
|
458 | 458 | except: # re-raises |
|
459 | 459 | # enter the debugger when we hit an exception |
|
460 | 460 | if req.earlyoptions[b'debugger']: |
|
461 | 461 | traceback.print_exc() |
|
462 | 462 | debugmortem[debugger](sys.exc_info()[2]) |
|
463 | 463 | raise |
|
464 | 464 | |
|
465 | 465 | return _callcatch(ui, _runcatchfunc) |
|
466 | 466 | |
|
467 | 467 | |
|
468 | 468 | def _callcatch(ui, func): |
|
469 | 469 | """like scmutil.callcatch but handles more high-level exceptions about |
|
470 | 470 | config parsing and commands. besides, use handlecommandexception to handle |
|
471 | 471 | uncaught exceptions. |
|
472 | 472 | """ |
|
473 | detailed_exit_code = -1 | |
|
473 | 474 | try: |
|
474 | 475 | return scmutil.callcatch(ui, func) |
|
475 | 476 | except error.AmbiguousCommand as inst: |
|
477 | detailed_exit_code = 10 | |
|
476 | 478 | ui.warn( |
|
477 | 479 | _(b"hg: command '%s' is ambiguous:\n %s\n") |
|
478 | 480 | % (inst.prefix, b" ".join(inst.matches)) |
|
479 | 481 | ) |
|
480 | 482 | except error.CommandError as inst: |
|
483 | detailed_exit_code = 10 | |
|
481 | 484 | if inst.command: |
|
482 | 485 | ui.pager(b'help') |
|
483 | 486 | msgbytes = pycompat.bytestr(inst.message) |
|
484 | 487 | ui.warn(_(b"hg %s: %s\n") % (inst.command, msgbytes)) |
|
485 | 488 | commands.help_(ui, inst.command, full=False, command=True) |
|
486 | 489 | else: |
|
487 | 490 | ui.warn(_(b"hg: %s\n") % inst.message) |
|
488 | 491 | ui.warn(_(b"(use 'hg help -v' for a list of global options)\n")) |
|
489 | 492 | except error.UnknownCommand as inst: |
|
493 | detailed_exit_code = 10 | |
|
490 | 494 | nocmdmsg = _(b"hg: unknown command '%s'\n") % inst.command |
|
491 | 495 | try: |
|
492 | 496 | # check if the command is in a disabled extension |
|
493 | 497 | # (but don't check for extensions themselves) |
|
494 | 498 | formatted = help.formattedhelp( |
|
495 | 499 | ui, commands, inst.command, unknowncmd=True |
|
496 | 500 | ) |
|
497 | 501 | ui.warn(nocmdmsg) |
|
498 | 502 | ui.write(formatted) |
|
499 | 503 | except (error.UnknownCommand, error.Abort): |
|
500 | 504 | suggested = False |
|
501 | 505 | if inst.all_commands: |
|
502 | 506 | sim = error.getsimilar(inst.all_commands, inst.command) |
|
503 | 507 | if sim: |
|
504 | 508 | ui.warn(nocmdmsg) |
|
505 | 509 | ui.warn(b"(%s)\n" % error.similarity_hint(sim)) |
|
506 | 510 | suggested = True |
|
507 | 511 | if not suggested: |
|
508 | 512 | ui.warn(nocmdmsg) |
|
509 | 513 | ui.warn(_(b"(use 'hg help' for a list of commands)\n")) |
|
510 | 514 | except IOError: |
|
511 | 515 | raise |
|
512 | 516 | except KeyboardInterrupt: |
|
513 | 517 | raise |
|
514 | 518 | except: # probably re-raises |
|
515 | 519 | if not handlecommandexception(ui): |
|
516 | 520 | raise |
|
517 | 521 | |
|
522 | if ui.configbool(b'ui', b'detailed-exit-code'): | |
|
523 | return detailed_exit_code | |
|
524 | else: | |
|
518 | 525 | return -1 |
|
519 | 526 | |
|
520 | 527 | |
|
521 | 528 | def aliasargs(fn, givenargs): |
|
522 | 529 | args = [] |
|
523 | 530 | # only care about alias 'args', ignore 'args' set by extensions.wrapfunction |
|
524 | 531 | if not util.safehasattr(fn, b'_origfunc'): |
|
525 | 532 | args = getattr(fn, 'args', args) |
|
526 | 533 | if args: |
|
527 | 534 | cmd = b' '.join(map(procutil.shellquote, args)) |
|
528 | 535 | |
|
529 | 536 | nums = [] |
|
530 | 537 | |
|
531 | 538 | def replacer(m): |
|
532 | 539 | num = int(m.group(1)) - 1 |
|
533 | 540 | nums.append(num) |
|
534 | 541 | if num < len(givenargs): |
|
535 | 542 | return givenargs[num] |
|
536 | 543 | raise error.InputError(_(b'too few arguments for command alias')) |
|
537 | 544 | |
|
538 | 545 | cmd = re.sub(br'\$(\d+|\$)', replacer, cmd) |
|
539 | 546 | givenargs = [x for i, x in enumerate(givenargs) if i not in nums] |
|
540 | 547 | args = pycompat.shlexsplit(cmd) |
|
541 | 548 | return args + givenargs |
|
542 | 549 | |
|
543 | 550 | |
|
544 | 551 | def aliasinterpolate(name, args, cmd): |
|
545 | 552 | """interpolate args into cmd for shell aliases |
|
546 | 553 | |
|
547 | 554 | This also handles $0, $@ and "$@". |
|
548 | 555 | """ |
|
549 | 556 | # util.interpolate can't deal with "$@" (with quotes) because it's only |
|
550 | 557 | # built to match prefix + patterns. |
|
551 | 558 | replacemap = {b'$%d' % (i + 1): arg for i, arg in enumerate(args)} |
|
552 | 559 | replacemap[b'$0'] = name |
|
553 | 560 | replacemap[b'$$'] = b'$' |
|
554 | 561 | replacemap[b'$@'] = b' '.join(args) |
|
555 | 562 | # Typical Unix shells interpolate "$@" (with quotes) as all the positional |
|
556 | 563 | # parameters, separated out into words. Emulate the same behavior here by |
|
557 | 564 | # quoting the arguments individually. POSIX shells will then typically |
|
558 | 565 | # tokenize each argument into exactly one word. |
|
559 | 566 | replacemap[b'"$@"'] = b' '.join(procutil.shellquote(arg) for arg in args) |
|
560 | 567 | # escape '\$' for regex |
|
561 | 568 | regex = b'|'.join(replacemap.keys()).replace(b'$', br'\$') |
|
562 | 569 | r = re.compile(regex) |
|
563 | 570 | return r.sub(lambda x: replacemap[x.group()], cmd) |
|
564 | 571 | |
|
565 | 572 | |
|
566 | 573 | class cmdalias(object): |
|
567 | 574 | def __init__(self, ui, name, definition, cmdtable, source): |
|
568 | 575 | self.name = self.cmd = name |
|
569 | 576 | self.cmdname = b'' |
|
570 | 577 | self.definition = definition |
|
571 | 578 | self.fn = None |
|
572 | 579 | self.givenargs = [] |
|
573 | 580 | self.opts = [] |
|
574 | 581 | self.help = b'' |
|
575 | 582 | self.badalias = None |
|
576 | 583 | self.unknowncmd = False |
|
577 | 584 | self.source = source |
|
578 | 585 | |
|
579 | 586 | try: |
|
580 | 587 | aliases, entry = cmdutil.findcmd(self.name, cmdtable) |
|
581 | 588 | for alias, e in pycompat.iteritems(cmdtable): |
|
582 | 589 | if e is entry: |
|
583 | 590 | self.cmd = alias |
|
584 | 591 | break |
|
585 | 592 | self.shadows = True |
|
586 | 593 | except error.UnknownCommand: |
|
587 | 594 | self.shadows = False |
|
588 | 595 | |
|
589 | 596 | if not self.definition: |
|
590 | 597 | self.badalias = _(b"no definition for alias '%s'") % self.name |
|
591 | 598 | return |
|
592 | 599 | |
|
593 | 600 | if self.definition.startswith(b'!'): |
|
594 | 601 | shdef = self.definition[1:] |
|
595 | 602 | self.shell = True |
|
596 | 603 | |
|
597 | 604 | def fn(ui, *args): |
|
598 | 605 | env = {b'HG_ARGS': b' '.join((self.name,) + args)} |
|
599 | 606 | |
|
600 | 607 | def _checkvar(m): |
|
601 | 608 | if m.groups()[0] == b'$': |
|
602 | 609 | return m.group() |
|
603 | 610 | elif int(m.groups()[0]) <= len(args): |
|
604 | 611 | return m.group() |
|
605 | 612 | else: |
|
606 | 613 | ui.debug( |
|
607 | 614 | b"No argument found for substitution " |
|
608 | 615 | b"of %i variable in alias '%s' definition.\n" |
|
609 | 616 | % (int(m.groups()[0]), self.name) |
|
610 | 617 | ) |
|
611 | 618 | return b'' |
|
612 | 619 | |
|
613 | 620 | cmd = re.sub(br'\$(\d+|\$)', _checkvar, shdef) |
|
614 | 621 | cmd = aliasinterpolate(self.name, args, cmd) |
|
615 | 622 | return ui.system( |
|
616 | 623 | cmd, environ=env, blockedtag=b'alias_%s' % self.name |
|
617 | 624 | ) |
|
618 | 625 | |
|
619 | 626 | self.fn = fn |
|
620 | 627 | self.alias = True |
|
621 | 628 | self._populatehelp(ui, name, shdef, self.fn) |
|
622 | 629 | return |
|
623 | 630 | |
|
624 | 631 | try: |
|
625 | 632 | args = pycompat.shlexsplit(self.definition) |
|
626 | 633 | except ValueError as inst: |
|
627 | 634 | self.badalias = _(b"error in definition for alias '%s': %s") % ( |
|
628 | 635 | self.name, |
|
629 | 636 | stringutil.forcebytestr(inst), |
|
630 | 637 | ) |
|
631 | 638 | return |
|
632 | 639 | earlyopts, args = _earlysplitopts(args) |
|
633 | 640 | if earlyopts: |
|
634 | 641 | self.badalias = _( |
|
635 | 642 | b"error in definition for alias '%s': %s may " |
|
636 | 643 | b"only be given on the command line" |
|
637 | 644 | ) % (self.name, b'/'.join(pycompat.ziplist(*earlyopts)[0])) |
|
638 | 645 | return |
|
639 | 646 | self.cmdname = cmd = args.pop(0) |
|
640 | 647 | self.givenargs = args |
|
641 | 648 | |
|
642 | 649 | try: |
|
643 | 650 | tableentry = cmdutil.findcmd(cmd, cmdtable, False)[1] |
|
644 | 651 | if len(tableentry) > 2: |
|
645 | 652 | self.fn, self.opts, cmdhelp = tableentry |
|
646 | 653 | else: |
|
647 | 654 | self.fn, self.opts = tableentry |
|
648 | 655 | cmdhelp = None |
|
649 | 656 | |
|
650 | 657 | self.alias = True |
|
651 | 658 | self._populatehelp(ui, name, cmd, self.fn, cmdhelp) |
|
652 | 659 | |
|
653 | 660 | except error.UnknownCommand: |
|
654 | 661 | self.badalias = _( |
|
655 | 662 | b"alias '%s' resolves to unknown command '%s'" |
|
656 | 663 | ) % ( |
|
657 | 664 | self.name, |
|
658 | 665 | cmd, |
|
659 | 666 | ) |
|
660 | 667 | self.unknowncmd = True |
|
661 | 668 | except error.AmbiguousCommand: |
|
662 | 669 | self.badalias = _( |
|
663 | 670 | b"alias '%s' resolves to ambiguous command '%s'" |
|
664 | 671 | ) % ( |
|
665 | 672 | self.name, |
|
666 | 673 | cmd, |
|
667 | 674 | ) |
|
668 | 675 | |
|
669 | 676 | def _populatehelp(self, ui, name, cmd, fn, defaulthelp=None): |
|
670 | 677 | # confine strings to be passed to i18n.gettext() |
|
671 | 678 | cfg = {} |
|
672 | 679 | for k in (b'doc', b'help', b'category'): |
|
673 | 680 | v = ui.config(b'alias', b'%s:%s' % (name, k), None) |
|
674 | 681 | if v is None: |
|
675 | 682 | continue |
|
676 | 683 | if not encoding.isasciistr(v): |
|
677 | 684 | self.badalias = _( |
|
678 | 685 | b"non-ASCII character in alias definition '%s:%s'" |
|
679 | 686 | ) % (name, k) |
|
680 | 687 | return |
|
681 | 688 | cfg[k] = v |
|
682 | 689 | |
|
683 | 690 | self.help = cfg.get(b'help', defaulthelp or b'') |
|
684 | 691 | if self.help and self.help.startswith(b"hg " + cmd): |
|
685 | 692 | # drop prefix in old-style help lines so hg shows the alias |
|
686 | 693 | self.help = self.help[4 + len(cmd) :] |
|
687 | 694 | |
|
688 | 695 | self.owndoc = b'doc' in cfg |
|
689 | 696 | doc = cfg.get(b'doc', pycompat.getdoc(fn)) |
|
690 | 697 | if doc is not None: |
|
691 | 698 | doc = pycompat.sysstr(doc) |
|
692 | 699 | self.__doc__ = doc |
|
693 | 700 | |
|
694 | 701 | self.helpcategory = cfg.get( |
|
695 | 702 | b'category', registrar.command.CATEGORY_NONE |
|
696 | 703 | ) |
|
697 | 704 | |
|
698 | 705 | @property |
|
699 | 706 | def args(self): |
|
700 | 707 | args = pycompat.maplist(util.expandpath, self.givenargs) |
|
701 | 708 | return aliasargs(self.fn, args) |
|
702 | 709 | |
|
703 | 710 | def __getattr__(self, name): |
|
704 | 711 | adefaults = { |
|
705 | 712 | 'norepo': True, |
|
706 | 713 | 'intents': set(), |
|
707 | 714 | 'optionalrepo': False, |
|
708 | 715 | 'inferrepo': False, |
|
709 | 716 | } |
|
710 | 717 | if name not in adefaults: |
|
711 | 718 | raise AttributeError(name) |
|
712 | 719 | if self.badalias or util.safehasattr(self, b'shell'): |
|
713 | 720 | return adefaults[name] |
|
714 | 721 | return getattr(self.fn, name) |
|
715 | 722 | |
|
716 | 723 | def __call__(self, ui, *args, **opts): |
|
717 | 724 | if self.badalias: |
|
718 | 725 | hint = None |
|
719 | 726 | if self.unknowncmd: |
|
720 | 727 | try: |
|
721 | 728 | # check if the command is in a disabled extension |
|
722 | 729 | cmd, ext = extensions.disabledcmd(ui, self.cmdname)[:2] |
|
723 | 730 | hint = _(b"'%s' is provided by '%s' extension") % (cmd, ext) |
|
724 | 731 | except error.UnknownCommand: |
|
725 | 732 | pass |
|
726 | 733 | raise error.ConfigError(self.badalias, hint=hint) |
|
727 | 734 | if self.shadows: |
|
728 | 735 | ui.debug( |
|
729 | 736 | b"alias '%s' shadows command '%s'\n" % (self.name, self.cmdname) |
|
730 | 737 | ) |
|
731 | 738 | |
|
732 | 739 | ui.log( |
|
733 | 740 | b'commandalias', |
|
734 | 741 | b"alias '%s' expands to '%s'\n", |
|
735 | 742 | self.name, |
|
736 | 743 | self.definition, |
|
737 | 744 | ) |
|
738 | 745 | if util.safehasattr(self, b'shell'): |
|
739 | 746 | return self.fn(ui, *args, **opts) |
|
740 | 747 | else: |
|
741 | 748 | try: |
|
742 | 749 | return util.checksignature(self.fn)(ui, *args, **opts) |
|
743 | 750 | except error.SignatureError: |
|
744 | 751 | args = b' '.join([self.cmdname] + self.args) |
|
745 | 752 | ui.debug(b"alias '%s' expands to '%s'\n" % (self.name, args)) |
|
746 | 753 | raise |
|
747 | 754 | |
|
748 | 755 | |
|
749 | 756 | class lazyaliasentry(object): |
|
750 | 757 | """like a typical command entry (func, opts, help), but is lazy""" |
|
751 | 758 | |
|
752 | 759 | def __init__(self, ui, name, definition, cmdtable, source): |
|
753 | 760 | self.ui = ui |
|
754 | 761 | self.name = name |
|
755 | 762 | self.definition = definition |
|
756 | 763 | self.cmdtable = cmdtable.copy() |
|
757 | 764 | self.source = source |
|
758 | 765 | self.alias = True |
|
759 | 766 | |
|
760 | 767 | @util.propertycache |
|
761 | 768 | def _aliasdef(self): |
|
762 | 769 | return cmdalias( |
|
763 | 770 | self.ui, self.name, self.definition, self.cmdtable, self.source |
|
764 | 771 | ) |
|
765 | 772 | |
|
766 | 773 | def __getitem__(self, n): |
|
767 | 774 | aliasdef = self._aliasdef |
|
768 | 775 | if n == 0: |
|
769 | 776 | return aliasdef |
|
770 | 777 | elif n == 1: |
|
771 | 778 | return aliasdef.opts |
|
772 | 779 | elif n == 2: |
|
773 | 780 | return aliasdef.help |
|
774 | 781 | else: |
|
775 | 782 | raise IndexError |
|
776 | 783 | |
|
777 | 784 | def __iter__(self): |
|
778 | 785 | for i in range(3): |
|
779 | 786 | yield self[i] |
|
780 | 787 | |
|
781 | 788 | def __len__(self): |
|
782 | 789 | return 3 |
|
783 | 790 | |
|
784 | 791 | |
|
785 | 792 | def addaliases(ui, cmdtable): |
|
786 | 793 | # aliases are processed after extensions have been loaded, so they |
|
787 | 794 | # may use extension commands. Aliases can also use other alias definitions, |
|
788 | 795 | # but only if they have been defined prior to the current definition. |
|
789 | 796 | for alias, definition in ui.configitems(b'alias', ignoresub=True): |
|
790 | 797 | try: |
|
791 | 798 | if cmdtable[alias].definition == definition: |
|
792 | 799 | continue |
|
793 | 800 | except (KeyError, AttributeError): |
|
794 | 801 | # definition might not exist or it might not be a cmdalias |
|
795 | 802 | pass |
|
796 | 803 | |
|
797 | 804 | source = ui.configsource(b'alias', alias) |
|
798 | 805 | entry = lazyaliasentry(ui, alias, definition, cmdtable, source) |
|
799 | 806 | cmdtable[alias] = entry |
|
800 | 807 | |
|
801 | 808 | |
|
802 | 809 | def _parse(ui, args): |
|
803 | 810 | options = {} |
|
804 | 811 | cmdoptions = {} |
|
805 | 812 | |
|
806 | 813 | try: |
|
807 | 814 | args = fancyopts.fancyopts(args, commands.globalopts, options) |
|
808 | 815 | except getopt.GetoptError as inst: |
|
809 | 816 | raise error.CommandError(None, stringutil.forcebytestr(inst)) |
|
810 | 817 | |
|
811 | 818 | if args: |
|
812 | 819 | cmd, args = args[0], args[1:] |
|
813 | 820 | aliases, entry = cmdutil.findcmd( |
|
814 | 821 | cmd, commands.table, ui.configbool(b"ui", b"strict") |
|
815 | 822 | ) |
|
816 | 823 | cmd = aliases[0] |
|
817 | 824 | args = aliasargs(entry[0], args) |
|
818 | 825 | defaults = ui.config(b"defaults", cmd) |
|
819 | 826 | if defaults: |
|
820 | 827 | args = ( |
|
821 | 828 | pycompat.maplist(util.expandpath, pycompat.shlexsplit(defaults)) |
|
822 | 829 | + args |
|
823 | 830 | ) |
|
824 | 831 | c = list(entry[1]) |
|
825 | 832 | else: |
|
826 | 833 | cmd = None |
|
827 | 834 | c = [] |
|
828 | 835 | |
|
829 | 836 | # combine global options into local |
|
830 | 837 | for o in commands.globalopts: |
|
831 | 838 | c.append((o[0], o[1], options[o[1]], o[3])) |
|
832 | 839 | |
|
833 | 840 | try: |
|
834 | 841 | args = fancyopts.fancyopts(args, c, cmdoptions, gnu=True) |
|
835 | 842 | except getopt.GetoptError as inst: |
|
836 | 843 | raise error.CommandError(cmd, stringutil.forcebytestr(inst)) |
|
837 | 844 | |
|
838 | 845 | # separate global options back out |
|
839 | 846 | for o in commands.globalopts: |
|
840 | 847 | n = o[1] |
|
841 | 848 | options[n] = cmdoptions[n] |
|
842 | 849 | del cmdoptions[n] |
|
843 | 850 | |
|
844 | 851 | return (cmd, cmd and entry[0] or None, args, options, cmdoptions) |
|
845 | 852 | |
|
846 | 853 | |
|
847 | 854 | def _parseconfig(ui, config): |
|
848 | 855 | """parse the --config options from the command line""" |
|
849 | 856 | configs = [] |
|
850 | 857 | |
|
851 | 858 | for cfg in config: |
|
852 | 859 | try: |
|
853 | 860 | name, value = [cfgelem.strip() for cfgelem in cfg.split(b'=', 1)] |
|
854 | 861 | section, name = name.split(b'.', 1) |
|
855 | 862 | if not section or not name: |
|
856 | 863 | raise IndexError |
|
857 | 864 | ui.setconfig(section, name, value, b'--config') |
|
858 | 865 | configs.append((section, name, value)) |
|
859 | 866 | except (IndexError, ValueError): |
|
860 | 867 | raise error.InputError( |
|
861 | 868 | _( |
|
862 | 869 | b'malformed --config option: %r ' |
|
863 | 870 | b'(use --config section.name=value)' |
|
864 | 871 | ) |
|
865 | 872 | % pycompat.bytestr(cfg) |
|
866 | 873 | ) |
|
867 | 874 | |
|
868 | 875 | return configs |
|
869 | 876 | |
|
870 | 877 | |
|
871 | 878 | def _earlyparseopts(ui, args): |
|
872 | 879 | options = {} |
|
873 | 880 | fancyopts.fancyopts( |
|
874 | 881 | args, |
|
875 | 882 | commands.globalopts, |
|
876 | 883 | options, |
|
877 | 884 | gnu=not ui.plain(b'strictflags'), |
|
878 | 885 | early=True, |
|
879 | 886 | optaliases={b'repository': [b'repo']}, |
|
880 | 887 | ) |
|
881 | 888 | return options |
|
882 | 889 | |
|
883 | 890 | |
|
884 | 891 | def _earlysplitopts(args): |
|
885 | 892 | """Split args into a list of possible early options and remainder args""" |
|
886 | 893 | shortoptions = b'R:' |
|
887 | 894 | # TODO: perhaps 'debugger' should be included |
|
888 | 895 | longoptions = [b'cwd=', b'repository=', b'repo=', b'config='] |
|
889 | 896 | return fancyopts.earlygetopt( |
|
890 | 897 | args, shortoptions, longoptions, gnu=True, keepsep=True |
|
891 | 898 | ) |
|
892 | 899 | |
|
893 | 900 | |
|
894 | 901 | def runcommand(lui, repo, cmd, fullargs, ui, options, d, cmdpats, cmdoptions): |
|
895 | 902 | # run pre-hook, and abort if it fails |
|
896 | 903 | hook.hook( |
|
897 | 904 | lui, |
|
898 | 905 | repo, |
|
899 | 906 | b"pre-%s" % cmd, |
|
900 | 907 | True, |
|
901 | 908 | args=b" ".join(fullargs), |
|
902 | 909 | pats=cmdpats, |
|
903 | 910 | opts=cmdoptions, |
|
904 | 911 | ) |
|
905 | 912 | try: |
|
906 | 913 | ret = _runcommand(ui, options, cmd, d) |
|
907 | 914 | # run post-hook, passing command result |
|
908 | 915 | hook.hook( |
|
909 | 916 | lui, |
|
910 | 917 | repo, |
|
911 | 918 | b"post-%s" % cmd, |
|
912 | 919 | False, |
|
913 | 920 | args=b" ".join(fullargs), |
|
914 | 921 | result=ret, |
|
915 | 922 | pats=cmdpats, |
|
916 | 923 | opts=cmdoptions, |
|
917 | 924 | ) |
|
918 | 925 | except Exception: |
|
919 | 926 | # run failure hook and re-raise |
|
920 | 927 | hook.hook( |
|
921 | 928 | lui, |
|
922 | 929 | repo, |
|
923 | 930 | b"fail-%s" % cmd, |
|
924 | 931 | False, |
|
925 | 932 | args=b" ".join(fullargs), |
|
926 | 933 | pats=cmdpats, |
|
927 | 934 | opts=cmdoptions, |
|
928 | 935 | ) |
|
929 | 936 | raise |
|
930 | 937 | return ret |
|
931 | 938 | |
|
932 | 939 | |
|
933 | 940 | def _readsharedsourceconfig(ui, path): |
|
934 | 941 | """if the current repository is shared one, this tries to read |
|
935 | 942 | .hg/hgrc of shared source if we are in share-safe mode |
|
936 | 943 | |
|
937 | 944 | Config read is loaded into the ui object passed |
|
938 | 945 | |
|
939 | 946 | This should be called before reading .hg/hgrc or the main repo |
|
940 | 947 | as that overrides config set in shared source""" |
|
941 | 948 | try: |
|
942 | 949 | with open(os.path.join(path, b".hg", b"requires"), "rb") as fp: |
|
943 | 950 | requirements = set(fp.read().splitlines()) |
|
944 | 951 | if not ( |
|
945 | 952 | requirementsmod.SHARESAFE_REQUIREMENT in requirements |
|
946 | 953 | and requirementsmod.SHARED_REQUIREMENT in requirements |
|
947 | 954 | ): |
|
948 | 955 | return |
|
949 | 956 | hgvfs = vfs.vfs(os.path.join(path, b".hg")) |
|
950 | 957 | sharedvfs = localrepo._getsharedvfs(hgvfs, requirements) |
|
951 | 958 | root = sharedvfs.base |
|
952 | 959 | ui.readconfig(sharedvfs.join(b"hgrc"), root) |
|
953 | 960 | except IOError: |
|
954 | 961 | pass |
|
955 | 962 | |
|
956 | 963 | |
|
957 | 964 | def _getlocal(ui, rpath, wd=None): |
|
958 | 965 | """Return (path, local ui object) for the given target path. |
|
959 | 966 | |
|
960 | 967 | Takes paths in [cwd]/.hg/hgrc into account." |
|
961 | 968 | """ |
|
962 | 969 | if wd is None: |
|
963 | 970 | try: |
|
964 | 971 | wd = encoding.getcwd() |
|
965 | 972 | except OSError as e: |
|
966 | 973 | raise error.Abort( |
|
967 | 974 | _(b"error getting current working directory: %s") |
|
968 | 975 | % encoding.strtolocal(e.strerror) |
|
969 | 976 | ) |
|
970 | 977 | |
|
971 | 978 | path = cmdutil.findrepo(wd) or b"" |
|
972 | 979 | if not path: |
|
973 | 980 | lui = ui |
|
974 | 981 | else: |
|
975 | 982 | lui = ui.copy() |
|
976 | 983 | if rcutil.use_repo_hgrc(): |
|
977 | 984 | _readsharedsourceconfig(lui, path) |
|
978 | 985 | lui.readconfig(os.path.join(path, b".hg", b"hgrc"), path) |
|
979 | 986 | lui.readconfig(os.path.join(path, b".hg", b"hgrc-not-shared"), path) |
|
980 | 987 | |
|
981 | 988 | if rpath: |
|
982 | 989 | path = lui.expandpath(rpath) |
|
983 | 990 | lui = ui.copy() |
|
984 | 991 | if rcutil.use_repo_hgrc(): |
|
985 | 992 | _readsharedsourceconfig(lui, path) |
|
986 | 993 | lui.readconfig(os.path.join(path, b".hg", b"hgrc"), path) |
|
987 | 994 | lui.readconfig(os.path.join(path, b".hg", b"hgrc-not-shared"), path) |
|
988 | 995 | |
|
989 | 996 | return path, lui |
|
990 | 997 | |
|
991 | 998 | |
|
992 | 999 | def _checkshellalias(lui, ui, args): |
|
993 | 1000 | """Return the function to run the shell alias, if it is required""" |
|
994 | 1001 | options = {} |
|
995 | 1002 | |
|
996 | 1003 | try: |
|
997 | 1004 | args = fancyopts.fancyopts(args, commands.globalopts, options) |
|
998 | 1005 | except getopt.GetoptError: |
|
999 | 1006 | return |
|
1000 | 1007 | |
|
1001 | 1008 | if not args: |
|
1002 | 1009 | return |
|
1003 | 1010 | |
|
1004 | 1011 | cmdtable = commands.table |
|
1005 | 1012 | |
|
1006 | 1013 | cmd = args[0] |
|
1007 | 1014 | try: |
|
1008 | 1015 | strict = ui.configbool(b"ui", b"strict") |
|
1009 | 1016 | aliases, entry = cmdutil.findcmd(cmd, cmdtable, strict) |
|
1010 | 1017 | except (error.AmbiguousCommand, error.UnknownCommand): |
|
1011 | 1018 | return |
|
1012 | 1019 | |
|
1013 | 1020 | cmd = aliases[0] |
|
1014 | 1021 | fn = entry[0] |
|
1015 | 1022 | |
|
1016 | 1023 | if cmd and util.safehasattr(fn, b'shell'): |
|
1017 | 1024 | # shell alias shouldn't receive early options which are consumed by hg |
|
1018 | 1025 | _earlyopts, args = _earlysplitopts(args) |
|
1019 | 1026 | d = lambda: fn(ui, *args[1:]) |
|
1020 | 1027 | return lambda: runcommand( |
|
1021 | 1028 | lui, None, cmd, args[:1], ui, options, d, [], {} |
|
1022 | 1029 | ) |
|
1023 | 1030 | |
|
1024 | 1031 | |
|
1025 | 1032 | def _dispatch(req): |
|
1026 | 1033 | args = req.args |
|
1027 | 1034 | ui = req.ui |
|
1028 | 1035 | |
|
1029 | 1036 | # check for cwd |
|
1030 | 1037 | cwd = req.earlyoptions[b'cwd'] |
|
1031 | 1038 | if cwd: |
|
1032 | 1039 | os.chdir(cwd) |
|
1033 | 1040 | |
|
1034 | 1041 | rpath = req.earlyoptions[b'repository'] |
|
1035 | 1042 | path, lui = _getlocal(ui, rpath) |
|
1036 | 1043 | |
|
1037 | 1044 | uis = {ui, lui} |
|
1038 | 1045 | |
|
1039 | 1046 | if req.repo: |
|
1040 | 1047 | uis.add(req.repo.ui) |
|
1041 | 1048 | |
|
1042 | 1049 | if ( |
|
1043 | 1050 | req.earlyoptions[b'verbose'] |
|
1044 | 1051 | or req.earlyoptions[b'debug'] |
|
1045 | 1052 | or req.earlyoptions[b'quiet'] |
|
1046 | 1053 | ): |
|
1047 | 1054 | for opt in (b'verbose', b'debug', b'quiet'): |
|
1048 | 1055 | val = pycompat.bytestr(bool(req.earlyoptions[opt])) |
|
1049 | 1056 | for ui_ in uis: |
|
1050 | 1057 | ui_.setconfig(b'ui', opt, val, b'--' + opt) |
|
1051 | 1058 | |
|
1052 | 1059 | if req.earlyoptions[b'profile']: |
|
1053 | 1060 | for ui_ in uis: |
|
1054 | 1061 | ui_.setconfig(b'profiling', b'enabled', b'true', b'--profile') |
|
1055 | 1062 | |
|
1056 | 1063 | profile = lui.configbool(b'profiling', b'enabled') |
|
1057 | 1064 | with profiling.profile(lui, enabled=profile) as profiler: |
|
1058 | 1065 | # Configure extensions in phases: uisetup, extsetup, cmdtable, and |
|
1059 | 1066 | # reposetup |
|
1060 | 1067 | extensions.loadall(lui) |
|
1061 | 1068 | # Propagate any changes to lui.__class__ by extensions |
|
1062 | 1069 | ui.__class__ = lui.__class__ |
|
1063 | 1070 | |
|
1064 | 1071 | # (uisetup and extsetup are handled in extensions.loadall) |
|
1065 | 1072 | |
|
1066 | 1073 | # (reposetup is handled in hg.repository) |
|
1067 | 1074 | |
|
1068 | 1075 | addaliases(lui, commands.table) |
|
1069 | 1076 | |
|
1070 | 1077 | # All aliases and commands are completely defined, now. |
|
1071 | 1078 | # Check abbreviation/ambiguity of shell alias. |
|
1072 | 1079 | shellaliasfn = _checkshellalias(lui, ui, args) |
|
1073 | 1080 | if shellaliasfn: |
|
1074 | 1081 | # no additional configs will be set, set up the ui instances |
|
1075 | 1082 | for ui_ in uis: |
|
1076 | 1083 | extensions.populateui(ui_) |
|
1077 | 1084 | return shellaliasfn() |
|
1078 | 1085 | |
|
1079 | 1086 | # check for fallback encoding |
|
1080 | 1087 | fallback = lui.config(b'ui', b'fallbackencoding') |
|
1081 | 1088 | if fallback: |
|
1082 | 1089 | encoding.fallbackencoding = fallback |
|
1083 | 1090 | |
|
1084 | 1091 | fullargs = args |
|
1085 | 1092 | cmd, func, args, options, cmdoptions = _parse(lui, args) |
|
1086 | 1093 | |
|
1087 | 1094 | # store the canonical command name in request object for later access |
|
1088 | 1095 | req.canonical_command = cmd |
|
1089 | 1096 | |
|
1090 | 1097 | if options[b"config"] != req.earlyoptions[b"config"]: |
|
1091 | 1098 | raise error.InputError(_(b"option --config may not be abbreviated")) |
|
1092 | 1099 | if options[b"cwd"] != req.earlyoptions[b"cwd"]: |
|
1093 | 1100 | raise error.InputError(_(b"option --cwd may not be abbreviated")) |
|
1094 | 1101 | if options[b"repository"] != req.earlyoptions[b"repository"]: |
|
1095 | 1102 | raise error.InputError( |
|
1096 | 1103 | _( |
|
1097 | 1104 | b"option -R has to be separated from other options (e.g. not " |
|
1098 | 1105 | b"-qR) and --repository may only be abbreviated as --repo" |
|
1099 | 1106 | ) |
|
1100 | 1107 | ) |
|
1101 | 1108 | if options[b"debugger"] != req.earlyoptions[b"debugger"]: |
|
1102 | 1109 | raise error.InputError( |
|
1103 | 1110 | _(b"option --debugger may not be abbreviated") |
|
1104 | 1111 | ) |
|
1105 | 1112 | # don't validate --profile/--traceback, which can be enabled from now |
|
1106 | 1113 | |
|
1107 | 1114 | if options[b"encoding"]: |
|
1108 | 1115 | encoding.encoding = options[b"encoding"] |
|
1109 | 1116 | if options[b"encodingmode"]: |
|
1110 | 1117 | encoding.encodingmode = options[b"encodingmode"] |
|
1111 | 1118 | if options[b"time"]: |
|
1112 | 1119 | |
|
1113 | 1120 | def get_times(): |
|
1114 | 1121 | t = os.times() |
|
1115 | 1122 | if t[4] == 0.0: |
|
1116 | 1123 | # Windows leaves this as zero, so use time.perf_counter() |
|
1117 | 1124 | t = (t[0], t[1], t[2], t[3], util.timer()) |
|
1118 | 1125 | return t |
|
1119 | 1126 | |
|
1120 | 1127 | s = get_times() |
|
1121 | 1128 | |
|
1122 | 1129 | def print_time(): |
|
1123 | 1130 | t = get_times() |
|
1124 | 1131 | ui.warn( |
|
1125 | 1132 | _(b"time: real %.3f secs (user %.3f+%.3f sys %.3f+%.3f)\n") |
|
1126 | 1133 | % ( |
|
1127 | 1134 | t[4] - s[4], |
|
1128 | 1135 | t[0] - s[0], |
|
1129 | 1136 | t[2] - s[2], |
|
1130 | 1137 | t[1] - s[1], |
|
1131 | 1138 | t[3] - s[3], |
|
1132 | 1139 | ) |
|
1133 | 1140 | ) |
|
1134 | 1141 | |
|
1135 | 1142 | ui.atexit(print_time) |
|
1136 | 1143 | if options[b"profile"]: |
|
1137 | 1144 | profiler.start() |
|
1138 | 1145 | |
|
1139 | 1146 | # if abbreviated version of this were used, take them in account, now |
|
1140 | 1147 | if options[b'verbose'] or options[b'debug'] or options[b'quiet']: |
|
1141 | 1148 | for opt in (b'verbose', b'debug', b'quiet'): |
|
1142 | 1149 | if options[opt] == req.earlyoptions[opt]: |
|
1143 | 1150 | continue |
|
1144 | 1151 | val = pycompat.bytestr(bool(options[opt])) |
|
1145 | 1152 | for ui_ in uis: |
|
1146 | 1153 | ui_.setconfig(b'ui', opt, val, b'--' + opt) |
|
1147 | 1154 | |
|
1148 | 1155 | if options[b'traceback']: |
|
1149 | 1156 | for ui_ in uis: |
|
1150 | 1157 | ui_.setconfig(b'ui', b'traceback', b'on', b'--traceback') |
|
1151 | 1158 | |
|
1152 | 1159 | if options[b'noninteractive']: |
|
1153 | 1160 | for ui_ in uis: |
|
1154 | 1161 | ui_.setconfig(b'ui', b'interactive', b'off', b'-y') |
|
1155 | 1162 | |
|
1156 | 1163 | if cmdoptions.get(b'insecure', False): |
|
1157 | 1164 | for ui_ in uis: |
|
1158 | 1165 | ui_.insecureconnections = True |
|
1159 | 1166 | |
|
1160 | 1167 | # setup color handling before pager, because setting up pager |
|
1161 | 1168 | # might cause incorrect console information |
|
1162 | 1169 | coloropt = options[b'color'] |
|
1163 | 1170 | for ui_ in uis: |
|
1164 | 1171 | if coloropt: |
|
1165 | 1172 | ui_.setconfig(b'ui', b'color', coloropt, b'--color') |
|
1166 | 1173 | color.setup(ui_) |
|
1167 | 1174 | |
|
1168 | 1175 | if stringutil.parsebool(options[b'pager']): |
|
1169 | 1176 | # ui.pager() expects 'internal-always-' prefix in this case |
|
1170 | 1177 | ui.pager(b'internal-always-' + cmd) |
|
1171 | 1178 | elif options[b'pager'] != b'auto': |
|
1172 | 1179 | for ui_ in uis: |
|
1173 | 1180 | ui_.disablepager() |
|
1174 | 1181 | |
|
1175 | 1182 | # configs are fully loaded, set up the ui instances |
|
1176 | 1183 | for ui_ in uis: |
|
1177 | 1184 | extensions.populateui(ui_) |
|
1178 | 1185 | |
|
1179 | 1186 | if options[b'version']: |
|
1180 | 1187 | return commands.version_(ui) |
|
1181 | 1188 | if options[b'help']: |
|
1182 | 1189 | return commands.help_(ui, cmd, command=cmd is not None) |
|
1183 | 1190 | elif not cmd: |
|
1184 | 1191 | return commands.help_(ui, b'shortlist') |
|
1185 | 1192 | |
|
1186 | 1193 | repo = None |
|
1187 | 1194 | cmdpats = args[:] |
|
1188 | 1195 | assert func is not None # help out pytype |
|
1189 | 1196 | if not func.norepo: |
|
1190 | 1197 | # use the repo from the request only if we don't have -R |
|
1191 | 1198 | if not rpath and not cwd: |
|
1192 | 1199 | repo = req.repo |
|
1193 | 1200 | |
|
1194 | 1201 | if repo: |
|
1195 | 1202 | # set the descriptors of the repo ui to those of ui |
|
1196 | 1203 | repo.ui.fin = ui.fin |
|
1197 | 1204 | repo.ui.fout = ui.fout |
|
1198 | 1205 | repo.ui.ferr = ui.ferr |
|
1199 | 1206 | repo.ui.fmsg = ui.fmsg |
|
1200 | 1207 | else: |
|
1201 | 1208 | try: |
|
1202 | 1209 | repo = hg.repository( |
|
1203 | 1210 | ui, |
|
1204 | 1211 | path=path, |
|
1205 | 1212 | presetupfuncs=req.prereposetups, |
|
1206 | 1213 | intents=func.intents, |
|
1207 | 1214 | ) |
|
1208 | 1215 | if not repo.local(): |
|
1209 | 1216 | raise error.InputError( |
|
1210 | 1217 | _(b"repository '%s' is not local") % path |
|
1211 | 1218 | ) |
|
1212 | 1219 | repo.ui.setconfig( |
|
1213 | 1220 | b"bundle", b"mainreporoot", repo.root, b'repo' |
|
1214 | 1221 | ) |
|
1215 | 1222 | except error.RequirementError: |
|
1216 | 1223 | raise |
|
1217 | 1224 | except error.RepoError: |
|
1218 | 1225 | if rpath: # invalid -R path |
|
1219 | 1226 | raise |
|
1220 | 1227 | if not func.optionalrepo: |
|
1221 | 1228 | if func.inferrepo and args and not path: |
|
1222 | 1229 | # try to infer -R from command args |
|
1223 | 1230 | repos = pycompat.maplist(cmdutil.findrepo, args) |
|
1224 | 1231 | guess = repos[0] |
|
1225 | 1232 | if guess and repos.count(guess) == len(repos): |
|
1226 | 1233 | req.args = [b'--repository', guess] + fullargs |
|
1227 | 1234 | req.earlyoptions[b'repository'] = guess |
|
1228 | 1235 | return _dispatch(req) |
|
1229 | 1236 | if not path: |
|
1230 | 1237 | raise error.InputError( |
|
1231 | 1238 | _( |
|
1232 | 1239 | b"no repository found in" |
|
1233 | 1240 | b" '%s' (.hg not found)" |
|
1234 | 1241 | ) |
|
1235 | 1242 | % encoding.getcwd() |
|
1236 | 1243 | ) |
|
1237 | 1244 | raise |
|
1238 | 1245 | if repo: |
|
1239 | 1246 | ui = repo.ui |
|
1240 | 1247 | if options[b'hidden']: |
|
1241 | 1248 | repo = repo.unfiltered() |
|
1242 | 1249 | args.insert(0, repo) |
|
1243 | 1250 | elif rpath: |
|
1244 | 1251 | ui.warn(_(b"warning: --repository ignored\n")) |
|
1245 | 1252 | |
|
1246 | 1253 | msg = _formatargs(fullargs) |
|
1247 | 1254 | ui.log(b"command", b'%s\n', msg) |
|
1248 | 1255 | strcmdopt = pycompat.strkwargs(cmdoptions) |
|
1249 | 1256 | d = lambda: util.checksignature(func)(ui, *args, **strcmdopt) |
|
1250 | 1257 | try: |
|
1251 | 1258 | return runcommand( |
|
1252 | 1259 | lui, repo, cmd, fullargs, ui, options, d, cmdpats, cmdoptions |
|
1253 | 1260 | ) |
|
1254 | 1261 | finally: |
|
1255 | 1262 | if repo and repo != req.repo: |
|
1256 | 1263 | repo.close() |
|
1257 | 1264 | |
|
1258 | 1265 | |
|
1259 | 1266 | def _runcommand(ui, options, cmd, cmdfunc): |
|
1260 | 1267 | """Run a command function, possibly with profiling enabled.""" |
|
1261 | 1268 | try: |
|
1262 | 1269 | with tracing.log("Running %s command" % cmd): |
|
1263 | 1270 | return cmdfunc() |
|
1264 | 1271 | except error.SignatureError: |
|
1265 | 1272 | raise error.CommandError(cmd, _(b'invalid arguments')) |
|
1266 | 1273 | |
|
1267 | 1274 | |
|
1268 | 1275 | def _exceptionwarning(ui): |
|
1269 | 1276 | """Produce a warning message for the current active exception""" |
|
1270 | 1277 | |
|
1271 | 1278 | # For compatibility checking, we discard the portion of the hg |
|
1272 | 1279 | # version after the + on the assumption that if a "normal |
|
1273 | 1280 | # user" is running a build with a + in it the packager |
|
1274 | 1281 | # probably built from fairly close to a tag and anyone with a |
|
1275 | 1282 | # 'make local' copy of hg (where the version number can be out |
|
1276 | 1283 | # of date) will be clueful enough to notice the implausible |
|
1277 | 1284 | # version number and try updating. |
|
1278 | 1285 | ct = util.versiontuple(n=2) |
|
1279 | 1286 | worst = None, ct, b'', b'' |
|
1280 | 1287 | if ui.config(b'ui', b'supportcontact') is None: |
|
1281 | 1288 | for name, mod in extensions.extensions(): |
|
1282 | 1289 | # 'testedwith' should be bytes, but not all extensions are ported |
|
1283 | 1290 | # to py3 and we don't want UnicodeException because of that. |
|
1284 | 1291 | testedwith = stringutil.forcebytestr( |
|
1285 | 1292 | getattr(mod, 'testedwith', b'') |
|
1286 | 1293 | ) |
|
1287 | 1294 | version = extensions.moduleversion(mod) |
|
1288 | 1295 | report = getattr(mod, 'buglink', _(b'the extension author.')) |
|
1289 | 1296 | if not testedwith.strip(): |
|
1290 | 1297 | # We found an untested extension. It's likely the culprit. |
|
1291 | 1298 | worst = name, b'unknown', report, version |
|
1292 | 1299 | break |
|
1293 | 1300 | |
|
1294 | 1301 | # Never blame on extensions bundled with Mercurial. |
|
1295 | 1302 | if extensions.ismoduleinternal(mod): |
|
1296 | 1303 | continue |
|
1297 | 1304 | |
|
1298 | 1305 | tested = [util.versiontuple(t, 2) for t in testedwith.split()] |
|
1299 | 1306 | if ct in tested: |
|
1300 | 1307 | continue |
|
1301 | 1308 | |
|
1302 | 1309 | lower = [t for t in tested if t < ct] |
|
1303 | 1310 | nearest = max(lower or tested) |
|
1304 | 1311 | if worst[0] is None or nearest < worst[1]: |
|
1305 | 1312 | worst = name, nearest, report, version |
|
1306 | 1313 | if worst[0] is not None: |
|
1307 | 1314 | name, testedwith, report, version = worst |
|
1308 | 1315 | if not isinstance(testedwith, (bytes, str)): |
|
1309 | 1316 | testedwith = b'.'.join( |
|
1310 | 1317 | [stringutil.forcebytestr(c) for c in testedwith] |
|
1311 | 1318 | ) |
|
1312 | 1319 | extver = version or _(b"(version N/A)") |
|
1313 | 1320 | warning = _( |
|
1314 | 1321 | b'** Unknown exception encountered with ' |
|
1315 | 1322 | b'possibly-broken third-party extension "%s" %s\n' |
|
1316 | 1323 | b'** which supports versions %s of Mercurial.\n' |
|
1317 | 1324 | b'** Please disable "%s" and try your action again.\n' |
|
1318 | 1325 | b'** If that fixes the bug please report it to %s\n' |
|
1319 | 1326 | ) % (name, extver, testedwith, name, stringutil.forcebytestr(report)) |
|
1320 | 1327 | else: |
|
1321 | 1328 | bugtracker = ui.config(b'ui', b'supportcontact') |
|
1322 | 1329 | if bugtracker is None: |
|
1323 | 1330 | bugtracker = _(b"https://mercurial-scm.org/wiki/BugTracker") |
|
1324 | 1331 | warning = ( |
|
1325 | 1332 | _( |
|
1326 | 1333 | b"** unknown exception encountered, " |
|
1327 | 1334 | b"please report by visiting\n** " |
|
1328 | 1335 | ) |
|
1329 | 1336 | + bugtracker |
|
1330 | 1337 | + b'\n' |
|
1331 | 1338 | ) |
|
1332 | 1339 | sysversion = pycompat.sysbytes(sys.version).replace(b'\n', b'') |
|
1333 | 1340 | |
|
1334 | 1341 | def ext_with_ver(x): |
|
1335 | 1342 | ext = x[0] |
|
1336 | 1343 | ver = extensions.moduleversion(x[1]) |
|
1337 | 1344 | if ver: |
|
1338 | 1345 | ext += b' ' + ver |
|
1339 | 1346 | return ext |
|
1340 | 1347 | |
|
1341 | 1348 | warning += ( |
|
1342 | 1349 | (_(b"** Python %s\n") % sysversion) |
|
1343 | 1350 | + (_(b"** Mercurial Distributed SCM (version %s)\n") % util.version()) |
|
1344 | 1351 | + ( |
|
1345 | 1352 | _(b"** Extensions loaded: %s\n") |
|
1346 | 1353 | % b", ".join( |
|
1347 | 1354 | [ext_with_ver(x) for x in sorted(extensions.extensions())] |
|
1348 | 1355 | ) |
|
1349 | 1356 | ) |
|
1350 | 1357 | ) |
|
1351 | 1358 | return warning |
|
1352 | 1359 | |
|
1353 | 1360 | |
|
1354 | 1361 | def handlecommandexception(ui): |
|
1355 | 1362 | """Produce a warning message for broken commands |
|
1356 | 1363 | |
|
1357 | 1364 | Called when handling an exception; the exception is reraised if |
|
1358 | 1365 | this function returns False, ignored otherwise. |
|
1359 | 1366 | """ |
|
1360 | 1367 | warning = _exceptionwarning(ui) |
|
1361 | 1368 | ui.log( |
|
1362 | 1369 | b"commandexception", |
|
1363 | 1370 | b"%s\n%s\n", |
|
1364 | 1371 | warning, |
|
1365 | 1372 | pycompat.sysbytes(traceback.format_exc()), |
|
1366 | 1373 | ) |
|
1367 | 1374 | ui.warn(warning) |
|
1368 | 1375 | return False # re-raise the exception |
@@ -1,722 +1,722 b'' | |||
|
1 | 1 | $ HGFOO=BAR; export HGFOO |
|
2 | 2 | $ cat >> $HGRCPATH <<EOF |
|
3 | 3 | > [alias] |
|
4 | 4 | > # should clobber ci but not commit (issue2993) |
|
5 | 5 | > ci = version |
|
6 | 6 | > myinit = init |
|
7 | 7 | > myinit:doc = This is my documented alias for init. |
|
8 | 8 | > myinit:help = [OPTIONS] [BLA] [BLE] |
|
9 | 9 | > mycommit = commit |
|
10 | 10 | > mycommit:doc = This is my alias with only doc. |
|
11 | 11 | > optionalrepo = showconfig alias.myinit |
|
12 | 12 | > cleanstatus = status -c |
|
13 | 13 | > cleanstatus:help = [ONLYHELPHERE] |
|
14 | 14 | > unknown = bargle |
|
15 | 15 | > ambiguous = s |
|
16 | 16 | > recursive = recursive |
|
17 | 17 | > disabled = email |
|
18 | 18 | > nodefinition = |
|
19 | 19 | > noclosingquotation = ' |
|
20 | 20 | > no--cwd = status --cwd elsewhere |
|
21 | 21 | > no-R = status -R elsewhere |
|
22 | 22 | > no--repo = status --repo elsewhere |
|
23 | 23 | > no--repository = status --repository elsewhere |
|
24 | 24 | > no--config = status --config a.config=1 |
|
25 | 25 | > mylog = log |
|
26 | 26 | > lognull = log -r null |
|
27 | 27 | > lognull:doc = Logs the null rev |
|
28 | 28 | > lognull:help = foo bar baz |
|
29 | 29 | > shortlog = log --template '{rev} {node|short} | {date|isodate}\n' |
|
30 | 30 | > positional = log --template '{\$2} {\$1} | {date|isodate}\n' |
|
31 | 31 | > dln = lognull --debug |
|
32 | 32 | > recursivedoc = dln |
|
33 | 33 | > recursivedoc:doc = Logs the null rev in debug mode |
|
34 | 34 | > nousage = rollback |
|
35 | 35 | > put = export -r 0 -o "\$FOO/%R.diff" |
|
36 | 36 | > blank = !printf '\n' |
|
37 | 37 | > self = !printf '\$0\n' |
|
38 | 38 | > echoall = !printf '\$@\n' |
|
39 | 39 | > echo1 = !printf '\$1\n' |
|
40 | 40 | > echo2 = !printf '\$2\n' |
|
41 | 41 | > echo13 = !printf '\$1 \$3\n' |
|
42 | 42 | > echotokens = !printf "%s\n" "\$@" |
|
43 | 43 | > count = !hg log -r "\$@" --template=. | wc -c | sed -e 's/ //g' |
|
44 | 44 | > mcount = !hg log \$@ --template=. | wc -c | sed -e 's/ //g' |
|
45 | 45 | > rt = root |
|
46 | 46 | > tglog = log -G --template "{rev}:{node|short}: '{desc}' {branches}\n" |
|
47 | 47 | > idalias = id |
|
48 | 48 | > idaliaslong = id |
|
49 | 49 | > idaliasshell = !echo test |
|
50 | 50 | > parentsshell1 = !echo one |
|
51 | 51 | > parentsshell2 = !echo two |
|
52 | 52 | > escaped1 = !printf 'test\$\$test\n' |
|
53 | 53 | > escaped2 = !sh -c 'echo "HGFOO is \$\$HGFOO"' |
|
54 | 54 | > escaped3 = !sh -c 'echo "\$1 is \$\$\$1"' |
|
55 | 55 | > escaped4 = !printf '\$\$0 \$\$@\n' |
|
56 | 56 | > exit1 = !sh -c 'exit 1' |
|
57 | 57 | > |
|
58 | 58 | > [defaults] |
|
59 | 59 | > mylog = -q |
|
60 | 60 | > lognull = -q |
|
61 | 61 | > log = -v |
|
62 | 62 | > EOF |
|
63 | 63 | |
|
64 | 64 | basic |
|
65 | 65 | |
|
66 | 66 | $ hg myinit alias |
|
67 | 67 | |
|
68 | 68 | help |
|
69 | 69 | |
|
70 | 70 | $ hg help -c | grep myinit |
|
71 | 71 | myinit This is my documented alias for init. |
|
72 | 72 | $ hg help -c | grep mycommit |
|
73 | 73 | mycommit This is my alias with only doc. |
|
74 | 74 | $ hg help -c | grep cleanstatus |
|
75 | 75 | [1] |
|
76 | 76 | $ hg help -c | grep lognull |
|
77 | 77 | lognull Logs the null rev |
|
78 | 78 | $ hg help -c | grep dln |
|
79 | 79 | [1] |
|
80 | 80 | $ hg help -c | grep recursivedoc |
|
81 | 81 | recursivedoc Logs the null rev in debug mode |
|
82 | 82 | $ hg help myinit |
|
83 | 83 | hg myinit [OPTIONS] [BLA] [BLE] |
|
84 | 84 | |
|
85 | 85 | alias for: hg init |
|
86 | 86 | |
|
87 | 87 | This is my documented alias for init. |
|
88 | 88 | |
|
89 | 89 | defined by: * (glob) |
|
90 | 90 | */* (glob) (?) |
|
91 | 91 | */* (glob) (?) |
|
92 | 92 | */* (glob) (?) |
|
93 | 93 | |
|
94 | 94 | options: |
|
95 | 95 | |
|
96 | 96 | -e --ssh CMD specify ssh command to use |
|
97 | 97 | --remotecmd CMD specify hg command to run on the remote side |
|
98 | 98 | --insecure do not verify server certificate (ignoring web.cacerts |
|
99 | 99 | config) |
|
100 | 100 | |
|
101 | 101 | (some details hidden, use --verbose to show complete help) |
|
102 | 102 | |
|
103 | 103 | $ hg help mycommit |
|
104 | 104 | hg mycommit [OPTION]... [FILE]... |
|
105 | 105 | |
|
106 | 106 | alias for: hg commit |
|
107 | 107 | |
|
108 | 108 | This is my alias with only doc. |
|
109 | 109 | |
|
110 | 110 | defined by: * (glob) |
|
111 | 111 | */* (glob) (?) |
|
112 | 112 | */* (glob) (?) |
|
113 | 113 | */* (glob) (?) |
|
114 | 114 | |
|
115 | 115 | options ([+] can be repeated): |
|
116 | 116 | |
|
117 | 117 | -A --addremove mark new/missing files as added/removed before |
|
118 | 118 | committing |
|
119 | 119 | --close-branch mark a branch head as closed |
|
120 | 120 | --amend amend the parent of the working directory |
|
121 | 121 | -s --secret use the secret phase for committing |
|
122 | 122 | -e --edit invoke editor on commit messages |
|
123 | 123 | -i --interactive use interactive mode |
|
124 | 124 | -I --include PATTERN [+] include names matching the given patterns |
|
125 | 125 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
126 | 126 | -m --message TEXT use text as commit message |
|
127 | 127 | -l --logfile FILE read commit message from file |
|
128 | 128 | -d --date DATE record the specified date as commit date |
|
129 | 129 | -u --user USER record the specified user as committer |
|
130 | 130 | -S --subrepos recurse into subrepositories |
|
131 | 131 | |
|
132 | 132 | (some details hidden, use --verbose to show complete help) |
|
133 | 133 | |
|
134 | 134 | $ hg help cleanstatus |
|
135 | 135 | hg cleanstatus [ONLYHELPHERE] |
|
136 | 136 | |
|
137 | 137 | alias for: hg status -c |
|
138 | 138 | |
|
139 | 139 | show changed files in the working directory |
|
140 | 140 | |
|
141 | 141 | Show status of files in the repository. If names are given, only files |
|
142 | 142 | that match are shown. Files that are clean or ignored or the source of a |
|
143 | 143 | copy/move operation, are not listed unless -c/--clean, -i/--ignored, |
|
144 | 144 | -C/--copies or -A/--all are given. Unless options described with "show |
|
145 | 145 | only ..." are given, the options -mardu are used. |
|
146 | 146 | |
|
147 | 147 | Option -q/--quiet hides untracked (unknown and ignored) files unless |
|
148 | 148 | explicitly requested with -u/--unknown or -i/--ignored. |
|
149 | 149 | |
|
150 | 150 | Note: |
|
151 | 151 | 'hg status' may appear to disagree with diff if permissions have |
|
152 | 152 | changed or a merge has occurred. The standard diff format does not |
|
153 | 153 | report permission changes and diff only reports changes relative to one |
|
154 | 154 | merge parent. |
|
155 | 155 | |
|
156 | 156 | If one revision is given, it is used as the base revision. If two |
|
157 | 157 | revisions are given, the differences between them are shown. The --change |
|
158 | 158 | option can also be used as a shortcut to list the changed files of a |
|
159 | 159 | revision from its first parent. |
|
160 | 160 | |
|
161 | 161 | The codes used to show the status of files are: |
|
162 | 162 | |
|
163 | 163 | M = modified |
|
164 | 164 | A = added |
|
165 | 165 | R = removed |
|
166 | 166 | C = clean |
|
167 | 167 | ! = missing (deleted by non-hg command, but still tracked) |
|
168 | 168 | ? = not tracked |
|
169 | 169 | I = ignored |
|
170 | 170 | = origin of the previous file (with --copies) |
|
171 | 171 | |
|
172 | 172 | Returns 0 on success. |
|
173 | 173 | |
|
174 | 174 | defined by: * (glob) |
|
175 | 175 | */* (glob) (?) |
|
176 | 176 | */* (glob) (?) |
|
177 | 177 | */* (glob) (?) |
|
178 | 178 | |
|
179 | 179 | options ([+] can be repeated): |
|
180 | 180 | |
|
181 | 181 | -A --all show status of all files |
|
182 | 182 | -m --modified show only modified files |
|
183 | 183 | -a --added show only added files |
|
184 | 184 | -r --removed show only removed files |
|
185 | 185 | -d --deleted show only missing files |
|
186 | 186 | -c --clean show only files without changes |
|
187 | 187 | -u --unknown show only unknown (not tracked) files |
|
188 | 188 | -i --ignored show only ignored files |
|
189 | 189 | -n --no-status hide status prefix |
|
190 | 190 | -C --copies show source of copied files |
|
191 | 191 | -0 --print0 end filenames with NUL, for use with xargs |
|
192 | 192 | --rev REV [+] show difference from revision |
|
193 | 193 | --change REV list the changed files of a revision |
|
194 | 194 | -I --include PATTERN [+] include names matching the given patterns |
|
195 | 195 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
196 | 196 | -S --subrepos recurse into subrepositories |
|
197 | 197 | -T --template TEMPLATE display with template |
|
198 | 198 | |
|
199 | 199 | (some details hidden, use --verbose to show complete help) |
|
200 | 200 | |
|
201 | 201 | $ hg help recursivedoc | head -n 5 |
|
202 | 202 | hg recursivedoc foo bar baz |
|
203 | 203 | |
|
204 | 204 | alias for: hg dln |
|
205 | 205 | |
|
206 | 206 | Logs the null rev in debug mode |
|
207 | 207 | |
|
208 | 208 | unknown |
|
209 | 209 | |
|
210 | 210 | $ hg unknown |
|
211 | 211 | config error: alias 'unknown' resolves to unknown command 'bargle' |
|
212 | 212 | [30] |
|
213 | 213 | $ hg help unknown |
|
214 | 214 | alias 'unknown' resolves to unknown command 'bargle' |
|
215 | 215 | |
|
216 | 216 | |
|
217 | 217 | ambiguous |
|
218 | 218 | |
|
219 | 219 | $ hg ambiguous |
|
220 | 220 | config error: alias 'ambiguous' resolves to ambiguous command 's' |
|
221 | 221 | [30] |
|
222 | 222 | $ hg help ambiguous |
|
223 | 223 | alias 'ambiguous' resolves to ambiguous command 's' |
|
224 | 224 | |
|
225 | 225 | |
|
226 | 226 | recursive |
|
227 | 227 | |
|
228 | 228 | $ hg recursive |
|
229 | 229 | config error: alias 'recursive' resolves to unknown command 'recursive' |
|
230 | 230 | [30] |
|
231 | 231 | $ hg help recursive |
|
232 | 232 | alias 'recursive' resolves to unknown command 'recursive' |
|
233 | 233 | |
|
234 | 234 | |
|
235 | 235 | disabled |
|
236 | 236 | |
|
237 | 237 | $ hg disabled |
|
238 | 238 | config error: alias 'disabled' resolves to unknown command 'email' |
|
239 | 239 | ('email' is provided by 'patchbomb' extension) |
|
240 | 240 | [30] |
|
241 | 241 | $ hg help disabled |
|
242 | 242 | alias 'disabled' resolves to unknown command 'email' |
|
243 | 243 | |
|
244 | 244 | 'email' is provided by the following extension: |
|
245 | 245 | |
|
246 | 246 | patchbomb command to send changesets as (a series of) patch emails |
|
247 | 247 | |
|
248 | 248 | (use 'hg help extensions' for information on enabling extensions) |
|
249 | 249 | |
|
250 | 250 | |
|
251 | 251 | no definition |
|
252 | 252 | |
|
253 | 253 | $ hg nodef |
|
254 | 254 | config error: no definition for alias 'nodefinition' |
|
255 | 255 | [30] |
|
256 | 256 | $ hg help nodef |
|
257 | 257 | no definition for alias 'nodefinition' |
|
258 | 258 | |
|
259 | 259 | |
|
260 | 260 | no closing quotation |
|
261 | 261 | |
|
262 | 262 | $ hg noclosing |
|
263 | 263 | config error: error in definition for alias 'noclosingquotation': No closing quotation |
|
264 | 264 | [30] |
|
265 | 265 | $ hg help noclosing |
|
266 | 266 | error in definition for alias 'noclosingquotation': No closing quotation |
|
267 | 267 | |
|
268 | 268 | "--" in alias definition should be preserved |
|
269 | 269 | |
|
270 | 270 | $ hg --config alias.dash='cat --' -R alias dash -r0 |
|
271 | 271 | abort: -r0 not under root '$TESTTMP/alias' |
|
272 | 272 | (consider using '--cwd alias') |
|
273 | 273 | [255] |
|
274 | 274 | |
|
275 | 275 | invalid options |
|
276 | 276 | |
|
277 | 277 | $ hg no--cwd |
|
278 | 278 | config error: error in definition for alias 'no--cwd': --cwd may only be given on the command line |
|
279 | 279 | [30] |
|
280 | 280 | $ hg help no--cwd |
|
281 | 281 | error in definition for alias 'no--cwd': --cwd may only be given on the |
|
282 | 282 | command line |
|
283 | 283 | $ hg no-R |
|
284 | 284 | config error: error in definition for alias 'no-R': -R may only be given on the command line |
|
285 | 285 | [30] |
|
286 | 286 | $ hg help no-R |
|
287 | 287 | error in definition for alias 'no-R': -R may only be given on the command line |
|
288 | 288 | $ hg no--repo |
|
289 | 289 | config error: error in definition for alias 'no--repo': --repo may only be given on the command line |
|
290 | 290 | [30] |
|
291 | 291 | $ hg help no--repo |
|
292 | 292 | error in definition for alias 'no--repo': --repo may only be given on the |
|
293 | 293 | command line |
|
294 | 294 | $ hg no--repository |
|
295 | 295 | config error: error in definition for alias 'no--repository': --repository may only be given on the command line |
|
296 | 296 | [30] |
|
297 | 297 | $ hg help no--repository |
|
298 | 298 | error in definition for alias 'no--repository': --repository may only be given |
|
299 | 299 | on the command line |
|
300 | 300 | $ hg no--config |
|
301 | 301 | config error: error in definition for alias 'no--config': --config may only be given on the command line |
|
302 | 302 | [30] |
|
303 | 303 | $ hg no --config alias.no='--repo elsewhere --cwd elsewhere status' |
|
304 | 304 | config error: error in definition for alias 'no': --repo/--cwd may only be given on the command line |
|
305 | 305 | [30] |
|
306 | 306 | $ hg no --config alias.no='--repo elsewhere' |
|
307 | 307 | config error: error in definition for alias 'no': --repo may only be given on the command line |
|
308 | 308 | [30] |
|
309 | 309 | |
|
310 | 310 | optional repository |
|
311 | 311 | |
|
312 | 312 | #if no-outer-repo |
|
313 | 313 | $ hg optionalrepo |
|
314 | 314 | init |
|
315 | 315 | #endif |
|
316 | 316 | $ cd alias |
|
317 | 317 | $ cat > .hg/hgrc <<EOF |
|
318 | 318 | > [alias] |
|
319 | 319 | > myinit = init -q |
|
320 | 320 | > EOF |
|
321 | 321 | $ hg optionalrepo |
|
322 | 322 | init -q |
|
323 | 323 | |
|
324 | 324 | no usage |
|
325 | 325 | |
|
326 | 326 | $ hg nousage |
|
327 | 327 | no rollback information available |
|
328 | 328 | [1] |
|
329 | 329 | |
|
330 | 330 | $ echo foo > foo |
|
331 | 331 | $ hg commit -Amfoo |
|
332 | 332 | adding foo |
|
333 | 333 | |
|
334 | 334 | infer repository |
|
335 | 335 | |
|
336 | 336 | $ cd .. |
|
337 | 337 | |
|
338 | 338 | #if no-outer-repo |
|
339 | 339 | $ hg shortlog alias/foo |
|
340 | 340 | 0 e63c23eaa88a | 1970-01-01 00:00 +0000 |
|
341 | 341 | #endif |
|
342 | 342 | |
|
343 | 343 | $ cd alias |
|
344 | 344 | |
|
345 | 345 | with opts |
|
346 | 346 | |
|
347 | 347 | $ hg cleanst |
|
348 | 348 | C foo |
|
349 | 349 | |
|
350 | 350 | |
|
351 | 351 | with opts and whitespace |
|
352 | 352 | |
|
353 | 353 | $ hg shortlog |
|
354 | 354 | 0 e63c23eaa88a | 1970-01-01 00:00 +0000 |
|
355 | 355 | |
|
356 | 356 | positional arguments |
|
357 | 357 | |
|
358 | 358 | $ hg positional |
|
359 | 359 | abort: too few arguments for command alias |
|
360 | 360 | [10] |
|
361 | 361 | $ hg positional a |
|
362 | 362 | abort: too few arguments for command alias |
|
363 | 363 | [10] |
|
364 | 364 | $ hg positional 'node|short' rev |
|
365 | 365 | 0 e63c23eaa88a | 1970-01-01 00:00 +0000 |
|
366 | 366 | |
|
367 | 367 | interaction with defaults |
|
368 | 368 | |
|
369 | 369 | $ hg mylog |
|
370 | 370 | 0:e63c23eaa88a |
|
371 | 371 | $ hg lognull |
|
372 | 372 | -1:000000000000 |
|
373 | 373 | |
|
374 | 374 | |
|
375 | 375 | properly recursive |
|
376 | 376 | |
|
377 | 377 | $ hg dln |
|
378 | 378 | changeset: -1:0000000000000000000000000000000000000000 |
|
379 | 379 | phase: public |
|
380 | 380 | parent: -1:0000000000000000000000000000000000000000 |
|
381 | 381 | parent: -1:0000000000000000000000000000000000000000 |
|
382 | 382 | manifest: -1:0000000000000000000000000000000000000000 |
|
383 | 383 | user: |
|
384 | 384 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
385 | 385 | extra: branch=default |
|
386 | 386 | |
|
387 | 387 | |
|
388 | 388 | |
|
389 | 389 | path expanding |
|
390 | 390 | |
|
391 | 391 | $ FOO=`pwd` hg put |
|
392 | 392 | $ cat 0.diff |
|
393 | 393 | # HG changeset patch |
|
394 | 394 | # User test |
|
395 | 395 | # Date 0 0 |
|
396 | 396 | # Thu Jan 01 00:00:00 1970 +0000 |
|
397 | 397 | # Node ID e63c23eaa88ae77967edcf4ea194d31167c478b0 |
|
398 | 398 | # Parent 0000000000000000000000000000000000000000 |
|
399 | 399 | foo |
|
400 | 400 | |
|
401 | 401 | diff -r 000000000000 -r e63c23eaa88a foo |
|
402 | 402 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
403 | 403 | +++ b/foo Thu Jan 01 00:00:00 1970 +0000 |
|
404 | 404 | @@ -0,0 +1,1 @@ |
|
405 | 405 | +foo |
|
406 | 406 | |
|
407 | 407 | |
|
408 | 408 | simple shell aliases |
|
409 | 409 | |
|
410 | 410 | $ hg blank |
|
411 | 411 | |
|
412 | 412 | $ hg blank foo |
|
413 | 413 | |
|
414 | 414 | $ hg self |
|
415 | 415 | self |
|
416 | 416 | $ hg echoall |
|
417 | 417 | |
|
418 | 418 | $ hg echoall foo |
|
419 | 419 | foo |
|
420 | 420 | $ hg echoall 'test $2' foo |
|
421 | 421 | test $2 foo |
|
422 | 422 | $ hg echoall 'test $@' foo '$@' |
|
423 | 423 | test $@ foo $@ |
|
424 | 424 | $ hg echoall 'test "$@"' foo '"$@"' |
|
425 | 425 | test "$@" foo "$@" |
|
426 | 426 | $ hg echo1 foo bar baz |
|
427 | 427 | foo |
|
428 | 428 | $ hg echo2 foo bar baz |
|
429 | 429 | bar |
|
430 | 430 | $ hg echo13 foo bar baz test |
|
431 | 431 | foo baz |
|
432 | 432 | $ hg echo2 foo |
|
433 | 433 | |
|
434 | 434 | $ hg echotokens |
|
435 | 435 | |
|
436 | 436 | $ hg echotokens foo 'bar $1 baz' |
|
437 | 437 | foo |
|
438 | 438 | bar $1 baz |
|
439 | 439 | $ hg echotokens 'test $2' foo |
|
440 | 440 | test $2 |
|
441 | 441 | foo |
|
442 | 442 | $ hg echotokens 'test $@' foo '$@' |
|
443 | 443 | test $@ |
|
444 | 444 | foo |
|
445 | 445 | $@ |
|
446 | 446 | $ hg echotokens 'test "$@"' foo '"$@"' |
|
447 | 447 | test "$@" |
|
448 | 448 | foo |
|
449 | 449 | "$@" |
|
450 | 450 | $ echo bar > bar |
|
451 | 451 | $ hg commit -qA -m bar |
|
452 | 452 | $ hg count . |
|
453 | 453 | 1 |
|
454 | 454 | $ hg count 'branch(default)' |
|
455 | 455 | 2 |
|
456 | 456 | $ hg mcount -r '"branch(default)"' |
|
457 | 457 | 2 |
|
458 | 458 | |
|
459 | 459 | $ hg tglog |
|
460 | 460 | @ 1:042423737847: 'bar' |
|
461 | 461 | | |
|
462 | 462 | o 0:e63c23eaa88a: 'foo' |
|
463 | 463 | |
|
464 | 464 | |
|
465 | 465 | |
|
466 | 466 | shadowing |
|
467 | 467 | |
|
468 | 468 | $ hg i |
|
469 | 469 | hg: command 'i' is ambiguous: |
|
470 | 470 | idalias idaliaslong idaliasshell identify import incoming init |
|
471 |
[ |
|
|
471 | [10] | |
|
472 | 472 | $ hg id |
|
473 | 473 | 042423737847 tip |
|
474 | 474 | $ hg ida |
|
475 | 475 | hg: command 'ida' is ambiguous: |
|
476 | 476 | idalias idaliaslong idaliasshell |
|
477 |
[ |
|
|
477 | [10] | |
|
478 | 478 | $ hg idalias |
|
479 | 479 | 042423737847 tip |
|
480 | 480 | $ hg idaliasl |
|
481 | 481 | 042423737847 tip |
|
482 | 482 | $ hg idaliass |
|
483 | 483 | test |
|
484 | 484 | $ hg parentsshell |
|
485 | 485 | hg: command 'parentsshell' is ambiguous: |
|
486 | 486 | parentsshell1 parentsshell2 |
|
487 |
[ |
|
|
487 | [10] | |
|
488 | 488 | $ hg parentsshell1 |
|
489 | 489 | one |
|
490 | 490 | $ hg parentsshell2 |
|
491 | 491 | two |
|
492 | 492 | |
|
493 | 493 | |
|
494 | 494 | shell aliases with global options |
|
495 | 495 | |
|
496 | 496 | $ hg init sub |
|
497 | 497 | $ cd sub |
|
498 | 498 | $ hg count 'branch(default)' |
|
499 | 499 | abort: unknown revision 'default' |
|
500 | 500 | 0 |
|
501 | 501 | $ hg -v count 'branch(default)' |
|
502 | 502 | abort: unknown revision 'default' |
|
503 | 503 | 0 |
|
504 | 504 | $ hg -R .. count 'branch(default)' |
|
505 | 505 | abort: unknown revision 'default' |
|
506 | 506 | 0 |
|
507 | 507 | $ hg --cwd .. count 'branch(default)' |
|
508 | 508 | 2 |
|
509 | 509 | $ hg echoall --cwd .. |
|
510 | 510 | |
|
511 | 511 | |
|
512 | 512 | "--" passed to shell alias should be preserved |
|
513 | 513 | |
|
514 | 514 | $ hg --config alias.printf='!printf "$@"' printf '%s %s %s\n' -- --cwd .. |
|
515 | 515 | -- --cwd .. |
|
516 | 516 | |
|
517 | 517 | repo specific shell aliases |
|
518 | 518 | |
|
519 | 519 | $ cat >> .hg/hgrc <<EOF |
|
520 | 520 | > [alias] |
|
521 | 521 | > subalias = !echo sub |
|
522 | 522 | > EOF |
|
523 | 523 | $ cat >> ../.hg/hgrc <<EOF |
|
524 | 524 | > [alias] |
|
525 | 525 | > mainalias = !echo main |
|
526 | 526 | > EOF |
|
527 | 527 | |
|
528 | 528 | |
|
529 | 529 | shell alias defined in current repo |
|
530 | 530 | |
|
531 | 531 | $ hg subalias |
|
532 | 532 | sub |
|
533 | 533 | $ hg --cwd .. subalias > /dev/null |
|
534 | 534 | hg: unknown command 'subalias' |
|
535 | 535 | (did you mean idalias?) |
|
536 |
[ |
|
|
536 | [10] | |
|
537 | 537 | $ hg -R .. subalias > /dev/null |
|
538 | 538 | hg: unknown command 'subalias' |
|
539 | 539 | (did you mean idalias?) |
|
540 |
[ |
|
|
540 | [10] | |
|
541 | 541 | |
|
542 | 542 | |
|
543 | 543 | shell alias defined in other repo |
|
544 | 544 | |
|
545 | 545 | $ hg mainalias > /dev/null |
|
546 | 546 | hg: unknown command 'mainalias' |
|
547 | 547 | (did you mean idalias?) |
|
548 |
[ |
|
|
548 | [10] | |
|
549 | 549 | $ hg -R .. mainalias |
|
550 | 550 | main |
|
551 | 551 | $ hg --cwd .. mainalias |
|
552 | 552 | main |
|
553 | 553 | |
|
554 | 554 | typos get useful suggestions |
|
555 | 555 | $ hg --cwd .. manalias |
|
556 | 556 | hg: unknown command 'manalias' |
|
557 | 557 | (did you mean one of idalias, mainalias, manifest?) |
|
558 |
[ |
|
|
558 | [10] | |
|
559 | 559 | |
|
560 | 560 | shell aliases with escaped $ chars |
|
561 | 561 | |
|
562 | 562 | $ hg escaped1 |
|
563 | 563 | test$test |
|
564 | 564 | $ hg escaped2 |
|
565 | 565 | HGFOO is BAR |
|
566 | 566 | $ hg escaped3 HGFOO |
|
567 | 567 | HGFOO is BAR |
|
568 | 568 | $ hg escaped4 test |
|
569 | 569 | $0 $@ |
|
570 | 570 | |
|
571 | 571 | abbreviated name, which matches against both shell alias and the |
|
572 | 572 | command provided extension, should be aborted. |
|
573 | 573 | |
|
574 | 574 | $ cat >> .hg/hgrc <<EOF |
|
575 | 575 | > [extensions] |
|
576 | 576 | > hgext.rebase = |
|
577 | 577 | > EOF |
|
578 | 578 | #if windows |
|
579 | 579 | $ cat >> .hg/hgrc <<EOF |
|
580 | 580 | > [alias] |
|
581 | 581 | > rebate = !echo this is %HG_ARGS% |
|
582 | 582 | > EOF |
|
583 | 583 | #else |
|
584 | 584 | $ cat >> .hg/hgrc <<EOF |
|
585 | 585 | > [alias] |
|
586 | 586 | > rebate = !echo this is \$HG_ARGS |
|
587 | 587 | > EOF |
|
588 | 588 | #endif |
|
589 | 589 | $ cat >> .hg/hgrc <<EOF |
|
590 | 590 | > rebate:doc = This is my alias which just prints something. |
|
591 | 591 | > rebate:help = [MYARGS] |
|
592 | 592 | > EOF |
|
593 | 593 | $ hg reba |
|
594 | 594 | hg: command 'reba' is ambiguous: |
|
595 | 595 | rebase rebate |
|
596 |
[ |
|
|
596 | [10] | |
|
597 | 597 | $ hg rebat |
|
598 | 598 | this is rebate |
|
599 | 599 | $ hg rebat --foo-bar |
|
600 | 600 | this is rebate --foo-bar |
|
601 | 601 | |
|
602 | 602 | help for a shell alias |
|
603 | 603 | |
|
604 | 604 | $ hg help -c | grep rebate |
|
605 | 605 | rebate This is my alias which just prints something. |
|
606 | 606 | $ hg help rebate |
|
607 | 607 | hg rebate [MYARGS] |
|
608 | 608 | |
|
609 | 609 | shell alias for: echo this is %HG_ARGS% (windows !) |
|
610 | 610 | shell alias for: echo this is $HG_ARGS (no-windows !) |
|
611 | 611 | |
|
612 | 612 | This is my alias which just prints something. |
|
613 | 613 | |
|
614 | 614 | defined by:* (glob) |
|
615 | 615 | */* (glob) (?) |
|
616 | 616 | */* (glob) (?) |
|
617 | 617 | */* (glob) (?) |
|
618 | 618 | |
|
619 | 619 | (some details hidden, use --verbose to show complete help) |
|
620 | 620 | |
|
621 | 621 | invalid character in user-specified help |
|
622 | 622 | |
|
623 | 623 | >>> with open('.hg/hgrc', 'ab') as f: |
|
624 | 624 | ... f.write(b'[alias]\n' |
|
625 | 625 | ... b'invaliddoc = log\n' |
|
626 | 626 | ... b'invaliddoc:doc = \xc3\xa9\n' |
|
627 | 627 | ... b'invalidhelp = log\n' |
|
628 | 628 | ... b'invalidhelp:help = \xc3\xa9\n') and None |
|
629 | 629 | $ hg help invaliddoc |
|
630 | 630 | non-ASCII character in alias definition 'invaliddoc:doc' |
|
631 | 631 | $ hg help invalidhelp |
|
632 | 632 | non-ASCII character in alias definition 'invalidhelp:help' |
|
633 | 633 | $ hg invaliddoc |
|
634 | 634 | config error: non-ASCII character in alias definition 'invaliddoc:doc' |
|
635 | 635 | [30] |
|
636 | 636 | $ hg invalidhelp |
|
637 | 637 | config error: non-ASCII character in alias definition 'invalidhelp:help' |
|
638 | 638 | [30] |
|
639 | 639 | |
|
640 | 640 | invalid arguments |
|
641 | 641 | |
|
642 | 642 | $ hg rt foo |
|
643 | 643 | hg rt: invalid arguments |
|
644 | 644 | hg rt |
|
645 | 645 | |
|
646 | 646 | alias for: hg root |
|
647 | 647 | |
|
648 | 648 | options: |
|
649 | 649 | |
|
650 | 650 | -T --template TEMPLATE display with template |
|
651 | 651 | |
|
652 | 652 | (use 'hg rt -h' to show more help) |
|
653 |
[ |
|
|
653 | [10] | |
|
654 | 654 | |
|
655 | 655 | invalid global arguments for normal commands, aliases, and shell aliases |
|
656 | 656 | |
|
657 | 657 | $ hg --invalid root |
|
658 | 658 | hg: option --invalid not recognized |
|
659 | 659 | (use 'hg help -v' for a list of global options) |
|
660 |
[ |
|
|
660 | [10] | |
|
661 | 661 | $ hg --invalid mylog |
|
662 | 662 | hg: option --invalid not recognized |
|
663 | 663 | (use 'hg help -v' for a list of global options) |
|
664 |
[ |
|
|
664 | [10] | |
|
665 | 665 | $ hg --invalid blank |
|
666 | 666 | hg: option --invalid not recognized |
|
667 | 667 | (use 'hg help -v' for a list of global options) |
|
668 |
[ |
|
|
668 | [10] | |
|
669 | 669 | |
|
670 | 670 | environment variable changes in alias commands |
|
671 | 671 | |
|
672 | 672 | $ cat > $TESTTMP/expandalias.py <<EOF |
|
673 | 673 | > import os |
|
674 | 674 | > from mercurial import cmdutil, commands, registrar |
|
675 | 675 | > cmdtable = {} |
|
676 | 676 | > command = registrar.command(cmdtable) |
|
677 | 677 | > @command(b'expandalias') |
|
678 | 678 | > def expandalias(ui, repo, name): |
|
679 | 679 | > alias = cmdutil.findcmd(name, commands.table)[1][0] |
|
680 | 680 | > ui.write(b'%s args: %s\n' % (name, b' '.join(alias.args))) |
|
681 | 681 | > os.environ['COUNT'] = '2' |
|
682 | 682 | > ui.write(b'%s args: %s (with COUNT=2)\n' % (name, b' '.join(alias.args))) |
|
683 | 683 | > EOF |
|
684 | 684 | |
|
685 | 685 | $ cat >> $HGRCPATH <<'EOF' |
|
686 | 686 | > [extensions] |
|
687 | 687 | > expandalias = $TESTTMP/expandalias.py |
|
688 | 688 | > [alias] |
|
689 | 689 | > showcount = log -T "$COUNT" -r . |
|
690 | 690 | > EOF |
|
691 | 691 | |
|
692 | 692 | $ COUNT=1 hg expandalias showcount |
|
693 | 693 | showcount args: -T 1 -r . |
|
694 | 694 | showcount args: -T 2 -r . (with COUNT=2) |
|
695 | 695 | |
|
696 | 696 | This should show id: |
|
697 | 697 | |
|
698 | 698 | $ hg --config alias.log='id' log |
|
699 | 699 | 000000000000 tip |
|
700 | 700 | |
|
701 | 701 | This shouldn't: |
|
702 | 702 | |
|
703 | 703 | $ hg --config alias.log='id' history |
|
704 | 704 | |
|
705 | 705 | $ cd ../.. |
|
706 | 706 | |
|
707 | 707 | return code of command and shell aliases: |
|
708 | 708 | |
|
709 | 709 | $ hg mycommit -R alias |
|
710 | 710 | nothing changed |
|
711 | 711 | [1] |
|
712 | 712 | $ hg exit1 |
|
713 | 713 | [1] |
|
714 | 714 | |
|
715 | 715 | #if no-outer-repo |
|
716 | 716 | $ hg root |
|
717 | 717 | abort: no repository found in '$TESTTMP' (.hg not found) |
|
718 | 718 | [10] |
|
719 | 719 | $ hg --config alias.hgroot='!hg root' hgroot |
|
720 | 720 | abort: no repository found in '$TESTTMP' (.hg not found) |
|
721 | 721 | [10] |
|
722 | 722 | #endif |
@@ -1,254 +1,254 b'' | |||
|
1 | 1 | Create a repository: |
|
2 | 2 | |
|
3 | 3 | #if no-extraextensions |
|
4 | 4 | $ hg config |
|
5 | 5 | devel.all-warnings=true |
|
6 | 6 | devel.default-date=0 0 |
|
7 | 7 | extensions.fsmonitor= (fsmonitor !) |
|
8 | 8 | largefiles.usercache=$TESTTMP/.cache/largefiles |
|
9 | 9 | lfs.usercache=$TESTTMP/.cache/lfs |
|
10 | 10 | ui.slash=True |
|
11 | 11 | ui.interactive=False |
|
12 | 12 | ui.detailed-exit-code=True |
|
13 | 13 | ui.merge=internal:merge |
|
14 | 14 | ui.mergemarkers=detailed |
|
15 | 15 | ui.promptecho=True |
|
16 | 16 | ui.timeout.warn=15 |
|
17 | 17 | web.address=localhost |
|
18 | 18 | web\.ipv6=(?:True|False) (re) |
|
19 | 19 | web.server-header=testing stub value |
|
20 | 20 | #endif |
|
21 | 21 | |
|
22 | 22 | $ hg init t |
|
23 | 23 | $ cd t |
|
24 | 24 | |
|
25 | 25 | Prepare a changeset: |
|
26 | 26 | |
|
27 | 27 | $ echo a > a |
|
28 | 28 | $ hg add a |
|
29 | 29 | |
|
30 | 30 | $ hg status |
|
31 | 31 | A a |
|
32 | 32 | |
|
33 | 33 | Writes to stdio succeed and fail appropriately |
|
34 | 34 | |
|
35 | 35 | #if devfull |
|
36 | 36 | $ hg status 2>/dev/full |
|
37 | 37 | A a |
|
38 | 38 | |
|
39 | 39 | $ hg status >/dev/full |
|
40 | 40 | abort: No space left on device |
|
41 | 41 | [255] |
|
42 | 42 | #endif |
|
43 | 43 | |
|
44 | 44 | #if devfull |
|
45 | 45 | $ hg status >/dev/full 2>&1 |
|
46 | 46 | [255] |
|
47 | 47 | |
|
48 | 48 | $ hg status ENOENT 2>/dev/full |
|
49 | 49 | [255] |
|
50 | 50 | #endif |
|
51 | 51 | |
|
52 | 52 | On Python 3, stdio may be None: |
|
53 | 53 | |
|
54 | 54 | $ hg debuguiprompt --config ui.interactive=true 0<&- |
|
55 | 55 | abort: Bad file descriptor |
|
56 | 56 | [255] |
|
57 | 57 | $ hg version -q 0<&- |
|
58 | 58 | Mercurial Distributed SCM * (glob) |
|
59 | 59 | |
|
60 | 60 | #if py3 |
|
61 | 61 | $ hg version -q 1>&- |
|
62 | 62 | abort: Bad file descriptor |
|
63 | 63 | [255] |
|
64 | 64 | #else |
|
65 | 65 | $ hg version -q 1>&- |
|
66 | 66 | #endif |
|
67 | 67 | $ hg unknown -q 1>&- |
|
68 | 68 | hg: unknown command 'unknown' |
|
69 | 69 | (did you mean debugknown?) |
|
70 |
[ |
|
|
70 | [10] | |
|
71 | 71 | |
|
72 | 72 | $ hg version -q 2>&- |
|
73 | 73 | Mercurial Distributed SCM * (glob) |
|
74 | 74 | $ hg unknown -q 2>&- |
|
75 |
[ |
|
|
75 | [10] | |
|
76 | 76 | |
|
77 | 77 | $ hg commit -m test |
|
78 | 78 | |
|
79 | 79 | This command is ancient: |
|
80 | 80 | |
|
81 | 81 | $ hg history |
|
82 | 82 | changeset: 0:acb14030fe0a |
|
83 | 83 | tag: tip |
|
84 | 84 | user: test |
|
85 | 85 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
86 | 86 | summary: test |
|
87 | 87 | |
|
88 | 88 | |
|
89 | 89 | Verify that updating to revision 0 via commands.update() works properly |
|
90 | 90 | |
|
91 | 91 | $ cat <<EOF > update_to_rev0.py |
|
92 | 92 | > from mercurial import commands, hg, ui as uimod |
|
93 | 93 | > myui = uimod.ui.load() |
|
94 | 94 | > repo = hg.repository(myui, path=b'.') |
|
95 | 95 | > commands.update(myui, repo, rev=b"0") |
|
96 | 96 | > EOF |
|
97 | 97 | $ hg up null |
|
98 | 98 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
99 | 99 | $ "$PYTHON" ./update_to_rev0.py |
|
100 | 100 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
101 | 101 | $ hg identify -n |
|
102 | 102 | 0 |
|
103 | 103 | |
|
104 | 104 | |
|
105 | 105 | Poke around at hashes: |
|
106 | 106 | |
|
107 | 107 | $ hg manifest --debug |
|
108 | 108 | b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 644 a |
|
109 | 109 | |
|
110 | 110 | $ hg cat a |
|
111 | 111 | a |
|
112 | 112 | |
|
113 | 113 | Verify should succeed: |
|
114 | 114 | |
|
115 | 115 | $ hg verify |
|
116 | 116 | checking changesets |
|
117 | 117 | checking manifests |
|
118 | 118 | crosschecking files in changesets and manifests |
|
119 | 119 | checking files |
|
120 | 120 | checked 1 changesets with 1 changes to 1 files |
|
121 | 121 | |
|
122 | 122 | Repository root: |
|
123 | 123 | |
|
124 | 124 | $ hg root |
|
125 | 125 | $TESTTMP/t |
|
126 | 126 | $ hg log -l1 -T '{reporoot}\n' |
|
127 | 127 | $TESTTMP/t |
|
128 | 128 | $ hg root -Tjson | sed 's|\\\\|\\|g' |
|
129 | 129 | [ |
|
130 | 130 | { |
|
131 | 131 | "hgpath": "$TESTTMP/t/.hg", |
|
132 | 132 | "reporoot": "$TESTTMP/t", |
|
133 | 133 | "storepath": "$TESTTMP/t/.hg/store" |
|
134 | 134 | } |
|
135 | 135 | ] |
|
136 | 136 | |
|
137 | 137 | At the end... |
|
138 | 138 | |
|
139 | 139 | $ cd .. |
|
140 | 140 | |
|
141 | 141 | Status message redirection: |
|
142 | 142 | |
|
143 | 143 | $ hg init empty |
|
144 | 144 | |
|
145 | 145 | status messages are sent to stdout by default: |
|
146 | 146 | |
|
147 | 147 | $ hg outgoing -R t empty -Tjson 2>/dev/null |
|
148 | 148 | comparing with empty |
|
149 | 149 | searching for changes |
|
150 | 150 | [ |
|
151 | 151 | { |
|
152 | 152 | "bookmarks": [], |
|
153 | 153 | "branch": "default", |
|
154 | 154 | "date": [0, 0], |
|
155 | 155 | "desc": "test", |
|
156 | 156 | "node": "acb14030fe0a21b60322c440ad2d20cf7685a376", |
|
157 | 157 | "parents": ["0000000000000000000000000000000000000000"], |
|
158 | 158 | "phase": "draft", |
|
159 | 159 | "rev": 0, |
|
160 | 160 | "tags": ["tip"], |
|
161 | 161 | "user": "test" |
|
162 | 162 | } |
|
163 | 163 | ] |
|
164 | 164 | |
|
165 | 165 | which can be configured to send to stderr, so the output wouldn't be |
|
166 | 166 | interleaved: |
|
167 | 167 | |
|
168 | 168 | $ cat <<'EOF' >> "$HGRCPATH" |
|
169 | 169 | > [ui] |
|
170 | 170 | > message-output = stderr |
|
171 | 171 | > EOF |
|
172 | 172 | $ hg outgoing -R t empty -Tjson 2>/dev/null |
|
173 | 173 | [ |
|
174 | 174 | { |
|
175 | 175 | "bookmarks": [], |
|
176 | 176 | "branch": "default", |
|
177 | 177 | "date": [0, 0], |
|
178 | 178 | "desc": "test", |
|
179 | 179 | "node": "acb14030fe0a21b60322c440ad2d20cf7685a376", |
|
180 | 180 | "parents": ["0000000000000000000000000000000000000000"], |
|
181 | 181 | "phase": "draft", |
|
182 | 182 | "rev": 0, |
|
183 | 183 | "tags": ["tip"], |
|
184 | 184 | "user": "test" |
|
185 | 185 | } |
|
186 | 186 | ] |
|
187 | 187 | $ hg outgoing -R t empty -Tjson >/dev/null |
|
188 | 188 | comparing with empty |
|
189 | 189 | searching for changes |
|
190 | 190 | |
|
191 | 191 | this option should be turned off by HGPLAIN= since it may break scripting use: |
|
192 | 192 | |
|
193 | 193 | $ HGPLAIN= hg outgoing -R t empty -Tjson 2>/dev/null |
|
194 | 194 | comparing with empty |
|
195 | 195 | searching for changes |
|
196 | 196 | [ |
|
197 | 197 | { |
|
198 | 198 | "bookmarks": [], |
|
199 | 199 | "branch": "default", |
|
200 | 200 | "date": [0, 0], |
|
201 | 201 | "desc": "test", |
|
202 | 202 | "node": "acb14030fe0a21b60322c440ad2d20cf7685a376", |
|
203 | 203 | "parents": ["0000000000000000000000000000000000000000"], |
|
204 | 204 | "phase": "draft", |
|
205 | 205 | "rev": 0, |
|
206 | 206 | "tags": ["tip"], |
|
207 | 207 | "user": "test" |
|
208 | 208 | } |
|
209 | 209 | ] |
|
210 | 210 | |
|
211 | 211 | but still overridden by --config: |
|
212 | 212 | |
|
213 | 213 | $ HGPLAIN= hg outgoing -R t empty -Tjson --config ui.message-output=stderr \ |
|
214 | 214 | > 2>/dev/null |
|
215 | 215 | [ |
|
216 | 216 | { |
|
217 | 217 | "bookmarks": [], |
|
218 | 218 | "branch": "default", |
|
219 | 219 | "date": [0, 0], |
|
220 | 220 | "desc": "test", |
|
221 | 221 | "node": "acb14030fe0a21b60322c440ad2d20cf7685a376", |
|
222 | 222 | "parents": ["0000000000000000000000000000000000000000"], |
|
223 | 223 | "phase": "draft", |
|
224 | 224 | "rev": 0, |
|
225 | 225 | "tags": ["tip"], |
|
226 | 226 | "user": "test" |
|
227 | 227 | } |
|
228 | 228 | ] |
|
229 | 229 | |
|
230 | 230 | Invalid ui.message-output option: |
|
231 | 231 | |
|
232 | 232 | $ hg log -R t --config ui.message-output=bad |
|
233 | 233 | abort: invalid ui.message-output destination: bad |
|
234 | 234 | [255] |
|
235 | 235 | |
|
236 | 236 | Underlying message streams should be updated when ui.fout/ferr are set: |
|
237 | 237 | |
|
238 | 238 | $ cat <<'EOF' > capui.py |
|
239 | 239 | > from mercurial import pycompat, registrar |
|
240 | 240 | > cmdtable = {} |
|
241 | 241 | > command = registrar.command(cmdtable) |
|
242 | 242 | > @command(b'capui', norepo=True) |
|
243 | 243 | > def capui(ui): |
|
244 | 244 | > out = ui.fout |
|
245 | 245 | > ui.fout = pycompat.bytesio() |
|
246 | 246 | > ui.status(b'status\n') |
|
247 | 247 | > ui.ferr = pycompat.bytesio() |
|
248 | 248 | > ui.warn(b'warn\n') |
|
249 | 249 | > out.write(b'stdout: %s' % ui.fout.getvalue()) |
|
250 | 250 | > out.write(b'stderr: %s' % ui.ferr.getvalue()) |
|
251 | 251 | > EOF |
|
252 | 252 | $ hg --config extensions.capui=capui.py --config ui.message-output=stdio capui |
|
253 | 253 | stdout: status |
|
254 | 254 | stderr: warn |
@@ -1,439 +1,439 b'' | |||
|
1 | 1 | Show all commands except debug commands |
|
2 | 2 | $ hg debugcomplete |
|
3 | 3 | abort |
|
4 | 4 | add |
|
5 | 5 | addremove |
|
6 | 6 | annotate |
|
7 | 7 | archive |
|
8 | 8 | backout |
|
9 | 9 | bisect |
|
10 | 10 | bookmarks |
|
11 | 11 | branch |
|
12 | 12 | branches |
|
13 | 13 | bundle |
|
14 | 14 | cat |
|
15 | 15 | clone |
|
16 | 16 | commit |
|
17 | 17 | config |
|
18 | 18 | continue |
|
19 | 19 | copy |
|
20 | 20 | diff |
|
21 | 21 | export |
|
22 | 22 | files |
|
23 | 23 | forget |
|
24 | 24 | graft |
|
25 | 25 | grep |
|
26 | 26 | heads |
|
27 | 27 | help |
|
28 | 28 | identify |
|
29 | 29 | import |
|
30 | 30 | incoming |
|
31 | 31 | init |
|
32 | 32 | locate |
|
33 | 33 | log |
|
34 | 34 | manifest |
|
35 | 35 | merge |
|
36 | 36 | outgoing |
|
37 | 37 | parents |
|
38 | 38 | paths |
|
39 | 39 | phase |
|
40 | 40 | pull |
|
41 | 41 | push |
|
42 | 42 | recover |
|
43 | 43 | remove |
|
44 | 44 | rename |
|
45 | 45 | resolve |
|
46 | 46 | revert |
|
47 | 47 | rollback |
|
48 | 48 | root |
|
49 | 49 | serve |
|
50 | 50 | shelve |
|
51 | 51 | status |
|
52 | 52 | summary |
|
53 | 53 | tag |
|
54 | 54 | tags |
|
55 | 55 | tip |
|
56 | 56 | unbundle |
|
57 | 57 | unshelve |
|
58 | 58 | update |
|
59 | 59 | verify |
|
60 | 60 | version |
|
61 | 61 | |
|
62 | 62 | Show all commands that start with "a" |
|
63 | 63 | $ hg debugcomplete a |
|
64 | 64 | abort |
|
65 | 65 | add |
|
66 | 66 | addremove |
|
67 | 67 | annotate |
|
68 | 68 | archive |
|
69 | 69 | |
|
70 | 70 | Do not show debug commands if there are other candidates |
|
71 | 71 | $ hg debugcomplete d |
|
72 | 72 | diff |
|
73 | 73 | |
|
74 | 74 | Show debug commands if there are no other candidates |
|
75 | 75 | $ hg debugcomplete debug |
|
76 | 76 | debugancestor |
|
77 | 77 | debugantivirusrunning |
|
78 | 78 | debugapplystreamclonebundle |
|
79 | 79 | debugbackupbundle |
|
80 | 80 | debugbuilddag |
|
81 | 81 | debugbundle |
|
82 | 82 | debugcapabilities |
|
83 | 83 | debugchangedfiles |
|
84 | 84 | debugcheckstate |
|
85 | 85 | debugcolor |
|
86 | 86 | debugcommands |
|
87 | 87 | debugcomplete |
|
88 | 88 | debugconfig |
|
89 | 89 | debugcreatestreamclonebundle |
|
90 | 90 | debugdag |
|
91 | 91 | debugdata |
|
92 | 92 | debugdate |
|
93 | 93 | debugdeltachain |
|
94 | 94 | debugdirstate |
|
95 | 95 | debugdiscovery |
|
96 | 96 | debugdownload |
|
97 | 97 | debugextensions |
|
98 | 98 | debugfileset |
|
99 | 99 | debugformat |
|
100 | 100 | debugfsinfo |
|
101 | 101 | debuggetbundle |
|
102 | 102 | debugignore |
|
103 | 103 | debugindex |
|
104 | 104 | debugindexdot |
|
105 | 105 | debugindexstats |
|
106 | 106 | debuginstall |
|
107 | 107 | debugknown |
|
108 | 108 | debuglabelcomplete |
|
109 | 109 | debuglocks |
|
110 | 110 | debugmanifestfulltextcache |
|
111 | 111 | debugmergestate |
|
112 | 112 | debugnamecomplete |
|
113 | 113 | debugnodemap |
|
114 | 114 | debugobsolete |
|
115 | 115 | debugp1copies |
|
116 | 116 | debugp2copies |
|
117 | 117 | debugpathcomplete |
|
118 | 118 | debugpathcopies |
|
119 | 119 | debugpeer |
|
120 | 120 | debugpickmergetool |
|
121 | 121 | debugpushkey |
|
122 | 122 | debugpvec |
|
123 | 123 | debugrebuilddirstate |
|
124 | 124 | debugrebuildfncache |
|
125 | 125 | debugrename |
|
126 | 126 | debugrequires |
|
127 | 127 | debugrevlog |
|
128 | 128 | debugrevlogindex |
|
129 | 129 | debugrevspec |
|
130 | 130 | debugserve |
|
131 | 131 | debugsetparents |
|
132 | 132 | debugsidedata |
|
133 | 133 | debugssl |
|
134 | 134 | debugstrip |
|
135 | 135 | debugsub |
|
136 | 136 | debugsuccessorssets |
|
137 | 137 | debugtagscache |
|
138 | 138 | debugtemplate |
|
139 | 139 | debuguigetpass |
|
140 | 140 | debuguiprompt |
|
141 | 141 | debugupdatecaches |
|
142 | 142 | debugupgraderepo |
|
143 | 143 | debugwalk |
|
144 | 144 | debugwhyunstable |
|
145 | 145 | debugwireargs |
|
146 | 146 | debugwireproto |
|
147 | 147 | |
|
148 | 148 | Do not show the alias of a debug command if there are other candidates |
|
149 | 149 | (this should hide rawcommit) |
|
150 | 150 | $ hg debugcomplete r |
|
151 | 151 | recover |
|
152 | 152 | remove |
|
153 | 153 | rename |
|
154 | 154 | resolve |
|
155 | 155 | revert |
|
156 | 156 | rollback |
|
157 | 157 | root |
|
158 | 158 | Show the alias of a debug command if there are no other candidates |
|
159 | 159 | $ hg debugcomplete rawc |
|
160 | 160 | |
|
161 | 161 | |
|
162 | 162 | Show the global options |
|
163 | 163 | $ hg debugcomplete --options | sort |
|
164 | 164 | --color |
|
165 | 165 | --config |
|
166 | 166 | --cwd |
|
167 | 167 | --debug |
|
168 | 168 | --debugger |
|
169 | 169 | --encoding |
|
170 | 170 | --encodingmode |
|
171 | 171 | --help |
|
172 | 172 | --hidden |
|
173 | 173 | --noninteractive |
|
174 | 174 | --pager |
|
175 | 175 | --profile |
|
176 | 176 | --quiet |
|
177 | 177 | --repository |
|
178 | 178 | --time |
|
179 | 179 | --traceback |
|
180 | 180 | --verbose |
|
181 | 181 | --version |
|
182 | 182 | -R |
|
183 | 183 | -h |
|
184 | 184 | -q |
|
185 | 185 | -v |
|
186 | 186 | -y |
|
187 | 187 | |
|
188 | 188 | Show the options for the "serve" command |
|
189 | 189 | $ hg debugcomplete --options serve | sort |
|
190 | 190 | --accesslog |
|
191 | 191 | --address |
|
192 | 192 | --certificate |
|
193 | 193 | --cmdserver |
|
194 | 194 | --color |
|
195 | 195 | --config |
|
196 | 196 | --cwd |
|
197 | 197 | --daemon |
|
198 | 198 | --daemon-postexec |
|
199 | 199 | --debug |
|
200 | 200 | --debugger |
|
201 | 201 | --encoding |
|
202 | 202 | --encodingmode |
|
203 | 203 | --errorlog |
|
204 | 204 | --help |
|
205 | 205 | --hidden |
|
206 | 206 | --ipv6 |
|
207 | 207 | --name |
|
208 | 208 | --noninteractive |
|
209 | 209 | --pager |
|
210 | 210 | --pid-file |
|
211 | 211 | --port |
|
212 | 212 | --prefix |
|
213 | 213 | --print-url |
|
214 | 214 | --profile |
|
215 | 215 | --quiet |
|
216 | 216 | --repository |
|
217 | 217 | --stdio |
|
218 | 218 | --style |
|
219 | 219 | --subrepos |
|
220 | 220 | --templates |
|
221 | 221 | --time |
|
222 | 222 | --traceback |
|
223 | 223 | --verbose |
|
224 | 224 | --version |
|
225 | 225 | --web-conf |
|
226 | 226 | -6 |
|
227 | 227 | -A |
|
228 | 228 | -E |
|
229 | 229 | -R |
|
230 | 230 | -S |
|
231 | 231 | -a |
|
232 | 232 | -d |
|
233 | 233 | -h |
|
234 | 234 | -n |
|
235 | 235 | -p |
|
236 | 236 | -q |
|
237 | 237 | -t |
|
238 | 238 | -v |
|
239 | 239 | -y |
|
240 | 240 | |
|
241 | 241 | Show an error if we use --options with an ambiguous abbreviation |
|
242 | 242 | $ hg debugcomplete --options s |
|
243 | 243 | hg: command 's' is ambiguous: |
|
244 | 244 | serve shelve showconfig status summary |
|
245 |
[ |
|
|
245 | [10] | |
|
246 | 246 | |
|
247 | 247 | Show all commands + options |
|
248 | 248 | $ hg debugcommands |
|
249 | 249 | abort: dry-run |
|
250 | 250 | add: include, exclude, subrepos, dry-run |
|
251 | 251 | addremove: similarity, subrepos, include, exclude, dry-run |
|
252 | 252 | annotate: rev, follow, no-follow, text, user, file, date, number, changeset, line-number, skip, ignore-all-space, ignore-space-change, ignore-blank-lines, ignore-space-at-eol, include, exclude, template |
|
253 | 253 | archive: no-decode, prefix, rev, type, subrepos, include, exclude |
|
254 | 254 | backout: merge, commit, no-commit, parent, rev, edit, tool, include, exclude, message, logfile, date, user |
|
255 | 255 | bisect: reset, good, bad, skip, extend, command, noupdate |
|
256 | 256 | bookmarks: force, rev, delete, rename, inactive, list, template |
|
257 | 257 | branch: force, clean, rev |
|
258 | 258 | branches: active, closed, rev, template |
|
259 | 259 | bundle: force, rev, branch, base, all, type, ssh, remotecmd, insecure |
|
260 | 260 | cat: output, rev, decode, include, exclude, template |
|
261 | 261 | clone: noupdate, updaterev, rev, branch, pull, uncompressed, stream, ssh, remotecmd, insecure |
|
262 | 262 | commit: addremove, close-branch, amend, secret, edit, force-close-branch, interactive, include, exclude, message, logfile, date, user, subrepos |
|
263 | 263 | config: untrusted, edit, local, shared, non-shared, global, template |
|
264 | 264 | continue: dry-run |
|
265 | 265 | copy: forget, after, at-rev, force, include, exclude, dry-run |
|
266 | 266 | debugancestor: |
|
267 | 267 | debugantivirusrunning: |
|
268 | 268 | debugapplystreamclonebundle: |
|
269 | 269 | debugbackupbundle: recover, patch, git, limit, no-merges, stat, graph, style, template |
|
270 | 270 | debugbuilddag: mergeable-file, overwritten-file, new-file |
|
271 | 271 | debugbundle: all, part-type, spec |
|
272 | 272 | debugcapabilities: |
|
273 | 273 | debugchangedfiles: |
|
274 | 274 | debugcheckstate: |
|
275 | 275 | debugcolor: style |
|
276 | 276 | debugcommands: |
|
277 | 277 | debugcomplete: options |
|
278 | 278 | debugcreatestreamclonebundle: |
|
279 | 279 | debugdag: tags, branches, dots, spaces |
|
280 | 280 | debugdata: changelog, manifest, dir |
|
281 | 281 | debugdate: extended |
|
282 | 282 | debugdeltachain: changelog, manifest, dir, template |
|
283 | 283 | debugdirstate: nodates, dates, datesort |
|
284 | 284 | debugdiscovery: old, nonheads, rev, seed, ssh, remotecmd, insecure |
|
285 | 285 | debugdownload: output |
|
286 | 286 | debugextensions: template |
|
287 | 287 | debugfileset: rev, all-files, show-matcher, show-stage |
|
288 | 288 | debugformat: template |
|
289 | 289 | debugfsinfo: |
|
290 | 290 | debuggetbundle: head, common, type |
|
291 | 291 | debugignore: |
|
292 | 292 | debugindex: changelog, manifest, dir, template |
|
293 | 293 | debugindexdot: changelog, manifest, dir |
|
294 | 294 | debugindexstats: |
|
295 | 295 | debuginstall: template |
|
296 | 296 | debugknown: |
|
297 | 297 | debuglabelcomplete: |
|
298 | 298 | debuglocks: force-free-lock, force-free-wlock, set-lock, set-wlock |
|
299 | 299 | debugmanifestfulltextcache: clear, add |
|
300 | 300 | debugmergestate: style, template |
|
301 | 301 | debugnamecomplete: |
|
302 | 302 | debugnodemap: dump-new, dump-disk, check, metadata |
|
303 | 303 | debugobsolete: flags, record-parents, rev, exclusive, index, delete, date, user, template |
|
304 | 304 | debugp1copies: rev |
|
305 | 305 | debugp2copies: rev |
|
306 | 306 | debugpathcomplete: full, normal, added, removed |
|
307 | 307 | debugpathcopies: include, exclude |
|
308 | 308 | debugpeer: |
|
309 | 309 | debugpickmergetool: rev, changedelete, include, exclude, tool |
|
310 | 310 | debugpushkey: |
|
311 | 311 | debugpvec: |
|
312 | 312 | debugrebuilddirstate: rev, minimal |
|
313 | 313 | debugrebuildfncache: |
|
314 | 314 | debugrename: rev |
|
315 | 315 | debugrequires: |
|
316 | 316 | debugrevlog: changelog, manifest, dir, dump |
|
317 | 317 | debugrevlogindex: changelog, manifest, dir, format |
|
318 | 318 | debugrevspec: optimize, show-revs, show-set, show-stage, no-optimized, verify-optimized |
|
319 | 319 | debugserve: sshstdio, logiofd, logiofile |
|
320 | 320 | debugsetparents: |
|
321 | 321 | debugsidedata: changelog, manifest, dir |
|
322 | 322 | debugssl: |
|
323 | 323 | debugstrip: rev, force, no-backup, nobackup, , keep, bookmark, soft |
|
324 | 324 | debugsub: rev |
|
325 | 325 | debugsuccessorssets: closest |
|
326 | 326 | debugtagscache: |
|
327 | 327 | debugtemplate: rev, define |
|
328 | 328 | debuguigetpass: prompt |
|
329 | 329 | debuguiprompt: prompt |
|
330 | 330 | debugupdatecaches: |
|
331 | 331 | debugupgraderepo: optimize, run, backup, changelog, manifest, filelogs |
|
332 | 332 | debugwalk: include, exclude |
|
333 | 333 | debugwhyunstable: |
|
334 | 334 | debugwireargs: three, four, five, ssh, remotecmd, insecure |
|
335 | 335 | debugwireproto: localssh, peer, noreadstderr, nologhandshake, ssh, remotecmd, insecure |
|
336 | 336 | diff: rev, from, to, change, text, git, binary, nodates, noprefix, show-function, reverse, ignore-all-space, ignore-space-change, ignore-blank-lines, ignore-space-at-eol, unified, stat, root, include, exclude, subrepos |
|
337 | 337 | export: bookmark, output, switch-parent, rev, text, git, binary, nodates, template |
|
338 | 338 | files: rev, print0, include, exclude, template, subrepos |
|
339 | 339 | forget: interactive, include, exclude, dry-run |
|
340 | 340 | graft: rev, base, continue, stop, abort, edit, log, no-commit, force, currentdate, currentuser, date, user, tool, dry-run |
|
341 | 341 | grep: print0, all, diff, text, follow, ignore-case, files-with-matches, line-number, rev, all-files, user, date, template, include, exclude |
|
342 | 342 | heads: rev, topo, active, closed, style, template |
|
343 | 343 | help: extension, command, keyword, system |
|
344 | 344 | identify: rev, num, id, branch, tags, bookmarks, ssh, remotecmd, insecure, template |
|
345 | 345 | import: strip, base, secret, edit, force, no-commit, bypass, partial, exact, prefix, import-branch, message, logfile, date, user, similarity |
|
346 | 346 | incoming: force, newest-first, bundle, rev, bookmarks, branch, patch, git, limit, no-merges, stat, graph, style, template, ssh, remotecmd, insecure, subrepos |
|
347 | 347 | init: ssh, remotecmd, insecure |
|
348 | 348 | locate: rev, print0, fullpath, include, exclude |
|
349 | 349 | log: follow, follow-first, date, copies, keyword, rev, line-range, removed, only-merges, user, only-branch, branch, bookmark, prune, patch, git, limit, no-merges, stat, graph, style, template, include, exclude |
|
350 | 350 | manifest: rev, all, template |
|
351 | 351 | merge: force, rev, preview, abort, tool |
|
352 | 352 | outgoing: force, rev, newest-first, bookmarks, branch, patch, git, limit, no-merges, stat, graph, style, template, ssh, remotecmd, insecure, subrepos |
|
353 | 353 | parents: rev, style, template |
|
354 | 354 | paths: template |
|
355 | 355 | phase: public, draft, secret, force, rev |
|
356 | 356 | pull: update, force, confirm, rev, bookmark, branch, ssh, remotecmd, insecure |
|
357 | 357 | push: force, rev, bookmark, all-bookmarks, branch, new-branch, pushvars, publish, ssh, remotecmd, insecure |
|
358 | 358 | recover: verify |
|
359 | 359 | remove: after, force, subrepos, include, exclude, dry-run |
|
360 | 360 | rename: after, at-rev, force, include, exclude, dry-run |
|
361 | 361 | resolve: all, list, mark, unmark, no-status, re-merge, tool, include, exclude, template |
|
362 | 362 | revert: all, date, rev, no-backup, interactive, include, exclude, dry-run |
|
363 | 363 | rollback: dry-run, force |
|
364 | 364 | root: template |
|
365 | 365 | serve: accesslog, daemon, daemon-postexec, errorlog, port, address, prefix, name, web-conf, webdir-conf, pid-file, stdio, cmdserver, templates, style, ipv6, certificate, print-url, subrepos |
|
366 | 366 | shelve: addremove, unknown, cleanup, date, delete, edit, keep, list, message, name, patch, interactive, stat, include, exclude |
|
367 | 367 | status: all, modified, added, removed, deleted, clean, unknown, ignored, no-status, terse, copies, print0, rev, change, include, exclude, subrepos, template |
|
368 | 368 | summary: remote |
|
369 | 369 | tag: force, local, rev, remove, edit, message, date, user |
|
370 | 370 | tags: template |
|
371 | 371 | tip: patch, git, style, template |
|
372 | 372 | unbundle: update |
|
373 | 373 | unshelve: abort, continue, interactive, keep, name, tool, date |
|
374 | 374 | update: clean, check, merge, date, rev, tool |
|
375 | 375 | verify: full |
|
376 | 376 | version: template |
|
377 | 377 | |
|
378 | 378 | $ hg init a |
|
379 | 379 | $ cd a |
|
380 | 380 | $ echo fee > fee |
|
381 | 381 | $ hg ci -q -Amfee |
|
382 | 382 | $ hg tag fee |
|
383 | 383 | $ mkdir fie |
|
384 | 384 | $ echo dead > fie/dead |
|
385 | 385 | $ echo live > fie/live |
|
386 | 386 | $ hg bookmark fo |
|
387 | 387 | $ hg branch -q fie |
|
388 | 388 | $ hg ci -q -Amfie |
|
389 | 389 | $ echo fo > fo |
|
390 | 390 | $ hg branch -qf default |
|
391 | 391 | $ hg ci -q -Amfo |
|
392 | 392 | $ echo Fum > Fum |
|
393 | 393 | $ hg ci -q -AmFum |
|
394 | 394 | $ hg bookmark Fum |
|
395 | 395 | |
|
396 | 396 | Test debugpathcomplete |
|
397 | 397 | |
|
398 | 398 | $ hg debugpathcomplete f |
|
399 | 399 | fee |
|
400 | 400 | fie |
|
401 | 401 | fo |
|
402 | 402 | $ hg debugpathcomplete -f f |
|
403 | 403 | fee |
|
404 | 404 | fie/dead |
|
405 | 405 | fie/live |
|
406 | 406 | fo |
|
407 | 407 | |
|
408 | 408 | $ hg rm Fum |
|
409 | 409 | $ hg debugpathcomplete -r F |
|
410 | 410 | Fum |
|
411 | 411 | |
|
412 | 412 | Test debugnamecomplete |
|
413 | 413 | |
|
414 | 414 | $ hg debugnamecomplete |
|
415 | 415 | Fum |
|
416 | 416 | default |
|
417 | 417 | fee |
|
418 | 418 | fie |
|
419 | 419 | fo |
|
420 | 420 | tip |
|
421 | 421 | $ hg debugnamecomplete f |
|
422 | 422 | fee |
|
423 | 423 | fie |
|
424 | 424 | fo |
|
425 | 425 | |
|
426 | 426 | Test debuglabelcomplete, a deprecated name for debugnamecomplete that is still |
|
427 | 427 | used for completions in some shells. |
|
428 | 428 | |
|
429 | 429 | $ hg debuglabelcomplete |
|
430 | 430 | Fum |
|
431 | 431 | default |
|
432 | 432 | fee |
|
433 | 433 | fie |
|
434 | 434 | fo |
|
435 | 435 | tip |
|
436 | 436 | $ hg debuglabelcomplete f |
|
437 | 437 | fee |
|
438 | 438 | fie |
|
439 | 439 | fo |
@@ -1,221 +1,221 b'' | |||
|
1 | 1 | test command parsing and dispatch |
|
2 | 2 | |
|
3 | 3 | $ hg init a |
|
4 | 4 | $ cd a |
|
5 | 5 | |
|
6 | 6 | Redundant options used to crash (issue436): |
|
7 | 7 | $ hg -v log -v |
|
8 | 8 | $ hg -v log -v x |
|
9 | 9 | |
|
10 | 10 | $ echo a > a |
|
11 | 11 | $ hg ci -Ama |
|
12 | 12 | adding a |
|
13 | 13 | |
|
14 | 14 | Missing arg: |
|
15 | 15 | |
|
16 | 16 | $ hg cat |
|
17 | 17 | hg cat: invalid arguments |
|
18 | 18 | hg cat [OPTION]... FILE... |
|
19 | 19 | |
|
20 | 20 | output the current or given revision of files |
|
21 | 21 | |
|
22 | 22 | options ([+] can be repeated): |
|
23 | 23 | |
|
24 | 24 | -o --output FORMAT print output to file with formatted name |
|
25 | 25 | -r --rev REV print the given revision |
|
26 | 26 | --decode apply any matching decode filter |
|
27 | 27 | -I --include PATTERN [+] include names matching the given patterns |
|
28 | 28 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
29 | 29 | -T --template TEMPLATE display with template |
|
30 | 30 | |
|
31 | 31 | (use 'hg cat -h' to show more help) |
|
32 |
[ |
|
|
32 | [10] | |
|
33 | 33 | |
|
34 | 34 | Missing parameter for early option: |
|
35 | 35 | |
|
36 | 36 | $ hg log -R 2>&1 | grep 'hg log' |
|
37 | 37 | hg log: option -R requires argument |
|
38 | 38 | hg log [OPTION]... [FILE] |
|
39 | 39 | (use 'hg log -h' to show more help) |
|
40 | 40 | |
|
41 | 41 | "--" may be an option value: |
|
42 | 42 | |
|
43 | 43 | $ hg -R -- log |
|
44 | 44 | abort: repository -- not found |
|
45 | 45 | [255] |
|
46 | 46 | $ hg log -R -- |
|
47 | 47 | abort: repository -- not found |
|
48 | 48 | [255] |
|
49 | 49 | $ hg log -T -- |
|
50 | 50 | -- (no-eol) |
|
51 | 51 | $ hg log -T -- -k nomatch |
|
52 | 52 | |
|
53 | 53 | Parsing of early options should stop at "--": |
|
54 | 54 | |
|
55 | 55 | $ hg cat -- --config=hooks.pre-cat=false |
|
56 | 56 | --config=hooks.pre-cat=false: no such file in rev cb9a9f314b8b |
|
57 | 57 | [1] |
|
58 | 58 | $ hg cat -- --debugger |
|
59 | 59 | --debugger: no such file in rev cb9a9f314b8b |
|
60 | 60 | [1] |
|
61 | 61 | |
|
62 | 62 | Unparsable form of early options: |
|
63 | 63 | |
|
64 | 64 | $ hg cat --debugg |
|
65 | 65 | abort: option --debugger may not be abbreviated |
|
66 | 66 | [10] |
|
67 | 67 | |
|
68 | 68 | Parsing failure of early options should be detected before executing the |
|
69 | 69 | command: |
|
70 | 70 | |
|
71 | 71 | $ hg log -b '--config=hooks.pre-log=false' default |
|
72 | 72 | abort: option --config may not be abbreviated |
|
73 | 73 | [10] |
|
74 | 74 | $ hg log -b -R. default |
|
75 | 75 | abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo |
|
76 | 76 | [10] |
|
77 | 77 | $ hg log --cwd .. -b --cwd=. default |
|
78 | 78 | abort: option --cwd may not be abbreviated |
|
79 | 79 | [10] |
|
80 | 80 | |
|
81 | 81 | However, we can't prevent it from loading extensions and configs: |
|
82 | 82 | |
|
83 | 83 | $ cat <<EOF > bad.py |
|
84 | 84 | > raise Exception('bad') |
|
85 | 85 | > EOF |
|
86 | 86 | $ hg log -b '--config=extensions.bad=bad.py' default |
|
87 | 87 | *** failed to import extension bad from bad.py: bad |
|
88 | 88 | abort: option --config may not be abbreviated |
|
89 | 89 | [10] |
|
90 | 90 | |
|
91 | 91 | $ mkdir -p badrepo/.hg |
|
92 | 92 | $ echo 'invalid-syntax' > badrepo/.hg/hgrc |
|
93 | 93 | $ hg log -b -Rbadrepo default |
|
94 | 94 | config error at badrepo/.hg/hgrc:1: invalid-syntax |
|
95 | 95 | [30] |
|
96 | 96 | |
|
97 | 97 | $ hg log -b --cwd=inexistent default |
|
98 | 98 | abort: $ENOENT$: 'inexistent' |
|
99 | 99 | [255] |
|
100 | 100 | |
|
101 | 101 | $ hg log -b '--config=ui.traceback=yes' 2>&1 | grep '^Traceback' |
|
102 | 102 | Traceback (most recent call last): |
|
103 | 103 | $ hg log -b '--config=profiling.enabled=yes' 2>&1 | grep -i sample |
|
104 | 104 | Sample count: .*|No samples recorded\. (re) |
|
105 | 105 | |
|
106 | 106 | Early options can't be specified in [aliases] and [defaults] because they are |
|
107 | 107 | applied before the command name is resolved: |
|
108 | 108 | |
|
109 | 109 | $ hg log -b '--config=alias.log=log --config=hooks.pre-log=false' |
|
110 | 110 | hg log: option -b not recognized |
|
111 | 111 | error in definition for alias 'log': --config may only be given on the command |
|
112 | 112 | line |
|
113 |
[ |
|
|
113 | [10] | |
|
114 | 114 | |
|
115 | 115 | $ hg log -b '--config=defaults.log=--config=hooks.pre-log=false' |
|
116 | 116 | abort: option --config may not be abbreviated |
|
117 | 117 | [10] |
|
118 | 118 | |
|
119 | 119 | Shell aliases bypass any command parsing rules but for the early one: |
|
120 | 120 | |
|
121 | 121 | $ hg log -b '--config=alias.log=!echo howdy' |
|
122 | 122 | howdy |
|
123 | 123 | |
|
124 | 124 | Early options must come first if HGPLAIN=+strictflags is specified: |
|
125 | 125 | (BUG: chg cherry-picks early options to pass them as a server command) |
|
126 | 126 | |
|
127 | 127 | #if no-chg |
|
128 | 128 | $ HGPLAIN=+strictflags hg log -b --config='hooks.pre-log=false' default |
|
129 | 129 | abort: unknown revision '--config=hooks.pre-log=false' |
|
130 | 130 | [255] |
|
131 | 131 | $ HGPLAIN=+strictflags hg log -b -R. default |
|
132 | 132 | abort: unknown revision '-R.' |
|
133 | 133 | [255] |
|
134 | 134 | $ HGPLAIN=+strictflags hg log -b --cwd=. default |
|
135 | 135 | abort: unknown revision '--cwd=.' |
|
136 | 136 | [255] |
|
137 | 137 | #endif |
|
138 | 138 | $ HGPLAIN=+strictflags hg log -b --debugger default |
|
139 | 139 | abort: unknown revision '--debugger' |
|
140 | 140 | [255] |
|
141 | 141 | $ HGPLAIN=+strictflags hg log -b --config='alias.log=!echo pwned' default |
|
142 | 142 | abort: unknown revision '--config=alias.log=!echo pwned' |
|
143 | 143 | [255] |
|
144 | 144 | |
|
145 | 145 | $ HGPLAIN=+strictflags hg log --config='hooks.pre-log=false' -b default |
|
146 | 146 | abort: option --config may not be abbreviated |
|
147 | 147 | [10] |
|
148 | 148 | $ HGPLAIN=+strictflags hg log -q --cwd=.. -b default |
|
149 | 149 | abort: option --cwd may not be abbreviated |
|
150 | 150 | [10] |
|
151 | 151 | $ HGPLAIN=+strictflags hg log -q -R . -b default |
|
152 | 152 | abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo |
|
153 | 153 | [10] |
|
154 | 154 | |
|
155 | 155 | $ HGPLAIN=+strictflags hg --config='hooks.pre-log=false' log -b default |
|
156 | 156 | abort: pre-log hook exited with status 1 |
|
157 | 157 | [255] |
|
158 | 158 | $ HGPLAIN=+strictflags hg --cwd .. -q -Ra log -b default |
|
159 | 159 | 0:cb9a9f314b8b |
|
160 | 160 | $ HGPLAIN=+strictflags hg --cwd .. -q --repository a log -b default |
|
161 | 161 | 0:cb9a9f314b8b |
|
162 | 162 | $ HGPLAIN=+strictflags hg --cwd .. -q --repo a log -b default |
|
163 | 163 | 0:cb9a9f314b8b |
|
164 | 164 | |
|
165 | 165 | For compatibility reasons, HGPLAIN=+strictflags is not enabled by plain HGPLAIN: |
|
166 | 166 | |
|
167 | 167 | $ HGPLAIN= hg log --config='hooks.pre-log=false' -b default |
|
168 | 168 | abort: pre-log hook exited with status 1 |
|
169 | 169 | [255] |
|
170 | 170 | $ HGPLAINEXCEPT= hg log --cwd .. -q -Ra -b default |
|
171 | 171 | 0:cb9a9f314b8b |
|
172 | 172 | |
|
173 | 173 | [defaults] |
|
174 | 174 | |
|
175 | 175 | $ hg cat a |
|
176 | 176 | a |
|
177 | 177 | $ cat >> $HGRCPATH <<EOF |
|
178 | 178 | > [defaults] |
|
179 | 179 | > cat = -r null |
|
180 | 180 | > EOF |
|
181 | 181 | $ hg cat a |
|
182 | 182 | a: no such file in rev 000000000000 |
|
183 | 183 | [1] |
|
184 | 184 | |
|
185 | 185 | $ cd "$TESTTMP" |
|
186 | 186 | |
|
187 | 187 | OSError "No such file or directory" / "The system cannot find the path |
|
188 | 188 | specified" should include filename even when it is empty |
|
189 | 189 | |
|
190 | 190 | $ hg -R a archive '' |
|
191 | 191 | abort: $ENOENT$: '' (no-windows !) |
|
192 | 192 | abort: $ENOTDIR$: '' (windows !) |
|
193 | 193 | [255] |
|
194 | 194 | |
|
195 | 195 | #if no-outer-repo |
|
196 | 196 | |
|
197 | 197 | No repo: |
|
198 | 198 | |
|
199 | 199 | $ hg cat |
|
200 | 200 | abort: no repository found in '$TESTTMP' (.hg not found) |
|
201 | 201 | [10] |
|
202 | 202 | |
|
203 | 203 | #endif |
|
204 | 204 | |
|
205 | 205 | #if rmcwd |
|
206 | 206 | |
|
207 | 207 | Current directory removed: |
|
208 | 208 | |
|
209 | 209 | $ mkdir $TESTTMP/repo1 |
|
210 | 210 | $ cd $TESTTMP/repo1 |
|
211 | 211 | $ rm -rf $TESTTMP/repo1 |
|
212 | 212 | |
|
213 | 213 | The output could be one of the following and something else: |
|
214 | 214 | chg: abort: failed to getcwd (errno = *) (glob) |
|
215 | 215 | abort: error getting current working directory: * (glob) |
|
216 | 216 | sh: 0: getcwd() failed: $ENOENT$ |
|
217 | 217 | Since the exact behavior depends on the shell, only check it returns non-zero. |
|
218 | 218 | $ HGDEMANDIMPORT=disable hg version -q 2>/dev/null || false |
|
219 | 219 | [1] |
|
220 | 220 | |
|
221 | 221 | #endif |
@@ -1,1908 +1,1908 b'' | |||
|
1 | 1 | Test basic extension support |
|
2 | 2 | $ cat > unflush.py <<EOF |
|
3 | 3 | > import sys |
|
4 | 4 | > from mercurial import pycompat |
|
5 | 5 | > if pycompat.ispy3: |
|
6 | 6 | > # no changes required |
|
7 | 7 | > sys.exit(0) |
|
8 | 8 | > with open(sys.argv[1], 'rb') as f: |
|
9 | 9 | > data = f.read() |
|
10 | 10 | > with open(sys.argv[1], 'wb') as f: |
|
11 | 11 | > f.write(data.replace(b', flush=True', b'')) |
|
12 | 12 | > EOF |
|
13 | 13 | |
|
14 | 14 | $ cat > foobar.py <<EOF |
|
15 | 15 | > import os |
|
16 | 16 | > from mercurial import commands, exthelper, registrar |
|
17 | 17 | > |
|
18 | 18 | > eh = exthelper.exthelper() |
|
19 | 19 | > eh.configitem(b'tests', b'foo', default=b"Foo") |
|
20 | 20 | > |
|
21 | 21 | > uisetup = eh.finaluisetup |
|
22 | 22 | > uipopulate = eh.finaluipopulate |
|
23 | 23 | > reposetup = eh.finalreposetup |
|
24 | 24 | > cmdtable = eh.cmdtable |
|
25 | 25 | > configtable = eh.configtable |
|
26 | 26 | > |
|
27 | 27 | > @eh.uisetup |
|
28 | 28 | > def _uisetup(ui): |
|
29 | 29 | > ui.debug(b"uisetup called [debug]\\n") |
|
30 | 30 | > ui.write(b"uisetup called\\n") |
|
31 | 31 | > ui.status(b"uisetup called [status]\\n") |
|
32 | 32 | > ui.flush() |
|
33 | 33 | > @eh.uipopulate |
|
34 | 34 | > def _uipopulate(ui): |
|
35 | 35 | > ui._populatecnt = getattr(ui, "_populatecnt", 0) + 1 |
|
36 | 36 | > ui.write(b"uipopulate called (%d times)\n" % ui._populatecnt) |
|
37 | 37 | > @eh.reposetup |
|
38 | 38 | > def _reposetup(ui, repo): |
|
39 | 39 | > ui.write(b"reposetup called for %s\\n" % os.path.basename(repo.root)) |
|
40 | 40 | > ui.write(b"ui %s= repo.ui\\n" % (ui == repo.ui and b"=" or b"!")) |
|
41 | 41 | > ui.flush() |
|
42 | 42 | > @eh.command(b'foo', [], b'hg foo') |
|
43 | 43 | > def foo(ui, *args, **kwargs): |
|
44 | 44 | > foo = ui.config(b'tests', b'foo') |
|
45 | 45 | > ui.write(foo) |
|
46 | 46 | > ui.write(b"\\n") |
|
47 | 47 | > @eh.command(b'bar', [], b'hg bar', norepo=True) |
|
48 | 48 | > def bar(ui, *args, **kwargs): |
|
49 | 49 | > ui.write(b"Bar\\n") |
|
50 | 50 | > EOF |
|
51 | 51 | $ abspath=`pwd`/foobar.py |
|
52 | 52 | |
|
53 | 53 | $ mkdir barfoo |
|
54 | 54 | $ cp foobar.py barfoo/__init__.py |
|
55 | 55 | $ barfoopath=`pwd`/barfoo |
|
56 | 56 | |
|
57 | 57 | $ hg init a |
|
58 | 58 | $ cd a |
|
59 | 59 | $ echo foo > file |
|
60 | 60 | $ hg add file |
|
61 | 61 | $ hg commit -m 'add file' |
|
62 | 62 | |
|
63 | 63 | $ echo '[extensions]' >> $HGRCPATH |
|
64 | 64 | $ echo "foobar = $abspath" >> $HGRCPATH |
|
65 | 65 | $ hg foo |
|
66 | 66 | uisetup called |
|
67 | 67 | uisetup called [status] |
|
68 | 68 | uipopulate called (1 times) |
|
69 | 69 | uipopulate called (1 times) |
|
70 | 70 | uipopulate called (1 times) |
|
71 | 71 | reposetup called for a |
|
72 | 72 | ui == repo.ui |
|
73 | 73 | uipopulate called (1 times) (chg !) |
|
74 | 74 | uipopulate called (1 times) (chg !) |
|
75 | 75 | uipopulate called (1 times) (chg !) |
|
76 | 76 | uipopulate called (1 times) (chg !) |
|
77 | 77 | uipopulate called (1 times) (chg !) |
|
78 | 78 | reposetup called for a (chg !) |
|
79 | 79 | ui == repo.ui (chg !) |
|
80 | 80 | Foo |
|
81 | 81 | $ hg foo --quiet |
|
82 | 82 | uisetup called (no-chg !) |
|
83 | 83 | uipopulate called (1 times) |
|
84 | 84 | uipopulate called (1 times) |
|
85 | 85 | uipopulate called (1 times) (chg !) |
|
86 | 86 | uipopulate called (1 times) (chg !) |
|
87 | 87 | uipopulate called (1 times) |
|
88 | 88 | reposetup called for a |
|
89 | 89 | ui == repo.ui |
|
90 | 90 | Foo |
|
91 | 91 | $ hg foo --debug |
|
92 | 92 | uisetup called [debug] (no-chg !) |
|
93 | 93 | uisetup called (no-chg !) |
|
94 | 94 | uisetup called [status] (no-chg !) |
|
95 | 95 | uipopulate called (1 times) |
|
96 | 96 | uipopulate called (1 times) |
|
97 | 97 | uipopulate called (1 times) (chg !) |
|
98 | 98 | uipopulate called (1 times) (chg !) |
|
99 | 99 | uipopulate called (1 times) |
|
100 | 100 | reposetup called for a |
|
101 | 101 | ui == repo.ui |
|
102 | 102 | Foo |
|
103 | 103 | |
|
104 | 104 | $ cd .. |
|
105 | 105 | $ hg clone a b |
|
106 | 106 | uisetup called (no-chg !) |
|
107 | 107 | uisetup called [status] (no-chg !) |
|
108 | 108 | uipopulate called (1 times) |
|
109 | 109 | uipopulate called (1 times) (chg !) |
|
110 | 110 | uipopulate called (1 times) |
|
111 | 111 | reposetup called for a |
|
112 | 112 | ui == repo.ui |
|
113 | 113 | uipopulate called (1 times) |
|
114 | 114 | reposetup called for b |
|
115 | 115 | ui == repo.ui |
|
116 | 116 | updating to branch default |
|
117 | 117 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
118 | 118 | |
|
119 | 119 | $ hg bar |
|
120 | 120 | uisetup called (no-chg !) |
|
121 | 121 | uisetup called [status] (no-chg !) |
|
122 | 122 | uipopulate called (1 times) |
|
123 | 123 | uipopulate called (1 times) (chg !) |
|
124 | 124 | Bar |
|
125 | 125 | $ echo 'foobar = !' >> $HGRCPATH |
|
126 | 126 | |
|
127 | 127 | module/__init__.py-style |
|
128 | 128 | |
|
129 | 129 | $ echo "barfoo = $barfoopath" >> $HGRCPATH |
|
130 | 130 | $ cd a |
|
131 | 131 | $ hg foo |
|
132 | 132 | uisetup called |
|
133 | 133 | uisetup called [status] |
|
134 | 134 | uipopulate called (1 times) |
|
135 | 135 | uipopulate called (1 times) |
|
136 | 136 | uipopulate called (1 times) |
|
137 | 137 | reposetup called for a |
|
138 | 138 | ui == repo.ui |
|
139 | 139 | uipopulate called (1 times) (chg !) |
|
140 | 140 | uipopulate called (1 times) (chg !) |
|
141 | 141 | uipopulate called (1 times) (chg !) |
|
142 | 142 | uipopulate called (1 times) (chg !) |
|
143 | 143 | uipopulate called (1 times) (chg !) |
|
144 | 144 | reposetup called for a (chg !) |
|
145 | 145 | ui == repo.ui (chg !) |
|
146 | 146 | Foo |
|
147 | 147 | $ echo 'barfoo = !' >> $HGRCPATH |
|
148 | 148 | |
|
149 | 149 | Check that extensions are loaded in phases: |
|
150 | 150 | |
|
151 | 151 | $ cat > foo.py <<EOF |
|
152 | 152 | > from __future__ import print_function |
|
153 | 153 | > import os |
|
154 | 154 | > from mercurial import exthelper |
|
155 | 155 | > from mercurial.utils import procutil |
|
156 | 156 | > |
|
157 | 157 | > def write(msg): |
|
158 | 158 | > procutil.stdout.write(msg) |
|
159 | 159 | > procutil.stdout.flush() |
|
160 | 160 | > |
|
161 | 161 | > name = os.path.basename(__file__).rsplit('.', 1)[0] |
|
162 | 162 | > bytesname = name.encode('utf-8') |
|
163 | 163 | > write(b"1) %s imported\n" % bytesname) |
|
164 | 164 | > eh = exthelper.exthelper() |
|
165 | 165 | > @eh.uisetup |
|
166 | 166 | > def _uisetup(ui): |
|
167 | 167 | > write(b"2) %s uisetup\n" % bytesname) |
|
168 | 168 | > @eh.extsetup |
|
169 | 169 | > def _extsetup(ui): |
|
170 | 170 | > write(b"3) %s extsetup\n" % bytesname) |
|
171 | 171 | > @eh.uipopulate |
|
172 | 172 | > def _uipopulate(ui): |
|
173 | 173 | > write(b"4) %s uipopulate\n" % bytesname) |
|
174 | 174 | > @eh.reposetup |
|
175 | 175 | > def _reposetup(ui, repo): |
|
176 | 176 | > write(b"5) %s reposetup\n" % bytesname) |
|
177 | 177 | > |
|
178 | 178 | > extsetup = eh.finalextsetup |
|
179 | 179 | > reposetup = eh.finalreposetup |
|
180 | 180 | > uipopulate = eh.finaluipopulate |
|
181 | 181 | > uisetup = eh.finaluisetup |
|
182 | 182 | > revsetpredicate = eh.revsetpredicate |
|
183 | 183 | > |
|
184 | 184 | > # custom predicate to check registration of functions at loading |
|
185 | 185 | > from mercurial import ( |
|
186 | 186 | > smartset, |
|
187 | 187 | > ) |
|
188 | 188 | > @eh.revsetpredicate(bytesname, safe=True) # safe=True for query via hgweb |
|
189 | 189 | > def custompredicate(repo, subset, x): |
|
190 | 190 | > return smartset.baseset([r for r in subset if r in {0}]) |
|
191 | 191 | > EOF |
|
192 | 192 | $ "$PYTHON" $TESTTMP/unflush.py foo.py |
|
193 | 193 | |
|
194 | 194 | $ cp foo.py bar.py |
|
195 | 195 | $ echo 'foo = foo.py' >> $HGRCPATH |
|
196 | 196 | $ echo 'bar = bar.py' >> $HGRCPATH |
|
197 | 197 | |
|
198 | 198 | Check normal command's load order of extensions and registration of functions |
|
199 | 199 | |
|
200 | 200 | On chg server, extension should be first set up by the server. Then |
|
201 | 201 | object-level setup should follow in the worker process. |
|
202 | 202 | |
|
203 | 203 | $ hg log -r "foo() and bar()" -q |
|
204 | 204 | 1) foo imported |
|
205 | 205 | 1) bar imported |
|
206 | 206 | 2) foo uisetup |
|
207 | 207 | 2) bar uisetup |
|
208 | 208 | 3) foo extsetup |
|
209 | 209 | 3) bar extsetup |
|
210 | 210 | 4) foo uipopulate |
|
211 | 211 | 4) bar uipopulate |
|
212 | 212 | 4) foo uipopulate |
|
213 | 213 | 4) bar uipopulate |
|
214 | 214 | 4) foo uipopulate |
|
215 | 215 | 4) bar uipopulate |
|
216 | 216 | 5) foo reposetup |
|
217 | 217 | 5) bar reposetup |
|
218 | 218 | 4) foo uipopulate (chg !) |
|
219 | 219 | 4) bar uipopulate (chg !) |
|
220 | 220 | 4) foo uipopulate (chg !) |
|
221 | 221 | 4) bar uipopulate (chg !) |
|
222 | 222 | 4) foo uipopulate (chg !) |
|
223 | 223 | 4) bar uipopulate (chg !) |
|
224 | 224 | 4) foo uipopulate (chg !) |
|
225 | 225 | 4) bar uipopulate (chg !) |
|
226 | 226 | 4) foo uipopulate (chg !) |
|
227 | 227 | 4) bar uipopulate (chg !) |
|
228 | 228 | 5) foo reposetup (chg !) |
|
229 | 229 | 5) bar reposetup (chg !) |
|
230 | 230 | 0:c24b9ac61126 |
|
231 | 231 | |
|
232 | 232 | Check hgweb's load order of extensions and registration of functions |
|
233 | 233 | |
|
234 | 234 | $ cat > hgweb.cgi <<EOF |
|
235 | 235 | > #!$PYTHON |
|
236 | 236 | > from mercurial import demandimport; demandimport.enable() |
|
237 | 237 | > from mercurial.hgweb import hgweb |
|
238 | 238 | > from mercurial.hgweb import wsgicgi |
|
239 | 239 | > application = hgweb(b'.', b'test repo') |
|
240 | 240 | > wsgicgi.launch(application) |
|
241 | 241 | > EOF |
|
242 | 242 | $ . "$TESTDIR/cgienv" |
|
243 | 243 | |
|
244 | 244 | $ PATH_INFO='/' SCRIPT_NAME='' "$PYTHON" hgweb.cgi \ |
|
245 | 245 | > | grep '^[0-9]) ' # ignores HTML output |
|
246 | 246 | 1) foo imported |
|
247 | 247 | 1) bar imported |
|
248 | 248 | 2) foo uisetup |
|
249 | 249 | 2) bar uisetup |
|
250 | 250 | 3) foo extsetup |
|
251 | 251 | 3) bar extsetup |
|
252 | 252 | 4) foo uipopulate |
|
253 | 253 | 4) bar uipopulate |
|
254 | 254 | 4) foo uipopulate |
|
255 | 255 | 4) bar uipopulate |
|
256 | 256 | 5) foo reposetup |
|
257 | 257 | 5) bar reposetup |
|
258 | 258 | |
|
259 | 259 | (check that revset predicate foo() and bar() are available) |
|
260 | 260 | |
|
261 | 261 | #if msys |
|
262 | 262 | $ PATH_INFO='//shortlog' |
|
263 | 263 | #else |
|
264 | 264 | $ PATH_INFO='/shortlog' |
|
265 | 265 | #endif |
|
266 | 266 | $ export PATH_INFO |
|
267 | 267 | $ SCRIPT_NAME='' QUERY_STRING='rev=foo() and bar()' "$PYTHON" hgweb.cgi \ |
|
268 | 268 | > | grep '<a href="/rev/[0-9a-z]*">' |
|
269 | 269 | <a href="/rev/c24b9ac61126">add file</a> |
|
270 | 270 | |
|
271 | 271 | $ echo 'foo = !' >> $HGRCPATH |
|
272 | 272 | $ echo 'bar = !' >> $HGRCPATH |
|
273 | 273 | |
|
274 | 274 | Check "from __future__ import absolute_import" support for external libraries |
|
275 | 275 | |
|
276 | 276 | (import-checker.py reports issues for some of heredoc python code |
|
277 | 277 | fragments below, because import-checker.py does not know test specific |
|
278 | 278 | package hierarchy. NO_CHECK_* should be used as a limit mark of |
|
279 | 279 | heredoc, in order to make import-checker.py ignore them. For |
|
280 | 280 | simplicity, all python code fragments below are generated with such |
|
281 | 281 | limit mark, regardless of importing module or not.) |
|
282 | 282 | |
|
283 | 283 | #if windows |
|
284 | 284 | $ PATHSEP=";" |
|
285 | 285 | #else |
|
286 | 286 | $ PATHSEP=":" |
|
287 | 287 | #endif |
|
288 | 288 | $ export PATHSEP |
|
289 | 289 | |
|
290 | 290 | $ mkdir $TESTTMP/libroot |
|
291 | 291 | $ echo "s = 'libroot/ambig.py'" > $TESTTMP/libroot/ambig.py |
|
292 | 292 | $ mkdir $TESTTMP/libroot/mod |
|
293 | 293 | $ touch $TESTTMP/libroot/mod/__init__.py |
|
294 | 294 | $ echo "s = 'libroot/mod/ambig.py'" > $TESTTMP/libroot/mod/ambig.py |
|
295 | 295 | |
|
296 | 296 | $ cat > $TESTTMP/libroot/mod/ambigabs.py <<NO_CHECK_EOF |
|
297 | 297 | > from __future__ import absolute_import, print_function |
|
298 | 298 | > import ambig # should load "libroot/ambig.py" |
|
299 | 299 | > s = ambig.s |
|
300 | 300 | > NO_CHECK_EOF |
|
301 | 301 | $ cat > loadabs.py <<NO_CHECK_EOF |
|
302 | 302 | > import mod.ambigabs as ambigabs |
|
303 | 303 | > def extsetup(ui): |
|
304 | 304 | > print('ambigabs.s=%s' % ambigabs.s, flush=True) |
|
305 | 305 | > NO_CHECK_EOF |
|
306 | 306 | $ "$PYTHON" $TESTTMP/unflush.py loadabs.py |
|
307 | 307 | $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadabs=loadabs.py root) |
|
308 | 308 | ambigabs.s=libroot/ambig.py |
|
309 | 309 | $TESTTMP/a |
|
310 | 310 | |
|
311 | 311 | #if no-py3 |
|
312 | 312 | $ cat > $TESTTMP/libroot/mod/ambigrel.py <<NO_CHECK_EOF |
|
313 | 313 | > from __future__ import print_function |
|
314 | 314 | > import ambig # should load "libroot/mod/ambig.py" |
|
315 | 315 | > s = ambig.s |
|
316 | 316 | > NO_CHECK_EOF |
|
317 | 317 | $ cat > loadrel.py <<NO_CHECK_EOF |
|
318 | 318 | > import mod.ambigrel as ambigrel |
|
319 | 319 | > def extsetup(ui): |
|
320 | 320 | > print('ambigrel.s=%s' % ambigrel.s, flush=True) |
|
321 | 321 | > NO_CHECK_EOF |
|
322 | 322 | $ "$PYTHON" $TESTTMP/unflush.py loadrel.py |
|
323 | 323 | $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadrel=loadrel.py root) |
|
324 | 324 | ambigrel.s=libroot/mod/ambig.py |
|
325 | 325 | $TESTTMP/a |
|
326 | 326 | #endif |
|
327 | 327 | |
|
328 | 328 | Check absolute/relative import of extension specific modules |
|
329 | 329 | |
|
330 | 330 | $ mkdir $TESTTMP/extroot |
|
331 | 331 | $ cat > $TESTTMP/extroot/bar.py <<NO_CHECK_EOF |
|
332 | 332 | > s = b'this is extroot.bar' |
|
333 | 333 | > NO_CHECK_EOF |
|
334 | 334 | $ mkdir $TESTTMP/extroot/sub1 |
|
335 | 335 | $ cat > $TESTTMP/extroot/sub1/__init__.py <<NO_CHECK_EOF |
|
336 | 336 | > s = b'this is extroot.sub1.__init__' |
|
337 | 337 | > NO_CHECK_EOF |
|
338 | 338 | $ cat > $TESTTMP/extroot/sub1/baz.py <<NO_CHECK_EOF |
|
339 | 339 | > s = b'this is extroot.sub1.baz' |
|
340 | 340 | > NO_CHECK_EOF |
|
341 | 341 | $ cat > $TESTTMP/extroot/__init__.py <<NO_CHECK_EOF |
|
342 | 342 | > from __future__ import absolute_import |
|
343 | 343 | > s = b'this is extroot.__init__' |
|
344 | 344 | > from . import foo |
|
345 | 345 | > def extsetup(ui): |
|
346 | 346 | > ui.write(b'(extroot) ', foo.func(), b'\n') |
|
347 | 347 | > ui.flush() |
|
348 | 348 | > NO_CHECK_EOF |
|
349 | 349 | |
|
350 | 350 | $ cat > $TESTTMP/extroot/foo.py <<NO_CHECK_EOF |
|
351 | 351 | > # test absolute import |
|
352 | 352 | > buf = [] |
|
353 | 353 | > def func(): |
|
354 | 354 | > # "not locals" case |
|
355 | 355 | > import extroot.bar |
|
356 | 356 | > buf.append(b'import extroot.bar in func(): %s' % extroot.bar.s) |
|
357 | 357 | > return b'\n(extroot) '.join(buf) |
|
358 | 358 | > # b"fromlist == ('*',)" case |
|
359 | 359 | > from extroot.bar import * |
|
360 | 360 | > buf.append(b'from extroot.bar import *: %s' % s) |
|
361 | 361 | > # "not fromlist" and "if '.' in name" case |
|
362 | 362 | > import extroot.sub1.baz |
|
363 | 363 | > buf.append(b'import extroot.sub1.baz: %s' % extroot.sub1.baz.s) |
|
364 | 364 | > # "not fromlist" and NOT "if '.' in name" case |
|
365 | 365 | > import extroot |
|
366 | 366 | > buf.append(b'import extroot: %s' % extroot.s) |
|
367 | 367 | > # NOT "not fromlist" and NOT "level != -1" case |
|
368 | 368 | > from extroot.bar import s |
|
369 | 369 | > buf.append(b'from extroot.bar import s: %s' % s) |
|
370 | 370 | > NO_CHECK_EOF |
|
371 | 371 | $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.extroot=$TESTTMP/extroot root) |
|
372 | 372 | (extroot) from extroot.bar import *: this is extroot.bar |
|
373 | 373 | (extroot) import extroot.sub1.baz: this is extroot.sub1.baz |
|
374 | 374 | (extroot) import extroot: this is extroot.__init__ |
|
375 | 375 | (extroot) from extroot.bar import s: this is extroot.bar |
|
376 | 376 | (extroot) import extroot.bar in func(): this is extroot.bar |
|
377 | 377 | $TESTTMP/a |
|
378 | 378 | |
|
379 | 379 | #if no-py3 |
|
380 | 380 | $ rm "$TESTTMP"/extroot/foo.* |
|
381 | 381 | $ rm -Rf "$TESTTMP/extroot/__pycache__" |
|
382 | 382 | $ cat > $TESTTMP/extroot/foo.py <<NO_CHECK_EOF |
|
383 | 383 | > # test relative import |
|
384 | 384 | > buf = [] |
|
385 | 385 | > def func(): |
|
386 | 386 | > # "not locals" case |
|
387 | 387 | > import bar |
|
388 | 388 | > buf.append('import bar in func(): %s' % bar.s) |
|
389 | 389 | > return '\n(extroot) '.join(buf) |
|
390 | 390 | > # "fromlist == ('*',)" case |
|
391 | 391 | > from bar import * |
|
392 | 392 | > buf.append('from bar import *: %s' % s) |
|
393 | 393 | > # "not fromlist" and "if '.' in name" case |
|
394 | 394 | > import sub1.baz |
|
395 | 395 | > buf.append('import sub1.baz: %s' % sub1.baz.s) |
|
396 | 396 | > # "not fromlist" and NOT "if '.' in name" case |
|
397 | 397 | > import sub1 |
|
398 | 398 | > buf.append('import sub1: %s' % sub1.s) |
|
399 | 399 | > # NOT "not fromlist" and NOT "level != -1" case |
|
400 | 400 | > from bar import s |
|
401 | 401 | > buf.append('from bar import s: %s' % s) |
|
402 | 402 | > NO_CHECK_EOF |
|
403 | 403 | $ hg --config extensions.extroot=$TESTTMP/extroot root |
|
404 | 404 | (extroot) from bar import *: this is extroot.bar |
|
405 | 405 | (extroot) import sub1.baz: this is extroot.sub1.baz |
|
406 | 406 | (extroot) import sub1: this is extroot.sub1.__init__ |
|
407 | 407 | (extroot) from bar import s: this is extroot.bar |
|
408 | 408 | (extroot) import bar in func(): this is extroot.bar |
|
409 | 409 | $TESTTMP/a |
|
410 | 410 | #endif |
|
411 | 411 | |
|
412 | 412 | #if demandimport |
|
413 | 413 | |
|
414 | 414 | Examine whether module loading is delayed until actual referring, even |
|
415 | 415 | though module is imported with "absolute_import" feature. |
|
416 | 416 | |
|
417 | 417 | Files below in each packages are used for described purpose: |
|
418 | 418 | |
|
419 | 419 | - "called": examine whether "from MODULE import ATTR" works correctly |
|
420 | 420 | - "unused": examine whether loading is delayed correctly |
|
421 | 421 | - "used": examine whether "from PACKAGE import MODULE" works correctly |
|
422 | 422 | |
|
423 | 423 | Package hierarchy is needed to examine whether demand importing works |
|
424 | 424 | as expected for "from SUB.PACK.AGE import MODULE". |
|
425 | 425 | |
|
426 | 426 | Setup "external library" to be imported with "absolute_import" |
|
427 | 427 | feature. |
|
428 | 428 | |
|
429 | 429 | $ mkdir -p $TESTTMP/extlibroot/lsub1/lsub2 |
|
430 | 430 | $ touch $TESTTMP/extlibroot/__init__.py |
|
431 | 431 | $ touch $TESTTMP/extlibroot/lsub1/__init__.py |
|
432 | 432 | $ touch $TESTTMP/extlibroot/lsub1/lsub2/__init__.py |
|
433 | 433 | |
|
434 | 434 | $ cat > $TESTTMP/extlibroot/lsub1/lsub2/called.py <<NO_CHECK_EOF |
|
435 | 435 | > def func(): |
|
436 | 436 | > return b"this is extlibroot.lsub1.lsub2.called.func()" |
|
437 | 437 | > NO_CHECK_EOF |
|
438 | 438 | $ cat > $TESTTMP/extlibroot/lsub1/lsub2/unused.py <<NO_CHECK_EOF |
|
439 | 439 | > raise Exception("extlibroot.lsub1.lsub2.unused is loaded unintentionally") |
|
440 | 440 | > NO_CHECK_EOF |
|
441 | 441 | $ cat > $TESTTMP/extlibroot/lsub1/lsub2/used.py <<NO_CHECK_EOF |
|
442 | 442 | > detail = b"this is extlibroot.lsub1.lsub2.used" |
|
443 | 443 | > NO_CHECK_EOF |
|
444 | 444 | |
|
445 | 445 | Setup sub-package of "external library", which causes instantiation of |
|
446 | 446 | demandmod in "recurse down the module chain" code path. Relative |
|
447 | 447 | importing with "absolute_import" feature isn't tested, because "level |
|
448 | 448 | >=1 " doesn't cause instantiation of demandmod. |
|
449 | 449 | |
|
450 | 450 | $ mkdir -p $TESTTMP/extlibroot/recursedown/abs |
|
451 | 451 | $ cat > $TESTTMP/extlibroot/recursedown/abs/used.py <<NO_CHECK_EOF |
|
452 | 452 | > detail = b"this is extlibroot.recursedown.abs.used" |
|
453 | 453 | > NO_CHECK_EOF |
|
454 | 454 | $ cat > $TESTTMP/extlibroot/recursedown/abs/__init__.py <<NO_CHECK_EOF |
|
455 | 455 | > from __future__ import absolute_import |
|
456 | 456 | > from extlibroot.recursedown.abs.used import detail |
|
457 | 457 | > NO_CHECK_EOF |
|
458 | 458 | |
|
459 | 459 | $ mkdir -p $TESTTMP/extlibroot/recursedown/legacy |
|
460 | 460 | $ cat > $TESTTMP/extlibroot/recursedown/legacy/used.py <<NO_CHECK_EOF |
|
461 | 461 | > detail = b"this is extlibroot.recursedown.legacy.used" |
|
462 | 462 | > NO_CHECK_EOF |
|
463 | 463 | $ cat > $TESTTMP/extlibroot/recursedown/legacy/__init__.py <<NO_CHECK_EOF |
|
464 | 464 | > # legacy style (level == -1) import |
|
465 | 465 | > from extlibroot.recursedown.legacy.used import detail |
|
466 | 466 | > NO_CHECK_EOF |
|
467 | 467 | |
|
468 | 468 | $ cat > $TESTTMP/extlibroot/recursedown/__init__.py <<NO_CHECK_EOF |
|
469 | 469 | > from __future__ import absolute_import |
|
470 | 470 | > from extlibroot.recursedown.abs import detail as absdetail |
|
471 | 471 | > from .legacy import detail as legacydetail |
|
472 | 472 | > NO_CHECK_EOF |
|
473 | 473 | |
|
474 | 474 | Setup package that re-exports an attribute of its submodule as the same |
|
475 | 475 | name. This leaves 'shadowing.used' pointing to 'used.detail', but still |
|
476 | 476 | the submodule 'used' should be somehow accessible. (issue5617) |
|
477 | 477 | |
|
478 | 478 | $ mkdir -p $TESTTMP/extlibroot/shadowing |
|
479 | 479 | $ cat > $TESTTMP/extlibroot/shadowing/used.py <<NO_CHECK_EOF |
|
480 | 480 | > detail = b"this is extlibroot.shadowing.used" |
|
481 | 481 | > NO_CHECK_EOF |
|
482 | 482 | $ cat > $TESTTMP/extlibroot/shadowing/proxied.py <<NO_CHECK_EOF |
|
483 | 483 | > from __future__ import absolute_import |
|
484 | 484 | > from extlibroot.shadowing.used import detail |
|
485 | 485 | > NO_CHECK_EOF |
|
486 | 486 | $ cat > $TESTTMP/extlibroot/shadowing/__init__.py <<NO_CHECK_EOF |
|
487 | 487 | > from __future__ import absolute_import |
|
488 | 488 | > from .used import detail as used |
|
489 | 489 | > NO_CHECK_EOF |
|
490 | 490 | |
|
491 | 491 | Setup extension local modules to be imported with "absolute_import" |
|
492 | 492 | feature. |
|
493 | 493 | |
|
494 | 494 | $ mkdir -p $TESTTMP/absextroot/xsub1/xsub2 |
|
495 | 495 | $ touch $TESTTMP/absextroot/xsub1/__init__.py |
|
496 | 496 | $ touch $TESTTMP/absextroot/xsub1/xsub2/__init__.py |
|
497 | 497 | |
|
498 | 498 | $ cat > $TESTTMP/absextroot/xsub1/xsub2/called.py <<NO_CHECK_EOF |
|
499 | 499 | > def func(): |
|
500 | 500 | > return b"this is absextroot.xsub1.xsub2.called.func()" |
|
501 | 501 | > NO_CHECK_EOF |
|
502 | 502 | $ cat > $TESTTMP/absextroot/xsub1/xsub2/unused.py <<NO_CHECK_EOF |
|
503 | 503 | > raise Exception("absextroot.xsub1.xsub2.unused is loaded unintentionally") |
|
504 | 504 | > NO_CHECK_EOF |
|
505 | 505 | $ cat > $TESTTMP/absextroot/xsub1/xsub2/used.py <<NO_CHECK_EOF |
|
506 | 506 | > detail = b"this is absextroot.xsub1.xsub2.used" |
|
507 | 507 | > NO_CHECK_EOF |
|
508 | 508 | |
|
509 | 509 | Setup extension local modules to examine whether demand importing |
|
510 | 510 | works as expected in "level > 1" case. |
|
511 | 511 | |
|
512 | 512 | $ cat > $TESTTMP/absextroot/relimportee.py <<NO_CHECK_EOF |
|
513 | 513 | > detail = b"this is absextroot.relimportee" |
|
514 | 514 | > NO_CHECK_EOF |
|
515 | 515 | $ cat > $TESTTMP/absextroot/xsub1/xsub2/relimporter.py <<NO_CHECK_EOF |
|
516 | 516 | > from __future__ import absolute_import |
|
517 | 517 | > from mercurial import pycompat |
|
518 | 518 | > from ... import relimportee |
|
519 | 519 | > detail = b"this relimporter imports %r" % ( |
|
520 | 520 | > pycompat.bytestr(relimportee.detail)) |
|
521 | 521 | > NO_CHECK_EOF |
|
522 | 522 | |
|
523 | 523 | Setup modules, which actually import extension local modules at |
|
524 | 524 | runtime. |
|
525 | 525 | |
|
526 | 526 | $ cat > $TESTTMP/absextroot/absolute.py << NO_CHECK_EOF |
|
527 | 527 | > from __future__ import absolute_import |
|
528 | 528 | > |
|
529 | 529 | > # import extension local modules absolutely (level = 0) |
|
530 | 530 | > from absextroot.xsub1.xsub2 import used, unused |
|
531 | 531 | > from absextroot.xsub1.xsub2.called import func |
|
532 | 532 | > |
|
533 | 533 | > def getresult(): |
|
534 | 534 | > result = [] |
|
535 | 535 | > result.append(used.detail) |
|
536 | 536 | > result.append(func()) |
|
537 | 537 | > return result |
|
538 | 538 | > NO_CHECK_EOF |
|
539 | 539 | |
|
540 | 540 | $ cat > $TESTTMP/absextroot/relative.py << NO_CHECK_EOF |
|
541 | 541 | > from __future__ import absolute_import |
|
542 | 542 | > |
|
543 | 543 | > # import extension local modules relatively (level == 1) |
|
544 | 544 | > from .xsub1.xsub2 import used, unused |
|
545 | 545 | > from .xsub1.xsub2.called import func |
|
546 | 546 | > |
|
547 | 547 | > # import a module, which implies "importing with level > 1" |
|
548 | 548 | > from .xsub1.xsub2 import relimporter |
|
549 | 549 | > |
|
550 | 550 | > def getresult(): |
|
551 | 551 | > result = [] |
|
552 | 552 | > result.append(used.detail) |
|
553 | 553 | > result.append(func()) |
|
554 | 554 | > result.append(relimporter.detail) |
|
555 | 555 | > return result |
|
556 | 556 | > NO_CHECK_EOF |
|
557 | 557 | |
|
558 | 558 | Setup main procedure of extension. |
|
559 | 559 | |
|
560 | 560 | $ cat > $TESTTMP/absextroot/__init__.py <<NO_CHECK_EOF |
|
561 | 561 | > from __future__ import absolute_import |
|
562 | 562 | > from mercurial import registrar |
|
563 | 563 | > cmdtable = {} |
|
564 | 564 | > command = registrar.command(cmdtable) |
|
565 | 565 | > |
|
566 | 566 | > # "absolute" and "relative" shouldn't be imported before actual |
|
567 | 567 | > # command execution, because (1) they import same modules, and (2) |
|
568 | 568 | > # preceding import (= instantiate "demandmod" object instead of |
|
569 | 569 | > # real "module" object) might hide problem of succeeding import. |
|
570 | 570 | > |
|
571 | 571 | > @command(b'showabsolute', [], norepo=True) |
|
572 | 572 | > def showabsolute(ui, *args, **opts): |
|
573 | 573 | > from absextroot import absolute |
|
574 | 574 | > ui.write(b'ABS: %s\n' % b'\nABS: '.join(absolute.getresult())) |
|
575 | 575 | > |
|
576 | 576 | > @command(b'showrelative', [], norepo=True) |
|
577 | 577 | > def showrelative(ui, *args, **opts): |
|
578 | 578 | > from . import relative |
|
579 | 579 | > ui.write(b'REL: %s\n' % b'\nREL: '.join(relative.getresult())) |
|
580 | 580 | > |
|
581 | 581 | > # import modules from external library |
|
582 | 582 | > from extlibroot.lsub1.lsub2 import used as lused, unused as lunused |
|
583 | 583 | > from extlibroot.lsub1.lsub2.called import func as lfunc |
|
584 | 584 | > from extlibroot.recursedown import absdetail, legacydetail |
|
585 | 585 | > from extlibroot.shadowing import proxied |
|
586 | 586 | > |
|
587 | 587 | > def uisetup(ui): |
|
588 | 588 | > result = [] |
|
589 | 589 | > result.append(lused.detail) |
|
590 | 590 | > result.append(lfunc()) |
|
591 | 591 | > result.append(absdetail) |
|
592 | 592 | > result.append(legacydetail) |
|
593 | 593 | > result.append(proxied.detail) |
|
594 | 594 | > ui.write(b'LIB: %s\n' % b'\nLIB: '.join(result)) |
|
595 | 595 | > NO_CHECK_EOF |
|
596 | 596 | |
|
597 | 597 | Examine module importing. |
|
598 | 598 | |
|
599 | 599 | $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.absextroot=$TESTTMP/absextroot showabsolute) |
|
600 | 600 | LIB: this is extlibroot.lsub1.lsub2.used |
|
601 | 601 | LIB: this is extlibroot.lsub1.lsub2.called.func() |
|
602 | 602 | LIB: this is extlibroot.recursedown.abs.used |
|
603 | 603 | LIB: this is extlibroot.recursedown.legacy.used |
|
604 | 604 | LIB: this is extlibroot.shadowing.used |
|
605 | 605 | ABS: this is absextroot.xsub1.xsub2.used |
|
606 | 606 | ABS: this is absextroot.xsub1.xsub2.called.func() |
|
607 | 607 | |
|
608 | 608 | $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.absextroot=$TESTTMP/absextroot showrelative) |
|
609 | 609 | LIB: this is extlibroot.lsub1.lsub2.used |
|
610 | 610 | LIB: this is extlibroot.lsub1.lsub2.called.func() |
|
611 | 611 | LIB: this is extlibroot.recursedown.abs.used |
|
612 | 612 | LIB: this is extlibroot.recursedown.legacy.used |
|
613 | 613 | LIB: this is extlibroot.shadowing.used |
|
614 | 614 | REL: this is absextroot.xsub1.xsub2.used |
|
615 | 615 | REL: this is absextroot.xsub1.xsub2.called.func() |
|
616 | 616 | REL: this relimporter imports 'this is absextroot.relimportee' |
|
617 | 617 | |
|
618 | 618 | Examine whether sub-module is imported relatively as expected. |
|
619 | 619 | |
|
620 | 620 | See also issue5208 for detail about example case on Python 3.x. |
|
621 | 621 | |
|
622 | 622 | $ f -q $TESTTMP/extlibroot/lsub1/lsub2/notexist.py |
|
623 | 623 | $TESTTMP/extlibroot/lsub1/lsub2/notexist.py: file not found |
|
624 | 624 | |
|
625 | 625 | $ cat > $TESTTMP/notexist.py <<NO_CHECK_EOF |
|
626 | 626 | > text = 'notexist.py at root is loaded unintentionally\n' |
|
627 | 627 | > NO_CHECK_EOF |
|
628 | 628 | |
|
629 | 629 | $ cat > $TESTTMP/checkrelativity.py <<NO_CHECK_EOF |
|
630 | 630 | > from mercurial import registrar |
|
631 | 631 | > cmdtable = {} |
|
632 | 632 | > command = registrar.command(cmdtable) |
|
633 | 633 | > |
|
634 | 634 | > # demand import avoids failure of importing notexist here, but only on |
|
635 | 635 | > # Python 2. |
|
636 | 636 | > import extlibroot.lsub1.lsub2.notexist |
|
637 | 637 | > |
|
638 | 638 | > @command(b'checkrelativity', [], norepo=True) |
|
639 | 639 | > def checkrelativity(ui, *args, **opts): |
|
640 | 640 | > try: |
|
641 | 641 | > ui.write(extlibroot.lsub1.lsub2.notexist.text) |
|
642 | 642 | > return 1 # unintentional success |
|
643 | 643 | > except ImportError: |
|
644 | 644 | > pass # intentional failure |
|
645 | 645 | > NO_CHECK_EOF |
|
646 | 646 | |
|
647 | 647 | Python 3's lazy importer verifies modules exist before returning the lazy |
|
648 | 648 | module stub. Our custom lazy importer for Python 2 always returns a stub. |
|
649 | 649 | |
|
650 | 650 | $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.checkrelativity=$TESTTMP/checkrelativity.py checkrelativity) || true |
|
651 | 651 | *** failed to import extension checkrelativity from $TESTTMP/checkrelativity.py: No module named 'extlibroot.lsub1.lsub2.notexist' (py3 !) |
|
652 | 652 | hg: unknown command 'checkrelativity' (py3 !) |
|
653 | 653 | (use 'hg help' for a list of commands) (py3 !) |
|
654 | 654 | |
|
655 | 655 | #endif |
|
656 | 656 | |
|
657 | 657 | (Here, module importing tests are finished. Therefore, use other than |
|
658 | 658 | NO_CHECK_* limit mark for heredoc python files, in order to apply |
|
659 | 659 | import-checker.py or so on their contents) |
|
660 | 660 | |
|
661 | 661 | Make sure a broken uisetup doesn't globally break hg: |
|
662 | 662 | $ cat > $TESTTMP/baduisetup.py <<EOF |
|
663 | 663 | > def uisetup(ui): |
|
664 | 664 | > 1 / 0 |
|
665 | 665 | > EOF |
|
666 | 666 | |
|
667 | 667 | Even though the extension fails during uisetup, hg is still basically usable: |
|
668 | 668 | $ hg --config extensions.baduisetup=$TESTTMP/baduisetup.py version |
|
669 | 669 | Traceback (most recent call last): |
|
670 | 670 | File "*/mercurial/extensions.py", line *, in _runuisetup (glob) |
|
671 | 671 | uisetup(ui) |
|
672 | 672 | File "$TESTTMP/baduisetup.py", line 2, in uisetup |
|
673 | 673 | 1 / 0 |
|
674 | 674 | ZeroDivisionError: * by zero (glob) |
|
675 | 675 | *** failed to set up extension baduisetup: * by zero (glob) |
|
676 | 676 | Mercurial Distributed SCM (version *) (glob) |
|
677 | 677 | (see https://mercurial-scm.org for more information) |
|
678 | 678 | |
|
679 | 679 | Copyright (C) 2005-* Matt Mackall and others (glob) |
|
680 | 680 | This is free software; see the source for copying conditions. There is NO |
|
681 | 681 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
682 | 682 | |
|
683 | 683 | $ cd .. |
|
684 | 684 | |
|
685 | 685 | hide outer repo |
|
686 | 686 | $ hg init |
|
687 | 687 | |
|
688 | 688 | $ cat > empty.py <<EOF |
|
689 | 689 | > '''empty cmdtable |
|
690 | 690 | > ''' |
|
691 | 691 | > cmdtable = {} |
|
692 | 692 | > EOF |
|
693 | 693 | $ emptypath=`pwd`/empty.py |
|
694 | 694 | $ echo "empty = $emptypath" >> $HGRCPATH |
|
695 | 695 | $ hg help empty |
|
696 | 696 | empty extension - empty cmdtable |
|
697 | 697 | |
|
698 | 698 | no commands defined |
|
699 | 699 | |
|
700 | 700 | |
|
701 | 701 | $ echo 'empty = !' >> $HGRCPATH |
|
702 | 702 | |
|
703 | 703 | $ cat > debugextension.py <<EOF |
|
704 | 704 | > '''only debugcommands |
|
705 | 705 | > ''' |
|
706 | 706 | > from mercurial import registrar |
|
707 | 707 | > cmdtable = {} |
|
708 | 708 | > command = registrar.command(cmdtable) |
|
709 | 709 | > @command(b'debugfoobar', [], b'hg debugfoobar') |
|
710 | 710 | > def debugfoobar(ui, repo, *args, **opts): |
|
711 | 711 | > "yet another debug command" |
|
712 | 712 | > @command(b'foo', [], b'hg foo') |
|
713 | 713 | > def foo(ui, repo, *args, **opts): |
|
714 | 714 | > """yet another foo command |
|
715 | 715 | > This command has been DEPRECATED since forever. |
|
716 | 716 | > """ |
|
717 | 717 | > EOF |
|
718 | 718 | $ debugpath=`pwd`/debugextension.py |
|
719 | 719 | $ echo "debugextension = $debugpath" >> $HGRCPATH |
|
720 | 720 | |
|
721 | 721 | $ hg help debugextension |
|
722 | 722 | hg debugextensions |
|
723 | 723 | |
|
724 | 724 | show information about active extensions |
|
725 | 725 | |
|
726 | 726 | options: |
|
727 | 727 | |
|
728 | 728 | -T --template TEMPLATE display with template |
|
729 | 729 | |
|
730 | 730 | (some details hidden, use --verbose to show complete help) |
|
731 | 731 | |
|
732 | 732 | |
|
733 | 733 | $ hg --verbose help debugextension |
|
734 | 734 | hg debugextensions |
|
735 | 735 | |
|
736 | 736 | show information about active extensions |
|
737 | 737 | |
|
738 | 738 | options: |
|
739 | 739 | |
|
740 | 740 | -T --template TEMPLATE display with template |
|
741 | 741 | |
|
742 | 742 | global options ([+] can be repeated): |
|
743 | 743 | |
|
744 | 744 | -R --repository REPO repository root directory or name of overlay bundle |
|
745 | 745 | file |
|
746 | 746 | --cwd DIR change working directory |
|
747 | 747 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
748 | 748 | all prompts |
|
749 | 749 | -q --quiet suppress output |
|
750 | 750 | -v --verbose enable additional output |
|
751 | 751 | --color TYPE when to colorize (boolean, always, auto, never, or |
|
752 | 752 | debug) |
|
753 | 753 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
754 | 754 | --debug enable debugging output |
|
755 | 755 | --debugger start debugger |
|
756 | 756 | --encoding ENCODE set the charset encoding (default: ascii) |
|
757 | 757 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
758 | 758 | --traceback always print a traceback on exception |
|
759 | 759 | --time time how long the command takes |
|
760 | 760 | --profile print command execution profile |
|
761 | 761 | --version output version information and exit |
|
762 | 762 | -h --help display help and exit |
|
763 | 763 | --hidden consider hidden changesets |
|
764 | 764 | --pager TYPE when to paginate (boolean, always, auto, or never) |
|
765 | 765 | (default: auto) |
|
766 | 766 | |
|
767 | 767 | |
|
768 | 768 | |
|
769 | 769 | |
|
770 | 770 | |
|
771 | 771 | |
|
772 | 772 | $ hg --debug help debugextension |
|
773 | 773 | hg debugextensions |
|
774 | 774 | |
|
775 | 775 | show information about active extensions |
|
776 | 776 | |
|
777 | 777 | options: |
|
778 | 778 | |
|
779 | 779 | -T --template TEMPLATE display with template |
|
780 | 780 | |
|
781 | 781 | global options ([+] can be repeated): |
|
782 | 782 | |
|
783 | 783 | -R --repository REPO repository root directory or name of overlay bundle |
|
784 | 784 | file |
|
785 | 785 | --cwd DIR change working directory |
|
786 | 786 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
787 | 787 | all prompts |
|
788 | 788 | -q --quiet suppress output |
|
789 | 789 | -v --verbose enable additional output |
|
790 | 790 | --color TYPE when to colorize (boolean, always, auto, never, or |
|
791 | 791 | debug) |
|
792 | 792 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
793 | 793 | --debug enable debugging output |
|
794 | 794 | --debugger start debugger |
|
795 | 795 | --encoding ENCODE set the charset encoding (default: ascii) |
|
796 | 796 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
797 | 797 | --traceback always print a traceback on exception |
|
798 | 798 | --time time how long the command takes |
|
799 | 799 | --profile print command execution profile |
|
800 | 800 | --version output version information and exit |
|
801 | 801 | -h --help display help and exit |
|
802 | 802 | --hidden consider hidden changesets |
|
803 | 803 | --pager TYPE when to paginate (boolean, always, auto, or never) |
|
804 | 804 | (default: auto) |
|
805 | 805 | |
|
806 | 806 | |
|
807 | 807 | |
|
808 | 808 | |
|
809 | 809 | |
|
810 | 810 | $ echo 'debugextension = !' >> $HGRCPATH |
|
811 | 811 | |
|
812 | 812 | Asking for help about a deprecated extension should do something useful: |
|
813 | 813 | |
|
814 | 814 | $ hg help glog |
|
815 | 815 | 'glog' is provided by the following extension: |
|
816 | 816 | |
|
817 | 817 | graphlog command to view revision graphs from a shell (DEPRECATED) |
|
818 | 818 | |
|
819 | 819 | (use 'hg help extensions' for information on enabling extensions) |
|
820 | 820 | |
|
821 | 821 | Extension module help vs command help: |
|
822 | 822 | |
|
823 | 823 | $ echo 'extdiff =' >> $HGRCPATH |
|
824 | 824 | $ hg help extdiff |
|
825 | 825 | hg extdiff [OPT]... [FILE]... |
|
826 | 826 | |
|
827 | 827 | use external program to diff repository (or selected files) |
|
828 | 828 | |
|
829 | 829 | Show differences between revisions for the specified files, using an |
|
830 | 830 | external program. The default program used is diff, with default options |
|
831 | 831 | "-Npru". |
|
832 | 832 | |
|
833 | 833 | To select a different program, use the -p/--program option. The program |
|
834 | 834 | will be passed the names of two directories to compare, unless the --per- |
|
835 | 835 | file option is specified (see below). To pass additional options to the |
|
836 | 836 | program, use -o/--option. These will be passed before the names of the |
|
837 | 837 | directories or files to compare. |
|
838 | 838 | |
|
839 | 839 | The --from, --to, and --change options work the same way they do for 'hg |
|
840 | 840 | diff'. |
|
841 | 841 | |
|
842 | 842 | The --per-file option runs the external program repeatedly on each file to |
|
843 | 843 | diff, instead of once on two directories. By default, this happens one by |
|
844 | 844 | one, where the next file diff is open in the external program only once |
|
845 | 845 | the previous external program (for the previous file diff) has exited. If |
|
846 | 846 | the external program has a graphical interface, it can open all the file |
|
847 | 847 | diffs at once instead of one by one. See 'hg help -e extdiff' for |
|
848 | 848 | information about how to tell Mercurial that a given program has a |
|
849 | 849 | graphical interface. |
|
850 | 850 | |
|
851 | 851 | The --confirm option will prompt the user before each invocation of the |
|
852 | 852 | external program. It is ignored if --per-file isn't specified. |
|
853 | 853 | |
|
854 | 854 | (use 'hg help -e extdiff' to show help for the extdiff extension) |
|
855 | 855 | |
|
856 | 856 | options ([+] can be repeated): |
|
857 | 857 | |
|
858 | 858 | -p --program CMD comparison program to run |
|
859 | 859 | -o --option OPT [+] pass option to comparison program |
|
860 | 860 | --from REV1 revision to diff from |
|
861 | 861 | --to REV2 revision to diff to |
|
862 | 862 | -c --change REV change made by revision |
|
863 | 863 | --per-file compare each file instead of revision snapshots |
|
864 | 864 | --confirm prompt user before each external program invocation |
|
865 | 865 | --patch compare patches for two revisions |
|
866 | 866 | -I --include PATTERN [+] include names matching the given patterns |
|
867 | 867 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
868 | 868 | -S --subrepos recurse into subrepositories |
|
869 | 869 | |
|
870 | 870 | (some details hidden, use --verbose to show complete help) |
|
871 | 871 | |
|
872 | 872 | |
|
873 | 873 | |
|
874 | 874 | |
|
875 | 875 | |
|
876 | 876 | |
|
877 | 877 | |
|
878 | 878 | |
|
879 | 879 | |
|
880 | 880 | |
|
881 | 881 | $ hg help --extension extdiff |
|
882 | 882 | extdiff extension - command to allow external programs to compare revisions |
|
883 | 883 | |
|
884 | 884 | The extdiff Mercurial extension allows you to use external programs to compare |
|
885 | 885 | revisions, or revision with working directory. The external diff programs are |
|
886 | 886 | called with a configurable set of options and two non-option arguments: paths |
|
887 | 887 | to directories containing snapshots of files to compare. |
|
888 | 888 | |
|
889 | 889 | If there is more than one file being compared and the "child" revision is the |
|
890 | 890 | working directory, any modifications made in the external diff program will be |
|
891 | 891 | copied back to the working directory from the temporary directory. |
|
892 | 892 | |
|
893 | 893 | The extdiff extension also allows you to configure new diff commands, so you |
|
894 | 894 | do not need to type 'hg extdiff -p kdiff3' always. |
|
895 | 895 | |
|
896 | 896 | [extdiff] |
|
897 | 897 | # add new command that runs GNU diff(1) in 'context diff' mode |
|
898 | 898 | cdiff = gdiff -Nprc5 |
|
899 | 899 | ## or the old way: |
|
900 | 900 | #cmd.cdiff = gdiff |
|
901 | 901 | #opts.cdiff = -Nprc5 |
|
902 | 902 | |
|
903 | 903 | # add new command called meld, runs meld (no need to name twice). If |
|
904 | 904 | # the meld executable is not available, the meld tool in [merge-tools] |
|
905 | 905 | # will be used, if available |
|
906 | 906 | meld = |
|
907 | 907 | |
|
908 | 908 | # add new command called vimdiff, runs gvimdiff with DirDiff plugin |
|
909 | 909 | # (see http://www.vim.org/scripts/script.php?script_id=102) Non |
|
910 | 910 | # English user, be sure to put "let g:DirDiffDynamicDiffText = 1" in |
|
911 | 911 | # your .vimrc |
|
912 | 912 | vimdiff = gvim -f "+next" \ |
|
913 | 913 | "+execute 'DirDiff' fnameescape(argv(0)) fnameescape(argv(1))" |
|
914 | 914 | |
|
915 | 915 | Tool arguments can include variables that are expanded at runtime: |
|
916 | 916 | |
|
917 | 917 | $parent1, $plabel1 - filename, descriptive label of first parent |
|
918 | 918 | $child, $clabel - filename, descriptive label of child revision |
|
919 | 919 | $parent2, $plabel2 - filename, descriptive label of second parent |
|
920 | 920 | $root - repository root |
|
921 | 921 | $parent is an alias for $parent1. |
|
922 | 922 | |
|
923 | 923 | The extdiff extension will look in your [diff-tools] and [merge-tools] |
|
924 | 924 | sections for diff tool arguments, when none are specified in [extdiff]. |
|
925 | 925 | |
|
926 | 926 | [extdiff] |
|
927 | 927 | kdiff3 = |
|
928 | 928 | |
|
929 | 929 | [diff-tools] |
|
930 | 930 | kdiff3.diffargs=--L1 '$plabel1' --L2 '$clabel' $parent $child |
|
931 | 931 | |
|
932 | 932 | If a program has a graphical interface, it might be interesting to tell |
|
933 | 933 | Mercurial about it. It will prevent the program from being mistakenly used in |
|
934 | 934 | a terminal-only environment (such as an SSH terminal session), and will make |
|
935 | 935 | 'hg extdiff --per-file' open multiple file diffs at once instead of one by one |
|
936 | 936 | (if you still want to open file diffs one by one, you can use the --confirm |
|
937 | 937 | option). |
|
938 | 938 | |
|
939 | 939 | Declaring that a tool has a graphical interface can be done with the "gui" |
|
940 | 940 | flag next to where "diffargs" are specified: |
|
941 | 941 | |
|
942 | 942 | [diff-tools] |
|
943 | 943 | kdiff3.diffargs=--L1 '$plabel1' --L2 '$clabel' $parent $child |
|
944 | 944 | kdiff3.gui = true |
|
945 | 945 | |
|
946 | 946 | You can use -I/-X and list of file or directory names like normal 'hg diff' |
|
947 | 947 | command. The extdiff extension makes snapshots of only needed files, so |
|
948 | 948 | running the external diff program will actually be pretty fast (at least |
|
949 | 949 | faster than having to compare the entire tree). |
|
950 | 950 | |
|
951 | 951 | list of commands: |
|
952 | 952 | |
|
953 | 953 | extdiff use external program to diff repository (or selected files) |
|
954 | 954 | |
|
955 | 955 | (use 'hg help -v -e extdiff' to show built-in aliases and global options) |
|
956 | 956 | |
|
957 | 957 | |
|
958 | 958 | |
|
959 | 959 | |
|
960 | 960 | |
|
961 | 961 | |
|
962 | 962 | |
|
963 | 963 | |
|
964 | 964 | |
|
965 | 965 | |
|
966 | 966 | |
|
967 | 967 | |
|
968 | 968 | |
|
969 | 969 | |
|
970 | 970 | |
|
971 | 971 | |
|
972 | 972 | $ echo 'extdiff = !' >> $HGRCPATH |
|
973 | 973 | |
|
974 | 974 | Test help topic with same name as extension |
|
975 | 975 | |
|
976 | 976 | $ cat > multirevs.py <<EOF |
|
977 | 977 | > from mercurial import commands, registrar |
|
978 | 978 | > cmdtable = {} |
|
979 | 979 | > command = registrar.command(cmdtable) |
|
980 | 980 | > """multirevs extension |
|
981 | 981 | > Big multi-line module docstring.""" |
|
982 | 982 | > @command(b'multirevs', [], b'ARG', norepo=True) |
|
983 | 983 | > def multirevs(ui, repo, arg, *args, **opts): |
|
984 | 984 | > """multirevs command""" |
|
985 | 985 | > EOF |
|
986 | 986 | $ echo "multirevs = multirevs.py" >> $HGRCPATH |
|
987 | 987 | |
|
988 | 988 | $ hg help multirevs | tail |
|
989 | 989 | used): |
|
990 | 990 | |
|
991 | 991 | hg update :@ |
|
992 | 992 | |
|
993 | 993 | - Show diff between tags 1.3 and 1.5 (this works because the first and the |
|
994 | 994 | last revisions of the revset are used): |
|
995 | 995 | |
|
996 | 996 | hg diff -r 1.3::1.5 |
|
997 | 997 | |
|
998 | 998 | use 'hg help -c multirevs' to see help for the multirevs command |
|
999 | 999 | |
|
1000 | 1000 | |
|
1001 | 1001 | |
|
1002 | 1002 | |
|
1003 | 1003 | |
|
1004 | 1004 | |
|
1005 | 1005 | $ hg help -c multirevs |
|
1006 | 1006 | hg multirevs ARG |
|
1007 | 1007 | |
|
1008 | 1008 | multirevs command |
|
1009 | 1009 | |
|
1010 | 1010 | (some details hidden, use --verbose to show complete help) |
|
1011 | 1011 | |
|
1012 | 1012 | |
|
1013 | 1013 | |
|
1014 | 1014 | $ hg multirevs |
|
1015 | 1015 | hg multirevs: invalid arguments |
|
1016 | 1016 | hg multirevs ARG |
|
1017 | 1017 | |
|
1018 | 1018 | multirevs command |
|
1019 | 1019 | |
|
1020 | 1020 | (use 'hg multirevs -h' to show more help) |
|
1021 |
[ |
|
|
1021 | [10] | |
|
1022 | 1022 | |
|
1023 | 1023 | |
|
1024 | 1024 | |
|
1025 | 1025 | $ echo "multirevs = !" >> $HGRCPATH |
|
1026 | 1026 | |
|
1027 | 1027 | Issue811: Problem loading extensions twice (by site and by user) |
|
1028 | 1028 | |
|
1029 | 1029 | $ cat <<EOF >> $HGRCPATH |
|
1030 | 1030 | > mq = |
|
1031 | 1031 | > strip = |
|
1032 | 1032 | > hgext.mq = |
|
1033 | 1033 | > hgext/mq = |
|
1034 | 1034 | > EOF |
|
1035 | 1035 | |
|
1036 | 1036 | Show extensions: |
|
1037 | 1037 | (note that mq force load strip, also checking it's not loaded twice) |
|
1038 | 1038 | |
|
1039 | 1039 | #if no-extraextensions |
|
1040 | 1040 | $ hg debugextensions |
|
1041 | 1041 | mq |
|
1042 | 1042 | strip |
|
1043 | 1043 | #endif |
|
1044 | 1044 | |
|
1045 | 1045 | For extensions, which name matches one of its commands, help |
|
1046 | 1046 | message should ask '-v -e' to get list of built-in aliases |
|
1047 | 1047 | along with extension help itself |
|
1048 | 1048 | |
|
1049 | 1049 | $ mkdir $TESTTMP/d |
|
1050 | 1050 | $ cat > $TESTTMP/d/dodo.py <<EOF |
|
1051 | 1051 | > """ |
|
1052 | 1052 | > This is an awesome 'dodo' extension. It does nothing and |
|
1053 | 1053 | > writes 'Foo foo' |
|
1054 | 1054 | > """ |
|
1055 | 1055 | > from mercurial import commands, registrar |
|
1056 | 1056 | > cmdtable = {} |
|
1057 | 1057 | > command = registrar.command(cmdtable) |
|
1058 | 1058 | > @command(b'dodo', [], b'hg dodo') |
|
1059 | 1059 | > def dodo(ui, *args, **kwargs): |
|
1060 | 1060 | > """Does nothing""" |
|
1061 | 1061 | > ui.write(b"I do nothing. Yay\\n") |
|
1062 | 1062 | > @command(b'foofoo', [], b'hg foofoo') |
|
1063 | 1063 | > def foofoo(ui, *args, **kwargs): |
|
1064 | 1064 | > """Writes 'Foo foo'""" |
|
1065 | 1065 | > ui.write(b"Foo foo\\n") |
|
1066 | 1066 | > EOF |
|
1067 | 1067 | $ dodopath=$TESTTMP/d/dodo.py |
|
1068 | 1068 | |
|
1069 | 1069 | $ echo "dodo = $dodopath" >> $HGRCPATH |
|
1070 | 1070 | |
|
1071 | 1071 | Make sure that user is asked to enter '-v -e' to get list of built-in aliases |
|
1072 | 1072 | $ hg help -e dodo |
|
1073 | 1073 | dodo extension - |
|
1074 | 1074 | |
|
1075 | 1075 | This is an awesome 'dodo' extension. It does nothing and writes 'Foo foo' |
|
1076 | 1076 | |
|
1077 | 1077 | list of commands: |
|
1078 | 1078 | |
|
1079 | 1079 | dodo Does nothing |
|
1080 | 1080 | foofoo Writes 'Foo foo' |
|
1081 | 1081 | |
|
1082 | 1082 | (use 'hg help -v -e dodo' to show built-in aliases and global options) |
|
1083 | 1083 | |
|
1084 | 1084 | Make sure that '-v -e' prints list of built-in aliases along with |
|
1085 | 1085 | extension help itself |
|
1086 | 1086 | $ hg help -v -e dodo |
|
1087 | 1087 | dodo extension - |
|
1088 | 1088 | |
|
1089 | 1089 | This is an awesome 'dodo' extension. It does nothing and writes 'Foo foo' |
|
1090 | 1090 | |
|
1091 | 1091 | list of commands: |
|
1092 | 1092 | |
|
1093 | 1093 | dodo Does nothing |
|
1094 | 1094 | foofoo Writes 'Foo foo' |
|
1095 | 1095 | |
|
1096 | 1096 | global options ([+] can be repeated): |
|
1097 | 1097 | |
|
1098 | 1098 | -R --repository REPO repository root directory or name of overlay bundle |
|
1099 | 1099 | file |
|
1100 | 1100 | --cwd DIR change working directory |
|
1101 | 1101 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
1102 | 1102 | all prompts |
|
1103 | 1103 | -q --quiet suppress output |
|
1104 | 1104 | -v --verbose enable additional output |
|
1105 | 1105 | --color TYPE when to colorize (boolean, always, auto, never, or |
|
1106 | 1106 | debug) |
|
1107 | 1107 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
1108 | 1108 | --debug enable debugging output |
|
1109 | 1109 | --debugger start debugger |
|
1110 | 1110 | --encoding ENCODE set the charset encoding (default: ascii) |
|
1111 | 1111 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
1112 | 1112 | --traceback always print a traceback on exception |
|
1113 | 1113 | --time time how long the command takes |
|
1114 | 1114 | --profile print command execution profile |
|
1115 | 1115 | --version output version information and exit |
|
1116 | 1116 | -h --help display help and exit |
|
1117 | 1117 | --hidden consider hidden changesets |
|
1118 | 1118 | --pager TYPE when to paginate (boolean, always, auto, or never) |
|
1119 | 1119 | (default: auto) |
|
1120 | 1120 | |
|
1121 | 1121 | Make sure that single '-v' option shows help and built-ins only for 'dodo' command |
|
1122 | 1122 | $ hg help -v dodo |
|
1123 | 1123 | hg dodo |
|
1124 | 1124 | |
|
1125 | 1125 | Does nothing |
|
1126 | 1126 | |
|
1127 | 1127 | (use 'hg help -e dodo' to show help for the dodo extension) |
|
1128 | 1128 | |
|
1129 | 1129 | options: |
|
1130 | 1130 | |
|
1131 | 1131 | --mq operate on patch repository |
|
1132 | 1132 | |
|
1133 | 1133 | global options ([+] can be repeated): |
|
1134 | 1134 | |
|
1135 | 1135 | -R --repository REPO repository root directory or name of overlay bundle |
|
1136 | 1136 | file |
|
1137 | 1137 | --cwd DIR change working directory |
|
1138 | 1138 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
1139 | 1139 | all prompts |
|
1140 | 1140 | -q --quiet suppress output |
|
1141 | 1141 | -v --verbose enable additional output |
|
1142 | 1142 | --color TYPE when to colorize (boolean, always, auto, never, or |
|
1143 | 1143 | debug) |
|
1144 | 1144 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
1145 | 1145 | --debug enable debugging output |
|
1146 | 1146 | --debugger start debugger |
|
1147 | 1147 | --encoding ENCODE set the charset encoding (default: ascii) |
|
1148 | 1148 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
1149 | 1149 | --traceback always print a traceback on exception |
|
1150 | 1150 | --time time how long the command takes |
|
1151 | 1151 | --profile print command execution profile |
|
1152 | 1152 | --version output version information and exit |
|
1153 | 1153 | -h --help display help and exit |
|
1154 | 1154 | --hidden consider hidden changesets |
|
1155 | 1155 | --pager TYPE when to paginate (boolean, always, auto, or never) |
|
1156 | 1156 | (default: auto) |
|
1157 | 1157 | |
|
1158 | 1158 | In case when extension name doesn't match any of its commands, |
|
1159 | 1159 | help message should ask for '-v' to get list of built-in aliases |
|
1160 | 1160 | along with extension help |
|
1161 | 1161 | $ cat > $TESTTMP/d/dudu.py <<EOF |
|
1162 | 1162 | > """ |
|
1163 | 1163 | > This is an awesome 'dudu' extension. It does something and |
|
1164 | 1164 | > also writes 'Beep beep' |
|
1165 | 1165 | > """ |
|
1166 | 1166 | > from mercurial import commands, registrar |
|
1167 | 1167 | > cmdtable = {} |
|
1168 | 1168 | > command = registrar.command(cmdtable) |
|
1169 | 1169 | > @command(b'something', [], b'hg something') |
|
1170 | 1170 | > def something(ui, *args, **kwargs): |
|
1171 | 1171 | > """Does something""" |
|
1172 | 1172 | > ui.write(b"I do something. Yaaay\\n") |
|
1173 | 1173 | > @command(b'beep', [], b'hg beep') |
|
1174 | 1174 | > def beep(ui, *args, **kwargs): |
|
1175 | 1175 | > """Writes 'Beep beep'""" |
|
1176 | 1176 | > ui.write(b"Beep beep\\n") |
|
1177 | 1177 | > EOF |
|
1178 | 1178 | $ dudupath=$TESTTMP/d/dudu.py |
|
1179 | 1179 | |
|
1180 | 1180 | $ echo "dudu = $dudupath" >> $HGRCPATH |
|
1181 | 1181 | |
|
1182 | 1182 | $ hg help -e dudu |
|
1183 | 1183 | dudu extension - |
|
1184 | 1184 | |
|
1185 | 1185 | This is an awesome 'dudu' extension. It does something and also writes 'Beep |
|
1186 | 1186 | beep' |
|
1187 | 1187 | |
|
1188 | 1188 | list of commands: |
|
1189 | 1189 | |
|
1190 | 1190 | beep Writes 'Beep beep' |
|
1191 | 1191 | something Does something |
|
1192 | 1192 | |
|
1193 | 1193 | (use 'hg help -v dudu' to show built-in aliases and global options) |
|
1194 | 1194 | |
|
1195 | 1195 | In case when extension name doesn't match any of its commands, |
|
1196 | 1196 | help options '-v' and '-v -e' should be equivalent |
|
1197 | 1197 | $ hg help -v dudu |
|
1198 | 1198 | dudu extension - |
|
1199 | 1199 | |
|
1200 | 1200 | This is an awesome 'dudu' extension. It does something and also writes 'Beep |
|
1201 | 1201 | beep' |
|
1202 | 1202 | |
|
1203 | 1203 | list of commands: |
|
1204 | 1204 | |
|
1205 | 1205 | beep Writes 'Beep beep' |
|
1206 | 1206 | something Does something |
|
1207 | 1207 | |
|
1208 | 1208 | global options ([+] can be repeated): |
|
1209 | 1209 | |
|
1210 | 1210 | -R --repository REPO repository root directory or name of overlay bundle |
|
1211 | 1211 | file |
|
1212 | 1212 | --cwd DIR change working directory |
|
1213 | 1213 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
1214 | 1214 | all prompts |
|
1215 | 1215 | -q --quiet suppress output |
|
1216 | 1216 | -v --verbose enable additional output |
|
1217 | 1217 | --color TYPE when to colorize (boolean, always, auto, never, or |
|
1218 | 1218 | debug) |
|
1219 | 1219 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
1220 | 1220 | --debug enable debugging output |
|
1221 | 1221 | --debugger start debugger |
|
1222 | 1222 | --encoding ENCODE set the charset encoding (default: ascii) |
|
1223 | 1223 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
1224 | 1224 | --traceback always print a traceback on exception |
|
1225 | 1225 | --time time how long the command takes |
|
1226 | 1226 | --profile print command execution profile |
|
1227 | 1227 | --version output version information and exit |
|
1228 | 1228 | -h --help display help and exit |
|
1229 | 1229 | --hidden consider hidden changesets |
|
1230 | 1230 | --pager TYPE when to paginate (boolean, always, auto, or never) |
|
1231 | 1231 | (default: auto) |
|
1232 | 1232 | |
|
1233 | 1233 | $ hg help -v -e dudu |
|
1234 | 1234 | dudu extension - |
|
1235 | 1235 | |
|
1236 | 1236 | This is an awesome 'dudu' extension. It does something and also writes 'Beep |
|
1237 | 1237 | beep' |
|
1238 | 1238 | |
|
1239 | 1239 | list of commands: |
|
1240 | 1240 | |
|
1241 | 1241 | beep Writes 'Beep beep' |
|
1242 | 1242 | something Does something |
|
1243 | 1243 | |
|
1244 | 1244 | global options ([+] can be repeated): |
|
1245 | 1245 | |
|
1246 | 1246 | -R --repository REPO repository root directory or name of overlay bundle |
|
1247 | 1247 | file |
|
1248 | 1248 | --cwd DIR change working directory |
|
1249 | 1249 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
1250 | 1250 | all prompts |
|
1251 | 1251 | -q --quiet suppress output |
|
1252 | 1252 | -v --verbose enable additional output |
|
1253 | 1253 | --color TYPE when to colorize (boolean, always, auto, never, or |
|
1254 | 1254 | debug) |
|
1255 | 1255 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
1256 | 1256 | --debug enable debugging output |
|
1257 | 1257 | --debugger start debugger |
|
1258 | 1258 | --encoding ENCODE set the charset encoding (default: ascii) |
|
1259 | 1259 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
1260 | 1260 | --traceback always print a traceback on exception |
|
1261 | 1261 | --time time how long the command takes |
|
1262 | 1262 | --profile print command execution profile |
|
1263 | 1263 | --version output version information and exit |
|
1264 | 1264 | -h --help display help and exit |
|
1265 | 1265 | --hidden consider hidden changesets |
|
1266 | 1266 | --pager TYPE when to paginate (boolean, always, auto, or never) |
|
1267 | 1267 | (default: auto) |
|
1268 | 1268 | |
|
1269 | 1269 | Disabled extension commands: |
|
1270 | 1270 | |
|
1271 | 1271 | $ ORGHGRCPATH=$HGRCPATH |
|
1272 | 1272 | $ HGRCPATH= |
|
1273 | 1273 | $ export HGRCPATH |
|
1274 | 1274 | $ hg help email |
|
1275 | 1275 | 'email' is provided by the following extension: |
|
1276 | 1276 | |
|
1277 | 1277 | patchbomb command to send changesets as (a series of) patch emails |
|
1278 | 1278 | |
|
1279 | 1279 | (use 'hg help extensions' for information on enabling extensions) |
|
1280 | 1280 | |
|
1281 | 1281 | |
|
1282 | 1282 | $ hg qdel |
|
1283 | 1283 | hg: unknown command 'qdel' |
|
1284 | 1284 | 'qdelete' is provided by the following extension: |
|
1285 | 1285 | |
|
1286 | 1286 | mq manage a stack of patches |
|
1287 | 1287 | |
|
1288 | 1288 | (use 'hg help extensions' for information on enabling extensions) |
|
1289 | 1289 | [255] |
|
1290 | 1290 | |
|
1291 | 1291 | |
|
1292 | 1292 | $ hg churn |
|
1293 | 1293 | hg: unknown command 'churn' |
|
1294 | 1294 | 'churn' is provided by the following extension: |
|
1295 | 1295 | |
|
1296 | 1296 | churn command to display statistics about repository history |
|
1297 | 1297 | |
|
1298 | 1298 | (use 'hg help extensions' for information on enabling extensions) |
|
1299 | 1299 | [255] |
|
1300 | 1300 | |
|
1301 | 1301 | |
|
1302 | 1302 | |
|
1303 | 1303 | Disabled extensions: |
|
1304 | 1304 | |
|
1305 | 1305 | $ hg help churn |
|
1306 | 1306 | churn extension - command to display statistics about repository history |
|
1307 | 1307 | |
|
1308 | 1308 | (use 'hg help extensions' for information on enabling extensions) |
|
1309 | 1309 | |
|
1310 | 1310 | $ hg help patchbomb |
|
1311 | 1311 | patchbomb extension - command to send changesets as (a series of) patch emails |
|
1312 | 1312 | |
|
1313 | 1313 | The series is started off with a "[PATCH 0 of N]" introduction, which |
|
1314 | 1314 | describes the series as a whole. |
|
1315 | 1315 | |
|
1316 | 1316 | Each patch email has a Subject line of "[PATCH M of N] ...", using the first |
|
1317 | 1317 | line of the changeset description as the subject text. The message contains |
|
1318 | 1318 | two or three body parts: |
|
1319 | 1319 | |
|
1320 | 1320 | - The changeset description. |
|
1321 | 1321 | - [Optional] The result of running diffstat on the patch. |
|
1322 | 1322 | - The patch itself, as generated by 'hg export'. |
|
1323 | 1323 | |
|
1324 | 1324 | Each message refers to the first in the series using the In-Reply-To and |
|
1325 | 1325 | References headers, so they will show up as a sequence in threaded mail and |
|
1326 | 1326 | news readers, and in mail archives. |
|
1327 | 1327 | |
|
1328 | 1328 | To configure other defaults, add a section like this to your configuration |
|
1329 | 1329 | file: |
|
1330 | 1330 | |
|
1331 | 1331 | [email] |
|
1332 | 1332 | from = My Name <my@email> |
|
1333 | 1333 | to = recipient1, recipient2, ... |
|
1334 | 1334 | cc = cc1, cc2, ... |
|
1335 | 1335 | bcc = bcc1, bcc2, ... |
|
1336 | 1336 | reply-to = address1, address2, ... |
|
1337 | 1337 | |
|
1338 | 1338 | Use "[patchbomb]" as configuration section name if you need to override global |
|
1339 | 1339 | "[email]" address settings. |
|
1340 | 1340 | |
|
1341 | 1341 | Then you can use the 'hg email' command to mail a series of changesets as a |
|
1342 | 1342 | patchbomb. |
|
1343 | 1343 | |
|
1344 | 1344 | You can also either configure the method option in the email section to be a |
|
1345 | 1345 | sendmail compatible mailer or fill out the [smtp] section so that the |
|
1346 | 1346 | patchbomb extension can automatically send patchbombs directly from the |
|
1347 | 1347 | commandline. See the [email] and [smtp] sections in hgrc(5) for details. |
|
1348 | 1348 | |
|
1349 | 1349 | By default, 'hg email' will prompt for a "To" or "CC" header if you do not |
|
1350 | 1350 | supply one via configuration or the command line. You can override this to |
|
1351 | 1351 | never prompt by configuring an empty value: |
|
1352 | 1352 | |
|
1353 | 1353 | [email] |
|
1354 | 1354 | cc = |
|
1355 | 1355 | |
|
1356 | 1356 | You can control the default inclusion of an introduction message with the |
|
1357 | 1357 | "patchbomb.intro" configuration option. The configuration is always |
|
1358 | 1358 | overwritten by command line flags like --intro and --desc: |
|
1359 | 1359 | |
|
1360 | 1360 | [patchbomb] |
|
1361 | 1361 | intro=auto # include introduction message if more than 1 patch (default) |
|
1362 | 1362 | intro=never # never include an introduction message |
|
1363 | 1363 | intro=always # always include an introduction message |
|
1364 | 1364 | |
|
1365 | 1365 | You can specify a template for flags to be added in subject prefixes. Flags |
|
1366 | 1366 | specified by --flag option are exported as "{flags}" keyword: |
|
1367 | 1367 | |
|
1368 | 1368 | [patchbomb] |
|
1369 | 1369 | flagtemplate = "{separate(' ', |
|
1370 | 1370 | ifeq(branch, 'default', '', branch|upper), |
|
1371 | 1371 | flags)}" |
|
1372 | 1372 | |
|
1373 | 1373 | You can set patchbomb to always ask for confirmation by setting |
|
1374 | 1374 | "patchbomb.confirm" to true. |
|
1375 | 1375 | |
|
1376 | 1376 | (use 'hg help extensions' for information on enabling extensions) |
|
1377 | 1377 | |
|
1378 | 1378 | |
|
1379 | 1379 | Broken disabled extension and command: |
|
1380 | 1380 | |
|
1381 | 1381 | $ mkdir hgext |
|
1382 | 1382 | $ echo > hgext/__init__.py |
|
1383 | 1383 | $ cat > hgext/broken.py <<NO_CHECK_EOF |
|
1384 | 1384 | > "broken extension' |
|
1385 | 1385 | > NO_CHECK_EOF |
|
1386 | 1386 | $ cat > path.py <<EOF |
|
1387 | 1387 | > import os |
|
1388 | 1388 | > import sys |
|
1389 | 1389 | > sys.path.insert(0, os.environ['HGEXTPATH']) |
|
1390 | 1390 | > EOF |
|
1391 | 1391 | $ HGEXTPATH=`pwd` |
|
1392 | 1392 | $ export HGEXTPATH |
|
1393 | 1393 | |
|
1394 | 1394 | $ hg --config extensions.path=./path.py help broken |
|
1395 | 1395 | broken extension - (no help text available) |
|
1396 | 1396 | |
|
1397 | 1397 | (use 'hg help extensions' for information on enabling extensions) |
|
1398 | 1398 | |
|
1399 | 1399 | |
|
1400 | 1400 | $ cat > hgext/forest.py <<EOF |
|
1401 | 1401 | > cmdtable = None |
|
1402 | 1402 | > @command() |
|
1403 | 1403 | > def f(): |
|
1404 | 1404 | > pass |
|
1405 | 1405 | > @command(123) |
|
1406 | 1406 | > def g(): |
|
1407 | 1407 | > pass |
|
1408 | 1408 | > EOF |
|
1409 | 1409 | $ hg --config extensions.path=./path.py help foo |
|
1410 | 1410 | abort: no such help topic: foo |
|
1411 | 1411 | (try 'hg help --keyword foo') |
|
1412 | 1412 | [255] |
|
1413 | 1413 | |
|
1414 | 1414 | $ cat > throw.py <<EOF |
|
1415 | 1415 | > from mercurial import commands, registrar, util |
|
1416 | 1416 | > cmdtable = {} |
|
1417 | 1417 | > command = registrar.command(cmdtable) |
|
1418 | 1418 | > class Bogon(Exception): pass |
|
1419 | 1419 | > # NB: version should be bytes; simulating extension not ported to py3 |
|
1420 | 1420 | > __version__ = '1.0.0' |
|
1421 | 1421 | > @command(b'throw', [], b'hg throw', norepo=True) |
|
1422 | 1422 | > def throw(ui, **opts): |
|
1423 | 1423 | > """throws an exception""" |
|
1424 | 1424 | > raise Bogon() |
|
1425 | 1425 | > EOF |
|
1426 | 1426 | |
|
1427 | 1427 | Test extension without proper byteification of key attributes doesn't crash when |
|
1428 | 1428 | accessed. |
|
1429 | 1429 | |
|
1430 | 1430 | $ hg version -v --config extensions.throw=throw.py | grep '^ ' |
|
1431 | 1431 | throw external 1.0.0 |
|
1432 | 1432 | |
|
1433 | 1433 | No declared supported version, extension complains: |
|
1434 | 1434 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' |
|
1435 | 1435 | ** Unknown exception encountered with possibly-broken third-party extension "throw" 1.0.0 |
|
1436 | 1436 | ** which supports versions unknown of Mercurial. |
|
1437 | 1437 | ** Please disable "throw" and try your action again. |
|
1438 | 1438 | ** If that fixes the bug please report it to the extension author. |
|
1439 | 1439 | ** Python * (glob) |
|
1440 | 1440 | ** Mercurial Distributed SCM * (glob) |
|
1441 | 1441 | ** Extensions loaded: throw 1.0.0 |
|
1442 | 1442 | |
|
1443 | 1443 | empty declaration of supported version, extension complains (but doesn't choke if |
|
1444 | 1444 | the value is improperly a str instead of bytes): |
|
1445 | 1445 | $ echo "testedwith = ''" >> throw.py |
|
1446 | 1446 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' |
|
1447 | 1447 | ** Unknown exception encountered with possibly-broken third-party extension "throw" 1.0.0 |
|
1448 | 1448 | ** which supports versions unknown of Mercurial. |
|
1449 | 1449 | ** Please disable "throw" and try your action again. |
|
1450 | 1450 | ** If that fixes the bug please report it to the extension author. |
|
1451 | 1451 | ** Python * (glob) |
|
1452 | 1452 | ** Mercurial Distributed SCM (*) (glob) |
|
1453 | 1453 | ** Extensions loaded: throw 1.0.0 |
|
1454 | 1454 | |
|
1455 | 1455 | If the extension specifies a buglink, show that (but don't choke if the value is |
|
1456 | 1456 | improperly a str instead of bytes): |
|
1457 | 1457 | $ echo 'buglink = "http://example.com/bts"' >> throw.py |
|
1458 | 1458 | $ rm -f throw.pyc throw.pyo |
|
1459 | 1459 | $ rm -Rf __pycache__ |
|
1460 | 1460 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' |
|
1461 | 1461 | ** Unknown exception encountered with possibly-broken third-party extension "throw" 1.0.0 |
|
1462 | 1462 | ** which supports versions unknown of Mercurial. |
|
1463 | 1463 | ** Please disable "throw" and try your action again. |
|
1464 | 1464 | ** If that fixes the bug please report it to http://example.com/bts |
|
1465 | 1465 | ** Python * (glob) |
|
1466 | 1466 | ** Mercurial Distributed SCM (*) (glob) |
|
1467 | 1467 | ** Extensions loaded: throw 1.0.0 |
|
1468 | 1468 | |
|
1469 | 1469 | If the extensions declare outdated versions, accuse the older extension first: |
|
1470 | 1470 | $ echo "from mercurial import util" >> older.py |
|
1471 | 1471 | $ echo "util.version = lambda:b'2.2'" >> older.py |
|
1472 | 1472 | $ echo "testedwith = b'1.9.3'" >> older.py |
|
1473 | 1473 | $ echo "testedwith = b'2.1.1'" >> throw.py |
|
1474 | 1474 | $ rm -f throw.pyc throw.pyo |
|
1475 | 1475 | $ rm -Rf __pycache__ |
|
1476 | 1476 | $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ |
|
1477 | 1477 | > throw 2>&1 | egrep '^\*\*' |
|
1478 | 1478 | ** Unknown exception encountered with possibly-broken third-party extension "older" (version N/A) |
|
1479 | 1479 | ** which supports versions 1.9 of Mercurial. |
|
1480 | 1480 | ** Please disable "older" and try your action again. |
|
1481 | 1481 | ** If that fixes the bug please report it to the extension author. |
|
1482 | 1482 | ** Python * (glob) |
|
1483 | 1483 | ** Mercurial Distributed SCM (version 2.2) |
|
1484 | 1484 | ** Extensions loaded: older, throw 1.0.0 |
|
1485 | 1485 | |
|
1486 | 1486 | One extension only tested with older, one only with newer versions: |
|
1487 | 1487 | $ echo "util.version = lambda:b'2.1'" >> older.py |
|
1488 | 1488 | $ rm -f older.pyc older.pyo |
|
1489 | 1489 | $ rm -Rf __pycache__ |
|
1490 | 1490 | $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ |
|
1491 | 1491 | > throw 2>&1 | egrep '^\*\*' |
|
1492 | 1492 | ** Unknown exception encountered with possibly-broken third-party extension "older" (version N/A) |
|
1493 | 1493 | ** which supports versions 1.9 of Mercurial. |
|
1494 | 1494 | ** Please disable "older" and try your action again. |
|
1495 | 1495 | ** If that fixes the bug please report it to the extension author. |
|
1496 | 1496 | ** Python * (glob) |
|
1497 | 1497 | ** Mercurial Distributed SCM (version 2.1) |
|
1498 | 1498 | ** Extensions loaded: older, throw 1.0.0 |
|
1499 | 1499 | |
|
1500 | 1500 | Older extension is tested with current version, the other only with newer: |
|
1501 | 1501 | $ echo "util.version = lambda:b'1.9.3'" >> older.py |
|
1502 | 1502 | $ rm -f older.pyc older.pyo |
|
1503 | 1503 | $ rm -Rf __pycache__ |
|
1504 | 1504 | $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ |
|
1505 | 1505 | > throw 2>&1 | egrep '^\*\*' |
|
1506 | 1506 | ** Unknown exception encountered with possibly-broken third-party extension "throw" 1.0.0 |
|
1507 | 1507 | ** which supports versions 2.1 of Mercurial. |
|
1508 | 1508 | ** Please disable "throw" and try your action again. |
|
1509 | 1509 | ** If that fixes the bug please report it to http://example.com/bts |
|
1510 | 1510 | ** Python * (glob) |
|
1511 | 1511 | ** Mercurial Distributed SCM (version 1.9.3) |
|
1512 | 1512 | ** Extensions loaded: older, throw 1.0.0 |
|
1513 | 1513 | |
|
1514 | 1514 | Ability to point to a different point |
|
1515 | 1515 | $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ |
|
1516 | 1516 | > --config ui.supportcontact='Your Local Goat Lenders' throw 2>&1 | egrep '^\*\*' |
|
1517 | 1517 | ** unknown exception encountered, please report by visiting |
|
1518 | 1518 | ** Your Local Goat Lenders |
|
1519 | 1519 | ** Python * (glob) |
|
1520 | 1520 | ** Mercurial Distributed SCM (*) (glob) |
|
1521 | 1521 | ** Extensions loaded: older, throw 1.0.0 |
|
1522 | 1522 | |
|
1523 | 1523 | Declare the version as supporting this hg version, show regular bts link: |
|
1524 | 1524 | $ hgver=`hg debuginstall -T '{hgver}'` |
|
1525 | 1525 | $ echo 'testedwith = """'"$hgver"'"""' >> throw.py |
|
1526 | 1526 | $ if [ -z "$hgver" ]; then |
|
1527 | 1527 | > echo "unable to fetch a mercurial version. Make sure __version__ is correct"; |
|
1528 | 1528 | > fi |
|
1529 | 1529 | $ rm -f throw.pyc throw.pyo |
|
1530 | 1530 | $ rm -Rf __pycache__ |
|
1531 | 1531 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' |
|
1532 | 1532 | ** unknown exception encountered, please report by visiting |
|
1533 | 1533 | ** https://mercurial-scm.org/wiki/BugTracker |
|
1534 | 1534 | ** Python * (glob) |
|
1535 | 1535 | ** Mercurial Distributed SCM (*) (glob) |
|
1536 | 1536 | ** Extensions loaded: throw 1.0.0 |
|
1537 | 1537 | |
|
1538 | 1538 | Patch version is ignored during compatibility check |
|
1539 | 1539 | $ echo "testedwith = b'3.2'" >> throw.py |
|
1540 | 1540 | $ echo "util.version = lambda:b'3.2.2'" >> throw.py |
|
1541 | 1541 | $ rm -f throw.pyc throw.pyo |
|
1542 | 1542 | $ rm -Rf __pycache__ |
|
1543 | 1543 | $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' |
|
1544 | 1544 | ** unknown exception encountered, please report by visiting |
|
1545 | 1545 | ** https://mercurial-scm.org/wiki/BugTracker |
|
1546 | 1546 | ** Python * (glob) |
|
1547 | 1547 | ** Mercurial Distributed SCM (*) (glob) |
|
1548 | 1548 | ** Extensions loaded: throw 1.0.0 |
|
1549 | 1549 | |
|
1550 | 1550 | Test version number support in 'hg version': |
|
1551 | 1551 | $ echo '__version__ = (1, 2, 3)' >> throw.py |
|
1552 | 1552 | $ rm -f throw.pyc throw.pyo |
|
1553 | 1553 | $ rm -Rf __pycache__ |
|
1554 | 1554 | $ hg version -v |
|
1555 | 1555 | Mercurial Distributed SCM (version *) (glob) |
|
1556 | 1556 | (see https://mercurial-scm.org for more information) |
|
1557 | 1557 | |
|
1558 | 1558 | Copyright (C) 2005-* Matt Mackall and others (glob) |
|
1559 | 1559 | This is free software; see the source for copying conditions. There is NO |
|
1560 | 1560 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
1561 | 1561 | |
|
1562 | 1562 | Enabled extensions: |
|
1563 | 1563 | |
|
1564 | 1564 | |
|
1565 | 1565 | $ hg version -v --config extensions.throw=throw.py |
|
1566 | 1566 | Mercurial Distributed SCM (version *) (glob) |
|
1567 | 1567 | (see https://mercurial-scm.org for more information) |
|
1568 | 1568 | |
|
1569 | 1569 | Copyright (C) 2005-* Matt Mackall and others (glob) |
|
1570 | 1570 | This is free software; see the source for copying conditions. There is NO |
|
1571 | 1571 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
1572 | 1572 | |
|
1573 | 1573 | Enabled extensions: |
|
1574 | 1574 | |
|
1575 | 1575 | throw external 1.2.3 |
|
1576 | 1576 | $ echo 'getversion = lambda: b"1.twentythree"' >> throw.py |
|
1577 | 1577 | $ rm -f throw.pyc throw.pyo |
|
1578 | 1578 | $ rm -Rf __pycache__ |
|
1579 | 1579 | $ hg version -v --config extensions.throw=throw.py --config extensions.strip= |
|
1580 | 1580 | Mercurial Distributed SCM (version *) (glob) |
|
1581 | 1581 | (see https://mercurial-scm.org for more information) |
|
1582 | 1582 | |
|
1583 | 1583 | Copyright (C) 2005-* Matt Mackall and others (glob) |
|
1584 | 1584 | This is free software; see the source for copying conditions. There is NO |
|
1585 | 1585 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
1586 | 1586 | |
|
1587 | 1587 | Enabled extensions: |
|
1588 | 1588 | |
|
1589 | 1589 | strip internal |
|
1590 | 1590 | throw external 1.twentythree |
|
1591 | 1591 | |
|
1592 | 1592 | $ hg version -q --config extensions.throw=throw.py |
|
1593 | 1593 | Mercurial Distributed SCM (version *) (glob) |
|
1594 | 1594 | |
|
1595 | 1595 | Test template output: |
|
1596 | 1596 | |
|
1597 | 1597 | $ hg version --config extensions.strip= -T'{extensions}' |
|
1598 | 1598 | strip |
|
1599 | 1599 | |
|
1600 | 1600 | Test JSON output of version: |
|
1601 | 1601 | |
|
1602 | 1602 | $ hg version -Tjson |
|
1603 | 1603 | [ |
|
1604 | 1604 | { |
|
1605 | 1605 | "extensions": [], |
|
1606 | 1606 | "ver": "*" (glob) |
|
1607 | 1607 | } |
|
1608 | 1608 | ] |
|
1609 | 1609 | |
|
1610 | 1610 | $ hg version --config extensions.throw=throw.py -Tjson |
|
1611 | 1611 | [ |
|
1612 | 1612 | { |
|
1613 | 1613 | "extensions": [{"bundled": false, "name": "throw", "ver": "1.twentythree"}], |
|
1614 | 1614 | "ver": "3.2.2" |
|
1615 | 1615 | } |
|
1616 | 1616 | ] |
|
1617 | 1617 | |
|
1618 | 1618 | $ hg version --config extensions.strip= -Tjson |
|
1619 | 1619 | [ |
|
1620 | 1620 | { |
|
1621 | 1621 | "extensions": [{"bundled": true, "name": "strip", "ver": null}], |
|
1622 | 1622 | "ver": "*" (glob) |
|
1623 | 1623 | } |
|
1624 | 1624 | ] |
|
1625 | 1625 | |
|
1626 | 1626 | Test template output of version: |
|
1627 | 1627 | |
|
1628 | 1628 | $ hg version --config extensions.throw=throw.py --config extensions.strip= \ |
|
1629 | 1629 | > -T'{extensions % "{name} {pad(ver, 16)} ({if(bundled, "internal", "external")})\n"}' |
|
1630 | 1630 | strip (internal) |
|
1631 | 1631 | throw 1.twentythree (external) |
|
1632 | 1632 | |
|
1633 | 1633 | Refuse to load extensions with minimum version requirements |
|
1634 | 1634 | |
|
1635 | 1635 | $ cat > minversion1.py << EOF |
|
1636 | 1636 | > from mercurial import util |
|
1637 | 1637 | > util.version = lambda: b'3.5.2' |
|
1638 | 1638 | > minimumhgversion = b'3.6' |
|
1639 | 1639 | > EOF |
|
1640 | 1640 | $ hg --config extensions.minversion=minversion1.py version |
|
1641 | 1641 | (third party extension minversion requires version 3.6 or newer of Mercurial (current: 3.5.2); disabling) |
|
1642 | 1642 | Mercurial Distributed SCM (version 3.5.2) |
|
1643 | 1643 | (see https://mercurial-scm.org for more information) |
|
1644 | 1644 | |
|
1645 | 1645 | Copyright (C) 2005-* Matt Mackall and others (glob) |
|
1646 | 1646 | This is free software; see the source for copying conditions. There is NO |
|
1647 | 1647 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
1648 | 1648 | |
|
1649 | 1649 | $ cat > minversion2.py << EOF |
|
1650 | 1650 | > from mercurial import util |
|
1651 | 1651 | > util.version = lambda: b'3.6' |
|
1652 | 1652 | > minimumhgversion = b'3.7' |
|
1653 | 1653 | > EOF |
|
1654 | 1654 | $ hg --config extensions.minversion=minversion2.py version 2>&1 | egrep '\(third' |
|
1655 | 1655 | (third party extension minversion requires version 3.7 or newer of Mercurial (current: 3.6); disabling) |
|
1656 | 1656 | |
|
1657 | 1657 | Can load version that is only off by point release |
|
1658 | 1658 | |
|
1659 | 1659 | $ cat > minversion2.py << EOF |
|
1660 | 1660 | > from mercurial import util |
|
1661 | 1661 | > util.version = lambda: b'3.6.1' |
|
1662 | 1662 | > minimumhgversion = b'3.6' |
|
1663 | 1663 | > EOF |
|
1664 | 1664 | $ hg --config extensions.minversion=minversion3.py version 2>&1 | egrep '\(third' |
|
1665 | 1665 | [1] |
|
1666 | 1666 | |
|
1667 | 1667 | Can load minimum version identical to current |
|
1668 | 1668 | |
|
1669 | 1669 | $ cat > minversion3.py << EOF |
|
1670 | 1670 | > from mercurial import util |
|
1671 | 1671 | > util.version = lambda: b'3.5' |
|
1672 | 1672 | > minimumhgversion = b'3.5' |
|
1673 | 1673 | > EOF |
|
1674 | 1674 | $ hg --config extensions.minversion=minversion3.py version 2>&1 | egrep '\(third' |
|
1675 | 1675 | [1] |
|
1676 | 1676 | |
|
1677 | 1677 | Restore HGRCPATH |
|
1678 | 1678 | |
|
1679 | 1679 | $ HGRCPATH=$ORGHGRCPATH |
|
1680 | 1680 | $ export HGRCPATH |
|
1681 | 1681 | |
|
1682 | 1682 | Commands handling multiple repositories at a time should invoke only |
|
1683 | 1683 | "reposetup()" of extensions enabling in the target repository. |
|
1684 | 1684 | |
|
1685 | 1685 | $ mkdir reposetup-test |
|
1686 | 1686 | $ cd reposetup-test |
|
1687 | 1687 | |
|
1688 | 1688 | $ cat > $TESTTMP/reposetuptest.py <<EOF |
|
1689 | 1689 | > from mercurial import extensions |
|
1690 | 1690 | > def reposetup(ui, repo): |
|
1691 | 1691 | > ui.write(b'reposetup() for %s\n' % (repo.root)) |
|
1692 | 1692 | > ui.flush() |
|
1693 | 1693 | > EOF |
|
1694 | 1694 | $ hg init src |
|
1695 | 1695 | $ echo a > src/a |
|
1696 | 1696 | $ hg -R src commit -Am '#0 at src/a' |
|
1697 | 1697 | adding a |
|
1698 | 1698 | $ echo '[extensions]' >> src/.hg/hgrc |
|
1699 | 1699 | $ echo '# enable extension locally' >> src/.hg/hgrc |
|
1700 | 1700 | $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> src/.hg/hgrc |
|
1701 | 1701 | $ hg -R src status |
|
1702 | 1702 | reposetup() for $TESTTMP/reposetup-test/src |
|
1703 | 1703 | reposetup() for $TESTTMP/reposetup-test/src (chg !) |
|
1704 | 1704 | |
|
1705 | 1705 | #if no-extraextensions |
|
1706 | 1706 | $ hg --cwd src debugextensions |
|
1707 | 1707 | reposetup() for $TESTTMP/reposetup-test/src |
|
1708 | 1708 | dodo (untested!) |
|
1709 | 1709 | dudu (untested!) |
|
1710 | 1710 | mq |
|
1711 | 1711 | reposetuptest (untested!) |
|
1712 | 1712 | strip |
|
1713 | 1713 | #endif |
|
1714 | 1714 | |
|
1715 | 1715 | $ hg clone -U src clone-dst1 |
|
1716 | 1716 | reposetup() for $TESTTMP/reposetup-test/src |
|
1717 | 1717 | $ hg init push-dst1 |
|
1718 | 1718 | $ hg -q -R src push push-dst1 |
|
1719 | 1719 | reposetup() for $TESTTMP/reposetup-test/src |
|
1720 | 1720 | $ hg init pull-src1 |
|
1721 | 1721 | $ hg -q -R pull-src1 pull src |
|
1722 | 1722 | reposetup() for $TESTTMP/reposetup-test/src |
|
1723 | 1723 | |
|
1724 | 1724 | $ cat <<EOF >> $HGRCPATH |
|
1725 | 1725 | > [extensions] |
|
1726 | 1726 | > # disable extension globally and explicitly |
|
1727 | 1727 | > reposetuptest = ! |
|
1728 | 1728 | > EOF |
|
1729 | 1729 | $ hg clone -U src clone-dst2 |
|
1730 | 1730 | reposetup() for $TESTTMP/reposetup-test/src |
|
1731 | 1731 | $ hg init push-dst2 |
|
1732 | 1732 | $ hg -q -R src push push-dst2 |
|
1733 | 1733 | reposetup() for $TESTTMP/reposetup-test/src |
|
1734 | 1734 | $ hg init pull-src2 |
|
1735 | 1735 | $ hg -q -R pull-src2 pull src |
|
1736 | 1736 | reposetup() for $TESTTMP/reposetup-test/src |
|
1737 | 1737 | |
|
1738 | 1738 | $ cat <<EOF >> $HGRCPATH |
|
1739 | 1739 | > [extensions] |
|
1740 | 1740 | > # enable extension globally |
|
1741 | 1741 | > reposetuptest = $TESTTMP/reposetuptest.py |
|
1742 | 1742 | > EOF |
|
1743 | 1743 | $ hg clone -U src clone-dst3 |
|
1744 | 1744 | reposetup() for $TESTTMP/reposetup-test/src |
|
1745 | 1745 | reposetup() for $TESTTMP/reposetup-test/clone-dst3 |
|
1746 | 1746 | $ hg init push-dst3 |
|
1747 | 1747 | reposetup() for $TESTTMP/reposetup-test/push-dst3 |
|
1748 | 1748 | $ hg -q -R src push push-dst3 |
|
1749 | 1749 | reposetup() for $TESTTMP/reposetup-test/src |
|
1750 | 1750 | reposetup() for $TESTTMP/reposetup-test/push-dst3 |
|
1751 | 1751 | $ hg init pull-src3 |
|
1752 | 1752 | reposetup() for $TESTTMP/reposetup-test/pull-src3 |
|
1753 | 1753 | $ hg -q -R pull-src3 pull src |
|
1754 | 1754 | reposetup() for $TESTTMP/reposetup-test/pull-src3 |
|
1755 | 1755 | reposetup() for $TESTTMP/reposetup-test/src |
|
1756 | 1756 | |
|
1757 | 1757 | $ echo '[extensions]' >> src/.hg/hgrc |
|
1758 | 1758 | $ echo '# disable extension locally' >> src/.hg/hgrc |
|
1759 | 1759 | $ echo 'reposetuptest = !' >> src/.hg/hgrc |
|
1760 | 1760 | $ hg clone -U src clone-dst4 |
|
1761 | 1761 | reposetup() for $TESTTMP/reposetup-test/clone-dst4 |
|
1762 | 1762 | $ hg init push-dst4 |
|
1763 | 1763 | reposetup() for $TESTTMP/reposetup-test/push-dst4 |
|
1764 | 1764 | $ hg -q -R src push push-dst4 |
|
1765 | 1765 | reposetup() for $TESTTMP/reposetup-test/push-dst4 |
|
1766 | 1766 | $ hg init pull-src4 |
|
1767 | 1767 | reposetup() for $TESTTMP/reposetup-test/pull-src4 |
|
1768 | 1768 | $ hg -q -R pull-src4 pull src |
|
1769 | 1769 | reposetup() for $TESTTMP/reposetup-test/pull-src4 |
|
1770 | 1770 | |
|
1771 | 1771 | disabling in command line overlays with all configuration |
|
1772 | 1772 | $ hg --config extensions.reposetuptest=! clone -U src clone-dst5 |
|
1773 | 1773 | $ hg --config extensions.reposetuptest=! init push-dst5 |
|
1774 | 1774 | $ hg --config extensions.reposetuptest=! -q -R src push push-dst5 |
|
1775 | 1775 | $ hg --config extensions.reposetuptest=! init pull-src5 |
|
1776 | 1776 | $ hg --config extensions.reposetuptest=! -q -R pull-src5 pull src |
|
1777 | 1777 | |
|
1778 | 1778 | $ cat <<EOF >> $HGRCPATH |
|
1779 | 1779 | > [extensions] |
|
1780 | 1780 | > # disable extension globally and explicitly |
|
1781 | 1781 | > reposetuptest = ! |
|
1782 | 1782 | > EOF |
|
1783 | 1783 | $ hg init parent |
|
1784 | 1784 | $ hg init parent/sub1 |
|
1785 | 1785 | $ echo 1 > parent/sub1/1 |
|
1786 | 1786 | $ hg -R parent/sub1 commit -Am '#0 at parent/sub1' |
|
1787 | 1787 | adding 1 |
|
1788 | 1788 | $ hg init parent/sub2 |
|
1789 | 1789 | $ hg init parent/sub2/sub21 |
|
1790 | 1790 | $ echo 21 > parent/sub2/sub21/21 |
|
1791 | 1791 | $ hg -R parent/sub2/sub21 commit -Am '#0 at parent/sub2/sub21' |
|
1792 | 1792 | adding 21 |
|
1793 | 1793 | $ cat > parent/sub2/.hgsub <<EOF |
|
1794 | 1794 | > sub21 = sub21 |
|
1795 | 1795 | > EOF |
|
1796 | 1796 | $ hg -R parent/sub2 commit -Am '#0 at parent/sub2' |
|
1797 | 1797 | adding .hgsub |
|
1798 | 1798 | $ hg init parent/sub3 |
|
1799 | 1799 | $ echo 3 > parent/sub3/3 |
|
1800 | 1800 | $ hg -R parent/sub3 commit -Am '#0 at parent/sub3' |
|
1801 | 1801 | adding 3 |
|
1802 | 1802 | $ cat > parent/.hgsub <<EOF |
|
1803 | 1803 | > sub1 = sub1 |
|
1804 | 1804 | > sub2 = sub2 |
|
1805 | 1805 | > sub3 = sub3 |
|
1806 | 1806 | > EOF |
|
1807 | 1807 | $ hg -R parent commit -Am '#0 at parent' |
|
1808 | 1808 | adding .hgsub |
|
1809 | 1809 | $ echo '[extensions]' >> parent/.hg/hgrc |
|
1810 | 1810 | $ echo '# enable extension locally' >> parent/.hg/hgrc |
|
1811 | 1811 | $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> parent/.hg/hgrc |
|
1812 | 1812 | $ cp parent/.hg/hgrc parent/sub2/.hg/hgrc |
|
1813 | 1813 | $ hg -R parent status -S -A |
|
1814 | 1814 | reposetup() for $TESTTMP/reposetup-test/parent |
|
1815 | 1815 | reposetup() for $TESTTMP/reposetup-test/parent/sub2 |
|
1816 | 1816 | C .hgsub |
|
1817 | 1817 | C .hgsubstate |
|
1818 | 1818 | C sub1/1 |
|
1819 | 1819 | C sub2/.hgsub |
|
1820 | 1820 | C sub2/.hgsubstate |
|
1821 | 1821 | C sub2/sub21/21 |
|
1822 | 1822 | C sub3/3 |
|
1823 | 1823 | |
|
1824 | 1824 | $ cd .. |
|
1825 | 1825 | |
|
1826 | 1826 | Prohibit registration of commands that don't use @command (issue5137) |
|
1827 | 1827 | |
|
1828 | 1828 | $ hg init deprecated |
|
1829 | 1829 | $ cd deprecated |
|
1830 | 1830 | |
|
1831 | 1831 | $ cat <<EOF > deprecatedcmd.py |
|
1832 | 1832 | > def deprecatedcmd(repo, ui): |
|
1833 | 1833 | > pass |
|
1834 | 1834 | > cmdtable = { |
|
1835 | 1835 | > b'deprecatedcmd': (deprecatedcmd, [], b''), |
|
1836 | 1836 | > } |
|
1837 | 1837 | > EOF |
|
1838 | 1838 | $ cat <<EOF > .hg/hgrc |
|
1839 | 1839 | > [extensions] |
|
1840 | 1840 | > deprecatedcmd = `pwd`/deprecatedcmd.py |
|
1841 | 1841 | > mq = ! |
|
1842 | 1842 | > hgext.mq = ! |
|
1843 | 1843 | > hgext/mq = ! |
|
1844 | 1844 | > EOF |
|
1845 | 1845 | |
|
1846 | 1846 | $ hg deprecatedcmd > /dev/null |
|
1847 | 1847 | *** failed to import extension deprecatedcmd from $TESTTMP/deprecated/deprecatedcmd.py: missing attributes: norepo, optionalrepo, inferrepo |
|
1848 | 1848 | *** (use @command decorator to register 'deprecatedcmd') |
|
1849 | 1849 | hg: unknown command 'deprecatedcmd' |
|
1850 | 1850 | (use 'hg help' for a list of commands) |
|
1851 |
[ |
|
|
1851 | [10] | |
|
1852 | 1852 | |
|
1853 | 1853 | the extension shouldn't be loaded at all so the mq works: |
|
1854 | 1854 | |
|
1855 | 1855 | $ hg qseries --config extensions.mq= > /dev/null |
|
1856 | 1856 | *** failed to import extension deprecatedcmd from $TESTTMP/deprecated/deprecatedcmd.py: missing attributes: norepo, optionalrepo, inferrepo |
|
1857 | 1857 | *** (use @command decorator to register 'deprecatedcmd') |
|
1858 | 1858 | |
|
1859 | 1859 | $ cd .. |
|
1860 | 1860 | |
|
1861 | 1861 | Test synopsis and docstring extending |
|
1862 | 1862 | |
|
1863 | 1863 | $ hg init exthelp |
|
1864 | 1864 | $ cat > exthelp.py <<EOF |
|
1865 | 1865 | > from mercurial import commands, extensions |
|
1866 | 1866 | > def exbookmarks(orig, *args, **opts): |
|
1867 | 1867 | > return orig(*args, **opts) |
|
1868 | 1868 | > def uisetup(ui): |
|
1869 | 1869 | > synopsis = b' GREPME [--foo] [-x]' |
|
1870 | 1870 | > docstring = ''' |
|
1871 | 1871 | > GREPME make sure that this is in the help! |
|
1872 | 1872 | > ''' |
|
1873 | 1873 | > extensions.wrapcommand(commands.table, b'bookmarks', exbookmarks, |
|
1874 | 1874 | > synopsis, docstring) |
|
1875 | 1875 | > EOF |
|
1876 | 1876 | $ abspath=`pwd`/exthelp.py |
|
1877 | 1877 | $ echo '[extensions]' >> $HGRCPATH |
|
1878 | 1878 | $ echo "exthelp = $abspath" >> $HGRCPATH |
|
1879 | 1879 | $ cd exthelp |
|
1880 | 1880 | $ hg help bookmarks | grep GREPME |
|
1881 | 1881 | hg bookmarks [OPTIONS]... [NAME]... GREPME [--foo] [-x] |
|
1882 | 1882 | GREPME make sure that this is in the help! |
|
1883 | 1883 | $ cd .. |
|
1884 | 1884 | |
|
1885 | 1885 | Prohibit the use of unicode strings as the default value of options |
|
1886 | 1886 | |
|
1887 | 1887 | $ hg init $TESTTMP/opt-unicode-default |
|
1888 | 1888 | |
|
1889 | 1889 | $ cat > $TESTTMP/test_unicode_default_value.py << EOF |
|
1890 | 1890 | > from __future__ import print_function |
|
1891 | 1891 | > from mercurial import registrar |
|
1892 | 1892 | > cmdtable = {} |
|
1893 | 1893 | > command = registrar.command(cmdtable) |
|
1894 | 1894 | > @command(b'dummy', [(b'', b'opt', u'value', u'help')], 'ext [OPTIONS]') |
|
1895 | 1895 | > def ext(*args, **opts): |
|
1896 | 1896 | > print(opts[b'opt'], flush=True) |
|
1897 | 1897 | > EOF |
|
1898 | 1898 | $ "$PYTHON" $TESTTMP/unflush.py $TESTTMP/test_unicode_default_value.py |
|
1899 | 1899 | $ cat > $TESTTMP/opt-unicode-default/.hg/hgrc << EOF |
|
1900 | 1900 | > [extensions] |
|
1901 | 1901 | > test_unicode_default_value = $TESTTMP/test_unicode_default_value.py |
|
1902 | 1902 | > EOF |
|
1903 | 1903 | $ hg -R $TESTTMP/opt-unicode-default dummy |
|
1904 | 1904 | *** failed to import extension test_unicode_default_value from $TESTTMP/test_unicode_default_value.py: unicode *'value' found in cmdtable.dummy (glob) |
|
1905 | 1905 | *** (use b'' to make it byte string) |
|
1906 | 1906 | hg: unknown command 'dummy' |
|
1907 | 1907 | (did you mean summary?) |
|
1908 |
[ |
|
|
1908 | [10] |
@@ -1,261 +1,261 b'' | |||
|
1 | 1 | $ cat >> $HGRCPATH << EOF |
|
2 | 2 | > [extensions] |
|
3 | 3 | > fastannotate= |
|
4 | 4 | > EOF |
|
5 | 5 | |
|
6 | 6 | $ hg init repo |
|
7 | 7 | $ cd repo |
|
8 | 8 | |
|
9 | 9 | a simple merge case |
|
10 | 10 | |
|
11 | 11 | $ echo 1 > a |
|
12 | 12 | $ hg commit -qAm 'append 1' |
|
13 | 13 | $ echo 2 >> a |
|
14 | 14 | $ hg commit -m 'append 2' |
|
15 | 15 | $ echo 3 >> a |
|
16 | 16 | $ hg commit -m 'append 3' |
|
17 | 17 | $ hg up 1 -q |
|
18 | 18 | $ cat > a << EOF |
|
19 | 19 | > 0 |
|
20 | 20 | > 1 |
|
21 | 21 | > 2 |
|
22 | 22 | > EOF |
|
23 | 23 | $ hg commit -qm 'insert 0' |
|
24 | 24 | $ hg merge 2 -q |
|
25 | 25 | $ echo 4 >> a |
|
26 | 26 | $ hg commit -m merge |
|
27 | 27 | $ hg log -G -T '{rev}: {desc}' |
|
28 | 28 | @ 4: merge |
|
29 | 29 | |\ |
|
30 | 30 | | o 3: insert 0 |
|
31 | 31 | | | |
|
32 | 32 | o | 2: append 3 |
|
33 | 33 | |/ |
|
34 | 34 | o 1: append 2 |
|
35 | 35 | | |
|
36 | 36 | o 0: append 1 |
|
37 | 37 | |
|
38 | 38 | $ hg fastannotate a |
|
39 | 39 | 3: 0 |
|
40 | 40 | 0: 1 |
|
41 | 41 | 1: 2 |
|
42 | 42 | 2: 3 |
|
43 | 43 | 4: 4 |
|
44 | 44 | $ hg fastannotate -r 0 a |
|
45 | 45 | 0: 1 |
|
46 | 46 | $ hg fastannotate -r 1 a |
|
47 | 47 | 0: 1 |
|
48 | 48 | 1: 2 |
|
49 | 49 | $ hg fastannotate -udnclf a |
|
50 | 50 | test 3 d641cb51f61e Thu Jan 01 00:00:00 1970 +0000 a:1: 0 |
|
51 | 51 | test 0 4994017376d3 Thu Jan 01 00:00:00 1970 +0000 a:1: 1 |
|
52 | 52 | test 1 e940cb6d9a06 Thu Jan 01 00:00:00 1970 +0000 a:2: 2 |
|
53 | 53 | test 2 26162a884ba6 Thu Jan 01 00:00:00 1970 +0000 a:3: 3 |
|
54 | 54 | test 4 3ad7bcd2815f Thu Jan 01 00:00:00 1970 +0000 a:5: 4 |
|
55 | 55 | $ hg fastannotate --linear a |
|
56 | 56 | 3: 0 |
|
57 | 57 | 0: 1 |
|
58 | 58 | 1: 2 |
|
59 | 59 | 4: 3 |
|
60 | 60 | 4: 4 |
|
61 | 61 | |
|
62 | 62 | incrementally updating |
|
63 | 63 | |
|
64 | 64 | $ hg fastannotate -r 0 a --debug |
|
65 | 65 | fastannotate: a: using fast path (resolved fctx: True) |
|
66 | 66 | 0: 1 |
|
67 | 67 | $ hg fastannotate -r 0 a --debug --rebuild |
|
68 | 68 | fastannotate: a: 1 new changesets in the main branch |
|
69 | 69 | 0: 1 |
|
70 | 70 | $ hg fastannotate -r 1 a --debug |
|
71 | 71 | fastannotate: a: 1 new changesets in the main branch |
|
72 | 72 | 0: 1 |
|
73 | 73 | 1: 2 |
|
74 | 74 | $ hg fastannotate -r 3 a --debug |
|
75 | 75 | fastannotate: a: 1 new changesets in the main branch |
|
76 | 76 | 3: 0 |
|
77 | 77 | 0: 1 |
|
78 | 78 | 1: 2 |
|
79 | 79 | $ hg fastannotate -r 4 a --debug |
|
80 | 80 | fastannotate: a: 1 new changesets in the main branch |
|
81 | 81 | 3: 0 |
|
82 | 82 | 0: 1 |
|
83 | 83 | 1: 2 |
|
84 | 84 | 2: 3 |
|
85 | 85 | 4: 4 |
|
86 | 86 | $ hg fastannotate -r 1 a --debug |
|
87 | 87 | fastannotate: a: using fast path (resolved fctx: True) |
|
88 | 88 | 0: 1 |
|
89 | 89 | 1: 2 |
|
90 | 90 | |
|
91 | 91 | rebuild happens automatically if unable to update |
|
92 | 92 | |
|
93 | 93 | $ hg fastannotate -r 2 a --debug |
|
94 | 94 | fastannotate: a: cache broken and deleted |
|
95 | 95 | fastannotate: a: 3 new changesets in the main branch |
|
96 | 96 | 0: 1 |
|
97 | 97 | 1: 2 |
|
98 | 98 | 2: 3 |
|
99 | 99 | |
|
100 | 100 | config option "fastannotate.mainbranch" |
|
101 | 101 | |
|
102 | 102 | $ hg fastannotate -r 1 --rebuild --config fastannotate.mainbranch=tip a --debug |
|
103 | 103 | fastannotate: a: 4 new changesets in the main branch |
|
104 | 104 | 0: 1 |
|
105 | 105 | 1: 2 |
|
106 | 106 | $ hg fastannotate -r 4 a --debug |
|
107 | 107 | fastannotate: a: using fast path (resolved fctx: True) |
|
108 | 108 | 3: 0 |
|
109 | 109 | 0: 1 |
|
110 | 110 | 1: 2 |
|
111 | 111 | 2: 3 |
|
112 | 112 | 4: 4 |
|
113 | 113 | |
|
114 | 114 | config option "fastannotate.modes" |
|
115 | 115 | |
|
116 | 116 | $ hg annotate -r 1 --debug a |
|
117 | 117 | 0: 1 |
|
118 | 118 | 1: 2 |
|
119 | 119 | $ hg annotate --config fastannotate.modes=fctx -r 1 --debug a |
|
120 | 120 | fastannotate: a: using fast path (resolved fctx: False) |
|
121 | 121 | 0: 1 |
|
122 | 122 | 1: 2 |
|
123 | 123 | $ hg fastannotate --config fastannotate.modes=fctx -h -q |
|
124 | 124 | hg: unknown command 'fastannotate' |
|
125 | 125 | (did you mean *) (glob) |
|
126 |
[ |
|
|
126 | [10] | |
|
127 | 127 | |
|
128 | 128 | rename |
|
129 | 129 | |
|
130 | 130 | $ hg mv a b |
|
131 | 131 | $ cat > b << EOF |
|
132 | 132 | > 0 |
|
133 | 133 | > 11 |
|
134 | 134 | > 3 |
|
135 | 135 | > 44 |
|
136 | 136 | > EOF |
|
137 | 137 | $ hg commit -m b -q |
|
138 | 138 | $ hg fastannotate -ncf --long-hash b |
|
139 | 139 | 3 d641cb51f61e331c44654104301f8154d7865c89 a: 0 |
|
140 | 140 | 5 d44dade239915bc82b91e4556b1257323f8e5824 b: 11 |
|
141 | 141 | 2 26162a884ba60e8c87bf4e0d6bb8efcc6f711a4e a: 3 |
|
142 | 142 | 5 d44dade239915bc82b91e4556b1257323f8e5824 b: 44 |
|
143 | 143 | $ hg fastannotate -r 26162a884ba60e8c87bf4e0d6bb8efcc6f711a4e a |
|
144 | 144 | 0: 1 |
|
145 | 145 | 1: 2 |
|
146 | 146 | 2: 3 |
|
147 | 147 | |
|
148 | 148 | fastannotate --deleted |
|
149 | 149 | |
|
150 | 150 | $ hg fastannotate --deleted -nf b |
|
151 | 151 | 3 a: 0 |
|
152 | 152 | 5 b: 11 |
|
153 | 153 | 0 a: -1 |
|
154 | 154 | 1 a: -2 |
|
155 | 155 | 2 a: 3 |
|
156 | 156 | 5 b: 44 |
|
157 | 157 | 4 a: -4 |
|
158 | 158 | $ hg fastannotate --deleted -r 3 -nf a |
|
159 | 159 | 3 a: 0 |
|
160 | 160 | 0 a: 1 |
|
161 | 161 | 1 a: 2 |
|
162 | 162 | |
|
163 | 163 | file and directories with ".l", ".m" suffixes |
|
164 | 164 | |
|
165 | 165 | $ cd .. |
|
166 | 166 | $ hg init repo2 |
|
167 | 167 | $ cd repo2 |
|
168 | 168 | |
|
169 | 169 | $ mkdir a.l b.m c.lock a.l.hg b.hg |
|
170 | 170 | $ for i in a b c d d.l d.m a.l/a b.m/a c.lock/a a.l.hg/a b.hg/a; do |
|
171 | 171 | > echo $i > $i |
|
172 | 172 | > done |
|
173 | 173 | $ hg add . -q |
|
174 | 174 | $ hg commit -m init |
|
175 | 175 | $ hg fastannotate a.l/a b.m/a c.lock/a a.l.hg/a b.hg/a d.l d.m a b c d |
|
176 | 176 | 0: a |
|
177 | 177 | 0: a.l.hg/a |
|
178 | 178 | 0: a.l/a |
|
179 | 179 | 0: b |
|
180 | 180 | 0: b.hg/a |
|
181 | 181 | 0: b.m/a |
|
182 | 182 | 0: c |
|
183 | 183 | 0: c.lock/a |
|
184 | 184 | 0: d |
|
185 | 185 | 0: d.l |
|
186 | 186 | 0: d.m |
|
187 | 187 | |
|
188 | 188 | empty file |
|
189 | 189 | |
|
190 | 190 | $ touch empty |
|
191 | 191 | $ hg commit -A empty -m empty |
|
192 | 192 | $ hg fastannotate empty |
|
193 | 193 | |
|
194 | 194 | json format |
|
195 | 195 | |
|
196 | 196 | $ hg fastannotate -Tjson -cludn b a empty |
|
197 | 197 | [ |
|
198 | 198 | { |
|
199 | 199 | "date": [0.0, 0], |
|
200 | 200 | "line": "a\n", |
|
201 | 201 | "line_number": 1, |
|
202 | 202 | "node": "1fd620b16252aecb54c6aa530dff5ed6e6ec3d21", |
|
203 | 203 | "rev": 0, |
|
204 | 204 | "user": "test" |
|
205 | 205 | }, |
|
206 | 206 | { |
|
207 | 207 | "date": [0.0, 0], |
|
208 | 208 | "line": "b\n", |
|
209 | 209 | "line_number": 1, |
|
210 | 210 | "node": "1fd620b16252aecb54c6aa530dff5ed6e6ec3d21", |
|
211 | 211 | "rev": 0, |
|
212 | 212 | "user": "test" |
|
213 | 213 | } |
|
214 | 214 | ] |
|
215 | 215 | |
|
216 | 216 | $ hg fastannotate -Tjson -cludn empty |
|
217 | 217 | [ |
|
218 | 218 | ] |
|
219 | 219 | $ hg fastannotate -Tjson --no-content -n a |
|
220 | 220 | [ |
|
221 | 221 | { |
|
222 | 222 | "rev": 0 |
|
223 | 223 | } |
|
224 | 224 | ] |
|
225 | 225 | |
|
226 | 226 | working copy |
|
227 | 227 | |
|
228 | 228 | $ echo a >> a |
|
229 | 229 | $ hg fastannotate -r 'wdir()' a |
|
230 | 230 | abort: cannot update linelog to wdir() |
|
231 | 231 | (set fastannotate.mainbranch) |
|
232 | 232 | [255] |
|
233 | 233 | $ cat >> $HGRCPATH << EOF |
|
234 | 234 | > [fastannotate] |
|
235 | 235 | > mainbranch = . |
|
236 | 236 | > EOF |
|
237 | 237 | $ hg fastannotate -r 'wdir()' a |
|
238 | 238 | 0 : a |
|
239 | 239 | 1+: a |
|
240 | 240 | $ hg fastannotate -cludn -r 'wdir()' a |
|
241 | 241 | test 0 1fd620b16252 Thu Jan 01 00:00:00 1970 +0000:1: a |
|
242 | 242 | test 1 720582f5bdb6+ *:2: a (glob) |
|
243 | 243 | $ hg fastannotate -cludn -r 'wdir()' -Tjson a |
|
244 | 244 | [ |
|
245 | 245 | { |
|
246 | 246 | "date": [0.0, 0], |
|
247 | 247 | "line": "a\n", |
|
248 | 248 | "line_number": 1, |
|
249 | 249 | "node": "1fd620b16252aecb54c6aa530dff5ed6e6ec3d21", |
|
250 | 250 | "rev": 0, |
|
251 | 251 | "user": "test" |
|
252 | 252 | }, |
|
253 | 253 | { |
|
254 | 254 | "date": [*, 0], (glob) |
|
255 | 255 | "line": "a\n", |
|
256 | 256 | "line_number": 2, |
|
257 | 257 | "node": null, |
|
258 | 258 | "rev": null, |
|
259 | 259 | "user": "test" |
|
260 | 260 | } |
|
261 | 261 | ] |
@@ -1,3932 +1,3932 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 another revision into working directory |
|
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 another revision into working directory |
|
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 | Extra extensions will be printed in help output in a non-reliable order since |
|
48 | 48 | the extension is unknown. |
|
49 | 49 | #if no-extraextensions |
|
50 | 50 | |
|
51 | 51 | $ hg help |
|
52 | 52 | Mercurial Distributed SCM |
|
53 | 53 | |
|
54 | 54 | list of commands: |
|
55 | 55 | |
|
56 | 56 | Repository creation: |
|
57 | 57 | |
|
58 | 58 | clone make a copy of an existing repository |
|
59 | 59 | init create a new repository in the given directory |
|
60 | 60 | |
|
61 | 61 | Remote repository management: |
|
62 | 62 | |
|
63 | 63 | incoming show new changesets found in source |
|
64 | 64 | outgoing show changesets not found in the destination |
|
65 | 65 | paths show aliases for remote repositories |
|
66 | 66 | pull pull changes from the specified source |
|
67 | 67 | push push changes to the specified destination |
|
68 | 68 | serve start stand-alone webserver |
|
69 | 69 | |
|
70 | 70 | Change creation: |
|
71 | 71 | |
|
72 | 72 | commit commit the specified files or all outstanding changes |
|
73 | 73 | |
|
74 | 74 | Change manipulation: |
|
75 | 75 | |
|
76 | 76 | backout reverse effect of earlier changeset |
|
77 | 77 | graft copy changes from other branches onto the current branch |
|
78 | 78 | merge merge another revision into working directory |
|
79 | 79 | |
|
80 | 80 | Change organization: |
|
81 | 81 | |
|
82 | 82 | bookmarks create a new bookmark or list existing bookmarks |
|
83 | 83 | branch set or show the current branch name |
|
84 | 84 | branches list repository named branches |
|
85 | 85 | phase set or show the current phase name |
|
86 | 86 | tag add one or more tags for the current or given revision |
|
87 | 87 | tags list repository tags |
|
88 | 88 | |
|
89 | 89 | File content management: |
|
90 | 90 | |
|
91 | 91 | annotate show changeset information by line for each file |
|
92 | 92 | cat output the current or given revision of files |
|
93 | 93 | copy mark files as copied for the next commit |
|
94 | 94 | diff diff repository (or selected files) |
|
95 | 95 | grep search for a pattern in specified files |
|
96 | 96 | |
|
97 | 97 | Change navigation: |
|
98 | 98 | |
|
99 | 99 | bisect subdivision search of changesets |
|
100 | 100 | heads show branch heads |
|
101 | 101 | identify identify the working directory or specified revision |
|
102 | 102 | log show revision history of entire repository or files |
|
103 | 103 | |
|
104 | 104 | Working directory management: |
|
105 | 105 | |
|
106 | 106 | add add the specified files on the next commit |
|
107 | 107 | addremove add all new files, delete all missing files |
|
108 | 108 | files list tracked files |
|
109 | 109 | forget forget the specified files on the next commit |
|
110 | 110 | remove remove the specified files on the next commit |
|
111 | 111 | rename rename files; equivalent of copy + remove |
|
112 | 112 | resolve redo merges or set/view the merge status of files |
|
113 | 113 | revert restore files to their checkout state |
|
114 | 114 | root print the root (top) of the current working directory |
|
115 | 115 | shelve save and set aside changes from the working directory |
|
116 | 116 | status show changed files in the working directory |
|
117 | 117 | summary summarize working directory state |
|
118 | 118 | unshelve restore a shelved change to the working directory |
|
119 | 119 | update update working directory (or switch revisions) |
|
120 | 120 | |
|
121 | 121 | Change import/export: |
|
122 | 122 | |
|
123 | 123 | archive create an unversioned archive of a repository revision |
|
124 | 124 | bundle create a bundle file |
|
125 | 125 | export dump the header and diffs for one or more changesets |
|
126 | 126 | import import an ordered set of patches |
|
127 | 127 | unbundle apply one or more bundle files |
|
128 | 128 | |
|
129 | 129 | Repository maintenance: |
|
130 | 130 | |
|
131 | 131 | manifest output the current or given revision of the project manifest |
|
132 | 132 | recover roll back an interrupted transaction |
|
133 | 133 | verify verify the integrity of the repository |
|
134 | 134 | |
|
135 | 135 | Help: |
|
136 | 136 | |
|
137 | 137 | config show combined config settings from all hgrc files |
|
138 | 138 | help show help for a given topic or a help overview |
|
139 | 139 | version output version and copyright information |
|
140 | 140 | |
|
141 | 141 | additional help topics: |
|
142 | 142 | |
|
143 | 143 | Mercurial identifiers: |
|
144 | 144 | |
|
145 | 145 | filesets Specifying File Sets |
|
146 | 146 | hgignore Syntax for Mercurial Ignore Files |
|
147 | 147 | patterns File Name Patterns |
|
148 | 148 | revisions Specifying Revisions |
|
149 | 149 | urls URL Paths |
|
150 | 150 | |
|
151 | 151 | Mercurial output: |
|
152 | 152 | |
|
153 | 153 | color Colorizing Outputs |
|
154 | 154 | dates Date Formats |
|
155 | 155 | diffs Diff Formats |
|
156 | 156 | templating Template Usage |
|
157 | 157 | |
|
158 | 158 | Mercurial configuration: |
|
159 | 159 | |
|
160 | 160 | config Configuration Files |
|
161 | 161 | environment Environment Variables |
|
162 | 162 | extensions Using Additional Features |
|
163 | 163 | flags Command-line flags |
|
164 | 164 | hgweb Configuring hgweb |
|
165 | 165 | merge-tools Merge Tools |
|
166 | 166 | pager Pager Support |
|
167 | 167 | |
|
168 | 168 | Concepts: |
|
169 | 169 | |
|
170 | 170 | bundlespec Bundle File Formats |
|
171 | 171 | glossary Glossary |
|
172 | 172 | phases Working with Phases |
|
173 | 173 | subrepos Subrepositories |
|
174 | 174 | |
|
175 | 175 | Miscellaneous: |
|
176 | 176 | |
|
177 | 177 | deprecated Deprecated Features |
|
178 | 178 | internals Technical implementation topics |
|
179 | 179 | scripting Using Mercurial from scripts and automation |
|
180 | 180 | |
|
181 | 181 | (use 'hg help -v' to show built-in aliases and global options) |
|
182 | 182 | |
|
183 | 183 | $ hg -q help |
|
184 | 184 | Repository creation: |
|
185 | 185 | |
|
186 | 186 | clone make a copy of an existing repository |
|
187 | 187 | init create a new repository in the given directory |
|
188 | 188 | |
|
189 | 189 | Remote repository management: |
|
190 | 190 | |
|
191 | 191 | incoming show new changesets found in source |
|
192 | 192 | outgoing show changesets not found in the destination |
|
193 | 193 | paths show aliases for remote repositories |
|
194 | 194 | pull pull changes from the specified source |
|
195 | 195 | push push changes to the specified destination |
|
196 | 196 | serve start stand-alone webserver |
|
197 | 197 | |
|
198 | 198 | Change creation: |
|
199 | 199 | |
|
200 | 200 | commit commit the specified files or all outstanding changes |
|
201 | 201 | |
|
202 | 202 | Change manipulation: |
|
203 | 203 | |
|
204 | 204 | backout reverse effect of earlier changeset |
|
205 | 205 | graft copy changes from other branches onto the current branch |
|
206 | 206 | merge merge another revision into working directory |
|
207 | 207 | |
|
208 | 208 | Change organization: |
|
209 | 209 | |
|
210 | 210 | bookmarks create a new bookmark or list existing bookmarks |
|
211 | 211 | branch set or show the current branch name |
|
212 | 212 | branches list repository named branches |
|
213 | 213 | phase set or show the current phase name |
|
214 | 214 | tag add one or more tags for the current or given revision |
|
215 | 215 | tags list repository tags |
|
216 | 216 | |
|
217 | 217 | File content management: |
|
218 | 218 | |
|
219 | 219 | annotate show changeset information by line for each file |
|
220 | 220 | cat output the current or given revision of files |
|
221 | 221 | copy mark files as copied for the next commit |
|
222 | 222 | diff diff repository (or selected files) |
|
223 | 223 | grep search for a pattern in specified files |
|
224 | 224 | |
|
225 | 225 | Change navigation: |
|
226 | 226 | |
|
227 | 227 | bisect subdivision search of changesets |
|
228 | 228 | heads show branch heads |
|
229 | 229 | identify identify the working directory or specified revision |
|
230 | 230 | log show revision history of entire repository or files |
|
231 | 231 | |
|
232 | 232 | Working directory management: |
|
233 | 233 | |
|
234 | 234 | add add the specified files on the next commit |
|
235 | 235 | addremove add all new files, delete all missing files |
|
236 | 236 | files list tracked files |
|
237 | 237 | forget forget the specified files on the next commit |
|
238 | 238 | remove remove the specified files on the next commit |
|
239 | 239 | rename rename files; equivalent of copy + remove |
|
240 | 240 | resolve redo merges or set/view the merge status of files |
|
241 | 241 | revert restore files to their checkout state |
|
242 | 242 | root print the root (top) of the current working directory |
|
243 | 243 | shelve save and set aside changes from the working directory |
|
244 | 244 | status show changed files in the working directory |
|
245 | 245 | summary summarize working directory state |
|
246 | 246 | unshelve restore a shelved change to the working directory |
|
247 | 247 | update update working directory (or switch revisions) |
|
248 | 248 | |
|
249 | 249 | Change import/export: |
|
250 | 250 | |
|
251 | 251 | archive create an unversioned archive of a repository revision |
|
252 | 252 | bundle create a bundle file |
|
253 | 253 | export dump the header and diffs for one or more changesets |
|
254 | 254 | import import an ordered set of patches |
|
255 | 255 | unbundle apply one or more bundle files |
|
256 | 256 | |
|
257 | 257 | Repository maintenance: |
|
258 | 258 | |
|
259 | 259 | manifest output the current or given revision of the project manifest |
|
260 | 260 | recover roll back an interrupted transaction |
|
261 | 261 | verify verify the integrity of the repository |
|
262 | 262 | |
|
263 | 263 | Help: |
|
264 | 264 | |
|
265 | 265 | config show combined config settings from all hgrc files |
|
266 | 266 | help show help for a given topic or a help overview |
|
267 | 267 | version output version and copyright information |
|
268 | 268 | |
|
269 | 269 | additional help topics: |
|
270 | 270 | |
|
271 | 271 | Mercurial identifiers: |
|
272 | 272 | |
|
273 | 273 | filesets Specifying File Sets |
|
274 | 274 | hgignore Syntax for Mercurial Ignore Files |
|
275 | 275 | patterns File Name Patterns |
|
276 | 276 | revisions Specifying Revisions |
|
277 | 277 | urls URL Paths |
|
278 | 278 | |
|
279 | 279 | Mercurial output: |
|
280 | 280 | |
|
281 | 281 | color Colorizing Outputs |
|
282 | 282 | dates Date Formats |
|
283 | 283 | diffs Diff Formats |
|
284 | 284 | templating Template Usage |
|
285 | 285 | |
|
286 | 286 | Mercurial configuration: |
|
287 | 287 | |
|
288 | 288 | config Configuration Files |
|
289 | 289 | environment Environment Variables |
|
290 | 290 | extensions Using Additional Features |
|
291 | 291 | flags Command-line flags |
|
292 | 292 | hgweb Configuring hgweb |
|
293 | 293 | merge-tools Merge Tools |
|
294 | 294 | pager Pager Support |
|
295 | 295 | |
|
296 | 296 | Concepts: |
|
297 | 297 | |
|
298 | 298 | bundlespec Bundle File Formats |
|
299 | 299 | glossary Glossary |
|
300 | 300 | phases Working with Phases |
|
301 | 301 | subrepos Subrepositories |
|
302 | 302 | |
|
303 | 303 | Miscellaneous: |
|
304 | 304 | |
|
305 | 305 | deprecated Deprecated Features |
|
306 | 306 | internals Technical implementation topics |
|
307 | 307 | scripting Using Mercurial from scripts and automation |
|
308 | 308 | |
|
309 | 309 | Test extension help: |
|
310 | 310 | $ hg help extensions --config extensions.rebase= --config extensions.children= |
|
311 | 311 | Using Additional Features |
|
312 | 312 | """"""""""""""""""""""""" |
|
313 | 313 | |
|
314 | 314 | Mercurial has the ability to add new features through the use of |
|
315 | 315 | extensions. Extensions may add new commands, add options to existing |
|
316 | 316 | commands, change the default behavior of commands, or implement hooks. |
|
317 | 317 | |
|
318 | 318 | To enable the "foo" extension, either shipped with Mercurial or in the |
|
319 | 319 | Python search path, create an entry for it in your configuration file, |
|
320 | 320 | like this: |
|
321 | 321 | |
|
322 | 322 | [extensions] |
|
323 | 323 | foo = |
|
324 | 324 | |
|
325 | 325 | You may also specify the full path to an extension: |
|
326 | 326 | |
|
327 | 327 | [extensions] |
|
328 | 328 | myfeature = ~/.hgext/myfeature.py |
|
329 | 329 | |
|
330 | 330 | See 'hg help config' for more information on configuration files. |
|
331 | 331 | |
|
332 | 332 | Extensions are not loaded by default for a variety of reasons: they can |
|
333 | 333 | increase startup overhead; they may be meant for advanced usage only; they |
|
334 | 334 | may provide potentially dangerous abilities (such as letting you destroy |
|
335 | 335 | or modify history); they might not be ready for prime time; or they may |
|
336 | 336 | alter some usual behaviors of stock Mercurial. It is thus up to the user |
|
337 | 337 | to activate extensions as needed. |
|
338 | 338 | |
|
339 | 339 | To explicitly disable an extension enabled in a configuration file of |
|
340 | 340 | broader scope, prepend its path with !: |
|
341 | 341 | |
|
342 | 342 | [extensions] |
|
343 | 343 | # disabling extension bar residing in /path/to/extension/bar.py |
|
344 | 344 | bar = !/path/to/extension/bar.py |
|
345 | 345 | # ditto, but no path was supplied for extension baz |
|
346 | 346 | baz = ! |
|
347 | 347 | |
|
348 | 348 | enabled extensions: |
|
349 | 349 | |
|
350 | 350 | children command to display child changesets (DEPRECATED) |
|
351 | 351 | rebase command to move sets of revisions to a different ancestor |
|
352 | 352 | |
|
353 | 353 | disabled extensions: |
|
354 | 354 | |
|
355 | 355 | acl hooks for controlling repository access |
|
356 | 356 | blackbox log repository events to a blackbox for debugging |
|
357 | 357 | bugzilla hooks for integrating with the Bugzilla bug tracker |
|
358 | 358 | censor erase file content at a given revision |
|
359 | 359 | churn command to display statistics about repository history |
|
360 | 360 | clonebundles advertise pre-generated bundles to seed clones |
|
361 | 361 | closehead close arbitrary heads without checking them out first |
|
362 | 362 | convert import revisions from foreign VCS repositories into |
|
363 | 363 | Mercurial |
|
364 | 364 | eol automatically manage newlines in repository files |
|
365 | 365 | extdiff command to allow external programs to compare revisions |
|
366 | 366 | factotum http authentication with factotum |
|
367 | 367 | fastexport export repositories as git fast-import stream |
|
368 | 368 | githelp try mapping git commands to Mercurial commands |
|
369 | 369 | gpg commands to sign and verify changesets |
|
370 | 370 | hgk browse the repository in a graphical way |
|
371 | 371 | highlight syntax highlighting for hgweb (requires Pygments) |
|
372 | 372 | histedit interactive history editing |
|
373 | 373 | keyword expand keywords in tracked files |
|
374 | 374 | largefiles track large binary files |
|
375 | 375 | mq manage a stack of patches |
|
376 | 376 | notify hooks for sending email push notifications |
|
377 | 377 | patchbomb command to send changesets as (a series of) patch emails |
|
378 | 378 | purge command to delete untracked files from the working |
|
379 | 379 | directory |
|
380 | 380 | relink recreates hardlinks between repository clones |
|
381 | 381 | schemes extend schemes with shortcuts to repository swarms |
|
382 | 382 | share share a common history between several working directories |
|
383 | 383 | transplant command to transplant changesets from another branch |
|
384 | 384 | win32mbcs allow the use of MBCS paths with problematic encodings |
|
385 | 385 | zeroconf discover and advertise repositories on the local network |
|
386 | 386 | |
|
387 | 387 | #endif |
|
388 | 388 | |
|
389 | 389 | Verify that deprecated extensions are included if --verbose: |
|
390 | 390 | |
|
391 | 391 | $ hg -v help extensions | grep children |
|
392 | 392 | children command to display child changesets (DEPRECATED) |
|
393 | 393 | |
|
394 | 394 | Verify that extension keywords appear in help templates |
|
395 | 395 | |
|
396 | 396 | $ hg help --config extensions.transplant= templating|grep transplant > /dev/null |
|
397 | 397 | |
|
398 | 398 | Test short command list with verbose option |
|
399 | 399 | |
|
400 | 400 | $ hg -v help shortlist |
|
401 | 401 | Mercurial Distributed SCM |
|
402 | 402 | |
|
403 | 403 | basic commands: |
|
404 | 404 | |
|
405 | 405 | abort abort an unfinished operation (EXPERIMENTAL) |
|
406 | 406 | add add the specified files on the next commit |
|
407 | 407 | annotate, blame |
|
408 | 408 | show changeset information by line for each file |
|
409 | 409 | clone make a copy of an existing repository |
|
410 | 410 | commit, ci commit the specified files or all outstanding changes |
|
411 | 411 | continue resumes an interrupted operation (EXPERIMENTAL) |
|
412 | 412 | diff diff repository (or selected files) |
|
413 | 413 | export dump the header and diffs for one or more changesets |
|
414 | 414 | forget forget the specified files on the next commit |
|
415 | 415 | init create a new repository in the given directory |
|
416 | 416 | log, history show revision history of entire repository or files |
|
417 | 417 | merge merge another revision into working directory |
|
418 | 418 | pull pull changes from the specified source |
|
419 | 419 | push push changes to the specified destination |
|
420 | 420 | remove, rm remove the specified files on the next commit |
|
421 | 421 | serve start stand-alone webserver |
|
422 | 422 | status, st show changed files in the working directory |
|
423 | 423 | summary, sum summarize working directory state |
|
424 | 424 | update, up, checkout, co |
|
425 | 425 | update working directory (or switch revisions) |
|
426 | 426 | |
|
427 | 427 | global options ([+] can be repeated): |
|
428 | 428 | |
|
429 | 429 | -R --repository REPO repository root directory or name of overlay bundle |
|
430 | 430 | file |
|
431 | 431 | --cwd DIR change working directory |
|
432 | 432 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
433 | 433 | all prompts |
|
434 | 434 | -q --quiet suppress output |
|
435 | 435 | -v --verbose enable additional output |
|
436 | 436 | --color TYPE when to colorize (boolean, always, auto, never, or |
|
437 | 437 | debug) |
|
438 | 438 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
439 | 439 | --debug enable debugging output |
|
440 | 440 | --debugger start debugger |
|
441 | 441 | --encoding ENCODE set the charset encoding (default: ascii) |
|
442 | 442 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
443 | 443 | --traceback always print a traceback on exception |
|
444 | 444 | --time time how long the command takes |
|
445 | 445 | --profile print command execution profile |
|
446 | 446 | --version output version information and exit |
|
447 | 447 | -h --help display help and exit |
|
448 | 448 | --hidden consider hidden changesets |
|
449 | 449 | --pager TYPE when to paginate (boolean, always, auto, or never) |
|
450 | 450 | (default: auto) |
|
451 | 451 | |
|
452 | 452 | (use 'hg help' for the full list of commands) |
|
453 | 453 | |
|
454 | 454 | $ hg add -h |
|
455 | 455 | hg add [OPTION]... [FILE]... |
|
456 | 456 | |
|
457 | 457 | add the specified files on the next commit |
|
458 | 458 | |
|
459 | 459 | Schedule files to be version controlled and added to the repository. |
|
460 | 460 | |
|
461 | 461 | The files will be added to the repository at the next commit. To undo an |
|
462 | 462 | add before that, see 'hg forget'. |
|
463 | 463 | |
|
464 | 464 | If no names are given, add all files to the repository (except files |
|
465 | 465 | matching ".hgignore"). |
|
466 | 466 | |
|
467 | 467 | Returns 0 if all files are successfully added. |
|
468 | 468 | |
|
469 | 469 | options ([+] can be repeated): |
|
470 | 470 | |
|
471 | 471 | -I --include PATTERN [+] include names matching the given patterns |
|
472 | 472 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
473 | 473 | -S --subrepos recurse into subrepositories |
|
474 | 474 | -n --dry-run do not perform actions, just print output |
|
475 | 475 | |
|
476 | 476 | (some details hidden, use --verbose to show complete help) |
|
477 | 477 | |
|
478 | 478 | Verbose help for add |
|
479 | 479 | |
|
480 | 480 | $ hg add -hv |
|
481 | 481 | hg add [OPTION]... [FILE]... |
|
482 | 482 | |
|
483 | 483 | add the specified files on the next commit |
|
484 | 484 | |
|
485 | 485 | Schedule files to be version controlled and added to the repository. |
|
486 | 486 | |
|
487 | 487 | The files will be added to the repository at the next commit. To undo an |
|
488 | 488 | add before that, see 'hg forget'. |
|
489 | 489 | |
|
490 | 490 | If no names are given, add all files to the repository (except files |
|
491 | 491 | matching ".hgignore"). |
|
492 | 492 | |
|
493 | 493 | Examples: |
|
494 | 494 | |
|
495 | 495 | - New (unknown) files are added automatically by 'hg add': |
|
496 | 496 | |
|
497 | 497 | $ ls |
|
498 | 498 | foo.c |
|
499 | 499 | $ hg status |
|
500 | 500 | ? foo.c |
|
501 | 501 | $ hg add |
|
502 | 502 | adding foo.c |
|
503 | 503 | $ hg status |
|
504 | 504 | A foo.c |
|
505 | 505 | |
|
506 | 506 | - Specific files to be added can be specified: |
|
507 | 507 | |
|
508 | 508 | $ ls |
|
509 | 509 | bar.c foo.c |
|
510 | 510 | $ hg status |
|
511 | 511 | ? bar.c |
|
512 | 512 | ? foo.c |
|
513 | 513 | $ hg add bar.c |
|
514 | 514 | $ hg status |
|
515 | 515 | A bar.c |
|
516 | 516 | ? foo.c |
|
517 | 517 | |
|
518 | 518 | Returns 0 if all files are successfully added. |
|
519 | 519 | |
|
520 | 520 | options ([+] can be repeated): |
|
521 | 521 | |
|
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 | -n --dry-run do not perform actions, just print output |
|
526 | 526 | |
|
527 | 527 | global options ([+] can be repeated): |
|
528 | 528 | |
|
529 | 529 | -R --repository REPO repository root directory or name of overlay bundle |
|
530 | 530 | file |
|
531 | 531 | --cwd DIR change working directory |
|
532 | 532 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
533 | 533 | all prompts |
|
534 | 534 | -q --quiet suppress output |
|
535 | 535 | -v --verbose enable additional output |
|
536 | 536 | --color TYPE when to colorize (boolean, always, auto, never, or |
|
537 | 537 | debug) |
|
538 | 538 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
539 | 539 | --debug enable debugging output |
|
540 | 540 | --debugger start debugger |
|
541 | 541 | --encoding ENCODE set the charset encoding (default: ascii) |
|
542 | 542 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
543 | 543 | --traceback always print a traceback on exception |
|
544 | 544 | --time time how long the command takes |
|
545 | 545 | --profile print command execution profile |
|
546 | 546 | --version output version information and exit |
|
547 | 547 | -h --help display help and exit |
|
548 | 548 | --hidden consider hidden changesets |
|
549 | 549 | --pager TYPE when to paginate (boolean, always, auto, or never) |
|
550 | 550 | (default: auto) |
|
551 | 551 | |
|
552 | 552 | Test the textwidth config option |
|
553 | 553 | |
|
554 | 554 | $ hg root -h --config ui.textwidth=50 |
|
555 | 555 | hg root |
|
556 | 556 | |
|
557 | 557 | print the root (top) of the current working |
|
558 | 558 | directory |
|
559 | 559 | |
|
560 | 560 | Print the root directory of the current |
|
561 | 561 | repository. |
|
562 | 562 | |
|
563 | 563 | Returns 0 on success. |
|
564 | 564 | |
|
565 | 565 | options: |
|
566 | 566 | |
|
567 | 567 | -T --template TEMPLATE display with template |
|
568 | 568 | |
|
569 | 569 | (some details hidden, use --verbose to show |
|
570 | 570 | complete help) |
|
571 | 571 | |
|
572 | 572 | Test help option with version option |
|
573 | 573 | |
|
574 | 574 | $ hg add -h --version |
|
575 | 575 | Mercurial Distributed SCM (version *) (glob) |
|
576 | 576 | (see https://mercurial-scm.org for more information) |
|
577 | 577 | |
|
578 | 578 | Copyright (C) 2005-* Matt Mackall and others (glob) |
|
579 | 579 | This is free software; see the source for copying conditions. There is NO |
|
580 | 580 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
581 | 581 | |
|
582 | 582 | $ hg add --skjdfks |
|
583 | 583 | hg add: option --skjdfks not recognized |
|
584 | 584 | hg add [OPTION]... [FILE]... |
|
585 | 585 | |
|
586 | 586 | add the specified files on the next commit |
|
587 | 587 | |
|
588 | 588 | options ([+] can be repeated): |
|
589 | 589 | |
|
590 | 590 | -I --include PATTERN [+] include names matching the given patterns |
|
591 | 591 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
592 | 592 | -S --subrepos recurse into subrepositories |
|
593 | 593 | -n --dry-run do not perform actions, just print output |
|
594 | 594 | |
|
595 | 595 | (use 'hg add -h' to show more help) |
|
596 |
[ |
|
|
596 | [10] | |
|
597 | 597 | |
|
598 | 598 | Test ambiguous command help |
|
599 | 599 | |
|
600 | 600 | $ hg help ad |
|
601 | 601 | list of commands: |
|
602 | 602 | |
|
603 | 603 | add add the specified files on the next commit |
|
604 | 604 | addremove add all new files, delete all missing files |
|
605 | 605 | |
|
606 | 606 | (use 'hg help -v ad' to show built-in aliases and global options) |
|
607 | 607 | |
|
608 | 608 | Test command without options |
|
609 | 609 | |
|
610 | 610 | $ hg help verify |
|
611 | 611 | hg verify |
|
612 | 612 | |
|
613 | 613 | verify the integrity of the repository |
|
614 | 614 | |
|
615 | 615 | Verify the integrity of the current repository. |
|
616 | 616 | |
|
617 | 617 | This will perform an extensive check of the repository's integrity, |
|
618 | 618 | validating the hashes and checksums of each entry in the changelog, |
|
619 | 619 | manifest, and tracked files, as well as the integrity of their crosslinks |
|
620 | 620 | and indices. |
|
621 | 621 | |
|
622 | 622 | Please see https://mercurial-scm.org/wiki/RepositoryCorruption for more |
|
623 | 623 | information about recovery from corruption of the repository. |
|
624 | 624 | |
|
625 | 625 | Returns 0 on success, 1 if errors are encountered. |
|
626 | 626 | |
|
627 | 627 | options: |
|
628 | 628 | |
|
629 | 629 | (some details hidden, use --verbose to show complete help) |
|
630 | 630 | |
|
631 | 631 | $ hg help diff |
|
632 | 632 | hg diff [OPTION]... ([-c REV] | [--from REV1] [--to REV2]) [FILE]... |
|
633 | 633 | |
|
634 | 634 | diff repository (or selected files) |
|
635 | 635 | |
|
636 | 636 | Show differences between revisions for the specified files. |
|
637 | 637 | |
|
638 | 638 | Differences between files are shown using the unified diff format. |
|
639 | 639 | |
|
640 | 640 | Note: |
|
641 | 641 | 'hg diff' may generate unexpected results for merges, as it will |
|
642 | 642 | default to comparing against the working directory's first parent |
|
643 | 643 | changeset if no revisions are specified. |
|
644 | 644 | |
|
645 | 645 | By default, the working directory files are compared to its first parent. |
|
646 | 646 | To see the differences from another revision, use --from. To see the |
|
647 | 647 | difference to another revision, use --to. For example, 'hg diff --from .^' |
|
648 | 648 | will show the differences from the working copy's grandparent to the |
|
649 | 649 | working copy, 'hg diff --to .' will show the diff from the working copy to |
|
650 | 650 | its parent (i.e. the reverse of the default), and 'hg diff --from 1.0 --to |
|
651 | 651 | 1.2' will show the diff between those two revisions. |
|
652 | 652 | |
|
653 | 653 | Alternatively you can specify -c/--change with a revision to see the |
|
654 | 654 | changes in that changeset relative to its first parent (i.e. 'hg diff -c |
|
655 | 655 | 42' is equivalent to 'hg diff --from 42^ --to 42') |
|
656 | 656 | |
|
657 | 657 | Without the -a/--text option, diff will avoid generating diffs of files it |
|
658 | 658 | detects as binary. With -a, diff will generate a diff anyway, probably |
|
659 | 659 | with undesirable results. |
|
660 | 660 | |
|
661 | 661 | Use the -g/--git option to generate diffs in the git extended diff format. |
|
662 | 662 | For more information, read 'hg help diffs'. |
|
663 | 663 | |
|
664 | 664 | Returns 0 on success. |
|
665 | 665 | |
|
666 | 666 | options ([+] can be repeated): |
|
667 | 667 | |
|
668 | 668 | --from REV1 revision to diff from |
|
669 | 669 | --to REV2 revision to diff to |
|
670 | 670 | -c --change REV change made by revision |
|
671 | 671 | -a --text treat all files as text |
|
672 | 672 | -g --git use git extended diff format |
|
673 | 673 | --binary generate binary diffs in git mode (default) |
|
674 | 674 | --nodates omit dates from diff headers |
|
675 | 675 | --noprefix omit a/ and b/ prefixes from filenames |
|
676 | 676 | -p --show-function show which function each change is in |
|
677 | 677 | --reverse produce a diff that undoes the changes |
|
678 | 678 | -w --ignore-all-space ignore white space when comparing lines |
|
679 | 679 | -b --ignore-space-change ignore changes in the amount of white space |
|
680 | 680 | -B --ignore-blank-lines ignore changes whose lines are all blank |
|
681 | 681 | -Z --ignore-space-at-eol ignore changes in whitespace at EOL |
|
682 | 682 | -U --unified NUM number of lines of context to show |
|
683 | 683 | --stat output diffstat-style summary of changes |
|
684 | 684 | --root DIR produce diffs relative to subdirectory |
|
685 | 685 | -I --include PATTERN [+] include names matching the given patterns |
|
686 | 686 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
687 | 687 | -S --subrepos recurse into subrepositories |
|
688 | 688 | |
|
689 | 689 | (some details hidden, use --verbose to show complete help) |
|
690 | 690 | |
|
691 | 691 | $ hg help status |
|
692 | 692 | hg status [OPTION]... [FILE]... |
|
693 | 693 | |
|
694 | 694 | aliases: st |
|
695 | 695 | |
|
696 | 696 | show changed files in the working directory |
|
697 | 697 | |
|
698 | 698 | Show status of files in the repository. If names are given, only files |
|
699 | 699 | that match are shown. Files that are clean or ignored or the source of a |
|
700 | 700 | copy/move operation, are not listed unless -c/--clean, -i/--ignored, |
|
701 | 701 | -C/--copies or -A/--all are given. Unless options described with "show |
|
702 | 702 | only ..." are given, the options -mardu are used. |
|
703 | 703 | |
|
704 | 704 | Option -q/--quiet hides untracked (unknown and ignored) files unless |
|
705 | 705 | explicitly requested with -u/--unknown or -i/--ignored. |
|
706 | 706 | |
|
707 | 707 | Note: |
|
708 | 708 | 'hg status' may appear to disagree with diff if permissions have |
|
709 | 709 | changed or a merge has occurred. The standard diff format does not |
|
710 | 710 | report permission changes and diff only reports changes relative to one |
|
711 | 711 | merge parent. |
|
712 | 712 | |
|
713 | 713 | If one revision is given, it is used as the base revision. If two |
|
714 | 714 | revisions are given, the differences between them are shown. The --change |
|
715 | 715 | option can also be used as a shortcut to list the changed files of a |
|
716 | 716 | revision from its first parent. |
|
717 | 717 | |
|
718 | 718 | The codes used to show the status of files are: |
|
719 | 719 | |
|
720 | 720 | M = modified |
|
721 | 721 | A = added |
|
722 | 722 | R = removed |
|
723 | 723 | C = clean |
|
724 | 724 | ! = missing (deleted by non-hg command, but still tracked) |
|
725 | 725 | ? = not tracked |
|
726 | 726 | I = ignored |
|
727 | 727 | = origin of the previous file (with --copies) |
|
728 | 728 | |
|
729 | 729 | Returns 0 on success. |
|
730 | 730 | |
|
731 | 731 | options ([+] can be repeated): |
|
732 | 732 | |
|
733 | 733 | -A --all show status of all files |
|
734 | 734 | -m --modified show only modified files |
|
735 | 735 | -a --added show only added files |
|
736 | 736 | -r --removed show only removed files |
|
737 | 737 | -d --deleted show only missing files |
|
738 | 738 | -c --clean show only files without changes |
|
739 | 739 | -u --unknown show only unknown (not tracked) files |
|
740 | 740 | -i --ignored show only ignored files |
|
741 | 741 | -n --no-status hide status prefix |
|
742 | 742 | -C --copies show source of copied files |
|
743 | 743 | -0 --print0 end filenames with NUL, for use with xargs |
|
744 | 744 | --rev REV [+] show difference from revision |
|
745 | 745 | --change REV list the changed files of a revision |
|
746 | 746 | -I --include PATTERN [+] include names matching the given patterns |
|
747 | 747 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
748 | 748 | -S --subrepos recurse into subrepositories |
|
749 | 749 | -T --template TEMPLATE display with template |
|
750 | 750 | |
|
751 | 751 | (some details hidden, use --verbose to show complete help) |
|
752 | 752 | |
|
753 | 753 | $ hg -q help status |
|
754 | 754 | hg status [OPTION]... [FILE]... |
|
755 | 755 | |
|
756 | 756 | show changed files in the working directory |
|
757 | 757 | |
|
758 | 758 | $ hg help foo |
|
759 | 759 | abort: no such help topic: foo |
|
760 | 760 | (try 'hg help --keyword foo') |
|
761 | 761 | [10] |
|
762 | 762 | |
|
763 | 763 | $ hg skjdfks |
|
764 | 764 | hg: unknown command 'skjdfks' |
|
765 | 765 | (use 'hg help' for a list of commands) |
|
766 |
[ |
|
|
766 | [10] | |
|
767 | 767 | |
|
768 | 768 | Typoed command gives suggestion |
|
769 | 769 | $ hg puls |
|
770 | 770 | hg: unknown command 'puls' |
|
771 | 771 | (did you mean one of pull, push?) |
|
772 |
[ |
|
|
772 | [10] | |
|
773 | 773 | |
|
774 | 774 | Not enabled extension gets suggested |
|
775 | 775 | |
|
776 | 776 | $ hg rebase |
|
777 | 777 | hg: unknown command 'rebase' |
|
778 | 778 | 'rebase' is provided by the following extension: |
|
779 | 779 | |
|
780 | 780 | rebase command to move sets of revisions to a different ancestor |
|
781 | 781 | |
|
782 | 782 | (use 'hg help extensions' for information on enabling extensions) |
|
783 |
[ |
|
|
783 | [10] | |
|
784 | 784 | |
|
785 | 785 | Disabled extension gets suggested |
|
786 | 786 | $ hg --config extensions.rebase=! rebase |
|
787 | 787 | hg: unknown command 'rebase' |
|
788 | 788 | 'rebase' is provided by the following extension: |
|
789 | 789 | |
|
790 | 790 | rebase command to move sets of revisions to a different ancestor |
|
791 | 791 | |
|
792 | 792 | (use 'hg help extensions' for information on enabling extensions) |
|
793 |
[ |
|
|
793 | [10] | |
|
794 | 794 | |
|
795 | 795 | Checking that help adapts based on the config: |
|
796 | 796 | |
|
797 | 797 | $ hg help diff --config ui.tweakdefaults=true | egrep -e '^ *(-g|config)' |
|
798 | 798 | -g --[no-]git use git extended diff format (default: on from |
|
799 | 799 | config) |
|
800 | 800 | |
|
801 | 801 | Make sure that we don't run afoul of the help system thinking that |
|
802 | 802 | this is a section and erroring out weirdly. |
|
803 | 803 | |
|
804 | 804 | $ hg .log |
|
805 | 805 | hg: unknown command '.log' |
|
806 | 806 | (did you mean log?) |
|
807 |
[ |
|
|
807 | [10] | |
|
808 | 808 | |
|
809 | 809 | $ hg log. |
|
810 | 810 | hg: unknown command 'log.' |
|
811 | 811 | (did you mean log?) |
|
812 |
[ |
|
|
812 | [10] | |
|
813 | 813 | $ hg pu.lh |
|
814 | 814 | hg: unknown command 'pu.lh' |
|
815 | 815 | (did you mean one of pull, push?) |
|
816 |
[ |
|
|
816 | [10] | |
|
817 | 817 | |
|
818 | 818 | $ cat > helpext.py <<EOF |
|
819 | 819 | > import os |
|
820 | 820 | > from mercurial import commands, fancyopts, registrar |
|
821 | 821 | > |
|
822 | 822 | > def func(arg): |
|
823 | 823 | > return '%sfoo' % arg |
|
824 | 824 | > class customopt(fancyopts.customopt): |
|
825 | 825 | > def newstate(self, oldstate, newparam, abort): |
|
826 | 826 | > return '%sbar' % oldstate |
|
827 | 827 | > cmdtable = {} |
|
828 | 828 | > command = registrar.command(cmdtable) |
|
829 | 829 | > |
|
830 | 830 | > @command(b'nohelp', |
|
831 | 831 | > [(b'', b'longdesc', 3, b'x'*67), |
|
832 | 832 | > (b'n', b'', None, b'normal desc'), |
|
833 | 833 | > (b'', b'newline', b'', b'line1\nline2'), |
|
834 | 834 | > (b'', b'default-off', False, b'enable X'), |
|
835 | 835 | > (b'', b'default-on', True, b'enable Y'), |
|
836 | 836 | > (b'', b'callableopt', func, b'adds foo'), |
|
837 | 837 | > (b'', b'customopt', customopt(''), b'adds bar'), |
|
838 | 838 | > (b'', b'customopt-withdefault', customopt('foo'), b'adds bar')], |
|
839 | 839 | > b'hg nohelp', |
|
840 | 840 | > norepo=True) |
|
841 | 841 | > @command(b'debugoptADV', [(b'', b'aopt', None, b'option is (ADVANCED)')]) |
|
842 | 842 | > @command(b'debugoptDEP', [(b'', b'dopt', None, b'option is (DEPRECATED)')]) |
|
843 | 843 | > @command(b'debugoptEXP', [(b'', b'eopt', None, b'option is (EXPERIMENTAL)')]) |
|
844 | 844 | > def nohelp(ui, *args, **kwargs): |
|
845 | 845 | > pass |
|
846 | 846 | > |
|
847 | 847 | > @command(b'hashelp', [], b'hg hashelp', norepo=True) |
|
848 | 848 | > def hashelp(ui, *args, **kwargs): |
|
849 | 849 | > """Extension command's help""" |
|
850 | 850 | > |
|
851 | 851 | > def uisetup(ui): |
|
852 | 852 | > ui.setconfig(b'alias', b'shellalias', b'!echo hi', b'helpext') |
|
853 | 853 | > ui.setconfig(b'alias', b'hgalias', b'summary', b'helpext') |
|
854 | 854 | > ui.setconfig(b'alias', b'hgalias:doc', b'My doc', b'helpext') |
|
855 | 855 | > ui.setconfig(b'alias', b'hgalias:category', b'navigation', b'helpext') |
|
856 | 856 | > ui.setconfig(b'alias', b'hgaliasnodoc', b'summary', b'helpext') |
|
857 | 857 | > |
|
858 | 858 | > EOF |
|
859 | 859 | $ echo '[extensions]' >> $HGRCPATH |
|
860 | 860 | $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH |
|
861 | 861 | |
|
862 | 862 | Test for aliases |
|
863 | 863 | |
|
864 | 864 | $ hg help | grep hgalias |
|
865 | 865 | hgalias My doc |
|
866 | 866 | |
|
867 | 867 | $ hg help hgalias |
|
868 | 868 | hg hgalias [--remote] |
|
869 | 869 | |
|
870 | 870 | alias for: hg summary |
|
871 | 871 | |
|
872 | 872 | My doc |
|
873 | 873 | |
|
874 | 874 | defined by: helpext |
|
875 | 875 | |
|
876 | 876 | options: |
|
877 | 877 | |
|
878 | 878 | --remote check for push and pull |
|
879 | 879 | |
|
880 | 880 | (some details hidden, use --verbose to show complete help) |
|
881 | 881 | $ hg help hgaliasnodoc |
|
882 | 882 | hg hgaliasnodoc [--remote] |
|
883 | 883 | |
|
884 | 884 | alias for: hg summary |
|
885 | 885 | |
|
886 | 886 | summarize working directory state |
|
887 | 887 | |
|
888 | 888 | This generates a brief summary of the working directory state, including |
|
889 | 889 | parents, branch, commit status, phase and available updates. |
|
890 | 890 | |
|
891 | 891 | With the --remote option, this will check the default paths for incoming |
|
892 | 892 | and outgoing changes. This can be time-consuming. |
|
893 | 893 | |
|
894 | 894 | Returns 0 on success. |
|
895 | 895 | |
|
896 | 896 | defined by: helpext |
|
897 | 897 | |
|
898 | 898 | options: |
|
899 | 899 | |
|
900 | 900 | --remote check for push and pull |
|
901 | 901 | |
|
902 | 902 | (some details hidden, use --verbose to show complete help) |
|
903 | 903 | |
|
904 | 904 | $ hg help shellalias |
|
905 | 905 | hg shellalias |
|
906 | 906 | |
|
907 | 907 | shell alias for: echo hi |
|
908 | 908 | |
|
909 | 909 | (no help text available) |
|
910 | 910 | |
|
911 | 911 | defined by: helpext |
|
912 | 912 | |
|
913 | 913 | (some details hidden, use --verbose to show complete help) |
|
914 | 914 | |
|
915 | 915 | Test command with no help text |
|
916 | 916 | |
|
917 | 917 | $ hg help nohelp |
|
918 | 918 | hg nohelp |
|
919 | 919 | |
|
920 | 920 | (no help text available) |
|
921 | 921 | |
|
922 | 922 | options: |
|
923 | 923 | |
|
924 | 924 | --longdesc VALUE |
|
925 | 925 | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
|
926 | 926 | xxxxxxxxxxxxxxxxxxxxxxx (default: 3) |
|
927 | 927 | -n -- normal desc |
|
928 | 928 | --newline VALUE line1 line2 |
|
929 | 929 | --default-off enable X |
|
930 | 930 | --[no-]default-on enable Y (default: on) |
|
931 | 931 | --callableopt VALUE adds foo |
|
932 | 932 | --customopt VALUE adds bar |
|
933 | 933 | --customopt-withdefault VALUE adds bar (default: foo) |
|
934 | 934 | |
|
935 | 935 | (some details hidden, use --verbose to show complete help) |
|
936 | 936 | |
|
937 | 937 | Test that default list of commands includes extension commands that have help, |
|
938 | 938 | but not those that don't, except in verbose mode, when a keyword is passed, or |
|
939 | 939 | when help about the extension is requested. |
|
940 | 940 | |
|
941 | 941 | #if no-extraextensions |
|
942 | 942 | |
|
943 | 943 | $ hg help | grep hashelp |
|
944 | 944 | hashelp Extension command's help |
|
945 | 945 | $ hg help | grep nohelp |
|
946 | 946 | [1] |
|
947 | 947 | $ hg help -v | grep nohelp |
|
948 | 948 | nohelp (no help text available) |
|
949 | 949 | |
|
950 | 950 | $ hg help -k nohelp |
|
951 | 951 | Commands: |
|
952 | 952 | |
|
953 | 953 | nohelp hg nohelp |
|
954 | 954 | |
|
955 | 955 | Extension Commands: |
|
956 | 956 | |
|
957 | 957 | nohelp (no help text available) |
|
958 | 958 | |
|
959 | 959 | $ hg help helpext |
|
960 | 960 | helpext extension - no help text available |
|
961 | 961 | |
|
962 | 962 | list of commands: |
|
963 | 963 | |
|
964 | 964 | hashelp Extension command's help |
|
965 | 965 | nohelp (no help text available) |
|
966 | 966 | |
|
967 | 967 | (use 'hg help -v helpext' to show built-in aliases and global options) |
|
968 | 968 | |
|
969 | 969 | #endif |
|
970 | 970 | |
|
971 | 971 | Test list of internal help commands |
|
972 | 972 | |
|
973 | 973 | $ hg help debug |
|
974 | 974 | debug commands (internal and unsupported): |
|
975 | 975 | |
|
976 | 976 | debugancestor |
|
977 | 977 | find the ancestor revision of two revisions in a given index |
|
978 | 978 | debugantivirusrunning |
|
979 | 979 | attempt to trigger an antivirus scanner to see if one is active |
|
980 | 980 | debugapplystreamclonebundle |
|
981 | 981 | apply a stream clone bundle file |
|
982 | 982 | debugbackupbundle |
|
983 | 983 | lists the changesets available in backup bundles |
|
984 | 984 | debugbuilddag |
|
985 | 985 | builds a repo with a given DAG from scratch in the current |
|
986 | 986 | empty repo |
|
987 | 987 | debugbundle lists the contents of a bundle |
|
988 | 988 | debugcapabilities |
|
989 | 989 | lists the capabilities of a remote peer |
|
990 | 990 | debugchangedfiles |
|
991 | 991 | list the stored files changes for a revision |
|
992 | 992 | debugcheckstate |
|
993 | 993 | validate the correctness of the current dirstate |
|
994 | 994 | debugcolor show available color, effects or style |
|
995 | 995 | debugcommands |
|
996 | 996 | list all available commands and options |
|
997 | 997 | debugcomplete |
|
998 | 998 | returns the completion list associated with the given command |
|
999 | 999 | debugcreatestreamclonebundle |
|
1000 | 1000 | create a stream clone bundle file |
|
1001 | 1001 | debugdag format the changelog or an index DAG as a concise textual |
|
1002 | 1002 | description |
|
1003 | 1003 | debugdata dump the contents of a data file revision |
|
1004 | 1004 | debugdate parse and display a date |
|
1005 | 1005 | debugdeltachain |
|
1006 | 1006 | dump information about delta chains in a revlog |
|
1007 | 1007 | debugdirstate |
|
1008 | 1008 | show the contents of the current dirstate |
|
1009 | 1009 | debugdiscovery |
|
1010 | 1010 | runs the changeset discovery protocol in isolation |
|
1011 | 1011 | debugdownload |
|
1012 | 1012 | download a resource using Mercurial logic and config |
|
1013 | 1013 | debugextensions |
|
1014 | 1014 | show information about active extensions |
|
1015 | 1015 | debugfileset parse and apply a fileset specification |
|
1016 | 1016 | debugformat display format information about the current repository |
|
1017 | 1017 | debugfsinfo show information detected about current filesystem |
|
1018 | 1018 | debuggetbundle |
|
1019 | 1019 | retrieves a bundle from a repo |
|
1020 | 1020 | debugignore display the combined ignore pattern and information about |
|
1021 | 1021 | ignored files |
|
1022 | 1022 | debugindex dump index data for a storage primitive |
|
1023 | 1023 | debugindexdot |
|
1024 | 1024 | dump an index DAG as a graphviz dot file |
|
1025 | 1025 | debugindexstats |
|
1026 | 1026 | show stats related to the changelog index |
|
1027 | 1027 | debuginstall test Mercurial installation |
|
1028 | 1028 | debugknown test whether node ids are known to a repo |
|
1029 | 1029 | debuglocks show or modify state of locks |
|
1030 | 1030 | debugmanifestfulltextcache |
|
1031 | 1031 | show, clear or amend the contents of the manifest fulltext |
|
1032 | 1032 | cache |
|
1033 | 1033 | debugmergestate |
|
1034 | 1034 | print merge state |
|
1035 | 1035 | debugnamecomplete |
|
1036 | 1036 | complete "names" - tags, open branch names, bookmark names |
|
1037 | 1037 | debugnodemap write and inspect on disk nodemap |
|
1038 | 1038 | debugobsolete |
|
1039 | 1039 | create arbitrary obsolete marker |
|
1040 | 1040 | debugoptADV (no help text available) |
|
1041 | 1041 | debugoptDEP (no help text available) |
|
1042 | 1042 | debugoptEXP (no help text available) |
|
1043 | 1043 | debugp1copies |
|
1044 | 1044 | dump copy information compared to p1 |
|
1045 | 1045 | debugp2copies |
|
1046 | 1046 | dump copy information compared to p2 |
|
1047 | 1047 | debugpathcomplete |
|
1048 | 1048 | complete part or all of a tracked path |
|
1049 | 1049 | debugpathcopies |
|
1050 | 1050 | show copies between two revisions |
|
1051 | 1051 | debugpeer establish a connection to a peer repository |
|
1052 | 1052 | debugpickmergetool |
|
1053 | 1053 | examine which merge tool is chosen for specified file |
|
1054 | 1054 | debugpushkey access the pushkey key/value protocol |
|
1055 | 1055 | debugpvec (no help text available) |
|
1056 | 1056 | debugrebuilddirstate |
|
1057 | 1057 | rebuild the dirstate as it would look like for the given |
|
1058 | 1058 | revision |
|
1059 | 1059 | debugrebuildfncache |
|
1060 | 1060 | rebuild the fncache file |
|
1061 | 1061 | debugrename dump rename information |
|
1062 | 1062 | debugrequires |
|
1063 | 1063 | print the current repo requirements |
|
1064 | 1064 | debugrevlog show data and statistics about a revlog |
|
1065 | 1065 | debugrevlogindex |
|
1066 | 1066 | dump the contents of a revlog index |
|
1067 | 1067 | debugrevspec parse and apply a revision specification |
|
1068 | 1068 | debugserve run a server with advanced settings |
|
1069 | 1069 | debugsetparents |
|
1070 | 1070 | manually set the parents of the current working directory |
|
1071 | 1071 | (DANGEROUS) |
|
1072 | 1072 | debugsidedata |
|
1073 | 1073 | dump the side data for a cl/manifest/file revision |
|
1074 | 1074 | debugssl test a secure connection to a server |
|
1075 | 1075 | debugstrip strip changesets and all their descendants from the repository |
|
1076 | 1076 | debugsub (no help text available) |
|
1077 | 1077 | debugsuccessorssets |
|
1078 | 1078 | show set of successors for revision |
|
1079 | 1079 | debugtagscache |
|
1080 | 1080 | display the contents of .hg/cache/hgtagsfnodes1 |
|
1081 | 1081 | debugtemplate |
|
1082 | 1082 | parse and apply a template |
|
1083 | 1083 | debuguigetpass |
|
1084 | 1084 | show prompt to type password |
|
1085 | 1085 | debuguiprompt |
|
1086 | 1086 | show plain prompt |
|
1087 | 1087 | debugupdatecaches |
|
1088 | 1088 | warm all known caches in the repository |
|
1089 | 1089 | debugupgraderepo |
|
1090 | 1090 | upgrade a repository to use different features |
|
1091 | 1091 | debugwalk show how files match on given patterns |
|
1092 | 1092 | debugwhyunstable |
|
1093 | 1093 | explain instabilities of a changeset |
|
1094 | 1094 | debugwireargs |
|
1095 | 1095 | (no help text available) |
|
1096 | 1096 | debugwireproto |
|
1097 | 1097 | send wire protocol commands to a server |
|
1098 | 1098 | |
|
1099 | 1099 | (use 'hg help -v debug' to show built-in aliases and global options) |
|
1100 | 1100 | |
|
1101 | 1101 | internals topic renders index of available sub-topics |
|
1102 | 1102 | |
|
1103 | 1103 | $ hg help internals |
|
1104 | 1104 | Technical implementation topics |
|
1105 | 1105 | """"""""""""""""""""""""""""""" |
|
1106 | 1106 | |
|
1107 | 1107 | To access a subtopic, use "hg help internals.{subtopic-name}" |
|
1108 | 1108 | |
|
1109 | 1109 | bid-merge Bid Merge Algorithm |
|
1110 | 1110 | bundle2 Bundle2 |
|
1111 | 1111 | bundles Bundles |
|
1112 | 1112 | cbor CBOR |
|
1113 | 1113 | censor Censor |
|
1114 | 1114 | changegroups Changegroups |
|
1115 | 1115 | config Config Registrar |
|
1116 | 1116 | extensions Extension API |
|
1117 | 1117 | mergestate Mergestate |
|
1118 | 1118 | requirements Repository Requirements |
|
1119 | 1119 | revlogs Revision Logs |
|
1120 | 1120 | wireprotocol Wire Protocol |
|
1121 | 1121 | wireprotocolrpc |
|
1122 | 1122 | Wire Protocol RPC |
|
1123 | 1123 | wireprotocolv2 |
|
1124 | 1124 | Wire Protocol Version 2 |
|
1125 | 1125 | |
|
1126 | 1126 | sub-topics can be accessed |
|
1127 | 1127 | |
|
1128 | 1128 | $ hg help internals.changegroups |
|
1129 | 1129 | Changegroups |
|
1130 | 1130 | """""""""""" |
|
1131 | 1131 | |
|
1132 | 1132 | Changegroups are representations of repository revlog data, specifically |
|
1133 | 1133 | the changelog data, root/flat manifest data, treemanifest data, and |
|
1134 | 1134 | filelogs. |
|
1135 | 1135 | |
|
1136 | 1136 | There are 3 versions of changegroups: "1", "2", and "3". From a high- |
|
1137 | 1137 | level, versions "1" and "2" are almost exactly the same, with the only |
|
1138 | 1138 | difference being an additional item in the *delta header*. Version "3" |
|
1139 | 1139 | adds support for storage flags in the *delta header* and optionally |
|
1140 | 1140 | exchanging treemanifests (enabled by setting an option on the |
|
1141 | 1141 | "changegroup" part in the bundle2). |
|
1142 | 1142 | |
|
1143 | 1143 | Changegroups when not exchanging treemanifests consist of 3 logical |
|
1144 | 1144 | segments: |
|
1145 | 1145 | |
|
1146 | 1146 | +---------------------------------+ |
|
1147 | 1147 | | | | | |
|
1148 | 1148 | | changeset | manifest | filelogs | |
|
1149 | 1149 | | | | | |
|
1150 | 1150 | | | | | |
|
1151 | 1151 | +---------------------------------+ |
|
1152 | 1152 | |
|
1153 | 1153 | When exchanging treemanifests, there are 4 logical segments: |
|
1154 | 1154 | |
|
1155 | 1155 | +-------------------------------------------------+ |
|
1156 | 1156 | | | | | | |
|
1157 | 1157 | | changeset | root | treemanifests | filelogs | |
|
1158 | 1158 | | | manifest | | | |
|
1159 | 1159 | | | | | | |
|
1160 | 1160 | +-------------------------------------------------+ |
|
1161 | 1161 | |
|
1162 | 1162 | The principle building block of each segment is a *chunk*. A *chunk* is a |
|
1163 | 1163 | framed piece of data: |
|
1164 | 1164 | |
|
1165 | 1165 | +---------------------------------------+ |
|
1166 | 1166 | | | | |
|
1167 | 1167 | | length | data | |
|
1168 | 1168 | | (4 bytes) | (<length - 4> bytes) | |
|
1169 | 1169 | | | | |
|
1170 | 1170 | +---------------------------------------+ |
|
1171 | 1171 | |
|
1172 | 1172 | All integers are big-endian signed integers. Each chunk starts with a |
|
1173 | 1173 | 32-bit integer indicating the length of the entire chunk (including the |
|
1174 | 1174 | length field itself). |
|
1175 | 1175 | |
|
1176 | 1176 | There is a special case chunk that has a value of 0 for the length |
|
1177 | 1177 | ("0x00000000"). We call this an *empty chunk*. |
|
1178 | 1178 | |
|
1179 | 1179 | Delta Groups |
|
1180 | 1180 | ============ |
|
1181 | 1181 | |
|
1182 | 1182 | A *delta group* expresses the content of a revlog as a series of deltas, |
|
1183 | 1183 | or patches against previous revisions. |
|
1184 | 1184 | |
|
1185 | 1185 | Delta groups consist of 0 or more *chunks* followed by the *empty chunk* |
|
1186 | 1186 | to signal the end of the delta group: |
|
1187 | 1187 | |
|
1188 | 1188 | +------------------------------------------------------------------------+ |
|
1189 | 1189 | | | | | | | |
|
1190 | 1190 | | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 | |
|
1191 | 1191 | | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) | |
|
1192 | 1192 | | | | | | | |
|
1193 | 1193 | +------------------------------------------------------------------------+ |
|
1194 | 1194 | |
|
1195 | 1195 | Each *chunk*'s data consists of the following: |
|
1196 | 1196 | |
|
1197 | 1197 | +---------------------------------------+ |
|
1198 | 1198 | | | | |
|
1199 | 1199 | | delta header | delta data | |
|
1200 | 1200 | | (various by version) | (various) | |
|
1201 | 1201 | | | | |
|
1202 | 1202 | +---------------------------------------+ |
|
1203 | 1203 | |
|
1204 | 1204 | The *delta data* is a series of *delta*s that describe a diff from an |
|
1205 | 1205 | existing entry (either that the recipient already has, or previously |
|
1206 | 1206 | specified in the bundle/changegroup). |
|
1207 | 1207 | |
|
1208 | 1208 | The *delta header* is different between versions "1", "2", and "3" of the |
|
1209 | 1209 | changegroup format. |
|
1210 | 1210 | |
|
1211 | 1211 | Version 1 (headerlen=80): |
|
1212 | 1212 | |
|
1213 | 1213 | +------------------------------------------------------+ |
|
1214 | 1214 | | | | | | |
|
1215 | 1215 | | node | p1 node | p2 node | link node | |
|
1216 | 1216 | | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | |
|
1217 | 1217 | | | | | | |
|
1218 | 1218 | +------------------------------------------------------+ |
|
1219 | 1219 | |
|
1220 | 1220 | Version 2 (headerlen=100): |
|
1221 | 1221 | |
|
1222 | 1222 | +------------------------------------------------------------------+ |
|
1223 | 1223 | | | | | | | |
|
1224 | 1224 | | node | p1 node | p2 node | base node | link node | |
|
1225 | 1225 | | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | |
|
1226 | 1226 | | | | | | | |
|
1227 | 1227 | +------------------------------------------------------------------+ |
|
1228 | 1228 | |
|
1229 | 1229 | Version 3 (headerlen=102): |
|
1230 | 1230 | |
|
1231 | 1231 | +------------------------------------------------------------------------------+ |
|
1232 | 1232 | | | | | | | | |
|
1233 | 1233 | | node | p1 node | p2 node | base node | link node | flags | |
|
1234 | 1234 | | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) | |
|
1235 | 1235 | | | | | | | | |
|
1236 | 1236 | +------------------------------------------------------------------------------+ |
|
1237 | 1237 | |
|
1238 | 1238 | The *delta data* consists of "chunklen - 4 - headerlen" bytes, which |
|
1239 | 1239 | contain a series of *delta*s, densely packed (no separators). These deltas |
|
1240 | 1240 | describe a diff from an existing entry (either that the recipient already |
|
1241 | 1241 | has, or previously specified in the bundle/changegroup). The format is |
|
1242 | 1242 | described more fully in "hg help internals.bdiff", but briefly: |
|
1243 | 1243 | |
|
1244 | 1244 | +---------------------------------------------------------------+ |
|
1245 | 1245 | | | | | | |
|
1246 | 1246 | | start offset | end offset | new length | content | |
|
1247 | 1247 | | (4 bytes) | (4 bytes) | (4 bytes) | (<new length> bytes) | |
|
1248 | 1248 | | | | | | |
|
1249 | 1249 | +---------------------------------------------------------------+ |
|
1250 | 1250 | |
|
1251 | 1251 | Please note that the length field in the delta data does *not* include |
|
1252 | 1252 | itself. |
|
1253 | 1253 | |
|
1254 | 1254 | In version 1, the delta is always applied against the previous node from |
|
1255 | 1255 | the changegroup or the first parent if this is the first entry in the |
|
1256 | 1256 | changegroup. |
|
1257 | 1257 | |
|
1258 | 1258 | In version 2 and up, the delta base node is encoded in the entry in the |
|
1259 | 1259 | changegroup. This allows the delta to be expressed against any parent, |
|
1260 | 1260 | which can result in smaller deltas and more efficient encoding of data. |
|
1261 | 1261 | |
|
1262 | 1262 | The *flags* field holds bitwise flags affecting the processing of revision |
|
1263 | 1263 | data. The following flags are defined: |
|
1264 | 1264 | |
|
1265 | 1265 | 32768 |
|
1266 | 1266 | Censored revision. The revision's fulltext has been replaced by censor |
|
1267 | 1267 | metadata. May only occur on file revisions. |
|
1268 | 1268 | |
|
1269 | 1269 | 16384 |
|
1270 | 1270 | Ellipsis revision. Revision hash does not match data (likely due to |
|
1271 | 1271 | rewritten parents). |
|
1272 | 1272 | |
|
1273 | 1273 | 8192 |
|
1274 | 1274 | Externally stored. The revision fulltext contains "key:value" "\n" |
|
1275 | 1275 | delimited metadata defining an object stored elsewhere. Used by the LFS |
|
1276 | 1276 | extension. |
|
1277 | 1277 | |
|
1278 | 1278 | For historical reasons, the integer values are identical to revlog version |
|
1279 | 1279 | 1 per-revision storage flags and correspond to bits being set in this |
|
1280 | 1280 | 2-byte field. Bits were allocated starting from the most-significant bit, |
|
1281 | 1281 | hence the reverse ordering and allocation of these flags. |
|
1282 | 1282 | |
|
1283 | 1283 | Changeset Segment |
|
1284 | 1284 | ================= |
|
1285 | 1285 | |
|
1286 | 1286 | The *changeset segment* consists of a single *delta group* holding |
|
1287 | 1287 | changelog data. The *empty chunk* at the end of the *delta group* denotes |
|
1288 | 1288 | the boundary to the *manifest segment*. |
|
1289 | 1289 | |
|
1290 | 1290 | Manifest Segment |
|
1291 | 1291 | ================ |
|
1292 | 1292 | |
|
1293 | 1293 | The *manifest segment* consists of a single *delta group* holding manifest |
|
1294 | 1294 | data. If treemanifests are in use, it contains only the manifest for the |
|
1295 | 1295 | root directory of the repository. Otherwise, it contains the entire |
|
1296 | 1296 | manifest data. The *empty chunk* at the end of the *delta group* denotes |
|
1297 | 1297 | the boundary to the next segment (either the *treemanifests segment* or |
|
1298 | 1298 | the *filelogs segment*, depending on version and the request options). |
|
1299 | 1299 | |
|
1300 | 1300 | Treemanifests Segment |
|
1301 | 1301 | --------------------- |
|
1302 | 1302 | |
|
1303 | 1303 | The *treemanifests segment* only exists in changegroup version "3", and |
|
1304 | 1304 | only if the 'treemanifest' param is part of the bundle2 changegroup part |
|
1305 | 1305 | (it is not possible to use changegroup version 3 outside of bundle2). |
|
1306 | 1306 | Aside from the filenames in the *treemanifests segment* containing a |
|
1307 | 1307 | trailing "/" character, it behaves identically to the *filelogs segment* |
|
1308 | 1308 | (see below). The final sub-segment is followed by an *empty chunk* |
|
1309 | 1309 | (logically, a sub-segment with filename size 0). This denotes the boundary |
|
1310 | 1310 | to the *filelogs segment*. |
|
1311 | 1311 | |
|
1312 | 1312 | Filelogs Segment |
|
1313 | 1313 | ================ |
|
1314 | 1314 | |
|
1315 | 1315 | The *filelogs segment* consists of multiple sub-segments, each |
|
1316 | 1316 | corresponding to an individual file whose data is being described: |
|
1317 | 1317 | |
|
1318 | 1318 | +--------------------------------------------------+ |
|
1319 | 1319 | | | | | | | |
|
1320 | 1320 | | filelog0 | filelog1 | filelog2 | ... | 0x0 | |
|
1321 | 1321 | | | | | | (4 bytes) | |
|
1322 | 1322 | | | | | | | |
|
1323 | 1323 | +--------------------------------------------------+ |
|
1324 | 1324 | |
|
1325 | 1325 | The final filelog sub-segment is followed by an *empty chunk* (logically, |
|
1326 | 1326 | a sub-segment with filename size 0). This denotes the end of the segment |
|
1327 | 1327 | and of the overall changegroup. |
|
1328 | 1328 | |
|
1329 | 1329 | Each filelog sub-segment consists of the following: |
|
1330 | 1330 | |
|
1331 | 1331 | +------------------------------------------------------+ |
|
1332 | 1332 | | | | | |
|
1333 | 1333 | | filename length | filename | delta group | |
|
1334 | 1334 | | (4 bytes) | (<length - 4> bytes) | (various) | |
|
1335 | 1335 | | | | | |
|
1336 | 1336 | +------------------------------------------------------+ |
|
1337 | 1337 | |
|
1338 | 1338 | That is, a *chunk* consisting of the filename (not terminated or padded) |
|
1339 | 1339 | followed by N chunks constituting the *delta group* for this file. The |
|
1340 | 1340 | *empty chunk* at the end of each *delta group* denotes the boundary to the |
|
1341 | 1341 | next filelog sub-segment. |
|
1342 | 1342 | |
|
1343 | 1343 | non-existent subtopics print an error |
|
1344 | 1344 | |
|
1345 | 1345 | $ hg help internals.foo |
|
1346 | 1346 | abort: no such help topic: internals.foo |
|
1347 | 1347 | (try 'hg help --keyword foo') |
|
1348 | 1348 | [10] |
|
1349 | 1349 | |
|
1350 | 1350 | test advanced, deprecated and experimental options are hidden in command help |
|
1351 | 1351 | $ hg help debugoptADV |
|
1352 | 1352 | hg debugoptADV |
|
1353 | 1353 | |
|
1354 | 1354 | (no help text available) |
|
1355 | 1355 | |
|
1356 | 1356 | options: |
|
1357 | 1357 | |
|
1358 | 1358 | (some details hidden, use --verbose to show complete help) |
|
1359 | 1359 | $ hg help debugoptDEP |
|
1360 | 1360 | hg debugoptDEP |
|
1361 | 1361 | |
|
1362 | 1362 | (no help text available) |
|
1363 | 1363 | |
|
1364 | 1364 | options: |
|
1365 | 1365 | |
|
1366 | 1366 | (some details hidden, use --verbose to show complete help) |
|
1367 | 1367 | |
|
1368 | 1368 | $ hg help debugoptEXP |
|
1369 | 1369 | hg debugoptEXP |
|
1370 | 1370 | |
|
1371 | 1371 | (no help text available) |
|
1372 | 1372 | |
|
1373 | 1373 | options: |
|
1374 | 1374 | |
|
1375 | 1375 | (some details hidden, use --verbose to show complete help) |
|
1376 | 1376 | |
|
1377 | 1377 | test advanced, deprecated and experimental options are shown with -v |
|
1378 | 1378 | $ hg help -v debugoptADV | grep aopt |
|
1379 | 1379 | --aopt option is (ADVANCED) |
|
1380 | 1380 | $ hg help -v debugoptDEP | grep dopt |
|
1381 | 1381 | --dopt option is (DEPRECATED) |
|
1382 | 1382 | $ hg help -v debugoptEXP | grep eopt |
|
1383 | 1383 | --eopt option is (EXPERIMENTAL) |
|
1384 | 1384 | |
|
1385 | 1385 | #if gettext |
|
1386 | 1386 | test deprecated option is hidden with translation with untranslated description |
|
1387 | 1387 | (use many globy for not failing on changed transaction) |
|
1388 | 1388 | $ LANGUAGE=sv hg help debugoptDEP |
|
1389 | 1389 | hg debugoptDEP |
|
1390 | 1390 | |
|
1391 | 1391 | (*) (glob) |
|
1392 | 1392 | |
|
1393 | 1393 | options: |
|
1394 | 1394 | |
|
1395 | 1395 | (some details hidden, use --verbose to show complete help) |
|
1396 | 1396 | #endif |
|
1397 | 1397 | |
|
1398 | 1398 | Test commands that collide with topics (issue4240) |
|
1399 | 1399 | |
|
1400 | 1400 | $ hg config -hq |
|
1401 | 1401 | hg config [-u] [NAME]... |
|
1402 | 1402 | |
|
1403 | 1403 | show combined config settings from all hgrc files |
|
1404 | 1404 | $ hg showconfig -hq |
|
1405 | 1405 | hg config [-u] [NAME]... |
|
1406 | 1406 | |
|
1407 | 1407 | show combined config settings from all hgrc files |
|
1408 | 1408 | |
|
1409 | 1409 | Test a help topic |
|
1410 | 1410 | |
|
1411 | 1411 | $ hg help dates |
|
1412 | 1412 | Date Formats |
|
1413 | 1413 | """""""""""" |
|
1414 | 1414 | |
|
1415 | 1415 | Some commands allow the user to specify a date, e.g.: |
|
1416 | 1416 | |
|
1417 | 1417 | - backout, commit, import, tag: Specify the commit date. |
|
1418 | 1418 | - log, revert, update: Select revision(s) by date. |
|
1419 | 1419 | |
|
1420 | 1420 | Many date formats are valid. Here are some examples: |
|
1421 | 1421 | |
|
1422 | 1422 | - "Wed Dec 6 13:18:29 2006" (local timezone assumed) |
|
1423 | 1423 | - "Dec 6 13:18 -0600" (year assumed, time offset provided) |
|
1424 | 1424 | - "Dec 6 13:18 UTC" (UTC and GMT are aliases for +0000) |
|
1425 | 1425 | - "Dec 6" (midnight) |
|
1426 | 1426 | - "13:18" (today assumed) |
|
1427 | 1427 | - "3:39" (3:39AM assumed) |
|
1428 | 1428 | - "3:39pm" (15:39) |
|
1429 | 1429 | - "2006-12-06 13:18:29" (ISO 8601 format) |
|
1430 | 1430 | - "2006-12-6 13:18" |
|
1431 | 1431 | - "2006-12-6" |
|
1432 | 1432 | - "12-6" |
|
1433 | 1433 | - "12/6" |
|
1434 | 1434 | - "12/6/6" (Dec 6 2006) |
|
1435 | 1435 | - "today" (midnight) |
|
1436 | 1436 | - "yesterday" (midnight) |
|
1437 | 1437 | - "now" - right now |
|
1438 | 1438 | |
|
1439 | 1439 | Lastly, there is Mercurial's internal format: |
|
1440 | 1440 | |
|
1441 | 1441 | - "1165411109 0" (Wed Dec 6 13:18:29 2006 UTC) |
|
1442 | 1442 | |
|
1443 | 1443 | This is the internal representation format for dates. The first number is |
|
1444 | 1444 | the number of seconds since the epoch (1970-01-01 00:00 UTC). The second |
|
1445 | 1445 | is the offset of the local timezone, in seconds west of UTC (negative if |
|
1446 | 1446 | the timezone is east of UTC). |
|
1447 | 1447 | |
|
1448 | 1448 | The log command also accepts date ranges: |
|
1449 | 1449 | |
|
1450 | 1450 | - "<DATE" - at or before a given date/time |
|
1451 | 1451 | - ">DATE" - on or after a given date/time |
|
1452 | 1452 | - "DATE to DATE" - a date range, inclusive |
|
1453 | 1453 | - "-DAYS" - within a given number of days from today |
|
1454 | 1454 | |
|
1455 | 1455 | Test repeated config section name |
|
1456 | 1456 | |
|
1457 | 1457 | $ hg help config.host |
|
1458 | 1458 | "http_proxy.host" |
|
1459 | 1459 | Host name and (optional) port of the proxy server, for example |
|
1460 | 1460 | "myproxy:8000". |
|
1461 | 1461 | |
|
1462 | 1462 | "smtp.host" |
|
1463 | 1463 | Host name of mail server, e.g. "mail.example.com". |
|
1464 | 1464 | |
|
1465 | 1465 | |
|
1466 | 1466 | Test section name with dot |
|
1467 | 1467 | |
|
1468 | 1468 | $ hg help config.ui.username |
|
1469 | 1469 | "ui.username" |
|
1470 | 1470 | The committer of a changeset created when running "commit". Typically |
|
1471 | 1471 | a person's name and email address, e.g. "Fred Widget |
|
1472 | 1472 | <fred@example.com>". Environment variables in the username are |
|
1473 | 1473 | expanded. |
|
1474 | 1474 | |
|
1475 | 1475 | (default: "$EMAIL" or "username@hostname". If the username in hgrc is |
|
1476 | 1476 | empty, e.g. if the system admin set "username =" in the system hgrc, |
|
1477 | 1477 | it has to be specified manually or in a different hgrc file) |
|
1478 | 1478 | |
|
1479 | 1479 | |
|
1480 | 1480 | $ hg help config.annotate.git |
|
1481 | 1481 | abort: help section not found: config.annotate.git |
|
1482 | 1482 | [10] |
|
1483 | 1483 | |
|
1484 | 1484 | $ hg help config.update.check |
|
1485 | 1485 | "commands.update.check" |
|
1486 | 1486 | Determines what level of checking 'hg update' will perform before |
|
1487 | 1487 | moving to a destination revision. Valid values are "abort", "none", |
|
1488 | 1488 | "linear", and "noconflict". "abort" always fails if the working |
|
1489 | 1489 | directory has uncommitted changes. "none" performs no checking, and |
|
1490 | 1490 | may result in a merge with uncommitted changes. "linear" allows any |
|
1491 | 1491 | update as long as it follows a straight line in the revision history, |
|
1492 | 1492 | and may trigger a merge with uncommitted changes. "noconflict" will |
|
1493 | 1493 | allow any update which would not trigger a merge with uncommitted |
|
1494 | 1494 | changes, if any are present. (default: "linear") |
|
1495 | 1495 | |
|
1496 | 1496 | |
|
1497 | 1497 | $ hg help config.commands.update.check |
|
1498 | 1498 | "commands.update.check" |
|
1499 | 1499 | Determines what level of checking 'hg update' will perform before |
|
1500 | 1500 | moving to a destination revision. Valid values are "abort", "none", |
|
1501 | 1501 | "linear", and "noconflict". "abort" always fails if the working |
|
1502 | 1502 | directory has uncommitted changes. "none" performs no checking, and |
|
1503 | 1503 | may result in a merge with uncommitted changes. "linear" allows any |
|
1504 | 1504 | update as long as it follows a straight line in the revision history, |
|
1505 | 1505 | and may trigger a merge with uncommitted changes. "noconflict" will |
|
1506 | 1506 | allow any update which would not trigger a merge with uncommitted |
|
1507 | 1507 | changes, if any are present. (default: "linear") |
|
1508 | 1508 | |
|
1509 | 1509 | |
|
1510 | 1510 | $ hg help config.ommands.update.check |
|
1511 | 1511 | abort: help section not found: config.ommands.update.check |
|
1512 | 1512 | [10] |
|
1513 | 1513 | |
|
1514 | 1514 | Unrelated trailing paragraphs shouldn't be included |
|
1515 | 1515 | |
|
1516 | 1516 | $ hg help config.extramsg | grep '^$' |
|
1517 | 1517 | |
|
1518 | 1518 | |
|
1519 | 1519 | Test capitalized section name |
|
1520 | 1520 | |
|
1521 | 1521 | $ hg help scripting.HGPLAIN > /dev/null |
|
1522 | 1522 | |
|
1523 | 1523 | Help subsection: |
|
1524 | 1524 | |
|
1525 | 1525 | $ hg help config.charsets |grep "Email example:" > /dev/null |
|
1526 | 1526 | [1] |
|
1527 | 1527 | |
|
1528 | 1528 | Show nested definitions |
|
1529 | 1529 | ("profiling.type"[break]"ls"[break]"stat"[break]) |
|
1530 | 1530 | |
|
1531 | 1531 | $ hg help config.type | egrep '^$'|wc -l |
|
1532 | 1532 | \s*3 (re) |
|
1533 | 1533 | |
|
1534 | 1534 | $ hg help config.profiling.type.ls |
|
1535 | 1535 | "profiling.type.ls" |
|
1536 | 1536 | Use Python's built-in instrumenting profiler. This profiler works on |
|
1537 | 1537 | all platforms, but each line number it reports is the first line of |
|
1538 | 1538 | a function. This restriction makes it difficult to identify the |
|
1539 | 1539 | expensive parts of a non-trivial function. |
|
1540 | 1540 | |
|
1541 | 1541 | |
|
1542 | 1542 | Separate sections from subsections |
|
1543 | 1543 | |
|
1544 | 1544 | $ hg help config.format | egrep '^ ("|-)|^\s*$' | uniq |
|
1545 | 1545 | "format" |
|
1546 | 1546 | -------- |
|
1547 | 1547 | |
|
1548 | 1548 | "usegeneraldelta" |
|
1549 | 1549 | |
|
1550 | 1550 | "dotencode" |
|
1551 | 1551 | |
|
1552 | 1552 | "usefncache" |
|
1553 | 1553 | |
|
1554 | 1554 | "usestore" |
|
1555 | 1555 | |
|
1556 | 1556 | "sparse-revlog" |
|
1557 | 1557 | |
|
1558 | 1558 | "revlog-compression" |
|
1559 | 1559 | |
|
1560 | 1560 | "bookmarks-in-store" |
|
1561 | 1561 | |
|
1562 | 1562 | "profiling" |
|
1563 | 1563 | ----------- |
|
1564 | 1564 | |
|
1565 | 1565 | "format" |
|
1566 | 1566 | |
|
1567 | 1567 | "progress" |
|
1568 | 1568 | ---------- |
|
1569 | 1569 | |
|
1570 | 1570 | "format" |
|
1571 | 1571 | |
|
1572 | 1572 | |
|
1573 | 1573 | Last item in help config.*: |
|
1574 | 1574 | |
|
1575 | 1575 | $ hg help config.`hg help config|grep '^ "'| \ |
|
1576 | 1576 | > tail -1|sed 's![ "]*!!g'`| \ |
|
1577 | 1577 | > grep 'hg help -c config' > /dev/null |
|
1578 | 1578 | [1] |
|
1579 | 1579 | |
|
1580 | 1580 | note to use help -c for general hg help config: |
|
1581 | 1581 | |
|
1582 | 1582 | $ hg help config |grep 'hg help -c config' > /dev/null |
|
1583 | 1583 | |
|
1584 | 1584 | Test templating help |
|
1585 | 1585 | |
|
1586 | 1586 | $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) ' |
|
1587 | 1587 | desc String. The text of the changeset description. |
|
1588 | 1588 | diffstat String. Statistics of changes with the following format: |
|
1589 | 1589 | firstline Any text. Returns the first line of text. |
|
1590 | 1590 | nonempty Any text. Returns '(none)' if the string is empty. |
|
1591 | 1591 | |
|
1592 | 1592 | Test deprecated items |
|
1593 | 1593 | |
|
1594 | 1594 | $ hg help -v templating | grep currentbookmark |
|
1595 | 1595 | currentbookmark |
|
1596 | 1596 | $ hg help templating | (grep currentbookmark || true) |
|
1597 | 1597 | |
|
1598 | 1598 | Test help hooks |
|
1599 | 1599 | |
|
1600 | 1600 | $ cat > helphook1.py <<EOF |
|
1601 | 1601 | > from mercurial import help |
|
1602 | 1602 | > |
|
1603 | 1603 | > def rewrite(ui, topic, doc): |
|
1604 | 1604 | > return doc + b'\nhelphook1\n' |
|
1605 | 1605 | > |
|
1606 | 1606 | > def extsetup(ui): |
|
1607 | 1607 | > help.addtopichook(b'revisions', rewrite) |
|
1608 | 1608 | > EOF |
|
1609 | 1609 | $ cat > helphook2.py <<EOF |
|
1610 | 1610 | > from mercurial import help |
|
1611 | 1611 | > |
|
1612 | 1612 | > def rewrite(ui, topic, doc): |
|
1613 | 1613 | > return doc + b'\nhelphook2\n' |
|
1614 | 1614 | > |
|
1615 | 1615 | > def extsetup(ui): |
|
1616 | 1616 | > help.addtopichook(b'revisions', rewrite) |
|
1617 | 1617 | > EOF |
|
1618 | 1618 | $ echo '[extensions]' >> $HGRCPATH |
|
1619 | 1619 | $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH |
|
1620 | 1620 | $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH |
|
1621 | 1621 | $ hg help revsets | grep helphook |
|
1622 | 1622 | helphook1 |
|
1623 | 1623 | helphook2 |
|
1624 | 1624 | |
|
1625 | 1625 | help -c should only show debug --debug |
|
1626 | 1626 | |
|
1627 | 1627 | $ hg help -c --debug|egrep debug|wc -l|egrep '^\s*0\s*$' |
|
1628 | 1628 | [1] |
|
1629 | 1629 | |
|
1630 | 1630 | help -c should only show deprecated for -v |
|
1631 | 1631 | |
|
1632 | 1632 | $ hg help -c -v|egrep DEPRECATED|wc -l|egrep '^\s*0\s*$' |
|
1633 | 1633 | [1] |
|
1634 | 1634 | |
|
1635 | 1635 | Test -s / --system |
|
1636 | 1636 | |
|
1637 | 1637 | $ hg help config.files -s windows |grep 'etc/mercurial' | \ |
|
1638 | 1638 | > wc -l | sed -e 's/ //g' |
|
1639 | 1639 | 0 |
|
1640 | 1640 | $ hg help config.files --system unix | grep 'USER' | \ |
|
1641 | 1641 | > wc -l | sed -e 's/ //g' |
|
1642 | 1642 | 0 |
|
1643 | 1643 | |
|
1644 | 1644 | Test -e / -c / -k combinations |
|
1645 | 1645 | |
|
1646 | 1646 | $ hg help -c|egrep '^[A-Z].*:|^ debug' |
|
1647 | 1647 | Commands: |
|
1648 | 1648 | $ hg help -e|egrep '^[A-Z].*:|^ debug' |
|
1649 | 1649 | Extensions: |
|
1650 | 1650 | $ hg help -k|egrep '^[A-Z].*:|^ debug' |
|
1651 | 1651 | Topics: |
|
1652 | 1652 | Commands: |
|
1653 | 1653 | Extensions: |
|
1654 | 1654 | Extension Commands: |
|
1655 | 1655 | $ hg help -c schemes |
|
1656 | 1656 | abort: no such help topic: schemes |
|
1657 | 1657 | (try 'hg help --keyword schemes') |
|
1658 | 1658 | [10] |
|
1659 | 1659 | $ hg help -e schemes |head -1 |
|
1660 | 1660 | schemes extension - extend schemes with shortcuts to repository swarms |
|
1661 | 1661 | $ hg help -c -k dates |egrep '^(Topics|Extensions|Commands):' |
|
1662 | 1662 | Commands: |
|
1663 | 1663 | $ hg help -e -k a |egrep '^(Topics|Extensions|Commands):' |
|
1664 | 1664 | Extensions: |
|
1665 | 1665 | $ hg help -e -c -k date |egrep '^(Topics|Extensions|Commands):' |
|
1666 | 1666 | Extensions: |
|
1667 | 1667 | Commands: |
|
1668 | 1668 | $ hg help -c commit > /dev/null |
|
1669 | 1669 | $ hg help -e -c commit > /dev/null |
|
1670 | 1670 | $ hg help -e commit |
|
1671 | 1671 | abort: no such help topic: commit |
|
1672 | 1672 | (try 'hg help --keyword commit') |
|
1673 | 1673 | [10] |
|
1674 | 1674 | |
|
1675 | 1675 | Test keyword search help |
|
1676 | 1676 | |
|
1677 | 1677 | $ cat > prefixedname.py <<EOF |
|
1678 | 1678 | > '''matched against word "clone" |
|
1679 | 1679 | > ''' |
|
1680 | 1680 | > EOF |
|
1681 | 1681 | $ echo '[extensions]' >> $HGRCPATH |
|
1682 | 1682 | $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH |
|
1683 | 1683 | $ hg help -k clone |
|
1684 | 1684 | Topics: |
|
1685 | 1685 | |
|
1686 | 1686 | config Configuration Files |
|
1687 | 1687 | extensions Using Additional Features |
|
1688 | 1688 | glossary Glossary |
|
1689 | 1689 | phases Working with Phases |
|
1690 | 1690 | subrepos Subrepositories |
|
1691 | 1691 | urls URL Paths |
|
1692 | 1692 | |
|
1693 | 1693 | Commands: |
|
1694 | 1694 | |
|
1695 | 1695 | bookmarks create a new bookmark or list existing bookmarks |
|
1696 | 1696 | clone make a copy of an existing repository |
|
1697 | 1697 | paths show aliases for remote repositories |
|
1698 | 1698 | pull pull changes from the specified source |
|
1699 | 1699 | update update working directory (or switch revisions) |
|
1700 | 1700 | |
|
1701 | 1701 | Extensions: |
|
1702 | 1702 | |
|
1703 | 1703 | clonebundles advertise pre-generated bundles to seed clones |
|
1704 | 1704 | narrow create clones which fetch history data for subset of files |
|
1705 | 1705 | (EXPERIMENTAL) |
|
1706 | 1706 | prefixedname matched against word "clone" |
|
1707 | 1707 | relink recreates hardlinks between repository clones |
|
1708 | 1708 | |
|
1709 | 1709 | Extension Commands: |
|
1710 | 1710 | |
|
1711 | 1711 | qclone clone main and patch repository at same time |
|
1712 | 1712 | |
|
1713 | 1713 | Test unfound topic |
|
1714 | 1714 | |
|
1715 | 1715 | $ hg help nonexistingtopicthatwillneverexisteverever |
|
1716 | 1716 | abort: no such help topic: nonexistingtopicthatwillneverexisteverever |
|
1717 | 1717 | (try 'hg help --keyword nonexistingtopicthatwillneverexisteverever') |
|
1718 | 1718 | [10] |
|
1719 | 1719 | |
|
1720 | 1720 | Test unfound keyword |
|
1721 | 1721 | |
|
1722 | 1722 | $ hg help --keyword nonexistingwordthatwillneverexisteverever |
|
1723 | 1723 | abort: no matches |
|
1724 | 1724 | (try 'hg help' for a list of topics) |
|
1725 | 1725 | [10] |
|
1726 | 1726 | |
|
1727 | 1727 | Test omit indicating for help |
|
1728 | 1728 | |
|
1729 | 1729 | $ cat > addverboseitems.py <<EOF |
|
1730 | 1730 | > r'''extension to test omit indicating. |
|
1731 | 1731 | > |
|
1732 | 1732 | > This paragraph is never omitted (for extension) |
|
1733 | 1733 | > |
|
1734 | 1734 | > .. container:: verbose |
|
1735 | 1735 | > |
|
1736 | 1736 | > This paragraph is omitted, |
|
1737 | 1737 | > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension) |
|
1738 | 1738 | > |
|
1739 | 1739 | > This paragraph is never omitted, too (for extension) |
|
1740 | 1740 | > ''' |
|
1741 | 1741 | > from __future__ import absolute_import |
|
1742 | 1742 | > from mercurial import commands, help |
|
1743 | 1743 | > testtopic = br"""This paragraph is never omitted (for topic). |
|
1744 | 1744 | > |
|
1745 | 1745 | > .. container:: verbose |
|
1746 | 1746 | > |
|
1747 | 1747 | > This paragraph is omitted, |
|
1748 | 1748 | > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic) |
|
1749 | 1749 | > |
|
1750 | 1750 | > This paragraph is never omitted, too (for topic) |
|
1751 | 1751 | > """ |
|
1752 | 1752 | > def extsetup(ui): |
|
1753 | 1753 | > help.helptable.append(([b"topic-containing-verbose"], |
|
1754 | 1754 | > b"This is the topic to test omit indicating.", |
|
1755 | 1755 | > lambda ui: testtopic)) |
|
1756 | 1756 | > EOF |
|
1757 | 1757 | $ echo '[extensions]' >> $HGRCPATH |
|
1758 | 1758 | $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH |
|
1759 | 1759 | $ hg help addverboseitems |
|
1760 | 1760 | addverboseitems extension - extension to test omit indicating. |
|
1761 | 1761 | |
|
1762 | 1762 | This paragraph is never omitted (for extension) |
|
1763 | 1763 | |
|
1764 | 1764 | This paragraph is never omitted, too (for extension) |
|
1765 | 1765 | |
|
1766 | 1766 | (some details hidden, use --verbose to show complete help) |
|
1767 | 1767 | |
|
1768 | 1768 | no commands defined |
|
1769 | 1769 | $ hg help -v addverboseitems |
|
1770 | 1770 | addverboseitems extension - extension to test omit indicating. |
|
1771 | 1771 | |
|
1772 | 1772 | This paragraph is never omitted (for extension) |
|
1773 | 1773 | |
|
1774 | 1774 | This paragraph is omitted, if 'hg help' is invoked without "-v" (for |
|
1775 | 1775 | extension) |
|
1776 | 1776 | |
|
1777 | 1777 | This paragraph is never omitted, too (for extension) |
|
1778 | 1778 | |
|
1779 | 1779 | no commands defined |
|
1780 | 1780 | $ hg help topic-containing-verbose |
|
1781 | 1781 | This is the topic to test omit indicating. |
|
1782 | 1782 | """""""""""""""""""""""""""""""""""""""""" |
|
1783 | 1783 | |
|
1784 | 1784 | This paragraph is never omitted (for topic). |
|
1785 | 1785 | |
|
1786 | 1786 | This paragraph is never omitted, too (for topic) |
|
1787 | 1787 | |
|
1788 | 1788 | (some details hidden, use --verbose to show complete help) |
|
1789 | 1789 | $ hg help -v topic-containing-verbose |
|
1790 | 1790 | This is the topic to test omit indicating. |
|
1791 | 1791 | """""""""""""""""""""""""""""""""""""""""" |
|
1792 | 1792 | |
|
1793 | 1793 | This paragraph is never omitted (for topic). |
|
1794 | 1794 | |
|
1795 | 1795 | This paragraph is omitted, if 'hg help' is invoked without "-v" (for |
|
1796 | 1796 | topic) |
|
1797 | 1797 | |
|
1798 | 1798 | This paragraph is never omitted, too (for topic) |
|
1799 | 1799 | |
|
1800 | 1800 | Test section lookup |
|
1801 | 1801 | |
|
1802 | 1802 | $ hg help revset.merge |
|
1803 | 1803 | "merge()" |
|
1804 | 1804 | Changeset is a merge changeset. |
|
1805 | 1805 | |
|
1806 | 1806 | $ hg help glossary.dag |
|
1807 | 1807 | DAG |
|
1808 | 1808 | The repository of changesets of a distributed version control system |
|
1809 | 1809 | (DVCS) can be described as a directed acyclic graph (DAG), consisting |
|
1810 | 1810 | of nodes and edges, where nodes correspond to changesets and edges |
|
1811 | 1811 | imply a parent -> child relation. This graph can be visualized by |
|
1812 | 1812 | graphical tools such as 'hg log --graph'. In Mercurial, the DAG is |
|
1813 | 1813 | limited by the requirement for children to have at most two parents. |
|
1814 | 1814 | |
|
1815 | 1815 | |
|
1816 | 1816 | $ hg help hgrc.paths |
|
1817 | 1817 | "paths" |
|
1818 | 1818 | ------- |
|
1819 | 1819 | |
|
1820 | 1820 | Assigns symbolic names and behavior to repositories. |
|
1821 | 1821 | |
|
1822 | 1822 | Options are symbolic names defining the URL or directory that is the |
|
1823 | 1823 | location of the repository. Example: |
|
1824 | 1824 | |
|
1825 | 1825 | [paths] |
|
1826 | 1826 | my_server = https://example.com/my_repo |
|
1827 | 1827 | local_path = /home/me/repo |
|
1828 | 1828 | |
|
1829 | 1829 | These symbolic names can be used from the command line. To pull from |
|
1830 | 1830 | "my_server": 'hg pull my_server'. To push to "local_path": 'hg push |
|
1831 | 1831 | local_path'. |
|
1832 | 1832 | |
|
1833 | 1833 | Options containing colons (":") denote sub-options that can influence |
|
1834 | 1834 | behavior for that specific path. Example: |
|
1835 | 1835 | |
|
1836 | 1836 | [paths] |
|
1837 | 1837 | my_server = https://example.com/my_path |
|
1838 | 1838 | my_server:pushurl = ssh://example.com/my_path |
|
1839 | 1839 | |
|
1840 | 1840 | The following sub-options can be defined: |
|
1841 | 1841 | |
|
1842 | 1842 | "pushurl" |
|
1843 | 1843 | The URL to use for push operations. If not defined, the location |
|
1844 | 1844 | defined by the path's main entry is used. |
|
1845 | 1845 | |
|
1846 | 1846 | "pushrev" |
|
1847 | 1847 | A revset defining which revisions to push by default. |
|
1848 | 1848 | |
|
1849 | 1849 | When 'hg push' is executed without a "-r" argument, the revset defined |
|
1850 | 1850 | by this sub-option is evaluated to determine what to push. |
|
1851 | 1851 | |
|
1852 | 1852 | For example, a value of "." will push the working directory's revision |
|
1853 | 1853 | by default. |
|
1854 | 1854 | |
|
1855 | 1855 | Revsets specifying bookmarks will not result in the bookmark being |
|
1856 | 1856 | pushed. |
|
1857 | 1857 | |
|
1858 | 1858 | The following special named paths exist: |
|
1859 | 1859 | |
|
1860 | 1860 | "default" |
|
1861 | 1861 | The URL or directory to use when no source or remote is specified. |
|
1862 | 1862 | |
|
1863 | 1863 | 'hg clone' will automatically define this path to the location the |
|
1864 | 1864 | repository was cloned from. |
|
1865 | 1865 | |
|
1866 | 1866 | "default-push" |
|
1867 | 1867 | (deprecated) The URL or directory for the default 'hg push' location. |
|
1868 | 1868 | "default:pushurl" should be used instead. |
|
1869 | 1869 | |
|
1870 | 1870 | $ hg help glossary.mcguffin |
|
1871 | 1871 | abort: help section not found: glossary.mcguffin |
|
1872 | 1872 | [10] |
|
1873 | 1873 | |
|
1874 | 1874 | $ hg help glossary.mc.guffin |
|
1875 | 1875 | abort: help section not found: glossary.mc.guffin |
|
1876 | 1876 | [10] |
|
1877 | 1877 | |
|
1878 | 1878 | $ hg help template.files |
|
1879 | 1879 | files List of strings. All files modified, added, or removed by |
|
1880 | 1880 | this changeset. |
|
1881 | 1881 | files(pattern) |
|
1882 | 1882 | All files of the current changeset matching the pattern. See |
|
1883 | 1883 | 'hg help patterns'. |
|
1884 | 1884 | |
|
1885 | 1885 | Test section lookup by translated message |
|
1886 | 1886 | |
|
1887 | 1887 | str.lower() instead of encoding.lower(str) on translated message might |
|
1888 | 1888 | make message meaningless, because some encoding uses 0x41(A) - 0x5a(Z) |
|
1889 | 1889 | as the second or later byte of multi-byte character. |
|
1890 | 1890 | |
|
1891 | 1891 | For example, "\x8bL\x98^" (translation of "record" in ja_JP.cp932) |
|
1892 | 1892 | contains 0x4c (L). str.lower() replaces 0x4c(L) by 0x6c(l) and this |
|
1893 | 1893 | replacement makes message meaningless. |
|
1894 | 1894 | |
|
1895 | 1895 | This tests that section lookup by translated string isn't broken by |
|
1896 | 1896 | such str.lower(). |
|
1897 | 1897 | |
|
1898 | 1898 | $ "$PYTHON" <<EOF |
|
1899 | 1899 | > def escape(s): |
|
1900 | 1900 | > return b''.join(b'\\u%x' % ord(uc) for uc in s.decode('cp932')) |
|
1901 | 1901 | > # translation of "record" in ja_JP.cp932 |
|
1902 | 1902 | > upper = b"\x8bL\x98^" |
|
1903 | 1903 | > # str.lower()-ed section name should be treated as different one |
|
1904 | 1904 | > lower = b"\x8bl\x98^" |
|
1905 | 1905 | > with open('ambiguous.py', 'wb') as fp: |
|
1906 | 1906 | > fp.write(b"""# ambiguous section names in ja_JP.cp932 |
|
1907 | 1907 | > u'''summary of extension |
|
1908 | 1908 | > |
|
1909 | 1909 | > %s |
|
1910 | 1910 | > ---- |
|
1911 | 1911 | > |
|
1912 | 1912 | > Upper name should show only this message |
|
1913 | 1913 | > |
|
1914 | 1914 | > %s |
|
1915 | 1915 | > ---- |
|
1916 | 1916 | > |
|
1917 | 1917 | > Lower name should show only this message |
|
1918 | 1918 | > |
|
1919 | 1919 | > subsequent section |
|
1920 | 1920 | > ------------------ |
|
1921 | 1921 | > |
|
1922 | 1922 | > This should be hidden at 'hg help ambiguous' with section name. |
|
1923 | 1923 | > ''' |
|
1924 | 1924 | > """ % (escape(upper), escape(lower))) |
|
1925 | 1925 | > EOF |
|
1926 | 1926 | |
|
1927 | 1927 | $ cat >> $HGRCPATH <<EOF |
|
1928 | 1928 | > [extensions] |
|
1929 | 1929 | > ambiguous = ./ambiguous.py |
|
1930 | 1930 | > EOF |
|
1931 | 1931 | |
|
1932 | 1932 | $ "$PYTHON" <<EOF | sh |
|
1933 | 1933 | > from mercurial.utils import procutil |
|
1934 | 1934 | > upper = b"\x8bL\x98^" |
|
1935 | 1935 | > procutil.stdout.write(b"hg --encoding cp932 help -e ambiguous.%s\n" % upper) |
|
1936 | 1936 | > EOF |
|
1937 | 1937 | \x8bL\x98^ (esc) |
|
1938 | 1938 | ---- |
|
1939 | 1939 | |
|
1940 | 1940 | Upper name should show only this message |
|
1941 | 1941 | |
|
1942 | 1942 | |
|
1943 | 1943 | $ "$PYTHON" <<EOF | sh |
|
1944 | 1944 | > from mercurial.utils import procutil |
|
1945 | 1945 | > lower = b"\x8bl\x98^" |
|
1946 | 1946 | > procutil.stdout.write(b"hg --encoding cp932 help -e ambiguous.%s\n" % lower) |
|
1947 | 1947 | > EOF |
|
1948 | 1948 | \x8bl\x98^ (esc) |
|
1949 | 1949 | ---- |
|
1950 | 1950 | |
|
1951 | 1951 | Lower name should show only this message |
|
1952 | 1952 | |
|
1953 | 1953 | |
|
1954 | 1954 | $ cat >> $HGRCPATH <<EOF |
|
1955 | 1955 | > [extensions] |
|
1956 | 1956 | > ambiguous = ! |
|
1957 | 1957 | > EOF |
|
1958 | 1958 | |
|
1959 | 1959 | Show help content of disabled extensions |
|
1960 | 1960 | |
|
1961 | 1961 | $ cat >> $HGRCPATH <<EOF |
|
1962 | 1962 | > [extensions] |
|
1963 | 1963 | > ambiguous = !./ambiguous.py |
|
1964 | 1964 | > EOF |
|
1965 | 1965 | $ hg help -e ambiguous |
|
1966 | 1966 | ambiguous extension - (no help text available) |
|
1967 | 1967 | |
|
1968 | 1968 | (use 'hg help extensions' for information on enabling extensions) |
|
1969 | 1969 | |
|
1970 | 1970 | Test dynamic list of merge tools only shows up once |
|
1971 | 1971 | $ hg help merge-tools |
|
1972 | 1972 | Merge Tools |
|
1973 | 1973 | """"""""""" |
|
1974 | 1974 | |
|
1975 | 1975 | To merge files Mercurial uses merge tools. |
|
1976 | 1976 | |
|
1977 | 1977 | A merge tool combines two different versions of a file into a merged file. |
|
1978 | 1978 | Merge tools are given the two files and the greatest common ancestor of |
|
1979 | 1979 | the two file versions, so they can determine the changes made on both |
|
1980 | 1980 | branches. |
|
1981 | 1981 | |
|
1982 | 1982 | Merge tools are used both for 'hg resolve', 'hg merge', 'hg update', 'hg |
|
1983 | 1983 | backout' and in several extensions. |
|
1984 | 1984 | |
|
1985 | 1985 | Usually, the merge tool tries to automatically reconcile the files by |
|
1986 | 1986 | combining all non-overlapping changes that occurred separately in the two |
|
1987 | 1987 | different evolutions of the same initial base file. Furthermore, some |
|
1988 | 1988 | interactive merge programs make it easier to manually resolve conflicting |
|
1989 | 1989 | merges, either in a graphical way, or by inserting some conflict markers. |
|
1990 | 1990 | Mercurial does not include any interactive merge programs but relies on |
|
1991 | 1991 | external tools for that. |
|
1992 | 1992 | |
|
1993 | 1993 | Available merge tools |
|
1994 | 1994 | ===================== |
|
1995 | 1995 | |
|
1996 | 1996 | External merge tools and their properties are configured in the merge- |
|
1997 | 1997 | tools configuration section - see hgrc(5) - but they can often just be |
|
1998 | 1998 | named by their executable. |
|
1999 | 1999 | |
|
2000 | 2000 | A merge tool is generally usable if its executable can be found on the |
|
2001 | 2001 | system and if it can handle the merge. The executable is found if it is an |
|
2002 | 2002 | absolute or relative executable path or the name of an application in the |
|
2003 | 2003 | executable search path. The tool is assumed to be able to handle the merge |
|
2004 | 2004 | if it can handle symlinks if the file is a symlink, if it can handle |
|
2005 | 2005 | binary files if the file is binary, and if a GUI is available if the tool |
|
2006 | 2006 | requires a GUI. |
|
2007 | 2007 | |
|
2008 | 2008 | There are some internal merge tools which can be used. The internal merge |
|
2009 | 2009 | tools are: |
|
2010 | 2010 | |
|
2011 | 2011 | ":dump" |
|
2012 | 2012 | Creates three versions of the files to merge, containing the contents of |
|
2013 | 2013 | local, other and base. These files can then be used to perform a merge |
|
2014 | 2014 | manually. If the file to be merged is named "a.txt", these files will |
|
2015 | 2015 | accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and |
|
2016 | 2016 | they will be placed in the same directory as "a.txt". |
|
2017 | 2017 | |
|
2018 | 2018 | This implies premerge. Therefore, files aren't dumped, if premerge runs |
|
2019 | 2019 | successfully. Use :forcedump to forcibly write files out. |
|
2020 | 2020 | |
|
2021 | 2021 | (actual capabilities: binary, symlink) |
|
2022 | 2022 | |
|
2023 | 2023 | ":fail" |
|
2024 | 2024 | Rather than attempting to merge files that were modified on both |
|
2025 | 2025 | branches, it marks them as unresolved. The resolve command must be used |
|
2026 | 2026 | to resolve these conflicts. |
|
2027 | 2027 | |
|
2028 | 2028 | (actual capabilities: binary, symlink) |
|
2029 | 2029 | |
|
2030 | 2030 | ":forcedump" |
|
2031 | 2031 | Creates three versions of the files as same as :dump, but omits |
|
2032 | 2032 | premerge. |
|
2033 | 2033 | |
|
2034 | 2034 | (actual capabilities: binary, symlink) |
|
2035 | 2035 | |
|
2036 | 2036 | ":local" |
|
2037 | 2037 | Uses the local 'p1()' version of files as the merged version. |
|
2038 | 2038 | |
|
2039 | 2039 | (actual capabilities: binary, symlink) |
|
2040 | 2040 | |
|
2041 | 2041 | ":merge" |
|
2042 | 2042 | Uses the internal non-interactive simple merge algorithm for merging |
|
2043 | 2043 | files. It will fail if there are any conflicts and leave markers in the |
|
2044 | 2044 | partially merged file. Markers will have two sections, one for each side |
|
2045 | 2045 | of merge. |
|
2046 | 2046 | |
|
2047 | 2047 | ":merge-local" |
|
2048 | 2048 | Like :merge, but resolve all conflicts non-interactively in favor of the |
|
2049 | 2049 | local 'p1()' changes. |
|
2050 | 2050 | |
|
2051 | 2051 | ":merge-other" |
|
2052 | 2052 | Like :merge, but resolve all conflicts non-interactively in favor of the |
|
2053 | 2053 | other 'p2()' changes. |
|
2054 | 2054 | |
|
2055 | 2055 | ":merge3" |
|
2056 | 2056 | Uses the internal non-interactive simple merge algorithm for merging |
|
2057 | 2057 | files. It will fail if there are any conflicts and leave markers in the |
|
2058 | 2058 | partially merged file. Marker will have three sections, one from each |
|
2059 | 2059 | side of the merge and one for the base content. |
|
2060 | 2060 | |
|
2061 | 2061 | ":mergediff" |
|
2062 | 2062 | Uses the internal non-interactive simple merge algorithm for merging |
|
2063 | 2063 | files. It will fail if there are any conflicts and leave markers in the |
|
2064 | 2064 | partially merged file. The marker will have two sections, one with the |
|
2065 | 2065 | content from one side of the merge, and one with a diff from the base |
|
2066 | 2066 | content to the content on the other side. (experimental) |
|
2067 | 2067 | |
|
2068 | 2068 | ":other" |
|
2069 | 2069 | Uses the other 'p2()' version of files as the merged version. |
|
2070 | 2070 | |
|
2071 | 2071 | (actual capabilities: binary, symlink) |
|
2072 | 2072 | |
|
2073 | 2073 | ":prompt" |
|
2074 | 2074 | Asks the user which of the local 'p1()' or the other 'p2()' version to |
|
2075 | 2075 | keep as the merged version. |
|
2076 | 2076 | |
|
2077 | 2077 | (actual capabilities: binary, symlink) |
|
2078 | 2078 | |
|
2079 | 2079 | ":tagmerge" |
|
2080 | 2080 | Uses the internal tag merge algorithm (experimental). |
|
2081 | 2081 | |
|
2082 | 2082 | ":union" |
|
2083 | 2083 | Uses the internal non-interactive simple merge algorithm for merging |
|
2084 | 2084 | files. It will use both left and right sides for conflict regions. No |
|
2085 | 2085 | markers are inserted. |
|
2086 | 2086 | |
|
2087 | 2087 | Internal tools are always available and do not require a GUI but will by |
|
2088 | 2088 | default not handle symlinks or binary files. See next section for detail |
|
2089 | 2089 | about "actual capabilities" described above. |
|
2090 | 2090 | |
|
2091 | 2091 | Choosing a merge tool |
|
2092 | 2092 | ===================== |
|
2093 | 2093 | |
|
2094 | 2094 | Mercurial uses these rules when deciding which merge tool to use: |
|
2095 | 2095 | |
|
2096 | 2096 | 1. If a tool has been specified with the --tool option to merge or |
|
2097 | 2097 | resolve, it is used. If it is the name of a tool in the merge-tools |
|
2098 | 2098 | configuration, its configuration is used. Otherwise the specified tool |
|
2099 | 2099 | must be executable by the shell. |
|
2100 | 2100 | 2. If the "HGMERGE" environment variable is present, its value is used and |
|
2101 | 2101 | must be executable by the shell. |
|
2102 | 2102 | 3. If the filename of the file to be merged matches any of the patterns in |
|
2103 | 2103 | the merge-patterns configuration section, the first usable merge tool |
|
2104 | 2104 | corresponding to a matching pattern is used. |
|
2105 | 2105 | 4. If ui.merge is set it will be considered next. If the value is not the |
|
2106 | 2106 | name of a configured tool, the specified value is used and must be |
|
2107 | 2107 | executable by the shell. Otherwise the named tool is used if it is |
|
2108 | 2108 | usable. |
|
2109 | 2109 | 5. If any usable merge tools are present in the merge-tools configuration |
|
2110 | 2110 | section, the one with the highest priority is used. |
|
2111 | 2111 | 6. If a program named "hgmerge" can be found on the system, it is used - |
|
2112 | 2112 | but it will by default not be used for symlinks and binary files. |
|
2113 | 2113 | 7. If the file to be merged is not binary and is not a symlink, then |
|
2114 | 2114 | internal ":merge" is used. |
|
2115 | 2115 | 8. Otherwise, ":prompt" is used. |
|
2116 | 2116 | |
|
2117 | 2117 | For historical reason, Mercurial treats merge tools as below while |
|
2118 | 2118 | examining rules above. |
|
2119 | 2119 | |
|
2120 | 2120 | step specified via binary symlink |
|
2121 | 2121 | ---------------------------------- |
|
2122 | 2122 | 1. --tool o/o o/o |
|
2123 | 2123 | 2. HGMERGE o/o o/o |
|
2124 | 2124 | 3. merge-patterns o/o(*) x/?(*) |
|
2125 | 2125 | 4. ui.merge x/?(*) x/?(*) |
|
2126 | 2126 | |
|
2127 | 2127 | Each capability column indicates Mercurial behavior for internal/external |
|
2128 | 2128 | merge tools at examining each rule. |
|
2129 | 2129 | |
|
2130 | 2130 | - "o": "assume that a tool has capability" |
|
2131 | 2131 | - "x": "assume that a tool does not have capability" |
|
2132 | 2132 | - "?": "check actual capability of a tool" |
|
2133 | 2133 | |
|
2134 | 2134 | If "merge.strict-capability-check" configuration is true, Mercurial checks |
|
2135 | 2135 | capabilities of merge tools strictly in (*) cases above (= each capability |
|
2136 | 2136 | column becomes "?/?"). It is false by default for backward compatibility. |
|
2137 | 2137 | |
|
2138 | 2138 | Note: |
|
2139 | 2139 | After selecting a merge program, Mercurial will by default attempt to |
|
2140 | 2140 | merge the files using a simple merge algorithm first. Only if it |
|
2141 | 2141 | doesn't succeed because of conflicting changes will Mercurial actually |
|
2142 | 2142 | execute the merge program. Whether to use the simple merge algorithm |
|
2143 | 2143 | first can be controlled by the premerge setting of the merge tool. |
|
2144 | 2144 | Premerge is enabled by default unless the file is binary or a symlink. |
|
2145 | 2145 | |
|
2146 | 2146 | See the merge-tools and ui sections of hgrc(5) for details on the |
|
2147 | 2147 | configuration of merge tools. |
|
2148 | 2148 | |
|
2149 | 2149 | Compression engines listed in `hg help bundlespec` |
|
2150 | 2150 | |
|
2151 | 2151 | $ hg help bundlespec | grep gzip |
|
2152 | 2152 | "v1" bundles can only use the "gzip", "bzip2", and "none" compression |
|
2153 | 2153 | An algorithm that produces smaller bundles than "gzip". |
|
2154 | 2154 | This engine will likely produce smaller bundles than "gzip" but will be |
|
2155 | 2155 | "gzip" |
|
2156 | 2156 | better compression than "gzip". It also frequently yields better (?) |
|
2157 | 2157 | |
|
2158 | 2158 | Test usage of section marks in help documents |
|
2159 | 2159 | |
|
2160 | 2160 | $ cd "$TESTDIR"/../doc |
|
2161 | 2161 | $ "$PYTHON" check-seclevel.py |
|
2162 | 2162 | $ cd $TESTTMP |
|
2163 | 2163 | |
|
2164 | 2164 | #if serve |
|
2165 | 2165 | |
|
2166 | 2166 | Test the help pages in hgweb. |
|
2167 | 2167 | |
|
2168 | 2168 | Dish up an empty repo; serve it cold. |
|
2169 | 2169 | |
|
2170 | 2170 | $ hg init "$TESTTMP/test" |
|
2171 | 2171 | $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid |
|
2172 | 2172 | $ cat hg.pid >> $DAEMON_PIDS |
|
2173 | 2173 | |
|
2174 | 2174 | $ get-with-headers.py $LOCALIP:$HGPORT "help" |
|
2175 | 2175 | 200 Script output follows |
|
2176 | 2176 | |
|
2177 | 2177 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
|
2178 | 2178 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> |
|
2179 | 2179 | <head> |
|
2180 | 2180 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> |
|
2181 | 2181 | <meta name="robots" content="index, nofollow" /> |
|
2182 | 2182 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> |
|
2183 | 2183 | <script type="text/javascript" src="/static/mercurial.js"></script> |
|
2184 | 2184 | |
|
2185 | 2185 | <title>Help: Index</title> |
|
2186 | 2186 | </head> |
|
2187 | 2187 | <body> |
|
2188 | 2188 | |
|
2189 | 2189 | <div class="container"> |
|
2190 | 2190 | <div class="menu"> |
|
2191 | 2191 | <div class="logo"> |
|
2192 | 2192 | <a href="https://mercurial-scm.org/"> |
|
2193 | 2193 | <img src="/static/hglogo.png" alt="mercurial" /></a> |
|
2194 | 2194 | </div> |
|
2195 | 2195 | <ul> |
|
2196 | 2196 | <li><a href="/shortlog">log</a></li> |
|
2197 | 2197 | <li><a href="/graph">graph</a></li> |
|
2198 | 2198 | <li><a href="/tags">tags</a></li> |
|
2199 | 2199 | <li><a href="/bookmarks">bookmarks</a></li> |
|
2200 | 2200 | <li><a href="/branches">branches</a></li> |
|
2201 | 2201 | </ul> |
|
2202 | 2202 | <ul> |
|
2203 | 2203 | <li class="active">help</li> |
|
2204 | 2204 | </ul> |
|
2205 | 2205 | </div> |
|
2206 | 2206 | |
|
2207 | 2207 | <div class="main"> |
|
2208 | 2208 | <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> |
|
2209 | 2209 | |
|
2210 | 2210 | <form class="search" action="/log"> |
|
2211 | 2211 | |
|
2212 | 2212 | <p><input name="rev" id="search1" type="text" size="30" value="" /></p> |
|
2213 | 2213 | <div id="hint">Find changesets by keywords (author, files, the commit message), revision |
|
2214 | 2214 | number or hash, or <a href="/help/revsets">revset expression</a>.</div> |
|
2215 | 2215 | </form> |
|
2216 | 2216 | <table class="bigtable"> |
|
2217 | 2217 | <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr> |
|
2218 | 2218 | |
|
2219 | 2219 | <tr><td> |
|
2220 | 2220 | <a href="/help/bundlespec"> |
|
2221 | 2221 | bundlespec |
|
2222 | 2222 | </a> |
|
2223 | 2223 | </td><td> |
|
2224 | 2224 | Bundle File Formats |
|
2225 | 2225 | </td></tr> |
|
2226 | 2226 | <tr><td> |
|
2227 | 2227 | <a href="/help/color"> |
|
2228 | 2228 | color |
|
2229 | 2229 | </a> |
|
2230 | 2230 | </td><td> |
|
2231 | 2231 | Colorizing Outputs |
|
2232 | 2232 | </td></tr> |
|
2233 | 2233 | <tr><td> |
|
2234 | 2234 | <a href="/help/config"> |
|
2235 | 2235 | config |
|
2236 | 2236 | </a> |
|
2237 | 2237 | </td><td> |
|
2238 | 2238 | Configuration Files |
|
2239 | 2239 | </td></tr> |
|
2240 | 2240 | <tr><td> |
|
2241 | 2241 | <a href="/help/dates"> |
|
2242 | 2242 | dates |
|
2243 | 2243 | </a> |
|
2244 | 2244 | </td><td> |
|
2245 | 2245 | Date Formats |
|
2246 | 2246 | </td></tr> |
|
2247 | 2247 | <tr><td> |
|
2248 | 2248 | <a href="/help/deprecated"> |
|
2249 | 2249 | deprecated |
|
2250 | 2250 | </a> |
|
2251 | 2251 | </td><td> |
|
2252 | 2252 | Deprecated Features |
|
2253 | 2253 | </td></tr> |
|
2254 | 2254 | <tr><td> |
|
2255 | 2255 | <a href="/help/diffs"> |
|
2256 | 2256 | diffs |
|
2257 | 2257 | </a> |
|
2258 | 2258 | </td><td> |
|
2259 | 2259 | Diff Formats |
|
2260 | 2260 | </td></tr> |
|
2261 | 2261 | <tr><td> |
|
2262 | 2262 | <a href="/help/environment"> |
|
2263 | 2263 | environment |
|
2264 | 2264 | </a> |
|
2265 | 2265 | </td><td> |
|
2266 | 2266 | Environment Variables |
|
2267 | 2267 | </td></tr> |
|
2268 | 2268 | <tr><td> |
|
2269 | 2269 | <a href="/help/extensions"> |
|
2270 | 2270 | extensions |
|
2271 | 2271 | </a> |
|
2272 | 2272 | </td><td> |
|
2273 | 2273 | Using Additional Features |
|
2274 | 2274 | </td></tr> |
|
2275 | 2275 | <tr><td> |
|
2276 | 2276 | <a href="/help/filesets"> |
|
2277 | 2277 | filesets |
|
2278 | 2278 | </a> |
|
2279 | 2279 | </td><td> |
|
2280 | 2280 | Specifying File Sets |
|
2281 | 2281 | </td></tr> |
|
2282 | 2282 | <tr><td> |
|
2283 | 2283 | <a href="/help/flags"> |
|
2284 | 2284 | flags |
|
2285 | 2285 | </a> |
|
2286 | 2286 | </td><td> |
|
2287 | 2287 | Command-line flags |
|
2288 | 2288 | </td></tr> |
|
2289 | 2289 | <tr><td> |
|
2290 | 2290 | <a href="/help/glossary"> |
|
2291 | 2291 | glossary |
|
2292 | 2292 | </a> |
|
2293 | 2293 | </td><td> |
|
2294 | 2294 | Glossary |
|
2295 | 2295 | </td></tr> |
|
2296 | 2296 | <tr><td> |
|
2297 | 2297 | <a href="/help/hgignore"> |
|
2298 | 2298 | hgignore |
|
2299 | 2299 | </a> |
|
2300 | 2300 | </td><td> |
|
2301 | 2301 | Syntax for Mercurial Ignore Files |
|
2302 | 2302 | </td></tr> |
|
2303 | 2303 | <tr><td> |
|
2304 | 2304 | <a href="/help/hgweb"> |
|
2305 | 2305 | hgweb |
|
2306 | 2306 | </a> |
|
2307 | 2307 | </td><td> |
|
2308 | 2308 | Configuring hgweb |
|
2309 | 2309 | </td></tr> |
|
2310 | 2310 | <tr><td> |
|
2311 | 2311 | <a href="/help/internals"> |
|
2312 | 2312 | internals |
|
2313 | 2313 | </a> |
|
2314 | 2314 | </td><td> |
|
2315 | 2315 | Technical implementation topics |
|
2316 | 2316 | </td></tr> |
|
2317 | 2317 | <tr><td> |
|
2318 | 2318 | <a href="/help/merge-tools"> |
|
2319 | 2319 | merge-tools |
|
2320 | 2320 | </a> |
|
2321 | 2321 | </td><td> |
|
2322 | 2322 | Merge Tools |
|
2323 | 2323 | </td></tr> |
|
2324 | 2324 | <tr><td> |
|
2325 | 2325 | <a href="/help/pager"> |
|
2326 | 2326 | pager |
|
2327 | 2327 | </a> |
|
2328 | 2328 | </td><td> |
|
2329 | 2329 | Pager Support |
|
2330 | 2330 | </td></tr> |
|
2331 | 2331 | <tr><td> |
|
2332 | 2332 | <a href="/help/patterns"> |
|
2333 | 2333 | patterns |
|
2334 | 2334 | </a> |
|
2335 | 2335 | </td><td> |
|
2336 | 2336 | File Name Patterns |
|
2337 | 2337 | </td></tr> |
|
2338 | 2338 | <tr><td> |
|
2339 | 2339 | <a href="/help/phases"> |
|
2340 | 2340 | phases |
|
2341 | 2341 | </a> |
|
2342 | 2342 | </td><td> |
|
2343 | 2343 | Working with Phases |
|
2344 | 2344 | </td></tr> |
|
2345 | 2345 | <tr><td> |
|
2346 | 2346 | <a href="/help/revisions"> |
|
2347 | 2347 | revisions |
|
2348 | 2348 | </a> |
|
2349 | 2349 | </td><td> |
|
2350 | 2350 | Specifying Revisions |
|
2351 | 2351 | </td></tr> |
|
2352 | 2352 | <tr><td> |
|
2353 | 2353 | <a href="/help/scripting"> |
|
2354 | 2354 | scripting |
|
2355 | 2355 | </a> |
|
2356 | 2356 | </td><td> |
|
2357 | 2357 | Using Mercurial from scripts and automation |
|
2358 | 2358 | </td></tr> |
|
2359 | 2359 | <tr><td> |
|
2360 | 2360 | <a href="/help/subrepos"> |
|
2361 | 2361 | subrepos |
|
2362 | 2362 | </a> |
|
2363 | 2363 | </td><td> |
|
2364 | 2364 | Subrepositories |
|
2365 | 2365 | </td></tr> |
|
2366 | 2366 | <tr><td> |
|
2367 | 2367 | <a href="/help/templating"> |
|
2368 | 2368 | templating |
|
2369 | 2369 | </a> |
|
2370 | 2370 | </td><td> |
|
2371 | 2371 | Template Usage |
|
2372 | 2372 | </td></tr> |
|
2373 | 2373 | <tr><td> |
|
2374 | 2374 | <a href="/help/urls"> |
|
2375 | 2375 | urls |
|
2376 | 2376 | </a> |
|
2377 | 2377 | </td><td> |
|
2378 | 2378 | URL Paths |
|
2379 | 2379 | </td></tr> |
|
2380 | 2380 | <tr><td> |
|
2381 | 2381 | <a href="/help/topic-containing-verbose"> |
|
2382 | 2382 | topic-containing-verbose |
|
2383 | 2383 | </a> |
|
2384 | 2384 | </td><td> |
|
2385 | 2385 | This is the topic to test omit indicating. |
|
2386 | 2386 | </td></tr> |
|
2387 | 2387 | |
|
2388 | 2388 | |
|
2389 | 2389 | <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr> |
|
2390 | 2390 | |
|
2391 | 2391 | <tr><td> |
|
2392 | 2392 | <a href="/help/abort"> |
|
2393 | 2393 | abort |
|
2394 | 2394 | </a> |
|
2395 | 2395 | </td><td> |
|
2396 | 2396 | abort an unfinished operation (EXPERIMENTAL) |
|
2397 | 2397 | </td></tr> |
|
2398 | 2398 | <tr><td> |
|
2399 | 2399 | <a href="/help/add"> |
|
2400 | 2400 | add |
|
2401 | 2401 | </a> |
|
2402 | 2402 | </td><td> |
|
2403 | 2403 | add the specified files on the next commit |
|
2404 | 2404 | </td></tr> |
|
2405 | 2405 | <tr><td> |
|
2406 | 2406 | <a href="/help/annotate"> |
|
2407 | 2407 | annotate |
|
2408 | 2408 | </a> |
|
2409 | 2409 | </td><td> |
|
2410 | 2410 | show changeset information by line for each file |
|
2411 | 2411 | </td></tr> |
|
2412 | 2412 | <tr><td> |
|
2413 | 2413 | <a href="/help/clone"> |
|
2414 | 2414 | clone |
|
2415 | 2415 | </a> |
|
2416 | 2416 | </td><td> |
|
2417 | 2417 | make a copy of an existing repository |
|
2418 | 2418 | </td></tr> |
|
2419 | 2419 | <tr><td> |
|
2420 | 2420 | <a href="/help/commit"> |
|
2421 | 2421 | commit |
|
2422 | 2422 | </a> |
|
2423 | 2423 | </td><td> |
|
2424 | 2424 | commit the specified files or all outstanding changes |
|
2425 | 2425 | </td></tr> |
|
2426 | 2426 | <tr><td> |
|
2427 | 2427 | <a href="/help/continue"> |
|
2428 | 2428 | continue |
|
2429 | 2429 | </a> |
|
2430 | 2430 | </td><td> |
|
2431 | 2431 | resumes an interrupted operation (EXPERIMENTAL) |
|
2432 | 2432 | </td></tr> |
|
2433 | 2433 | <tr><td> |
|
2434 | 2434 | <a href="/help/diff"> |
|
2435 | 2435 | diff |
|
2436 | 2436 | </a> |
|
2437 | 2437 | </td><td> |
|
2438 | 2438 | diff repository (or selected files) |
|
2439 | 2439 | </td></tr> |
|
2440 | 2440 | <tr><td> |
|
2441 | 2441 | <a href="/help/export"> |
|
2442 | 2442 | export |
|
2443 | 2443 | </a> |
|
2444 | 2444 | </td><td> |
|
2445 | 2445 | dump the header and diffs for one or more changesets |
|
2446 | 2446 | </td></tr> |
|
2447 | 2447 | <tr><td> |
|
2448 | 2448 | <a href="/help/forget"> |
|
2449 | 2449 | forget |
|
2450 | 2450 | </a> |
|
2451 | 2451 | </td><td> |
|
2452 | 2452 | forget the specified files on the next commit |
|
2453 | 2453 | </td></tr> |
|
2454 | 2454 | <tr><td> |
|
2455 | 2455 | <a href="/help/init"> |
|
2456 | 2456 | init |
|
2457 | 2457 | </a> |
|
2458 | 2458 | </td><td> |
|
2459 | 2459 | create a new repository in the given directory |
|
2460 | 2460 | </td></tr> |
|
2461 | 2461 | <tr><td> |
|
2462 | 2462 | <a href="/help/log"> |
|
2463 | 2463 | log |
|
2464 | 2464 | </a> |
|
2465 | 2465 | </td><td> |
|
2466 | 2466 | show revision history of entire repository or files |
|
2467 | 2467 | </td></tr> |
|
2468 | 2468 | <tr><td> |
|
2469 | 2469 | <a href="/help/merge"> |
|
2470 | 2470 | merge |
|
2471 | 2471 | </a> |
|
2472 | 2472 | </td><td> |
|
2473 | 2473 | merge another revision into working directory |
|
2474 | 2474 | </td></tr> |
|
2475 | 2475 | <tr><td> |
|
2476 | 2476 | <a href="/help/pull"> |
|
2477 | 2477 | pull |
|
2478 | 2478 | </a> |
|
2479 | 2479 | </td><td> |
|
2480 | 2480 | pull changes from the specified source |
|
2481 | 2481 | </td></tr> |
|
2482 | 2482 | <tr><td> |
|
2483 | 2483 | <a href="/help/push"> |
|
2484 | 2484 | push |
|
2485 | 2485 | </a> |
|
2486 | 2486 | </td><td> |
|
2487 | 2487 | push changes to the specified destination |
|
2488 | 2488 | </td></tr> |
|
2489 | 2489 | <tr><td> |
|
2490 | 2490 | <a href="/help/remove"> |
|
2491 | 2491 | remove |
|
2492 | 2492 | </a> |
|
2493 | 2493 | </td><td> |
|
2494 | 2494 | remove the specified files on the next commit |
|
2495 | 2495 | </td></tr> |
|
2496 | 2496 | <tr><td> |
|
2497 | 2497 | <a href="/help/serve"> |
|
2498 | 2498 | serve |
|
2499 | 2499 | </a> |
|
2500 | 2500 | </td><td> |
|
2501 | 2501 | start stand-alone webserver |
|
2502 | 2502 | </td></tr> |
|
2503 | 2503 | <tr><td> |
|
2504 | 2504 | <a href="/help/status"> |
|
2505 | 2505 | status |
|
2506 | 2506 | </a> |
|
2507 | 2507 | </td><td> |
|
2508 | 2508 | show changed files in the working directory |
|
2509 | 2509 | </td></tr> |
|
2510 | 2510 | <tr><td> |
|
2511 | 2511 | <a href="/help/summary"> |
|
2512 | 2512 | summary |
|
2513 | 2513 | </a> |
|
2514 | 2514 | </td><td> |
|
2515 | 2515 | summarize working directory state |
|
2516 | 2516 | </td></tr> |
|
2517 | 2517 | <tr><td> |
|
2518 | 2518 | <a href="/help/update"> |
|
2519 | 2519 | update |
|
2520 | 2520 | </a> |
|
2521 | 2521 | </td><td> |
|
2522 | 2522 | update working directory (or switch revisions) |
|
2523 | 2523 | </td></tr> |
|
2524 | 2524 | |
|
2525 | 2525 | |
|
2526 | 2526 | |
|
2527 | 2527 | <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr> |
|
2528 | 2528 | |
|
2529 | 2529 | <tr><td> |
|
2530 | 2530 | <a href="/help/addremove"> |
|
2531 | 2531 | addremove |
|
2532 | 2532 | </a> |
|
2533 | 2533 | </td><td> |
|
2534 | 2534 | add all new files, delete all missing files |
|
2535 | 2535 | </td></tr> |
|
2536 | 2536 | <tr><td> |
|
2537 | 2537 | <a href="/help/archive"> |
|
2538 | 2538 | archive |
|
2539 | 2539 | </a> |
|
2540 | 2540 | </td><td> |
|
2541 | 2541 | create an unversioned archive of a repository revision |
|
2542 | 2542 | </td></tr> |
|
2543 | 2543 | <tr><td> |
|
2544 | 2544 | <a href="/help/backout"> |
|
2545 | 2545 | backout |
|
2546 | 2546 | </a> |
|
2547 | 2547 | </td><td> |
|
2548 | 2548 | reverse effect of earlier changeset |
|
2549 | 2549 | </td></tr> |
|
2550 | 2550 | <tr><td> |
|
2551 | 2551 | <a href="/help/bisect"> |
|
2552 | 2552 | bisect |
|
2553 | 2553 | </a> |
|
2554 | 2554 | </td><td> |
|
2555 | 2555 | subdivision search of changesets |
|
2556 | 2556 | </td></tr> |
|
2557 | 2557 | <tr><td> |
|
2558 | 2558 | <a href="/help/bookmarks"> |
|
2559 | 2559 | bookmarks |
|
2560 | 2560 | </a> |
|
2561 | 2561 | </td><td> |
|
2562 | 2562 | create a new bookmark or list existing bookmarks |
|
2563 | 2563 | </td></tr> |
|
2564 | 2564 | <tr><td> |
|
2565 | 2565 | <a href="/help/branch"> |
|
2566 | 2566 | branch |
|
2567 | 2567 | </a> |
|
2568 | 2568 | </td><td> |
|
2569 | 2569 | set or show the current branch name |
|
2570 | 2570 | </td></tr> |
|
2571 | 2571 | <tr><td> |
|
2572 | 2572 | <a href="/help/branches"> |
|
2573 | 2573 | branches |
|
2574 | 2574 | </a> |
|
2575 | 2575 | </td><td> |
|
2576 | 2576 | list repository named branches |
|
2577 | 2577 | </td></tr> |
|
2578 | 2578 | <tr><td> |
|
2579 | 2579 | <a href="/help/bundle"> |
|
2580 | 2580 | bundle |
|
2581 | 2581 | </a> |
|
2582 | 2582 | </td><td> |
|
2583 | 2583 | create a bundle file |
|
2584 | 2584 | </td></tr> |
|
2585 | 2585 | <tr><td> |
|
2586 | 2586 | <a href="/help/cat"> |
|
2587 | 2587 | cat |
|
2588 | 2588 | </a> |
|
2589 | 2589 | </td><td> |
|
2590 | 2590 | output the current or given revision of files |
|
2591 | 2591 | </td></tr> |
|
2592 | 2592 | <tr><td> |
|
2593 | 2593 | <a href="/help/config"> |
|
2594 | 2594 | config |
|
2595 | 2595 | </a> |
|
2596 | 2596 | </td><td> |
|
2597 | 2597 | show combined config settings from all hgrc files |
|
2598 | 2598 | </td></tr> |
|
2599 | 2599 | <tr><td> |
|
2600 | 2600 | <a href="/help/copy"> |
|
2601 | 2601 | copy |
|
2602 | 2602 | </a> |
|
2603 | 2603 | </td><td> |
|
2604 | 2604 | mark files as copied for the next commit |
|
2605 | 2605 | </td></tr> |
|
2606 | 2606 | <tr><td> |
|
2607 | 2607 | <a href="/help/files"> |
|
2608 | 2608 | files |
|
2609 | 2609 | </a> |
|
2610 | 2610 | </td><td> |
|
2611 | 2611 | list tracked files |
|
2612 | 2612 | </td></tr> |
|
2613 | 2613 | <tr><td> |
|
2614 | 2614 | <a href="/help/graft"> |
|
2615 | 2615 | graft |
|
2616 | 2616 | </a> |
|
2617 | 2617 | </td><td> |
|
2618 | 2618 | copy changes from other branches onto the current branch |
|
2619 | 2619 | </td></tr> |
|
2620 | 2620 | <tr><td> |
|
2621 | 2621 | <a href="/help/grep"> |
|
2622 | 2622 | grep |
|
2623 | 2623 | </a> |
|
2624 | 2624 | </td><td> |
|
2625 | 2625 | search for a pattern in specified files |
|
2626 | 2626 | </td></tr> |
|
2627 | 2627 | <tr><td> |
|
2628 | 2628 | <a href="/help/hashelp"> |
|
2629 | 2629 | hashelp |
|
2630 | 2630 | </a> |
|
2631 | 2631 | </td><td> |
|
2632 | 2632 | Extension command's help |
|
2633 | 2633 | </td></tr> |
|
2634 | 2634 | <tr><td> |
|
2635 | 2635 | <a href="/help/heads"> |
|
2636 | 2636 | heads |
|
2637 | 2637 | </a> |
|
2638 | 2638 | </td><td> |
|
2639 | 2639 | show branch heads |
|
2640 | 2640 | </td></tr> |
|
2641 | 2641 | <tr><td> |
|
2642 | 2642 | <a href="/help/help"> |
|
2643 | 2643 | help |
|
2644 | 2644 | </a> |
|
2645 | 2645 | </td><td> |
|
2646 | 2646 | show help for a given topic or a help overview |
|
2647 | 2647 | </td></tr> |
|
2648 | 2648 | <tr><td> |
|
2649 | 2649 | <a href="/help/hgalias"> |
|
2650 | 2650 | hgalias |
|
2651 | 2651 | </a> |
|
2652 | 2652 | </td><td> |
|
2653 | 2653 | My doc |
|
2654 | 2654 | </td></tr> |
|
2655 | 2655 | <tr><td> |
|
2656 | 2656 | <a href="/help/hgaliasnodoc"> |
|
2657 | 2657 | hgaliasnodoc |
|
2658 | 2658 | </a> |
|
2659 | 2659 | </td><td> |
|
2660 | 2660 | summarize working directory state |
|
2661 | 2661 | </td></tr> |
|
2662 | 2662 | <tr><td> |
|
2663 | 2663 | <a href="/help/identify"> |
|
2664 | 2664 | identify |
|
2665 | 2665 | </a> |
|
2666 | 2666 | </td><td> |
|
2667 | 2667 | identify the working directory or specified revision |
|
2668 | 2668 | </td></tr> |
|
2669 | 2669 | <tr><td> |
|
2670 | 2670 | <a href="/help/import"> |
|
2671 | 2671 | import |
|
2672 | 2672 | </a> |
|
2673 | 2673 | </td><td> |
|
2674 | 2674 | import an ordered set of patches |
|
2675 | 2675 | </td></tr> |
|
2676 | 2676 | <tr><td> |
|
2677 | 2677 | <a href="/help/incoming"> |
|
2678 | 2678 | incoming |
|
2679 | 2679 | </a> |
|
2680 | 2680 | </td><td> |
|
2681 | 2681 | show new changesets found in source |
|
2682 | 2682 | </td></tr> |
|
2683 | 2683 | <tr><td> |
|
2684 | 2684 | <a href="/help/manifest"> |
|
2685 | 2685 | manifest |
|
2686 | 2686 | </a> |
|
2687 | 2687 | </td><td> |
|
2688 | 2688 | output the current or given revision of the project manifest |
|
2689 | 2689 | </td></tr> |
|
2690 | 2690 | <tr><td> |
|
2691 | 2691 | <a href="/help/nohelp"> |
|
2692 | 2692 | nohelp |
|
2693 | 2693 | </a> |
|
2694 | 2694 | </td><td> |
|
2695 | 2695 | (no help text available) |
|
2696 | 2696 | </td></tr> |
|
2697 | 2697 | <tr><td> |
|
2698 | 2698 | <a href="/help/outgoing"> |
|
2699 | 2699 | outgoing |
|
2700 | 2700 | </a> |
|
2701 | 2701 | </td><td> |
|
2702 | 2702 | show changesets not found in the destination |
|
2703 | 2703 | </td></tr> |
|
2704 | 2704 | <tr><td> |
|
2705 | 2705 | <a href="/help/paths"> |
|
2706 | 2706 | paths |
|
2707 | 2707 | </a> |
|
2708 | 2708 | </td><td> |
|
2709 | 2709 | show aliases for remote repositories |
|
2710 | 2710 | </td></tr> |
|
2711 | 2711 | <tr><td> |
|
2712 | 2712 | <a href="/help/phase"> |
|
2713 | 2713 | phase |
|
2714 | 2714 | </a> |
|
2715 | 2715 | </td><td> |
|
2716 | 2716 | set or show the current phase name |
|
2717 | 2717 | </td></tr> |
|
2718 | 2718 | <tr><td> |
|
2719 | 2719 | <a href="/help/recover"> |
|
2720 | 2720 | recover |
|
2721 | 2721 | </a> |
|
2722 | 2722 | </td><td> |
|
2723 | 2723 | roll back an interrupted transaction |
|
2724 | 2724 | </td></tr> |
|
2725 | 2725 | <tr><td> |
|
2726 | 2726 | <a href="/help/rename"> |
|
2727 | 2727 | rename |
|
2728 | 2728 | </a> |
|
2729 | 2729 | </td><td> |
|
2730 | 2730 | rename files; equivalent of copy + remove |
|
2731 | 2731 | </td></tr> |
|
2732 | 2732 | <tr><td> |
|
2733 | 2733 | <a href="/help/resolve"> |
|
2734 | 2734 | resolve |
|
2735 | 2735 | </a> |
|
2736 | 2736 | </td><td> |
|
2737 | 2737 | redo merges or set/view the merge status of files |
|
2738 | 2738 | </td></tr> |
|
2739 | 2739 | <tr><td> |
|
2740 | 2740 | <a href="/help/revert"> |
|
2741 | 2741 | revert |
|
2742 | 2742 | </a> |
|
2743 | 2743 | </td><td> |
|
2744 | 2744 | restore files to their checkout state |
|
2745 | 2745 | </td></tr> |
|
2746 | 2746 | <tr><td> |
|
2747 | 2747 | <a href="/help/root"> |
|
2748 | 2748 | root |
|
2749 | 2749 | </a> |
|
2750 | 2750 | </td><td> |
|
2751 | 2751 | print the root (top) of the current working directory |
|
2752 | 2752 | </td></tr> |
|
2753 | 2753 | <tr><td> |
|
2754 | 2754 | <a href="/help/shellalias"> |
|
2755 | 2755 | shellalias |
|
2756 | 2756 | </a> |
|
2757 | 2757 | </td><td> |
|
2758 | 2758 | (no help text available) |
|
2759 | 2759 | </td></tr> |
|
2760 | 2760 | <tr><td> |
|
2761 | 2761 | <a href="/help/shelve"> |
|
2762 | 2762 | shelve |
|
2763 | 2763 | </a> |
|
2764 | 2764 | </td><td> |
|
2765 | 2765 | save and set aside changes from the working directory |
|
2766 | 2766 | </td></tr> |
|
2767 | 2767 | <tr><td> |
|
2768 | 2768 | <a href="/help/tag"> |
|
2769 | 2769 | tag |
|
2770 | 2770 | </a> |
|
2771 | 2771 | </td><td> |
|
2772 | 2772 | add one or more tags for the current or given revision |
|
2773 | 2773 | </td></tr> |
|
2774 | 2774 | <tr><td> |
|
2775 | 2775 | <a href="/help/tags"> |
|
2776 | 2776 | tags |
|
2777 | 2777 | </a> |
|
2778 | 2778 | </td><td> |
|
2779 | 2779 | list repository tags |
|
2780 | 2780 | </td></tr> |
|
2781 | 2781 | <tr><td> |
|
2782 | 2782 | <a href="/help/unbundle"> |
|
2783 | 2783 | unbundle |
|
2784 | 2784 | </a> |
|
2785 | 2785 | </td><td> |
|
2786 | 2786 | apply one or more bundle files |
|
2787 | 2787 | </td></tr> |
|
2788 | 2788 | <tr><td> |
|
2789 | 2789 | <a href="/help/unshelve"> |
|
2790 | 2790 | unshelve |
|
2791 | 2791 | </a> |
|
2792 | 2792 | </td><td> |
|
2793 | 2793 | restore a shelved change to the working directory |
|
2794 | 2794 | </td></tr> |
|
2795 | 2795 | <tr><td> |
|
2796 | 2796 | <a href="/help/verify"> |
|
2797 | 2797 | verify |
|
2798 | 2798 | </a> |
|
2799 | 2799 | </td><td> |
|
2800 | 2800 | verify the integrity of the repository |
|
2801 | 2801 | </td></tr> |
|
2802 | 2802 | <tr><td> |
|
2803 | 2803 | <a href="/help/version"> |
|
2804 | 2804 | version |
|
2805 | 2805 | </a> |
|
2806 | 2806 | </td><td> |
|
2807 | 2807 | output version and copyright information |
|
2808 | 2808 | </td></tr> |
|
2809 | 2809 | |
|
2810 | 2810 | |
|
2811 | 2811 | </table> |
|
2812 | 2812 | </div> |
|
2813 | 2813 | </div> |
|
2814 | 2814 | |
|
2815 | 2815 | |
|
2816 | 2816 | |
|
2817 | 2817 | </body> |
|
2818 | 2818 | </html> |
|
2819 | 2819 | |
|
2820 | 2820 | |
|
2821 | 2821 | $ get-with-headers.py $LOCALIP:$HGPORT "help/add" |
|
2822 | 2822 | 200 Script output follows |
|
2823 | 2823 | |
|
2824 | 2824 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
|
2825 | 2825 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> |
|
2826 | 2826 | <head> |
|
2827 | 2827 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> |
|
2828 | 2828 | <meta name="robots" content="index, nofollow" /> |
|
2829 | 2829 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> |
|
2830 | 2830 | <script type="text/javascript" src="/static/mercurial.js"></script> |
|
2831 | 2831 | |
|
2832 | 2832 | <title>Help: add</title> |
|
2833 | 2833 | </head> |
|
2834 | 2834 | <body> |
|
2835 | 2835 | |
|
2836 | 2836 | <div class="container"> |
|
2837 | 2837 | <div class="menu"> |
|
2838 | 2838 | <div class="logo"> |
|
2839 | 2839 | <a href="https://mercurial-scm.org/"> |
|
2840 | 2840 | <img src="/static/hglogo.png" alt="mercurial" /></a> |
|
2841 | 2841 | </div> |
|
2842 | 2842 | <ul> |
|
2843 | 2843 | <li><a href="/shortlog">log</a></li> |
|
2844 | 2844 | <li><a href="/graph">graph</a></li> |
|
2845 | 2845 | <li><a href="/tags">tags</a></li> |
|
2846 | 2846 | <li><a href="/bookmarks">bookmarks</a></li> |
|
2847 | 2847 | <li><a href="/branches">branches</a></li> |
|
2848 | 2848 | </ul> |
|
2849 | 2849 | <ul> |
|
2850 | 2850 | <li class="active"><a href="/help">help</a></li> |
|
2851 | 2851 | </ul> |
|
2852 | 2852 | </div> |
|
2853 | 2853 | |
|
2854 | 2854 | <div class="main"> |
|
2855 | 2855 | <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> |
|
2856 | 2856 | <h3>Help: add</h3> |
|
2857 | 2857 | |
|
2858 | 2858 | <form class="search" action="/log"> |
|
2859 | 2859 | |
|
2860 | 2860 | <p><input name="rev" id="search1" type="text" size="30" value="" /></p> |
|
2861 | 2861 | <div id="hint">Find changesets by keywords (author, files, the commit message), revision |
|
2862 | 2862 | number or hash, or <a href="/help/revsets">revset expression</a>.</div> |
|
2863 | 2863 | </form> |
|
2864 | 2864 | <div id="doc"> |
|
2865 | 2865 | <p> |
|
2866 | 2866 | hg add [OPTION]... [FILE]... |
|
2867 | 2867 | </p> |
|
2868 | 2868 | <p> |
|
2869 | 2869 | add the specified files on the next commit |
|
2870 | 2870 | </p> |
|
2871 | 2871 | <p> |
|
2872 | 2872 | Schedule files to be version controlled and added to the |
|
2873 | 2873 | repository. |
|
2874 | 2874 | </p> |
|
2875 | 2875 | <p> |
|
2876 | 2876 | The files will be added to the repository at the next commit. To |
|
2877 | 2877 | undo an add before that, see 'hg forget'. |
|
2878 | 2878 | </p> |
|
2879 | 2879 | <p> |
|
2880 | 2880 | If no names are given, add all files to the repository (except |
|
2881 | 2881 | files matching ".hgignore"). |
|
2882 | 2882 | </p> |
|
2883 | 2883 | <p> |
|
2884 | 2884 | Examples: |
|
2885 | 2885 | </p> |
|
2886 | 2886 | <ul> |
|
2887 | 2887 | <li> New (unknown) files are added automatically by 'hg add': |
|
2888 | 2888 | <pre> |
|
2889 | 2889 | \$ ls (re) |
|
2890 | 2890 | foo.c |
|
2891 | 2891 | \$ hg status (re) |
|
2892 | 2892 | ? foo.c |
|
2893 | 2893 | \$ hg add (re) |
|
2894 | 2894 | adding foo.c |
|
2895 | 2895 | \$ hg status (re) |
|
2896 | 2896 | A foo.c |
|
2897 | 2897 | </pre> |
|
2898 | 2898 | <li> Specific files to be added can be specified: |
|
2899 | 2899 | <pre> |
|
2900 | 2900 | \$ ls (re) |
|
2901 | 2901 | bar.c foo.c |
|
2902 | 2902 | \$ hg status (re) |
|
2903 | 2903 | ? bar.c |
|
2904 | 2904 | ? foo.c |
|
2905 | 2905 | \$ hg add bar.c (re) |
|
2906 | 2906 | \$ hg status (re) |
|
2907 | 2907 | A bar.c |
|
2908 | 2908 | ? foo.c |
|
2909 | 2909 | </pre> |
|
2910 | 2910 | </ul> |
|
2911 | 2911 | <p> |
|
2912 | 2912 | Returns 0 if all files are successfully added. |
|
2913 | 2913 | </p> |
|
2914 | 2914 | <p> |
|
2915 | 2915 | options ([+] can be repeated): |
|
2916 | 2916 | </p> |
|
2917 | 2917 | <table> |
|
2918 | 2918 | <tr><td>-I</td> |
|
2919 | 2919 | <td>--include PATTERN [+]</td> |
|
2920 | 2920 | <td>include names matching the given patterns</td></tr> |
|
2921 | 2921 | <tr><td>-X</td> |
|
2922 | 2922 | <td>--exclude PATTERN [+]</td> |
|
2923 | 2923 | <td>exclude names matching the given patterns</td></tr> |
|
2924 | 2924 | <tr><td>-S</td> |
|
2925 | 2925 | <td>--subrepos</td> |
|
2926 | 2926 | <td>recurse into subrepositories</td></tr> |
|
2927 | 2927 | <tr><td>-n</td> |
|
2928 | 2928 | <td>--dry-run</td> |
|
2929 | 2929 | <td>do not perform actions, just print output</td></tr> |
|
2930 | 2930 | </table> |
|
2931 | 2931 | <p> |
|
2932 | 2932 | global options ([+] can be repeated): |
|
2933 | 2933 | </p> |
|
2934 | 2934 | <table> |
|
2935 | 2935 | <tr><td>-R</td> |
|
2936 | 2936 | <td>--repository REPO</td> |
|
2937 | 2937 | <td>repository root directory or name of overlay bundle file</td></tr> |
|
2938 | 2938 | <tr><td></td> |
|
2939 | 2939 | <td>--cwd DIR</td> |
|
2940 | 2940 | <td>change working directory</td></tr> |
|
2941 | 2941 | <tr><td>-y</td> |
|
2942 | 2942 | <td>--noninteractive</td> |
|
2943 | 2943 | <td>do not prompt, automatically pick the first choice for all prompts</td></tr> |
|
2944 | 2944 | <tr><td>-q</td> |
|
2945 | 2945 | <td>--quiet</td> |
|
2946 | 2946 | <td>suppress output</td></tr> |
|
2947 | 2947 | <tr><td>-v</td> |
|
2948 | 2948 | <td>--verbose</td> |
|
2949 | 2949 | <td>enable additional output</td></tr> |
|
2950 | 2950 | <tr><td></td> |
|
2951 | 2951 | <td>--color TYPE</td> |
|
2952 | 2952 | <td>when to colorize (boolean, always, auto, never, or debug)</td></tr> |
|
2953 | 2953 | <tr><td></td> |
|
2954 | 2954 | <td>--config CONFIG [+]</td> |
|
2955 | 2955 | <td>set/override config option (use 'section.name=value')</td></tr> |
|
2956 | 2956 | <tr><td></td> |
|
2957 | 2957 | <td>--debug</td> |
|
2958 | 2958 | <td>enable debugging output</td></tr> |
|
2959 | 2959 | <tr><td></td> |
|
2960 | 2960 | <td>--debugger</td> |
|
2961 | 2961 | <td>start debugger</td></tr> |
|
2962 | 2962 | <tr><td></td> |
|
2963 | 2963 | <td>--encoding ENCODE</td> |
|
2964 | 2964 | <td>set the charset encoding (default: ascii)</td></tr> |
|
2965 | 2965 | <tr><td></td> |
|
2966 | 2966 | <td>--encodingmode MODE</td> |
|
2967 | 2967 | <td>set the charset encoding mode (default: strict)</td></tr> |
|
2968 | 2968 | <tr><td></td> |
|
2969 | 2969 | <td>--traceback</td> |
|
2970 | 2970 | <td>always print a traceback on exception</td></tr> |
|
2971 | 2971 | <tr><td></td> |
|
2972 | 2972 | <td>--time</td> |
|
2973 | 2973 | <td>time how long the command takes</td></tr> |
|
2974 | 2974 | <tr><td></td> |
|
2975 | 2975 | <td>--profile</td> |
|
2976 | 2976 | <td>print command execution profile</td></tr> |
|
2977 | 2977 | <tr><td></td> |
|
2978 | 2978 | <td>--version</td> |
|
2979 | 2979 | <td>output version information and exit</td></tr> |
|
2980 | 2980 | <tr><td>-h</td> |
|
2981 | 2981 | <td>--help</td> |
|
2982 | 2982 | <td>display help and exit</td></tr> |
|
2983 | 2983 | <tr><td></td> |
|
2984 | 2984 | <td>--hidden</td> |
|
2985 | 2985 | <td>consider hidden changesets</td></tr> |
|
2986 | 2986 | <tr><td></td> |
|
2987 | 2987 | <td>--pager TYPE</td> |
|
2988 | 2988 | <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr> |
|
2989 | 2989 | </table> |
|
2990 | 2990 | |
|
2991 | 2991 | </div> |
|
2992 | 2992 | </div> |
|
2993 | 2993 | </div> |
|
2994 | 2994 | |
|
2995 | 2995 | |
|
2996 | 2996 | |
|
2997 | 2997 | </body> |
|
2998 | 2998 | </html> |
|
2999 | 2999 | |
|
3000 | 3000 | |
|
3001 | 3001 | $ get-with-headers.py $LOCALIP:$HGPORT "help/remove" |
|
3002 | 3002 | 200 Script output follows |
|
3003 | 3003 | |
|
3004 | 3004 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
|
3005 | 3005 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> |
|
3006 | 3006 | <head> |
|
3007 | 3007 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> |
|
3008 | 3008 | <meta name="robots" content="index, nofollow" /> |
|
3009 | 3009 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> |
|
3010 | 3010 | <script type="text/javascript" src="/static/mercurial.js"></script> |
|
3011 | 3011 | |
|
3012 | 3012 | <title>Help: remove</title> |
|
3013 | 3013 | </head> |
|
3014 | 3014 | <body> |
|
3015 | 3015 | |
|
3016 | 3016 | <div class="container"> |
|
3017 | 3017 | <div class="menu"> |
|
3018 | 3018 | <div class="logo"> |
|
3019 | 3019 | <a href="https://mercurial-scm.org/"> |
|
3020 | 3020 | <img src="/static/hglogo.png" alt="mercurial" /></a> |
|
3021 | 3021 | </div> |
|
3022 | 3022 | <ul> |
|
3023 | 3023 | <li><a href="/shortlog">log</a></li> |
|
3024 | 3024 | <li><a href="/graph">graph</a></li> |
|
3025 | 3025 | <li><a href="/tags">tags</a></li> |
|
3026 | 3026 | <li><a href="/bookmarks">bookmarks</a></li> |
|
3027 | 3027 | <li><a href="/branches">branches</a></li> |
|
3028 | 3028 | </ul> |
|
3029 | 3029 | <ul> |
|
3030 | 3030 | <li class="active"><a href="/help">help</a></li> |
|
3031 | 3031 | </ul> |
|
3032 | 3032 | </div> |
|
3033 | 3033 | |
|
3034 | 3034 | <div class="main"> |
|
3035 | 3035 | <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> |
|
3036 | 3036 | <h3>Help: remove</h3> |
|
3037 | 3037 | |
|
3038 | 3038 | <form class="search" action="/log"> |
|
3039 | 3039 | |
|
3040 | 3040 | <p><input name="rev" id="search1" type="text" size="30" value="" /></p> |
|
3041 | 3041 | <div id="hint">Find changesets by keywords (author, files, the commit message), revision |
|
3042 | 3042 | number or hash, or <a href="/help/revsets">revset expression</a>.</div> |
|
3043 | 3043 | </form> |
|
3044 | 3044 | <div id="doc"> |
|
3045 | 3045 | <p> |
|
3046 | 3046 | hg remove [OPTION]... FILE... |
|
3047 | 3047 | </p> |
|
3048 | 3048 | <p> |
|
3049 | 3049 | aliases: rm |
|
3050 | 3050 | </p> |
|
3051 | 3051 | <p> |
|
3052 | 3052 | remove the specified files on the next commit |
|
3053 | 3053 | </p> |
|
3054 | 3054 | <p> |
|
3055 | 3055 | Schedule the indicated files for removal from the current branch. |
|
3056 | 3056 | </p> |
|
3057 | 3057 | <p> |
|
3058 | 3058 | This command schedules the files to be removed at the next commit. |
|
3059 | 3059 | To undo a remove before that, see 'hg revert'. To undo added |
|
3060 | 3060 | files, see 'hg forget'. |
|
3061 | 3061 | </p> |
|
3062 | 3062 | <p> |
|
3063 | 3063 | -A/--after can be used to remove only files that have already |
|
3064 | 3064 | been deleted, -f/--force can be used to force deletion, and -Af |
|
3065 | 3065 | can be used to remove files from the next revision without |
|
3066 | 3066 | deleting them from the working directory. |
|
3067 | 3067 | </p> |
|
3068 | 3068 | <p> |
|
3069 | 3069 | The following table details the behavior of remove for different |
|
3070 | 3070 | file states (columns) and option combinations (rows). The file |
|
3071 | 3071 | states are Added [A], Clean [C], Modified [M] and Missing [!] |
|
3072 | 3072 | (as reported by 'hg status'). The actions are Warn, Remove |
|
3073 | 3073 | (from branch) and Delete (from disk): |
|
3074 | 3074 | </p> |
|
3075 | 3075 | <table> |
|
3076 | 3076 | <tr><td>opt/state</td> |
|
3077 | 3077 | <td>A</td> |
|
3078 | 3078 | <td>C</td> |
|
3079 | 3079 | <td>M</td> |
|
3080 | 3080 | <td>!</td></tr> |
|
3081 | 3081 | <tr><td>none</td> |
|
3082 | 3082 | <td>W</td> |
|
3083 | 3083 | <td>RD</td> |
|
3084 | 3084 | <td>W</td> |
|
3085 | 3085 | <td>R</td></tr> |
|
3086 | 3086 | <tr><td>-f</td> |
|
3087 | 3087 | <td>R</td> |
|
3088 | 3088 | <td>RD</td> |
|
3089 | 3089 | <td>RD</td> |
|
3090 | 3090 | <td>R</td></tr> |
|
3091 | 3091 | <tr><td>-A</td> |
|
3092 | 3092 | <td>W</td> |
|
3093 | 3093 | <td>W</td> |
|
3094 | 3094 | <td>W</td> |
|
3095 | 3095 | <td>R</td></tr> |
|
3096 | 3096 | <tr><td>-Af</td> |
|
3097 | 3097 | <td>R</td> |
|
3098 | 3098 | <td>R</td> |
|
3099 | 3099 | <td>R</td> |
|
3100 | 3100 | <td>R</td></tr> |
|
3101 | 3101 | </table> |
|
3102 | 3102 | <p> |
|
3103 | 3103 | <b>Note:</b> |
|
3104 | 3104 | </p> |
|
3105 | 3105 | <p> |
|
3106 | 3106 | 'hg remove' never deletes files in Added [A] state from the |
|
3107 | 3107 | working directory, not even if "--force" is specified. |
|
3108 | 3108 | </p> |
|
3109 | 3109 | <p> |
|
3110 | 3110 | Returns 0 on success, 1 if any warnings encountered. |
|
3111 | 3111 | </p> |
|
3112 | 3112 | <p> |
|
3113 | 3113 | options ([+] can be repeated): |
|
3114 | 3114 | </p> |
|
3115 | 3115 | <table> |
|
3116 | 3116 | <tr><td>-A</td> |
|
3117 | 3117 | <td>--after</td> |
|
3118 | 3118 | <td>record delete for missing files</td></tr> |
|
3119 | 3119 | <tr><td>-f</td> |
|
3120 | 3120 | <td>--force</td> |
|
3121 | 3121 | <td>forget added files, delete modified files</td></tr> |
|
3122 | 3122 | <tr><td>-S</td> |
|
3123 | 3123 | <td>--subrepos</td> |
|
3124 | 3124 | <td>recurse into subrepositories</td></tr> |
|
3125 | 3125 | <tr><td>-I</td> |
|
3126 | 3126 | <td>--include PATTERN [+]</td> |
|
3127 | 3127 | <td>include names matching the given patterns</td></tr> |
|
3128 | 3128 | <tr><td>-X</td> |
|
3129 | 3129 | <td>--exclude PATTERN [+]</td> |
|
3130 | 3130 | <td>exclude names matching the given patterns</td></tr> |
|
3131 | 3131 | <tr><td>-n</td> |
|
3132 | 3132 | <td>--dry-run</td> |
|
3133 | 3133 | <td>do not perform actions, just print output</td></tr> |
|
3134 | 3134 | </table> |
|
3135 | 3135 | <p> |
|
3136 | 3136 | global options ([+] can be repeated): |
|
3137 | 3137 | </p> |
|
3138 | 3138 | <table> |
|
3139 | 3139 | <tr><td>-R</td> |
|
3140 | 3140 | <td>--repository REPO</td> |
|
3141 | 3141 | <td>repository root directory or name of overlay bundle file</td></tr> |
|
3142 | 3142 | <tr><td></td> |
|
3143 | 3143 | <td>--cwd DIR</td> |
|
3144 | 3144 | <td>change working directory</td></tr> |
|
3145 | 3145 | <tr><td>-y</td> |
|
3146 | 3146 | <td>--noninteractive</td> |
|
3147 | 3147 | <td>do not prompt, automatically pick the first choice for all prompts</td></tr> |
|
3148 | 3148 | <tr><td>-q</td> |
|
3149 | 3149 | <td>--quiet</td> |
|
3150 | 3150 | <td>suppress output</td></tr> |
|
3151 | 3151 | <tr><td>-v</td> |
|
3152 | 3152 | <td>--verbose</td> |
|
3153 | 3153 | <td>enable additional output</td></tr> |
|
3154 | 3154 | <tr><td></td> |
|
3155 | 3155 | <td>--color TYPE</td> |
|
3156 | 3156 | <td>when to colorize (boolean, always, auto, never, or debug)</td></tr> |
|
3157 | 3157 | <tr><td></td> |
|
3158 | 3158 | <td>--config CONFIG [+]</td> |
|
3159 | 3159 | <td>set/override config option (use 'section.name=value')</td></tr> |
|
3160 | 3160 | <tr><td></td> |
|
3161 | 3161 | <td>--debug</td> |
|
3162 | 3162 | <td>enable debugging output</td></tr> |
|
3163 | 3163 | <tr><td></td> |
|
3164 | 3164 | <td>--debugger</td> |
|
3165 | 3165 | <td>start debugger</td></tr> |
|
3166 | 3166 | <tr><td></td> |
|
3167 | 3167 | <td>--encoding ENCODE</td> |
|
3168 | 3168 | <td>set the charset encoding (default: ascii)</td></tr> |
|
3169 | 3169 | <tr><td></td> |
|
3170 | 3170 | <td>--encodingmode MODE</td> |
|
3171 | 3171 | <td>set the charset encoding mode (default: strict)</td></tr> |
|
3172 | 3172 | <tr><td></td> |
|
3173 | 3173 | <td>--traceback</td> |
|
3174 | 3174 | <td>always print a traceback on exception</td></tr> |
|
3175 | 3175 | <tr><td></td> |
|
3176 | 3176 | <td>--time</td> |
|
3177 | 3177 | <td>time how long the command takes</td></tr> |
|
3178 | 3178 | <tr><td></td> |
|
3179 | 3179 | <td>--profile</td> |
|
3180 | 3180 | <td>print command execution profile</td></tr> |
|
3181 | 3181 | <tr><td></td> |
|
3182 | 3182 | <td>--version</td> |
|
3183 | 3183 | <td>output version information and exit</td></tr> |
|
3184 | 3184 | <tr><td>-h</td> |
|
3185 | 3185 | <td>--help</td> |
|
3186 | 3186 | <td>display help and exit</td></tr> |
|
3187 | 3187 | <tr><td></td> |
|
3188 | 3188 | <td>--hidden</td> |
|
3189 | 3189 | <td>consider hidden changesets</td></tr> |
|
3190 | 3190 | <tr><td></td> |
|
3191 | 3191 | <td>--pager TYPE</td> |
|
3192 | 3192 | <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr> |
|
3193 | 3193 | </table> |
|
3194 | 3194 | |
|
3195 | 3195 | </div> |
|
3196 | 3196 | </div> |
|
3197 | 3197 | </div> |
|
3198 | 3198 | |
|
3199 | 3199 | |
|
3200 | 3200 | |
|
3201 | 3201 | </body> |
|
3202 | 3202 | </html> |
|
3203 | 3203 | |
|
3204 | 3204 | |
|
3205 | 3205 | $ get-with-headers.py $LOCALIP:$HGPORT "help/dates" |
|
3206 | 3206 | 200 Script output follows |
|
3207 | 3207 | |
|
3208 | 3208 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
|
3209 | 3209 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> |
|
3210 | 3210 | <head> |
|
3211 | 3211 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> |
|
3212 | 3212 | <meta name="robots" content="index, nofollow" /> |
|
3213 | 3213 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> |
|
3214 | 3214 | <script type="text/javascript" src="/static/mercurial.js"></script> |
|
3215 | 3215 | |
|
3216 | 3216 | <title>Help: dates</title> |
|
3217 | 3217 | </head> |
|
3218 | 3218 | <body> |
|
3219 | 3219 | |
|
3220 | 3220 | <div class="container"> |
|
3221 | 3221 | <div class="menu"> |
|
3222 | 3222 | <div class="logo"> |
|
3223 | 3223 | <a href="https://mercurial-scm.org/"> |
|
3224 | 3224 | <img src="/static/hglogo.png" alt="mercurial" /></a> |
|
3225 | 3225 | </div> |
|
3226 | 3226 | <ul> |
|
3227 | 3227 | <li><a href="/shortlog">log</a></li> |
|
3228 | 3228 | <li><a href="/graph">graph</a></li> |
|
3229 | 3229 | <li><a href="/tags">tags</a></li> |
|
3230 | 3230 | <li><a href="/bookmarks">bookmarks</a></li> |
|
3231 | 3231 | <li><a href="/branches">branches</a></li> |
|
3232 | 3232 | </ul> |
|
3233 | 3233 | <ul> |
|
3234 | 3234 | <li class="active"><a href="/help">help</a></li> |
|
3235 | 3235 | </ul> |
|
3236 | 3236 | </div> |
|
3237 | 3237 | |
|
3238 | 3238 | <div class="main"> |
|
3239 | 3239 | <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> |
|
3240 | 3240 | <h3>Help: dates</h3> |
|
3241 | 3241 | |
|
3242 | 3242 | <form class="search" action="/log"> |
|
3243 | 3243 | |
|
3244 | 3244 | <p><input name="rev" id="search1" type="text" size="30" value="" /></p> |
|
3245 | 3245 | <div id="hint">Find changesets by keywords (author, files, the commit message), revision |
|
3246 | 3246 | number or hash, or <a href="/help/revsets">revset expression</a>.</div> |
|
3247 | 3247 | </form> |
|
3248 | 3248 | <div id="doc"> |
|
3249 | 3249 | <h1>Date Formats</h1> |
|
3250 | 3250 | <p> |
|
3251 | 3251 | Some commands allow the user to specify a date, e.g.: |
|
3252 | 3252 | </p> |
|
3253 | 3253 | <ul> |
|
3254 | 3254 | <li> backout, commit, import, tag: Specify the commit date. |
|
3255 | 3255 | <li> log, revert, update: Select revision(s) by date. |
|
3256 | 3256 | </ul> |
|
3257 | 3257 | <p> |
|
3258 | 3258 | Many date formats are valid. Here are some examples: |
|
3259 | 3259 | </p> |
|
3260 | 3260 | <ul> |
|
3261 | 3261 | <li> "Wed Dec 6 13:18:29 2006" (local timezone assumed) |
|
3262 | 3262 | <li> "Dec 6 13:18 -0600" (year assumed, time offset provided) |
|
3263 | 3263 | <li> "Dec 6 13:18 UTC" (UTC and GMT are aliases for +0000) |
|
3264 | 3264 | <li> "Dec 6" (midnight) |
|
3265 | 3265 | <li> "13:18" (today assumed) |
|
3266 | 3266 | <li> "3:39" (3:39AM assumed) |
|
3267 | 3267 | <li> "3:39pm" (15:39) |
|
3268 | 3268 | <li> "2006-12-06 13:18:29" (ISO 8601 format) |
|
3269 | 3269 | <li> "2006-12-6 13:18" |
|
3270 | 3270 | <li> "2006-12-6" |
|
3271 | 3271 | <li> "12-6" |
|
3272 | 3272 | <li> "12/6" |
|
3273 | 3273 | <li> "12/6/6" (Dec 6 2006) |
|
3274 | 3274 | <li> "today" (midnight) |
|
3275 | 3275 | <li> "yesterday" (midnight) |
|
3276 | 3276 | <li> "now" - right now |
|
3277 | 3277 | </ul> |
|
3278 | 3278 | <p> |
|
3279 | 3279 | Lastly, there is Mercurial's internal format: |
|
3280 | 3280 | </p> |
|
3281 | 3281 | <ul> |
|
3282 | 3282 | <li> "1165411109 0" (Wed Dec 6 13:18:29 2006 UTC) |
|
3283 | 3283 | </ul> |
|
3284 | 3284 | <p> |
|
3285 | 3285 | This is the internal representation format for dates. The first number |
|
3286 | 3286 | is the number of seconds since the epoch (1970-01-01 00:00 UTC). The |
|
3287 | 3287 | second is the offset of the local timezone, in seconds west of UTC |
|
3288 | 3288 | (negative if the timezone is east of UTC). |
|
3289 | 3289 | </p> |
|
3290 | 3290 | <p> |
|
3291 | 3291 | The log command also accepts date ranges: |
|
3292 | 3292 | </p> |
|
3293 | 3293 | <ul> |
|
3294 | 3294 | <li> "<DATE" - at or before a given date/time |
|
3295 | 3295 | <li> ">DATE" - on or after a given date/time |
|
3296 | 3296 | <li> "DATE to DATE" - a date range, inclusive |
|
3297 | 3297 | <li> "-DAYS" - within a given number of days from today |
|
3298 | 3298 | </ul> |
|
3299 | 3299 | |
|
3300 | 3300 | </div> |
|
3301 | 3301 | </div> |
|
3302 | 3302 | </div> |
|
3303 | 3303 | |
|
3304 | 3304 | |
|
3305 | 3305 | |
|
3306 | 3306 | </body> |
|
3307 | 3307 | </html> |
|
3308 | 3308 | |
|
3309 | 3309 | |
|
3310 | 3310 | $ get-with-headers.py $LOCALIP:$HGPORT "help/pager" |
|
3311 | 3311 | 200 Script output follows |
|
3312 | 3312 | |
|
3313 | 3313 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
|
3314 | 3314 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> |
|
3315 | 3315 | <head> |
|
3316 | 3316 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> |
|
3317 | 3317 | <meta name="robots" content="index, nofollow" /> |
|
3318 | 3318 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> |
|
3319 | 3319 | <script type="text/javascript" src="/static/mercurial.js"></script> |
|
3320 | 3320 | |
|
3321 | 3321 | <title>Help: pager</title> |
|
3322 | 3322 | </head> |
|
3323 | 3323 | <body> |
|
3324 | 3324 | |
|
3325 | 3325 | <div class="container"> |
|
3326 | 3326 | <div class="menu"> |
|
3327 | 3327 | <div class="logo"> |
|
3328 | 3328 | <a href="https://mercurial-scm.org/"> |
|
3329 | 3329 | <img src="/static/hglogo.png" alt="mercurial" /></a> |
|
3330 | 3330 | </div> |
|
3331 | 3331 | <ul> |
|
3332 | 3332 | <li><a href="/shortlog">log</a></li> |
|
3333 | 3333 | <li><a href="/graph">graph</a></li> |
|
3334 | 3334 | <li><a href="/tags">tags</a></li> |
|
3335 | 3335 | <li><a href="/bookmarks">bookmarks</a></li> |
|
3336 | 3336 | <li><a href="/branches">branches</a></li> |
|
3337 | 3337 | </ul> |
|
3338 | 3338 | <ul> |
|
3339 | 3339 | <li class="active"><a href="/help">help</a></li> |
|
3340 | 3340 | </ul> |
|
3341 | 3341 | </div> |
|
3342 | 3342 | |
|
3343 | 3343 | <div class="main"> |
|
3344 | 3344 | <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> |
|
3345 | 3345 | <h3>Help: pager</h3> |
|
3346 | 3346 | |
|
3347 | 3347 | <form class="search" action="/log"> |
|
3348 | 3348 | |
|
3349 | 3349 | <p><input name="rev" id="search1" type="text" size="30" value="" /></p> |
|
3350 | 3350 | <div id="hint">Find changesets by keywords (author, files, the commit message), revision |
|
3351 | 3351 | number or hash, or <a href="/help/revsets">revset expression</a>.</div> |
|
3352 | 3352 | </form> |
|
3353 | 3353 | <div id="doc"> |
|
3354 | 3354 | <h1>Pager Support</h1> |
|
3355 | 3355 | <p> |
|
3356 | 3356 | Some Mercurial commands can produce a lot of output, and Mercurial will |
|
3357 | 3357 | attempt to use a pager to make those commands more pleasant. |
|
3358 | 3358 | </p> |
|
3359 | 3359 | <p> |
|
3360 | 3360 | To set the pager that should be used, set the application variable: |
|
3361 | 3361 | </p> |
|
3362 | 3362 | <pre> |
|
3363 | 3363 | [pager] |
|
3364 | 3364 | pager = less -FRX |
|
3365 | 3365 | </pre> |
|
3366 | 3366 | <p> |
|
3367 | 3367 | If no pager is set in the user or repository configuration, Mercurial uses the |
|
3368 | 3368 | environment variable $PAGER. If $PAGER is not set, pager.pager from the default |
|
3369 | 3369 | or system configuration is used. If none of these are set, a default pager will |
|
3370 | 3370 | be used, typically 'less' on Unix and 'more' on Windows. |
|
3371 | 3371 | </p> |
|
3372 | 3372 | <p> |
|
3373 | 3373 | You can disable the pager for certain commands by adding them to the |
|
3374 | 3374 | pager.ignore list: |
|
3375 | 3375 | </p> |
|
3376 | 3376 | <pre> |
|
3377 | 3377 | [pager] |
|
3378 | 3378 | ignore = version, help, update |
|
3379 | 3379 | </pre> |
|
3380 | 3380 | <p> |
|
3381 | 3381 | To ignore global commands like 'hg version' or 'hg help', you have |
|
3382 | 3382 | to specify them in your user configuration file. |
|
3383 | 3383 | </p> |
|
3384 | 3384 | <p> |
|
3385 | 3385 | To control whether the pager is used at all for an individual command, |
|
3386 | 3386 | you can use --pager=<value>: |
|
3387 | 3387 | </p> |
|
3388 | 3388 | <ul> |
|
3389 | 3389 | <li> use as needed: 'auto'. |
|
3390 | 3390 | <li> require the pager: 'yes' or 'on'. |
|
3391 | 3391 | <li> suppress the pager: 'no' or 'off' (any unrecognized value will also work). |
|
3392 | 3392 | </ul> |
|
3393 | 3393 | <p> |
|
3394 | 3394 | To globally turn off all attempts to use a pager, set: |
|
3395 | 3395 | </p> |
|
3396 | 3396 | <pre> |
|
3397 | 3397 | [ui] |
|
3398 | 3398 | paginate = never |
|
3399 | 3399 | </pre> |
|
3400 | 3400 | <p> |
|
3401 | 3401 | which will prevent the pager from running. |
|
3402 | 3402 | </p> |
|
3403 | 3403 | |
|
3404 | 3404 | </div> |
|
3405 | 3405 | </div> |
|
3406 | 3406 | </div> |
|
3407 | 3407 | |
|
3408 | 3408 | |
|
3409 | 3409 | |
|
3410 | 3410 | </body> |
|
3411 | 3411 | </html> |
|
3412 | 3412 | |
|
3413 | 3413 | |
|
3414 | 3414 | Sub-topic indexes rendered properly |
|
3415 | 3415 | |
|
3416 | 3416 | $ get-with-headers.py $LOCALIP:$HGPORT "help/internals" |
|
3417 | 3417 | 200 Script output follows |
|
3418 | 3418 | |
|
3419 | 3419 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
|
3420 | 3420 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> |
|
3421 | 3421 | <head> |
|
3422 | 3422 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> |
|
3423 | 3423 | <meta name="robots" content="index, nofollow" /> |
|
3424 | 3424 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> |
|
3425 | 3425 | <script type="text/javascript" src="/static/mercurial.js"></script> |
|
3426 | 3426 | |
|
3427 | 3427 | <title>Help: internals</title> |
|
3428 | 3428 | </head> |
|
3429 | 3429 | <body> |
|
3430 | 3430 | |
|
3431 | 3431 | <div class="container"> |
|
3432 | 3432 | <div class="menu"> |
|
3433 | 3433 | <div class="logo"> |
|
3434 | 3434 | <a href="https://mercurial-scm.org/"> |
|
3435 | 3435 | <img src="/static/hglogo.png" alt="mercurial" /></a> |
|
3436 | 3436 | </div> |
|
3437 | 3437 | <ul> |
|
3438 | 3438 | <li><a href="/shortlog">log</a></li> |
|
3439 | 3439 | <li><a href="/graph">graph</a></li> |
|
3440 | 3440 | <li><a href="/tags">tags</a></li> |
|
3441 | 3441 | <li><a href="/bookmarks">bookmarks</a></li> |
|
3442 | 3442 | <li><a href="/branches">branches</a></li> |
|
3443 | 3443 | </ul> |
|
3444 | 3444 | <ul> |
|
3445 | 3445 | <li><a href="/help">help</a></li> |
|
3446 | 3446 | </ul> |
|
3447 | 3447 | </div> |
|
3448 | 3448 | |
|
3449 | 3449 | <div class="main"> |
|
3450 | 3450 | <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> |
|
3451 | 3451 | |
|
3452 | 3452 | <form class="search" action="/log"> |
|
3453 | 3453 | |
|
3454 | 3454 | <p><input name="rev" id="search1" type="text" size="30" value="" /></p> |
|
3455 | 3455 | <div id="hint">Find changesets by keywords (author, files, the commit message), revision |
|
3456 | 3456 | number or hash, or <a href="/help/revsets">revset expression</a>.</div> |
|
3457 | 3457 | </form> |
|
3458 | 3458 | <table class="bigtable"> |
|
3459 | 3459 | <tr><td colspan="2"><h2><a name="topics" href="#topics">Topics</a></h2></td></tr> |
|
3460 | 3460 | |
|
3461 | 3461 | <tr><td> |
|
3462 | 3462 | <a href="/help/internals.bid-merge"> |
|
3463 | 3463 | bid-merge |
|
3464 | 3464 | </a> |
|
3465 | 3465 | </td><td> |
|
3466 | 3466 | Bid Merge Algorithm |
|
3467 | 3467 | </td></tr> |
|
3468 | 3468 | <tr><td> |
|
3469 | 3469 | <a href="/help/internals.bundle2"> |
|
3470 | 3470 | bundle2 |
|
3471 | 3471 | </a> |
|
3472 | 3472 | </td><td> |
|
3473 | 3473 | Bundle2 |
|
3474 | 3474 | </td></tr> |
|
3475 | 3475 | <tr><td> |
|
3476 | 3476 | <a href="/help/internals.bundles"> |
|
3477 | 3477 | bundles |
|
3478 | 3478 | </a> |
|
3479 | 3479 | </td><td> |
|
3480 | 3480 | Bundles |
|
3481 | 3481 | </td></tr> |
|
3482 | 3482 | <tr><td> |
|
3483 | 3483 | <a href="/help/internals.cbor"> |
|
3484 | 3484 | cbor |
|
3485 | 3485 | </a> |
|
3486 | 3486 | </td><td> |
|
3487 | 3487 | CBOR |
|
3488 | 3488 | </td></tr> |
|
3489 | 3489 | <tr><td> |
|
3490 | 3490 | <a href="/help/internals.censor"> |
|
3491 | 3491 | censor |
|
3492 | 3492 | </a> |
|
3493 | 3493 | </td><td> |
|
3494 | 3494 | Censor |
|
3495 | 3495 | </td></tr> |
|
3496 | 3496 | <tr><td> |
|
3497 | 3497 | <a href="/help/internals.changegroups"> |
|
3498 | 3498 | changegroups |
|
3499 | 3499 | </a> |
|
3500 | 3500 | </td><td> |
|
3501 | 3501 | Changegroups |
|
3502 | 3502 | </td></tr> |
|
3503 | 3503 | <tr><td> |
|
3504 | 3504 | <a href="/help/internals.config"> |
|
3505 | 3505 | config |
|
3506 | 3506 | </a> |
|
3507 | 3507 | </td><td> |
|
3508 | 3508 | Config Registrar |
|
3509 | 3509 | </td></tr> |
|
3510 | 3510 | <tr><td> |
|
3511 | 3511 | <a href="/help/internals.extensions"> |
|
3512 | 3512 | extensions |
|
3513 | 3513 | </a> |
|
3514 | 3514 | </td><td> |
|
3515 | 3515 | Extension API |
|
3516 | 3516 | </td></tr> |
|
3517 | 3517 | <tr><td> |
|
3518 | 3518 | <a href="/help/internals.mergestate"> |
|
3519 | 3519 | mergestate |
|
3520 | 3520 | </a> |
|
3521 | 3521 | </td><td> |
|
3522 | 3522 | Mergestate |
|
3523 | 3523 | </td></tr> |
|
3524 | 3524 | <tr><td> |
|
3525 | 3525 | <a href="/help/internals.requirements"> |
|
3526 | 3526 | requirements |
|
3527 | 3527 | </a> |
|
3528 | 3528 | </td><td> |
|
3529 | 3529 | Repository Requirements |
|
3530 | 3530 | </td></tr> |
|
3531 | 3531 | <tr><td> |
|
3532 | 3532 | <a href="/help/internals.revlogs"> |
|
3533 | 3533 | revlogs |
|
3534 | 3534 | </a> |
|
3535 | 3535 | </td><td> |
|
3536 | 3536 | Revision Logs |
|
3537 | 3537 | </td></tr> |
|
3538 | 3538 | <tr><td> |
|
3539 | 3539 | <a href="/help/internals.wireprotocol"> |
|
3540 | 3540 | wireprotocol |
|
3541 | 3541 | </a> |
|
3542 | 3542 | </td><td> |
|
3543 | 3543 | Wire Protocol |
|
3544 | 3544 | </td></tr> |
|
3545 | 3545 | <tr><td> |
|
3546 | 3546 | <a href="/help/internals.wireprotocolrpc"> |
|
3547 | 3547 | wireprotocolrpc |
|
3548 | 3548 | </a> |
|
3549 | 3549 | </td><td> |
|
3550 | 3550 | Wire Protocol RPC |
|
3551 | 3551 | </td></tr> |
|
3552 | 3552 | <tr><td> |
|
3553 | 3553 | <a href="/help/internals.wireprotocolv2"> |
|
3554 | 3554 | wireprotocolv2 |
|
3555 | 3555 | </a> |
|
3556 | 3556 | </td><td> |
|
3557 | 3557 | Wire Protocol Version 2 |
|
3558 | 3558 | </td></tr> |
|
3559 | 3559 | |
|
3560 | 3560 | |
|
3561 | 3561 | |
|
3562 | 3562 | |
|
3563 | 3563 | |
|
3564 | 3564 | </table> |
|
3565 | 3565 | </div> |
|
3566 | 3566 | </div> |
|
3567 | 3567 | |
|
3568 | 3568 | |
|
3569 | 3569 | |
|
3570 | 3570 | </body> |
|
3571 | 3571 | </html> |
|
3572 | 3572 | |
|
3573 | 3573 | |
|
3574 | 3574 | Sub-topic topics rendered properly |
|
3575 | 3575 | |
|
3576 | 3576 | $ get-with-headers.py $LOCALIP:$HGPORT "help/internals.changegroups" |
|
3577 | 3577 | 200 Script output follows |
|
3578 | 3578 | |
|
3579 | 3579 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
|
3580 | 3580 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> |
|
3581 | 3581 | <head> |
|
3582 | 3582 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> |
|
3583 | 3583 | <meta name="robots" content="index, nofollow" /> |
|
3584 | 3584 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> |
|
3585 | 3585 | <script type="text/javascript" src="/static/mercurial.js"></script> |
|
3586 | 3586 | |
|
3587 | 3587 | <title>Help: internals.changegroups</title> |
|
3588 | 3588 | </head> |
|
3589 | 3589 | <body> |
|
3590 | 3590 | |
|
3591 | 3591 | <div class="container"> |
|
3592 | 3592 | <div class="menu"> |
|
3593 | 3593 | <div class="logo"> |
|
3594 | 3594 | <a href="https://mercurial-scm.org/"> |
|
3595 | 3595 | <img src="/static/hglogo.png" alt="mercurial" /></a> |
|
3596 | 3596 | </div> |
|
3597 | 3597 | <ul> |
|
3598 | 3598 | <li><a href="/shortlog">log</a></li> |
|
3599 | 3599 | <li><a href="/graph">graph</a></li> |
|
3600 | 3600 | <li><a href="/tags">tags</a></li> |
|
3601 | 3601 | <li><a href="/bookmarks">bookmarks</a></li> |
|
3602 | 3602 | <li><a href="/branches">branches</a></li> |
|
3603 | 3603 | </ul> |
|
3604 | 3604 | <ul> |
|
3605 | 3605 | <li class="active"><a href="/help">help</a></li> |
|
3606 | 3606 | </ul> |
|
3607 | 3607 | </div> |
|
3608 | 3608 | |
|
3609 | 3609 | <div class="main"> |
|
3610 | 3610 | <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> |
|
3611 | 3611 | <h3>Help: internals.changegroups</h3> |
|
3612 | 3612 | |
|
3613 | 3613 | <form class="search" action="/log"> |
|
3614 | 3614 | |
|
3615 | 3615 | <p><input name="rev" id="search1" type="text" size="30" value="" /></p> |
|
3616 | 3616 | <div id="hint">Find changesets by keywords (author, files, the commit message), revision |
|
3617 | 3617 | number or hash, or <a href="/help/revsets">revset expression</a>.</div> |
|
3618 | 3618 | </form> |
|
3619 | 3619 | <div id="doc"> |
|
3620 | 3620 | <h1>Changegroups</h1> |
|
3621 | 3621 | <p> |
|
3622 | 3622 | Changegroups are representations of repository revlog data, specifically |
|
3623 | 3623 | the changelog data, root/flat manifest data, treemanifest data, and |
|
3624 | 3624 | filelogs. |
|
3625 | 3625 | </p> |
|
3626 | 3626 | <p> |
|
3627 | 3627 | There are 3 versions of changegroups: "1", "2", and "3". From a |
|
3628 | 3628 | high-level, versions "1" and "2" are almost exactly the same, with the |
|
3629 | 3629 | only difference being an additional item in the *delta header*. Version |
|
3630 | 3630 | "3" adds support for storage flags in the *delta header* and optionally |
|
3631 | 3631 | exchanging treemanifests (enabled by setting an option on the |
|
3632 | 3632 | "changegroup" part in the bundle2). |
|
3633 | 3633 | </p> |
|
3634 | 3634 | <p> |
|
3635 | 3635 | Changegroups when not exchanging treemanifests consist of 3 logical |
|
3636 | 3636 | segments: |
|
3637 | 3637 | </p> |
|
3638 | 3638 | <pre> |
|
3639 | 3639 | +---------------------------------+ |
|
3640 | 3640 | | | | | |
|
3641 | 3641 | | changeset | manifest | filelogs | |
|
3642 | 3642 | | | | | |
|
3643 | 3643 | | | | | |
|
3644 | 3644 | +---------------------------------+ |
|
3645 | 3645 | </pre> |
|
3646 | 3646 | <p> |
|
3647 | 3647 | When exchanging treemanifests, there are 4 logical segments: |
|
3648 | 3648 | </p> |
|
3649 | 3649 | <pre> |
|
3650 | 3650 | +-------------------------------------------------+ |
|
3651 | 3651 | | | | | | |
|
3652 | 3652 | | changeset | root | treemanifests | filelogs | |
|
3653 | 3653 | | | manifest | | | |
|
3654 | 3654 | | | | | | |
|
3655 | 3655 | +-------------------------------------------------+ |
|
3656 | 3656 | </pre> |
|
3657 | 3657 | <p> |
|
3658 | 3658 | The principle building block of each segment is a *chunk*. A *chunk* |
|
3659 | 3659 | is a framed piece of data: |
|
3660 | 3660 | </p> |
|
3661 | 3661 | <pre> |
|
3662 | 3662 | +---------------------------------------+ |
|
3663 | 3663 | | | | |
|
3664 | 3664 | | length | data | |
|
3665 | 3665 | | (4 bytes) | (<length - 4> bytes) | |
|
3666 | 3666 | | | | |
|
3667 | 3667 | +---------------------------------------+ |
|
3668 | 3668 | </pre> |
|
3669 | 3669 | <p> |
|
3670 | 3670 | All integers are big-endian signed integers. Each chunk starts with a 32-bit |
|
3671 | 3671 | integer indicating the length of the entire chunk (including the length field |
|
3672 | 3672 | itself). |
|
3673 | 3673 | </p> |
|
3674 | 3674 | <p> |
|
3675 | 3675 | There is a special case chunk that has a value of 0 for the length |
|
3676 | 3676 | ("0x00000000"). We call this an *empty chunk*. |
|
3677 | 3677 | </p> |
|
3678 | 3678 | <h2>Delta Groups</h2> |
|
3679 | 3679 | <p> |
|
3680 | 3680 | A *delta group* expresses the content of a revlog as a series of deltas, |
|
3681 | 3681 | or patches against previous revisions. |
|
3682 | 3682 | </p> |
|
3683 | 3683 | <p> |
|
3684 | 3684 | Delta groups consist of 0 or more *chunks* followed by the *empty chunk* |
|
3685 | 3685 | to signal the end of the delta group: |
|
3686 | 3686 | </p> |
|
3687 | 3687 | <pre> |
|
3688 | 3688 | +------------------------------------------------------------------------+ |
|
3689 | 3689 | | | | | | | |
|
3690 | 3690 | | chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 | |
|
3691 | 3691 | | (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) | |
|
3692 | 3692 | | | | | | | |
|
3693 | 3693 | +------------------------------------------------------------------------+ |
|
3694 | 3694 | </pre> |
|
3695 | 3695 | <p> |
|
3696 | 3696 | Each *chunk*'s data consists of the following: |
|
3697 | 3697 | </p> |
|
3698 | 3698 | <pre> |
|
3699 | 3699 | +---------------------------------------+ |
|
3700 | 3700 | | | | |
|
3701 | 3701 | | delta header | delta data | |
|
3702 | 3702 | | (various by version) | (various) | |
|
3703 | 3703 | | | | |
|
3704 | 3704 | +---------------------------------------+ |
|
3705 | 3705 | </pre> |
|
3706 | 3706 | <p> |
|
3707 | 3707 | The *delta data* is a series of *delta*s that describe a diff from an existing |
|
3708 | 3708 | entry (either that the recipient already has, or previously specified in the |
|
3709 | 3709 | bundle/changegroup). |
|
3710 | 3710 | </p> |
|
3711 | 3711 | <p> |
|
3712 | 3712 | The *delta header* is different between versions "1", "2", and |
|
3713 | 3713 | "3" of the changegroup format. |
|
3714 | 3714 | </p> |
|
3715 | 3715 | <p> |
|
3716 | 3716 | Version 1 (headerlen=80): |
|
3717 | 3717 | </p> |
|
3718 | 3718 | <pre> |
|
3719 | 3719 | +------------------------------------------------------+ |
|
3720 | 3720 | | | | | | |
|
3721 | 3721 | | node | p1 node | p2 node | link node | |
|
3722 | 3722 | | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | |
|
3723 | 3723 | | | | | | |
|
3724 | 3724 | +------------------------------------------------------+ |
|
3725 | 3725 | </pre> |
|
3726 | 3726 | <p> |
|
3727 | 3727 | Version 2 (headerlen=100): |
|
3728 | 3728 | </p> |
|
3729 | 3729 | <pre> |
|
3730 | 3730 | +------------------------------------------------------------------+ |
|
3731 | 3731 | | | | | | | |
|
3732 | 3732 | | node | p1 node | p2 node | base node | link node | |
|
3733 | 3733 | | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | |
|
3734 | 3734 | | | | | | | |
|
3735 | 3735 | +------------------------------------------------------------------+ |
|
3736 | 3736 | </pre> |
|
3737 | 3737 | <p> |
|
3738 | 3738 | Version 3 (headerlen=102): |
|
3739 | 3739 | </p> |
|
3740 | 3740 | <pre> |
|
3741 | 3741 | +------------------------------------------------------------------------------+ |
|
3742 | 3742 | | | | | | | | |
|
3743 | 3743 | | node | p1 node | p2 node | base node | link node | flags | |
|
3744 | 3744 | | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) | |
|
3745 | 3745 | | | | | | | | |
|
3746 | 3746 | +------------------------------------------------------------------------------+ |
|
3747 | 3747 | </pre> |
|
3748 | 3748 | <p> |
|
3749 | 3749 | The *delta data* consists of "chunklen - 4 - headerlen" bytes, which contain a |
|
3750 | 3750 | series of *delta*s, densely packed (no separators). These deltas describe a diff |
|
3751 | 3751 | from an existing entry (either that the recipient already has, or previously |
|
3752 | 3752 | specified in the bundle/changegroup). The format is described more fully in |
|
3753 | 3753 | "hg help internals.bdiff", but briefly: |
|
3754 | 3754 | </p> |
|
3755 | 3755 | <pre> |
|
3756 | 3756 | +---------------------------------------------------------------+ |
|
3757 | 3757 | | | | | | |
|
3758 | 3758 | | start offset | end offset | new length | content | |
|
3759 | 3759 | | (4 bytes) | (4 bytes) | (4 bytes) | (<new length> bytes) | |
|
3760 | 3760 | | | | | | |
|
3761 | 3761 | +---------------------------------------------------------------+ |
|
3762 | 3762 | </pre> |
|
3763 | 3763 | <p> |
|
3764 | 3764 | Please note that the length field in the delta data does *not* include itself. |
|
3765 | 3765 | </p> |
|
3766 | 3766 | <p> |
|
3767 | 3767 | In version 1, the delta is always applied against the previous node from |
|
3768 | 3768 | the changegroup or the first parent if this is the first entry in the |
|
3769 | 3769 | changegroup. |
|
3770 | 3770 | </p> |
|
3771 | 3771 | <p> |
|
3772 | 3772 | In version 2 and up, the delta base node is encoded in the entry in the |
|
3773 | 3773 | changegroup. This allows the delta to be expressed against any parent, |
|
3774 | 3774 | which can result in smaller deltas and more efficient encoding of data. |
|
3775 | 3775 | </p> |
|
3776 | 3776 | <p> |
|
3777 | 3777 | The *flags* field holds bitwise flags affecting the processing of revision |
|
3778 | 3778 | data. The following flags are defined: |
|
3779 | 3779 | </p> |
|
3780 | 3780 | <dl> |
|
3781 | 3781 | <dt>32768 |
|
3782 | 3782 | <dd>Censored revision. The revision's fulltext has been replaced by censor metadata. May only occur on file revisions. |
|
3783 | 3783 | <dt>16384 |
|
3784 | 3784 | <dd>Ellipsis revision. Revision hash does not match data (likely due to rewritten parents). |
|
3785 | 3785 | <dt>8192 |
|
3786 | 3786 | <dd>Externally stored. The revision fulltext contains "key:value" "\n" delimited metadata defining an object stored elsewhere. Used by the LFS extension. |
|
3787 | 3787 | </dl> |
|
3788 | 3788 | <p> |
|
3789 | 3789 | For historical reasons, the integer values are identical to revlog version 1 |
|
3790 | 3790 | per-revision storage flags and correspond to bits being set in this 2-byte |
|
3791 | 3791 | field. Bits were allocated starting from the most-significant bit, hence the |
|
3792 | 3792 | reverse ordering and allocation of these flags. |
|
3793 | 3793 | </p> |
|
3794 | 3794 | <h2>Changeset Segment</h2> |
|
3795 | 3795 | <p> |
|
3796 | 3796 | The *changeset segment* consists of a single *delta group* holding |
|
3797 | 3797 | changelog data. The *empty chunk* at the end of the *delta group* denotes |
|
3798 | 3798 | the boundary to the *manifest segment*. |
|
3799 | 3799 | </p> |
|
3800 | 3800 | <h2>Manifest Segment</h2> |
|
3801 | 3801 | <p> |
|
3802 | 3802 | The *manifest segment* consists of a single *delta group* holding manifest |
|
3803 | 3803 | data. If treemanifests are in use, it contains only the manifest for the |
|
3804 | 3804 | root directory of the repository. Otherwise, it contains the entire |
|
3805 | 3805 | manifest data. The *empty chunk* at the end of the *delta group* denotes |
|
3806 | 3806 | the boundary to the next segment (either the *treemanifests segment* or the |
|
3807 | 3807 | *filelogs segment*, depending on version and the request options). |
|
3808 | 3808 | </p> |
|
3809 | 3809 | <h3>Treemanifests Segment</h3> |
|
3810 | 3810 | <p> |
|
3811 | 3811 | The *treemanifests segment* only exists in changegroup version "3", and |
|
3812 | 3812 | only if the 'treemanifest' param is part of the bundle2 changegroup part |
|
3813 | 3813 | (it is not possible to use changegroup version 3 outside of bundle2). |
|
3814 | 3814 | Aside from the filenames in the *treemanifests segment* containing a |
|
3815 | 3815 | trailing "/" character, it behaves identically to the *filelogs segment* |
|
3816 | 3816 | (see below). The final sub-segment is followed by an *empty chunk* (logically, |
|
3817 | 3817 | a sub-segment with filename size 0). This denotes the boundary to the |
|
3818 | 3818 | *filelogs segment*. |
|
3819 | 3819 | </p> |
|
3820 | 3820 | <h2>Filelogs Segment</h2> |
|
3821 | 3821 | <p> |
|
3822 | 3822 | The *filelogs segment* consists of multiple sub-segments, each |
|
3823 | 3823 | corresponding to an individual file whose data is being described: |
|
3824 | 3824 | </p> |
|
3825 | 3825 | <pre> |
|
3826 | 3826 | +--------------------------------------------------+ |
|
3827 | 3827 | | | | | | | |
|
3828 | 3828 | | filelog0 | filelog1 | filelog2 | ... | 0x0 | |
|
3829 | 3829 | | | | | | (4 bytes) | |
|
3830 | 3830 | | | | | | | |
|
3831 | 3831 | +--------------------------------------------------+ |
|
3832 | 3832 | </pre> |
|
3833 | 3833 | <p> |
|
3834 | 3834 | The final filelog sub-segment is followed by an *empty chunk* (logically, |
|
3835 | 3835 | a sub-segment with filename size 0). This denotes the end of the segment |
|
3836 | 3836 | and of the overall changegroup. |
|
3837 | 3837 | </p> |
|
3838 | 3838 | <p> |
|
3839 | 3839 | Each filelog sub-segment consists of the following: |
|
3840 | 3840 | </p> |
|
3841 | 3841 | <pre> |
|
3842 | 3842 | +------------------------------------------------------+ |
|
3843 | 3843 | | | | | |
|
3844 | 3844 | | filename length | filename | delta group | |
|
3845 | 3845 | | (4 bytes) | (<length - 4> bytes) | (various) | |
|
3846 | 3846 | | | | | |
|
3847 | 3847 | +------------------------------------------------------+ |
|
3848 | 3848 | </pre> |
|
3849 | 3849 | <p> |
|
3850 | 3850 | That is, a *chunk* consisting of the filename (not terminated or padded) |
|
3851 | 3851 | followed by N chunks constituting the *delta group* for this file. The |
|
3852 | 3852 | *empty chunk* at the end of each *delta group* denotes the boundary to the |
|
3853 | 3853 | next filelog sub-segment. |
|
3854 | 3854 | </p> |
|
3855 | 3855 | |
|
3856 | 3856 | </div> |
|
3857 | 3857 | </div> |
|
3858 | 3858 | </div> |
|
3859 | 3859 | |
|
3860 | 3860 | |
|
3861 | 3861 | |
|
3862 | 3862 | </body> |
|
3863 | 3863 | </html> |
|
3864 | 3864 | |
|
3865 | 3865 | |
|
3866 | 3866 | $ get-with-headers.py 127.0.0.1:$HGPORT "help/unknowntopic" |
|
3867 | 3867 | 404 Not Found |
|
3868 | 3868 | |
|
3869 | 3869 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
|
3870 | 3870 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> |
|
3871 | 3871 | <head> |
|
3872 | 3872 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> |
|
3873 | 3873 | <meta name="robots" content="index, nofollow" /> |
|
3874 | 3874 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> |
|
3875 | 3875 | <script type="text/javascript" src="/static/mercurial.js"></script> |
|
3876 | 3876 | |
|
3877 | 3877 | <title>test: error</title> |
|
3878 | 3878 | </head> |
|
3879 | 3879 | <body> |
|
3880 | 3880 | |
|
3881 | 3881 | <div class="container"> |
|
3882 | 3882 | <div class="menu"> |
|
3883 | 3883 | <div class="logo"> |
|
3884 | 3884 | <a href="https://mercurial-scm.org/"> |
|
3885 | 3885 | <img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial" /></a> |
|
3886 | 3886 | </div> |
|
3887 | 3887 | <ul> |
|
3888 | 3888 | <li><a href="/shortlog">log</a></li> |
|
3889 | 3889 | <li><a href="/graph">graph</a></li> |
|
3890 | 3890 | <li><a href="/tags">tags</a></li> |
|
3891 | 3891 | <li><a href="/bookmarks">bookmarks</a></li> |
|
3892 | 3892 | <li><a href="/branches">branches</a></li> |
|
3893 | 3893 | </ul> |
|
3894 | 3894 | <ul> |
|
3895 | 3895 | <li><a href="/help">help</a></li> |
|
3896 | 3896 | </ul> |
|
3897 | 3897 | </div> |
|
3898 | 3898 | |
|
3899 | 3899 | <div class="main"> |
|
3900 | 3900 | |
|
3901 | 3901 | <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> |
|
3902 | 3902 | <h3>error</h3> |
|
3903 | 3903 | |
|
3904 | 3904 | |
|
3905 | 3905 | <form class="search" action="/log"> |
|
3906 | 3906 | |
|
3907 | 3907 | <p><input name="rev" id="search1" type="text" size="30" value="" /></p> |
|
3908 | 3908 | <div id="hint">Find changesets by keywords (author, files, the commit message), revision |
|
3909 | 3909 | number or hash, or <a href="/help/revsets">revset expression</a>.</div> |
|
3910 | 3910 | </form> |
|
3911 | 3911 | |
|
3912 | 3912 | <div class="description"> |
|
3913 | 3913 | <p> |
|
3914 | 3914 | An error occurred while processing your request: |
|
3915 | 3915 | </p> |
|
3916 | 3916 | <p> |
|
3917 | 3917 | Not Found |
|
3918 | 3918 | </p> |
|
3919 | 3919 | </div> |
|
3920 | 3920 | </div> |
|
3921 | 3921 | </div> |
|
3922 | 3922 | |
|
3923 | 3923 | |
|
3924 | 3924 | |
|
3925 | 3925 | </body> |
|
3926 | 3926 | </html> |
|
3927 | 3927 | |
|
3928 | 3928 | [1] |
|
3929 | 3929 | |
|
3930 | 3930 | $ killdaemons.py |
|
3931 | 3931 | |
|
3932 | 3932 | #endif |
@@ -1,227 +1,227 b'' | |||
|
1 | 1 | #testcases flat tree |
|
2 | 2 | $ . "$TESTDIR/narrow-library.sh" |
|
3 | 3 | |
|
4 | 4 | #if tree |
|
5 | 5 | $ cat << EOF >> $HGRCPATH |
|
6 | 6 | > [experimental] |
|
7 | 7 | > treemanifest = 1 |
|
8 | 8 | > EOF |
|
9 | 9 | #endif |
|
10 | 10 | |
|
11 | 11 | $ hg init master |
|
12 | 12 | $ cd master |
|
13 | 13 | $ cat >> .hg/hgrc <<EOF |
|
14 | 14 | > [narrow] |
|
15 | 15 | > serveellipses=True |
|
16 | 16 | > EOF |
|
17 | 17 | |
|
18 | 18 | $ mkdir inside |
|
19 | 19 | $ echo 'inside' > inside/f |
|
20 | 20 | $ hg add inside/f |
|
21 | 21 | $ hg commit -m 'add inside' |
|
22 | 22 | |
|
23 | 23 | $ mkdir widest |
|
24 | 24 | $ echo 'widest' > widest/f |
|
25 | 25 | $ hg add widest/f |
|
26 | 26 | $ hg commit -m 'add widest' |
|
27 | 27 | |
|
28 | 28 | $ mkdir outside |
|
29 | 29 | $ echo 'outside' > outside/f |
|
30 | 30 | $ hg add outside/f |
|
31 | 31 | $ hg commit -m 'add outside' |
|
32 | 32 | |
|
33 | 33 | $ cd .. |
|
34 | 34 | |
|
35 | 35 | narrow clone the inside file |
|
36 | 36 | |
|
37 | 37 | $ hg clone --narrow ssh://user@dummy/master narrow --include inside |
|
38 | 38 | requesting all changes |
|
39 | 39 | adding changesets |
|
40 | 40 | adding manifests |
|
41 | 41 | adding file changes |
|
42 | 42 | added 2 changesets with 1 changes to 1 files |
|
43 | 43 | new changesets *:* (glob) |
|
44 | 44 | updating to branch default |
|
45 | 45 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
46 | 46 | $ cd narrow |
|
47 | 47 | $ hg tracked |
|
48 | 48 | I path:inside |
|
49 | 49 | $ ls -A |
|
50 | 50 | .hg |
|
51 | 51 | inside |
|
52 | 52 | $ cat inside/f |
|
53 | 53 | inside |
|
54 | 54 | $ cd .. |
|
55 | 55 | |
|
56 | 56 | add more upstream files which we will include in a wider narrow spec |
|
57 | 57 | |
|
58 | 58 | $ cd master |
|
59 | 59 | |
|
60 | 60 | $ mkdir wider |
|
61 | 61 | $ echo 'wider' > wider/f |
|
62 | 62 | $ hg add wider/f |
|
63 | 63 | $ echo 'widest v2' > widest/f |
|
64 | 64 | $ hg commit -m 'add wider, update widest' |
|
65 | 65 | |
|
66 | 66 | $ echo 'widest v3' > widest/f |
|
67 | 67 | $ hg commit -m 'update widest v3' |
|
68 | 68 | |
|
69 | 69 | $ echo 'inside v2' > inside/f |
|
70 | 70 | $ hg commit -m 'update inside' |
|
71 | 71 | |
|
72 | 72 | $ mkdir outside2 |
|
73 | 73 | $ echo 'outside2' > outside2/f |
|
74 | 74 | $ hg add outside2/f |
|
75 | 75 | $ hg commit -m 'add outside2' |
|
76 | 76 | |
|
77 | 77 | $ echo 'widest v4' > widest/f |
|
78 | 78 | $ hg commit -m 'update widest v4' |
|
79 | 79 | |
|
80 | 80 | $ hg log -T "{if(ellipsis, '...')}{rev}: {desc}\n" |
|
81 | 81 | 7: update widest v4 |
|
82 | 82 | 6: add outside2 |
|
83 | 83 | 5: update inside |
|
84 | 84 | 4: update widest v3 |
|
85 | 85 | 3: add wider, update widest |
|
86 | 86 | 2: add outside |
|
87 | 87 | 1: add widest |
|
88 | 88 | 0: add inside |
|
89 | 89 | |
|
90 | 90 | $ cd .. |
|
91 | 91 | |
|
92 | 92 | Testing the --import-rules flag of `hg tracked` command |
|
93 | 93 | |
|
94 | 94 | $ cd narrow |
|
95 | 95 | $ hg tracked --import-rules |
|
96 | 96 | hg tracked: option --import-rules requires argument |
|
97 | 97 | hg tracked [OPTIONS]... [REMOTE] |
|
98 | 98 | |
|
99 | 99 | show or change the current narrowspec |
|
100 | 100 | |
|
101 | 101 | options ([+] can be repeated): |
|
102 | 102 | |
|
103 | 103 | --addinclude VALUE [+] new paths to include |
|
104 | 104 | --removeinclude VALUE [+] old paths to no longer include |
|
105 | 105 | --auto-remove-includes automatically choose unused includes to |
|
106 | 106 | remove |
|
107 | 107 | --addexclude VALUE [+] new paths to exclude |
|
108 | 108 | --import-rules VALUE import narrowspecs from a file |
|
109 | 109 | --removeexclude VALUE [+] old paths to no longer exclude |
|
110 | 110 | --clear whether to replace the existing narrowspec |
|
111 | 111 | --force-delete-local-changes forces deletion of local changes when |
|
112 | 112 | narrowing |
|
113 | 113 | --update-working-copy update working copy when the store has |
|
114 | 114 | changed |
|
115 | 115 | -e --ssh CMD specify ssh command to use |
|
116 | 116 | --remotecmd CMD specify hg command to run on the remote side |
|
117 | 117 | --insecure do not verify server certificate (ignoring |
|
118 | 118 | web.cacerts config) |
|
119 | 119 | |
|
120 | 120 | (use 'hg tracked -h' to show more help) |
|
121 |
[ |
|
|
121 | [10] | |
|
122 | 122 | $ hg tracked --import-rules doesnotexist |
|
123 | 123 | abort: cannot read narrowspecs from '$TESTTMP/narrow/doesnotexist': $ENOENT$ |
|
124 | 124 | [50] |
|
125 | 125 | |
|
126 | 126 | $ cat > specs <<EOF |
|
127 | 127 | > %include foo |
|
128 | 128 | > [include] |
|
129 | 129 | > path:widest/ |
|
130 | 130 | > [exclude] |
|
131 | 131 | > path:inside/ |
|
132 | 132 | > EOF |
|
133 | 133 | |
|
134 | 134 | $ hg tracked --import-rules specs |
|
135 | 135 | abort: including other spec files using '%include' is not supported in narrowspec |
|
136 | 136 | [10] |
|
137 | 137 | |
|
138 | 138 | $ cat > specs <<EOF |
|
139 | 139 | > [include] |
|
140 | 140 | > outisde |
|
141 | 141 | > [exclude] |
|
142 | 142 | > inside |
|
143 | 143 | > EOF |
|
144 | 144 | |
|
145 | 145 | $ hg tracked --import-rules specs |
|
146 | 146 | comparing with ssh://user@dummy/master |
|
147 | 147 | searching for changes |
|
148 | 148 | looking for local changes to affected paths |
|
149 | 149 | deleting data/inside/f.i |
|
150 | 150 | deleting meta/inside/00manifest.i (tree !) |
|
151 | 151 | saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-widen.hg (glob) |
|
152 | 152 | adding changesets |
|
153 | 153 | adding manifests |
|
154 | 154 | adding file changes |
|
155 | 155 | added 2 changesets with 0 changes to 0 files |
|
156 | 156 | $ hg tracked |
|
157 | 157 | I path:outisde |
|
158 | 158 | X path:inside |
|
159 | 159 | |
|
160 | 160 | Testing the --import-rules flag with --addinclude and --addexclude |
|
161 | 161 | |
|
162 | 162 | $ cat > specs <<EOF |
|
163 | 163 | > [include] |
|
164 | 164 | > widest |
|
165 | 165 | > EOF |
|
166 | 166 | |
|
167 | 167 | $ hg tracked --import-rules specs --addinclude 'wider/' |
|
168 | 168 | comparing with ssh://user@dummy/master |
|
169 | 169 | searching for changes |
|
170 | 170 | saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-widen.hg (glob) |
|
171 | 171 | adding changesets |
|
172 | 172 | adding manifests |
|
173 | 173 | adding file changes |
|
174 | 174 | added 3 changesets with 1 changes to 1 files |
|
175 | 175 | $ hg tracked |
|
176 | 176 | I path:outisde |
|
177 | 177 | I path:wider |
|
178 | 178 | I path:widest |
|
179 | 179 | X path:inside |
|
180 | 180 | |
|
181 | 181 | $ cat > specs <<EOF |
|
182 | 182 | > [exclude] |
|
183 | 183 | > outside2 |
|
184 | 184 | > EOF |
|
185 | 185 | |
|
186 | 186 | $ hg tracked --import-rules specs --addexclude 'widest' |
|
187 | 187 | comparing with ssh://user@dummy/master |
|
188 | 188 | searching for changes |
|
189 | 189 | looking for local changes to affected paths |
|
190 | 190 | deleting data/widest/f.i |
|
191 | 191 | deleting meta/widest/00manifest.i (tree !) |
|
192 | 192 | $ hg tracked |
|
193 | 193 | I path:outisde |
|
194 | 194 | I path:wider |
|
195 | 195 | X path:inside |
|
196 | 196 | X path:outside2 |
|
197 | 197 | X path:widest |
|
198 | 198 | |
|
199 | 199 | $ hg tracked --import-rules specs --clear |
|
200 | 200 | abort: the --clear option is not yet supported |
|
201 | 201 | [10] |
|
202 | 202 | |
|
203 | 203 | Testing with passing a out of wdir file |
|
204 | 204 | |
|
205 | 205 | $ cat > ../nspecs <<EOF |
|
206 | 206 | > [include] |
|
207 | 207 | > widest |
|
208 | 208 | > EOF |
|
209 | 209 | |
|
210 | 210 | $ hg tracked --import-rules ../nspecs |
|
211 | 211 | comparing with ssh://user@dummy/master |
|
212 | 212 | searching for changes |
|
213 | 213 | saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-widen.hg (glob) |
|
214 | 214 | adding changesets |
|
215 | 215 | adding manifests |
|
216 | 216 | adding file changes |
|
217 | 217 | added 3 changesets with 0 changes to 0 files |
|
218 | 218 | |
|
219 | 219 | $ cd .. |
|
220 | 220 | |
|
221 | 221 | Testing tracked command on a non-narrow repo |
|
222 | 222 | |
|
223 | 223 | $ hg init non-narrow |
|
224 | 224 | $ cd non-narrow |
|
225 | 225 | $ hg tracked --addinclude foobar |
|
226 | 226 | abort: the tracked command is only supported on repositories cloned with --narrow |
|
227 | 227 | [10] |
@@ -1,473 +1,473 b'' | |||
|
1 | 1 | Create configuration |
|
2 | 2 | |
|
3 | 3 | $ echo "[ui]" >> $HGRCPATH |
|
4 | 4 | $ echo "interactive=true" >> $HGRCPATH |
|
5 | 5 | |
|
6 | 6 | help record (no record) |
|
7 | 7 | |
|
8 | 8 | $ hg help record |
|
9 | 9 | record extension - commands to interactively select changes for |
|
10 | 10 | commit/qrefresh (DEPRECATED) |
|
11 | 11 | |
|
12 | 12 | The feature provided by this extension has been moved into core Mercurial as |
|
13 | 13 | 'hg commit --interactive'. |
|
14 | 14 | |
|
15 | 15 | (use 'hg help extensions' for information on enabling extensions) |
|
16 | 16 | |
|
17 | 17 | help qrecord (no record) |
|
18 | 18 | |
|
19 | 19 | $ hg help qrecord |
|
20 | 20 | 'qrecord' is provided by the following extension: |
|
21 | 21 | |
|
22 | 22 | record commands to interactively select changes for commit/qrefresh |
|
23 | 23 | (DEPRECATED) |
|
24 | 24 | |
|
25 | 25 | (use 'hg help extensions' for information on enabling extensions) |
|
26 | 26 | |
|
27 | 27 | $ echo "[extensions]" >> $HGRCPATH |
|
28 | 28 | $ echo "record=" >> $HGRCPATH |
|
29 | 29 | |
|
30 | 30 | help record (record) |
|
31 | 31 | |
|
32 | 32 | $ hg help record |
|
33 | 33 | hg record [OPTION]... [FILE]... |
|
34 | 34 | |
|
35 | 35 | interactively select changes to commit |
|
36 | 36 | |
|
37 | 37 | If a list of files is omitted, all changes reported by 'hg status' will be |
|
38 | 38 | candidates for recording. |
|
39 | 39 | |
|
40 | 40 | See 'hg help dates' for a list of formats valid for -d/--date. |
|
41 | 41 | |
|
42 | 42 | If using the text interface (see 'hg help config'), you will be prompted |
|
43 | 43 | for whether to record changes to each modified file, and for files with |
|
44 | 44 | multiple changes, for each change to use. For each query, the following |
|
45 | 45 | responses are possible: |
|
46 | 46 | |
|
47 | 47 | y - record this change |
|
48 | 48 | n - skip this change |
|
49 | 49 | e - edit this change manually |
|
50 | 50 | |
|
51 | 51 | s - skip remaining changes to this file |
|
52 | 52 | f - record remaining changes to this file |
|
53 | 53 | |
|
54 | 54 | d - done, skip remaining changes and files |
|
55 | 55 | a - record all changes to all remaining files |
|
56 | 56 | q - quit, recording no changes |
|
57 | 57 | |
|
58 | 58 | ? - display help |
|
59 | 59 | |
|
60 | 60 | This command is not available when committing a merge. |
|
61 | 61 | |
|
62 | 62 | (use 'hg help -e record' to show help for the record extension) |
|
63 | 63 | |
|
64 | 64 | options ([+] can be repeated): |
|
65 | 65 | |
|
66 | 66 | -A --addremove mark new/missing files as added/removed before |
|
67 | 67 | committing |
|
68 | 68 | --close-branch mark a branch head as closed |
|
69 | 69 | --amend amend the parent of the working directory |
|
70 | 70 | -s --secret use the secret phase for committing |
|
71 | 71 | -e --edit invoke editor on commit messages |
|
72 | 72 | -I --include PATTERN [+] include names matching the given patterns |
|
73 | 73 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
74 | 74 | -m --message TEXT use text as commit message |
|
75 | 75 | -l --logfile FILE read commit message from file |
|
76 | 76 | -d --date DATE record the specified date as commit date |
|
77 | 77 | -u --user USER record the specified user as committer |
|
78 | 78 | -S --subrepos recurse into subrepositories |
|
79 | 79 | -w --ignore-all-space ignore white space when comparing lines |
|
80 | 80 | -b --ignore-space-change ignore changes in the amount of white space |
|
81 | 81 | -B --ignore-blank-lines ignore changes whose lines are all blank |
|
82 | 82 | -Z --ignore-space-at-eol ignore changes in whitespace at EOL |
|
83 | 83 | |
|
84 | 84 | (some details hidden, use --verbose to show complete help) |
|
85 | 85 | |
|
86 | 86 | help (no mq, so no qrecord) |
|
87 | 87 | |
|
88 | 88 | $ hg help qrecord |
|
89 | 89 | hg qrecord [OPTION]... PATCH [FILE]... |
|
90 | 90 | |
|
91 | 91 | interactively record a new patch |
|
92 | 92 | |
|
93 | 93 | See 'hg help qnew' & 'hg help record' for more information and usage. |
|
94 | 94 | |
|
95 | 95 | (some details hidden, use --verbose to show complete help) |
|
96 | 96 | |
|
97 | 97 | $ hg init a |
|
98 | 98 | |
|
99 | 99 | qrecord (mq not present) |
|
100 | 100 | |
|
101 | 101 | $ hg -R a qrecord |
|
102 | 102 | hg qrecord: invalid arguments |
|
103 | 103 | hg qrecord [OPTION]... PATCH [FILE]... |
|
104 | 104 | |
|
105 | 105 | interactively record a new patch |
|
106 | 106 | |
|
107 | 107 | (use 'hg qrecord -h' to show more help) |
|
108 |
[ |
|
|
108 | [10] | |
|
109 | 109 | |
|
110 | 110 | qrecord patch (mq not present) |
|
111 | 111 | |
|
112 | 112 | $ hg -R a qrecord patch |
|
113 | 113 | abort: 'mq' extension not loaded |
|
114 | 114 | [255] |
|
115 | 115 | |
|
116 | 116 | help (bad mq) |
|
117 | 117 | |
|
118 | 118 | $ echo "mq=nonexistent" >> $HGRCPATH |
|
119 | 119 | $ hg help qrecord |
|
120 | 120 | *** failed to import extension mq from nonexistent: [Errno *] * (glob) |
|
121 | 121 | hg qrecord [OPTION]... PATCH [FILE]... |
|
122 | 122 | |
|
123 | 123 | interactively record a new patch |
|
124 | 124 | |
|
125 | 125 | See 'hg help qnew' & 'hg help record' for more information and usage. |
|
126 | 126 | |
|
127 | 127 | (some details hidden, use --verbose to show complete help) |
|
128 | 128 | |
|
129 | 129 | help (mq present) |
|
130 | 130 | |
|
131 | 131 | $ sed 's/mq=nonexistent/mq=/' $HGRCPATH > hgrc.tmp |
|
132 | 132 | $ mv hgrc.tmp $HGRCPATH |
|
133 | 133 | |
|
134 | 134 | $ hg help qrecord |
|
135 | 135 | hg qrecord [OPTION]... PATCH [FILE]... |
|
136 | 136 | |
|
137 | 137 | interactively record a new patch |
|
138 | 138 | |
|
139 | 139 | See 'hg help qnew' & 'hg help record' for more information and usage. |
|
140 | 140 | |
|
141 | 141 | options ([+] can be repeated): |
|
142 | 142 | |
|
143 | 143 | -e --edit invoke editor on commit messages |
|
144 | 144 | -g --git use git extended diff format |
|
145 | 145 | -U --currentuser add "From: <current user>" to patch |
|
146 | 146 | -u --user USER add "From: <USER>" to patch |
|
147 | 147 | -D --currentdate add "Date: <current date>" to patch |
|
148 | 148 | -d --date DATE add "Date: <DATE>" to patch |
|
149 | 149 | -I --include PATTERN [+] include names matching the given patterns |
|
150 | 150 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
151 | 151 | -m --message TEXT use text as commit message |
|
152 | 152 | -l --logfile FILE read commit message from file |
|
153 | 153 | -w --ignore-all-space ignore white space when comparing lines |
|
154 | 154 | -b --ignore-space-change ignore changes in the amount of white space |
|
155 | 155 | -B --ignore-blank-lines ignore changes whose lines are all blank |
|
156 | 156 | -Z --ignore-space-at-eol ignore changes in whitespace at EOL |
|
157 | 157 | --mq operate on patch repository |
|
158 | 158 | |
|
159 | 159 | (some details hidden, use --verbose to show complete help) |
|
160 | 160 | |
|
161 | 161 | $ cd a |
|
162 | 162 | |
|
163 | 163 | Base commit |
|
164 | 164 | |
|
165 | 165 | $ cat > 1.txt <<EOF |
|
166 | 166 | > 1 |
|
167 | 167 | > 2 |
|
168 | 168 | > 3 |
|
169 | 169 | > 4 |
|
170 | 170 | > 5 |
|
171 | 171 | > EOF |
|
172 | 172 | $ cat > 2.txt <<EOF |
|
173 | 173 | > a |
|
174 | 174 | > b |
|
175 | 175 | > c |
|
176 | 176 | > d |
|
177 | 177 | > e |
|
178 | 178 | > f |
|
179 | 179 | > EOF |
|
180 | 180 | |
|
181 | 181 | $ mkdir dir |
|
182 | 182 | $ cat > dir/a.txt <<EOF |
|
183 | 183 | > hello world |
|
184 | 184 | > |
|
185 | 185 | > someone |
|
186 | 186 | > up |
|
187 | 187 | > there |
|
188 | 188 | > loves |
|
189 | 189 | > me |
|
190 | 190 | > EOF |
|
191 | 191 | |
|
192 | 192 | $ hg add 1.txt 2.txt dir/a.txt |
|
193 | 193 | $ hg commit -m 'initial checkin' |
|
194 | 194 | |
|
195 | 195 | Changing files |
|
196 | 196 | |
|
197 | 197 | $ sed -e 's/2/2 2/;s/4/4 4/' 1.txt > 1.txt.new |
|
198 | 198 | $ sed -e 's/b/b b/' 2.txt > 2.txt.new |
|
199 | 199 | $ sed -e 's/hello world/hello world!/' dir/a.txt > dir/a.txt.new |
|
200 | 200 | |
|
201 | 201 | $ mv -f 1.txt.new 1.txt |
|
202 | 202 | $ mv -f 2.txt.new 2.txt |
|
203 | 203 | $ mv -f dir/a.txt.new dir/a.txt |
|
204 | 204 | |
|
205 | 205 | Whole diff |
|
206 | 206 | |
|
207 | 207 | $ hg diff --nodates |
|
208 | 208 | diff -r 1057167b20ef 1.txt |
|
209 | 209 | --- a/1.txt |
|
210 | 210 | +++ b/1.txt |
|
211 | 211 | @@ -1,5 +1,5 @@ |
|
212 | 212 | 1 |
|
213 | 213 | -2 |
|
214 | 214 | +2 2 |
|
215 | 215 | 3 |
|
216 | 216 | -4 |
|
217 | 217 | +4 4 |
|
218 | 218 | 5 |
|
219 | 219 | diff -r 1057167b20ef 2.txt |
|
220 | 220 | --- a/2.txt |
|
221 | 221 | +++ b/2.txt |
|
222 | 222 | @@ -1,5 +1,5 @@ |
|
223 | 223 | a |
|
224 | 224 | -b |
|
225 | 225 | +b b |
|
226 | 226 | c |
|
227 | 227 | d |
|
228 | 228 | e |
|
229 | 229 | diff -r 1057167b20ef dir/a.txt |
|
230 | 230 | --- a/dir/a.txt |
|
231 | 231 | +++ b/dir/a.txt |
|
232 | 232 | @@ -1,4 +1,4 @@ |
|
233 | 233 | -hello world |
|
234 | 234 | +hello world! |
|
235 | 235 | |
|
236 | 236 | someone |
|
237 | 237 | up |
|
238 | 238 | |
|
239 | 239 | qrecord with bad patch name, should abort before prompting |
|
240 | 240 | |
|
241 | 241 | $ hg qrecord .hg |
|
242 | 242 | abort: patch name cannot begin with ".hg" |
|
243 | 243 | [255] |
|
244 | 244 | $ hg qrecord ' foo' |
|
245 | 245 | abort: patch name cannot begin or end with whitespace |
|
246 | 246 | [255] |
|
247 | 247 | $ hg qrecord 'foo ' |
|
248 | 248 | abort: patch name cannot begin or end with whitespace |
|
249 | 249 | [255] |
|
250 | 250 | |
|
251 | 251 | qrecord a.patch |
|
252 | 252 | |
|
253 | 253 | $ hg qrecord -d '0 0' -m aaa a.patch <<EOF |
|
254 | 254 | > y |
|
255 | 255 | > y |
|
256 | 256 | > n |
|
257 | 257 | > y |
|
258 | 258 | > y |
|
259 | 259 | > n |
|
260 | 260 | > EOF |
|
261 | 261 | diff --git a/1.txt b/1.txt |
|
262 | 262 | 2 hunks, 2 lines changed |
|
263 | 263 | examine changes to '1.txt'? |
|
264 | 264 | (enter ? for help) [Ynesfdaq?] y |
|
265 | 265 | |
|
266 | 266 | @@ -1,3 +1,3 @@ |
|
267 | 267 | 1 |
|
268 | 268 | -2 |
|
269 | 269 | +2 2 |
|
270 | 270 | 3 |
|
271 | 271 | record change 1/4 to '1.txt'? |
|
272 | 272 | (enter ? for help) [Ynesfdaq?] y |
|
273 | 273 | |
|
274 | 274 | @@ -3,3 +3,3 @@ |
|
275 | 275 | 3 |
|
276 | 276 | -4 |
|
277 | 277 | +4 4 |
|
278 | 278 | 5 |
|
279 | 279 | record change 2/4 to '1.txt'? |
|
280 | 280 | (enter ? for help) [Ynesfdaq?] n |
|
281 | 281 | |
|
282 | 282 | diff --git a/2.txt b/2.txt |
|
283 | 283 | 1 hunks, 1 lines changed |
|
284 | 284 | examine changes to '2.txt'? |
|
285 | 285 | (enter ? for help) [Ynesfdaq?] y |
|
286 | 286 | |
|
287 | 287 | @@ -1,5 +1,5 @@ |
|
288 | 288 | a |
|
289 | 289 | -b |
|
290 | 290 | +b b |
|
291 | 291 | c |
|
292 | 292 | d |
|
293 | 293 | e |
|
294 | 294 | record change 3/4 to '2.txt'? |
|
295 | 295 | (enter ? for help) [Ynesfdaq?] y |
|
296 | 296 | |
|
297 | 297 | diff --git a/dir/a.txt b/dir/a.txt |
|
298 | 298 | 1 hunks, 1 lines changed |
|
299 | 299 | examine changes to 'dir/a.txt'? |
|
300 | 300 | (enter ? for help) [Ynesfdaq?] n |
|
301 | 301 | |
|
302 | 302 | |
|
303 | 303 | After qrecord a.patch 'tip'" |
|
304 | 304 | |
|
305 | 305 | $ hg tip -p |
|
306 | 306 | changeset: 1:5d1ca63427ee |
|
307 | 307 | tag: a.patch |
|
308 | 308 | tag: qbase |
|
309 | 309 | tag: qtip |
|
310 | 310 | tag: tip |
|
311 | 311 | user: test |
|
312 | 312 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
313 | 313 | summary: aaa |
|
314 | 314 | |
|
315 | 315 | diff -r 1057167b20ef -r 5d1ca63427ee 1.txt |
|
316 | 316 | --- a/1.txt Thu Jan 01 00:00:00 1970 +0000 |
|
317 | 317 | +++ b/1.txt Thu Jan 01 00:00:00 1970 +0000 |
|
318 | 318 | @@ -1,5 +1,5 @@ |
|
319 | 319 | 1 |
|
320 | 320 | -2 |
|
321 | 321 | +2 2 |
|
322 | 322 | 3 |
|
323 | 323 | 4 |
|
324 | 324 | 5 |
|
325 | 325 | diff -r 1057167b20ef -r 5d1ca63427ee 2.txt |
|
326 | 326 | --- a/2.txt Thu Jan 01 00:00:00 1970 +0000 |
|
327 | 327 | +++ b/2.txt Thu Jan 01 00:00:00 1970 +0000 |
|
328 | 328 | @@ -1,5 +1,5 @@ |
|
329 | 329 | a |
|
330 | 330 | -b |
|
331 | 331 | +b b |
|
332 | 332 | c |
|
333 | 333 | d |
|
334 | 334 | e |
|
335 | 335 | |
|
336 | 336 | |
|
337 | 337 | After qrecord a.patch 'diff'" |
|
338 | 338 | |
|
339 | 339 | $ hg diff --nodates |
|
340 | 340 | diff -r 5d1ca63427ee 1.txt |
|
341 | 341 | --- a/1.txt |
|
342 | 342 | +++ b/1.txt |
|
343 | 343 | @@ -1,5 +1,5 @@ |
|
344 | 344 | 1 |
|
345 | 345 | 2 2 |
|
346 | 346 | 3 |
|
347 | 347 | -4 |
|
348 | 348 | +4 4 |
|
349 | 349 | 5 |
|
350 | 350 | diff -r 5d1ca63427ee dir/a.txt |
|
351 | 351 | --- a/dir/a.txt |
|
352 | 352 | +++ b/dir/a.txt |
|
353 | 353 | @@ -1,4 +1,4 @@ |
|
354 | 354 | -hello world |
|
355 | 355 | +hello world! |
|
356 | 356 | |
|
357 | 357 | someone |
|
358 | 358 | up |
|
359 | 359 | |
|
360 | 360 | qrecord b.patch |
|
361 | 361 | |
|
362 | 362 | $ hg qrecord -d '0 0' -m bbb b.patch <<EOF |
|
363 | 363 | > y |
|
364 | 364 | > y |
|
365 | 365 | > y |
|
366 | 366 | > y |
|
367 | 367 | > EOF |
|
368 | 368 | diff --git a/1.txt b/1.txt |
|
369 | 369 | 1 hunks, 1 lines changed |
|
370 | 370 | examine changes to '1.txt'? |
|
371 | 371 | (enter ? for help) [Ynesfdaq?] y |
|
372 | 372 | |
|
373 | 373 | @@ -1,5 +1,5 @@ |
|
374 | 374 | 1 |
|
375 | 375 | 2 2 |
|
376 | 376 | 3 |
|
377 | 377 | -4 |
|
378 | 378 | +4 4 |
|
379 | 379 | 5 |
|
380 | 380 | record change 1/2 to '1.txt'? |
|
381 | 381 | (enter ? for help) [Ynesfdaq?] y |
|
382 | 382 | |
|
383 | 383 | diff --git a/dir/a.txt b/dir/a.txt |
|
384 | 384 | 1 hunks, 1 lines changed |
|
385 | 385 | examine changes to 'dir/a.txt'? |
|
386 | 386 | (enter ? for help) [Ynesfdaq?] y |
|
387 | 387 | |
|
388 | 388 | @@ -1,4 +1,4 @@ |
|
389 | 389 | -hello world |
|
390 | 390 | +hello world! |
|
391 | 391 | |
|
392 | 392 | someone |
|
393 | 393 | up |
|
394 | 394 | record change 2/2 to 'dir/a.txt'? |
|
395 | 395 | (enter ? for help) [Ynesfdaq?] y |
|
396 | 396 | |
|
397 | 397 | |
|
398 | 398 | After qrecord b.patch 'tip' |
|
399 | 399 | |
|
400 | 400 | $ hg tip -p |
|
401 | 401 | changeset: 2:b056198bf878 |
|
402 | 402 | tag: b.patch |
|
403 | 403 | tag: qtip |
|
404 | 404 | tag: tip |
|
405 | 405 | user: test |
|
406 | 406 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
407 | 407 | summary: bbb |
|
408 | 408 | |
|
409 | 409 | diff -r 5d1ca63427ee -r b056198bf878 1.txt |
|
410 | 410 | --- a/1.txt Thu Jan 01 00:00:00 1970 +0000 |
|
411 | 411 | +++ b/1.txt Thu Jan 01 00:00:00 1970 +0000 |
|
412 | 412 | @@ -1,5 +1,5 @@ |
|
413 | 413 | 1 |
|
414 | 414 | 2 2 |
|
415 | 415 | 3 |
|
416 | 416 | -4 |
|
417 | 417 | +4 4 |
|
418 | 418 | 5 |
|
419 | 419 | diff -r 5d1ca63427ee -r b056198bf878 dir/a.txt |
|
420 | 420 | --- a/dir/a.txt Thu Jan 01 00:00:00 1970 +0000 |
|
421 | 421 | +++ b/dir/a.txt Thu Jan 01 00:00:00 1970 +0000 |
|
422 | 422 | @@ -1,4 +1,4 @@ |
|
423 | 423 | -hello world |
|
424 | 424 | +hello world! |
|
425 | 425 | |
|
426 | 426 | someone |
|
427 | 427 | up |
|
428 | 428 | |
|
429 | 429 | |
|
430 | 430 | After qrecord b.patch 'diff' |
|
431 | 431 | |
|
432 | 432 | $ hg diff --nodates |
|
433 | 433 | |
|
434 | 434 | $ cd .. |
|
435 | 435 | |
|
436 | 436 | qrecord should throw an error when histedit in process |
|
437 | 437 | |
|
438 | 438 | $ hg init issue5981 |
|
439 | 439 | $ cd issue5981 |
|
440 | 440 | $ cat >> $HGRCPATH <<EOF |
|
441 | 441 | > [extensions] |
|
442 | 442 | > histedit= |
|
443 | 443 | > mq= |
|
444 | 444 | > EOF |
|
445 | 445 | $ echo > a |
|
446 | 446 | $ hg ci -Am 'foo bar' |
|
447 | 447 | adding a |
|
448 | 448 | $ hg log |
|
449 | 449 | changeset: 0:ea55e2ae468f |
|
450 | 450 | tag: tip |
|
451 | 451 | user: test |
|
452 | 452 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
453 | 453 | summary: foo bar |
|
454 | 454 | |
|
455 | 455 | $ hg histedit tip --commands - 2>&1 <<EOF |
|
456 | 456 | > edit ea55e2ae468f foo bar |
|
457 | 457 | > EOF |
|
458 | 458 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
459 | 459 | Editing (ea55e2ae468f), commit as needed now to split the change |
|
460 | 460 | (to edit ea55e2ae468f, `hg histedit --continue` after making changes) |
|
461 | 461 | [240] |
|
462 | 462 | $ echo 'foo bar' > a |
|
463 | 463 | $ hg qrecord -d '0 0' -m aaa a.patch <<EOF |
|
464 | 464 | > y |
|
465 | 465 | > y |
|
466 | 466 | > n |
|
467 | 467 | > y |
|
468 | 468 | > y |
|
469 | 469 | > n |
|
470 | 470 | > EOF |
|
471 | 471 | abort: histedit in progress |
|
472 | 472 | (use 'hg histedit --continue' or 'hg histedit --abort') |
|
473 | 473 | [20] |
@@ -1,579 +1,579 b'' | |||
|
1 | 1 | setup |
|
2 | 2 | |
|
3 | 3 | $ cat >> $HGRCPATH <<EOF |
|
4 | 4 | > [extensions] |
|
5 | 5 | > share = |
|
6 | 6 | > [format] |
|
7 | 7 | > exp-share-safe = True |
|
8 | 8 | > EOF |
|
9 | 9 | |
|
10 | 10 | prepare source repo |
|
11 | 11 | |
|
12 | 12 | $ hg init source |
|
13 | 13 | $ cd source |
|
14 | 14 | $ cat .hg/requires |
|
15 | 15 | exp-sharesafe |
|
16 | 16 | $ cat .hg/store/requires |
|
17 | 17 | dotencode |
|
18 | 18 | fncache |
|
19 | 19 | generaldelta |
|
20 | 20 | revlogv1 |
|
21 | 21 | sparserevlog |
|
22 | 22 | store |
|
23 | 23 | $ hg debugrequirements |
|
24 | 24 | dotencode |
|
25 | 25 | exp-sharesafe |
|
26 | 26 | fncache |
|
27 | 27 | generaldelta |
|
28 | 28 | revlogv1 |
|
29 | 29 | sparserevlog |
|
30 | 30 | store |
|
31 | 31 | |
|
32 | 32 | $ echo a > a |
|
33 | 33 | $ hg ci -Aqm "added a" |
|
34 | 34 | $ echo b > b |
|
35 | 35 | $ hg ci -Aqm "added b" |
|
36 | 36 | |
|
37 | 37 | $ HGEDITOR=cat hg config --shared |
|
38 | 38 | abort: repository is not shared; can't use --shared |
|
39 | 39 | [10] |
|
40 | 40 | $ cd .. |
|
41 | 41 | |
|
42 | 42 | Create a shared repo and check the requirements are shared and read correctly |
|
43 | 43 | $ hg share source shared1 |
|
44 | 44 | updating working directory |
|
45 | 45 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
46 | 46 | $ cd shared1 |
|
47 | 47 | $ cat .hg/requires |
|
48 | 48 | exp-sharesafe |
|
49 | 49 | shared |
|
50 | 50 | |
|
51 | 51 | $ hg debugrequirements -R ../source |
|
52 | 52 | dotencode |
|
53 | 53 | exp-sharesafe |
|
54 | 54 | fncache |
|
55 | 55 | generaldelta |
|
56 | 56 | revlogv1 |
|
57 | 57 | sparserevlog |
|
58 | 58 | store |
|
59 | 59 | |
|
60 | 60 | $ hg debugrequirements |
|
61 | 61 | dotencode |
|
62 | 62 | exp-sharesafe |
|
63 | 63 | fncache |
|
64 | 64 | generaldelta |
|
65 | 65 | revlogv1 |
|
66 | 66 | shared |
|
67 | 67 | sparserevlog |
|
68 | 68 | store |
|
69 | 69 | |
|
70 | 70 | $ echo c > c |
|
71 | 71 | $ hg ci -Aqm "added c" |
|
72 | 72 | |
|
73 | 73 | Check that config of the source repository is also loaded |
|
74 | 74 | |
|
75 | 75 | $ hg showconfig ui.curses |
|
76 | 76 | [1] |
|
77 | 77 | |
|
78 | 78 | $ echo "[ui]" >> ../source/.hg/hgrc |
|
79 | 79 | $ echo "curses=true" >> ../source/.hg/hgrc |
|
80 | 80 | |
|
81 | 81 | $ hg showconfig ui.curses |
|
82 | 82 | true |
|
83 | 83 | |
|
84 | 84 | Test that extensions of source repository are also loaded |
|
85 | 85 | |
|
86 | 86 | $ hg debugextensions |
|
87 | 87 | share |
|
88 | 88 | $ hg extdiff -p echo |
|
89 | 89 | hg: unknown command 'extdiff' |
|
90 | 90 | 'extdiff' is provided by the following extension: |
|
91 | 91 | |
|
92 | 92 | extdiff command to allow external programs to compare revisions |
|
93 | 93 | |
|
94 | 94 | (use 'hg help extensions' for information on enabling extensions) |
|
95 |
[ |
|
|
95 | [10] | |
|
96 | 96 | |
|
97 | 97 | $ echo "[extensions]" >> ../source/.hg/hgrc |
|
98 | 98 | $ echo "extdiff=" >> ../source/.hg/hgrc |
|
99 | 99 | |
|
100 | 100 | $ hg debugextensions -R ../source |
|
101 | 101 | extdiff |
|
102 | 102 | share |
|
103 | 103 | $ hg extdiff -R ../source -p echo |
|
104 | 104 | |
|
105 | 105 | BROKEN: the command below will not work if config of shared source is not loaded |
|
106 | 106 | on dispatch but debugextensions says that extension |
|
107 | 107 | is loaded |
|
108 | 108 | $ hg debugextensions |
|
109 | 109 | extdiff |
|
110 | 110 | share |
|
111 | 111 | |
|
112 | 112 | $ hg extdiff -p echo |
|
113 | 113 | |
|
114 | 114 | However, local .hg/hgrc should override the config set by share source |
|
115 | 115 | |
|
116 | 116 | $ echo "[ui]" >> .hg/hgrc |
|
117 | 117 | $ echo "curses=false" >> .hg/hgrc |
|
118 | 118 | |
|
119 | 119 | $ hg showconfig ui.curses |
|
120 | 120 | false |
|
121 | 121 | |
|
122 | 122 | $ HGEDITOR=cat hg config --shared |
|
123 | 123 | [ui] |
|
124 | 124 | curses=true |
|
125 | 125 | [extensions] |
|
126 | 126 | extdiff= |
|
127 | 127 | |
|
128 | 128 | $ HGEDITOR=cat hg config --local |
|
129 | 129 | [ui] |
|
130 | 130 | curses=false |
|
131 | 131 | |
|
132 | 132 | Testing that hooks set in source repository also runs in shared repo |
|
133 | 133 | |
|
134 | 134 | $ cd ../source |
|
135 | 135 | $ cat <<EOF >> .hg/hgrc |
|
136 | 136 | > [extensions] |
|
137 | 137 | > hooklib= |
|
138 | 138 | > [hooks] |
|
139 | 139 | > pretxnchangegroup.reject_merge_commits = \ |
|
140 | 140 | > python:hgext.hooklib.reject_merge_commits.hook |
|
141 | 141 | > EOF |
|
142 | 142 | |
|
143 | 143 | $ cd .. |
|
144 | 144 | $ hg clone source cloned |
|
145 | 145 | updating to branch default |
|
146 | 146 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
147 | 147 | $ cd cloned |
|
148 | 148 | $ hg up 0 |
|
149 | 149 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
150 | 150 | $ echo bar > bar |
|
151 | 151 | $ hg ci -Aqm "added bar" |
|
152 | 152 | $ hg merge |
|
153 | 153 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
154 | 154 | (branch merge, don't forget to commit) |
|
155 | 155 | $ hg ci -m "merge commit" |
|
156 | 156 | |
|
157 | 157 | $ hg push ../source |
|
158 | 158 | pushing to ../source |
|
159 | 159 | searching for changes |
|
160 | 160 | adding changesets |
|
161 | 161 | adding manifests |
|
162 | 162 | adding file changes |
|
163 | 163 | error: pretxnchangegroup.reject_merge_commits hook failed: bcde3522682d rejected as merge on the same branch. Please consider rebase. |
|
164 | 164 | transaction abort! |
|
165 | 165 | rollback completed |
|
166 | 166 | abort: bcde3522682d rejected as merge on the same branch. Please consider rebase. |
|
167 | 167 | [255] |
|
168 | 168 | |
|
169 | 169 | $ hg push ../shared1 |
|
170 | 170 | pushing to ../shared1 |
|
171 | 171 | searching for changes |
|
172 | 172 | adding changesets |
|
173 | 173 | adding manifests |
|
174 | 174 | adding file changes |
|
175 | 175 | error: pretxnchangegroup.reject_merge_commits hook failed: bcde3522682d rejected as merge on the same branch. Please consider rebase. |
|
176 | 176 | transaction abort! |
|
177 | 177 | rollback completed |
|
178 | 178 | abort: bcde3522682d rejected as merge on the same branch. Please consider rebase. |
|
179 | 179 | [255] |
|
180 | 180 | |
|
181 | 181 | Test that if share source config is untrusted, we dont read it |
|
182 | 182 | |
|
183 | 183 | $ cd ../shared1 |
|
184 | 184 | |
|
185 | 185 | $ cat << EOF > $TESTTMP/untrusted.py |
|
186 | 186 | > from mercurial import scmutil, util |
|
187 | 187 | > def uisetup(ui): |
|
188 | 188 | > class untrustedui(ui.__class__): |
|
189 | 189 | > def _trusted(self, fp, f): |
|
190 | 190 | > if util.normpath(fp.name).endswith(b'source/.hg/hgrc'): |
|
191 | 191 | > return False |
|
192 | 192 | > return super(untrustedui, self)._trusted(fp, f) |
|
193 | 193 | > ui.__class__ = untrustedui |
|
194 | 194 | > EOF |
|
195 | 195 | |
|
196 | 196 | $ hg showconfig hooks |
|
197 | 197 | hooks.pretxnchangegroup.reject_merge_commits=python:hgext.hooklib.reject_merge_commits.hook |
|
198 | 198 | |
|
199 | 199 | $ hg showconfig hooks --config extensions.untrusted=$TESTTMP/untrusted.py |
|
200 | 200 | [1] |
|
201 | 201 | |
|
202 | 202 | Update the source repository format and check that shared repo works |
|
203 | 203 | |
|
204 | 204 | $ cd ../source |
|
205 | 205 | |
|
206 | 206 | Disable zstd related tests because its not present on pure version |
|
207 | 207 | #if zstd |
|
208 | 208 | $ echo "[format]" >> .hg/hgrc |
|
209 | 209 | $ echo "revlog-compression=zstd" >> .hg/hgrc |
|
210 | 210 | |
|
211 | 211 | $ hg debugupgraderepo --run -q |
|
212 | 212 | upgrade will perform the following actions: |
|
213 | 213 | |
|
214 | 214 | requirements |
|
215 | 215 | preserved: dotencode, exp-sharesafe, fncache, generaldelta, revlogv1, sparserevlog, store |
|
216 | 216 | added: revlog-compression-zstd |
|
217 | 217 | |
|
218 | 218 | processed revlogs: |
|
219 | 219 | - all-filelogs |
|
220 | 220 | - changelog |
|
221 | 221 | - manifest |
|
222 | 222 | |
|
223 | 223 | $ hg log -r . |
|
224 | 224 | changeset: 1:5f6d8a4bf34a |
|
225 | 225 | user: test |
|
226 | 226 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
227 | 227 | summary: added b |
|
228 | 228 | |
|
229 | 229 | #endif |
|
230 | 230 | $ echo "[format]" >> .hg/hgrc |
|
231 | 231 | $ echo "use-persistent-nodemap=True" >> .hg/hgrc |
|
232 | 232 | |
|
233 | 233 | $ hg debugupgraderepo --run -q -R ../shared1 |
|
234 | 234 | abort: cannot upgrade repository; unsupported source requirement: shared |
|
235 | 235 | [255] |
|
236 | 236 | |
|
237 | 237 | $ hg debugupgraderepo --run -q |
|
238 | 238 | upgrade will perform the following actions: |
|
239 | 239 | |
|
240 | 240 | requirements |
|
241 | 241 | preserved: dotencode, exp-sharesafe, fncache, generaldelta, revlogv1, sparserevlog, store (no-zstd !) |
|
242 | 242 | preserved: dotencode, exp-sharesafe, fncache, generaldelta, revlog-compression-zstd, revlogv1, sparserevlog, store (zstd !) |
|
243 | 243 | added: persistent-nodemap |
|
244 | 244 | |
|
245 | 245 | processed revlogs: |
|
246 | 246 | - all-filelogs |
|
247 | 247 | - changelog |
|
248 | 248 | - manifest |
|
249 | 249 | |
|
250 | 250 | $ hg log -r . |
|
251 | 251 | changeset: 1:5f6d8a4bf34a |
|
252 | 252 | user: test |
|
253 | 253 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
254 | 254 | summary: added b |
|
255 | 255 | |
|
256 | 256 | |
|
257 | 257 | Shared one should work |
|
258 | 258 | $ cd ../shared1 |
|
259 | 259 | $ hg log -r . |
|
260 | 260 | changeset: 2:155349b645be |
|
261 | 261 | tag: tip |
|
262 | 262 | user: test |
|
263 | 263 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
264 | 264 | summary: added c |
|
265 | 265 | |
|
266 | 266 | |
|
267 | 267 | Testing that nonsharedrc is loaded for source and not shared |
|
268 | 268 | |
|
269 | 269 | $ cd ../source |
|
270 | 270 | $ touch .hg/hgrc-not-shared |
|
271 | 271 | $ echo "[ui]" >> .hg/hgrc-not-shared |
|
272 | 272 | $ echo "traceback=true" >> .hg/hgrc-not-shared |
|
273 | 273 | |
|
274 | 274 | $ hg showconfig ui.traceback |
|
275 | 275 | true |
|
276 | 276 | |
|
277 | 277 | $ HGEDITOR=cat hg config --non-shared |
|
278 | 278 | [ui] |
|
279 | 279 | traceback=true |
|
280 | 280 | |
|
281 | 281 | $ cd ../shared1 |
|
282 | 282 | $ hg showconfig ui.traceback |
|
283 | 283 | [1] |
|
284 | 284 | |
|
285 | 285 | Unsharing works |
|
286 | 286 | |
|
287 | 287 | $ hg unshare |
|
288 | 288 | |
|
289 | 289 | Test that source config is added to the shared one after unshare, and the config |
|
290 | 290 | of current repo is still respected over the config which came from source config |
|
291 | 291 | $ cd ../cloned |
|
292 | 292 | $ hg push ../shared1 |
|
293 | 293 | pushing to ../shared1 |
|
294 | 294 | searching for changes |
|
295 | 295 | adding changesets |
|
296 | 296 | adding manifests |
|
297 | 297 | adding file changes |
|
298 | 298 | error: pretxnchangegroup.reject_merge_commits hook failed: bcde3522682d rejected as merge on the same branch. Please consider rebase. |
|
299 | 299 | transaction abort! |
|
300 | 300 | rollback completed |
|
301 | 301 | abort: bcde3522682d rejected as merge on the same branch. Please consider rebase. |
|
302 | 302 | [255] |
|
303 | 303 | $ hg showconfig ui.curses -R ../shared1 |
|
304 | 304 | false |
|
305 | 305 | |
|
306 | 306 | $ cd ../ |
|
307 | 307 | |
|
308 | 308 | Test that upgrading using debugupgraderepo works |
|
309 | 309 | ================================================= |
|
310 | 310 | |
|
311 | 311 | $ hg init non-share-safe --config format.exp-share-safe=false |
|
312 | 312 | $ cd non-share-safe |
|
313 | 313 | $ hg debugrequirements |
|
314 | 314 | dotencode |
|
315 | 315 | fncache |
|
316 | 316 | generaldelta |
|
317 | 317 | revlogv1 |
|
318 | 318 | sparserevlog |
|
319 | 319 | store |
|
320 | 320 | $ echo foo > foo |
|
321 | 321 | $ hg ci -Aqm 'added foo' |
|
322 | 322 | $ echo bar > bar |
|
323 | 323 | $ hg ci -Aqm 'added bar' |
|
324 | 324 | |
|
325 | 325 | Create a share before upgrading |
|
326 | 326 | |
|
327 | 327 | $ cd .. |
|
328 | 328 | $ hg share non-share-safe nss-share |
|
329 | 329 | updating working directory |
|
330 | 330 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
331 | 331 | $ hg debugrequirements -R nss-share |
|
332 | 332 | dotencode |
|
333 | 333 | fncache |
|
334 | 334 | generaldelta |
|
335 | 335 | revlogv1 |
|
336 | 336 | shared |
|
337 | 337 | sparserevlog |
|
338 | 338 | store |
|
339 | 339 | $ cd non-share-safe |
|
340 | 340 | |
|
341 | 341 | Upgrade |
|
342 | 342 | |
|
343 | 343 | $ hg debugupgraderepo -q |
|
344 | 344 | requirements |
|
345 | 345 | preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store |
|
346 | 346 | added: exp-sharesafe |
|
347 | 347 | |
|
348 | 348 | processed revlogs: |
|
349 | 349 | - all-filelogs |
|
350 | 350 | - changelog |
|
351 | 351 | - manifest |
|
352 | 352 | |
|
353 | 353 | $ hg debugupgraderepo --run -q |
|
354 | 354 | upgrade will perform the following actions: |
|
355 | 355 | |
|
356 | 356 | requirements |
|
357 | 357 | preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store |
|
358 | 358 | added: exp-sharesafe |
|
359 | 359 | |
|
360 | 360 | processed revlogs: |
|
361 | 361 | - all-filelogs |
|
362 | 362 | - changelog |
|
363 | 363 | - manifest |
|
364 | 364 | |
|
365 | 365 | repository upgraded to share safe mode, existing shares will still work in old non-safe mode. Re-share existing shares to use them in safe mode New shares will be created in safe mode. |
|
366 | 366 | |
|
367 | 367 | $ hg debugrequirements |
|
368 | 368 | dotencode |
|
369 | 369 | exp-sharesafe |
|
370 | 370 | fncache |
|
371 | 371 | generaldelta |
|
372 | 372 | revlogv1 |
|
373 | 373 | sparserevlog |
|
374 | 374 | store |
|
375 | 375 | |
|
376 | 376 | $ cat .hg/requires |
|
377 | 377 | exp-sharesafe |
|
378 | 378 | |
|
379 | 379 | $ cat .hg/store/requires |
|
380 | 380 | dotencode |
|
381 | 381 | fncache |
|
382 | 382 | generaldelta |
|
383 | 383 | revlogv1 |
|
384 | 384 | sparserevlog |
|
385 | 385 | store |
|
386 | 386 | |
|
387 | 387 | $ hg log -GT "{node}: {desc}\n" |
|
388 | 388 | @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar |
|
389 | 389 | | |
|
390 | 390 | o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo |
|
391 | 391 | |
|
392 | 392 | |
|
393 | 393 | Make sure existing shares still works |
|
394 | 394 | |
|
395 | 395 | $ hg log -GT "{node}: {desc}\n" -R ../nss-share --config experimental.sharesafe-warn-outdated-shares=false |
|
396 | 396 | @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar |
|
397 | 397 | | |
|
398 | 398 | o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo |
|
399 | 399 | |
|
400 | 400 | |
|
401 | 401 | $ hg log -GT "{node}: {desc}\n" -R ../nss-share |
|
402 | 402 | warning: source repository supports share-safe functionality. Reshare to upgrade. |
|
403 | 403 | @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar |
|
404 | 404 | | |
|
405 | 405 | o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo |
|
406 | 406 | |
|
407 | 407 | |
|
408 | 408 | |
|
409 | 409 | Create a safe share from upgrade one |
|
410 | 410 | |
|
411 | 411 | $ cd .. |
|
412 | 412 | $ hg share non-share-safe ss-share |
|
413 | 413 | updating working directory |
|
414 | 414 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
415 | 415 | $ cd ss-share |
|
416 | 416 | $ hg log -GT "{node}: {desc}\n" |
|
417 | 417 | @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar |
|
418 | 418 | | |
|
419 | 419 | o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo |
|
420 | 420 | |
|
421 | 421 | $ cd ../non-share-safe |
|
422 | 422 | |
|
423 | 423 | Test that downgrading works too |
|
424 | 424 | |
|
425 | 425 | $ cat >> $HGRCPATH <<EOF |
|
426 | 426 | > [extensions] |
|
427 | 427 | > share = |
|
428 | 428 | > [format] |
|
429 | 429 | > exp-share-safe = False |
|
430 | 430 | > EOF |
|
431 | 431 | |
|
432 | 432 | $ hg debugupgraderepo -q |
|
433 | 433 | requirements |
|
434 | 434 | preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store |
|
435 | 435 | removed: exp-sharesafe |
|
436 | 436 | |
|
437 | 437 | processed revlogs: |
|
438 | 438 | - all-filelogs |
|
439 | 439 | - changelog |
|
440 | 440 | - manifest |
|
441 | 441 | |
|
442 | 442 | $ hg debugupgraderepo -q --run |
|
443 | 443 | upgrade will perform the following actions: |
|
444 | 444 | |
|
445 | 445 | requirements |
|
446 | 446 | preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store |
|
447 | 447 | removed: exp-sharesafe |
|
448 | 448 | |
|
449 | 449 | processed revlogs: |
|
450 | 450 | - all-filelogs |
|
451 | 451 | - changelog |
|
452 | 452 | - manifest |
|
453 | 453 | |
|
454 | 454 | repository downgraded to not use share safe mode, existing shares will not work and needs to be reshared. |
|
455 | 455 | |
|
456 | 456 | $ hg debugrequirements |
|
457 | 457 | dotencode |
|
458 | 458 | fncache |
|
459 | 459 | generaldelta |
|
460 | 460 | revlogv1 |
|
461 | 461 | sparserevlog |
|
462 | 462 | store |
|
463 | 463 | |
|
464 | 464 | $ cat .hg/requires |
|
465 | 465 | dotencode |
|
466 | 466 | fncache |
|
467 | 467 | generaldelta |
|
468 | 468 | revlogv1 |
|
469 | 469 | sparserevlog |
|
470 | 470 | store |
|
471 | 471 | |
|
472 | 472 | $ test -f .hg/store/requires |
|
473 | 473 | [1] |
|
474 | 474 | |
|
475 | 475 | $ hg log -GT "{node}: {desc}\n" |
|
476 | 476 | @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar |
|
477 | 477 | | |
|
478 | 478 | o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo |
|
479 | 479 | |
|
480 | 480 | |
|
481 | 481 | Make sure existing shares still works |
|
482 | 482 | |
|
483 | 483 | $ hg log -GT "{node}: {desc}\n" -R ../nss-share |
|
484 | 484 | @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar |
|
485 | 485 | | |
|
486 | 486 | o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo |
|
487 | 487 | |
|
488 | 488 | |
|
489 | 489 | $ hg log -GT "{node}: {desc}\n" -R ../ss-share |
|
490 | 490 | abort: share source does not support exp-sharesafe requirement |
|
491 | 491 | [255] |
|
492 | 492 | |
|
493 | 493 | Testing automatic downgrade of shares when config is set |
|
494 | 494 | |
|
495 | 495 | $ touch ../ss-share/.hg/wlock |
|
496 | 496 | $ hg log -GT "{node}: {desc}\n" -R ../ss-share --config experimental.sharesafe-auto-downgrade-shares=true |
|
497 | 497 | abort: failed to downgrade share, got error: Lock held |
|
498 | 498 | [255] |
|
499 | 499 | $ rm ../ss-share/.hg/wlock |
|
500 | 500 | |
|
501 | 501 | $ hg log -GT "{node}: {desc}\n" -R ../ss-share --config experimental.sharesafe-auto-downgrade-shares=true |
|
502 | 502 | repository downgraded to not use share-safe mode |
|
503 | 503 | @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar |
|
504 | 504 | | |
|
505 | 505 | o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo |
|
506 | 506 | |
|
507 | 507 | |
|
508 | 508 | $ hg log -GT "{node}: {desc}\n" -R ../ss-share |
|
509 | 509 | @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar |
|
510 | 510 | | |
|
511 | 511 | o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo |
|
512 | 512 | |
|
513 | 513 | |
|
514 | 514 | |
|
515 | 515 | Testing automatic upgrade of shares when config is set |
|
516 | 516 | |
|
517 | 517 | $ hg debugupgraderepo -q --run --config format.exp-share-safe=True |
|
518 | 518 | upgrade will perform the following actions: |
|
519 | 519 | |
|
520 | 520 | requirements |
|
521 | 521 | preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store |
|
522 | 522 | added: exp-sharesafe |
|
523 | 523 | |
|
524 | 524 | processed revlogs: |
|
525 | 525 | - all-filelogs |
|
526 | 526 | - changelog |
|
527 | 527 | - manifest |
|
528 | 528 | |
|
529 | 529 | repository upgraded to share safe mode, existing shares will still work in old non-safe mode. Re-share existing shares to use them in safe mode New shares will be created in safe mode. |
|
530 | 530 | $ hg debugrequirements |
|
531 | 531 | dotencode |
|
532 | 532 | exp-sharesafe |
|
533 | 533 | fncache |
|
534 | 534 | generaldelta |
|
535 | 535 | revlogv1 |
|
536 | 536 | sparserevlog |
|
537 | 537 | store |
|
538 | 538 | $ hg log -GT "{node}: {desc}\n" -R ../nss-share |
|
539 | 539 | warning: source repository supports share-safe functionality. Reshare to upgrade. |
|
540 | 540 | @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar |
|
541 | 541 | | |
|
542 | 542 | o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo |
|
543 | 543 | |
|
544 | 544 | |
|
545 | 545 | Check that if lock is taken, upgrade fails but read operation are successful |
|
546 | 546 | $ touch ../nss-share/.hg/wlock |
|
547 | 547 | $ hg log -GT "{node}: {desc}\n" -R ../nss-share --config experimental.sharesafe-auto-upgrade-shares=true |
|
548 | 548 | failed to upgrade share, got error: Lock held |
|
549 | 549 | @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar |
|
550 | 550 | | |
|
551 | 551 | o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo |
|
552 | 552 | |
|
553 | 553 | |
|
554 | 554 | $ hg log -GT "{node}: {desc}\n" -R ../nss-share --config experimental.sharesafe-auto-upgrade-shares=true --config experimental.sharesafe-warn-outdated-shares=false |
|
555 | 555 | @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar |
|
556 | 556 | | |
|
557 | 557 | o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo |
|
558 | 558 | |
|
559 | 559 | |
|
560 | 560 | $ hg log -GT "{node}: {desc}\n" -R ../nss-share --config experimental.sharesafe-auto-upgrade-shares=true --config experimental.sharesafe-auto-upgrade-fail-error=true |
|
561 | 561 | abort: failed to upgrade share, got error: Lock held |
|
562 | 562 | [255] |
|
563 | 563 | |
|
564 | 564 | $ rm ../nss-share/.hg/wlock |
|
565 | 565 | $ hg log -GT "{node}: {desc}\n" -R ../nss-share --config experimental.sharesafe-auto-upgrade-shares=true |
|
566 | 566 | repository upgraded to use share-safe mode |
|
567 | 567 | @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar |
|
568 | 568 | | |
|
569 | 569 | o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo |
|
570 | 570 | |
|
571 | 571 | |
|
572 | 572 | Test that unshare works |
|
573 | 573 | |
|
574 | 574 | $ hg unshare -R ../nss-share |
|
575 | 575 | $ hg log -GT "{node}: {desc}\n" -R ../nss-share |
|
576 | 576 | @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar |
|
577 | 577 | | |
|
578 | 578 | o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo |
|
579 | 579 |
@@ -1,407 +1,407 b'' | |||
|
1 | 1 | $ cat <<EOF >> $HGRCPATH |
|
2 | 2 | > [ui] |
|
3 | 3 | > color = always |
|
4 | 4 | > [color] |
|
5 | 5 | > mode = ansi |
|
6 | 6 | > EOF |
|
7 | 7 | Terminfo codes compatibility fix |
|
8 | 8 | $ echo "color.none=0" >> $HGRCPATH |
|
9 | 9 | |
|
10 | 10 | $ hg init repo1 |
|
11 | 11 | $ cd repo1 |
|
12 | 12 | $ mkdir a b a/1 b/1 b/2 |
|
13 | 13 | $ touch in_root a/in_a b/in_b a/1/in_a_1 b/1/in_b_1 b/2/in_b_2 |
|
14 | 14 | |
|
15 | 15 | hg status in repo root: |
|
16 | 16 | |
|
17 | 17 | $ hg status |
|
18 | 18 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/1/in_a_1\x1b[0m (esc) |
|
19 | 19 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/in_a\x1b[0m (esc) |
|
20 | 20 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/1/in_b_1\x1b[0m (esc) |
|
21 | 21 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/2/in_b_2\x1b[0m (esc) |
|
22 | 22 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/in_b\x1b[0m (esc) |
|
23 | 23 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_root\x1b[0m (esc) |
|
24 | 24 | |
|
25 | 25 | $ hg status --color=debug |
|
26 | 26 | [status.unknown|? ][status.unknown|a/1/in_a_1] |
|
27 | 27 | [status.unknown|? ][status.unknown|a/in_a] |
|
28 | 28 | [status.unknown|? ][status.unknown|b/1/in_b_1] |
|
29 | 29 | [status.unknown|? ][status.unknown|b/2/in_b_2] |
|
30 | 30 | [status.unknown|? ][status.unknown|b/in_b] |
|
31 | 31 | [status.unknown|? ][status.unknown|in_root] |
|
32 | 32 | HGPLAIN disables color |
|
33 | 33 | $ HGPLAIN=1 hg status --color=debug |
|
34 | 34 | ? a/1/in_a_1 (glob) |
|
35 | 35 | ? a/in_a (glob) |
|
36 | 36 | ? b/1/in_b_1 (glob) |
|
37 | 37 | ? b/2/in_b_2 (glob) |
|
38 | 38 | ? b/in_b (glob) |
|
39 | 39 | ? in_root |
|
40 | 40 | HGPLAINEXCEPT=color does not disable color |
|
41 | 41 | $ HGPLAINEXCEPT=color hg status --color=debug |
|
42 | 42 | [status.unknown|? ][status.unknown|a/1/in_a_1] (glob) |
|
43 | 43 | [status.unknown|? ][status.unknown|a/in_a] (glob) |
|
44 | 44 | [status.unknown|? ][status.unknown|b/1/in_b_1] (glob) |
|
45 | 45 | [status.unknown|? ][status.unknown|b/2/in_b_2] (glob) |
|
46 | 46 | [status.unknown|? ][status.unknown|b/in_b] (glob) |
|
47 | 47 | [status.unknown|? ][status.unknown|in_root] |
|
48 | 48 | |
|
49 | 49 | hg status with template |
|
50 | 50 | $ hg status -T "{label('red', path)}\n" --color=debug |
|
51 | 51 | [red|a/1/in_a_1] |
|
52 | 52 | [red|a/in_a] |
|
53 | 53 | [red|b/1/in_b_1] |
|
54 | 54 | [red|b/2/in_b_2] |
|
55 | 55 | [red|b/in_b] |
|
56 | 56 | [red|in_root] |
|
57 | 57 | |
|
58 | 58 | hg status . in repo root: |
|
59 | 59 | |
|
60 | 60 | $ hg status . |
|
61 | 61 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/1/in_a_1\x1b[0m (esc) |
|
62 | 62 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/in_a\x1b[0m (esc) |
|
63 | 63 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/1/in_b_1\x1b[0m (esc) |
|
64 | 64 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/2/in_b_2\x1b[0m (esc) |
|
65 | 65 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/in_b\x1b[0m (esc) |
|
66 | 66 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_root\x1b[0m (esc) |
|
67 | 67 | |
|
68 | 68 | $ hg status --cwd a |
|
69 | 69 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/1/in_a_1\x1b[0m (esc) |
|
70 | 70 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/in_a\x1b[0m (esc) |
|
71 | 71 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/1/in_b_1\x1b[0m (esc) |
|
72 | 72 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/2/in_b_2\x1b[0m (esc) |
|
73 | 73 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/in_b\x1b[0m (esc) |
|
74 | 74 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_root\x1b[0m (esc) |
|
75 | 75 | $ hg status --cwd a . |
|
76 | 76 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m1/in_a_1\x1b[0m (esc) |
|
77 | 77 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_a\x1b[0m (esc) |
|
78 | 78 | $ hg status --cwd a .. |
|
79 | 79 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m1/in_a_1\x1b[0m (esc) |
|
80 | 80 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_a\x1b[0m (esc) |
|
81 | 81 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../b/1/in_b_1\x1b[0m (esc) |
|
82 | 82 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../b/2/in_b_2\x1b[0m (esc) |
|
83 | 83 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../b/in_b\x1b[0m (esc) |
|
84 | 84 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../in_root\x1b[0m (esc) |
|
85 | 85 | |
|
86 | 86 | $ hg status --cwd b |
|
87 | 87 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/1/in_a_1\x1b[0m (esc) |
|
88 | 88 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/in_a\x1b[0m (esc) |
|
89 | 89 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/1/in_b_1\x1b[0m (esc) |
|
90 | 90 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/2/in_b_2\x1b[0m (esc) |
|
91 | 91 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/in_b\x1b[0m (esc) |
|
92 | 92 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_root\x1b[0m (esc) |
|
93 | 93 | $ hg status --cwd b . |
|
94 | 94 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m1/in_b_1\x1b[0m (esc) |
|
95 | 95 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m2/in_b_2\x1b[0m (esc) |
|
96 | 96 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_b\x1b[0m (esc) |
|
97 | 97 | $ hg status --cwd b .. |
|
98 | 98 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../a/1/in_a_1\x1b[0m (esc) |
|
99 | 99 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../a/in_a\x1b[0m (esc) |
|
100 | 100 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m1/in_b_1\x1b[0m (esc) |
|
101 | 101 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m2/in_b_2\x1b[0m (esc) |
|
102 | 102 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_b\x1b[0m (esc) |
|
103 | 103 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../in_root\x1b[0m (esc) |
|
104 | 104 | |
|
105 | 105 | $ hg status --cwd a/1 |
|
106 | 106 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/1/in_a_1\x1b[0m (esc) |
|
107 | 107 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/in_a\x1b[0m (esc) |
|
108 | 108 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/1/in_b_1\x1b[0m (esc) |
|
109 | 109 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/2/in_b_2\x1b[0m (esc) |
|
110 | 110 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/in_b\x1b[0m (esc) |
|
111 | 111 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_root\x1b[0m (esc) |
|
112 | 112 | $ hg status --cwd a/1 . |
|
113 | 113 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_a_1\x1b[0m (esc) |
|
114 | 114 | $ hg status --cwd a/1 .. |
|
115 | 115 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_a_1\x1b[0m (esc) |
|
116 | 116 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../in_a\x1b[0m (esc) |
|
117 | 117 | |
|
118 | 118 | $ hg status --cwd b/1 |
|
119 | 119 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/1/in_a_1\x1b[0m (esc) |
|
120 | 120 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/in_a\x1b[0m (esc) |
|
121 | 121 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/1/in_b_1\x1b[0m (esc) |
|
122 | 122 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/2/in_b_2\x1b[0m (esc) |
|
123 | 123 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/in_b\x1b[0m (esc) |
|
124 | 124 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_root\x1b[0m (esc) |
|
125 | 125 | $ hg status --cwd b/1 . |
|
126 | 126 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_b_1\x1b[0m (esc) |
|
127 | 127 | $ hg status --cwd b/1 .. |
|
128 | 128 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_b_1\x1b[0m (esc) |
|
129 | 129 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../2/in_b_2\x1b[0m (esc) |
|
130 | 130 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../in_b\x1b[0m (esc) |
|
131 | 131 | |
|
132 | 132 | $ hg status --cwd b/2 |
|
133 | 133 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/1/in_a_1\x1b[0m (esc) |
|
134 | 134 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/in_a\x1b[0m (esc) |
|
135 | 135 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/1/in_b_1\x1b[0m (esc) |
|
136 | 136 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/2/in_b_2\x1b[0m (esc) |
|
137 | 137 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/in_b\x1b[0m (esc) |
|
138 | 138 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_root\x1b[0m (esc) |
|
139 | 139 | $ hg status --cwd b/2 . |
|
140 | 140 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_b_2\x1b[0m (esc) |
|
141 | 141 | $ hg status --cwd b/2 .. |
|
142 | 142 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../1/in_b_1\x1b[0m (esc) |
|
143 | 143 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_b_2\x1b[0m (esc) |
|
144 | 144 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../in_b\x1b[0m (esc) |
|
145 | 145 | |
|
146 | 146 | Make sure --color=never works |
|
147 | 147 | $ hg status --color=never |
|
148 | 148 | ? a/1/in_a_1 |
|
149 | 149 | ? a/in_a |
|
150 | 150 | ? b/1/in_b_1 |
|
151 | 151 | ? b/2/in_b_2 |
|
152 | 152 | ? b/in_b |
|
153 | 153 | ? in_root |
|
154 | 154 | |
|
155 | 155 | Make sure ui.formatted=False works |
|
156 | 156 | $ hg status --color=auto --config ui.formatted=False |
|
157 | 157 | ? a/1/in_a_1 |
|
158 | 158 | ? a/in_a |
|
159 | 159 | ? b/1/in_b_1 |
|
160 | 160 | ? b/2/in_b_2 |
|
161 | 161 | ? b/in_b |
|
162 | 162 | ? in_root |
|
163 | 163 | |
|
164 | 164 | $ cd .. |
|
165 | 165 | |
|
166 | 166 | $ hg init repo2 |
|
167 | 167 | $ cd repo2 |
|
168 | 168 | $ touch modified removed deleted ignored |
|
169 | 169 | $ echo "^ignored$" > .hgignore |
|
170 | 170 | $ hg ci -A -m 'initial checkin' |
|
171 | 171 | \x1b[0;32madding .hgignore\x1b[0m (esc) |
|
172 | 172 | \x1b[0;32madding deleted\x1b[0m (esc) |
|
173 | 173 | \x1b[0;32madding modified\x1b[0m (esc) |
|
174 | 174 | \x1b[0;32madding removed\x1b[0m (esc) |
|
175 | 175 | $ hg log --color=debug |
|
176 | 176 | [log.changeset changeset.draft|changeset: 0:389aef86a55e] |
|
177 | 177 | [log.tag|tag: tip] |
|
178 | 178 | [log.user|user: test] |
|
179 | 179 | [log.date|date: Thu Jan 01 00:00:00 1970 +0000] |
|
180 | 180 | [log.summary|summary: initial checkin] |
|
181 | 181 | |
|
182 | 182 | $ hg log -Tcompact --color=debug |
|
183 | 183 | [log.changeset changeset.draft|0][tip] [log.node|389aef86a55e] [log.date|1970-01-01 00:00 +0000] [log.user|test] |
|
184 | 184 | [ui.note log.description|initial checkin] |
|
185 | 185 | |
|
186 | 186 | Labels on empty strings should not be displayed, labels on custom |
|
187 | 187 | templates should be. |
|
188 | 188 | |
|
189 | 189 | $ hg log --color=debug -T '{label("my.label",author)}\n{label("skipped.label","")}' |
|
190 | 190 | [my.label|test] |
|
191 | 191 | $ touch modified added unknown ignored |
|
192 | 192 | $ hg add added |
|
193 | 193 | $ hg remove removed |
|
194 | 194 | $ rm deleted |
|
195 | 195 | |
|
196 | 196 | hg status: |
|
197 | 197 | |
|
198 | 198 | $ hg status |
|
199 | 199 | \x1b[0;32;1mA \x1b[0m\x1b[0;32;1madded\x1b[0m (esc) |
|
200 | 200 | \x1b[0;31;1mR \x1b[0m\x1b[0;31;1mremoved\x1b[0m (esc) |
|
201 | 201 | \x1b[0;36;1;4m! \x1b[0m\x1b[0;36;1;4mdeleted\x1b[0m (esc) |
|
202 | 202 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4munknown\x1b[0m (esc) |
|
203 | 203 | |
|
204 | 204 | hg status modified added removed deleted unknown never-existed ignored: |
|
205 | 205 | |
|
206 | 206 | $ hg status modified added removed deleted unknown never-existed ignored |
|
207 | 207 | never-existed: * (glob) |
|
208 | 208 | \x1b[0;32;1mA \x1b[0m\x1b[0;32;1madded\x1b[0m (esc) |
|
209 | 209 | \x1b[0;31;1mR \x1b[0m\x1b[0;31;1mremoved\x1b[0m (esc) |
|
210 | 210 | \x1b[0;36;1;4m! \x1b[0m\x1b[0;36;1;4mdeleted\x1b[0m (esc) |
|
211 | 211 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4munknown\x1b[0m (esc) |
|
212 | 212 | |
|
213 | 213 | $ hg copy modified copied |
|
214 | 214 | |
|
215 | 215 | hg status -C: |
|
216 | 216 | |
|
217 | 217 | $ hg status -C |
|
218 | 218 | \x1b[0;32;1mA \x1b[0m\x1b[0;32;1madded\x1b[0m (esc) |
|
219 | 219 | \x1b[0;32;1mA \x1b[0m\x1b[0;32;1mcopied\x1b[0m (esc) |
|
220 | 220 | \x1b[0;0m modified\x1b[0m (esc) |
|
221 | 221 | \x1b[0;31;1mR \x1b[0m\x1b[0;31;1mremoved\x1b[0m (esc) |
|
222 | 222 | \x1b[0;36;1;4m! \x1b[0m\x1b[0;36;1;4mdeleted\x1b[0m (esc) |
|
223 | 223 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4munknown\x1b[0m (esc) |
|
224 | 224 | |
|
225 | 225 | hg status -A: |
|
226 | 226 | |
|
227 | 227 | $ hg status -A |
|
228 | 228 | \x1b[0;32;1mA \x1b[0m\x1b[0;32;1madded\x1b[0m (esc) |
|
229 | 229 | \x1b[0;32;1mA \x1b[0m\x1b[0;32;1mcopied\x1b[0m (esc) |
|
230 | 230 | \x1b[0;0m modified\x1b[0m (esc) |
|
231 | 231 | \x1b[0;31;1mR \x1b[0m\x1b[0;31;1mremoved\x1b[0m (esc) |
|
232 | 232 | \x1b[0;36;1;4m! \x1b[0m\x1b[0;36;1;4mdeleted\x1b[0m (esc) |
|
233 | 233 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4munknown\x1b[0m (esc) |
|
234 | 234 | \x1b[0;30;1mI \x1b[0m\x1b[0;30;1mignored\x1b[0m (esc) |
|
235 | 235 | \x1b[0;0mC \x1b[0m\x1b[0;0m.hgignore\x1b[0m (esc) |
|
236 | 236 | \x1b[0;0mC \x1b[0m\x1b[0;0mmodified\x1b[0m (esc) |
|
237 | 237 | |
|
238 | 238 | |
|
239 | 239 | hg status -A (with terminfo color): |
|
240 | 240 | |
|
241 | 241 | #if tic |
|
242 | 242 | |
|
243 | 243 | $ tic -o "$TESTTMP/terminfo" "$TESTDIR/hgterm.ti" |
|
244 | 244 | $ ln -s "$TESTTMP/terminfo" "$TESTTMP/terminfo.cdb" |
|
245 | 245 | $ TERM=hgterm TERMINFO="$TESTTMP/terminfo" hg status --config color.mode=terminfo -A |
|
246 | 246 | \x1b[30m\x1b[32m\x1b[1mA \x1b[30m\x1b[30m\x1b[32m\x1b[1madded\x1b[30m (esc) |
|
247 | 247 | \x1b[30m\x1b[32m\x1b[1mA \x1b[30m\x1b[30m\x1b[32m\x1b[1mcopied\x1b[30m (esc) |
|
248 | 248 | \x1b[30m\x1b[30m modified\x1b[30m (esc) |
|
249 | 249 | \x1b[30m\x1b[31m\x1b[1mR \x1b[30m\x1b[30m\x1b[31m\x1b[1mremoved\x1b[30m (esc) |
|
250 | 250 | \x1b[30m\x1b[36m\x1b[1m\x1b[4m! \x1b[30m\x1b[30m\x1b[36m\x1b[1m\x1b[4mdeleted\x1b[30m (esc) |
|
251 | 251 | \x1b[30m\x1b[35m\x1b[1m\x1b[4m? \x1b[30m\x1b[30m\x1b[35m\x1b[1m\x1b[4munknown\x1b[30m (esc) |
|
252 | 252 | \x1b[30m\x1b[30m\x1b[1mI \x1b[30m\x1b[30m\x1b[30m\x1b[1mignored\x1b[30m (esc) |
|
253 | 253 | \x1b[30m\x1b[30mC \x1b[30m\x1b[30m\x1b[30m.hgignore\x1b[30m (esc) |
|
254 | 254 | \x1b[30m\x1b[30mC \x1b[30m\x1b[30m\x1b[30mmodified\x1b[30m (esc) |
|
255 | 255 | |
|
256 | 256 | The user can define effects with raw terminfo codes: |
|
257 | 257 | |
|
258 | 258 | $ cat <<EOF >> $HGRCPATH |
|
259 | 259 | > # Completely bogus code for dim |
|
260 | 260 | > terminfo.dim = \E[88m |
|
261 | 261 | > # We can override what's in the terminfo database, too |
|
262 | 262 | > terminfo.bold = \E[2m |
|
263 | 263 | > EOF |
|
264 | 264 | $ TERM=hgterm TERMINFO="$TESTTMP/terminfo" hg status --config color.mode=terminfo --config color.status.clean=dim -A |
|
265 | 265 | \x1b[30m\x1b[32m\x1b[2mA \x1b[30m\x1b[30m\x1b[32m\x1b[2madded\x1b[30m (esc) |
|
266 | 266 | \x1b[30m\x1b[32m\x1b[2mA \x1b[30m\x1b[30m\x1b[32m\x1b[2mcopied\x1b[30m (esc) |
|
267 | 267 | \x1b[30m\x1b[30m modified\x1b[30m (esc) |
|
268 | 268 | \x1b[30m\x1b[31m\x1b[2mR \x1b[30m\x1b[30m\x1b[31m\x1b[2mremoved\x1b[30m (esc) |
|
269 | 269 | \x1b[30m\x1b[36m\x1b[2m\x1b[4m! \x1b[30m\x1b[30m\x1b[36m\x1b[2m\x1b[4mdeleted\x1b[30m (esc) |
|
270 | 270 | \x1b[30m\x1b[35m\x1b[2m\x1b[4m? \x1b[30m\x1b[30m\x1b[35m\x1b[2m\x1b[4munknown\x1b[30m (esc) |
|
271 | 271 | \x1b[30m\x1b[30m\x1b[2mI \x1b[30m\x1b[30m\x1b[30m\x1b[2mignored\x1b[30m (esc) |
|
272 | 272 | \x1b[30m\x1b[88mC \x1b[30m\x1b[30m\x1b[88m.hgignore\x1b[30m (esc) |
|
273 | 273 | \x1b[30m\x1b[88mC \x1b[30m\x1b[30m\x1b[88mmodified\x1b[30m (esc) |
|
274 | 274 | |
|
275 | 275 | #endif |
|
276 | 276 | |
|
277 | 277 | |
|
278 | 278 | $ echo "^ignoreddir$" > .hgignore |
|
279 | 279 | $ mkdir ignoreddir |
|
280 | 280 | $ touch ignoreddir/file |
|
281 | 281 | |
|
282 | 282 | hg status ignoreddir/file: |
|
283 | 283 | |
|
284 | 284 | $ hg status ignoreddir/file |
|
285 | 285 | |
|
286 | 286 | hg status -i ignoreddir/file: |
|
287 | 287 | |
|
288 | 288 | $ hg status -i ignoreddir/file |
|
289 | 289 | \x1b[0;30;1mI \x1b[0m\x1b[0;30;1mignoreddir/file\x1b[0m (esc) |
|
290 | 290 | $ cd .. |
|
291 | 291 | |
|
292 | 292 | check 'status -q' and some combinations |
|
293 | 293 | |
|
294 | 294 | $ hg init repo3 |
|
295 | 295 | $ cd repo3 |
|
296 | 296 | $ touch modified removed deleted ignored |
|
297 | 297 | $ echo "^ignored$" > .hgignore |
|
298 | 298 | $ hg commit -A -m 'initial checkin' |
|
299 | 299 | \x1b[0;32madding .hgignore\x1b[0m (esc) |
|
300 | 300 | \x1b[0;32madding deleted\x1b[0m (esc) |
|
301 | 301 | \x1b[0;32madding modified\x1b[0m (esc) |
|
302 | 302 | \x1b[0;32madding removed\x1b[0m (esc) |
|
303 | 303 | $ touch added unknown ignored |
|
304 | 304 | $ hg add added |
|
305 | 305 | $ echo "test" >> modified |
|
306 | 306 | $ hg remove removed |
|
307 | 307 | $ rm deleted |
|
308 | 308 | $ hg copy modified copied |
|
309 | 309 | |
|
310 | 310 | test unknown color |
|
311 | 311 | |
|
312 | 312 | $ hg --config color.status.modified=periwinkle status |
|
313 | 313 | ignoring unknown color/effect 'periwinkle' (configured in color.status.modified) |
|
314 | 314 | ignoring unknown color/effect 'periwinkle' (configured in color.status.modified) |
|
315 | 315 | ignoring unknown color/effect 'periwinkle' (configured in color.status.modified) |
|
316 | 316 | M modified |
|
317 | 317 | \x1b[0;32;1mA \x1b[0m\x1b[0;32;1madded\x1b[0m (esc) |
|
318 | 318 | \x1b[0;32;1mA \x1b[0m\x1b[0;32;1mcopied\x1b[0m (esc) |
|
319 | 319 | \x1b[0;31;1mR \x1b[0m\x1b[0;31;1mremoved\x1b[0m (esc) |
|
320 | 320 | \x1b[0;36;1;4m! \x1b[0m\x1b[0;36;1;4mdeleted\x1b[0m (esc) |
|
321 | 321 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4munknown\x1b[0m (esc) |
|
322 | 322 | |
|
323 | 323 | Run status with 2 different flags. |
|
324 | 324 | Check if result is the same or different. |
|
325 | 325 | If result is not as expected, raise error |
|
326 | 326 | |
|
327 | 327 | $ assert() { |
|
328 | 328 | > hg status $1 > ../a |
|
329 | 329 | > hg status $2 > ../b |
|
330 | 330 | > if diff ../a ../b > /dev/null; then |
|
331 | 331 | > out=0 |
|
332 | 332 | > else |
|
333 | 333 | > out=1 |
|
334 | 334 | > fi |
|
335 | 335 | > if [ $3 -eq 0 ]; then |
|
336 | 336 | > df="same" |
|
337 | 337 | > else |
|
338 | 338 | > df="different" |
|
339 | 339 | > fi |
|
340 | 340 | > if [ $out -ne $3 ]; then |
|
341 | 341 | > echo "Error on $1 and $2, should be $df." |
|
342 | 342 | > fi |
|
343 | 343 | > } |
|
344 | 344 | |
|
345 | 345 | assert flag1 flag2 [0-same | 1-different] |
|
346 | 346 | |
|
347 | 347 | $ assert "-q" "-mard" 0 |
|
348 | 348 | $ assert "-A" "-marduicC" 0 |
|
349 | 349 | $ assert "-qA" "-mardcC" 0 |
|
350 | 350 | $ assert "-qAui" "-A" 0 |
|
351 | 351 | $ assert "-qAu" "-marducC" 0 |
|
352 | 352 | $ assert "-qAi" "-mardicC" 0 |
|
353 | 353 | $ assert "-qu" "-u" 0 |
|
354 | 354 | $ assert "-q" "-u" 1 |
|
355 | 355 | $ assert "-m" "-a" 1 |
|
356 | 356 | $ assert "-r" "-d" 1 |
|
357 | 357 | $ cd .. |
|
358 | 358 | |
|
359 | 359 | test 'resolve -l' |
|
360 | 360 | |
|
361 | 361 | $ hg init repo4 |
|
362 | 362 | $ cd repo4 |
|
363 | 363 | $ echo "file a" > a |
|
364 | 364 | $ echo "file b" > b |
|
365 | 365 | $ hg add a b |
|
366 | 366 | $ hg commit -m "initial" |
|
367 | 367 | $ echo "file a change 1" > a |
|
368 | 368 | $ echo "file b change 1" > b |
|
369 | 369 | $ hg commit -m "head 1" |
|
370 | 370 | $ hg update 0 |
|
371 | 371 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
372 | 372 | $ echo "file a change 2" > a |
|
373 | 373 | $ echo "file b change 2" > b |
|
374 | 374 | $ hg commit -m "head 2" |
|
375 | 375 | created new head |
|
376 | 376 | $ hg merge |
|
377 | 377 | merging a |
|
378 | 378 | merging b |
|
379 | 379 | warning: conflicts while merging a! (edit, then use 'hg resolve --mark') |
|
380 | 380 | warning: conflicts while merging b! (edit, then use 'hg resolve --mark') |
|
381 | 381 | 0 files updated, 0 files merged, 0 files removed, 2 files unresolved |
|
382 | 382 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
|
383 | 383 | [1] |
|
384 | 384 | $ hg resolve -m b |
|
385 | 385 | |
|
386 | 386 | hg resolve with one unresolved, one resolved: |
|
387 | 387 | |
|
388 | 388 | $ hg resolve -l |
|
389 | 389 | \x1b[0;31;1mU \x1b[0m\x1b[0;31;1ma\x1b[0m (esc) |
|
390 | 390 | \x1b[0;32;1mR \x1b[0m\x1b[0;32;1mb\x1b[0m (esc) |
|
391 | 391 | |
|
392 | 392 | color coding of error message with current availability of curses |
|
393 | 393 | |
|
394 | 394 | $ hg unknowncommand > /dev/null |
|
395 | 395 | hg: unknown command 'unknowncommand' |
|
396 | 396 | (use 'hg help' for a list of commands) |
|
397 |
[ |
|
|
397 | [10] | |
|
398 | 398 | |
|
399 | 399 | color coding of error message without curses |
|
400 | 400 | |
|
401 | 401 | $ echo 'raise ImportError' > curses.py |
|
402 | 402 | $ PYTHONPATH=`pwd`:$PYTHONPATH hg unknowncommand > /dev/null |
|
403 | 403 | hg: unknown command 'unknowncommand' |
|
404 | 404 | (use 'hg help' for a list of commands) |
|
405 |
[ |
|
|
405 | [10] | |
|
406 | 406 | |
|
407 | 407 | $ cd .. |
@@ -1,26 +1,26 b'' | |||
|
1 | 1 | $ hg init |
|
2 | 2 | |
|
3 | 3 | $ echo a > a |
|
4 | 4 | $ hg ci -Ama |
|
5 | 5 | adding a |
|
6 | 6 | |
|
7 | 7 | $ hg an a |
|
8 | 8 | 0: a |
|
9 | 9 | |
|
10 | 10 | $ hg --config ui.strict=False an a |
|
11 | 11 | 0: a |
|
12 | 12 | |
|
13 | 13 | $ echo "[ui]" >> $HGRCPATH |
|
14 | 14 | $ echo "strict=True" >> $HGRCPATH |
|
15 | 15 | |
|
16 | 16 | $ hg an a |
|
17 | 17 | hg: unknown command 'an' |
|
18 | 18 | (use 'hg help' for a list of commands) |
|
19 |
[ |
|
|
19 | [10] | |
|
20 | 20 | $ hg annotate a |
|
21 | 21 | 0: a |
|
22 | 22 | |
|
23 | 23 | should succeed - up is an alias, not an abbreviation |
|
24 | 24 | |
|
25 | 25 | $ hg up |
|
26 | 26 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
@@ -1,1459 +1,1459 b'' | |||
|
1 | 1 | $ echo "[extensions]" >> $HGRCPATH |
|
2 | 2 | $ echo "strip=" >> $HGRCPATH |
|
3 | 3 | $ echo "drawdag=$TESTDIR/drawdag.py" >> $HGRCPATH |
|
4 | 4 | |
|
5 | 5 | $ restore() { |
|
6 | 6 | > hg unbundle -q .hg/strip-backup/* |
|
7 | 7 | > rm .hg/strip-backup/* |
|
8 | 8 | > } |
|
9 | 9 | $ teststrip() { |
|
10 | 10 | > hg up -C $1 |
|
11 | 11 | > echo % before update $1, strip $2 |
|
12 | 12 | > hg log -G -T '{rev}:{node}' |
|
13 | 13 | > hg --traceback debugstrip $2 |
|
14 | 14 | > echo % after update $1, strip $2 |
|
15 | 15 | > hg log -G -T '{rev}:{node}' |
|
16 | 16 | > restore |
|
17 | 17 | > } |
|
18 | 18 | |
|
19 | 19 | $ hg init test |
|
20 | 20 | $ cd test |
|
21 | 21 | |
|
22 | 22 | $ echo foo > bar |
|
23 | 23 | $ hg ci -Ama |
|
24 | 24 | adding bar |
|
25 | 25 | |
|
26 | 26 | $ echo more >> bar |
|
27 | 27 | $ hg ci -Amb |
|
28 | 28 | |
|
29 | 29 | $ echo blah >> bar |
|
30 | 30 | $ hg ci -Amc |
|
31 | 31 | |
|
32 | 32 | $ hg up 1 |
|
33 | 33 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
34 | 34 | $ echo blah >> bar |
|
35 | 35 | $ hg ci -Amd |
|
36 | 36 | created new head |
|
37 | 37 | |
|
38 | 38 | $ echo final >> bar |
|
39 | 39 | $ hg ci -Ame |
|
40 | 40 | |
|
41 | 41 | $ hg log |
|
42 | 42 | changeset: 4:443431ffac4f |
|
43 | 43 | tag: tip |
|
44 | 44 | user: test |
|
45 | 45 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
46 | 46 | summary: e |
|
47 | 47 | |
|
48 | 48 | changeset: 3:65bd5f99a4a3 |
|
49 | 49 | parent: 1:ef3a871183d7 |
|
50 | 50 | user: test |
|
51 | 51 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
52 | 52 | summary: d |
|
53 | 53 | |
|
54 | 54 | changeset: 2:264128213d29 |
|
55 | 55 | user: test |
|
56 | 56 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
57 | 57 | summary: c |
|
58 | 58 | |
|
59 | 59 | changeset: 1:ef3a871183d7 |
|
60 | 60 | user: test |
|
61 | 61 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
62 | 62 | summary: b |
|
63 | 63 | |
|
64 | 64 | changeset: 0:9ab35a2d17cb |
|
65 | 65 | user: test |
|
66 | 66 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
67 | 67 | summary: a |
|
68 | 68 | |
|
69 | 69 | |
|
70 | 70 | $ teststrip 4 4 |
|
71 | 71 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
72 | 72 | % before update 4, strip 4 |
|
73 | 73 | @ 4:443431ffac4f5b5a19b0b6c298a21b7ba736bcce |
|
74 | 74 | | |
|
75 | 75 | o 3:65bd5f99a4a376cdea23a1153f07856b0d881d64 |
|
76 | 76 | | |
|
77 | 77 | | o 2:264128213d290d868c54642d13aeaa3675551a78 |
|
78 | 78 | |/ |
|
79 | 79 | o 1:ef3a871183d7199c541cc140218298bbfcc6c28a |
|
80 | 80 | | |
|
81 | 81 | o 0:9ab35a2d17cb64271241ea881efcc19dd953215b |
|
82 | 82 | |
|
83 | 83 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
84 | 84 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
85 | 85 | % after update 4, strip 4 |
|
86 | 86 | @ 3:65bd5f99a4a376cdea23a1153f07856b0d881d64 |
|
87 | 87 | | |
|
88 | 88 | | o 2:264128213d290d868c54642d13aeaa3675551a78 |
|
89 | 89 | |/ |
|
90 | 90 | o 1:ef3a871183d7199c541cc140218298bbfcc6c28a |
|
91 | 91 | | |
|
92 | 92 | o 0:9ab35a2d17cb64271241ea881efcc19dd953215b |
|
93 | 93 | |
|
94 | 94 | $ teststrip 4 3 |
|
95 | 95 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
96 | 96 | % before update 4, strip 3 |
|
97 | 97 | @ 4:443431ffac4f5b5a19b0b6c298a21b7ba736bcce |
|
98 | 98 | | |
|
99 | 99 | o 3:65bd5f99a4a376cdea23a1153f07856b0d881d64 |
|
100 | 100 | | |
|
101 | 101 | | o 2:264128213d290d868c54642d13aeaa3675551a78 |
|
102 | 102 | |/ |
|
103 | 103 | o 1:ef3a871183d7199c541cc140218298bbfcc6c28a |
|
104 | 104 | | |
|
105 | 105 | o 0:9ab35a2d17cb64271241ea881efcc19dd953215b |
|
106 | 106 | |
|
107 | 107 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
108 | 108 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
109 | 109 | % after update 4, strip 3 |
|
110 | 110 | o 2:264128213d290d868c54642d13aeaa3675551a78 |
|
111 | 111 | | |
|
112 | 112 | @ 1:ef3a871183d7199c541cc140218298bbfcc6c28a |
|
113 | 113 | | |
|
114 | 114 | o 0:9ab35a2d17cb64271241ea881efcc19dd953215b |
|
115 | 115 | |
|
116 | 116 | $ teststrip 1 4 |
|
117 | 117 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
118 | 118 | % before update 1, strip 4 |
|
119 | 119 | o 4:443431ffac4f5b5a19b0b6c298a21b7ba736bcce |
|
120 | 120 | | |
|
121 | 121 | o 3:65bd5f99a4a376cdea23a1153f07856b0d881d64 |
|
122 | 122 | | |
|
123 | 123 | | o 2:264128213d290d868c54642d13aeaa3675551a78 |
|
124 | 124 | |/ |
|
125 | 125 | @ 1:ef3a871183d7199c541cc140218298bbfcc6c28a |
|
126 | 126 | | |
|
127 | 127 | o 0:9ab35a2d17cb64271241ea881efcc19dd953215b |
|
128 | 128 | |
|
129 | 129 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
130 | 130 | % after update 1, strip 4 |
|
131 | 131 | o 3:65bd5f99a4a376cdea23a1153f07856b0d881d64 |
|
132 | 132 | | |
|
133 | 133 | | o 2:264128213d290d868c54642d13aeaa3675551a78 |
|
134 | 134 | |/ |
|
135 | 135 | @ 1:ef3a871183d7199c541cc140218298bbfcc6c28a |
|
136 | 136 | | |
|
137 | 137 | o 0:9ab35a2d17cb64271241ea881efcc19dd953215b |
|
138 | 138 | |
|
139 | 139 | $ teststrip 4 2 |
|
140 | 140 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
141 | 141 | % before update 4, strip 2 |
|
142 | 142 | @ 4:443431ffac4f5b5a19b0b6c298a21b7ba736bcce |
|
143 | 143 | | |
|
144 | 144 | o 3:65bd5f99a4a376cdea23a1153f07856b0d881d64 |
|
145 | 145 | | |
|
146 | 146 | | o 2:264128213d290d868c54642d13aeaa3675551a78 |
|
147 | 147 | |/ |
|
148 | 148 | o 1:ef3a871183d7199c541cc140218298bbfcc6c28a |
|
149 | 149 | | |
|
150 | 150 | o 0:9ab35a2d17cb64271241ea881efcc19dd953215b |
|
151 | 151 | |
|
152 | 152 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
153 | 153 | % after update 4, strip 2 |
|
154 | 154 | @ 3:443431ffac4f5b5a19b0b6c298a21b7ba736bcce |
|
155 | 155 | | |
|
156 | 156 | o 2:65bd5f99a4a376cdea23a1153f07856b0d881d64 |
|
157 | 157 | | |
|
158 | 158 | o 1:ef3a871183d7199c541cc140218298bbfcc6c28a |
|
159 | 159 | | |
|
160 | 160 | o 0:9ab35a2d17cb64271241ea881efcc19dd953215b |
|
161 | 161 | |
|
162 | 162 | $ teststrip 4 1 |
|
163 | 163 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
164 | 164 | % before update 4, strip 1 |
|
165 | 165 | @ 4:264128213d290d868c54642d13aeaa3675551a78 |
|
166 | 166 | | |
|
167 | 167 | | o 3:443431ffac4f5b5a19b0b6c298a21b7ba736bcce |
|
168 | 168 | | | |
|
169 | 169 | | o 2:65bd5f99a4a376cdea23a1153f07856b0d881d64 |
|
170 | 170 | |/ |
|
171 | 171 | o 1:ef3a871183d7199c541cc140218298bbfcc6c28a |
|
172 | 172 | | |
|
173 | 173 | o 0:9ab35a2d17cb64271241ea881efcc19dd953215b |
|
174 | 174 | |
|
175 | 175 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
176 | 176 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
177 | 177 | % after update 4, strip 1 |
|
178 | 178 | @ 0:9ab35a2d17cb64271241ea881efcc19dd953215b |
|
179 | 179 | |
|
180 | 180 | $ teststrip null 4 |
|
181 | 181 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
182 | 182 | % before update null, strip 4 |
|
183 | 183 | o 4:264128213d290d868c54642d13aeaa3675551a78 |
|
184 | 184 | | |
|
185 | 185 | | o 3:443431ffac4f5b5a19b0b6c298a21b7ba736bcce |
|
186 | 186 | | | |
|
187 | 187 | | o 2:65bd5f99a4a376cdea23a1153f07856b0d881d64 |
|
188 | 188 | |/ |
|
189 | 189 | o 1:ef3a871183d7199c541cc140218298bbfcc6c28a |
|
190 | 190 | | |
|
191 | 191 | o 0:9ab35a2d17cb64271241ea881efcc19dd953215b |
|
192 | 192 | |
|
193 | 193 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
194 | 194 | % after update null, strip 4 |
|
195 | 195 | o 3:443431ffac4f5b5a19b0b6c298a21b7ba736bcce |
|
196 | 196 | | |
|
197 | 197 | o 2:65bd5f99a4a376cdea23a1153f07856b0d881d64 |
|
198 | 198 | | |
|
199 | 199 | o 1:ef3a871183d7199c541cc140218298bbfcc6c28a |
|
200 | 200 | | |
|
201 | 201 | o 0:9ab35a2d17cb64271241ea881efcc19dd953215b |
|
202 | 202 | |
|
203 | 203 | |
|
204 | 204 | $ hg log |
|
205 | 205 | changeset: 4:264128213d29 |
|
206 | 206 | tag: tip |
|
207 | 207 | parent: 1:ef3a871183d7 |
|
208 | 208 | user: test |
|
209 | 209 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
210 | 210 | summary: c |
|
211 | 211 | |
|
212 | 212 | changeset: 3:443431ffac4f |
|
213 | 213 | user: test |
|
214 | 214 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
215 | 215 | summary: e |
|
216 | 216 | |
|
217 | 217 | changeset: 2:65bd5f99a4a3 |
|
218 | 218 | user: test |
|
219 | 219 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
220 | 220 | summary: d |
|
221 | 221 | |
|
222 | 222 | changeset: 1:ef3a871183d7 |
|
223 | 223 | user: test |
|
224 | 224 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
225 | 225 | summary: b |
|
226 | 226 | |
|
227 | 227 | changeset: 0:9ab35a2d17cb |
|
228 | 228 | user: test |
|
229 | 229 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
230 | 230 | summary: a |
|
231 | 231 | |
|
232 | 232 | $ hg up -C 4 |
|
233 | 233 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
234 | 234 | $ hg parents |
|
235 | 235 | changeset: 4:264128213d29 |
|
236 | 236 | tag: tip |
|
237 | 237 | parent: 1:ef3a871183d7 |
|
238 | 238 | user: test |
|
239 | 239 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
240 | 240 | summary: c |
|
241 | 241 | |
|
242 | 242 | |
|
243 | 243 | $ hg --traceback strip 4 |
|
244 | 244 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
245 | 245 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/264128213d29-0b39d6bf-backup.hg |
|
246 | 246 | $ hg parents |
|
247 | 247 | changeset: 1:ef3a871183d7 |
|
248 | 248 | user: test |
|
249 | 249 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
250 | 250 | summary: b |
|
251 | 251 | |
|
252 | 252 | $ hg debugbundle .hg/strip-backup/* |
|
253 | 253 | Stream params: {Compression: BZ} |
|
254 | 254 | changegroup -- {nbchanges: 1, version: 02} (mandatory: True) |
|
255 | 255 | 264128213d290d868c54642d13aeaa3675551a78 |
|
256 | 256 | cache:rev-branch-cache -- {} (mandatory: False) |
|
257 | 257 | phase-heads -- {} (mandatory: True) |
|
258 | 258 | 264128213d290d868c54642d13aeaa3675551a78 draft |
|
259 | 259 | $ hg unbundle .hg/strip-backup/* |
|
260 | 260 | adding changesets |
|
261 | 261 | adding manifests |
|
262 | 262 | adding file changes |
|
263 | 263 | added 1 changesets with 0 changes to 1 files (+1 heads) |
|
264 | 264 | new changesets 264128213d29 (1 drafts) |
|
265 | 265 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
266 | 266 | $ rm .hg/strip-backup/* |
|
267 | 267 | $ hg log --graph |
|
268 | 268 | o changeset: 4:264128213d29 |
|
269 | 269 | | tag: tip |
|
270 | 270 | | parent: 1:ef3a871183d7 |
|
271 | 271 | | user: test |
|
272 | 272 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
273 | 273 | | summary: c |
|
274 | 274 | | |
|
275 | 275 | | o changeset: 3:443431ffac4f |
|
276 | 276 | | | user: test |
|
277 | 277 | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
278 | 278 | | | summary: e |
|
279 | 279 | | | |
|
280 | 280 | | o changeset: 2:65bd5f99a4a3 |
|
281 | 281 | |/ user: test |
|
282 | 282 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
283 | 283 | | summary: d |
|
284 | 284 | | |
|
285 | 285 | @ changeset: 1:ef3a871183d7 |
|
286 | 286 | | user: test |
|
287 | 287 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
288 | 288 | | summary: b |
|
289 | 289 | | |
|
290 | 290 | o changeset: 0:9ab35a2d17cb |
|
291 | 291 | user: test |
|
292 | 292 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
293 | 293 | summary: a |
|
294 | 294 | |
|
295 | 295 | $ hg up -C 2 |
|
296 | 296 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
297 | 297 | $ hg merge 4 |
|
298 | 298 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
299 | 299 | (branch merge, don't forget to commit) |
|
300 | 300 | |
|
301 | 301 | before strip of merge parent |
|
302 | 302 | |
|
303 | 303 | $ hg parents |
|
304 | 304 | changeset: 2:65bd5f99a4a3 |
|
305 | 305 | user: test |
|
306 | 306 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
307 | 307 | summary: d |
|
308 | 308 | |
|
309 | 309 | changeset: 4:264128213d29 |
|
310 | 310 | tag: tip |
|
311 | 311 | parent: 1:ef3a871183d7 |
|
312 | 312 | user: test |
|
313 | 313 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
314 | 314 | summary: c |
|
315 | 315 | |
|
316 | 316 | ##strip not allowed with merge in progress |
|
317 | 317 | $ hg strip 4 |
|
318 | 318 | abort: outstanding uncommitted merge |
|
319 | 319 | (use 'hg commit' or 'hg merge --abort') |
|
320 | 320 | [20] |
|
321 | 321 | ##strip allowed --force with merge in progress |
|
322 | 322 | $ hg strip 4 --force |
|
323 | 323 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
324 | 324 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
325 | 325 | |
|
326 | 326 | after strip of merge parent |
|
327 | 327 | |
|
328 | 328 | $ hg parents |
|
329 | 329 | changeset: 1:ef3a871183d7 |
|
330 | 330 | user: test |
|
331 | 331 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
332 | 332 | summary: b |
|
333 | 333 | |
|
334 | 334 | $ restore |
|
335 | 335 | |
|
336 | 336 | $ hg up |
|
337 | 337 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
338 | 338 | updated to "264128213d29: c" |
|
339 | 339 | 1 other heads for branch "default" |
|
340 | 340 | $ hg log -G |
|
341 | 341 | @ changeset: 4:264128213d29 |
|
342 | 342 | | tag: tip |
|
343 | 343 | | parent: 1:ef3a871183d7 |
|
344 | 344 | | user: test |
|
345 | 345 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
346 | 346 | | summary: c |
|
347 | 347 | | |
|
348 | 348 | | o changeset: 3:443431ffac4f |
|
349 | 349 | | | user: test |
|
350 | 350 | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
351 | 351 | | | summary: e |
|
352 | 352 | | | |
|
353 | 353 | | o changeset: 2:65bd5f99a4a3 |
|
354 | 354 | |/ user: test |
|
355 | 355 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
356 | 356 | | summary: d |
|
357 | 357 | | |
|
358 | 358 | o changeset: 1:ef3a871183d7 |
|
359 | 359 | | user: test |
|
360 | 360 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
361 | 361 | | summary: b |
|
362 | 362 | | |
|
363 | 363 | o changeset: 0:9ab35a2d17cb |
|
364 | 364 | user: test |
|
365 | 365 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
366 | 366 | summary: a |
|
367 | 367 | |
|
368 | 368 | |
|
369 | 369 | 2 is parent of 3, only one strip should happen |
|
370 | 370 | |
|
371 | 371 | $ hg strip "roots(2)" 3 |
|
372 | 372 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
373 | 373 | $ hg log -G |
|
374 | 374 | @ changeset: 2:264128213d29 |
|
375 | 375 | | tag: tip |
|
376 | 376 | | user: test |
|
377 | 377 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
378 | 378 | | summary: c |
|
379 | 379 | | |
|
380 | 380 | o changeset: 1:ef3a871183d7 |
|
381 | 381 | | user: test |
|
382 | 382 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
383 | 383 | | summary: b |
|
384 | 384 | | |
|
385 | 385 | o changeset: 0:9ab35a2d17cb |
|
386 | 386 | user: test |
|
387 | 387 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
388 | 388 | summary: a |
|
389 | 389 | |
|
390 | 390 | $ restore |
|
391 | 391 | $ hg log -G |
|
392 | 392 | o changeset: 4:443431ffac4f |
|
393 | 393 | | tag: tip |
|
394 | 394 | | user: test |
|
395 | 395 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
396 | 396 | | summary: e |
|
397 | 397 | | |
|
398 | 398 | o changeset: 3:65bd5f99a4a3 |
|
399 | 399 | | parent: 1:ef3a871183d7 |
|
400 | 400 | | user: test |
|
401 | 401 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
402 | 402 | | summary: d |
|
403 | 403 | | |
|
404 | 404 | | @ changeset: 2:264128213d29 |
|
405 | 405 | |/ user: test |
|
406 | 406 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
407 | 407 | | summary: c |
|
408 | 408 | | |
|
409 | 409 | o changeset: 1:ef3a871183d7 |
|
410 | 410 | | user: test |
|
411 | 411 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
412 | 412 | | summary: b |
|
413 | 413 | | |
|
414 | 414 | o changeset: 0:9ab35a2d17cb |
|
415 | 415 | user: test |
|
416 | 416 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
417 | 417 | summary: a |
|
418 | 418 | |
|
419 | 419 | Failed hook while applying "saveheads" bundle. |
|
420 | 420 | |
|
421 | 421 | $ hg strip 2 --config hooks.pretxnchangegroup.bad=false |
|
422 | 422 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
423 | 423 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
424 | 424 | transaction abort! |
|
425 | 425 | rollback completed |
|
426 | 426 | strip failed, backup bundle stored in '$TESTTMP/test/.hg/strip-backup/*-backup.hg' (glob) |
|
427 | 427 | strip failed, unrecovered changes stored in '$TESTTMP/test/.hg/strip-backup/*-temp.hg' (glob) |
|
428 | 428 | (fix the problem, then recover the changesets with "hg unbundle '$TESTTMP/test/.hg/strip-backup/*-temp.hg'") (glob) |
|
429 | 429 | abort: pretxnchangegroup.bad hook exited with status 1 |
|
430 | 430 | [255] |
|
431 | 431 | $ restore |
|
432 | 432 | $ hg log -G |
|
433 | 433 | o changeset: 4:443431ffac4f |
|
434 | 434 | | tag: tip |
|
435 | 435 | | user: test |
|
436 | 436 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
437 | 437 | | summary: e |
|
438 | 438 | | |
|
439 | 439 | o changeset: 3:65bd5f99a4a3 |
|
440 | 440 | | parent: 1:ef3a871183d7 |
|
441 | 441 | | user: test |
|
442 | 442 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
443 | 443 | | summary: d |
|
444 | 444 | | |
|
445 | 445 | | o changeset: 2:264128213d29 |
|
446 | 446 | |/ user: test |
|
447 | 447 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
448 | 448 | | summary: c |
|
449 | 449 | | |
|
450 | 450 | @ changeset: 1:ef3a871183d7 |
|
451 | 451 | | user: test |
|
452 | 452 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
453 | 453 | | summary: b |
|
454 | 454 | | |
|
455 | 455 | o changeset: 0:9ab35a2d17cb |
|
456 | 456 | user: test |
|
457 | 457 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
458 | 458 | summary: a |
|
459 | 459 | |
|
460 | 460 | |
|
461 | 461 | 2 different branches: 2 strips |
|
462 | 462 | |
|
463 | 463 | $ hg strip 2 4 |
|
464 | 464 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
465 | 465 | $ hg log -G |
|
466 | 466 | o changeset: 2:65bd5f99a4a3 |
|
467 | 467 | | tag: tip |
|
468 | 468 | | user: test |
|
469 | 469 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
470 | 470 | | summary: d |
|
471 | 471 | | |
|
472 | 472 | @ changeset: 1:ef3a871183d7 |
|
473 | 473 | | user: test |
|
474 | 474 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
475 | 475 | | summary: b |
|
476 | 476 | | |
|
477 | 477 | o changeset: 0:9ab35a2d17cb |
|
478 | 478 | user: test |
|
479 | 479 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
480 | 480 | summary: a |
|
481 | 481 | |
|
482 | 482 | $ restore |
|
483 | 483 | |
|
484 | 484 | 2 different branches and a common ancestor: 1 strip |
|
485 | 485 | |
|
486 | 486 | $ hg strip 1 "2|4" |
|
487 | 487 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
488 | 488 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
489 | 489 | $ restore |
|
490 | 490 | |
|
491 | 491 | verify fncache is kept up-to-date |
|
492 | 492 | |
|
493 | 493 | $ touch a |
|
494 | 494 | $ hg ci -qAm a |
|
495 | 495 | #if repofncache |
|
496 | 496 | $ cat .hg/store/fncache | sort |
|
497 | 497 | data/a.i |
|
498 | 498 | data/bar.i |
|
499 | 499 | #endif |
|
500 | 500 | |
|
501 | 501 | $ hg strip tip |
|
502 | 502 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
503 | 503 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
504 | 504 | #if repofncache |
|
505 | 505 | $ cat .hg/store/fncache |
|
506 | 506 | data/bar.i |
|
507 | 507 | #endif |
|
508 | 508 | |
|
509 | 509 | stripping an empty revset |
|
510 | 510 | |
|
511 | 511 | $ hg strip "1 and not 1" |
|
512 | 512 | abort: empty revision set |
|
513 | 513 | [255] |
|
514 | 514 | |
|
515 | 515 | remove branchy history for qimport tests |
|
516 | 516 | |
|
517 | 517 | $ hg strip 3 |
|
518 | 518 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
519 | 519 | |
|
520 | 520 | |
|
521 | 521 | strip of applied mq should cleanup status file |
|
522 | 522 | |
|
523 | 523 | $ echo "mq=" >> $HGRCPATH |
|
524 | 524 | $ hg up -C 3 |
|
525 | 525 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
526 | 526 | $ echo fooagain >> bar |
|
527 | 527 | $ hg ci -mf |
|
528 | 528 | $ hg qimport -r tip:2 |
|
529 | 529 | |
|
530 | 530 | applied patches before strip |
|
531 | 531 | |
|
532 | 532 | $ hg qapplied |
|
533 | 533 | d |
|
534 | 534 | e |
|
535 | 535 | f |
|
536 | 536 | |
|
537 | 537 | stripping revision in queue |
|
538 | 538 | |
|
539 | 539 | $ hg strip 3 |
|
540 | 540 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
541 | 541 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
542 | 542 | |
|
543 | 543 | applied patches after stripping rev in queue |
|
544 | 544 | |
|
545 | 545 | $ hg qapplied |
|
546 | 546 | d |
|
547 | 547 | |
|
548 | 548 | stripping ancestor of queue |
|
549 | 549 | |
|
550 | 550 | $ hg strip 1 |
|
551 | 551 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
552 | 552 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
553 | 553 | |
|
554 | 554 | applied patches after stripping ancestor of queue |
|
555 | 555 | |
|
556 | 556 | $ hg qapplied |
|
557 | 557 | |
|
558 | 558 | Verify strip protects against stripping wc parent when there are uncommitted mods |
|
559 | 559 | |
|
560 | 560 | $ echo b > b |
|
561 | 561 | $ echo bb > bar |
|
562 | 562 | $ hg add b |
|
563 | 563 | $ hg ci -m 'b' |
|
564 | 564 | $ hg log --graph |
|
565 | 565 | @ changeset: 1:76dcf9fab855 |
|
566 | 566 | | tag: tip |
|
567 | 567 | | user: test |
|
568 | 568 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
569 | 569 | | summary: b |
|
570 | 570 | | |
|
571 | 571 | o changeset: 0:9ab35a2d17cb |
|
572 | 572 | user: test |
|
573 | 573 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
574 | 574 | summary: a |
|
575 | 575 | |
|
576 | 576 | $ hg up 0 |
|
577 | 577 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
578 | 578 | $ echo c > bar |
|
579 | 579 | $ hg up -t false |
|
580 | 580 | merging bar |
|
581 | 581 | merging bar failed! |
|
582 | 582 | 1 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
583 | 583 | use 'hg resolve' to retry unresolved file merges |
|
584 | 584 | [1] |
|
585 | 585 | $ hg sum |
|
586 | 586 | parent: 1:76dcf9fab855 tip |
|
587 | 587 | b |
|
588 | 588 | branch: default |
|
589 | 589 | commit: 1 modified, 1 unknown, 1 unresolved |
|
590 | 590 | update: (current) |
|
591 | 591 | phases: 2 draft |
|
592 | 592 | mq: 3 unapplied |
|
593 | 593 | |
|
594 | 594 | $ hg log --graph |
|
595 | 595 | @ changeset: 1:76dcf9fab855 |
|
596 | 596 | | tag: tip |
|
597 | 597 | | user: test |
|
598 | 598 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
599 | 599 | | summary: b |
|
600 | 600 | | |
|
601 | 601 | % changeset: 0:9ab35a2d17cb |
|
602 | 602 | user: test |
|
603 | 603 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
604 | 604 | summary: a |
|
605 | 605 | |
|
606 | 606 | $ echo c > b |
|
607 | 607 | $ hg strip tip |
|
608 | 608 | abort: uncommitted changes |
|
609 | 609 | [20] |
|
610 | 610 | $ hg strip tip --keep |
|
611 | 611 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
612 | 612 | $ hg log --graph |
|
613 | 613 | @ changeset: 0:9ab35a2d17cb |
|
614 | 614 | tag: tip |
|
615 | 615 | user: test |
|
616 | 616 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
617 | 617 | summary: a |
|
618 | 618 | |
|
619 | 619 | $ hg status |
|
620 | 620 | M bar |
|
621 | 621 | ? b |
|
622 | 622 | ? bar.orig |
|
623 | 623 | |
|
624 | 624 | $ rm bar.orig |
|
625 | 625 | $ hg sum |
|
626 | 626 | parent: 0:9ab35a2d17cb tip |
|
627 | 627 | a |
|
628 | 628 | branch: default |
|
629 | 629 | commit: 1 modified, 1 unknown |
|
630 | 630 | update: (current) |
|
631 | 631 | phases: 1 draft |
|
632 | 632 | mq: 3 unapplied |
|
633 | 633 | |
|
634 | 634 | Strip adds, removes, modifies with --keep |
|
635 | 635 | |
|
636 | 636 | $ touch b |
|
637 | 637 | $ hg add b |
|
638 | 638 | $ hg commit -mb |
|
639 | 639 | $ touch c |
|
640 | 640 | |
|
641 | 641 | ... with a clean working dir |
|
642 | 642 | |
|
643 | 643 | $ hg add c |
|
644 | 644 | $ hg rm bar |
|
645 | 645 | $ hg commit -mc |
|
646 | 646 | $ hg status |
|
647 | 647 | $ hg strip --keep tip |
|
648 | 648 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
649 | 649 | $ hg status |
|
650 | 650 | ! bar |
|
651 | 651 | ? c |
|
652 | 652 | |
|
653 | 653 | ... with a dirty working dir |
|
654 | 654 | |
|
655 | 655 | $ hg add c |
|
656 | 656 | $ hg rm bar |
|
657 | 657 | $ hg commit -mc |
|
658 | 658 | $ hg status |
|
659 | 659 | $ echo b > b |
|
660 | 660 | $ echo d > d |
|
661 | 661 | $ hg strip --keep tip |
|
662 | 662 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) |
|
663 | 663 | $ hg status |
|
664 | 664 | M b |
|
665 | 665 | ! bar |
|
666 | 666 | ? c |
|
667 | 667 | ? d |
|
668 | 668 | |
|
669 | 669 | ... after updating the dirstate |
|
670 | 670 | $ hg add c |
|
671 | 671 | $ hg commit -mc |
|
672 | 672 | $ hg rm c |
|
673 | 673 | $ hg commit -mc |
|
674 | 674 | $ hg strip --keep '.^' -q |
|
675 | 675 | $ cd .. |
|
676 | 676 | |
|
677 | 677 | stripping many nodes on a complex graph (issue3299) |
|
678 | 678 | |
|
679 | 679 | $ hg init issue3299 |
|
680 | 680 | $ cd issue3299 |
|
681 | 681 | $ hg debugbuilddag '@a.:a@b.:b.:x<a@a.:a<b@b.:b<a@a.:a' |
|
682 | 682 | $ hg strip 'not ancestors(x)' |
|
683 | 683 | saved backup bundle to $TESTTMP/issue3299/.hg/strip-backup/*-backup.hg (glob) |
|
684 | 684 | |
|
685 | 685 | test hg strip -B bookmark |
|
686 | 686 | |
|
687 | 687 | $ cd .. |
|
688 | 688 | $ hg init bookmarks |
|
689 | 689 | $ cd bookmarks |
|
690 | 690 | $ hg debugbuilddag '..<2.*1/2:m<2+3:c<m+3:a<2.:b<m+2:d<2.:e<m+1:f' |
|
691 | 691 | $ hg bookmark -r 'a' 'todelete' |
|
692 | 692 | $ hg bookmark -r 'b' 'B' |
|
693 | 693 | $ hg bookmark -r 'b' 'nostrip' |
|
694 | 694 | $ hg bookmark -r 'c' 'delete' |
|
695 | 695 | $ hg bookmark -r 'd' 'multipledelete1' |
|
696 | 696 | $ hg bookmark -r 'e' 'multipledelete2' |
|
697 | 697 | $ hg bookmark -r 'f' 'singlenode1' |
|
698 | 698 | $ hg bookmark -r 'f' 'singlenode2' |
|
699 | 699 | $ hg up -C todelete |
|
700 | 700 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
701 | 701 | (activating bookmark todelete) |
|
702 | 702 | $ hg strip -B nostrip |
|
703 | 703 | bookmark 'nostrip' deleted |
|
704 | 704 | abort: empty revision set |
|
705 | 705 | [255] |
|
706 | 706 | $ hg strip -B todelete |
|
707 | 707 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
708 | 708 | saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/*-backup.hg (glob) |
|
709 | 709 | bookmark 'todelete' deleted |
|
710 | 710 | $ hg id -ir dcbb326fdec2 |
|
711 | 711 | abort: unknown revision 'dcbb326fdec2' |
|
712 | 712 | [255] |
|
713 | 713 | $ hg id -ir d62d843c9a01 |
|
714 | 714 | d62d843c9a01 |
|
715 | 715 | $ hg bookmarks |
|
716 | 716 | B 9:ff43616e5d0f |
|
717 | 717 | delete 6:2702dd0c91e7 |
|
718 | 718 | multipledelete1 11:e46a4836065c |
|
719 | 719 | multipledelete2 12:b4594d867745 |
|
720 | 720 | singlenode1 13:43227190fef8 |
|
721 | 721 | singlenode2 13:43227190fef8 |
|
722 | 722 | $ hg strip -B multipledelete1 -B multipledelete2 |
|
723 | 723 | saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/e46a4836065c-89ec65c2-backup.hg |
|
724 | 724 | bookmark 'multipledelete1' deleted |
|
725 | 725 | bookmark 'multipledelete2' deleted |
|
726 | 726 | $ hg id -ir e46a4836065c |
|
727 | 727 | abort: unknown revision 'e46a4836065c' |
|
728 | 728 | [255] |
|
729 | 729 | $ hg id -ir b4594d867745 |
|
730 | 730 | abort: unknown revision 'b4594d867745' |
|
731 | 731 | [255] |
|
732 | 732 | $ hg strip -B singlenode1 -B singlenode2 |
|
733 | 733 | saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/43227190fef8-8da858f2-backup.hg |
|
734 | 734 | bookmark 'singlenode1' deleted |
|
735 | 735 | bookmark 'singlenode2' deleted |
|
736 | 736 | $ hg id -ir 43227190fef8 |
|
737 | 737 | abort: unknown revision '43227190fef8' |
|
738 | 738 | [255] |
|
739 | 739 | $ hg strip -B unknownbookmark |
|
740 | 740 | abort: bookmark 'unknownbookmark' not found |
|
741 | 741 | [255] |
|
742 | 742 | $ hg strip -B unknownbookmark1 -B unknownbookmark2 |
|
743 | 743 | abort: bookmark 'unknownbookmark1,unknownbookmark2' not found |
|
744 | 744 | [255] |
|
745 | 745 | $ hg strip -B delete -B unknownbookmark |
|
746 | 746 | abort: bookmark 'unknownbookmark' not found |
|
747 | 747 | [255] |
|
748 | 748 | $ hg strip -B delete |
|
749 | 749 | saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/*-backup.hg (glob) |
|
750 | 750 | bookmark 'delete' deleted |
|
751 | 751 | $ hg id -ir 6:2702dd0c91e7 |
|
752 | 752 | abort: unknown revision '2702dd0c91e7' |
|
753 | 753 | [255] |
|
754 | 754 | $ hg update B |
|
755 | 755 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
756 | 756 | (activating bookmark B) |
|
757 | 757 | $ echo a > a |
|
758 | 758 | $ hg add a |
|
759 | 759 | $ hg strip -B B |
|
760 | 760 | abort: uncommitted changes |
|
761 | 761 | [20] |
|
762 | 762 | $ hg bookmarks |
|
763 | 763 | * B 6:ff43616e5d0f |
|
764 | 764 | |
|
765 | 765 | Make sure no one adds back a -b option: |
|
766 | 766 | |
|
767 | 767 | $ hg strip -b tip |
|
768 | 768 | hg debugstrip: option -b not recognized |
|
769 | 769 | hg debugstrip [-k] [-f] [-B bookmark] [-r] REV... |
|
770 | 770 | |
|
771 | 771 | strip changesets and all their descendants from the repository |
|
772 | 772 | |
|
773 | 773 | options ([+] can be repeated): |
|
774 | 774 | |
|
775 | 775 | -r --rev REV [+] strip specified revision (optional, can specify |
|
776 | 776 | revisions without this option) |
|
777 | 777 | -f --force force removal of changesets, discard uncommitted |
|
778 | 778 | changes (no backup) |
|
779 | 779 | --no-backup do not save backup bundle |
|
780 | 780 | -k --keep do not modify working directory during strip |
|
781 | 781 | -B --bookmark BOOKMARK [+] remove revs only reachable from given bookmark |
|
782 | 782 | --mq operate on patch repository |
|
783 | 783 | |
|
784 | 784 | (use 'hg debugstrip -h' to show more help) |
|
785 |
[ |
|
|
785 | [10] | |
|
786 | 786 | |
|
787 | 787 | $ cd .. |
|
788 | 788 | |
|
789 | 789 | Verify bundles don't get overwritten: |
|
790 | 790 | |
|
791 | 791 | $ hg init doublebundle |
|
792 | 792 | $ cd doublebundle |
|
793 | 793 | $ touch a |
|
794 | 794 | $ hg commit -Aqm a |
|
795 | 795 | $ touch b |
|
796 | 796 | $ hg commit -Aqm b |
|
797 | 797 | $ hg strip -r 0 |
|
798 | 798 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
799 | 799 | saved backup bundle to $TESTTMP/doublebundle/.hg/strip-backup/3903775176ed-e68910bd-backup.hg |
|
800 | 800 | $ ls .hg/strip-backup |
|
801 | 801 | 3903775176ed-e68910bd-backup.hg |
|
802 | 802 | #if repobundlerepo |
|
803 | 803 | $ hg pull -q -r 3903775176ed .hg/strip-backup/3903775176ed-e68910bd-backup.hg |
|
804 | 804 | $ hg strip -r 0 |
|
805 | 805 | saved backup bundle to $TESTTMP/doublebundle/.hg/strip-backup/3903775176ed-54390173-backup.hg |
|
806 | 806 | $ ls .hg/strip-backup |
|
807 | 807 | 3903775176ed-54390173-backup.hg |
|
808 | 808 | 3903775176ed-e68910bd-backup.hg |
|
809 | 809 | #endif |
|
810 | 810 | $ cd .. |
|
811 | 811 | |
|
812 | 812 | Test that we only bundle the stripped changesets (issue4736) |
|
813 | 813 | ------------------------------------------------------------ |
|
814 | 814 | |
|
815 | 815 | initialization (previous repo is empty anyway) |
|
816 | 816 | |
|
817 | 817 | $ hg init issue4736 |
|
818 | 818 | $ cd issue4736 |
|
819 | 819 | $ echo a > a |
|
820 | 820 | $ hg add a |
|
821 | 821 | $ hg commit -m commitA |
|
822 | 822 | $ echo b > b |
|
823 | 823 | $ hg add b |
|
824 | 824 | $ hg commit -m commitB |
|
825 | 825 | $ echo c > c |
|
826 | 826 | $ hg add c |
|
827 | 827 | $ hg commit -m commitC |
|
828 | 828 | $ hg up 'desc(commitB)' |
|
829 | 829 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
830 | 830 | $ echo d > d |
|
831 | 831 | $ hg add d |
|
832 | 832 | $ hg commit -m commitD |
|
833 | 833 | created new head |
|
834 | 834 | $ hg up 'desc(commitC)' |
|
835 | 835 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
836 | 836 | $ hg merge 'desc(commitD)' |
|
837 | 837 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
838 | 838 | (branch merge, don't forget to commit) |
|
839 | 839 | $ hg ci -m 'mergeCD' |
|
840 | 840 | $ hg log -G |
|
841 | 841 | @ changeset: 4:d8db9d137221 |
|
842 | 842 | |\ tag: tip |
|
843 | 843 | | | parent: 2:5c51d8d6557d |
|
844 | 844 | | | parent: 3:6625a5168474 |
|
845 | 845 | | | user: test |
|
846 | 846 | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
847 | 847 | | | summary: mergeCD |
|
848 | 848 | | | |
|
849 | 849 | | o changeset: 3:6625a5168474 |
|
850 | 850 | | | parent: 1:eca11cf91c71 |
|
851 | 851 | | | user: test |
|
852 | 852 | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
853 | 853 | | | summary: commitD |
|
854 | 854 | | | |
|
855 | 855 | o | changeset: 2:5c51d8d6557d |
|
856 | 856 | |/ user: test |
|
857 | 857 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
858 | 858 | | summary: commitC |
|
859 | 859 | | |
|
860 | 860 | o changeset: 1:eca11cf91c71 |
|
861 | 861 | | user: test |
|
862 | 862 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
863 | 863 | | summary: commitB |
|
864 | 864 | | |
|
865 | 865 | o changeset: 0:105141ef12d0 |
|
866 | 866 | user: test |
|
867 | 867 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
868 | 868 | summary: commitA |
|
869 | 869 | |
|
870 | 870 | |
|
871 | 871 | Check bundle behavior: |
|
872 | 872 | |
|
873 | 873 | $ hg bundle -r 'desc(mergeCD)' --base 'desc(commitC)' ../issue4736.hg |
|
874 | 874 | 2 changesets found |
|
875 | 875 | #if repobundlerepo |
|
876 | 876 | $ hg log -r 'bundle()' -R ../issue4736.hg |
|
877 | 877 | changeset: 3:6625a5168474 |
|
878 | 878 | parent: 1:eca11cf91c71 |
|
879 | 879 | user: test |
|
880 | 880 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
881 | 881 | summary: commitD |
|
882 | 882 | |
|
883 | 883 | changeset: 4:d8db9d137221 |
|
884 | 884 | tag: tip |
|
885 | 885 | parent: 2:5c51d8d6557d |
|
886 | 886 | parent: 3:6625a5168474 |
|
887 | 887 | user: test |
|
888 | 888 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
889 | 889 | summary: mergeCD |
|
890 | 890 | |
|
891 | 891 | #endif |
|
892 | 892 | |
|
893 | 893 | check strip behavior |
|
894 | 894 | |
|
895 | 895 | $ hg --config extensions.strip= strip 'desc(commitD)' --debug |
|
896 | 896 | resolving manifests |
|
897 | 897 | branchmerge: False, force: True, partial: False |
|
898 | 898 | ancestor: d8db9d137221+, local: d8db9d137221+, remote: eca11cf91c71 |
|
899 | 899 | c: other deleted -> r |
|
900 | 900 | removing c |
|
901 | 901 | d: other deleted -> r |
|
902 | 902 | removing d |
|
903 | 903 | starting 4 threads for background file closing (?) |
|
904 | 904 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
905 | 905 | 2 changesets found |
|
906 | 906 | list of changesets: |
|
907 | 907 | 6625a516847449b6f0fa3737b9ba56e9f0f3032c |
|
908 | 908 | d8db9d1372214336d2b5570f20ee468d2c72fa8b |
|
909 | 909 | bundle2-output-bundle: "HG20", (1 params) 3 parts total |
|
910 | 910 | bundle2-output-part: "changegroup" (params: 1 mandatory 1 advisory) streamed payload |
|
911 | 911 | bundle2-output-part: "cache:rev-branch-cache" (advisory) streamed payload |
|
912 | 912 | bundle2-output-part: "phase-heads" 24 bytes payload |
|
913 | 913 | saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/6625a5168474-345bb43d-backup.hg |
|
914 | 914 | updating the branch cache |
|
915 | 915 | invalid branch cache (served): tip differs |
|
916 | 916 | $ hg log -G |
|
917 | 917 | o changeset: 2:5c51d8d6557d |
|
918 | 918 | | tag: tip |
|
919 | 919 | | user: test |
|
920 | 920 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
921 | 921 | | summary: commitC |
|
922 | 922 | | |
|
923 | 923 | @ changeset: 1:eca11cf91c71 |
|
924 | 924 | | user: test |
|
925 | 925 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
926 | 926 | | summary: commitB |
|
927 | 927 | | |
|
928 | 928 | o changeset: 0:105141ef12d0 |
|
929 | 929 | user: test |
|
930 | 930 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
931 | 931 | summary: commitA |
|
932 | 932 | |
|
933 | 933 | |
|
934 | 934 | strip backup content |
|
935 | 935 | |
|
936 | 936 | #if repobundlerepo |
|
937 | 937 | $ hg log -r 'bundle()' -R .hg/strip-backup/6625a5168474-*-backup.hg |
|
938 | 938 | changeset: 3:6625a5168474 |
|
939 | 939 | parent: 1:eca11cf91c71 |
|
940 | 940 | user: test |
|
941 | 941 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
942 | 942 | summary: commitD |
|
943 | 943 | |
|
944 | 944 | changeset: 4:d8db9d137221 |
|
945 | 945 | tag: tip |
|
946 | 946 | parent: 2:5c51d8d6557d |
|
947 | 947 | parent: 3:6625a5168474 |
|
948 | 948 | user: test |
|
949 | 949 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
950 | 950 | summary: mergeCD |
|
951 | 951 | |
|
952 | 952 | |
|
953 | 953 | #endif |
|
954 | 954 | |
|
955 | 955 | Check that the phase cache is properly invalidated after a strip with bookmark. |
|
956 | 956 | |
|
957 | 957 | $ cat > ../stripstalephasecache.py << EOF |
|
958 | 958 | > from mercurial import extensions, localrepo |
|
959 | 959 | > def transactioncallback(orig, repo, desc, *args, **kwargs): |
|
960 | 960 | > def test(transaction): |
|
961 | 961 | > # observe cache inconsistency |
|
962 | 962 | > try: |
|
963 | 963 | > [repo.changelog.node(r) for r in repo.revs(b"not public()")] |
|
964 | 964 | > except IndexError: |
|
965 | 965 | > repo.ui.status(b"Index error!\n") |
|
966 | 966 | > transaction = orig(repo, desc, *args, **kwargs) |
|
967 | 967 | > # warm up the phase cache |
|
968 | 968 | > list(repo.revs(b"not public()")) |
|
969 | 969 | > if desc != b'strip': |
|
970 | 970 | > transaction.addpostclose(b"phase invalidation test", test) |
|
971 | 971 | > return transaction |
|
972 | 972 | > def extsetup(ui): |
|
973 | 973 | > extensions.wrapfunction(localrepo.localrepository, b"transaction", |
|
974 | 974 | > transactioncallback) |
|
975 | 975 | > EOF |
|
976 | 976 | $ hg up -C 2 |
|
977 | 977 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
978 | 978 | $ echo k > k |
|
979 | 979 | $ hg add k |
|
980 | 980 | $ hg commit -m commitK |
|
981 | 981 | $ echo l > l |
|
982 | 982 | $ hg add l |
|
983 | 983 | $ hg commit -m commitL |
|
984 | 984 | $ hg book -r tip blah |
|
985 | 985 | $ hg strip ".^" --config extensions.crash=$TESTTMP/stripstalephasecache.py |
|
986 | 986 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
987 | 987 | saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/8f0b4384875c-4fa10deb-backup.hg |
|
988 | 988 | $ hg up -C 1 |
|
989 | 989 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
990 | 990 | |
|
991 | 991 | Error during post-close callback of the strip transaction |
|
992 | 992 | (They should be gracefully handled and reported) |
|
993 | 993 | |
|
994 | 994 | $ cat > ../crashstrip.py << EOF |
|
995 | 995 | > from mercurial import error |
|
996 | 996 | > def reposetup(ui, repo): |
|
997 | 997 | > class crashstriprepo(repo.__class__): |
|
998 | 998 | > def transaction(self, desc, *args, **kwargs): |
|
999 | 999 | > tr = super(crashstriprepo, self).transaction(desc, *args, **kwargs) |
|
1000 | 1000 | > if desc == b'strip': |
|
1001 | 1001 | > def crash(tra): raise error.Abort(b'boom') |
|
1002 | 1002 | > tr.addpostclose(b'crash', crash) |
|
1003 | 1003 | > return tr |
|
1004 | 1004 | > repo.__class__ = crashstriprepo |
|
1005 | 1005 | > EOF |
|
1006 | 1006 | $ hg strip tip --config extensions.crash=$TESTTMP/crashstrip.py |
|
1007 | 1007 | saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/5c51d8d6557d-70daef06-backup.hg |
|
1008 | 1008 | strip failed, backup bundle stored in '$TESTTMP/issue4736/.hg/strip-backup/5c51d8d6557d-70daef06-backup.hg' |
|
1009 | 1009 | abort: boom |
|
1010 | 1010 | [255] |
|
1011 | 1011 | |
|
1012 | 1012 | test stripping a working directory parent doesn't switch named branches |
|
1013 | 1013 | |
|
1014 | 1014 | $ hg log -G |
|
1015 | 1015 | @ changeset: 1:eca11cf91c71 |
|
1016 | 1016 | | tag: tip |
|
1017 | 1017 | | user: test |
|
1018 | 1018 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1019 | 1019 | | summary: commitB |
|
1020 | 1020 | | |
|
1021 | 1021 | o changeset: 0:105141ef12d0 |
|
1022 | 1022 | user: test |
|
1023 | 1023 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1024 | 1024 | summary: commitA |
|
1025 | 1025 | |
|
1026 | 1026 | |
|
1027 | 1027 | $ hg branch new-branch |
|
1028 | 1028 | marked working directory as branch new-branch |
|
1029 | 1029 | (branches are permanent and global, did you want a bookmark?) |
|
1030 | 1030 | $ hg ci -m "start new branch" |
|
1031 | 1031 | $ echo 'foo' > foo.txt |
|
1032 | 1032 | $ hg ci -Aqm foo |
|
1033 | 1033 | $ hg up default |
|
1034 | 1034 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
1035 | 1035 | $ echo 'bar' > bar.txt |
|
1036 | 1036 | $ hg ci -Aqm bar |
|
1037 | 1037 | $ hg up new-branch |
|
1038 | 1038 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
1039 | 1039 | $ hg merge default |
|
1040 | 1040 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1041 | 1041 | (branch merge, don't forget to commit) |
|
1042 | 1042 | $ hg log -G |
|
1043 | 1043 | @ changeset: 4:35358f982181 |
|
1044 | 1044 | | tag: tip |
|
1045 | 1045 | | parent: 1:eca11cf91c71 |
|
1046 | 1046 | | user: test |
|
1047 | 1047 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1048 | 1048 | | summary: bar |
|
1049 | 1049 | | |
|
1050 | 1050 | | @ changeset: 3:f62c6c09b707 |
|
1051 | 1051 | | | branch: new-branch |
|
1052 | 1052 | | | user: test |
|
1053 | 1053 | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1054 | 1054 | | | summary: foo |
|
1055 | 1055 | | | |
|
1056 | 1056 | | o changeset: 2:b1d33a8cadd9 |
|
1057 | 1057 | |/ branch: new-branch |
|
1058 | 1058 | | user: test |
|
1059 | 1059 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1060 | 1060 | | summary: start new branch |
|
1061 | 1061 | | |
|
1062 | 1062 | o changeset: 1:eca11cf91c71 |
|
1063 | 1063 | | user: test |
|
1064 | 1064 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1065 | 1065 | | summary: commitB |
|
1066 | 1066 | | |
|
1067 | 1067 | o changeset: 0:105141ef12d0 |
|
1068 | 1068 | user: test |
|
1069 | 1069 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1070 | 1070 | summary: commitA |
|
1071 | 1071 | |
|
1072 | 1072 | |
|
1073 | 1073 | $ hg strip --force -r 35358f982181 |
|
1074 | 1074 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
1075 | 1075 | saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/35358f982181-50d992d4-backup.hg |
|
1076 | 1076 | $ hg log -G |
|
1077 | 1077 | @ changeset: 3:f62c6c09b707 |
|
1078 | 1078 | | branch: new-branch |
|
1079 | 1079 | | tag: tip |
|
1080 | 1080 | | user: test |
|
1081 | 1081 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1082 | 1082 | | summary: foo |
|
1083 | 1083 | | |
|
1084 | 1084 | o changeset: 2:b1d33a8cadd9 |
|
1085 | 1085 | | branch: new-branch |
|
1086 | 1086 | | user: test |
|
1087 | 1087 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1088 | 1088 | | summary: start new branch |
|
1089 | 1089 | | |
|
1090 | 1090 | o changeset: 1:eca11cf91c71 |
|
1091 | 1091 | | user: test |
|
1092 | 1092 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1093 | 1093 | | summary: commitB |
|
1094 | 1094 | | |
|
1095 | 1095 | o changeset: 0:105141ef12d0 |
|
1096 | 1096 | user: test |
|
1097 | 1097 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1098 | 1098 | summary: commitA |
|
1099 | 1099 | |
|
1100 | 1100 | |
|
1101 | 1101 | $ hg up default |
|
1102 | 1102 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
1103 | 1103 | $ echo 'bar' > bar.txt |
|
1104 | 1104 | $ hg ci -Aqm bar |
|
1105 | 1105 | $ hg up new-branch |
|
1106 | 1106 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
1107 | 1107 | $ hg merge default |
|
1108 | 1108 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1109 | 1109 | (branch merge, don't forget to commit) |
|
1110 | 1110 | $ hg ci -m merge |
|
1111 | 1111 | $ hg log -G |
|
1112 | 1112 | @ changeset: 5:4cf5e92caec2 |
|
1113 | 1113 | |\ branch: new-branch |
|
1114 | 1114 | | | tag: tip |
|
1115 | 1115 | | | parent: 3:f62c6c09b707 |
|
1116 | 1116 | | | parent: 4:35358f982181 |
|
1117 | 1117 | | | user: test |
|
1118 | 1118 | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1119 | 1119 | | | summary: merge |
|
1120 | 1120 | | | |
|
1121 | 1121 | | o changeset: 4:35358f982181 |
|
1122 | 1122 | | | parent: 1:eca11cf91c71 |
|
1123 | 1123 | | | user: test |
|
1124 | 1124 | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1125 | 1125 | | | summary: bar |
|
1126 | 1126 | | | |
|
1127 | 1127 | o | changeset: 3:f62c6c09b707 |
|
1128 | 1128 | | | branch: new-branch |
|
1129 | 1129 | | | user: test |
|
1130 | 1130 | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1131 | 1131 | | | summary: foo |
|
1132 | 1132 | | | |
|
1133 | 1133 | o | changeset: 2:b1d33a8cadd9 |
|
1134 | 1134 | |/ branch: new-branch |
|
1135 | 1135 | | user: test |
|
1136 | 1136 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1137 | 1137 | | summary: start new branch |
|
1138 | 1138 | | |
|
1139 | 1139 | o changeset: 1:eca11cf91c71 |
|
1140 | 1140 | | user: test |
|
1141 | 1141 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1142 | 1142 | | summary: commitB |
|
1143 | 1143 | | |
|
1144 | 1144 | o changeset: 0:105141ef12d0 |
|
1145 | 1145 | user: test |
|
1146 | 1146 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1147 | 1147 | summary: commitA |
|
1148 | 1148 | |
|
1149 | 1149 | |
|
1150 | 1150 | $ hg strip -r 35358f982181 |
|
1151 | 1151 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
1152 | 1152 | saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/35358f982181-a6f020aa-backup.hg |
|
1153 | 1153 | $ hg log -G |
|
1154 | 1154 | @ changeset: 3:f62c6c09b707 |
|
1155 | 1155 | | branch: new-branch |
|
1156 | 1156 | | tag: tip |
|
1157 | 1157 | | user: test |
|
1158 | 1158 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1159 | 1159 | | summary: foo |
|
1160 | 1160 | | |
|
1161 | 1161 | o changeset: 2:b1d33a8cadd9 |
|
1162 | 1162 | | branch: new-branch |
|
1163 | 1163 | | user: test |
|
1164 | 1164 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1165 | 1165 | | summary: start new branch |
|
1166 | 1166 | | |
|
1167 | 1167 | o changeset: 1:eca11cf91c71 |
|
1168 | 1168 | | user: test |
|
1169 | 1169 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1170 | 1170 | | summary: commitB |
|
1171 | 1171 | | |
|
1172 | 1172 | o changeset: 0:105141ef12d0 |
|
1173 | 1173 | user: test |
|
1174 | 1174 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1175 | 1175 | summary: commitA |
|
1176 | 1176 | |
|
1177 | 1177 | |
|
1178 | 1178 | stripping a set containing a merge properly reset file content, including items on other branches |
|
1179 | 1179 | |
|
1180 | 1180 | The added file is moved to unknown, which is the behavior we have been seeing for other `hg strip --keep` call. |
|
1181 | 1181 | |
|
1182 | 1182 | stripping a set containing a merge properly reset file content, including items on other branches |
|
1183 | 1183 | |
|
1184 | 1184 | The added file is moved to unknown, which is the behavior we have been seeing for other `hg strip --keep` call. |
|
1185 | 1185 | |
|
1186 | 1186 | $ hg unbundle -u $TESTTMP/issue4736/.hg/strip-backup/35358f982181-a6f020aa-backup.hg |
|
1187 | 1187 | adding changesets |
|
1188 | 1188 | adding manifests |
|
1189 | 1189 | adding file changes |
|
1190 | 1190 | added 2 changesets with 1 changes to 1 files |
|
1191 | 1191 | new changesets 35358f982181:4cf5e92caec2 (2 drafts) |
|
1192 | 1192 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1193 | 1193 | |
|
1194 | 1194 | $ hg id |
|
1195 | 1195 | 4cf5e92caec2 (new-branch) tip |
|
1196 | 1196 | $ hg status --rev "f62c6c09b707" |
|
1197 | 1197 | A bar.txt |
|
1198 | 1198 | $ hg diff --rev "f62c6c09b707" |
|
1199 | 1199 | diff -r f62c6c09b707 bar.txt |
|
1200 | 1200 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1201 | 1201 | +++ b/bar.txt Thu Jan 01 00:00:00 1970 +0000 |
|
1202 | 1202 | @@ -0,0 +1,1 @@ |
|
1203 | 1203 | +bar |
|
1204 | 1204 | $ hg log -G -v --rev 35358f982181:: --patch |
|
1205 | 1205 | @ changeset: 5:4cf5e92caec2 |
|
1206 | 1206 | |\ branch: new-branch |
|
1207 | 1207 | | ~ tag: tip |
|
1208 | 1208 | | parent: 3:f62c6c09b707 |
|
1209 | 1209 | | parent: 4:35358f982181 |
|
1210 | 1210 | | user: test |
|
1211 | 1211 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1212 | 1212 | | description: |
|
1213 | 1213 | | merge |
|
1214 | 1214 | | |
|
1215 | 1215 | | |
|
1216 | 1216 | | diff -r f62c6c09b707 -r 4cf5e92caec2 bar.txt |
|
1217 | 1217 | | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1218 | 1218 | | +++ b/bar.txt Thu Jan 01 00:00:00 1970 +0000 |
|
1219 | 1219 | | @@ -0,0 +1,1 @@ |
|
1220 | 1220 | | +bar |
|
1221 | 1221 | | |
|
1222 | 1222 | o changeset: 4:35358f982181 |
|
1223 | 1223 | | parent: 1:eca11cf91c71 |
|
1224 | 1224 | ~ user: test |
|
1225 | 1225 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1226 | 1226 | files: bar.txt |
|
1227 | 1227 | description: |
|
1228 | 1228 | bar |
|
1229 | 1229 | |
|
1230 | 1230 | |
|
1231 | 1231 | diff -r eca11cf91c71 -r 35358f982181 bar.txt |
|
1232 | 1232 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1233 | 1233 | +++ b/bar.txt Thu Jan 01 00:00:00 1970 +0000 |
|
1234 | 1234 | @@ -0,0 +1,1 @@ |
|
1235 | 1235 | +bar |
|
1236 | 1236 | |
|
1237 | 1237 | |
|
1238 | 1238 | $ hg strip -k -r 35358f982181 |
|
1239 | 1239 | saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/35358f982181-a6f020aa-backup.hg |
|
1240 | 1240 | $ hg log -G |
|
1241 | 1241 | @ changeset: 3:f62c6c09b707 |
|
1242 | 1242 | | branch: new-branch |
|
1243 | 1243 | | tag: tip |
|
1244 | 1244 | | user: test |
|
1245 | 1245 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1246 | 1246 | | summary: foo |
|
1247 | 1247 | | |
|
1248 | 1248 | o changeset: 2:b1d33a8cadd9 |
|
1249 | 1249 | | branch: new-branch |
|
1250 | 1250 | | user: test |
|
1251 | 1251 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1252 | 1252 | | summary: start new branch |
|
1253 | 1253 | | |
|
1254 | 1254 | o changeset: 1:eca11cf91c71 |
|
1255 | 1255 | | user: test |
|
1256 | 1256 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1257 | 1257 | | summary: commitB |
|
1258 | 1258 | | |
|
1259 | 1259 | o changeset: 0:105141ef12d0 |
|
1260 | 1260 | user: test |
|
1261 | 1261 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1262 | 1262 | summary: commitA |
|
1263 | 1263 | |
|
1264 | 1264 | |
|
1265 | 1265 | $ hg status -A |
|
1266 | 1266 | ? bar.txt |
|
1267 | 1267 | C a |
|
1268 | 1268 | C b |
|
1269 | 1269 | C foo.txt |
|
1270 | 1270 | $ cat bar.txt |
|
1271 | 1271 | bar |
|
1272 | 1272 | |
|
1273 | 1273 | Use delayedstrip to strip inside a transaction |
|
1274 | 1274 | |
|
1275 | 1275 | $ cd $TESTTMP |
|
1276 | 1276 | $ hg init delayedstrip |
|
1277 | 1277 | $ cd delayedstrip |
|
1278 | 1278 | $ hg debugdrawdag <<'EOS' |
|
1279 | 1279 | > D |
|
1280 | 1280 | > | |
|
1281 | 1281 | > C F H # Commit on top of "I", |
|
1282 | 1282 | > | |/| # Strip B+D+I+E+G+H+Z |
|
1283 | 1283 | > I B E G |
|
1284 | 1284 | > \|/ |
|
1285 | 1285 | > A Z |
|
1286 | 1286 | > EOS |
|
1287 | 1287 | $ cp -R . ../scmutilcleanup |
|
1288 | 1288 | |
|
1289 | 1289 | $ hg up -C I |
|
1290 | 1290 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1291 | 1291 | $ echo 3 >> I |
|
1292 | 1292 | $ cat > $TESTTMP/delayedstrip.py <<EOF |
|
1293 | 1293 | > from __future__ import absolute_import |
|
1294 | 1294 | > from mercurial import commands, registrar, repair |
|
1295 | 1295 | > cmdtable = {} |
|
1296 | 1296 | > command = registrar.command(cmdtable) |
|
1297 | 1297 | > @command(b'testdelayedstrip') |
|
1298 | 1298 | > def testdelayedstrip(ui, repo): |
|
1299 | 1299 | > def getnodes(expr): |
|
1300 | 1300 | > return [repo.changelog.node(r) for r in repo.revs(expr)] |
|
1301 | 1301 | > with repo.wlock(): |
|
1302 | 1302 | > with repo.lock(): |
|
1303 | 1303 | > with repo.transaction(b'delayedstrip'): |
|
1304 | 1304 | > repair.delayedstrip(ui, repo, getnodes(b'B+I+Z+D+E'), b'J') |
|
1305 | 1305 | > repair.delayedstrip(ui, repo, getnodes(b'G+H+Z'), b'I') |
|
1306 | 1306 | > commands.commit(ui, repo, message=b'J', date=b'0 0') |
|
1307 | 1307 | > EOF |
|
1308 | 1308 | $ hg testdelayedstrip --config extensions.t=$TESTTMP/delayedstrip.py |
|
1309 | 1309 | warning: orphaned descendants detected, not stripping 08ebfeb61bac, 112478962961, 7fb047a69f22 |
|
1310 | 1310 | saved backup bundle to $TESTTMP/delayedstrip/.hg/strip-backup/f585351a92f8-17475721-I.hg |
|
1311 | 1311 | |
|
1312 | 1312 | $ hg log -G -T '{rev}:{node|short} {desc}' -r 'sort(all(), topo)' |
|
1313 | 1313 | @ 6:2f2d51af6205 J |
|
1314 | 1314 | | |
|
1315 | 1315 | o 3:08ebfeb61bac I |
|
1316 | 1316 | | |
|
1317 | 1317 | | o 5:64a8289d2492 F |
|
1318 | 1318 | | | |
|
1319 | 1319 | | o 2:7fb047a69f22 E |
|
1320 | 1320 | |/ |
|
1321 | 1321 | | o 4:26805aba1e60 C |
|
1322 | 1322 | | | |
|
1323 | 1323 | | o 1:112478962961 B |
|
1324 | 1324 | |/ |
|
1325 | 1325 | o 0:426bada5c675 A |
|
1326 | 1326 | |
|
1327 | 1327 | Test high-level scmutil.cleanupnodes API |
|
1328 | 1328 | |
|
1329 | 1329 | $ cd $TESTTMP/scmutilcleanup |
|
1330 | 1330 | $ hg debugdrawdag <<'EOS' |
|
1331 | 1331 | > D2 F2 G2 # D2, F2, G2 are replacements for D, F, G |
|
1332 | 1332 | > | | | |
|
1333 | 1333 | > C H G |
|
1334 | 1334 | > EOS |
|
1335 | 1335 | $ for i in B C D F G I Z; do |
|
1336 | 1336 | > hg bookmark -i -r $i b-$i |
|
1337 | 1337 | > done |
|
1338 | 1338 | $ hg bookmark -i -r E 'b-F@divergent1' |
|
1339 | 1339 | $ hg bookmark -i -r H 'b-F@divergent2' |
|
1340 | 1340 | $ hg bookmark -i -r G 'b-F@divergent3' |
|
1341 | 1341 | $ cp -R . ../scmutilcleanup.obsstore |
|
1342 | 1342 | |
|
1343 | 1343 | $ cat > $TESTTMP/scmutilcleanup.py <<EOF |
|
1344 | 1344 | > from mercurial import registrar, scmutil |
|
1345 | 1345 | > cmdtable = {} |
|
1346 | 1346 | > command = registrar.command(cmdtable) |
|
1347 | 1347 | > @command(b'testnodescleanup') |
|
1348 | 1348 | > def testnodescleanup(ui, repo): |
|
1349 | 1349 | > def nodes(expr): |
|
1350 | 1350 | > return [repo.changelog.node(r) for r in repo.revs(expr)] |
|
1351 | 1351 | > def node(expr): |
|
1352 | 1352 | > return nodes(expr)[0] |
|
1353 | 1353 | > with repo.wlock(): |
|
1354 | 1354 | > with repo.lock(): |
|
1355 | 1355 | > with repo.transaction(b'delayedstrip'): |
|
1356 | 1356 | > mapping = {node(b'F'): [node(b'F2')], |
|
1357 | 1357 | > node(b'D'): [node(b'D2')], |
|
1358 | 1358 | > node(b'G'): [node(b'G2')]} |
|
1359 | 1359 | > scmutil.cleanupnodes(repo, mapping, b'replace') |
|
1360 | 1360 | > scmutil.cleanupnodes(repo, nodes(b'((B::)+I+Z)-D2-obsolete()'), |
|
1361 | 1361 | > b'replace') |
|
1362 | 1362 | > EOF |
|
1363 | 1363 | $ hg testnodescleanup --config extensions.t=$TESTTMP/scmutilcleanup.py |
|
1364 | 1364 | warning: orphaned descendants detected, not stripping 112478962961, 1fc8102cda62, 26805aba1e60 |
|
1365 | 1365 | saved backup bundle to $TESTTMP/scmutilcleanup/.hg/strip-backup/f585351a92f8-73fb7c03-replace.hg |
|
1366 | 1366 | |
|
1367 | 1367 | $ hg log -G -T '{rev}:{node|short} {desc} {bookmarks}' -r 'sort(all(), topo)' |
|
1368 | 1368 | o 8:1473d4b996d1 G2 b-F@divergent3 b-G |
|
1369 | 1369 | | |
|
1370 | 1370 | | o 7:d11b3456a873 F2 b-F |
|
1371 | 1371 | | | |
|
1372 | 1372 | | o 5:5cb05ba470a7 H |
|
1373 | 1373 | |/| |
|
1374 | 1374 | | o 3:7fb047a69f22 E b-F@divergent1 |
|
1375 | 1375 | | | |
|
1376 | 1376 | | | o 6:7c78f703e465 D2 b-D |
|
1377 | 1377 | | | | |
|
1378 | 1378 | | | o 4:26805aba1e60 C |
|
1379 | 1379 | | | | |
|
1380 | 1380 | | | o 2:112478962961 B |
|
1381 | 1381 | | |/ |
|
1382 | 1382 | o | 1:1fc8102cda62 G |
|
1383 | 1383 | / |
|
1384 | 1384 | o 0:426bada5c675 A b-B b-C b-I |
|
1385 | 1385 | |
|
1386 | 1386 | $ hg bookmark |
|
1387 | 1387 | b-B 0:426bada5c675 |
|
1388 | 1388 | b-C 0:426bada5c675 |
|
1389 | 1389 | b-D 6:7c78f703e465 |
|
1390 | 1390 | b-F 7:d11b3456a873 |
|
1391 | 1391 | b-F@divergent1 3:7fb047a69f22 |
|
1392 | 1392 | b-F@divergent3 8:1473d4b996d1 |
|
1393 | 1393 | b-G 8:1473d4b996d1 |
|
1394 | 1394 | b-I 0:426bada5c675 |
|
1395 | 1395 | b-Z -1:000000000000 |
|
1396 | 1396 | |
|
1397 | 1397 | Test the above using obsstore "by the way". Not directly related to strip, but |
|
1398 | 1398 | we have reusable code here |
|
1399 | 1399 | |
|
1400 | 1400 | $ cd $TESTTMP/scmutilcleanup.obsstore |
|
1401 | 1401 | $ cat >> .hg/hgrc <<EOF |
|
1402 | 1402 | > [experimental] |
|
1403 | 1403 | > evolution=true |
|
1404 | 1404 | > evolution.track-operation=1 |
|
1405 | 1405 | > EOF |
|
1406 | 1406 | |
|
1407 | 1407 | $ hg testnodescleanup --config extensions.t=$TESTTMP/scmutilcleanup.py |
|
1408 | 1408 | 4 new orphan changesets |
|
1409 | 1409 | |
|
1410 | 1410 | $ rm .hg/localtags |
|
1411 | 1411 | $ hg log -G -T '{rev}:{node|short} {desc} {bookmarks}' -r 'sort(all(), topo)' |
|
1412 | 1412 | * 12:1473d4b996d1 G2 b-F@divergent3 b-G |
|
1413 | 1413 | | |
|
1414 | 1414 | | * 11:d11b3456a873 F2 b-F |
|
1415 | 1415 | | | |
|
1416 | 1416 | | * 8:5cb05ba470a7 H |
|
1417 | 1417 | |/| |
|
1418 | 1418 | | o 4:7fb047a69f22 E b-F@divergent1 |
|
1419 | 1419 | | | |
|
1420 | 1420 | | | * 10:7c78f703e465 D2 b-D |
|
1421 | 1421 | | | | |
|
1422 | 1422 | | | x 6:26805aba1e60 C |
|
1423 | 1423 | | | | |
|
1424 | 1424 | | | x 3:112478962961 B |
|
1425 | 1425 | | |/ |
|
1426 | 1426 | x | 1:1fc8102cda62 G |
|
1427 | 1427 | / |
|
1428 | 1428 | o 0:426bada5c675 A b-B b-C b-I |
|
1429 | 1429 | |
|
1430 | 1430 | $ hg debugobsolete |
|
1431 | 1431 | 1fc8102cda6204549f031015641606ccf5513ec3 1473d4b996d1d1b121de6b39fab6a04fbf9d873e 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'replace', 'user': 'test'} |
|
1432 | 1432 | 64a8289d249234b9886244d379f15e6b650b28e3 d11b3456a873daec7c7bc53e5622e8df6d741bd2 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'replace', 'user': 'test'} |
|
1433 | 1433 | f585351a92f85104bff7c284233c338b10eb1df7 7c78f703e465d73102cc8780667ce269c5208a40 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '9', 'operation': 'replace', 'user': 'test'} |
|
1434 | 1434 | 48b9aae0607f43ff110d84e6883c151942add5ab 0 {0000000000000000000000000000000000000000} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'replace', 'user': 'test'} |
|
1435 | 1435 | 112478962961147124edd43549aedd1a335e44bf 0 {426bada5c67598ca65036d57d9e4b64b0c1ce7a0} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'replace', 'user': 'test'} |
|
1436 | 1436 | 08ebfeb61bac6e3f12079de774d285a0d6689eba 0 {426bada5c67598ca65036d57d9e4b64b0c1ce7a0} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'replace', 'user': 'test'} |
|
1437 | 1437 | 26805aba1e600a82e93661149f2313866a221a7b 0 {112478962961147124edd43549aedd1a335e44bf} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'replace', 'user': 'test'} |
|
1438 | 1438 | $ cd .. |
|
1439 | 1439 | |
|
1440 | 1440 | Test that obsmarkers are restored even when not using generaldelta |
|
1441 | 1441 | |
|
1442 | 1442 | $ hg --config format.usegeneraldelta=no init issue5678 |
|
1443 | 1443 | $ cd issue5678 |
|
1444 | 1444 | $ cat >> .hg/hgrc <<EOF |
|
1445 | 1445 | > [experimental] |
|
1446 | 1446 | > evolution=true |
|
1447 | 1447 | > EOF |
|
1448 | 1448 | $ echo a > a |
|
1449 | 1449 | $ hg ci -Aqm a |
|
1450 | 1450 | $ hg ci --amend -m a2 |
|
1451 | 1451 | $ hg debugobsolete |
|
1452 | 1452 | cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b 489bac576828490c0bb8d45eac9e5e172e4ec0a8 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'test'} |
|
1453 | 1453 | $ hg strip . |
|
1454 | 1454 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
1455 | 1455 | saved backup bundle to $TESTTMP/issue5678/.hg/strip-backup/489bac576828-bef27e14-backup.hg |
|
1456 | 1456 | $ hg unbundle -q .hg/strip-backup/* |
|
1457 | 1457 | $ hg debugobsolete |
|
1458 | 1458 | cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b 489bac576828490c0bb8d45eac9e5e172e4ec0a8 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'test'} |
|
1459 | 1459 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now