##// END OF EJS Templates
migrate verify...
migrate verify -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 migrate verify Move the bulk of the verify code into the localrepository class and move the command into commands.py manifest hash: 793a8d0094d56ab0a411cd11d7fe7f39c923f209 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCog33ywK+sNU5EO8RApfBAJ4mCmiMmZE1fEfbR6sA+aP1csPvqQCfXHzY 3XK7yc19AivXf5HGKEOL3eM= =GISf -----END PGP SIGNATURE-----

File last commit:

r247:863b508c default
r247:863b508c default
Show More
hg
121 lines | 3.1 KiB | text/plain | TextLexer
#!/usr/bin/env python
#
# mercurial - a minimal scalable distributed SCM
# v0.5b "katje"
#
# Copyright 2005 Matt Mackall <mpm@selenic.com>
#
# This software may be used and distributed according to the terms
# of the GNU General Public License, incorporated herein by reference.
# the psyco compiler makes commits a bit faster
# and makes changegroup merge about 20 times slower!
# try:
# import psyco
# psyco.full()
# except:
# pass
import sys
from mercurial import hg, fancyopts, ui, commands
try:
sys.exit(commands.dispatch(sys.argv[1:]))
except commands.UnknownCommand:
# fall through
pass
options = {}
opts = [('v', 'verbose', None, 'verbose'),
('d', 'debug', None, 'debug'),
('q', 'quiet', None, 'quiet'),
('y', 'noninteractive', None, 'run non-interactively'),
]
args = fancyopts.fancyopts(sys.argv[1:], opts, options,
'hg [options] <command> [command options] [files]')
try:
cmd = args[0]
args = args[1:]
except:
cmd = "help"
ui = ui.ui(options["verbose"], options["debug"], options["quiet"],
not options["noninteractive"])
try:
repo = hg.repository(ui=ui)
except IOError:
ui.warn("Unable to open repository\n")
sys.exit(0)
if cmd == "debugchangegroup":
newer = repo.newer(map(repo.lookup, args))
for chunk in repo.changegroup(newer):
sys.stdout.write(chunk)
elif cmd == "debugaddchangegroup":
data = sys.stdin.read()
repo.addchangegroup(data)
elif cmd == "dump":
if args:
r = repo.file(args[0])
n = r.tip()
if len(args) > 1: n = r.lookup(args[1])
sys.stdout.write(r.read(n))
else:
print "missing filename"
elif cmd == "dumpmanifest":
n = repo.manifest.tip()
if len(args) > 0:
n = repo.manifest.lookup(args[0])
m = repo.manifest.read(n)
files = m.keys()
files.sort()
for f in files:
print hg.hex(m[f]), f
elif cmd == "debugindex":
if ".hg" not in args[0]:
args[0] = ".hg/data/" + repo.file(args[0]).encodepath(args[0]) + "i"
r = hg.revlog(open, args[0], "")
print " rev offset length base linkrev"+\
" p1 p2 nodeid"
for i in range(r.count()):
e = r.index[i]
print "% 6d % 9d % 7d % 6d % 7d %s.. %s.. %s.." % (
i, e[0], e[1], e[2], e[3],
hg.hex(e[4][:5]), hg.hex(e[5][:5]), hg.hex(e[6][:5]))
elif cmd == "debugindexdot":
if ".hg" not in args[0]:
args[0] = ".hg/data/" + repo.file(args[0]).encodepath(args[0]) + "i"
r = hg.revlog(open, args[0], "")
print "digraph G {"
for i in range(r.count()):
e = r.index[i]
print "\t%d -> %d" % (r.rev(e[4]), i)
if e[5] != hg.nullid:
print "\t%d -> %d" % (r.rev(e[5]), i)
print "}"
elif cmd == "tags":
repo.lookup(0) # prime the cache
i = repo.tags.items()
i.sort()
for k, n in i:
try:
r = repo.changelog.rev(n)
except KeyError:
r = "?"
print "%-30s %5d:%s" % (k, repo.changelog.rev(n), hg.hex(n))
else:
if cmd: ui.warn("unknown command\n\n")
sys.exit(1)