##// END OF EJS Templates
commands: remove redundant paragraph from tags help
Martin Geisler -
r7596:0be97ee2 default
parent child Browse files
Show More
@@ -1,3420 +1,3418 b''
1 1 # commands.py - command processing 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
6 6 # of the GNU General Public License, incorporated herein by reference.
7 7
8 8 from node import hex, nullid, nullrev, short
9 9 from repo import RepoError, NoCapability
10 10 from i18n import _, gettext
11 11 import os, re, sys
12 12 import hg, util, revlog, bundlerepo, extensions, copies, context
13 13 import difflib, patch, time, help, mdiff, tempfile, url
14 14 import version
15 15 import archival, changegroup, cmdutil, hgweb.server, sshserver, hbisect
16 16 import merge as merge_
17 17
18 18 # Commands start here, listed alphabetically
19 19
20 20 def add(ui, repo, *pats, **opts):
21 21 """add the specified files on the next commit
22 22
23 23 Schedule files to be version controlled and added to the repository.
24 24
25 25 The files will be added to the repository at the next commit. To
26 26 undo an add before that, see hg revert.
27 27
28 28 If no names are given, add all files in the repository.
29 29 """
30 30
31 31 rejected = None
32 32 exacts = {}
33 33 names = []
34 34 m = cmdutil.match(repo, pats, opts)
35 35 m.bad = lambda x,y: True
36 36 for abs in repo.walk(m):
37 37 if m.exact(abs):
38 38 if ui.verbose:
39 39 ui.status(_('adding %s\n') % m.rel(abs))
40 40 names.append(abs)
41 41 exacts[abs] = 1
42 42 elif abs not in repo.dirstate:
43 43 ui.status(_('adding %s\n') % m.rel(abs))
44 44 names.append(abs)
45 45 if not opts.get('dry_run'):
46 46 rejected = repo.add(names)
47 47 rejected = [p for p in rejected if p in exacts]
48 48 return rejected and 1 or 0
49 49
50 50 def addremove(ui, repo, *pats, **opts):
51 51 """add all new files, delete all missing files
52 52
53 53 Add all new files and remove all missing files from the repository.
54 54
55 55 New files are ignored if they match any of the patterns in .hgignore. As
56 56 with add, these changes take effect at the next commit.
57 57
58 58 Use the -s option to detect renamed files. With a parameter > 0,
59 59 this compares every removed file with every added file and records
60 60 those similar enough as renames. This option takes a percentage
61 61 between 0 (disabled) and 100 (files must be identical) as its
62 62 parameter. Detecting renamed files this way can be expensive.
63 63 """
64 64 try:
65 65 sim = float(opts.get('similarity') or 0)
66 66 except ValueError:
67 67 raise util.Abort(_('similarity must be a number'))
68 68 if sim < 0 or sim > 100:
69 69 raise util.Abort(_('similarity must be between 0 and 100'))
70 70 return cmdutil.addremove(repo, pats, opts, similarity=sim/100.)
71 71
72 72 def annotate(ui, repo, *pats, **opts):
73 73 """show changeset information per file line
74 74
75 75 List changes in files, showing the revision id responsible for each line
76 76
77 77 This command is useful to discover who did a change or when a change took
78 78 place.
79 79
80 80 Without the -a option, annotate will avoid processing files it
81 81 detects as binary. With -a, annotate will generate an annotation
82 82 anyway, probably with undesirable results.
83 83 """
84 84 datefunc = ui.quiet and util.shortdate or util.datestr
85 85 getdate = util.cachefunc(lambda x: datefunc(x[0].date()))
86 86
87 87 if not pats:
88 88 raise util.Abort(_('at least one file name or pattern required'))
89 89
90 90 opmap = [('user', lambda x: ui.shortuser(x[0].user())),
91 91 ('number', lambda x: str(x[0].rev())),
92 92 ('changeset', lambda x: short(x[0].node())),
93 93 ('date', getdate),
94 94 ('follow', lambda x: x[0].path()),
95 95 ]
96 96
97 97 if (not opts.get('user') and not opts.get('changeset') and not opts.get('date')
98 98 and not opts.get('follow')):
99 99 opts['number'] = 1
100 100
101 101 linenumber = opts.get('line_number') is not None
102 102 if (linenumber and (not opts.get('changeset')) and (not opts.get('number'))):
103 103 raise util.Abort(_('at least one of -n/-c is required for -l'))
104 104
105 105 funcmap = [func for op, func in opmap if opts.get(op)]
106 106 if linenumber:
107 107 lastfunc = funcmap[-1]
108 108 funcmap[-1] = lambda x: "%s:%s" % (lastfunc(x), x[1])
109 109
110 110 ctx = repo[opts.get('rev')]
111 111
112 112 m = cmdutil.match(repo, pats, opts)
113 113 for abs in ctx.walk(m):
114 114 fctx = ctx[abs]
115 115 if not opts.get('text') and util.binary(fctx.data()):
116 116 ui.write(_("%s: binary file\n") % ((pats and m.rel(abs)) or abs))
117 117 continue
118 118
119 119 lines = fctx.annotate(follow=opts.get('follow'),
120 120 linenumber=linenumber)
121 121 pieces = []
122 122
123 123 for f in funcmap:
124 124 l = [f(n) for n, dummy in lines]
125 125 if l:
126 126 ml = max(map(len, l))
127 127 pieces.append(["%*s" % (ml, x) for x in l])
128 128
129 129 if pieces:
130 130 for p, l in zip(zip(*pieces), lines):
131 131 ui.write("%s: %s" % (" ".join(p), l[1]))
132 132
133 133 def archive(ui, repo, dest, **opts):
134 134 '''create unversioned archive of a repository revision
135 135
136 136 By default, the revision used is the parent of the working
137 137 directory; use "-r" to specify a different revision.
138 138
139 139 To specify the type of archive to create, use "-t". Valid
140 140 types are:
141 141
142 142 "files" (default): a directory full of files
143 143 "tar": tar archive, uncompressed
144 144 "tbz2": tar archive, compressed using bzip2
145 145 "tgz": tar archive, compressed using gzip
146 146 "uzip": zip archive, uncompressed
147 147 "zip": zip archive, compressed using deflate
148 148
149 149 The exact name of the destination archive or directory is given
150 150 using a format string; see "hg help export" for details.
151 151
152 152 Each member added to an archive file has a directory prefix
153 153 prepended. Use "-p" to specify a format string for the prefix.
154 154 The default is the basename of the archive, with suffixes removed.
155 155 '''
156 156
157 157 ctx = repo[opts.get('rev')]
158 158 if not ctx:
159 159 raise util.Abort(_('no working directory: please specify a revision'))
160 160 node = ctx.node()
161 161 dest = cmdutil.make_filename(repo, dest, node)
162 162 if os.path.realpath(dest) == repo.root:
163 163 raise util.Abort(_('repository root cannot be destination'))
164 164 matchfn = cmdutil.match(repo, [], opts)
165 165 kind = opts.get('type') or 'files'
166 166 prefix = opts.get('prefix')
167 167 if dest == '-':
168 168 if kind == 'files':
169 169 raise util.Abort(_('cannot archive plain files to stdout'))
170 170 dest = sys.stdout
171 171 if not prefix: prefix = os.path.basename(repo.root) + '-%h'
172 172 prefix = cmdutil.make_filename(repo, prefix, node)
173 173 archival.archive(repo, dest, node, kind, not opts.get('no_decode'),
174 174 matchfn, prefix)
175 175
176 176 def backout(ui, repo, node=None, rev=None, **opts):
177 177 '''reverse effect of earlier changeset
178 178
179 179 Commit the backed out changes as a new changeset. The new
180 180 changeset is a child of the backed out changeset.
181 181
182 182 If you back out a changeset other than the tip, a new head is
183 183 created. This head will be the new tip and you should merge this
184 184 backout changeset with another head (current one by default).
185 185
186 186 The --merge option remembers the parent of the working directory
187 187 before starting the backout, then merges the new head with that
188 188 changeset afterwards. This saves you from doing the merge by
189 189 hand. The result of this merge is not committed, as for a normal
190 190 merge.
191 191
192 192 See \'hg help dates\' for a list of formats valid for -d/--date.
193 193 '''
194 194 if rev and node:
195 195 raise util.Abort(_("please specify just one revision"))
196 196
197 197 if not rev:
198 198 rev = node
199 199
200 200 if not rev:
201 201 raise util.Abort(_("please specify a revision to backout"))
202 202
203 203 date = opts.get('date')
204 204 if date:
205 205 opts['date'] = util.parsedate(date)
206 206
207 207 cmdutil.bail_if_changed(repo)
208 208 node = repo.lookup(rev)
209 209
210 210 op1, op2 = repo.dirstate.parents()
211 211 a = repo.changelog.ancestor(op1, node)
212 212 if a != node:
213 213 raise util.Abort(_('cannot back out change on a different branch'))
214 214
215 215 p1, p2 = repo.changelog.parents(node)
216 216 if p1 == nullid:
217 217 raise util.Abort(_('cannot back out a change with no parents'))
218 218 if p2 != nullid:
219 219 if not opts.get('parent'):
220 220 raise util.Abort(_('cannot back out a merge changeset without '
221 221 '--parent'))
222 222 p = repo.lookup(opts['parent'])
223 223 if p not in (p1, p2):
224 224 raise util.Abort(_('%s is not a parent of %s') %
225 225 (short(p), short(node)))
226 226 parent = p
227 227 else:
228 228 if opts.get('parent'):
229 229 raise util.Abort(_('cannot use --parent on non-merge changeset'))
230 230 parent = p1
231 231
232 232 # the backout should appear on the same branch
233 233 branch = repo.dirstate.branch()
234 234 hg.clean(repo, node, show_stats=False)
235 235 repo.dirstate.setbranch(branch)
236 236 revert_opts = opts.copy()
237 237 revert_opts['date'] = None
238 238 revert_opts['all'] = True
239 239 revert_opts['rev'] = hex(parent)
240 240 revert_opts['no_backup'] = None
241 241 revert(ui, repo, **revert_opts)
242 242 commit_opts = opts.copy()
243 243 commit_opts['addremove'] = False
244 244 if not commit_opts['message'] and not commit_opts['logfile']:
245 245 commit_opts['message'] = _("Backed out changeset %s") % (short(node))
246 246 commit_opts['force_editor'] = True
247 247 commit(ui, repo, **commit_opts)
248 248 def nice(node):
249 249 return '%d:%s' % (repo.changelog.rev(node), short(node))
250 250 ui.status(_('changeset %s backs out changeset %s\n') %
251 251 (nice(repo.changelog.tip()), nice(node)))
252 252 if op1 != node:
253 253 hg.clean(repo, op1, show_stats=False)
254 254 if opts.get('merge'):
255 255 ui.status(_('merging with changeset %s\n') % nice(repo.changelog.tip()))
256 256 hg.merge(repo, hex(repo.changelog.tip()))
257 257 else:
258 258 ui.status(_('the backout changeset is a new head - '
259 259 'do not forget to merge\n'))
260 260 ui.status(_('(use "backout --merge" '
261 261 'if you want to auto-merge)\n'))
262 262
263 263 def bisect(ui, repo, rev=None, extra=None, command=None,
264 264 reset=None, good=None, bad=None, skip=None, noupdate=None):
265 265 """subdivision search of changesets
266 266
267 267 This command helps to find changesets which introduce problems.
268 268 To use, mark the earliest changeset you know exhibits the problem
269 269 as bad, then mark the latest changeset which is free from the
270 270 problem as good. Bisect will update your working directory to a
271 271 revision for testing (unless the --noupdate option is specified).
272 272 Once you have performed tests, mark the working directory as bad
273 273 or good and bisect will either update to another candidate changeset
274 274 or announce that it has found the bad revision.
275 275
276 276 As a shortcut, you can also use the revision argument to mark a
277 277 revision as good or bad without checking it out first.
278 278
279 279 If you supply a command it will be used for automatic bisection. Its exit
280 280 status will be used as flag to mark revision as bad or good. In case exit
281 281 status is 0 the revision is marked as good, 125 - skipped, 127 (command not
282 282 found) - bisection will be aborted and any other status bigger than 0 will
283 283 mark revision as bad.
284 284 """
285 285 def print_result(nodes, good):
286 286 displayer = cmdutil.show_changeset(ui, repo, {})
287 287 transition = (good and "good" or "bad")
288 288 if len(nodes) == 1:
289 289 # narrowed it down to a single revision
290 290 ui.write(_("The first %s revision is:\n") % transition)
291 291 displayer.show(repo[nodes[0]])
292 292 else:
293 293 # multiple possible revisions
294 294 ui.write(_("Due to skipped revisions, the first "
295 295 "%s revision could be any of:\n") % transition)
296 296 for n in nodes:
297 297 displayer.show(repo[n])
298 298
299 299 def check_state(state, interactive=True):
300 300 if not state['good'] or not state['bad']:
301 301 if (good or bad or skip or reset) and interactive:
302 302 return
303 303 if not state['good']:
304 304 raise util.Abort(_('cannot bisect (no known good revisions)'))
305 305 else:
306 306 raise util.Abort(_('cannot bisect (no known bad revisions)'))
307 307 return True
308 308
309 309 # backward compatibility
310 310 if rev in "good bad reset init".split():
311 311 ui.warn(_("(use of 'hg bisect <cmd>' is deprecated)\n"))
312 312 cmd, rev, extra = rev, extra, None
313 313 if cmd == "good":
314 314 good = True
315 315 elif cmd == "bad":
316 316 bad = True
317 317 else:
318 318 reset = True
319 319 elif extra or good + bad + skip + reset + bool(command) > 1:
320 320 raise util.Abort(_('incompatible arguments'))
321 321
322 322 if reset:
323 323 p = repo.join("bisect.state")
324 324 if os.path.exists(p):
325 325 os.unlink(p)
326 326 return
327 327
328 328 state = hbisect.load_state(repo)
329 329
330 330 if command:
331 331 commandpath = util.find_exe(command)
332 332 changesets = 1
333 333 try:
334 334 while changesets:
335 335 # update state
336 336 status = os.spawnl(os.P_WAIT, commandpath)
337 337 if status == 125:
338 338 transition = "skip"
339 339 elif status == 0:
340 340 transition = "good"
341 341 # status < 0 means process was killed
342 342 elif status == 127:
343 343 raise util.Abort(_("failed to execute %s") % command)
344 344 elif status < 0:
345 345 raise util.Abort(_("%s killed") % command)
346 346 else:
347 347 transition = "bad"
348 348 node = repo.lookup(rev or '.')
349 349 state[transition].append(node)
350 350 ui.note(_('Changeset %s: %s\n') % (short(node), transition))
351 351 check_state(state, interactive=False)
352 352 # bisect
353 353 nodes, changesets, good = hbisect.bisect(repo.changelog, state)
354 354 # update to next check
355 355 cmdutil.bail_if_changed(repo)
356 356 hg.clean(repo, nodes[0], show_stats=False)
357 357 finally:
358 358 hbisect.save_state(repo, state)
359 359 return print_result(nodes, not status)
360 360
361 361 # update state
362 362 node = repo.lookup(rev or '.')
363 363 if good:
364 364 state['good'].append(node)
365 365 elif bad:
366 366 state['bad'].append(node)
367 367 elif skip:
368 368 state['skip'].append(node)
369 369
370 370 hbisect.save_state(repo, state)
371 371
372 372 if not check_state(state):
373 373 return
374 374
375 375 # actually bisect
376 376 nodes, changesets, good = hbisect.bisect(repo.changelog, state)
377 377 if changesets == 0:
378 378 print_result(nodes, good)
379 379 else:
380 380 assert len(nodes) == 1 # only a single node can be tested next
381 381 node = nodes[0]
382 382 # compute the approximate number of remaining tests
383 383 tests, size = 0, 2
384 384 while size <= changesets:
385 385 tests, size = tests + 1, size * 2
386 386 rev = repo.changelog.rev(node)
387 387 ui.write(_("Testing changeset %s:%s "
388 388 "(%s changesets remaining, ~%s tests)\n")
389 389 % (rev, short(node), changesets, tests))
390 390 if not noupdate:
391 391 cmdutil.bail_if_changed(repo)
392 392 return hg.clean(repo, node)
393 393
394 394 def branch(ui, repo, label=None, **opts):
395 395 """set or show the current branch name
396 396
397 397 With no argument, show the current branch name. With one argument,
398 398 set the working directory branch name (the branch does not exist in
399 399 the repository until the next commit).
400 400
401 401 Unless --force is specified, branch will not let you set a
402 402 branch name that shadows an existing branch.
403 403
404 404 Use --clean to reset the working directory branch to that of the
405 405 parent of the working directory, negating a previous branch change.
406 406
407 407 Use the command 'hg update' to switch to an existing branch.
408 408 """
409 409
410 410 if opts.get('clean'):
411 411 label = repo[None].parents()[0].branch()
412 412 repo.dirstate.setbranch(label)
413 413 ui.status(_('reset working directory to branch %s\n') % label)
414 414 elif label:
415 415 if not opts.get('force') and label in repo.branchtags():
416 416 if label not in [p.branch() for p in repo.parents()]:
417 417 raise util.Abort(_('a branch of the same name already exists'
418 418 ' (use --force to override)'))
419 419 repo.dirstate.setbranch(util.fromlocal(label))
420 420 ui.status(_('marked working directory as branch %s\n') % label)
421 421 else:
422 422 ui.write("%s\n" % util.tolocal(repo.dirstate.branch()))
423 423
424 424 def branches(ui, repo, active=False):
425 425 """list repository named branches
426 426
427 427 List the repository's named branches, indicating which ones are
428 428 inactive. If active is specified, only show active branches.
429 429
430 430 A branch is considered active if it contains repository heads.
431 431
432 432 Use the command 'hg update' to switch to an existing branch.
433 433 """
434 434 hexfunc = ui.debugflag and hex or short
435 435 activebranches = [util.tolocal(repo[n].branch())
436 436 for n in repo.heads()]
437 437 branches = util.sort([(tag in activebranches, repo.changelog.rev(node), tag)
438 438 for tag, node in repo.branchtags().items()])
439 439 branches.reverse()
440 440
441 441 for isactive, node, tag in branches:
442 442 if (not active) or isactive:
443 443 if ui.quiet:
444 444 ui.write("%s\n" % tag)
445 445 else:
446 446 rev = str(node).rjust(31 - util.locallen(tag))
447 447 isinactive = ((not isactive) and " (inactive)") or ''
448 448 data = tag, rev, hexfunc(repo.lookup(node)), isinactive
449 449 ui.write("%s %s:%s%s\n" % data)
450 450
451 451 def bundle(ui, repo, fname, dest=None, **opts):
452 452 """create a changegroup file
453 453
454 454 Generate a compressed changegroup file collecting changesets not
455 455 found in the other repository.
456 456
457 457 If no destination repository is specified the destination is
458 458 assumed to have all the nodes specified by one or more --base
459 459 parameters. To create a bundle containing all changesets, use
460 460 --all (or --base null). To change the compression method applied,
461 461 use the -t option (by default, bundles are compressed using bz2).
462 462
463 463 The bundle file can then be transferred using conventional means and
464 464 applied to another repository with the unbundle or pull command.
465 465 This is useful when direct push and pull are not available or when
466 466 exporting an entire repository is undesirable.
467 467
468 468 Applying bundles preserves all changeset contents including
469 469 permissions, copy/rename information, and revision history.
470 470 """
471 471 revs = opts.get('rev') or None
472 472 if revs:
473 473 revs = [repo.lookup(rev) for rev in revs]
474 474 if opts.get('all'):
475 475 base = ['null']
476 476 else:
477 477 base = opts.get('base')
478 478 if base:
479 479 if dest:
480 480 raise util.Abort(_("--base is incompatible with specifiying "
481 481 "a destination"))
482 482 base = [repo.lookup(rev) for rev in base]
483 483 # create the right base
484 484 # XXX: nodesbetween / changegroup* should be "fixed" instead
485 485 o = []
486 486 has = {nullid: None}
487 487 for n in base:
488 488 has.update(repo.changelog.reachable(n))
489 489 if revs:
490 490 visit = list(revs)
491 491 else:
492 492 visit = repo.changelog.heads()
493 493 seen = {}
494 494 while visit:
495 495 n = visit.pop(0)
496 496 parents = [p for p in repo.changelog.parents(n) if p not in has]
497 497 if len(parents) == 0:
498 498 o.insert(0, n)
499 499 else:
500 500 for p in parents:
501 501 if p not in seen:
502 502 seen[p] = 1
503 503 visit.append(p)
504 504 else:
505 505 cmdutil.setremoteconfig(ui, opts)
506 506 dest, revs, checkout = hg.parseurl(
507 507 ui.expandpath(dest or 'default-push', dest or 'default'), revs)
508 508 other = hg.repository(ui, dest)
509 509 o = repo.findoutgoing(other, force=opts.get('force'))
510 510
511 511 if revs:
512 512 cg = repo.changegroupsubset(o, revs, 'bundle')
513 513 else:
514 514 cg = repo.changegroup(o, 'bundle')
515 515
516 516 bundletype = opts.get('type', 'bzip2').lower()
517 517 btypes = {'none': 'HG10UN', 'bzip2': 'HG10BZ', 'gzip': 'HG10GZ'}
518 518 bundletype = btypes.get(bundletype)
519 519 if bundletype not in changegroup.bundletypes:
520 520 raise util.Abort(_('unknown bundle type specified with --type'))
521 521
522 522 changegroup.writebundle(cg, fname, bundletype)
523 523
524 524 def cat(ui, repo, file1, *pats, **opts):
525 525 """output the current or given revision of files
526 526
527 527 Print the specified files as they were at the given revision.
528 528 If no revision is given, the parent of the working directory is used,
529 529 or tip if no revision is checked out.
530 530
531 531 Output may be to a file, in which case the name of the file is
532 532 given using a format string. The formatting rules are the same as
533 533 for the export command, with the following additions:
534 534
535 535 %s basename of file being printed
536 536 %d dirname of file being printed, or '.' if in repo root
537 537 %p root-relative path name of file being printed
538 538 """
539 539 ctx = repo[opts.get('rev')]
540 540 err = 1
541 541 m = cmdutil.match(repo, (file1,) + pats, opts)
542 542 for abs in ctx.walk(m):
543 543 fp = cmdutil.make_file(repo, opts.get('output'), ctx.node(), pathname=abs)
544 544 data = ctx[abs].data()
545 545 if opts.get('decode'):
546 546 data = repo.wwritedata(abs, data)
547 547 fp.write(data)
548 548 err = 0
549 549 return err
550 550
551 551 def clone(ui, source, dest=None, **opts):
552 552 """make a copy of an existing repository
553 553
554 554 Create a copy of an existing repository in a new directory.
555 555
556 556 If no destination directory name is specified, it defaults to the
557 557 basename of the source.
558 558
559 559 The location of the source is added to the new repository's
560 560 .hg/hgrc file, as the default to be used for future pulls.
561 561
562 562 For efficiency, hardlinks are used for cloning whenever the source
563 563 and destination are on the same filesystem (note this applies only
564 564 to the repository data, not to the checked out files). Some
565 565 filesystems, such as AFS, implement hardlinking incorrectly, but
566 566 do not report errors. In these cases, use the --pull option to
567 567 avoid hardlinking.
568 568
569 569 In some cases, you can clone repositories and checked out files
570 570 using full hardlinks with
571 571
572 572 $ cp -al REPO REPOCLONE
573 573
574 574 This is the fastest way to clone, but it is not always safe. The
575 575 operation is not atomic (making sure REPO is not modified during
576 576 the operation is up to you) and you have to make sure your editor
577 577 breaks hardlinks (Emacs and most Linux Kernel tools do so). Also,
578 578 this is not compatible with certain extensions that place their
579 579 metadata under the .hg directory, such as mq.
580 580
581 581 If you use the -r option to clone up to a specific revision, no
582 582 subsequent revisions will be present in the cloned repository.
583 583 This option implies --pull, even on local repositories.
584 584
585 585 If the -U option is used, the new clone will contain only a repository
586 586 (.hg) and no working copy (the working copy parent is the null revision).
587 587
588 588 See pull for valid source format details.
589 589
590 590 It is possible to specify an ssh:// URL as the destination, but no
591 591 .hg/hgrc and working directory will be created on the remote side.
592 592 Look at the help text for the pull command for important details
593 593 about ssh:// URLs.
594 594 """
595 595 cmdutil.setremoteconfig(ui, opts)
596 596 hg.clone(ui, source, dest,
597 597 pull=opts.get('pull'),
598 598 stream=opts.get('uncompressed'),
599 599 rev=opts.get('rev'),
600 600 update=not opts.get('noupdate'))
601 601
602 602 def commit(ui, repo, *pats, **opts):
603 603 """commit the specified files or all outstanding changes
604 604
605 605 Commit changes to the given files into the repository.
606 606
607 607 If a list of files is omitted, all changes reported by "hg status"
608 608 will be committed.
609 609
610 610 If you are committing the result of a merge, do not provide any
611 611 file names or -I/-X filters.
612 612
613 613 If no commit message is specified, the configured editor is started to
614 614 enter a message.
615 615
616 616 See 'hg help dates' for a list of formats valid for -d/--date.
617 617 """
618 618 def commitfunc(ui, repo, message, match, opts):
619 619 return repo.commit(match.files(), message, opts.get('user'), opts.get('date'),
620 620 match, force_editor=opts.get('force_editor'))
621 621
622 622 node = cmdutil.commit(ui, repo, commitfunc, pats, opts)
623 623 if not node:
624 624 return
625 625 cl = repo.changelog
626 626 rev = cl.rev(node)
627 627 parents = cl.parentrevs(rev)
628 628 if rev - 1 in parents:
629 629 # one of the parents was the old tip
630 630 pass
631 631 elif (parents == (nullrev, nullrev) or
632 632 len(cl.heads(cl.node(parents[0]))) > 1 and
633 633 (parents[1] == nullrev or len(cl.heads(cl.node(parents[1]))) > 1)):
634 634 ui.status(_('created new head\n'))
635 635
636 636 if ui.debugflag:
637 637 ui.write(_('committed changeset %d:%s\n') % (rev,hex(node)))
638 638 elif ui.verbose:
639 639 ui.write(_('committed changeset %d:%s\n') % (rev,short(node)))
640 640
641 641 def copy(ui, repo, *pats, **opts):
642 642 """mark files as copied for the next commit
643 643
644 644 Mark dest as having copies of source files. If dest is a
645 645 directory, copies are put in that directory. If dest is a file,
646 646 there can only be one source.
647 647
648 648 By default, this command copies the contents of files as they
649 649 stand in the working directory. If invoked with --after, the
650 650 operation is recorded, but no copying is performed.
651 651
652 652 This command takes effect in the next commit. To undo a copy
653 653 before that, see hg revert.
654 654 """
655 655 wlock = repo.wlock(False)
656 656 try:
657 657 return cmdutil.copy(ui, repo, pats, opts)
658 658 finally:
659 659 del wlock
660 660
661 661 def debugancestor(ui, repo, *args):
662 662 """find the ancestor revision of two revisions in a given index"""
663 663 if len(args) == 3:
664 664 index, rev1, rev2 = args
665 665 r = revlog.revlog(util.opener(os.getcwd(), audit=False), index)
666 666 lookup = r.lookup
667 667 elif len(args) == 2:
668 668 if not repo:
669 669 raise util.Abort(_("There is no Mercurial repository here "
670 670 "(.hg not found)"))
671 671 rev1, rev2 = args
672 672 r = repo.changelog
673 673 lookup = repo.lookup
674 674 else:
675 675 raise util.Abort(_('either two or three arguments required'))
676 676 a = r.ancestor(lookup(rev1), lookup(rev2))
677 677 ui.write("%d:%s\n" % (r.rev(a), hex(a)))
678 678
679 679 def debugcomplete(ui, cmd='', **opts):
680 680 """returns the completion list associated with the given command"""
681 681
682 682 if opts.get('options'):
683 683 options = []
684 684 otables = [globalopts]
685 685 if cmd:
686 686 aliases, entry = cmdutil.findcmd(cmd, table, False)
687 687 otables.append(entry[1])
688 688 for t in otables:
689 689 for o in t:
690 690 if o[0]:
691 691 options.append('-%s' % o[0])
692 692 options.append('--%s' % o[1])
693 693 ui.write("%s\n" % "\n".join(options))
694 694 return
695 695
696 696 cmdlist = cmdutil.findpossible(cmd, table)
697 697 if ui.verbose:
698 698 cmdlist = [' '.join(c[0]) for c in cmdlist.values()]
699 699 ui.write("%s\n" % "\n".join(util.sort(cmdlist)))
700 700
701 701 def debugfsinfo(ui, path = "."):
702 702 file('.debugfsinfo', 'w').write('')
703 703 ui.write('exec: %s\n' % (util.checkexec(path) and 'yes' or 'no'))
704 704 ui.write('symlink: %s\n' % (util.checklink(path) and 'yes' or 'no'))
705 705 ui.write('case-sensitive: %s\n' % (util.checkcase('.debugfsinfo')
706 706 and 'yes' or 'no'))
707 707 os.unlink('.debugfsinfo')
708 708
709 709 def debugrebuildstate(ui, repo, rev="tip"):
710 710 """rebuild the dirstate as it would look like for the given revision"""
711 711 ctx = repo[rev]
712 712 wlock = repo.wlock()
713 713 try:
714 714 repo.dirstate.rebuild(ctx.node(), ctx.manifest())
715 715 finally:
716 716 del wlock
717 717
718 718 def debugcheckstate(ui, repo):
719 719 """validate the correctness of the current dirstate"""
720 720 parent1, parent2 = repo.dirstate.parents()
721 721 m1 = repo[parent1].manifest()
722 722 m2 = repo[parent2].manifest()
723 723 errors = 0
724 724 for f in repo.dirstate:
725 725 state = repo.dirstate[f]
726 726 if state in "nr" and f not in m1:
727 727 ui.warn(_("%s in state %s, but not in manifest1\n") % (f, state))
728 728 errors += 1
729 729 if state in "a" and f in m1:
730 730 ui.warn(_("%s in state %s, but also in manifest1\n") % (f, state))
731 731 errors += 1
732 732 if state in "m" and f not in m1 and f not in m2:
733 733 ui.warn(_("%s in state %s, but not in either manifest\n") %
734 734 (f, state))
735 735 errors += 1
736 736 for f in m1:
737 737 state = repo.dirstate[f]
738 738 if state not in "nrm":
739 739 ui.warn(_("%s in manifest1, but listed as state %s") % (f, state))
740 740 errors += 1
741 741 if errors:
742 742 error = _(".hg/dirstate inconsistent with current parent's manifest")
743 743 raise util.Abort(error)
744 744
745 745 def showconfig(ui, repo, *values, **opts):
746 746 """show combined config settings from all hgrc files
747 747
748 748 With no args, print names and values of all config items.
749 749
750 750 With one arg of the form section.name, print just the value of
751 751 that config item.
752 752
753 753 With multiple args, print names and values of all config items
754 754 with matching section names."""
755 755
756 756 untrusted = bool(opts.get('untrusted'))
757 757 if values:
758 758 if len([v for v in values if '.' in v]) > 1:
759 759 raise util.Abort(_('only one config item permitted'))
760 760 for section, name, value in ui.walkconfig(untrusted=untrusted):
761 761 sectname = section + '.' + name
762 762 if values:
763 763 for v in values:
764 764 if v == section:
765 765 ui.write('%s=%s\n' % (sectname, value))
766 766 elif v == sectname:
767 767 ui.write(value, '\n')
768 768 else:
769 769 ui.write('%s=%s\n' % (sectname, value))
770 770
771 771 def debugsetparents(ui, repo, rev1, rev2=None):
772 772 """manually set the parents of the current working directory
773 773
774 774 This is useful for writing repository conversion tools, but should
775 775 be used with care.
776 776 """
777 777
778 778 if not rev2:
779 779 rev2 = hex(nullid)
780 780
781 781 wlock = repo.wlock()
782 782 try:
783 783 repo.dirstate.setparents(repo.lookup(rev1), repo.lookup(rev2))
784 784 finally:
785 785 del wlock
786 786
787 787 def debugstate(ui, repo, nodates=None):
788 788 """show the contents of the current dirstate"""
789 789 timestr = ""
790 790 showdate = not nodates
791 791 for file_, ent in util.sort(repo.dirstate._map.items()):
792 792 if showdate:
793 793 if ent[3] == -1:
794 794 # Pad or slice to locale representation
795 795 locale_len = len(time.strftime("%Y-%m-%d %H:%M:%S ", time.localtime(0)))
796 796 timestr = 'unset'
797 797 timestr = timestr[:locale_len] + ' '*(locale_len - len(timestr))
798 798 else:
799 799 timestr = time.strftime("%Y-%m-%d %H:%M:%S ", time.localtime(ent[3]))
800 800 if ent[1] & 020000:
801 801 mode = 'lnk'
802 802 else:
803 803 mode = '%3o' % (ent[1] & 0777)
804 804 ui.write("%c %s %10d %s%s\n" % (ent[0], mode, ent[2], timestr, file_))
805 805 for f in repo.dirstate.copies():
806 806 ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copied(f), f))
807 807
808 808 def debugdata(ui, file_, rev):
809 809 """dump the contents of a data file revision"""
810 810 r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_[:-2] + ".i")
811 811 try:
812 812 ui.write(r.revision(r.lookup(rev)))
813 813 except KeyError:
814 814 raise util.Abort(_('invalid revision identifier %s') % rev)
815 815
816 816 def debugdate(ui, date, range=None, **opts):
817 817 """parse and display a date"""
818 818 if opts["extended"]:
819 819 d = util.parsedate(date, util.extendeddateformats)
820 820 else:
821 821 d = util.parsedate(date)
822 822 ui.write("internal: %s %s\n" % d)
823 823 ui.write("standard: %s\n" % util.datestr(d))
824 824 if range:
825 825 m = util.matchdate(range)
826 826 ui.write("match: %s\n" % m(d[0]))
827 827
828 828 def debugindex(ui, file_):
829 829 """dump the contents of an index file"""
830 830 r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_)
831 831 ui.write(" rev offset length base linkrev" +
832 832 " nodeid p1 p2\n")
833 833 for i in r:
834 834 node = r.node(i)
835 835 try:
836 836 pp = r.parents(node)
837 837 except:
838 838 pp = [nullid, nullid]
839 839 ui.write("% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % (
840 840 i, r.start(i), r.length(i), r.base(i), r.linkrev(i),
841 841 short(node), short(pp[0]), short(pp[1])))
842 842
843 843 def debugindexdot(ui, file_):
844 844 """dump an index DAG as a .dot file"""
845 845 r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_)
846 846 ui.write("digraph G {\n")
847 847 for i in r:
848 848 node = r.node(i)
849 849 pp = r.parents(node)
850 850 ui.write("\t%d -> %d\n" % (r.rev(pp[0]), i))
851 851 if pp[1] != nullid:
852 852 ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i))
853 853 ui.write("}\n")
854 854
855 855 def debuginstall(ui):
856 856 '''test Mercurial installation'''
857 857
858 858 def writetemp(contents):
859 859 (fd, name) = tempfile.mkstemp(prefix="hg-debuginstall-")
860 860 f = os.fdopen(fd, "wb")
861 861 f.write(contents)
862 862 f.close()
863 863 return name
864 864
865 865 problems = 0
866 866
867 867 # encoding
868 868 ui.status(_("Checking encoding (%s)...\n") % util._encoding)
869 869 try:
870 870 util.fromlocal("test")
871 871 except util.Abort, inst:
872 872 ui.write(" %s\n" % inst)
873 873 ui.write(_(" (check that your locale is properly set)\n"))
874 874 problems += 1
875 875
876 876 # compiled modules
877 877 ui.status(_("Checking extensions...\n"))
878 878 try:
879 879 import bdiff, mpatch, base85
880 880 except Exception, inst:
881 881 ui.write(" %s\n" % inst)
882 882 ui.write(_(" One or more extensions could not be found"))
883 883 ui.write(_(" (check that you compiled the extensions)\n"))
884 884 problems += 1
885 885
886 886 # templates
887 887 ui.status(_("Checking templates...\n"))
888 888 try:
889 889 import templater
890 890 t = templater.templater(templater.templatepath("map-cmdline.default"))
891 891 except Exception, inst:
892 892 ui.write(" %s\n" % inst)
893 893 ui.write(_(" (templates seem to have been installed incorrectly)\n"))
894 894 problems += 1
895 895
896 896 # patch
897 897 ui.status(_("Checking patch...\n"))
898 898 patchproblems = 0
899 899 a = "1\n2\n3\n4\n"
900 900 b = "1\n2\n3\ninsert\n4\n"
901 901 fa = writetemp(a)
902 902 d = mdiff.unidiff(a, None, b, None, os.path.basename(fa),
903 903 os.path.basename(fa))
904 904 fd = writetemp(d)
905 905
906 906 files = {}
907 907 try:
908 908 patch.patch(fd, ui, cwd=os.path.dirname(fa), files=files)
909 909 except util.Abort, e:
910 910 ui.write(_(" patch call failed:\n"))
911 911 ui.write(" " + str(e) + "\n")
912 912 patchproblems += 1
913 913 else:
914 914 if list(files) != [os.path.basename(fa)]:
915 915 ui.write(_(" unexpected patch output!\n"))
916 916 patchproblems += 1
917 917 a = file(fa).read()
918 918 if a != b:
919 919 ui.write(_(" patch test failed!\n"))
920 920 patchproblems += 1
921 921
922 922 if patchproblems:
923 923 if ui.config('ui', 'patch'):
924 924 ui.write(_(" (Current patch tool may be incompatible with patch,"
925 925 " or misconfigured. Please check your .hgrc file)\n"))
926 926 else:
927 927 ui.write(_(" Internal patcher failure, please report this error"
928 928 " to http://www.selenic.com/mercurial/bts\n"))
929 929 problems += patchproblems
930 930
931 931 os.unlink(fa)
932 932 os.unlink(fd)
933 933
934 934 # editor
935 935 ui.status(_("Checking commit editor...\n"))
936 936 editor = ui.geteditor()
937 937 cmdpath = util.find_exe(editor) or util.find_exe(editor.split()[0])
938 938 if not cmdpath:
939 939 if editor == 'vi':
940 940 ui.write(_(" No commit editor set and can't find vi in PATH\n"))
941 941 ui.write(_(" (specify a commit editor in your .hgrc file)\n"))
942 942 else:
943 943 ui.write(_(" Can't find editor '%s' in PATH\n") % editor)
944 944 ui.write(_(" (specify a commit editor in your .hgrc file)\n"))
945 945 problems += 1
946 946
947 947 # check username
948 948 ui.status(_("Checking username...\n"))
949 949 user = os.environ.get("HGUSER")
950 950 if user is None:
951 951 user = ui.config("ui", "username")
952 952 if user is None:
953 953 user = os.environ.get("EMAIL")
954 954 if not user:
955 955 ui.warn(" ")
956 956 ui.username()
957 957 ui.write(_(" (specify a username in your .hgrc file)\n"))
958 958
959 959 if not problems:
960 960 ui.status(_("No problems detected\n"))
961 961 else:
962 962 ui.write(_("%s problems detected,"
963 963 " please check your install!\n") % problems)
964 964
965 965 return problems
966 966
967 967 def debugrename(ui, repo, file1, *pats, **opts):
968 968 """dump rename information"""
969 969
970 970 ctx = repo[opts.get('rev')]
971 971 m = cmdutil.match(repo, (file1,) + pats, opts)
972 972 for abs in ctx.walk(m):
973 973 fctx = ctx[abs]
974 974 o = fctx.filelog().renamed(fctx.filenode())
975 975 rel = m.rel(abs)
976 976 if o:
977 977 ui.write(_("%s renamed from %s:%s\n") % (rel, o[0], hex(o[1])))
978 978 else:
979 979 ui.write(_("%s not renamed\n") % rel)
980 980
981 981 def debugwalk(ui, repo, *pats, **opts):
982 982 """show how files match on given patterns"""
983 983 m = cmdutil.match(repo, pats, opts)
984 984 items = list(repo.walk(m))
985 985 if not items:
986 986 return
987 987 fmt = 'f %%-%ds %%-%ds %%s' % (
988 988 max([len(abs) for abs in items]),
989 989 max([len(m.rel(abs)) for abs in items]))
990 990 for abs in items:
991 991 line = fmt % (abs, m.rel(abs), m.exact(abs) and 'exact' or '')
992 992 ui.write("%s\n" % line.rstrip())
993 993
994 994 def diff(ui, repo, *pats, **opts):
995 995 """diff repository (or selected files)
996 996
997 997 Show differences between revisions for the specified files.
998 998
999 999 Differences between files are shown using the unified diff format.
1000 1000
1001 1001 NOTE: diff may generate unexpected results for merges, as it will
1002 1002 default to comparing against the working directory's first parent
1003 1003 changeset if no revisions are specified.
1004 1004
1005 1005 When two revision arguments are given, then changes are shown
1006 1006 between those revisions. If only one revision is specified then
1007 1007 that revision is compared to the working directory, and, when no
1008 1008 revisions are specified, the working directory files are compared
1009 1009 to its parent.
1010 1010
1011 1011 Without the -a option, diff will avoid generating diffs of files
1012 1012 it detects as binary. With -a, diff will generate a diff anyway,
1013 1013 probably with undesirable results.
1014 1014
1015 1015 Use the --git option to generate diffs in the git extended diff
1016 1016 format. Read the diffs help topic for more information.
1017 1017 """
1018 1018 node1, node2 = cmdutil.revpair(repo, opts.get('rev'))
1019 1019
1020 1020 m = cmdutil.match(repo, pats, opts)
1021 1021 it = patch.diff(repo, node1, node2, match=m, opts=patch.diffopts(ui, opts))
1022 1022 for chunk in it:
1023 1023 repo.ui.write(chunk)
1024 1024
1025 1025 def export(ui, repo, *changesets, **opts):
1026 1026 """dump the header and diffs for one or more changesets
1027 1027
1028 1028 Print the changeset header and diffs for one or more revisions.
1029 1029
1030 1030 The information shown in the changeset header is: author,
1031 1031 changeset hash, parent(s) and commit comment.
1032 1032
1033 1033 NOTE: export may generate unexpected diff output for merge changesets,
1034 1034 as it will compare the merge changeset against its first parent only.
1035 1035
1036 1036 Output may be to a file, in which case the name of the file is
1037 1037 given using a format string. The formatting rules are as follows:
1038 1038
1039 1039 %% literal "%" character
1040 1040 %H changeset hash (40 bytes of hexadecimal)
1041 1041 %N number of patches being generated
1042 1042 %R changeset revision number
1043 1043 %b basename of the exporting repository
1044 1044 %h short-form changeset hash (12 bytes of hexadecimal)
1045 1045 %n zero-padded sequence number, starting at 1
1046 1046 %r zero-padded changeset revision number
1047 1047
1048 1048 Without the -a option, export will avoid generating diffs of files
1049 1049 it detects as binary. With -a, export will generate a diff anyway,
1050 1050 probably with undesirable results.
1051 1051
1052 1052 Use the --git option to generate diffs in the git extended diff
1053 1053 format. Read the diffs help topic for more information.
1054 1054
1055 1055 With the --switch-parent option, the diff will be against the second
1056 1056 parent. It can be useful to review a merge.
1057 1057 """
1058 1058 if not changesets:
1059 1059 raise util.Abort(_("export requires at least one changeset"))
1060 1060 revs = cmdutil.revrange(repo, changesets)
1061 1061 if len(revs) > 1:
1062 1062 ui.note(_('exporting patches:\n'))
1063 1063 else:
1064 1064 ui.note(_('exporting patch:\n'))
1065 1065 patch.export(repo, revs, template=opts.get('output'),
1066 1066 switch_parent=opts.get('switch_parent'),
1067 1067 opts=patch.diffopts(ui, opts))
1068 1068
1069 1069 def grep(ui, repo, pattern, *pats, **opts):
1070 1070 """search for a pattern in specified files and revisions
1071 1071
1072 1072 Search revisions of files for a regular expression.
1073 1073
1074 1074 This command behaves differently than Unix grep. It only accepts
1075 1075 Python/Perl regexps. It searches repository history, not the
1076 1076 working directory. It always prints the revision number in which
1077 1077 a match appears.
1078 1078
1079 1079 By default, grep only prints output for the first revision of a
1080 1080 file in which it finds a match. To get it to print every revision
1081 1081 that contains a change in match status ("-" for a match that
1082 1082 becomes a non-match, or "+" for a non-match that becomes a match),
1083 1083 use the --all flag.
1084 1084 """
1085 1085 reflags = 0
1086 1086 if opts.get('ignore_case'):
1087 1087 reflags |= re.I
1088 1088 try:
1089 1089 regexp = re.compile(pattern, reflags)
1090 1090 except Exception, inst:
1091 1091 ui.warn(_("grep: invalid match pattern: %s\n") % inst)
1092 1092 return None
1093 1093 sep, eol = ':', '\n'
1094 1094 if opts.get('print0'):
1095 1095 sep = eol = '\0'
1096 1096
1097 1097 fcache = {}
1098 1098 def getfile(fn):
1099 1099 if fn not in fcache:
1100 1100 fcache[fn] = repo.file(fn)
1101 1101 return fcache[fn]
1102 1102
1103 1103 def matchlines(body):
1104 1104 begin = 0
1105 1105 linenum = 0
1106 1106 while True:
1107 1107 match = regexp.search(body, begin)
1108 1108 if not match:
1109 1109 break
1110 1110 mstart, mend = match.span()
1111 1111 linenum += body.count('\n', begin, mstart) + 1
1112 1112 lstart = body.rfind('\n', begin, mstart) + 1 or begin
1113 1113 begin = body.find('\n', mend) + 1 or len(body)
1114 1114 lend = begin - 1
1115 1115 yield linenum, mstart - lstart, mend - lstart, body[lstart:lend]
1116 1116
1117 1117 class linestate(object):
1118 1118 def __init__(self, line, linenum, colstart, colend):
1119 1119 self.line = line
1120 1120 self.linenum = linenum
1121 1121 self.colstart = colstart
1122 1122 self.colend = colend
1123 1123
1124 1124 def __hash__(self):
1125 1125 return hash((self.linenum, self.line))
1126 1126
1127 1127 def __eq__(self, other):
1128 1128 return self.line == other.line
1129 1129
1130 1130 matches = {}
1131 1131 copies = {}
1132 1132 def grepbody(fn, rev, body):
1133 1133 matches[rev].setdefault(fn, [])
1134 1134 m = matches[rev][fn]
1135 1135 for lnum, cstart, cend, line in matchlines(body):
1136 1136 s = linestate(line, lnum, cstart, cend)
1137 1137 m.append(s)
1138 1138
1139 1139 def difflinestates(a, b):
1140 1140 sm = difflib.SequenceMatcher(None, a, b)
1141 1141 for tag, alo, ahi, blo, bhi in sm.get_opcodes():
1142 1142 if tag == 'insert':
1143 1143 for i in xrange(blo, bhi):
1144 1144 yield ('+', b[i])
1145 1145 elif tag == 'delete':
1146 1146 for i in xrange(alo, ahi):
1147 1147 yield ('-', a[i])
1148 1148 elif tag == 'replace':
1149 1149 for i in xrange(alo, ahi):
1150 1150 yield ('-', a[i])
1151 1151 for i in xrange(blo, bhi):
1152 1152 yield ('+', b[i])
1153 1153
1154 1154 prev = {}
1155 1155 def display(fn, rev, states, prevstates):
1156 1156 datefunc = ui.quiet and util.shortdate or util.datestr
1157 1157 found = False
1158 1158 filerevmatches = {}
1159 1159 r = prev.get(fn, -1)
1160 1160 if opts.get('all'):
1161 1161 iter = difflinestates(states, prevstates)
1162 1162 else:
1163 1163 iter = [('', l) for l in prevstates]
1164 1164 for change, l in iter:
1165 1165 cols = [fn, str(r)]
1166 1166 if opts.get('line_number'):
1167 1167 cols.append(str(l.linenum))
1168 1168 if opts.get('all'):
1169 1169 cols.append(change)
1170 1170 if opts.get('user'):
1171 1171 cols.append(ui.shortuser(get(r)[1]))
1172 1172 if opts.get('date'):
1173 1173 cols.append(datefunc(get(r)[2]))
1174 1174 if opts.get('files_with_matches'):
1175 1175 c = (fn, r)
1176 1176 if c in filerevmatches:
1177 1177 continue
1178 1178 filerevmatches[c] = 1
1179 1179 else:
1180 1180 cols.append(l.line)
1181 1181 ui.write(sep.join(cols), eol)
1182 1182 found = True
1183 1183 return found
1184 1184
1185 1185 fstate = {}
1186 1186 skip = {}
1187 1187 get = util.cachefunc(lambda r: repo[r].changeset())
1188 1188 changeiter, matchfn = cmdutil.walkchangerevs(ui, repo, pats, get, opts)
1189 1189 found = False
1190 1190 follow = opts.get('follow')
1191 1191 for st, rev, fns in changeiter:
1192 1192 if st == 'window':
1193 1193 matches.clear()
1194 1194 elif st == 'add':
1195 1195 ctx = repo[rev]
1196 1196 matches[rev] = {}
1197 1197 for fn in fns:
1198 1198 if fn in skip:
1199 1199 continue
1200 1200 try:
1201 1201 grepbody(fn, rev, getfile(fn).read(ctx.filenode(fn)))
1202 1202 fstate.setdefault(fn, [])
1203 1203 if follow:
1204 1204 copied = getfile(fn).renamed(ctx.filenode(fn))
1205 1205 if copied:
1206 1206 copies.setdefault(rev, {})[fn] = copied[0]
1207 1207 except revlog.LookupError:
1208 1208 pass
1209 1209 elif st == 'iter':
1210 1210 for fn, m in util.sort(matches[rev].items()):
1211 1211 copy = copies.get(rev, {}).get(fn)
1212 1212 if fn in skip:
1213 1213 if copy:
1214 1214 skip[copy] = True
1215 1215 continue
1216 1216 if fn in prev or fstate[fn]:
1217 1217 r = display(fn, rev, m, fstate[fn])
1218 1218 found = found or r
1219 1219 if r and not opts.get('all'):
1220 1220 skip[fn] = True
1221 1221 if copy:
1222 1222 skip[copy] = True
1223 1223 fstate[fn] = m
1224 1224 if copy:
1225 1225 fstate[copy] = m
1226 1226 prev[fn] = rev
1227 1227
1228 1228 for fn, state in util.sort(fstate.items()):
1229 1229 if fn in skip:
1230 1230 continue
1231 1231 if fn not in copies.get(prev[fn], {}):
1232 1232 found = display(fn, rev, {}, state) or found
1233 1233 return (not found and 1) or 0
1234 1234
1235 1235 def heads(ui, repo, *branchrevs, **opts):
1236 1236 """show current repository heads or show branch heads
1237 1237
1238 1238 With no arguments, show all repository head changesets.
1239 1239
1240 1240 If branch or revisions names are given this will show the heads of
1241 1241 the specified branches or the branches those revisions are tagged
1242 1242 with.
1243 1243
1244 1244 Repository "heads" are changesets that don't have child
1245 1245 changesets. They are where development generally takes place and
1246 1246 are the usual targets for update and merge operations.
1247 1247
1248 1248 Branch heads are changesets that have a given branch tag, but have
1249 1249 no child changesets with that tag. They are usually where
1250 1250 development on the given branch takes place.
1251 1251 """
1252 1252 if opts.get('rev'):
1253 1253 start = repo.lookup(opts['rev'])
1254 1254 else:
1255 1255 start = None
1256 1256 if not branchrevs:
1257 1257 # Assume we're looking repo-wide heads if no revs were specified.
1258 1258 heads = repo.heads(start)
1259 1259 else:
1260 1260 heads = []
1261 1261 visitedset = util.set()
1262 1262 for branchrev in branchrevs:
1263 1263 branch = repo[branchrev].branch()
1264 1264 if branch in visitedset:
1265 1265 continue
1266 1266 visitedset.add(branch)
1267 1267 bheads = repo.branchheads(branch, start)
1268 1268 if not bheads:
1269 1269 if branch != branchrev:
1270 1270 ui.warn(_("no changes on branch %s containing %s are "
1271 1271 "reachable from %s\n")
1272 1272 % (branch, branchrev, opts.get('rev')))
1273 1273 else:
1274 1274 ui.warn(_("no changes on branch %s are reachable from %s\n")
1275 1275 % (branch, opts.get('rev')))
1276 1276 heads.extend(bheads)
1277 1277 if not heads:
1278 1278 return 1
1279 1279 displayer = cmdutil.show_changeset(ui, repo, opts)
1280 1280 for n in heads:
1281 1281 displayer.show(repo[n])
1282 1282
1283 1283 def help_(ui, name=None, with_version=False):
1284 1284 """show help for a given topic or a help overview
1285 1285
1286 1286 With no arguments, print a list of commands and short help.
1287 1287
1288 1288 Given a topic, extension, or command name, print help for that topic."""
1289 1289 option_lists = []
1290 1290
1291 1291 def addglobalopts(aliases):
1292 1292 if ui.verbose:
1293 1293 option_lists.append((_("global options:"), globalopts))
1294 1294 if name == 'shortlist':
1295 1295 option_lists.append((_('use "hg help" for the full list '
1296 1296 'of commands'), ()))
1297 1297 else:
1298 1298 if name == 'shortlist':
1299 1299 msg = _('use "hg help" for the full list of commands '
1300 1300 'or "hg -v" for details')
1301 1301 elif aliases:
1302 1302 msg = _('use "hg -v help%s" to show aliases and '
1303 1303 'global options') % (name and " " + name or "")
1304 1304 else:
1305 1305 msg = _('use "hg -v help %s" to show global options') % name
1306 1306 option_lists.append((msg, ()))
1307 1307
1308 1308 def helpcmd(name):
1309 1309 if with_version:
1310 1310 version_(ui)
1311 1311 ui.write('\n')
1312 1312
1313 1313 try:
1314 1314 aliases, i = cmdutil.findcmd(name, table, False)
1315 1315 except cmdutil.AmbiguousCommand, inst:
1316 1316 select = lambda c: c.lstrip('^').startswith(inst.args[0])
1317 1317 helplist(_('list of commands:\n\n'), select)
1318 1318 return
1319 1319
1320 1320 # synopsis
1321 1321 if len(i) > 2:
1322 1322 if i[2].startswith('hg'):
1323 1323 ui.write("%s\n" % i[2])
1324 1324 else:
1325 1325 ui.write('hg %s %s\n' % (aliases[0], i[2]))
1326 1326 else:
1327 1327 ui.write('hg %s\n' % aliases[0])
1328 1328
1329 1329 # aliases
1330 1330 if not ui.quiet and len(aliases) > 1:
1331 1331 ui.write(_("\naliases: %s\n") % ', '.join(aliases[1:]))
1332 1332
1333 1333 # description
1334 1334 doc = gettext(i[0].__doc__)
1335 1335 if not doc:
1336 1336 doc = _("(No help text available)")
1337 1337 if ui.quiet:
1338 1338 doc = doc.splitlines(0)[0]
1339 1339 ui.write("\n%s\n" % doc.rstrip())
1340 1340
1341 1341 if not ui.quiet:
1342 1342 # options
1343 1343 if i[1]:
1344 1344 option_lists.append((_("options:\n"), i[1]))
1345 1345
1346 1346 addglobalopts(False)
1347 1347
1348 1348 def helplist(header, select=None):
1349 1349 h = {}
1350 1350 cmds = {}
1351 1351 for c, e in table.items():
1352 1352 f = c.split("|", 1)[0]
1353 1353 if select and not select(f):
1354 1354 continue
1355 1355 if (not select and name != 'shortlist' and
1356 1356 e[0].__module__ != __name__):
1357 1357 continue
1358 1358 if name == "shortlist" and not f.startswith("^"):
1359 1359 continue
1360 1360 f = f.lstrip("^")
1361 1361 if not ui.debugflag and f.startswith("debug"):
1362 1362 continue
1363 1363 doc = gettext(e[0].__doc__)
1364 1364 if not doc:
1365 1365 doc = _("(No help text available)")
1366 1366 h[f] = doc.splitlines(0)[0].rstrip()
1367 1367 cmds[f] = c.lstrip("^")
1368 1368
1369 1369 if not h:
1370 1370 ui.status(_('no commands defined\n'))
1371 1371 return
1372 1372
1373 1373 ui.status(header)
1374 1374 fns = util.sort(h)
1375 1375 m = max(map(len, fns))
1376 1376 for f in fns:
1377 1377 if ui.verbose:
1378 1378 commands = cmds[f].replace("|",", ")
1379 1379 ui.write(" %s:\n %s\n"%(commands, h[f]))
1380 1380 else:
1381 1381 ui.write(' %-*s %s\n' % (m, f, h[f]))
1382 1382
1383 1383 exts = list(extensions.extensions())
1384 1384 if exts and name != 'shortlist':
1385 1385 ui.write(_('\nenabled extensions:\n\n'))
1386 1386 maxlength = 0
1387 1387 exthelps = []
1388 1388 for ename, ext in exts:
1389 1389 doc = (ext.__doc__ or _('(no help text available)'))
1390 1390 ename = ename.split('.')[-1]
1391 1391 maxlength = max(len(ename), maxlength)
1392 1392 exthelps.append((ename, doc.splitlines(0)[0].strip()))
1393 1393 for ename, text in exthelps:
1394 1394 ui.write(_(' %s %s\n') % (ename.ljust(maxlength), text))
1395 1395
1396 1396 if not ui.quiet:
1397 1397 addglobalopts(True)
1398 1398
1399 1399 def helptopic(name):
1400 1400 for names, header, doc in help.helptable:
1401 1401 if name in names:
1402 1402 break
1403 1403 else:
1404 1404 raise cmdutil.UnknownCommand(name)
1405 1405
1406 1406 # description
1407 1407 if not doc:
1408 1408 doc = _("(No help text available)")
1409 1409 if callable(doc):
1410 1410 doc = doc()
1411 1411
1412 1412 ui.write("%s\n" % header)
1413 1413 ui.write("%s\n" % doc.rstrip())
1414 1414
1415 1415 def helpext(name):
1416 1416 try:
1417 1417 mod = extensions.find(name)
1418 1418 except KeyError:
1419 1419 raise cmdutil.UnknownCommand(name)
1420 1420
1421 1421 doc = gettext(mod.__doc__) or _('No help text available')
1422 1422 doc = doc.splitlines(0)
1423 1423 ui.write(_('%s extension - %s\n') % (name.split('.')[-1], doc[0]))
1424 1424 for d in doc[1:]:
1425 1425 ui.write(d, '\n')
1426 1426
1427 1427 ui.status('\n')
1428 1428
1429 1429 try:
1430 1430 ct = mod.cmdtable
1431 1431 except AttributeError:
1432 1432 ct = {}
1433 1433
1434 1434 modcmds = dict.fromkeys([c.split('|', 1)[0] for c in ct])
1435 1435 helplist(_('list of commands:\n\n'), modcmds.has_key)
1436 1436
1437 1437 if name and name != 'shortlist':
1438 1438 i = None
1439 1439 for f in (helptopic, helpcmd, helpext):
1440 1440 try:
1441 1441 f(name)
1442 1442 i = None
1443 1443 break
1444 1444 except cmdutil.UnknownCommand, inst:
1445 1445 i = inst
1446 1446 if i:
1447 1447 raise i
1448 1448
1449 1449 else:
1450 1450 # program name
1451 1451 if ui.verbose or with_version:
1452 1452 version_(ui)
1453 1453 else:
1454 1454 ui.status(_("Mercurial Distributed SCM\n"))
1455 1455 ui.status('\n')
1456 1456
1457 1457 # list of commands
1458 1458 if name == "shortlist":
1459 1459 header = _('basic commands:\n\n')
1460 1460 else:
1461 1461 header = _('list of commands:\n\n')
1462 1462
1463 1463 helplist(header)
1464 1464
1465 1465 # list all option lists
1466 1466 opt_output = []
1467 1467 for title, options in option_lists:
1468 1468 opt_output.append(("\n%s" % title, None))
1469 1469 for shortopt, longopt, default, desc in options:
1470 1470 if "DEPRECATED" in desc and not ui.verbose: continue
1471 1471 opt_output.append(("%2s%s" % (shortopt and "-%s" % shortopt,
1472 1472 longopt and " --%s" % longopt),
1473 1473 "%s%s" % (desc,
1474 1474 default
1475 1475 and _(" (default: %s)") % default
1476 1476 or "")))
1477 1477
1478 1478 if not name:
1479 1479 ui.write(_("\nadditional help topics:\n\n"))
1480 1480 topics = []
1481 1481 for names, header, doc in help.helptable:
1482 1482 names = [(-len(name), name) for name in names]
1483 1483 names.sort()
1484 1484 topics.append((names[0][1], header))
1485 1485 topics_len = max([len(s[0]) for s in topics])
1486 1486 for t, desc in topics:
1487 1487 ui.write(" %-*s %s\n" % (topics_len, t, desc))
1488 1488
1489 1489 if opt_output:
1490 1490 opts_len = max([len(line[0]) for line in opt_output if line[1]] or [0])
1491 1491 for first, second in opt_output:
1492 1492 if second:
1493 1493 ui.write(" %-*s %s\n" % (opts_len, first, second))
1494 1494 else:
1495 1495 ui.write("%s\n" % first)
1496 1496
1497 1497 def identify(ui, repo, source=None,
1498 1498 rev=None, num=None, id=None, branch=None, tags=None):
1499 1499 """identify the working copy or specified revision
1500 1500
1501 1501 With no revision, print a summary of the current state of the repo.
1502 1502
1503 1503 With a path, do a lookup in another repository.
1504 1504
1505 1505 This summary identifies the repository state using one or two parent
1506 1506 hash identifiers, followed by a "+" if there are uncommitted changes
1507 1507 in the working directory, a list of tags for this revision and a branch
1508 1508 name for non-default branches.
1509 1509 """
1510 1510
1511 1511 if not repo and not source:
1512 1512 raise util.Abort(_("There is no Mercurial repository here "
1513 1513 "(.hg not found)"))
1514 1514
1515 1515 hexfunc = ui.debugflag and hex or short
1516 1516 default = not (num or id or branch or tags)
1517 1517 output = []
1518 1518
1519 1519 if source:
1520 1520 source, revs, checkout = hg.parseurl(ui.expandpath(source), [])
1521 1521 srepo = hg.repository(ui, source)
1522 1522 if not rev and revs:
1523 1523 rev = revs[0]
1524 1524 if not rev:
1525 1525 rev = "tip"
1526 1526 if num or branch or tags:
1527 1527 raise util.Abort(
1528 1528 "can't query remote revision number, branch, or tags")
1529 1529 output = [hexfunc(srepo.lookup(rev))]
1530 1530 elif not rev:
1531 1531 ctx = repo[None]
1532 1532 parents = ctx.parents()
1533 1533 changed = False
1534 1534 if default or id or num:
1535 1535 changed = ctx.files() + ctx.deleted()
1536 1536 if default or id:
1537 1537 output = ["%s%s" % ('+'.join([hexfunc(p.node()) for p in parents]),
1538 1538 (changed) and "+" or "")]
1539 1539 if num:
1540 1540 output.append("%s%s" % ('+'.join([str(p.rev()) for p in parents]),
1541 1541 (changed) and "+" or ""))
1542 1542 else:
1543 1543 ctx = repo[rev]
1544 1544 if default or id:
1545 1545 output = [hexfunc(ctx.node())]
1546 1546 if num:
1547 1547 output.append(str(ctx.rev()))
1548 1548
1549 1549 if not source and default and not ui.quiet:
1550 1550 b = util.tolocal(ctx.branch())
1551 1551 if b != 'default':
1552 1552 output.append("(%s)" % b)
1553 1553
1554 1554 # multiple tags for a single parent separated by '/'
1555 1555 t = "/".join(ctx.tags())
1556 1556 if t:
1557 1557 output.append(t)
1558 1558
1559 1559 if branch:
1560 1560 output.append(util.tolocal(ctx.branch()))
1561 1561
1562 1562 if tags:
1563 1563 output.extend(ctx.tags())
1564 1564
1565 1565 ui.write("%s\n" % ' '.join(output))
1566 1566
1567 1567 def import_(ui, repo, patch1, *patches, **opts):
1568 1568 """import an ordered set of patches
1569 1569
1570 1570 Import a list of patches and commit them individually.
1571 1571
1572 1572 If there are outstanding changes in the working directory, import
1573 1573 will abort unless given the -f flag.
1574 1574
1575 1575 You can import a patch straight from a mail message. Even patches
1576 1576 as attachments work (body part must be type text/plain or
1577 1577 text/x-patch to be used). From and Subject headers of email
1578 1578 message are used as default committer and commit message. All
1579 1579 text/plain body parts before first diff are added to commit
1580 1580 message.
1581 1581
1582 1582 If the imported patch was generated by hg export, user and description
1583 1583 from patch override values from message headers and body. Values
1584 1584 given on command line with -m and -u override these.
1585 1585
1586 1586 If --exact is specified, import will set the working directory
1587 1587 to the parent of each patch before applying it, and will abort
1588 1588 if the resulting changeset has a different ID than the one
1589 1589 recorded in the patch. This may happen due to character set
1590 1590 problems or other deficiencies in the text patch format.
1591 1591
1592 1592 With --similarity, hg will attempt to discover renames and copies
1593 1593 in the patch in the same way as 'addremove'.
1594 1594
1595 1595 To read a patch from standard input, use patch name "-".
1596 1596 See 'hg help dates' for a list of formats valid for -d/--date.
1597 1597 """
1598 1598 patches = (patch1,) + patches
1599 1599
1600 1600 date = opts.get('date')
1601 1601 if date:
1602 1602 opts['date'] = util.parsedate(date)
1603 1603
1604 1604 try:
1605 1605 sim = float(opts.get('similarity') or 0)
1606 1606 except ValueError:
1607 1607 raise util.Abort(_('similarity must be a number'))
1608 1608 if sim < 0 or sim > 100:
1609 1609 raise util.Abort(_('similarity must be between 0 and 100'))
1610 1610
1611 1611 if opts.get('exact') or not opts.get('force'):
1612 1612 cmdutil.bail_if_changed(repo)
1613 1613
1614 1614 d = opts["base"]
1615 1615 strip = opts["strip"]
1616 1616 wlock = lock = None
1617 1617 try:
1618 1618 wlock = repo.wlock()
1619 1619 lock = repo.lock()
1620 1620 for p in patches:
1621 1621 pf = os.path.join(d, p)
1622 1622
1623 1623 if pf == '-':
1624 1624 ui.status(_("applying patch from stdin\n"))
1625 1625 pf = sys.stdin
1626 1626 else:
1627 1627 ui.status(_("applying %s\n") % p)
1628 1628 pf = url.open(ui, pf)
1629 1629 data = patch.extract(ui, pf)
1630 1630 tmpname, message, user, date, branch, nodeid, p1, p2 = data
1631 1631
1632 1632 if tmpname is None:
1633 1633 raise util.Abort(_('no diffs found'))
1634 1634
1635 1635 try:
1636 1636 cmdline_message = cmdutil.logmessage(opts)
1637 1637 if cmdline_message:
1638 1638 # pickup the cmdline msg
1639 1639 message = cmdline_message
1640 1640 elif message:
1641 1641 # pickup the patch msg
1642 1642 message = message.strip()
1643 1643 else:
1644 1644 # launch the editor
1645 1645 message = None
1646 1646 ui.debug(_('message:\n%s\n') % message)
1647 1647
1648 1648 wp = repo.parents()
1649 1649 if opts.get('exact'):
1650 1650 if not nodeid or not p1:
1651 1651 raise util.Abort(_('not a mercurial patch'))
1652 1652 p1 = repo.lookup(p1)
1653 1653 p2 = repo.lookup(p2 or hex(nullid))
1654 1654
1655 1655 if p1 != wp[0].node():
1656 1656 hg.clean(repo, p1)
1657 1657 repo.dirstate.setparents(p1, p2)
1658 1658 elif p2:
1659 1659 try:
1660 1660 p1 = repo.lookup(p1)
1661 1661 p2 = repo.lookup(p2)
1662 1662 if p1 == wp[0].node():
1663 1663 repo.dirstate.setparents(p1, p2)
1664 1664 except RepoError:
1665 1665 pass
1666 1666 if opts.get('exact') or opts.get('import_branch'):
1667 1667 repo.dirstate.setbranch(branch or 'default')
1668 1668
1669 1669 files = {}
1670 1670 try:
1671 1671 fuzz = patch.patch(tmpname, ui, strip=strip, cwd=repo.root,
1672 1672 files=files)
1673 1673 finally:
1674 1674 files = patch.updatedir(ui, repo, files, similarity=sim/100.)
1675 1675 if not opts.get('no_commit'):
1676 1676 n = repo.commit(files, message, opts.get('user') or user,
1677 1677 opts.get('date') or date)
1678 1678 if opts.get('exact'):
1679 1679 if hex(n) != nodeid:
1680 1680 repo.rollback()
1681 1681 raise util.Abort(_('patch is damaged'
1682 1682 ' or loses information'))
1683 1683 # Force a dirstate write so that the next transaction
1684 1684 # backups an up-do-date file.
1685 1685 repo.dirstate.write()
1686 1686 finally:
1687 1687 os.unlink(tmpname)
1688 1688 finally:
1689 1689 del lock, wlock
1690 1690
1691 1691 def incoming(ui, repo, source="default", **opts):
1692 1692 """show new changesets found in source
1693 1693
1694 1694 Show new changesets found in the specified path/URL or the default
1695 1695 pull location. These are the changesets that would be pulled if a pull
1696 1696 was requested.
1697 1697
1698 1698 For remote repository, using --bundle avoids downloading the changesets
1699 1699 twice if the incoming is followed by a pull.
1700 1700
1701 1701 See pull for valid source format details.
1702 1702 """
1703 1703 limit = cmdutil.loglimit(opts)
1704 1704 source, revs, checkout = hg.parseurl(ui.expandpath(source), opts.get('rev'))
1705 1705 cmdutil.setremoteconfig(ui, opts)
1706 1706
1707 1707 other = hg.repository(ui, source)
1708 1708 ui.status(_('comparing with %s\n') % url.hidepassword(source))
1709 1709 if revs:
1710 1710 revs = [other.lookup(rev) for rev in revs]
1711 1711 common, incoming, rheads = repo.findcommonincoming(other, heads=revs,
1712 1712 force=opts["force"])
1713 1713 if not incoming:
1714 1714 try:
1715 1715 os.unlink(opts["bundle"])
1716 1716 except:
1717 1717 pass
1718 1718 ui.status(_("no changes found\n"))
1719 1719 return 1
1720 1720
1721 1721 cleanup = None
1722 1722 try:
1723 1723 fname = opts["bundle"]
1724 1724 if fname or not other.local():
1725 1725 # create a bundle (uncompressed if other repo is not local)
1726 1726
1727 1727 if revs is None and other.capable('changegroupsubset'):
1728 1728 revs = rheads
1729 1729
1730 1730 if revs is None:
1731 1731 cg = other.changegroup(incoming, "incoming")
1732 1732 else:
1733 1733 cg = other.changegroupsubset(incoming, revs, 'incoming')
1734 1734 bundletype = other.local() and "HG10BZ" or "HG10UN"
1735 1735 fname = cleanup = changegroup.writebundle(cg, fname, bundletype)
1736 1736 # keep written bundle?
1737 1737 if opts["bundle"]:
1738 1738 cleanup = None
1739 1739 if not other.local():
1740 1740 # use the created uncompressed bundlerepo
1741 1741 other = bundlerepo.bundlerepository(ui, repo.root, fname)
1742 1742
1743 1743 o = other.changelog.nodesbetween(incoming, revs)[0]
1744 1744 if opts.get('newest_first'):
1745 1745 o.reverse()
1746 1746 displayer = cmdutil.show_changeset(ui, other, opts)
1747 1747 count = 0
1748 1748 for n in o:
1749 1749 if count >= limit:
1750 1750 break
1751 1751 parents = [p for p in other.changelog.parents(n) if p != nullid]
1752 1752 if opts.get('no_merges') and len(parents) == 2:
1753 1753 continue
1754 1754 count += 1
1755 1755 displayer.show(other[n])
1756 1756 finally:
1757 1757 if hasattr(other, 'close'):
1758 1758 other.close()
1759 1759 if cleanup:
1760 1760 os.unlink(cleanup)
1761 1761
1762 1762 def init(ui, dest=".", **opts):
1763 1763 """create a new repository in the given directory
1764 1764
1765 1765 Initialize a new repository in the given directory. If the given
1766 1766 directory does not exist, it is created.
1767 1767
1768 1768 If no directory is given, the current directory is used.
1769 1769
1770 1770 It is possible to specify an ssh:// URL as the destination.
1771 1771 Look at the help text for the pull command for important details
1772 1772 about ssh:// URLs.
1773 1773 """
1774 1774 cmdutil.setremoteconfig(ui, opts)
1775 1775 hg.repository(ui, dest, create=1)
1776 1776
1777 1777 def locate(ui, repo, *pats, **opts):
1778 1778 """locate files matching specific patterns
1779 1779
1780 1780 Print all files under Mercurial control whose names match the
1781 1781 given patterns.
1782 1782
1783 1783 This command searches the entire repository by default. To search
1784 1784 just the current directory and its subdirectories, use
1785 1785 "--include .".
1786 1786
1787 1787 If no patterns are given to match, this command prints all file
1788 1788 names.
1789 1789
1790 1790 If you want to feed the output of this command into the "xargs"
1791 1791 command, use the "-0" option to both this command and "xargs".
1792 1792 This will avoid the problem of "xargs" treating single filenames
1793 1793 that contain white space as multiple filenames.
1794 1794 """
1795 1795 end = opts.get('print0') and '\0' or '\n'
1796 1796 rev = opts.get('rev') or None
1797 1797
1798 1798 ret = 1
1799 1799 m = cmdutil.match(repo, pats, opts, default='relglob')
1800 1800 m.bad = lambda x,y: False
1801 1801 for abs in repo[rev].walk(m):
1802 1802 if not rev and abs not in repo.dirstate:
1803 1803 continue
1804 1804 if opts.get('fullpath'):
1805 1805 ui.write(repo.wjoin(abs), end)
1806 1806 else:
1807 1807 ui.write(((pats and m.rel(abs)) or abs), end)
1808 1808 ret = 0
1809 1809
1810 1810 return ret
1811 1811
1812 1812 def log(ui, repo, *pats, **opts):
1813 1813 """show revision history of entire repository or files
1814 1814
1815 1815 Print the revision history of the specified files or the entire
1816 1816 project.
1817 1817
1818 1818 File history is shown without following rename or copy history of
1819 1819 files. Use -f/--follow with a file name to follow history across
1820 1820 renames and copies. --follow without a file name will only show
1821 1821 ancestors or descendants of the starting revision. --follow-first
1822 1822 only follows the first parent of merge revisions.
1823 1823
1824 1824 If no revision range is specified, the default is tip:0 unless
1825 1825 --follow is set, in which case the working directory parent is
1826 1826 used as the starting revision.
1827 1827
1828 1828 See 'hg help dates' for a list of formats valid for -d/--date.
1829 1829
1830 1830 By default this command outputs: changeset id and hash, tags,
1831 1831 non-trivial parents, user, date and time, and a summary for each
1832 1832 commit. When the -v/--verbose switch is used, the list of changed
1833 1833 files and full commit message is shown.
1834 1834
1835 1835 NOTE: log -p may generate unexpected diff output for merge
1836 1836 changesets, as it will compare the merge changeset against its
1837 1837 first parent only. Also, the files: list will only reflect files
1838 1838 that are different from BOTH parents.
1839 1839
1840 1840 """
1841 1841
1842 1842 get = util.cachefunc(lambda r: repo[r].changeset())
1843 1843 changeiter, matchfn = cmdutil.walkchangerevs(ui, repo, pats, get, opts)
1844 1844
1845 1845 limit = cmdutil.loglimit(opts)
1846 1846 count = 0
1847 1847
1848 1848 if opts.get('copies') and opts.get('rev'):
1849 1849 endrev = max(cmdutil.revrange(repo, opts.get('rev'))) + 1
1850 1850 else:
1851 1851 endrev = len(repo)
1852 1852 rcache = {}
1853 1853 ncache = {}
1854 1854 def getrenamed(fn, rev):
1855 1855 '''looks up all renames for a file (up to endrev) the first
1856 1856 time the file is given. It indexes on the changerev and only
1857 1857 parses the manifest if linkrev != changerev.
1858 1858 Returns rename info for fn at changerev rev.'''
1859 1859 if fn not in rcache:
1860 1860 rcache[fn] = {}
1861 1861 ncache[fn] = {}
1862 1862 fl = repo.file(fn)
1863 1863 for i in fl:
1864 1864 node = fl.node(i)
1865 1865 lr = fl.linkrev(i)
1866 1866 renamed = fl.renamed(node)
1867 1867 rcache[fn][lr] = renamed
1868 1868 if renamed:
1869 1869 ncache[fn][node] = renamed
1870 1870 if lr >= endrev:
1871 1871 break
1872 1872 if rev in rcache[fn]:
1873 1873 return rcache[fn][rev]
1874 1874
1875 1875 # If linkrev != rev (i.e. rev not found in rcache) fallback to
1876 1876 # filectx logic.
1877 1877
1878 1878 try:
1879 1879 return repo[rev][fn].renamed()
1880 1880 except revlog.LookupError:
1881 1881 pass
1882 1882 return None
1883 1883
1884 1884 df = False
1885 1885 if opts["date"]:
1886 1886 df = util.matchdate(opts["date"])
1887 1887
1888 1888 only_branches = opts.get('only_branch')
1889 1889
1890 1890 displayer = cmdutil.show_changeset(ui, repo, opts, True, matchfn)
1891 1891 for st, rev, fns in changeiter:
1892 1892 if st == 'add':
1893 1893 parents = [p for p in repo.changelog.parentrevs(rev)
1894 1894 if p != nullrev]
1895 1895 if opts.get('no_merges') and len(parents) == 2:
1896 1896 continue
1897 1897 if opts.get('only_merges') and len(parents) != 2:
1898 1898 continue
1899 1899
1900 1900 if only_branches:
1901 1901 revbranch = get(rev)[5]['branch']
1902 1902 if revbranch not in only_branches:
1903 1903 continue
1904 1904
1905 1905 if df:
1906 1906 changes = get(rev)
1907 1907 if not df(changes[2][0]):
1908 1908 continue
1909 1909
1910 1910 if opts.get('keyword'):
1911 1911 changes = get(rev)
1912 1912 miss = 0
1913 1913 for k in [kw.lower() for kw in opts['keyword']]:
1914 1914 if not (k in changes[1].lower() or
1915 1915 k in changes[4].lower() or
1916 1916 k in " ".join(changes[3]).lower()):
1917 1917 miss = 1
1918 1918 break
1919 1919 if miss:
1920 1920 continue
1921 1921
1922 1922 if opts['user']:
1923 1923 changes = get(rev)
1924 1924 miss = 0
1925 1925 for k in opts['user']:
1926 1926 if k != changes[1]:
1927 1927 miss = 1
1928 1928 break
1929 1929 if miss:
1930 1930 continue
1931 1931
1932 1932 copies = []
1933 1933 if opts.get('copies') and rev:
1934 1934 for fn in get(rev)[3]:
1935 1935 rename = getrenamed(fn, rev)
1936 1936 if rename:
1937 1937 copies.append((fn, rename[0]))
1938 1938 displayer.show(context.changectx(repo, rev), copies=copies)
1939 1939 elif st == 'iter':
1940 1940 if count == limit: break
1941 1941 if displayer.flush(rev):
1942 1942 count += 1
1943 1943
1944 1944 def manifest(ui, repo, node=None, rev=None):
1945 1945 """output the current or given revision of the project manifest
1946 1946
1947 1947 Print a list of version controlled files for the given revision.
1948 1948 If no revision is given, the parent of the working directory is used,
1949 1949 or tip if no revision is checked out.
1950 1950
1951 1951 The manifest is the list of files being version controlled. If no revision
1952 1952 is given then the first parent of the working directory is used.
1953 1953
1954 1954 With -v flag, print file permissions, symlink and executable bits. With
1955 1955 --debug flag, print file revision hashes.
1956 1956 """
1957 1957
1958 1958 if rev and node:
1959 1959 raise util.Abort(_("please specify just one revision"))
1960 1960
1961 1961 if not node:
1962 1962 node = rev
1963 1963
1964 1964 decor = {'l':'644 @ ', 'x':'755 * ', '':'644 '}
1965 1965 ctx = repo[node]
1966 1966 for f in ctx:
1967 1967 if ui.debugflag:
1968 1968 ui.write("%40s " % hex(ctx.manifest()[f]))
1969 1969 if ui.verbose:
1970 1970 ui.write(decor[ctx.flags(f)])
1971 1971 ui.write("%s\n" % f)
1972 1972
1973 1973 def merge(ui, repo, node=None, force=None, rev=None):
1974 1974 """merge working directory with another revision
1975 1975
1976 1976 Merge the contents of the current working directory and the
1977 1977 requested revision. Files that changed between either parent are
1978 1978 marked as changed for the next commit and a commit must be
1979 1979 performed before any further updates are allowed.
1980 1980
1981 1981 If no revision is specified, the working directory's parent is a
1982 1982 head revision, and the current branch contains exactly one other head,
1983 1983 the other head is merged with by default. Otherwise, an explicit
1984 1984 revision to merge with must be provided.
1985 1985 """
1986 1986
1987 1987 if rev and node:
1988 1988 raise util.Abort(_("please specify just one revision"))
1989 1989 if not node:
1990 1990 node = rev
1991 1991
1992 1992 if not node:
1993 1993 branch = repo.changectx(None).branch()
1994 1994 bheads = repo.branchheads(branch)
1995 1995 if len(bheads) > 2:
1996 1996 raise util.Abort(_("branch '%s' has %d heads - "
1997 1997 "please merge with an explicit rev") %
1998 1998 (branch, len(bheads)))
1999 1999
2000 2000 parent = repo.dirstate.parents()[0]
2001 2001 if len(bheads) == 1:
2002 2002 if len(repo.heads()) > 1:
2003 2003 raise util.Abort(_("branch '%s' has one head - "
2004 2004 "please merge with an explicit rev") %
2005 2005 branch)
2006 2006 msg = _('there is nothing to merge')
2007 2007 if parent != repo.lookup(repo[None].branch()):
2008 2008 msg = _('%s - use "hg update" instead') % msg
2009 2009 raise util.Abort(msg)
2010 2010
2011 2011 if parent not in bheads:
2012 2012 raise util.Abort(_('working dir not at a head rev - '
2013 2013 'use "hg update" or merge with an explicit rev'))
2014 2014 node = parent == bheads[0] and bheads[-1] or bheads[0]
2015 2015 return hg.merge(repo, node, force=force)
2016 2016
2017 2017 def outgoing(ui, repo, dest=None, **opts):
2018 2018 """show changesets not found in destination
2019 2019
2020 2020 Show changesets not found in the specified destination repository or
2021 2021 the default push location. These are the changesets that would be pushed
2022 2022 if a push was requested.
2023 2023
2024 2024 See pull for valid destination format details.
2025 2025 """
2026 2026 limit = cmdutil.loglimit(opts)
2027 2027 dest, revs, checkout = hg.parseurl(
2028 2028 ui.expandpath(dest or 'default-push', dest or 'default'), opts.get('rev'))
2029 2029 cmdutil.setremoteconfig(ui, opts)
2030 2030 if revs:
2031 2031 revs = [repo.lookup(rev) for rev in revs]
2032 2032
2033 2033 other = hg.repository(ui, dest)
2034 2034 ui.status(_('comparing with %s\n') % url.hidepassword(dest))
2035 2035 o = repo.findoutgoing(other, force=opts.get('force'))
2036 2036 if not o:
2037 2037 ui.status(_("no changes found\n"))
2038 2038 return 1
2039 2039 o = repo.changelog.nodesbetween(o, revs)[0]
2040 2040 if opts.get('newest_first'):
2041 2041 o.reverse()
2042 2042 displayer = cmdutil.show_changeset(ui, repo, opts)
2043 2043 count = 0
2044 2044 for n in o:
2045 2045 if count >= limit:
2046 2046 break
2047 2047 parents = [p for p in repo.changelog.parents(n) if p != nullid]
2048 2048 if opts.get('no_merges') and len(parents) == 2:
2049 2049 continue
2050 2050 count += 1
2051 2051 displayer.show(repo[n])
2052 2052
2053 2053 def parents(ui, repo, file_=None, **opts):
2054 2054 """show the parents of the working dir or revision
2055 2055
2056 2056 Print the working directory's parent revisions. If a
2057 2057 revision is given via --rev, the parent of that revision
2058 2058 will be printed. If a file argument is given, revision in
2059 2059 which the file was last changed (before the working directory
2060 2060 revision or the argument to --rev if given) is printed.
2061 2061 """
2062 2062 rev = opts.get('rev')
2063 2063 if rev:
2064 2064 ctx = repo[rev]
2065 2065 else:
2066 2066 ctx = repo[None]
2067 2067
2068 2068 if file_:
2069 2069 m = cmdutil.match(repo, (file_,), opts)
2070 2070 if m.anypats() or len(m.files()) != 1:
2071 2071 raise util.Abort(_('can only specify an explicit file name'))
2072 2072 file_ = m.files()[0]
2073 2073 filenodes = []
2074 2074 for cp in ctx.parents():
2075 2075 if not cp:
2076 2076 continue
2077 2077 try:
2078 2078 filenodes.append(cp.filenode(file_))
2079 2079 except revlog.LookupError:
2080 2080 pass
2081 2081 if not filenodes:
2082 2082 raise util.Abort(_("'%s' not found in manifest!") % file_)
2083 2083 fl = repo.file(file_)
2084 2084 p = [repo.lookup(fl.linkrev(fl.rev(fn))) for fn in filenodes]
2085 2085 else:
2086 2086 p = [cp.node() for cp in ctx.parents()]
2087 2087
2088 2088 displayer = cmdutil.show_changeset(ui, repo, opts)
2089 2089 for n in p:
2090 2090 if n != nullid:
2091 2091 displayer.show(repo[n])
2092 2092
2093 2093 def paths(ui, repo, search=None):
2094 2094 """show definition of symbolic path names
2095 2095
2096 2096 Show definition of symbolic path name NAME. If no name is given, show
2097 2097 definition of available names.
2098 2098
2099 2099 Path names are defined in the [paths] section of /etc/mercurial/hgrc
2100 2100 and $HOME/.hgrc. If run inside a repository, .hg/hgrc is used, too.
2101 2101 """
2102 2102 if search:
2103 2103 for name, path in ui.configitems("paths"):
2104 2104 if name == search:
2105 2105 ui.write("%s\n" % url.hidepassword(path))
2106 2106 return
2107 2107 ui.warn(_("not found!\n"))
2108 2108 return 1
2109 2109 else:
2110 2110 for name, path in ui.configitems("paths"):
2111 2111 ui.write("%s = %s\n" % (name, url.hidepassword(path)))
2112 2112
2113 2113 def postincoming(ui, repo, modheads, optupdate, checkout):
2114 2114 if modheads == 0:
2115 2115 return
2116 2116 if optupdate:
2117 2117 if (modheads <= 1 or len(repo.branchheads()) == 1) or checkout:
2118 2118 return hg.update(repo, checkout)
2119 2119 else:
2120 2120 ui.status(_("not updating, since new heads added\n"))
2121 2121 if modheads > 1:
2122 2122 ui.status(_("(run 'hg heads' to see heads, 'hg merge' to merge)\n"))
2123 2123 else:
2124 2124 ui.status(_("(run 'hg update' to get a working copy)\n"))
2125 2125
2126 2126 def pull(ui, repo, source="default", **opts):
2127 2127 """pull changes from the specified source
2128 2128
2129 2129 Pull changes from a remote repository to a local one.
2130 2130
2131 2131 This finds all changes from the repository at the specified path
2132 2132 or URL and adds them to the local repository. By default, this
2133 2133 does not update the copy of the project in the working directory.
2134 2134
2135 2135 Valid URLs are of the form:
2136 2136
2137 2137 local/filesystem/path (or file://local/filesystem/path)
2138 2138 http://[user[:pass]@]host[:port]/[path]
2139 2139 https://[user[:pass]@]host[:port]/[path]
2140 2140 ssh://[user[:pass]@]host[:port]/[path]
2141 2141
2142 2142 Paths in the local filesystem can either point to Mercurial
2143 2143 repositories or to bundle files (as created by 'hg bundle' or
2144 2144 'hg incoming --bundle').
2145 2145
2146 2146 An optional identifier after # indicates a particular branch, tag,
2147 2147 or changeset to pull.
2148 2148
2149 2149 Some notes about using SSH with Mercurial:
2150 2150 - SSH requires an accessible shell account on the destination machine
2151 2151 and a copy of hg in the remote path or specified with as remotecmd.
2152 2152 - path is relative to the remote user's home directory by default.
2153 2153 Use an extra slash at the start of a path to specify an absolute path:
2154 2154 ssh://example.com//tmp/repository
2155 2155 - Mercurial doesn't use its own compression via SSH; the right thing
2156 2156 to do is to configure it in your ~/.ssh/config, e.g.:
2157 2157 Host *.mylocalnetwork.example.com
2158 2158 Compression no
2159 2159 Host *
2160 2160 Compression yes
2161 2161 Alternatively specify "ssh -C" as your ssh command in your hgrc or
2162 2162 with the --ssh command line option.
2163 2163 """
2164 2164 source, revs, checkout = hg.parseurl(ui.expandpath(source), opts.get('rev'))
2165 2165 cmdutil.setremoteconfig(ui, opts)
2166 2166
2167 2167 other = hg.repository(ui, source)
2168 2168 ui.status(_('pulling from %s\n') % url.hidepassword(source))
2169 2169 if revs:
2170 2170 try:
2171 2171 revs = [other.lookup(rev) for rev in revs]
2172 2172 except NoCapability:
2173 2173 error = _("Other repository doesn't support revision lookup, "
2174 2174 "so a rev cannot be specified.")
2175 2175 raise util.Abort(error)
2176 2176
2177 2177 modheads = repo.pull(other, heads=revs, force=opts.get('force'))
2178 2178 return postincoming(ui, repo, modheads, opts.get('update'), checkout)
2179 2179
2180 2180 def push(ui, repo, dest=None, **opts):
2181 2181 """push changes to the specified destination
2182 2182
2183 2183 Push changes from the local repository to the given destination.
2184 2184
2185 2185 This is the symmetrical operation for pull. It helps to move
2186 2186 changes from the current repository to a different one. If the
2187 2187 destination is local this is identical to a pull in that directory
2188 2188 from the current one.
2189 2189
2190 2190 By default, push will refuse to run if it detects the result would
2191 2191 increase the number of remote heads. This generally indicates the
2192 2192 the client has forgotten to pull and merge before pushing.
2193 2193
2194 2194 Valid URLs are of the form:
2195 2195
2196 2196 local/filesystem/path (or file://local/filesystem/path)
2197 2197 ssh://[user[:pass]@]host[:port]/[path]
2198 2198 http://[user[:pass]@]host[:port]/[path]
2199 2199 https://[user[:pass]@]host[:port]/[path]
2200 2200
2201 2201 An optional identifier after # indicates a particular branch, tag,
2202 2202 or changeset to push. If -r is used, the named changeset and all its
2203 2203 ancestors will be pushed to the remote repository.
2204 2204
2205 2205 Look at the help text for the pull command for important details
2206 2206 about ssh:// URLs.
2207 2207
2208 2208 Pushing to http:// and https:// URLs is only possible, if this
2209 2209 feature is explicitly enabled on the remote Mercurial server.
2210 2210 """
2211 2211 dest, revs, checkout = hg.parseurl(
2212 2212 ui.expandpath(dest or 'default-push', dest or 'default'), opts.get('rev'))
2213 2213 cmdutil.setremoteconfig(ui, opts)
2214 2214
2215 2215 other = hg.repository(ui, dest)
2216 2216 ui.status(_('pushing to %s\n') % url.hidepassword(dest))
2217 2217 if revs:
2218 2218 revs = [repo.lookup(rev) for rev in revs]
2219 2219 r = repo.push(other, opts.get('force'), revs=revs)
2220 2220 return r == 0
2221 2221
2222 2222 def rawcommit(ui, repo, *pats, **opts):
2223 2223 """raw commit interface (DEPRECATED)
2224 2224
2225 2225 (DEPRECATED)
2226 2226 Lowlevel commit, for use in helper scripts.
2227 2227
2228 2228 This command is not intended to be used by normal users, as it is
2229 2229 primarily useful for importing from other SCMs.
2230 2230
2231 2231 This command is now deprecated and will be removed in a future
2232 2232 release, please use debugsetparents and commit instead.
2233 2233 """
2234 2234
2235 2235 ui.warn(_("(the rawcommit command is deprecated)\n"))
2236 2236
2237 2237 message = cmdutil.logmessage(opts)
2238 2238
2239 2239 files = cmdutil.match(repo, pats, opts).files()
2240 2240 if opts.get('files'):
2241 2241 files += open(opts['files']).read().splitlines()
2242 2242
2243 2243 parents = [repo.lookup(p) for p in opts['parent']]
2244 2244
2245 2245 try:
2246 2246 repo.rawcommit(files, message, opts['user'], opts['date'], *parents)
2247 2247 except ValueError, inst:
2248 2248 raise util.Abort(str(inst))
2249 2249
2250 2250 def recover(ui, repo):
2251 2251 """roll back an interrupted transaction
2252 2252
2253 2253 Recover from an interrupted commit or pull.
2254 2254
2255 2255 This command tries to fix the repository status after an interrupted
2256 2256 operation. It should only be necessary when Mercurial suggests it.
2257 2257 """
2258 2258 if repo.recover():
2259 2259 return hg.verify(repo)
2260 2260 return 1
2261 2261
2262 2262 def remove(ui, repo, *pats, **opts):
2263 2263 """remove the specified files on the next commit
2264 2264
2265 2265 Schedule the indicated files for removal from the repository.
2266 2266
2267 2267 This only removes files from the current branch, not from the entire
2268 2268 project history. -A can be used to remove only files that have already
2269 2269 been deleted, -f can be used to force deletion, and -Af can be used
2270 2270 to remove files from the next revision without deleting them.
2271 2271
2272 2272 The following table details the behavior of remove for different file
2273 2273 states (columns) and option combinations (rows). The file states are
2274 2274 Added, Clean, Modified and Missing (as reported by hg status). The
2275 2275 actions are Warn, Remove (from branch) and Delete (from disk).
2276 2276
2277 2277 A C M !
2278 2278 none W RD W R
2279 2279 -f R RD RD R
2280 2280 -A W W W R
2281 2281 -Af R R R R
2282 2282
2283 2283 This command schedules the files to be removed at the next commit.
2284 2284 To undo a remove before that, see hg revert.
2285 2285 """
2286 2286
2287 2287 after, force = opts.get('after'), opts.get('force')
2288 2288 if not pats and not after:
2289 2289 raise util.Abort(_('no files specified'))
2290 2290
2291 2291 m = cmdutil.match(repo, pats, opts)
2292 2292 s = repo.status(match=m, clean=True)
2293 2293 modified, added, deleted, clean = s[0], s[1], s[3], s[6]
2294 2294
2295 2295 def warn(files, reason):
2296 2296 for f in files:
2297 2297 ui.warn(_('not removing %s: file %s (use -f to force removal)\n')
2298 2298 % (m.rel(f), reason))
2299 2299
2300 2300 if force:
2301 2301 remove, forget = modified + deleted + clean, added
2302 2302 elif after:
2303 2303 remove, forget = deleted, []
2304 2304 warn(modified + added + clean, _('still exists'))
2305 2305 else:
2306 2306 remove, forget = deleted + clean, []
2307 2307 warn(modified, _('is modified'))
2308 2308 warn(added, _('has been marked for add'))
2309 2309
2310 2310 for f in util.sort(remove + forget):
2311 2311 if ui.verbose or not m.exact(f):
2312 2312 ui.status(_('removing %s\n') % m.rel(f))
2313 2313
2314 2314 repo.forget(forget)
2315 2315 repo.remove(remove, unlink=not after)
2316 2316
2317 2317 def rename(ui, repo, *pats, **opts):
2318 2318 """rename files; equivalent of copy + remove
2319 2319
2320 2320 Mark dest as copies of sources; mark sources for deletion. If
2321 2321 dest is a directory, copies are put in that directory. If dest is
2322 2322 a file, there can only be one source.
2323 2323
2324 2324 By default, this command copies the contents of files as they
2325 2325 stand in the working directory. If invoked with --after, the
2326 2326 operation is recorded, but no copying is performed.
2327 2327
2328 2328 This command takes effect in the next commit. To undo a rename
2329 2329 before that, see hg revert.
2330 2330 """
2331 2331 wlock = repo.wlock(False)
2332 2332 try:
2333 2333 return cmdutil.copy(ui, repo, pats, opts, rename=True)
2334 2334 finally:
2335 2335 del wlock
2336 2336
2337 2337 def resolve(ui, repo, *pats, **opts):
2338 2338 """retry file merges from a merge or update
2339 2339
2340 2340 This command will cleanly retry unresolved file merges using file
2341 2341 revisions preserved from the last update or merge. To attempt to
2342 2342 resolve all unresolved files, use the -a switch.
2343 2343
2344 2344 This command will also allow listing resolved files and manually
2345 2345 marking and unmarking files as resolved.
2346 2346
2347 2347 The codes used to show the status of files are:
2348 2348 U = unresolved
2349 2349 R = resolved
2350 2350 """
2351 2351
2352 2352 all, mark, unmark, show = [opts.get(o) for o in 'all mark unmark list'.split()]
2353 2353
2354 2354 if (show and (mark or unmark)) or (mark and unmark):
2355 2355 raise util.Abort(_("too many options specified"))
2356 2356 if pats and all:
2357 2357 raise util.Abort(_("can't specify --all and patterns"))
2358 2358 if not (all or pats or show or mark or unmark):
2359 2359 raise util.Abort(_('no files or directories specified; '
2360 2360 'use --all to remerge all files'))
2361 2361
2362 2362 ms = merge_.mergestate(repo)
2363 2363 m = cmdutil.match(repo, pats, opts)
2364 2364
2365 2365 for f in ms:
2366 2366 if m(f):
2367 2367 if show:
2368 2368 ui.write("%s %s\n" % (ms[f].upper(), f))
2369 2369 elif mark:
2370 2370 ms.mark(f, "r")
2371 2371 elif unmark:
2372 2372 ms.mark(f, "u")
2373 2373 else:
2374 2374 wctx = repo[None]
2375 2375 mctx = wctx.parents()[-1]
2376 2376 ms.resolve(f, wctx, mctx)
2377 2377
2378 2378 def revert(ui, repo, *pats, **opts):
2379 2379 """restore individual files or dirs to an earlier state
2380 2380
2381 2381 (use update -r to check out earlier revisions, revert does not
2382 2382 change the working dir parents)
2383 2383
2384 2384 With no revision specified, revert the named files or directories
2385 2385 to the contents they had in the parent of the working directory.
2386 2386 This restores the contents of the affected files to an unmodified
2387 2387 state and unschedules adds, removes, copies, and renames. If the
2388 2388 working directory has two parents, you must explicitly specify the
2389 2389 revision to revert to.
2390 2390
2391 2391 Using the -r option, revert the given files or directories to their
2392 2392 contents as of a specific revision. This can be helpful to "roll
2393 2393 back" some or all of an earlier change.
2394 2394 See 'hg help dates' for a list of formats valid for -d/--date.
2395 2395
2396 2396 Revert modifies the working directory. It does not commit any
2397 2397 changes, or change the parent of the working directory. If you
2398 2398 revert to a revision other than the parent of the working
2399 2399 directory, the reverted files will thus appear modified
2400 2400 afterwards.
2401 2401
2402 2402 If a file has been deleted, it is restored. If the executable
2403 2403 mode of a file was changed, it is reset.
2404 2404
2405 2405 If names are given, all files matching the names are reverted.
2406 2406 If no arguments are given, no files are reverted.
2407 2407
2408 2408 Modified files are saved with a .orig suffix before reverting.
2409 2409 To disable these backups, use --no-backup.
2410 2410 """
2411 2411
2412 2412 if opts["date"]:
2413 2413 if opts["rev"]:
2414 2414 raise util.Abort(_("you can't specify a revision and a date"))
2415 2415 opts["rev"] = cmdutil.finddate(ui, repo, opts["date"])
2416 2416
2417 2417 if not pats and not opts.get('all'):
2418 2418 raise util.Abort(_('no files or directories specified; '
2419 2419 'use --all to revert the whole repo'))
2420 2420
2421 2421 parent, p2 = repo.dirstate.parents()
2422 2422 if not opts.get('rev') and p2 != nullid:
2423 2423 raise util.Abort(_('uncommitted merge - please provide a '
2424 2424 'specific revision'))
2425 2425 ctx = repo[opts.get('rev')]
2426 2426 node = ctx.node()
2427 2427 mf = ctx.manifest()
2428 2428 if node == parent:
2429 2429 pmf = mf
2430 2430 else:
2431 2431 pmf = None
2432 2432
2433 2433 # need all matching names in dirstate and manifest of target rev,
2434 2434 # so have to walk both. do not print errors if files exist in one
2435 2435 # but not other.
2436 2436
2437 2437 names = {}
2438 2438
2439 2439 wlock = repo.wlock()
2440 2440 try:
2441 2441 # walk dirstate.
2442 2442 files = []
2443 2443
2444 2444 m = cmdutil.match(repo, pats, opts)
2445 2445 m.bad = lambda x,y: False
2446 2446 for abs in repo.walk(m):
2447 2447 names[abs] = m.rel(abs), m.exact(abs)
2448 2448
2449 2449 # walk target manifest.
2450 2450
2451 2451 def badfn(path, msg):
2452 2452 if path in names:
2453 2453 return False
2454 2454 path_ = path + '/'
2455 2455 for f in names:
2456 2456 if f.startswith(path_):
2457 2457 return False
2458 2458 repo.ui.warn("%s: %s\n" % (m.rel(path), msg))
2459 2459 return False
2460 2460
2461 2461 m = cmdutil.match(repo, pats, opts)
2462 2462 m.bad = badfn
2463 2463 for abs in repo[node].walk(m):
2464 2464 if abs not in names:
2465 2465 names[abs] = m.rel(abs), m.exact(abs)
2466 2466
2467 2467 m = cmdutil.matchfiles(repo, names)
2468 2468 changes = repo.status(match=m)[:4]
2469 2469 modified, added, removed, deleted = map(dict.fromkeys, changes)
2470 2470
2471 2471 # if f is a rename, also revert the source
2472 2472 cwd = repo.getcwd()
2473 2473 for f in added:
2474 2474 src = repo.dirstate.copied(f)
2475 2475 if src and src not in names and repo.dirstate[src] == 'r':
2476 2476 removed[src] = None
2477 2477 names[src] = (repo.pathto(src, cwd), True)
2478 2478
2479 2479 def removeforget(abs):
2480 2480 if repo.dirstate[abs] == 'a':
2481 2481 return _('forgetting %s\n')
2482 2482 return _('removing %s\n')
2483 2483
2484 2484 revert = ([], _('reverting %s\n'))
2485 2485 add = ([], _('adding %s\n'))
2486 2486 remove = ([], removeforget)
2487 2487 undelete = ([], _('undeleting %s\n'))
2488 2488
2489 2489 disptable = (
2490 2490 # dispatch table:
2491 2491 # file state
2492 2492 # action if in target manifest
2493 2493 # action if not in target manifest
2494 2494 # make backup if in target manifest
2495 2495 # make backup if not in target manifest
2496 2496 (modified, revert, remove, True, True),
2497 2497 (added, revert, remove, True, False),
2498 2498 (removed, undelete, None, False, False),
2499 2499 (deleted, revert, remove, False, False),
2500 2500 )
2501 2501
2502 2502 for abs, (rel, exact) in util.sort(names.items()):
2503 2503 mfentry = mf.get(abs)
2504 2504 target = repo.wjoin(abs)
2505 2505 def handle(xlist, dobackup):
2506 2506 xlist[0].append(abs)
2507 2507 if dobackup and not opts.get('no_backup') and util.lexists(target):
2508 2508 bakname = "%s.orig" % rel
2509 2509 ui.note(_('saving current version of %s as %s\n') %
2510 2510 (rel, bakname))
2511 2511 if not opts.get('dry_run'):
2512 2512 util.copyfile(target, bakname)
2513 2513 if ui.verbose or not exact:
2514 2514 msg = xlist[1]
2515 2515 if not isinstance(msg, basestring):
2516 2516 msg = msg(abs)
2517 2517 ui.status(msg % rel)
2518 2518 for table, hitlist, misslist, backuphit, backupmiss in disptable:
2519 2519 if abs not in table: continue
2520 2520 # file has changed in dirstate
2521 2521 if mfentry:
2522 2522 handle(hitlist, backuphit)
2523 2523 elif misslist is not None:
2524 2524 handle(misslist, backupmiss)
2525 2525 break
2526 2526 else:
2527 2527 if abs not in repo.dirstate:
2528 2528 if mfentry:
2529 2529 handle(add, True)
2530 2530 elif exact:
2531 2531 ui.warn(_('file not managed: %s\n') % rel)
2532 2532 continue
2533 2533 # file has not changed in dirstate
2534 2534 if node == parent:
2535 2535 if exact: ui.warn(_('no changes needed to %s\n') % rel)
2536 2536 continue
2537 2537 if pmf is None:
2538 2538 # only need parent manifest in this unlikely case,
2539 2539 # so do not read by default
2540 2540 pmf = repo[parent].manifest()
2541 2541 if abs in pmf:
2542 2542 if mfentry:
2543 2543 # if version of file is same in parent and target
2544 2544 # manifests, do nothing
2545 2545 if (pmf[abs] != mfentry or
2546 2546 pmf.flags(abs) != mf.flags(abs)):
2547 2547 handle(revert, False)
2548 2548 else:
2549 2549 handle(remove, False)
2550 2550
2551 2551 if not opts.get('dry_run'):
2552 2552 def checkout(f):
2553 2553 fc = ctx[f]
2554 2554 repo.wwrite(f, fc.data(), fc.flags())
2555 2555
2556 2556 audit_path = util.path_auditor(repo.root)
2557 2557 for f in remove[0]:
2558 2558 if repo.dirstate[f] == 'a':
2559 2559 repo.dirstate.forget(f)
2560 2560 continue
2561 2561 audit_path(f)
2562 2562 try:
2563 2563 util.unlink(repo.wjoin(f))
2564 2564 except OSError:
2565 2565 pass
2566 2566 repo.dirstate.remove(f)
2567 2567
2568 2568 normal = None
2569 2569 if node == parent:
2570 2570 # We're reverting to our parent. If possible, we'd like status
2571 2571 # to report the file as clean. We have to use normallookup for
2572 2572 # merges to avoid losing information about merged/dirty files.
2573 2573 if p2 != nullid:
2574 2574 normal = repo.dirstate.normallookup
2575 2575 else:
2576 2576 normal = repo.dirstate.normal
2577 2577 for f in revert[0]:
2578 2578 checkout(f)
2579 2579 if normal:
2580 2580 normal(f)
2581 2581
2582 2582 for f in add[0]:
2583 2583 checkout(f)
2584 2584 repo.dirstate.add(f)
2585 2585
2586 2586 normal = repo.dirstate.normallookup
2587 2587 if node == parent and p2 == nullid:
2588 2588 normal = repo.dirstate.normal
2589 2589 for f in undelete[0]:
2590 2590 checkout(f)
2591 2591 normal(f)
2592 2592
2593 2593 finally:
2594 2594 del wlock
2595 2595
2596 2596 def rollback(ui, repo):
2597 2597 """roll back the last transaction
2598 2598
2599 2599 This command should be used with care. There is only one level of
2600 2600 rollback, and there is no way to undo a rollback. It will also
2601 2601 restore the dirstate at the time of the last transaction, losing
2602 2602 any dirstate changes since that time.
2603 2603
2604 2604 Transactions are used to encapsulate the effects of all commands
2605 2605 that create new changesets or propagate existing changesets into a
2606 2606 repository. For example, the following commands are transactional,
2607 2607 and their effects can be rolled back:
2608 2608
2609 2609 commit
2610 2610 import
2611 2611 pull
2612 2612 push (with this repository as destination)
2613 2613 unbundle
2614 2614
2615 2615 This command is not intended for use on public repositories. Once
2616 2616 changes are visible for pull by other users, rolling a transaction
2617 2617 back locally is ineffective (someone else may already have pulled
2618 2618 the changes). Furthermore, a race is possible with readers of the
2619 2619 repository; for example an in-progress pull from the repository
2620 2620 may fail if a rollback is performed.
2621 2621 """
2622 2622 repo.rollback()
2623 2623
2624 2624 def root(ui, repo):
2625 2625 """print the root (top) of the current working dir
2626 2626
2627 2627 Print the root directory of the current repository.
2628 2628 """
2629 2629 ui.write(repo.root + "\n")
2630 2630
2631 2631 def serve(ui, repo, **opts):
2632 2632 """export the repository via HTTP
2633 2633
2634 2634 Start a local HTTP repository browser and pull server.
2635 2635
2636 2636 By default, the server logs accesses to stdout and errors to
2637 2637 stderr. Use the "-A" and "-E" options to log to files.
2638 2638 """
2639 2639
2640 2640 if opts["stdio"]:
2641 2641 if repo is None:
2642 2642 raise RepoError(_("There is no Mercurial repository here"
2643 2643 " (.hg not found)"))
2644 2644 s = sshserver.sshserver(ui, repo)
2645 2645 s.serve_forever()
2646 2646
2647 2647 parentui = ui.parentui or ui
2648 2648 optlist = ("name templates style address port prefix ipv6"
2649 2649 " accesslog errorlog webdir_conf certificate")
2650 2650 for o in optlist.split():
2651 2651 if opts[o]:
2652 2652 parentui.setconfig("web", o, str(opts[o]))
2653 2653 if (repo is not None) and (repo.ui != parentui):
2654 2654 repo.ui.setconfig("web", o, str(opts[o]))
2655 2655
2656 2656 if repo is None and not ui.config("web", "webdir_conf"):
2657 2657 raise RepoError(_("There is no Mercurial repository here"
2658 2658 " (.hg not found)"))
2659 2659
2660 2660 class service:
2661 2661 def init(self):
2662 2662 util.set_signal_handler()
2663 2663 self.httpd = hgweb.server.create_server(parentui, repo)
2664 2664
2665 2665 if not ui.verbose: return
2666 2666
2667 2667 if self.httpd.prefix:
2668 2668 prefix = self.httpd.prefix.strip('/') + '/'
2669 2669 else:
2670 2670 prefix = ''
2671 2671
2672 2672 port = ':%d' % self.httpd.port
2673 2673 if port == ':80':
2674 2674 port = ''
2675 2675
2676 2676 bindaddr = self.httpd.addr
2677 2677 if bindaddr == '0.0.0.0':
2678 2678 bindaddr = '*'
2679 2679 elif ':' in bindaddr: # IPv6
2680 2680 bindaddr = '[%s]' % bindaddr
2681 2681
2682 2682 fqaddr = self.httpd.fqaddr
2683 2683 if ':' in fqaddr:
2684 2684 fqaddr = '[%s]' % fqaddr
2685 2685 ui.status(_('listening at http://%s%s/%s (bound to %s:%d)\n') %
2686 2686 (fqaddr, port, prefix, bindaddr, self.httpd.port))
2687 2687
2688 2688 def run(self):
2689 2689 self.httpd.serve_forever()
2690 2690
2691 2691 service = service()
2692 2692
2693 2693 cmdutil.service(opts, initfn=service.init, runfn=service.run)
2694 2694
2695 2695 def status(ui, repo, *pats, **opts):
2696 2696 """show changed files in the working directory
2697 2697
2698 2698 Show status of files in the repository. If names are given, only
2699 2699 files that match are shown. Files that are clean or ignored or
2700 2700 source of a copy/move operation, are not listed unless -c (clean),
2701 2701 -i (ignored), -C (copies) or -A is given. Unless options described
2702 2702 with "show only ..." are given, the options -mardu are used.
2703 2703
2704 2704 Option -q/--quiet hides untracked (unknown and ignored) files
2705 2705 unless explicitly requested with -u/--unknown or -i/-ignored.
2706 2706
2707 2707 NOTE: status may appear to disagree with diff if permissions have
2708 2708 changed or a merge has occurred. The standard diff format does not
2709 2709 report permission changes and diff only reports changes relative
2710 2710 to one merge parent.
2711 2711
2712 2712 If one revision is given, it is used as the base revision.
2713 2713 If two revisions are given, the difference between them is shown.
2714 2714
2715 2715 The codes used to show the status of files are:
2716 2716 M = modified
2717 2717 A = added
2718 2718 R = removed
2719 2719 C = clean
2720 2720 ! = deleted, but still tracked
2721 2721 ? = not tracked
2722 2722 I = ignored
2723 2723 = the previous added file was copied from here
2724 2724 """
2725 2725
2726 2726 node1, node2 = cmdutil.revpair(repo, opts.get('rev'))
2727 2727 cwd = (pats and repo.getcwd()) or ''
2728 2728 end = opts.get('print0') and '\0' or '\n'
2729 2729 copy = {}
2730 2730 states = 'modified added removed deleted unknown ignored clean'.split()
2731 2731 show = [k for k in states if opts[k]]
2732 2732 if opts.get('all'):
2733 2733 show += ui.quiet and (states[:4] + ['clean']) or states
2734 2734 if not show:
2735 2735 show = ui.quiet and states[:4] or states[:5]
2736 2736
2737 2737 stat = repo.status(node1, node2, cmdutil.match(repo, pats, opts),
2738 2738 'ignored' in show, 'clean' in show, 'unknown' in show)
2739 2739 changestates = zip(states, 'MAR!?IC', stat)
2740 2740
2741 2741 if (opts.get('all') or opts.get('copies')) and not opts.get('no_status'):
2742 2742 ctxn = repo[nullid]
2743 2743 ctx1 = repo[node1]
2744 2744 ctx2 = repo[node2]
2745 2745 added = stat[1]
2746 2746 if node2 is None:
2747 2747 added = stat[0] + stat[1] # merged?
2748 2748
2749 2749 for k, v in copies.copies(repo, ctx1, ctx2, ctxn)[0].items():
2750 2750 if k in added:
2751 2751 copy[k] = v
2752 2752 elif v in added:
2753 2753 copy[v] = k
2754 2754
2755 2755 for state, char, files in changestates:
2756 2756 if state in show:
2757 2757 format = "%s %%s%s" % (char, end)
2758 2758 if opts.get('no_status'):
2759 2759 format = "%%s%s" % end
2760 2760
2761 2761 for f in files:
2762 2762 ui.write(format % repo.pathto(f, cwd))
2763 2763 if f in copy:
2764 2764 ui.write(' %s%s' % (repo.pathto(copy[f], cwd), end))
2765 2765
2766 2766 def tag(ui, repo, name1, *names, **opts):
2767 2767 """add one or more tags for the current or given revision
2768 2768
2769 2769 Name a particular revision using <name>.
2770 2770
2771 2771 Tags are used to name particular revisions of the repository and are
2772 2772 very useful to compare different revisions, to go back to significant
2773 2773 earlier versions or to mark branch points as releases, etc.
2774 2774
2775 2775 If no revision is given, the parent of the working directory is used,
2776 2776 or tip if no revision is checked out.
2777 2777
2778 2778 To facilitate version control, distribution, and merging of tags,
2779 2779 they are stored as a file named ".hgtags" which is managed
2780 2780 similarly to other project files and can be hand-edited if
2781 2781 necessary. The file '.hg/localtags' is used for local tags (not
2782 2782 shared among repositories).
2783 2783
2784 2784 See 'hg help dates' for a list of formats valid for -d/--date.
2785 2785 """
2786 2786
2787 2787 rev_ = "."
2788 2788 names = (name1,) + names
2789 2789 if len(names) != len(dict.fromkeys(names)):
2790 2790 raise util.Abort(_('tag names must be unique'))
2791 2791 for n in names:
2792 2792 if n in ['tip', '.', 'null']:
2793 2793 raise util.Abort(_('the name \'%s\' is reserved') % n)
2794 2794 if opts.get('rev') and opts.get('remove'):
2795 2795 raise util.Abort(_("--rev and --remove are incompatible"))
2796 2796 if opts.get('rev'):
2797 2797 rev_ = opts['rev']
2798 2798 message = opts.get('message')
2799 2799 if opts.get('remove'):
2800 2800 expectedtype = opts.get('local') and 'local' or 'global'
2801 2801 for n in names:
2802 2802 if not repo.tagtype(n):
2803 2803 raise util.Abort(_('tag \'%s\' does not exist') % n)
2804 2804 if repo.tagtype(n) != expectedtype:
2805 2805 raise util.Abort(_('tag \'%s\' is not a %s tag') %
2806 2806 (n, expectedtype))
2807 2807 rev_ = nullid
2808 2808 if not message:
2809 2809 message = _('Removed tag %s') % ', '.join(names)
2810 2810 elif not opts.get('force'):
2811 2811 for n in names:
2812 2812 if n in repo.tags():
2813 2813 raise util.Abort(_('tag \'%s\' already exists '
2814 2814 '(use -f to force)') % n)
2815 2815 if not rev_ and repo.dirstate.parents()[1] != nullid:
2816 2816 raise util.Abort(_('uncommitted merge - please provide a '
2817 2817 'specific revision'))
2818 2818 r = repo[rev_].node()
2819 2819
2820 2820 if not message:
2821 2821 message = (_('Added tag %s for changeset %s') %
2822 2822 (', '.join(names), short(r)))
2823 2823
2824 2824 date = opts.get('date')
2825 2825 if date:
2826 2826 date = util.parsedate(date)
2827 2827
2828 2828 repo.tag(names, r, message, opts.get('local'), opts.get('user'), date)
2829 2829
2830 2830 def tags(ui, repo):
2831 2831 """list repository tags
2832 2832
2833 List the repository tags.
2834
2835 2833 This lists both regular and local tags. When the -v/--verbose switch
2836 2834 is used, a third column "local" is printed for local tags.
2837 2835 """
2838 2836
2839 2837 l = repo.tagslist()
2840 2838 l.reverse()
2841 2839 hexfunc = ui.debugflag and hex or short
2842 2840 tagtype = ""
2843 2841
2844 2842 for t, n in l:
2845 2843 if ui.quiet:
2846 2844 ui.write("%s\n" % t)
2847 2845 continue
2848 2846
2849 2847 try:
2850 2848 hn = hexfunc(n)
2851 2849 r = "%5d:%s" % (repo.changelog.rev(n), hn)
2852 2850 except revlog.LookupError:
2853 2851 r = " ?:%s" % hn
2854 2852 else:
2855 2853 spaces = " " * (30 - util.locallen(t))
2856 2854 if ui.verbose:
2857 2855 if repo.tagtype(t) == 'local':
2858 2856 tagtype = " local"
2859 2857 else:
2860 2858 tagtype = ""
2861 2859 ui.write("%s%s %s%s\n" % (t, spaces, r, tagtype))
2862 2860
2863 2861 def tip(ui, repo, **opts):
2864 2862 """show the tip revision
2865 2863
2866 2864 The tip revision (usually just called the tip) is the most
2867 2865 recently added changeset in the repository, the most recently
2868 2866 changed head.
2869 2867
2870 2868 If you have just made a commit, that commit will be the tip. If
2871 2869 you have just pulled changes from another repository, the tip of
2872 2870 that repository becomes the current tip. The "tip" tag is special
2873 2871 and cannot be renamed or assigned to a different changeset.
2874 2872 """
2875 2873 cmdutil.show_changeset(ui, repo, opts).show(repo[len(repo) - 1])
2876 2874
2877 2875 def unbundle(ui, repo, fname1, *fnames, **opts):
2878 2876 """apply one or more changegroup files
2879 2877
2880 2878 Apply one or more compressed changegroup files generated by the
2881 2879 bundle command.
2882 2880 """
2883 2881 fnames = (fname1,) + fnames
2884 2882
2885 2883 lock = None
2886 2884 try:
2887 2885 lock = repo.lock()
2888 2886 for fname in fnames:
2889 2887 f = url.open(ui, fname)
2890 2888 gen = changegroup.readbundle(f, fname)
2891 2889 modheads = repo.addchangegroup(gen, 'unbundle', 'bundle:' + fname)
2892 2890 finally:
2893 2891 del lock
2894 2892
2895 2893 return postincoming(ui, repo, modheads, opts.get('update'), None)
2896 2894
2897 2895 def update(ui, repo, node=None, rev=None, clean=False, date=None):
2898 2896 """update working directory
2899 2897
2900 2898 Update the repository's working directory to the specified revision,
2901 2899 or the tip of the current branch if none is specified. Use null as
2902 2900 the revision to remove the working copy (like 'hg clone -U').
2903 2901
2904 2902 When the working dir contains no uncommitted changes, it will be
2905 2903 replaced by the state of the requested revision from the repo. When
2906 2904 the requested revision is on a different branch, the working dir
2907 2905 will additionally be switched to that branch.
2908 2906
2909 2907 When there are uncommitted changes, use option -C to discard them,
2910 2908 forcibly replacing the state of the working dir with the requested
2911 2909 revision.
2912 2910
2913 2911 When there are uncommitted changes and option -C is not used, and
2914 2912 the parent revision and requested revision are on the same branch,
2915 2913 and one of them is an ancestor of the other, then the new working
2916 2914 directory will contain the requested revision merged with the
2917 2915 uncommitted changes. Otherwise, the update will fail with a
2918 2916 suggestion to use 'merge' or 'update -C' instead.
2919 2917
2920 2918 If you want to update just one file to an older revision, use revert.
2921 2919
2922 2920 See 'hg help dates' for a list of formats valid for --date.
2923 2921 """
2924 2922 if rev and node:
2925 2923 raise util.Abort(_("please specify just one revision"))
2926 2924
2927 2925 if not rev:
2928 2926 rev = node
2929 2927
2930 2928 if date:
2931 2929 if rev:
2932 2930 raise util.Abort(_("you can't specify a revision and a date"))
2933 2931 rev = cmdutil.finddate(ui, repo, date)
2934 2932
2935 2933 if clean:
2936 2934 return hg.clean(repo, rev)
2937 2935 else:
2938 2936 return hg.update(repo, rev)
2939 2937
2940 2938 def verify(ui, repo):
2941 2939 """verify the integrity of the repository
2942 2940
2943 2941 Verify the integrity of the current repository.
2944 2942
2945 2943 This will perform an extensive check of the repository's
2946 2944 integrity, validating the hashes and checksums of each entry in
2947 2945 the changelog, manifest, and tracked files, as well as the
2948 2946 integrity of their crosslinks and indices.
2949 2947 """
2950 2948 return hg.verify(repo)
2951 2949
2952 2950 def version_(ui):
2953 2951 """output version and copyright information"""
2954 2952 ui.write(_("Mercurial Distributed SCM (version %s)\n")
2955 2953 % version.get_version())
2956 2954 ui.status(_(
2957 2955 "\nCopyright (C) 2005-2008 Matt Mackall <mpm@selenic.com> and others\n"
2958 2956 "This is free software; see the source for copying conditions. "
2959 2957 "There is NO\nwarranty; "
2960 2958 "not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
2961 2959 ))
2962 2960
2963 2961 # Command options and aliases are listed here, alphabetically
2964 2962
2965 2963 globalopts = [
2966 2964 ('R', 'repository', '',
2967 2965 _('repository root directory or symbolic path name')),
2968 2966 ('', 'cwd', '', _('change working directory')),
2969 2967 ('y', 'noninteractive', None,
2970 2968 _('do not prompt, assume \'yes\' for any required answers')),
2971 2969 ('q', 'quiet', None, _('suppress output')),
2972 2970 ('v', 'verbose', None, _('enable additional output')),
2973 2971 ('', 'config', [], _('set/override config option')),
2974 2972 ('', 'debug', None, _('enable debugging output')),
2975 2973 ('', 'debugger', None, _('start debugger')),
2976 2974 ('', 'encoding', util._encoding, _('set the charset encoding')),
2977 2975 ('', 'encodingmode', util._encodingmode, _('set the charset encoding mode')),
2978 2976 ('', 'lsprof', None, _('print improved command execution profile')),
2979 2977 ('', 'traceback', None, _('print traceback on exception')),
2980 2978 ('', 'time', None, _('time how long the command takes')),
2981 2979 ('', 'profile', None, _('print command execution profile')),
2982 2980 ('', 'version', None, _('output version information and exit')),
2983 2981 ('h', 'help', None, _('display help and exit')),
2984 2982 ]
2985 2983
2986 2984 dryrunopts = [('n', 'dry-run', None,
2987 2985 _('do not perform actions, just print output'))]
2988 2986
2989 2987 remoteopts = [
2990 2988 ('e', 'ssh', '', _('specify ssh command to use')),
2991 2989 ('', 'remotecmd', '', _('specify hg command to run on the remote side')),
2992 2990 ]
2993 2991
2994 2992 walkopts = [
2995 2993 ('I', 'include', [], _('include names matching the given patterns')),
2996 2994 ('X', 'exclude', [], _('exclude names matching the given patterns')),
2997 2995 ]
2998 2996
2999 2997 commitopts = [
3000 2998 ('m', 'message', '', _('use <text> as commit message')),
3001 2999 ('l', 'logfile', '', _('read commit message from <file>')),
3002 3000 ]
3003 3001
3004 3002 commitopts2 = [
3005 3003 ('d', 'date', '', _('record datecode as commit date')),
3006 3004 ('u', 'user', '', _('record user as committer')),
3007 3005 ]
3008 3006
3009 3007 templateopts = [
3010 3008 ('', 'style', '', _('display using template map file')),
3011 3009 ('', 'template', '', _('display with template')),
3012 3010 ]
3013 3011
3014 3012 logopts = [
3015 3013 ('p', 'patch', None, _('show patch')),
3016 3014 ('l', 'limit', '', _('limit number of changes displayed')),
3017 3015 ('M', 'no-merges', None, _('do not show merges')),
3018 3016 ] + templateopts
3019 3017
3020 3018 diffopts = [
3021 3019 ('a', 'text', None, _('treat all files as text')),
3022 3020 ('g', 'git', None, _('use git extended diff format')),
3023 3021 ('', 'nodates', None, _("don't include dates in diff headers"))
3024 3022 ]
3025 3023
3026 3024 diffopts2 = [
3027 3025 ('p', 'show-function', None, _('show which function each change is in')),
3028 3026 ('w', 'ignore-all-space', None,
3029 3027 _('ignore white space when comparing lines')),
3030 3028 ('b', 'ignore-space-change', None,
3031 3029 _('ignore changes in the amount of white space')),
3032 3030 ('B', 'ignore-blank-lines', None,
3033 3031 _('ignore changes whose lines are all blank')),
3034 3032 ('U', 'unified', '', _('number of lines of context to show'))
3035 3033 ]
3036 3034
3037 3035 similarityopts = [
3038 3036 ('s', 'similarity', '',
3039 3037 _('guess renamed files by similarity (0<=s<=100)'))
3040 3038 ]
3041 3039
3042 3040 table = {
3043 3041 "^add": (add, walkopts + dryrunopts, _('[OPTION]... [FILE]...')),
3044 3042 "addremove":
3045 3043 (addremove, similarityopts + walkopts + dryrunopts,
3046 3044 _('[OPTION]... [FILE]...')),
3047 3045 "^annotate|blame":
3048 3046 (annotate,
3049 3047 [('r', 'rev', '', _('annotate the specified revision')),
3050 3048 ('f', 'follow', None, _('follow file copies and renames')),
3051 3049 ('a', 'text', None, _('treat all files as text')),
3052 3050 ('u', 'user', None, _('list the author (long with -v)')),
3053 3051 ('d', 'date', None, _('list the date (short with -q)')),
3054 3052 ('n', 'number', None, _('list the revision number (default)')),
3055 3053 ('c', 'changeset', None, _('list the changeset')),
3056 3054 ('l', 'line-number', None,
3057 3055 _('show line number at the first appearance'))
3058 3056 ] + walkopts,
3059 3057 _('[-r REV] [-f] [-a] [-u] [-d] [-n] [-c] [-l] FILE...')),
3060 3058 "archive":
3061 3059 (archive,
3062 3060 [('', 'no-decode', None, _('do not pass files through decoders')),
3063 3061 ('p', 'prefix', '', _('directory prefix for files in archive')),
3064 3062 ('r', 'rev', '', _('revision to distribute')),
3065 3063 ('t', 'type', '', _('type of distribution to create')),
3066 3064 ] + walkopts,
3067 3065 _('[OPTION]... DEST')),
3068 3066 "backout":
3069 3067 (backout,
3070 3068 [('', 'merge', None,
3071 3069 _('merge with old dirstate parent after backout')),
3072 3070 ('', 'parent', '', _('parent to choose when backing out merge')),
3073 3071 ('r', 'rev', '', _('revision to backout')),
3074 3072 ] + walkopts + commitopts + commitopts2,
3075 3073 _('[OPTION]... [-r] REV')),
3076 3074 "bisect":
3077 3075 (bisect,
3078 3076 [('r', 'reset', False, _('reset bisect state')),
3079 3077 ('g', 'good', False, _('mark changeset good')),
3080 3078 ('b', 'bad', False, _('mark changeset bad')),
3081 3079 ('s', 'skip', False, _('skip testing changeset')),
3082 3080 ('c', 'command', '', _('Use command to check changeset state')),
3083 3081 ('U', 'noupdate', False, _('do not update to target'))],
3084 3082 _("[-gbsr] [-c CMD] [REV]")),
3085 3083 "branch":
3086 3084 (branch,
3087 3085 [('f', 'force', None,
3088 3086 _('set branch name even if it shadows an existing branch')),
3089 3087 ('C', 'clean', None, _('reset branch name to parent branch name'))],
3090 3088 _('[-fC] [NAME]')),
3091 3089 "branches":
3092 3090 (branches,
3093 3091 [('a', 'active', False,
3094 3092 _('show only branches that have unmerged heads'))],
3095 3093 _('[-a]')),
3096 3094 "bundle":
3097 3095 (bundle,
3098 3096 [('f', 'force', None,
3099 3097 _('run even when remote repository is unrelated')),
3100 3098 ('r', 'rev', [],
3101 3099 _('a changeset up to which you would like to bundle')),
3102 3100 ('', 'base', [],
3103 3101 _('a base changeset to specify instead of a destination')),
3104 3102 ('a', 'all', None, _('bundle all changesets in the repository')),
3105 3103 ('t', 'type', 'bzip2', _('bundle compression type to use')),
3106 3104 ] + remoteopts,
3107 3105 _('[-f] [-a] [-r REV]... [--base REV]... FILE [DEST]')),
3108 3106 "cat":
3109 3107 (cat,
3110 3108 [('o', 'output', '', _('print output to file with formatted name')),
3111 3109 ('r', 'rev', '', _('print the given revision')),
3112 3110 ('', 'decode', None, _('apply any matching decode filter')),
3113 3111 ] + walkopts,
3114 3112 _('[OPTION]... FILE...')),
3115 3113 "^clone":
3116 3114 (clone,
3117 3115 [('U', 'noupdate', None,
3118 3116 _('the clone will only contain a repository (no working copy)')),
3119 3117 ('r', 'rev', [],
3120 3118 _('a changeset you would like to have after cloning')),
3121 3119 ('', 'pull', None, _('use pull protocol to copy metadata')),
3122 3120 ('', 'uncompressed', None,
3123 3121 _('use uncompressed transfer (fast over LAN)')),
3124 3122 ] + remoteopts,
3125 3123 _('[OPTION]... SOURCE [DEST]')),
3126 3124 "^commit|ci":
3127 3125 (commit,
3128 3126 [('A', 'addremove', None,
3129 3127 _('mark new/missing files as added/removed before committing')),
3130 3128 ] + walkopts + commitopts + commitopts2,
3131 3129 _('[OPTION]... [FILE]...')),
3132 3130 "copy|cp":
3133 3131 (copy,
3134 3132 [('A', 'after', None, _('record a copy that has already occurred')),
3135 3133 ('f', 'force', None,
3136 3134 _('forcibly copy over an existing managed file')),
3137 3135 ] + walkopts + dryrunopts,
3138 3136 _('[OPTION]... [SOURCE]... DEST')),
3139 3137 "debugancestor": (debugancestor, [], _('[INDEX] REV1 REV2')),
3140 3138 "debugcheckstate": (debugcheckstate, []),
3141 3139 "debugcomplete":
3142 3140 (debugcomplete,
3143 3141 [('o', 'options', None, _('show the command options'))],
3144 3142 _('[-o] CMD')),
3145 3143 "debugdate":
3146 3144 (debugdate,
3147 3145 [('e', 'extended', None, _('try extended date formats'))],
3148 3146 _('[-e] DATE [RANGE]')),
3149 3147 "debugdata": (debugdata, [], _('FILE REV')),
3150 3148 "debugfsinfo": (debugfsinfo, [], _('[PATH]')),
3151 3149 "debugindex": (debugindex, [], _('FILE')),
3152 3150 "debugindexdot": (debugindexdot, [], _('FILE')),
3153 3151 "debuginstall": (debuginstall, []),
3154 3152 "debugrawcommit|rawcommit":
3155 3153 (rawcommit,
3156 3154 [('p', 'parent', [], _('parent')),
3157 3155 ('F', 'files', '', _('file list'))
3158 3156 ] + commitopts + commitopts2,
3159 3157 _('[OPTION]... [FILE]...')),
3160 3158 "debugrebuildstate":
3161 3159 (debugrebuildstate,
3162 3160 [('r', 'rev', '', _('revision to rebuild to'))],
3163 3161 _('[-r REV] [REV]')),
3164 3162 "debugrename":
3165 3163 (debugrename,
3166 3164 [('r', 'rev', '', _('revision to debug'))],
3167 3165 _('[-r REV] FILE')),
3168 3166 "debugsetparents":
3169 3167 (debugsetparents, [], _('REV1 [REV2]')),
3170 3168 "debugstate":
3171 3169 (debugstate,
3172 3170 [('', 'nodates', None, _('do not display the saved mtime'))],
3173 3171 _('[OPTION]...')),
3174 3172 "debugwalk": (debugwalk, walkopts, _('[OPTION]... [FILE]...')),
3175 3173 "^diff":
3176 3174 (diff,
3177 3175 [('r', 'rev', [], _('revision'))
3178 3176 ] + diffopts + diffopts2 + walkopts,
3179 3177 _('[OPTION]... [-r REV1 [-r REV2]] [FILE]...')),
3180 3178 "^export":
3181 3179 (export,
3182 3180 [('o', 'output', '', _('print output to file with formatted name')),
3183 3181 ('', 'switch-parent', None, _('diff against the second parent'))
3184 3182 ] + diffopts,
3185 3183 _('[OPTION]... [-o OUTFILESPEC] REV...')),
3186 3184 "grep":
3187 3185 (grep,
3188 3186 [('0', 'print0', None, _('end fields with NUL')),
3189 3187 ('', 'all', None, _('print all revisions that match')),
3190 3188 ('f', 'follow', None,
3191 3189 _('follow changeset history, or file history across copies and renames')),
3192 3190 ('i', 'ignore-case', None, _('ignore case when matching')),
3193 3191 ('l', 'files-with-matches', None,
3194 3192 _('print only filenames and revs that match')),
3195 3193 ('n', 'line-number', None, _('print matching line numbers')),
3196 3194 ('r', 'rev', [], _('search in given revision range')),
3197 3195 ('u', 'user', None, _('list the author (long with -v)')),
3198 3196 ('d', 'date', None, _('list the date (short with -q)')),
3199 3197 ] + walkopts,
3200 3198 _('[OPTION]... PATTERN [FILE]...')),
3201 3199 "heads":
3202 3200 (heads,
3203 3201 [('r', 'rev', '', _('show only heads which are descendants of rev')),
3204 3202 ] + templateopts,
3205 3203 _('[-r REV] [REV]...')),
3206 3204 "help": (help_, [], _('[TOPIC]')),
3207 3205 "identify|id":
3208 3206 (identify,
3209 3207 [('r', 'rev', '', _('identify the specified rev')),
3210 3208 ('n', 'num', None, _('show local revision number')),
3211 3209 ('i', 'id', None, _('show global revision id')),
3212 3210 ('b', 'branch', None, _('show branch')),
3213 3211 ('t', 'tags', None, _('show tags'))],
3214 3212 _('[-nibt] [-r REV] [SOURCE]')),
3215 3213 "import|patch":
3216 3214 (import_,
3217 3215 [('p', 'strip', 1,
3218 3216 _('directory strip option for patch. This has the same\n'
3219 3217 'meaning as the corresponding patch option')),
3220 3218 ('b', 'base', '', _('base path')),
3221 3219 ('f', 'force', None,
3222 3220 _('skip check for outstanding uncommitted changes')),
3223 3221 ('', 'no-commit', None, _("don't commit, just update the working directory")),
3224 3222 ('', 'exact', None,
3225 3223 _('apply patch to the nodes from which it was generated')),
3226 3224 ('', 'import-branch', None,
3227 3225 _('Use any branch information in patch (implied by --exact)'))] +
3228 3226 commitopts + commitopts2 + similarityopts,
3229 3227 _('[OPTION]... PATCH...')),
3230 3228 "incoming|in":
3231 3229 (incoming,
3232 3230 [('f', 'force', None,
3233 3231 _('run even when remote repository is unrelated')),
3234 3232 ('n', 'newest-first', None, _('show newest record first')),
3235 3233 ('', 'bundle', '', _('file to store the bundles into')),
3236 3234 ('r', 'rev', [],
3237 3235 _('a specific revision up to which you would like to pull')),
3238 3236 ] + logopts + remoteopts,
3239 3237 _('[-p] [-n] [-M] [-f] [-r REV]...'
3240 3238 ' [--bundle FILENAME] [SOURCE]')),
3241 3239 "^init":
3242 3240 (init,
3243 3241 remoteopts,
3244 3242 _('[-e CMD] [--remotecmd CMD] [DEST]')),
3245 3243 "locate":
3246 3244 (locate,
3247 3245 [('r', 'rev', '', _('search the repository as it stood at rev')),
3248 3246 ('0', 'print0', None,
3249 3247 _('end filenames with NUL, for use with xargs')),
3250 3248 ('f', 'fullpath', None,
3251 3249 _('print complete paths from the filesystem root')),
3252 3250 ] + walkopts,
3253 3251 _('[OPTION]... [PATTERN]...')),
3254 3252 "^log|history":
3255 3253 (log,
3256 3254 [('f', 'follow', None,
3257 3255 _('follow changeset history, or file history across copies and renames')),
3258 3256 ('', 'follow-first', None,
3259 3257 _('only follow the first parent of merge changesets')),
3260 3258 ('d', 'date', '', _('show revs matching date spec')),
3261 3259 ('C', 'copies', None, _('show copied files')),
3262 3260 ('k', 'keyword', [], _('do case-insensitive search for a keyword')),
3263 3261 ('r', 'rev', [], _('show the specified revision or range')),
3264 3262 ('', 'removed', None, _('include revs where files were removed')),
3265 3263 ('m', 'only-merges', None, _('show only merges')),
3266 3264 ('u', 'user', [], _('revs committed by user')),
3267 3265 ('b', 'only-branch', [],
3268 3266 _('show only changesets within the given named branch')),
3269 3267 ('P', 'prune', [], _('do not display revision or any of its ancestors')),
3270 3268 ] + logopts + walkopts,
3271 3269 _('[OPTION]... [FILE]')),
3272 3270 "manifest":
3273 3271 (manifest,
3274 3272 [('r', 'rev', '', _('revision to display'))],
3275 3273 _('[-r REV]')),
3276 3274 "^merge":
3277 3275 (merge,
3278 3276 [('f', 'force', None, _('force a merge with outstanding changes')),
3279 3277 ('r', 'rev', '', _('revision to merge')),
3280 3278 ],
3281 3279 _('[-f] [[-r] REV]')),
3282 3280 "outgoing|out":
3283 3281 (outgoing,
3284 3282 [('f', 'force', None,
3285 3283 _('run even when remote repository is unrelated')),
3286 3284 ('r', 'rev', [],
3287 3285 _('a specific revision up to which you would like to push')),
3288 3286 ('n', 'newest-first', None, _('show newest record first')),
3289 3287 ] + logopts + remoteopts,
3290 3288 _('[-M] [-p] [-n] [-f] [-r REV]... [DEST]')),
3291 3289 "^parents":
3292 3290 (parents,
3293 3291 [('r', 'rev', '', _('show parents from the specified rev')),
3294 3292 ] + templateopts,
3295 3293 _('hg parents [-r REV] [FILE]')),
3296 3294 "paths": (paths, [], _('[NAME]')),
3297 3295 "^pull":
3298 3296 (pull,
3299 3297 [('u', 'update', None,
3300 3298 _('update to new tip if changesets were pulled')),
3301 3299 ('f', 'force', None,
3302 3300 _('run even when remote repository is unrelated')),
3303 3301 ('r', 'rev', [],
3304 3302 _('a specific revision up to which you would like to pull')),
3305 3303 ] + remoteopts,
3306 3304 _('[-u] [-f] [-r REV]... [-e CMD] [--remotecmd CMD] [SOURCE]')),
3307 3305 "^push":
3308 3306 (push,
3309 3307 [('f', 'force', None, _('force push')),
3310 3308 ('r', 'rev', [],
3311 3309 _('a specific revision up to which you would like to push')),
3312 3310 ] + remoteopts,
3313 3311 _('[-f] [-r REV]... [-e CMD] [--remotecmd CMD] [DEST]')),
3314 3312 "recover": (recover, []),
3315 3313 "^remove|rm":
3316 3314 (remove,
3317 3315 [('A', 'after', None, _('record delete for missing files')),
3318 3316 ('f', 'force', None,
3319 3317 _('remove (and delete) file even if added or modified')),
3320 3318 ] + walkopts,
3321 3319 _('[OPTION]... FILE...')),
3322 3320 "rename|mv":
3323 3321 (rename,
3324 3322 [('A', 'after', None, _('record a rename that has already occurred')),
3325 3323 ('f', 'force', None,
3326 3324 _('forcibly copy over an existing managed file')),
3327 3325 ] + walkopts + dryrunopts,
3328 3326 _('[OPTION]... SOURCE... DEST')),
3329 3327 "resolve":
3330 3328 (resolve,
3331 3329 [('a', 'all', None, _('remerge all unresolved files')),
3332 3330 ('l', 'list', None, _('list state of files needing merge')),
3333 3331 ('m', 'mark', None, _('mark files as resolved')),
3334 3332 ('u', 'unmark', None, _('unmark files as resolved'))],
3335 3333 _('[OPTION]... [FILE]...')),
3336 3334 "revert":
3337 3335 (revert,
3338 3336 [('a', 'all', None, _('revert all changes when no arguments given')),
3339 3337 ('d', 'date', '', _('tipmost revision matching date')),
3340 3338 ('r', 'rev', '', _('revision to revert to')),
3341 3339 ('', 'no-backup', None, _('do not save backup copies of files')),
3342 3340 ] + walkopts + dryrunopts,
3343 3341 _('[OPTION]... [-r REV] [NAME]...')),
3344 3342 "rollback": (rollback, []),
3345 3343 "root": (root, []),
3346 3344 "^serve":
3347 3345 (serve,
3348 3346 [('A', 'accesslog', '', _('name of access log file to write to')),
3349 3347 ('d', 'daemon', None, _('run server in background')),
3350 3348 ('', 'daemon-pipefds', '', _('used internally by daemon mode')),
3351 3349 ('E', 'errorlog', '', _('name of error log file to write to')),
3352 3350 ('p', 'port', 0, _('port to listen on (default: 8000)')),
3353 3351 ('a', 'address', '', _('address to listen on (default: all interfaces)')),
3354 3352 ('', 'prefix', '', _('prefix path to serve from (default: server root)')),
3355 3353 ('n', 'name', '',
3356 3354 _('name to show in web pages (default: working dir)')),
3357 3355 ('', 'webdir-conf', '', _('name of the webdir config file'
3358 3356 ' (serve more than one repo)')),
3359 3357 ('', 'pid-file', '', _('name of file to write process ID to')),
3360 3358 ('', 'stdio', None, _('for remote clients')),
3361 3359 ('t', 'templates', '', _('web templates to use')),
3362 3360 ('', 'style', '', _('template style to use')),
3363 3361 ('6', 'ipv6', None, _('use IPv6 in addition to IPv4')),
3364 3362 ('', 'certificate', '', _('SSL certificate file'))],
3365 3363 _('[OPTION]...')),
3366 3364 "showconfig|debugconfig":
3367 3365 (showconfig,
3368 3366 [('u', 'untrusted', None, _('show untrusted configuration options'))],
3369 3367 _('[-u] [NAME]...')),
3370 3368 "^status|st":
3371 3369 (status,
3372 3370 [('A', 'all', None, _('show status of all files')),
3373 3371 ('m', 'modified', None, _('show only modified files')),
3374 3372 ('a', 'added', None, _('show only added files')),
3375 3373 ('r', 'removed', None, _('show only removed files')),
3376 3374 ('d', 'deleted', None, _('show only deleted (but tracked) files')),
3377 3375 ('c', 'clean', None, _('show only files without changes')),
3378 3376 ('u', 'unknown', None, _('show only unknown (not tracked) files')),
3379 3377 ('i', 'ignored', None, _('show only ignored files')),
3380 3378 ('n', 'no-status', None, _('hide status prefix')),
3381 3379 ('C', 'copies', None, _('show source of copied files')),
3382 3380 ('0', 'print0', None,
3383 3381 _('end filenames with NUL, for use with xargs')),
3384 3382 ('', 'rev', [], _('show difference from revision')),
3385 3383 ] + walkopts,
3386 3384 _('[OPTION]... [FILE]...')),
3387 3385 "tag":
3388 3386 (tag,
3389 3387 [('f', 'force', None, _('replace existing tag')),
3390 3388 ('l', 'local', None, _('make the tag local')),
3391 3389 ('r', 'rev', '', _('revision to tag')),
3392 3390 ('', 'remove', None, _('remove a tag')),
3393 3391 # -l/--local is already there, commitopts cannot be used
3394 3392 ('m', 'message', '', _('use <text> as commit message')),
3395 3393 ] + commitopts2,
3396 3394 _('[-l] [-m TEXT] [-d DATE] [-u USER] [-r REV] NAME...')),
3397 3395 "tags": (tags, []),
3398 3396 "tip":
3399 3397 (tip,
3400 3398 [('p', 'patch', None, _('show patch')),
3401 3399 ] + templateopts,
3402 3400 _('[-p]')),
3403 3401 "unbundle":
3404 3402 (unbundle,
3405 3403 [('u', 'update', None,
3406 3404 _('update to new tip if changesets were unbundled'))],
3407 3405 _('[-u] FILE...')),
3408 3406 "^update|up|checkout|co":
3409 3407 (update,
3410 3408 [('C', 'clean', None, _('overwrite locally modified files (no backup)')),
3411 3409 ('d', 'date', '', _('tipmost revision matching date')),
3412 3410 ('r', 'rev', '', _('revision'))],
3413 3411 _('[-C] [-d DATE] [[-r] REV]')),
3414 3412 "verify": (verify, []),
3415 3413 "version": (version_, []),
3416 3414 }
3417 3415
3418 3416 norepo = ("clone init version help debugcomplete debugdata"
3419 3417 " debugindex debugindexdot debugdate debuginstall debugfsinfo")
3420 3418 optionalrepo = ("identify paths serve showconfig debugancestor")
General Comments 0
You need to be logged in to leave comments. Login now