annotate hg @ 247:863b508c5b36

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-----
author mpm@selenic.com
date Sat, 04 Jun 2005 12:24:23 -0800
parents 96cde50a746f
children b7645b3c86ff
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
1 #!/usr/bin/env python
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
2 #
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
3 # mercurial - a minimal scalable distributed SCM
193
0a28dfe59f8f Bump the version number to 0.5b for the protocol change
mpm@selenic.com
parents: 192
diff changeset
4 # v0.5b "katje"
0
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
5 #
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
6 # Copyright 2005 Matt Mackall <mpm@selenic.com>
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
7 #
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
8 # This software may be used and distributed according to the terms
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
9 # of the GNU General Public License, incorporated herein by reference.
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
10
46
93e868fa0db8 Add changegroup support
mpm@selenic.com
parents: 39
diff changeset
11 # the psyco compiler makes commits a bit faster
93e868fa0db8 Add changegroup support
mpm@selenic.com
parents: 39
diff changeset
12 # and makes changegroup merge about 20 times slower!
93e868fa0db8 Add changegroup support
mpm@selenic.com
parents: 39
diff changeset
13 # try:
93e868fa0db8 Add changegroup support
mpm@selenic.com
parents: 39
diff changeset
14 # import psyco
93e868fa0db8 Add changegroup support
mpm@selenic.com
parents: 39
diff changeset
15 # psyco.full()
93e868fa0db8 Add changegroup support
mpm@selenic.com
parents: 39
diff changeset
16 # except:
93e868fa0db8 Add changegroup support
mpm@selenic.com
parents: 39
diff changeset
17 # pass
0
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
18
246
96cde50a746f Migrate rawcommit, import, export, history, and merge
mpm@selenic.com
parents: 245
diff changeset
19 import sys
247
863b508c5b36 migrate verify
mpm@selenic.com
parents: 246
diff changeset
20 from mercurial import hg, fancyopts, ui, commands
0
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
21
209
63af1db35611 Beginning of new command parsing interface
mpm@selenic.com
parents: 207
diff changeset
22 try:
63af1db35611 Beginning of new command parsing interface
mpm@selenic.com
parents: 207
diff changeset
23 sys.exit(commands.dispatch(sys.argv[1:]))
63af1db35611 Beginning of new command parsing interface
mpm@selenic.com
parents: 207
diff changeset
24 except commands.UnknownCommand:
63af1db35611 Beginning of new command parsing interface
mpm@selenic.com
parents: 207
diff changeset
25 # fall through
63af1db35611 Beginning of new command parsing interface
mpm@selenic.com
parents: 207
diff changeset
26 pass
63af1db35611 Beginning of new command parsing interface
mpm@selenic.com
parents: 207
diff changeset
27
0
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
28 options = {}
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
29 opts = [('v', 'verbose', None, 'verbose'),
83
9fd5b35cfc45 Add -q quiet option
mpm@selenic.com
parents: 81
diff changeset
30 ('d', 'debug', None, 'debug'),
107
707a7481a861 Make prompting go
mpm@selenic.com
parents: 106
diff changeset
31 ('q', 'quiet', None, 'quiet'),
707a7481a861 Make prompting go
mpm@selenic.com
parents: 106
diff changeset
32 ('y', 'noninteractive', None, 'run non-interactively'),
707a7481a861 Make prompting go
mpm@selenic.com
parents: 106
diff changeset
33 ]
0
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
34
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
35 args = fancyopts.fancyopts(sys.argv[1:], opts, options,
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
36 'hg [options] <command> [command options] [files]')
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
37
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
38 try:
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
39 cmd = args[0]
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
40 args = args[1:]
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
41 except:
206
3295b6b508de hg: don't complain about missing repo with no args
mpm@selenic.com
parents: 203
diff changeset
42 cmd = "help"
0
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
43
207
ec327cf0d3a9 Move ui class to its own module
mpm@selenic.com
parents: 206
diff changeset
44 ui = ui.ui(options["verbose"], options["debug"], options["quiet"],
107
707a7481a861 Make prompting go
mpm@selenic.com
parents: 106
diff changeset
45 not options["noninteractive"])
0
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
46
213
d2172916ef6c commands: migrate status and branch
mpm@selenic.com
parents: 210
diff changeset
47 try:
d2172916ef6c commands: migrate status and branch
mpm@selenic.com
parents: 210
diff changeset
48 repo = hg.repository(ui=ui)
d2172916ef6c commands: migrate status and branch
mpm@selenic.com
parents: 210
diff changeset
49 except IOError:
d2172916ef6c commands: migrate status and branch
mpm@selenic.com
parents: 210
diff changeset
50 ui.warn("Unable to open repository\n")
0
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
51 sys.exit(0)
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
52
246
96cde50a746f Migrate rawcommit, import, export, history, and merge
mpm@selenic.com
parents: 245
diff changeset
53 if cmd == "debugchangegroup":
67
a182f2561c8e Add tag support
mpm@selenic.com
parents: 65
diff changeset
54 newer = repo.newer(map(repo.lookup, args))
62
022d98aa0a2a Fix tabs
mpm@selenic.com
parents: 56
diff changeset
55 for chunk in repo.changegroup(newer):
022d98aa0a2a Fix tabs
mpm@selenic.com
parents: 56
diff changeset
56 sys.stdout.write(chunk)
46
93e868fa0db8 Add changegroup support
mpm@selenic.com
parents: 39
diff changeset
57
93e868fa0db8 Add changegroup support
mpm@selenic.com
parents: 39
diff changeset
58 elif cmd == "debugaddchangegroup":
93e868fa0db8 Add changegroup support
mpm@selenic.com
parents: 39
diff changeset
59 data = sys.stdin.read()
93e868fa0db8 Add changegroup support
mpm@selenic.com
parents: 39
diff changeset
60 repo.addchangegroup(data)
93e868fa0db8 Add changegroup support
mpm@selenic.com
parents: 39
diff changeset
61
0
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
62 elif cmd == "dump":
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
63 if args:
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
64 r = repo.file(args[0])
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
65 n = r.tip()
39
adf70fffca9f Add lookup smarts everywhere
mpm@selenic.com
parents: 38
diff changeset
66 if len(args) > 1: n = r.lookup(args[1])
0
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
67 sys.stdout.write(r.read(n))
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
68 else:
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
69 print "missing filename"
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
70
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
71 elif cmd == "dumpmanifest":
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
72 n = repo.manifest.tip()
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
73 if len(args) > 0:
39
adf70fffca9f Add lookup smarts everywhere
mpm@selenic.com
parents: 38
diff changeset
74 n = repo.manifest.lookup(args[0])
0
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
75 m = repo.manifest.read(n)
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
76 files = m.keys()
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
77 files.sort()
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
78
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
79 for f in files:
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
80 print hg.hex(m[f]), f
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
81
24
57a1eef79415 Add debughash and debugindex commands
mpm@selenic.com
parents: 23
diff changeset
82 elif cmd == "debugindex":
91
1c212bbb38d5 hack so that debugindex takes filenames
mpm@selenic.com
parents: 89
diff changeset
83 if ".hg" not in args[0]:
1c212bbb38d5 hack so that debugindex takes filenames
mpm@selenic.com
parents: 89
diff changeset
84 args[0] = ".hg/data/" + repo.file(args[0]).encodepath(args[0]) + "i"
1c212bbb38d5 hack so that debugindex takes filenames
mpm@selenic.com
parents: 89
diff changeset
85
24
57a1eef79415 Add debughash and debugindex commands
mpm@selenic.com
parents: 23
diff changeset
86 r = hg.revlog(open, args[0], "")
70
ce080e8eccd7 Fix debugindex formatting for large repos
mpm@selenic.com
parents: 69
diff changeset
87 print " rev offset length base linkrev"+\
24
57a1eef79415 Add debughash and debugindex commands
mpm@selenic.com
parents: 23
diff changeset
88 " p1 p2 nodeid"
57a1eef79415 Add debughash and debugindex commands
mpm@selenic.com
parents: 23
diff changeset
89 for i in range(r.count()):
57a1eef79415 Add debughash and debugindex commands
mpm@selenic.com
parents: 23
diff changeset
90 e = r.index[i]
70
ce080e8eccd7 Fix debugindex formatting for large repos
mpm@selenic.com
parents: 69
diff changeset
91 print "% 6d % 9d % 7d % 6d % 7d %s.. %s.. %s.." % (
24
57a1eef79415 Add debughash and debugindex commands
mpm@selenic.com
parents: 23
diff changeset
92 i, e[0], e[1], e[2], e[3],
57a1eef79415 Add debughash and debugindex commands
mpm@selenic.com
parents: 23
diff changeset
93 hg.hex(e[4][:5]), hg.hex(e[5][:5]), hg.hex(e[6][:5]))
57a1eef79415 Add debughash and debugindex commands
mpm@selenic.com
parents: 23
diff changeset
94
92
e6fc7ff52246 Add debugindexdot to generate graphviz dot files from indexes
mpm@selenic.com
parents: 91
diff changeset
95 elif cmd == "debugindexdot":
e6fc7ff52246 Add debugindexdot to generate graphviz dot files from indexes
mpm@selenic.com
parents: 91
diff changeset
96 if ".hg" not in args[0]:
e6fc7ff52246 Add debugindexdot to generate graphviz dot files from indexes
mpm@selenic.com
parents: 91
diff changeset
97 args[0] = ".hg/data/" + repo.file(args[0]).encodepath(args[0]) + "i"
e6fc7ff52246 Add debugindexdot to generate graphviz dot files from indexes
mpm@selenic.com
parents: 91
diff changeset
98
e6fc7ff52246 Add debugindexdot to generate graphviz dot files from indexes
mpm@selenic.com
parents: 91
diff changeset
99 r = hg.revlog(open, args[0], "")
e6fc7ff52246 Add debugindexdot to generate graphviz dot files from indexes
mpm@selenic.com
parents: 91
diff changeset
100 print "digraph G {"
e6fc7ff52246 Add debugindexdot to generate graphviz dot files from indexes
mpm@selenic.com
parents: 91
diff changeset
101 for i in range(r.count()):
e6fc7ff52246 Add debugindexdot to generate graphviz dot files from indexes
mpm@selenic.com
parents: 91
diff changeset
102 e = r.index[i]
e6fc7ff52246 Add debugindexdot to generate graphviz dot files from indexes
mpm@selenic.com
parents: 91
diff changeset
103 print "\t%d -> %d" % (r.rev(e[4]), i)
e6fc7ff52246 Add debugindexdot to generate graphviz dot files from indexes
mpm@selenic.com
parents: 91
diff changeset
104 if e[5] != hg.nullid:
e6fc7ff52246 Add debugindexdot to generate graphviz dot files from indexes
mpm@selenic.com
parents: 91
diff changeset
105 print "\t%d -> %d" % (r.rev(e[5]), i)
e6fc7ff52246 Add debugindexdot to generate graphviz dot files from indexes
mpm@selenic.com
parents: 91
diff changeset
106 print "}"
e6fc7ff52246 Add debugindexdot to generate graphviz dot files from indexes
mpm@selenic.com
parents: 91
diff changeset
107
67
a182f2561c8e Add tag support
mpm@selenic.com
parents: 65
diff changeset
108 elif cmd == "tags":
a182f2561c8e Add tag support
mpm@selenic.com
parents: 65
diff changeset
109 repo.lookup(0) # prime the cache
a182f2561c8e Add tag support
mpm@selenic.com
parents: 65
diff changeset
110 i = repo.tags.items()
a182f2561c8e Add tag support
mpm@selenic.com
parents: 65
diff changeset
111 i.sort()
a182f2561c8e Add tag support
mpm@selenic.com
parents: 65
diff changeset
112 for k, n in i:
a182f2561c8e Add tag support
mpm@selenic.com
parents: 65
diff changeset
113 try:
a182f2561c8e Add tag support
mpm@selenic.com
parents: 65
diff changeset
114 r = repo.changelog.rev(n)
a182f2561c8e Add tag support
mpm@selenic.com
parents: 65
diff changeset
115 except KeyError:
a182f2561c8e Add tag support
mpm@selenic.com
parents: 65
diff changeset
116 r = "?"
a182f2561c8e Add tag support
mpm@selenic.com
parents: 65
diff changeset
117 print "%-30s %5d:%s" % (k, repo.changelog.rev(n), hg.hex(n))
a182f2561c8e Add tag support
mpm@selenic.com
parents: 65
diff changeset
118
0
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
119 else:
175
0eb6e2c9800d hg: remove some debug commands, improve help messages, add .hgpaths file
mpm@selenic.com
parents: 174
diff changeset
120 if cmd: ui.warn("unknown command\n\n")
0
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
121 sys.exit(1)