Mercurial > hg-stable
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 |
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 | 11 # the psyco compiler makes commits a bit faster |
12 # and makes changegroup merge about 20 times slower! | |
13 # try: | |
14 # import psyco | |
15 # psyco.full() | |
16 # except: | |
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 | 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 | 22 try: |
23 sys.exit(commands.dispatch(sys.argv[1:])) | |
24 except commands.UnknownCommand: | |
25 # fall through | |
26 pass | |
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 | 30 ('d', 'debug', None, 'debug'), |
107 | 31 ('q', 'quiet', None, 'quiet'), |
32 ('y', 'noninteractive', None, 'run non-interactively'), | |
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 | 44 ui = ui.ui(options["verbose"], options["debug"], options["quiet"], |
107 | 45 not options["noninteractive"]) |
0
9117c6561b0b
Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff
changeset
|
46 |
213 | 47 try: |
48 repo = hg.repository(ui=ui) | |
49 except IOError: | |
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 | 54 newer = repo.newer(map(repo.lookup, args)) |
62 | 55 for chunk in repo.changegroup(newer): |
56 sys.stdout.write(chunk) | |
46 | 57 |
58 elif cmd == "debugaddchangegroup": | |
59 data = sys.stdin.read() | |
60 repo.addchangegroup(data) | |
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 | 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 | 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 | 82 elif cmd == "debugindex": |
91 | 83 if ".hg" not in args[0]: |
84 args[0] = ".hg/data/" + repo.file(args[0]).encodepath(args[0]) + "i" | |
85 | |
24 | 86 r = hg.revlog(open, args[0], "") |
70 | 87 print " rev offset length base linkrev"+\ |
24 | 88 " p1 p2 nodeid" |
89 for i in range(r.count()): | |
90 e = r.index[i] | |
70 | 91 print "% 6d % 9d % 7d % 6d % 7d %s.. %s.. %s.." % ( |
24 | 92 i, e[0], e[1], e[2], e[3], |
93 hg.hex(e[4][:5]), hg.hex(e[5][:5]), hg.hex(e[6][:5])) | |
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 | 108 elif cmd == "tags": |
109 repo.lookup(0) # prime the cache | |
110 i = repo.tags.items() | |
111 i.sort() | |
112 for k, n in i: | |
113 try: | |
114 r = repo.changelog.rev(n) | |
115 except KeyError: | |
116 r = "?" | |
117 print "%-30s %5d:%s" % (k, repo.changelog.rev(n), hg.hex(n)) | |
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) |