398 m2 = repo.manifest.read(m2n) |
398 m2 = repo.manifest.read(m2n) |
399 errors = 0 |
399 errors = 0 |
400 for f in dc: |
400 for f in dc: |
401 state = repo.dirstate.state(f) |
401 state = repo.dirstate.state(f) |
402 if state in "nr" and f not in m1: |
402 if state in "nr" and f not in m1: |
403 print "%s in state %s, but not listed in manifest1" % (f, state) |
403 ui.warn("%s in state %s, but not in manifest1\n" % (f, state)) |
404 errors += 1 |
404 errors += 1 |
405 if state in "a" and f in m1: |
405 if state in "a" and f in m1: |
406 print "%s in state %s, but also listed in manifest1" % (f, state) |
406 ui.warn("%s in state %s, but also in manifest1\n" % (f, state)) |
407 errors += 1 |
407 errors += 1 |
408 if state in "m" and f not in m1 and f not in m2: |
408 if state in "m" and f not in m1 and f not in m2: |
409 print "%s in state %s, but not listed in either manifest" % \ |
409 ui.warn("%s in state %s, but not in either manifest\n" % |
410 (f, state) |
410 (f, state)) |
411 errors += 1 |
411 errors += 1 |
412 for f in m1: |
412 for f in m1: |
413 state = repo.dirstate.state(f) |
413 state = repo.dirstate.state(f) |
414 if state not in "nrm": |
414 if state not in "nrm": |
415 print "%s in manifest1, but listed as state %s" % (f, state) |
415 ui.warn("%s in manifest1, but listed as state %s" % (f, state)) |
416 errors += 1 |
416 errors += 1 |
417 if errors: |
417 if errors: |
418 print ".hg/dirstate inconsistent with current parent's manifest" |
418 ui.warn(".hg/dirstate inconsistent with current parent's manifest\n") |
419 sys.exit(1) |
419 sys.exit(1) |
420 |
420 |
421 def debugdumpdirstate(ui, repo): |
421 def debugdumpdirstate(ui, repo): |
422 repo.dirstate.read() |
422 repo.dirstate.read() |
423 dc = repo.dirstate.map |
423 dc = repo.dirstate.map |
424 keys = dc.keys() |
424 keys = dc.keys() |
425 keys.sort() |
425 keys.sort() |
426 for file in keys: |
426 for file in keys: |
427 print "%s => %c" % (file, dc[file][0]) |
427 ui.write("%c %s\n" % (dc[file][0], file)) |
428 |
428 |
429 def debugindex(ui, file): |
429 def debugindex(ui, file): |
430 r = hg.revlog(hg.opener(""), file, "") |
430 r = hg.revlog(hg.opener(""), file, "") |
431 print " rev offset length base linkrev"+\ |
431 ui.write(" rev offset length base linkrev" + |
432 " p1 p2 nodeid" |
432 " p1 p2 nodeid\n") |
433 for i in range(r.count()): |
433 for i in range(r.count()): |
434 e = r.index[i] |
434 e = r.index[i] |
435 print "% 6d % 9d % 7d % 6d % 7d %s.. %s.. %s.." % ( |
435 ui.write("% 6d % 9d % 7d % 6d % 7d %s.. %s.. %s..\n" % ( |
436 i, e[0], e[1], e[2], e[3], |
436 i, e[0], e[1], e[2], e[3], |
437 hg.hex(e[4][:5]), hg.hex(e[5][:5]), hg.hex(e[6][:5])) |
437 hg.hex(e[4][:5]), hg.hex(e[5][:5]), hg.hex(e[6][:5]))) |
438 |
438 |
439 def debugindexdot(ui, file): |
439 def debugindexdot(ui, file): |
440 r = hg.revlog(hg.opener(""), file, "") |
440 r = hg.revlog(hg.opener(""), file, "") |
441 print "digraph G {" |
441 ui.write("digraph G {\n") |
442 for i in range(r.count()): |
442 for i in range(r.count()): |
443 e = r.index[i] |
443 e = r.index[i] |
444 print "\t%d -> %d" % (r.rev(e[4]), i) |
444 ui.write("\t%d -> %d\n" % (r.rev(e[4]), i)) |
445 if e[5] != hg.nullid: |
445 if e[5] != hg.nullid: |
446 print "\t%d -> %d" % (r.rev(e[5]), i) |
446 ui.write("\t%d -> %d\n" % (r.rev(e[5]), i)) |
447 print "}" |
447 ui.write("}\n") |
448 |
448 |
449 def diff(ui, repo, *files, **opts): |
449 def diff(ui, repo, *files, **opts): |
450 """diff working directory (or selected files)""" |
450 """diff working directory (or selected files)""" |
451 revs = [] |
451 revs = [] |
452 if opts['rev']: |
452 if opts['rev']: |
500 inst.args[0]) |
500 inst.args[0]) |
501 sys.exit(1) |
501 sys.exit(1) |
502 else: |
502 else: |
503 fp = sys.stdout |
503 fp = sys.stdout |
504 |
504 |
505 print >> fp, "# HG changeset patch" |
505 fp.write("# HG changeset patch\n") |
506 print >> fp, "# User %s" % change[1] |
506 fp.write("# User %s\n" % change[1]) |
507 print >> fp, "# Node ID %s" % hg.hex(node) |
507 fp.write("# Node ID %s\n" % hg.hex(node)) |
508 print >> fp, "# Parent %s" % hg.hex(prev) |
508 fp.write("# Parent %s\n" % hg.hex(prev)) |
509 print >> fp |
|
510 if other != hg.nullid: |
509 if other != hg.nullid: |
511 print >> fp, "# Parent %s" % hg.hex(other) |
510 fp.write("# Parent %s\n" % hg.hex(other)) |
512 print >> fp, change[4].rstrip() |
511 fp.write(change[4].rstrip()) |
513 print >> fp |
512 fp.write("\n\n") |
514 |
513 |
515 dodiff(fp, ui, repo, None, prev, node) |
514 dodiff(fp, ui, repo, None, prev, node) |
516 |
515 |
517 def export(ui, repo, *changesets, **opts): |
516 def export(ui, repo, *changesets, **opts): |
518 """dump the header and diffs for one or more changesets""" |
517 """dump the header and diffs for one or more changesets""" |
752 ? = not tracked''' |
751 ? = not tracked''' |
753 |
752 |
754 (c, a, d, u) = repo.changes(None, None) |
753 (c, a, d, u) = repo.changes(None, None) |
755 (c, a, d, u) = map(lambda x: relfilter(repo, x), (c, a, d, u)) |
754 (c, a, d, u) = map(lambda x: relfilter(repo, x), (c, a, d, u)) |
756 |
755 |
757 for f in c: print "C", f |
756 for f in c: ui.write("C ", f, "\n") |
758 for f in a: print "A", f |
757 for f in a: ui.write("A ", f, "\n") |
759 for f in d: print "R", f |
758 for f in d: ui.write("R ", f, "\n") |
760 for f in u: print "?", f |
759 for f in u: ui.write("? ", f, "\n") |
761 |
760 |
762 def tag(ui, repo, name, rev = None, **opts): |
761 def tag(ui, repo, name, rev = None, **opts): |
763 """add a tag for the current tip or a given revision""" |
762 """add a tag for the current tip or a given revision""" |
764 |
763 |
765 if name == "tip": |
764 if name == "tip": |