Show More
@@ -1,5 +1,11 | |||||
1 | include hg |
|
1 | include hg | |
2 | recursive-include mercurial *.py |
|
2 | recursive-include mercurial *.py | |
3 | include tkmerge |
|
3 | include tkmerge | |
|
4 | include hgweb.cgi | |||
|
5 | include hgeditor rewrite-log convert-repo | |||
|
6 | include tests/* | |||
4 | include *.txt |
|
7 | include *.txt | |
|
8 | include templates/map | |||
|
9 | include templates/*.tmpl | |||
|
10 | include doc/* | |||
5 | include README |
|
11 | include README |
@@ -1,589 +1,589 | |||||
1 | #!/usr/bin/env python |
|
1 | #!/usr/bin/env python | |
2 | # |
|
2 | # | |
3 | # mercurial - a minimal scalable distributed SCM |
|
3 | # mercurial - a minimal scalable distributed SCM | |
4 |
# v0. |
|
4 | # v0.5 "katje" | |
5 | # |
|
5 | # | |
6 | # Copyright 2005 Matt Mackall <mpm@selenic.com> |
|
6 | # Copyright 2005 Matt Mackall <mpm@selenic.com> | |
7 | # |
|
7 | # | |
8 | # This software may be used and distributed according to the terms |
|
8 | # This software may be used and distributed according to the terms | |
9 | # of the GNU General Public License, incorporated herein by reference. |
|
9 | # of the GNU General Public License, incorporated herein by reference. | |
10 |
|
10 | |||
11 | # the psyco compiler makes commits a bit faster |
|
11 | # the psyco compiler makes commits a bit faster | |
12 | # and makes changegroup merge about 20 times slower! |
|
12 | # and makes changegroup merge about 20 times slower! | |
13 | # try: |
|
13 | # try: | |
14 | # import psyco |
|
14 | # import psyco | |
15 | # psyco.full() |
|
15 | # psyco.full() | |
16 | # except: |
|
16 | # except: | |
17 | # pass |
|
17 | # pass | |
18 |
|
18 | |||
19 | import sys, os, time |
|
19 | import sys, os, time | |
20 | from mercurial import hg, mdiff, fancyopts |
|
20 | from mercurial import hg, mdiff, fancyopts | |
21 |
|
21 | |||
22 | def help(): |
|
22 | def help(): | |
23 | ui.status("""\ |
|
23 | ui.status("""\ | |
24 | commands: |
|
24 | commands: | |
25 |
|
25 | |||
26 | add [files...] add the given files in the next commit |
|
26 | add [files...] add the given files in the next commit | |
27 | addremove add all new files, delete all missing files |
|
27 | addremove add all new files, delete all missing files | |
28 | annotate [files...] show changeset number per file line |
|
28 | annotate [files...] show changeset number per file line | |
29 | branch <path> create a branch of <path> in this directory |
|
29 | branch <path> create a branch of <path> in this directory | |
30 | checkout [changeset] checkout the latest or given changeset |
|
30 | checkout [changeset] checkout the latest or given changeset | |
31 | commit commit all changes to the repository |
|
31 | commit commit all changes to the repository | |
32 | diff [files...] diff working directory (or selected files) |
|
32 | diff [files...] diff working directory (or selected files) | |
33 | dump <file> [rev] dump the latest or given revision of a file |
|
33 | dump <file> [rev] dump the latest or given revision of a file | |
34 | dumpmanifest [rev] dump the latest or given revision of the manifest |
|
34 | dumpmanifest [rev] dump the latest or given revision of the manifest | |
35 | history show changeset history |
|
35 | history show changeset history | |
36 | init create a new repository in this directory |
|
36 | init create a new repository in this directory | |
37 | log <file> show revision history of a single file |
|
37 | log <file> show revision history of a single file | |
38 | merge <path> merge changes from <path> into local repository |
|
38 | merge <path> merge changes from <path> into local repository | |
39 | recover rollback an interrupted transaction |
|
39 | recover rollback an interrupted transaction | |
40 | remove [files...] remove the given files in the next commit |
|
40 | remove [files...] remove the given files in the next commit | |
41 | serve export the repository via HTTP |
|
41 | serve export the repository via HTTP | |
42 | status show new, missing, and changed files in working dir |
|
42 | status show new, missing, and changed files in working dir | |
43 | tags show current changeset tags |
|
43 | tags show current changeset tags | |
44 | undo undo the last transaction |
|
44 | undo undo the last transaction | |
45 | """) |
|
45 | """) | |
46 |
|
46 | |||
47 | def filterfiles(list, files): |
|
47 | def filterfiles(list, files): | |
48 | l = [ x for x in list if x in files ] |
|
48 | l = [ x for x in list if x in files ] | |
49 |
|
49 | |||
50 | for f in files: |
|
50 | for f in files: | |
51 | if f[-1] != os.sep: f += os.sep |
|
51 | if f[-1] != os.sep: f += os.sep | |
52 | l += [ x for x in list if x.startswith(f) ] |
|
52 | l += [ x for x in list if x.startswith(f) ] | |
53 | return l |
|
53 | return l | |
54 |
|
54 | |||
55 | def diff(files = None, node1 = None, node2 = None): |
|
55 | def diff(files = None, node1 = None, node2 = None): | |
56 | def date(c): |
|
56 | def date(c): | |
57 | return time.asctime(time.gmtime(float(c[2].split(' ')[0]))) |
|
57 | return time.asctime(time.gmtime(float(c[2].split(' ')[0]))) | |
58 |
|
58 | |||
59 | if node2: |
|
59 | if node2: | |
60 | change = repo.changelog.read(node2) |
|
60 | change = repo.changelog.read(node2) | |
61 | mmap2 = repo.manifest.read(change[0]) |
|
61 | mmap2 = repo.manifest.read(change[0]) | |
62 | (c, a, d) = repo.diffrevs(node1, node2) |
|
62 | (c, a, d) = repo.diffrevs(node1, node2) | |
63 | def read(f): return repo.file(f).read(mmap2[f]) |
|
63 | def read(f): return repo.file(f).read(mmap2[f]) | |
64 | date2 = date(change) |
|
64 | date2 = date(change) | |
65 | else: |
|
65 | else: | |
66 | date2 = time.asctime() |
|
66 | date2 = time.asctime() | |
67 | if not node1: |
|
67 | if not node1: | |
68 | node1 = repo.current |
|
68 | node1 = repo.current | |
69 | (c, a, d) = repo.diffdir(repo.root, node1) |
|
69 | (c, a, d) = repo.diffdir(repo.root, node1) | |
70 | a = [] # ignore unknown files in repo, by popular request |
|
70 | a = [] # ignore unknown files in repo, by popular request | |
71 | def read(f): return file(os.path.join(repo.root, f)).read() |
|
71 | def read(f): return file(os.path.join(repo.root, f)).read() | |
72 |
|
72 | |||
73 | change = repo.changelog.read(node1) |
|
73 | change = repo.changelog.read(node1) | |
74 | mmap = repo.manifest.read(change[0]) |
|
74 | mmap = repo.manifest.read(change[0]) | |
75 | date1 = date(change) |
|
75 | date1 = date(change) | |
76 |
|
76 | |||
77 | if files: |
|
77 | if files: | |
78 | c, a, d = map(lambda x: filterfiles(x, files), (c, a, d)) |
|
78 | c, a, d = map(lambda x: filterfiles(x, files), (c, a, d)) | |
79 |
|
79 | |||
80 | for f in c: |
|
80 | for f in c: | |
81 | to = "" |
|
81 | to = "" | |
82 | if mmap.has_key(f): |
|
82 | if mmap.has_key(f): | |
83 | to = repo.file(f).read(mmap[f]) |
|
83 | to = repo.file(f).read(mmap[f]) | |
84 | tn = read(f) |
|
84 | tn = read(f) | |
85 | sys.stdout.write(mdiff.unidiff(to, date1, tn, date2, f)) |
|
85 | sys.stdout.write(mdiff.unidiff(to, date1, tn, date2, f)) | |
86 | for f in a: |
|
86 | for f in a: | |
87 | to = "" |
|
87 | to = "" | |
88 | tn = read(f) |
|
88 | tn = read(f) | |
89 | sys.stdout.write(mdiff.unidiff(to, date1, tn, date2, f)) |
|
89 | sys.stdout.write(mdiff.unidiff(to, date1, tn, date2, f)) | |
90 | for f in d: |
|
90 | for f in d: | |
91 | to = repo.file(f).read(mmap[f]) |
|
91 | to = repo.file(f).read(mmap[f]) | |
92 | tn = "" |
|
92 | tn = "" | |
93 | sys.stdout.write(mdiff.unidiff(to, date1, tn, date2, f)) |
|
93 | sys.stdout.write(mdiff.unidiff(to, date1, tn, date2, f)) | |
94 |
|
94 | |||
95 | options = {} |
|
95 | options = {} | |
96 | opts = [('v', 'verbose', None, 'verbose'), |
|
96 | opts = [('v', 'verbose', None, 'verbose'), | |
97 | ('d', 'debug', None, 'debug'), |
|
97 | ('d', 'debug', None, 'debug'), | |
98 | ('q', 'quiet', None, 'quiet'), |
|
98 | ('q', 'quiet', None, 'quiet'), | |
99 | ('y', 'noninteractive', None, 'run non-interactively'), |
|
99 | ('y', 'noninteractive', None, 'run non-interactively'), | |
100 | ] |
|
100 | ] | |
101 |
|
101 | |||
102 | args = fancyopts.fancyopts(sys.argv[1:], opts, options, |
|
102 | args = fancyopts.fancyopts(sys.argv[1:], opts, options, | |
103 | 'hg [options] <command> [command options] [files]') |
|
103 | 'hg [options] <command> [command options] [files]') | |
104 |
|
104 | |||
105 | try: |
|
105 | try: | |
106 | cmd = args[0] |
|
106 | cmd = args[0] | |
107 | args = args[1:] |
|
107 | args = args[1:] | |
108 | except: |
|
108 | except: | |
109 | cmd = "" |
|
109 | cmd = "" | |
110 |
|
110 | |||
111 | ui = hg.ui(options["verbose"], options["debug"], options["quiet"], |
|
111 | ui = hg.ui(options["verbose"], options["debug"], options["quiet"], | |
112 | not options["noninteractive"]) |
|
112 | not options["noninteractive"]) | |
113 |
|
113 | |||
114 | if cmd == "init": |
|
114 | if cmd == "init": | |
115 | repo = hg.repository(ui, ".", create=1) |
|
115 | repo = hg.repository(ui, ".", create=1) | |
116 | sys.exit(0) |
|
116 | sys.exit(0) | |
117 | elif cmd == "branch" or cmd == "clone": |
|
117 | elif cmd == "branch" or cmd == "clone": | |
118 | os.system("cp -al %s/.hg .hg" % args[0]) |
|
118 | os.system("cp -al %s/.hg .hg" % args[0]) | |
119 | sys.exit(0) |
|
119 | sys.exit(0) | |
120 | elif cmd == "help": |
|
120 | elif cmd == "help": | |
121 | help() |
|
121 | help() | |
122 | sys.exit(0) |
|
122 | sys.exit(0) | |
123 | else: |
|
123 | else: | |
124 | try: |
|
124 | try: | |
125 | repo = hg.repository(ui=ui) |
|
125 | repo = hg.repository(ui=ui) | |
126 | except IOError: |
|
126 | except IOError: | |
127 | ui.warn("Unable to open repository\n") |
|
127 | ui.warn("Unable to open repository\n") | |
128 | sys.exit(0) |
|
128 | sys.exit(0) | |
129 |
|
129 | |||
130 | relpath = None |
|
130 | relpath = None | |
131 | if os.getcwd() != repo.root: |
|
131 | if os.getcwd() != repo.root: | |
132 | relpath = os.getcwd()[len(repo.root) + 1: ] |
|
132 | relpath = os.getcwd()[len(repo.root) + 1: ] | |
133 |
|
133 | |||
134 | if cmd == "checkout" or cmd == "co": |
|
134 | if cmd == "checkout" or cmd == "co": | |
135 | node = repo.changelog.tip() |
|
135 | node = repo.changelog.tip() | |
136 | if args: |
|
136 | if args: | |
137 | node = repo.lookup(args[0]) |
|
137 | node = repo.lookup(args[0]) | |
138 | repo.checkout(node) |
|
138 | repo.checkout(node) | |
139 |
|
139 | |||
140 | elif cmd == "add": |
|
140 | elif cmd == "add": | |
141 | repo.add(args) |
|
141 | repo.add(args) | |
142 |
|
142 | |||
143 | elif cmd == "remove" or cmd == "rm" or cmd == "del" or cmd == "delete": |
|
143 | elif cmd == "remove" or cmd == "rm" or cmd == "del" or cmd == "delete": | |
144 | repo.remove(args) |
|
144 | repo.remove(args) | |
145 |
|
145 | |||
146 | elif cmd == "commit" or cmd == "checkin" or cmd == "ci": |
|
146 | elif cmd == "commit" or cmd == "checkin" or cmd == "ci": | |
147 | if 1: |
|
147 | if 1: | |
148 | if len(args) > 0: |
|
148 | if len(args) > 0: | |
149 | repo.commit(repo.current, args) |
|
149 | repo.commit(repo.current, args) | |
150 | else: |
|
150 | else: | |
151 | repo.commit(repo.current) |
|
151 | repo.commit(repo.current) | |
152 |
|
152 | |||
153 | elif cmd == "import" or cmd == "patch": |
|
153 | elif cmd == "import" or cmd == "patch": | |
154 | try: |
|
154 | try: | |
155 | import psyco |
|
155 | import psyco | |
156 | psyco.full() |
|
156 | psyco.full() | |
157 | except: |
|
157 | except: | |
158 | pass |
|
158 | pass | |
159 |
|
159 | |||
160 | ioptions = {} |
|
160 | ioptions = {} | |
161 | opts = [('p', 'strip', 1, 'path strip'), |
|
161 | opts = [('p', 'strip', 1, 'path strip'), | |
162 | ('b', 'base', "", 'base path'), |
|
162 | ('b', 'base', "", 'base path'), | |
163 | ('q', 'quiet', "", 'silence diff') |
|
163 | ('q', 'quiet', "", 'silence diff') | |
164 | ] |
|
164 | ] | |
165 |
|
165 | |||
166 | args = fancyopts.fancyopts(args, opts, ioptions, |
|
166 | args = fancyopts.fancyopts(args, opts, ioptions, | |
167 | 'hg import [options] <patch names>') |
|
167 | 'hg import [options] <patch names>') | |
168 | d = ioptions["base"] |
|
168 | d = ioptions["base"] | |
169 | strip = ioptions["strip"] |
|
169 | strip = ioptions["strip"] | |
170 | quiet = ioptions["quiet"] and "> /dev/null" or "" |
|
170 | quiet = ioptions["quiet"] and "> /dev/null" or "" | |
171 |
|
171 | |||
172 | for patch in args: |
|
172 | for patch in args: | |
173 | ui.status("applying %s\n" % patch) |
|
173 | ui.status("applying %s\n" % patch) | |
174 | pf = os.path.join(d, patch) |
|
174 | pf = os.path.join(d, patch) | |
175 |
|
175 | |||
176 | text = "" |
|
176 | text = "" | |
177 | for l in file(pf): |
|
177 | for l in file(pf): | |
178 | if l[:4] == "--- ": break |
|
178 | if l[:4] == "--- ": break | |
179 | text += l |
|
179 | text += l | |
180 |
|
180 | |||
181 | f = os.popen("lsdiff --strip %d %s" % (strip, pf)) |
|
181 | f = os.popen("lsdiff --strip %d %s" % (strip, pf)) | |
182 | files = filter(None, map(lambda x: x.rstrip(), f.read().splitlines())) |
|
182 | files = filter(None, map(lambda x: x.rstrip(), f.read().splitlines())) | |
183 | f.close() |
|
183 | f.close() | |
184 |
|
184 | |||
185 | if files: |
|
185 | if files: | |
186 | if os.system("patch -p%d < %s %s" % (strip, pf, quiet)): |
|
186 | if os.system("patch -p%d < %s %s" % (strip, pf, quiet)): | |
187 | raise "patch failed!" |
|
187 | raise "patch failed!" | |
188 | repo.commit(repo.current, files, text) |
|
188 | repo.commit(repo.current, files, text) | |
189 |
|
189 | |||
190 | elif cmd == "status": |
|
190 | elif cmd == "status": | |
191 | (c, a, d) = repo.diffdir(repo.root, repo.current) |
|
191 | (c, a, d) = repo.diffdir(repo.root, repo.current) | |
192 | if relpath: |
|
192 | if relpath: | |
193 | (c, a, d) = map(lambda x: filterfiles(x, [ relpath ]), (c, a, d)) |
|
193 | (c, a, d) = map(lambda x: filterfiles(x, [ relpath ]), (c, a, d)) | |
194 |
|
194 | |||
195 | for f in c: print "C", f |
|
195 | for f in c: print "C", f | |
196 | for f in a: print "?", f |
|
196 | for f in a: print "?", f | |
197 | for f in d: print "R", f |
|
197 | for f in d: print "R", f | |
198 |
|
198 | |||
199 | elif cmd == "diff": |
|
199 | elif cmd == "diff": | |
200 | revs = [] |
|
200 | revs = [] | |
201 |
|
201 | |||
202 | if args: |
|
202 | if args: | |
203 | doptions = {} |
|
203 | doptions = {} | |
204 | opts = [('r', 'revision', [], 'revision')] |
|
204 | opts = [('r', 'revision', [], 'revision')] | |
205 | args = fancyopts.fancyopts(args, opts, doptions, |
|
205 | args = fancyopts.fancyopts(args, opts, doptions, | |
206 | 'hg diff [options] [files]') |
|
206 | 'hg diff [options] [files]') | |
207 | revs = map(lambda x: repo.lookup(x), doptions['revision']) |
|
207 | revs = map(lambda x: repo.lookup(x), doptions['revision']) | |
208 |
|
208 | |||
209 | if len(revs) > 2: |
|
209 | if len(revs) > 2: | |
210 | self.ui.warn("too many revisions to diff\n") |
|
210 | self.ui.warn("too many revisions to diff\n") | |
211 | sys.exit(1) |
|
211 | sys.exit(1) | |
212 |
|
212 | |||
213 | if relpath: |
|
213 | if relpath: | |
214 | if not args: args = [ relpath ] |
|
214 | if not args: args = [ relpath ] | |
215 | else: args = [ os.path.join(relpath, x) for x in args ] |
|
215 | else: args = [ os.path.join(relpath, x) for x in args ] | |
216 |
|
216 | |||
217 | diff(args, *revs) |
|
217 | diff(args, *revs) | |
218 |
|
218 | |||
219 | elif cmd == "annotate": |
|
219 | elif cmd == "annotate": | |
220 | bcache = {} |
|
220 | bcache = {} | |
221 |
|
221 | |||
222 | def getnode(rev): |
|
222 | def getnode(rev): | |
223 | return hg.short(repo.changelog.node(rev)) |
|
223 | return hg.short(repo.changelog.node(rev)) | |
224 |
|
224 | |||
225 | def getname(rev): |
|
225 | def getname(rev): | |
226 | try: |
|
226 | try: | |
227 | return bcache[rev] |
|
227 | return bcache[rev] | |
228 | except KeyError: |
|
228 | except KeyError: | |
229 | cl = repo.changelog.read(repo.changelog.node(rev)) |
|
229 | cl = repo.changelog.read(repo.changelog.node(rev)) | |
230 | name = cl[1] |
|
230 | name = cl[1] | |
231 | f = name.find('@') |
|
231 | f = name.find('@') | |
232 | if f >= 0: |
|
232 | if f >= 0: | |
233 | name = name[:f] |
|
233 | name = name[:f] | |
234 | bcache[rev] = name |
|
234 | bcache[rev] = name | |
235 | return name |
|
235 | return name | |
236 |
|
236 | |||
237 | aoptions = {} |
|
237 | aoptions = {} | |
238 | opts = [('r', 'revision', '', 'revision'), |
|
238 | opts = [('r', 'revision', '', 'revision'), | |
239 | ('u', 'user', None, 'show user'), |
|
239 | ('u', 'user', None, 'show user'), | |
240 | ('n', 'number', None, 'show revision number'), |
|
240 | ('n', 'number', None, 'show revision number'), | |
241 | ('c', 'changeset', None, 'show changeset')] |
|
241 | ('c', 'changeset', None, 'show changeset')] | |
242 |
|
242 | |||
243 | args = fancyopts.fancyopts(args, opts, aoptions, |
|
243 | args = fancyopts.fancyopts(args, opts, aoptions, | |
244 | 'hg annotate [-u] [-c] [-n] [-r id] [files]') |
|
244 | 'hg annotate [-u] [-c] [-n] [-r id] [files]') | |
245 |
|
245 | |||
246 | opmap = [['user', getname], ['number', str], ['changeset', getnode]] |
|
246 | opmap = [['user', getname], ['number', str], ['changeset', getnode]] | |
247 | if not aoptions['user'] and not aoptions['changeset']: |
|
247 | if not aoptions['user'] and not aoptions['changeset']: | |
248 | aoptions['number'] = 1 |
|
248 | aoptions['number'] = 1 | |
249 |
|
249 | |||
250 | if args: |
|
250 | if args: | |
251 | if relpath: args = [ os.path.join(relpath, x) for x in args ] |
|
251 | if relpath: args = [ os.path.join(relpath, x) for x in args ] | |
252 | node = repo.current |
|
252 | node = repo.current | |
253 | if aoptions['revision']: |
|
253 | if aoptions['revision']: | |
254 | node = repo.changelog.lookup(aoptions['revision']) |
|
254 | node = repo.changelog.lookup(aoptions['revision']) | |
255 | change = repo.changelog.read(node) |
|
255 | change = repo.changelog.read(node) | |
256 | mmap = repo.manifest.read(change[0]) |
|
256 | mmap = repo.manifest.read(change[0]) | |
257 | maxuserlen = 0 |
|
257 | maxuserlen = 0 | |
258 | maxchangelen = 0 |
|
258 | maxchangelen = 0 | |
259 | for f in args: |
|
259 | for f in args: | |
260 | lines = repo.file(f).annotate(mmap[f]) |
|
260 | lines = repo.file(f).annotate(mmap[f]) | |
261 | pieces = [] |
|
261 | pieces = [] | |
262 |
|
262 | |||
263 | for o, f in opmap: |
|
263 | for o, f in opmap: | |
264 | if aoptions[o]: |
|
264 | if aoptions[o]: | |
265 | l = [ f(n) for n,t in lines ] |
|
265 | l = [ f(n) for n,t in lines ] | |
266 | m = max(map(len, l)) |
|
266 | m = max(map(len, l)) | |
267 | pieces.append([ "%*s" % (m, x) for x in l]) |
|
267 | pieces.append([ "%*s" % (m, x) for x in l]) | |
268 |
|
268 | |||
269 | for p,l in zip(zip(*pieces), lines): |
|
269 | for p,l in zip(zip(*pieces), lines): | |
270 | sys.stdout.write(" ".join(p) + ": " + l[1]) |
|
270 | sys.stdout.write(" ".join(p) + ": " + l[1]) | |
271 |
|
271 | |||
272 | elif cmd == "export": |
|
272 | elif cmd == "export": | |
273 | node = repo.lookup(args[0]) |
|
273 | node = repo.lookup(args[0]) | |
274 | prev, other = repo.changelog.parents(node) |
|
274 | prev, other = repo.changelog.parents(node) | |
275 | change = repo.changelog.read(node) |
|
275 | change = repo.changelog.read(node) | |
276 | print "# HG changeset patch" |
|
276 | print "# HG changeset patch" | |
277 | print "# User %s" % change[1] |
|
277 | print "# User %s" % change[1] | |
278 | print "# Node ID %s" % hg.hex(node) |
|
278 | print "# Node ID %s" % hg.hex(node) | |
279 | print "# Parent %s" % hg.hex(prev) |
|
279 | print "# Parent %s" % hg.hex(prev) | |
280 |
|
280 | |||
281 | if other != hg.nullid: |
|
281 | if other != hg.nullid: | |
282 | print "# Parent %s" % hg.hex(other) |
|
282 | print "# Parent %s" % hg.hex(other) | |
283 | print change[4] |
|
283 | print change[4] | |
284 |
|
284 | |||
285 | diff(None, prev, node) |
|
285 | diff(None, prev, node) | |
286 |
|
286 | |||
287 | elif cmd == "debugchangegroup": |
|
287 | elif cmd == "debugchangegroup": | |
288 | newer = repo.newer(map(repo.lookup, args)) |
|
288 | newer = repo.newer(map(repo.lookup, args)) | |
289 | for chunk in repo.changegroup(newer): |
|
289 | for chunk in repo.changegroup(newer): | |
290 | sys.stdout.write(chunk) |
|
290 | sys.stdout.write(chunk) | |
291 |
|
291 | |||
292 | elif cmd == "debugaddchangegroup": |
|
292 | elif cmd == "debugaddchangegroup": | |
293 | data = sys.stdin.read() |
|
293 | data = sys.stdin.read() | |
294 | repo.addchangegroup(data) |
|
294 | repo.addchangegroup(data) | |
295 |
|
295 | |||
296 | elif cmd == "addremove": |
|
296 | elif cmd == "addremove": | |
297 | (c, a, d) = repo.diffdir(repo.root, repo.current) |
|
297 | (c, a, d) = repo.diffdir(repo.root, repo.current) | |
298 | repo.add(a) |
|
298 | repo.add(a) | |
299 | repo.remove(d) |
|
299 | repo.remove(d) | |
300 |
|
300 | |||
301 | elif cmd == "history": |
|
301 | elif cmd == "history": | |
302 | for i in range(repo.changelog.count()): |
|
302 | for i in range(repo.changelog.count()): | |
303 | n = repo.changelog.node(i) |
|
303 | n = repo.changelog.node(i) | |
304 | changes = repo.changelog.read(n) |
|
304 | changes = repo.changelog.read(n) | |
305 | (p1, p2) = repo.changelog.parents(n) |
|
305 | (p1, p2) = repo.changelog.parents(n) | |
306 | (h, h1, h2) = map(hg.hex, (n, p1, p2)) |
|
306 | (h, h1, h2) = map(hg.hex, (n, p1, p2)) | |
307 | (i1, i2) = map(repo.changelog.rev, (p1, p2)) |
|
307 | (i1, i2) = map(repo.changelog.rev, (p1, p2)) | |
308 | print "rev: %4d:%s" % (i, h) |
|
308 | print "rev: %4d:%s" % (i, h) | |
309 | print "parents: %4d:%s" % (i1, h1) |
|
309 | print "parents: %4d:%s" % (i1, h1) | |
310 | if i2: print " %4d:%s" % (i2, h2) |
|
310 | if i2: print " %4d:%s" % (i2, h2) | |
311 | print "manifest: %4d:%s" % (repo.manifest.rev(changes[0]), |
|
311 | print "manifest: %4d:%s" % (repo.manifest.rev(changes[0]), | |
312 | hg.hex(changes[0])) |
|
312 | hg.hex(changes[0])) | |
313 | print "user:", changes[1] |
|
313 | print "user:", changes[1] | |
314 | print "date:", time.asctime( |
|
314 | print "date:", time.asctime( | |
315 | time.localtime(float(changes[2].split(' ')[0]))) |
|
315 | time.localtime(float(changes[2].split(' ')[0]))) | |
316 | if ui.verbose: print "files:", " ".join(changes[3]) |
|
316 | if ui.verbose: print "files:", " ".join(changes[3]) | |
317 | print "description:" |
|
317 | print "description:" | |
318 | print changes[4] |
|
318 | print changes[4] | |
319 |
|
319 | |||
320 | elif cmd == "tip": |
|
320 | elif cmd == "tip": | |
321 | n = repo.changelog.tip() |
|
321 | n = repo.changelog.tip() | |
322 | t = repo.changelog.rev(n) |
|
322 | t = repo.changelog.rev(n) | |
323 | ui.status("%d:%s\n" % (t, hg.hex(n))) |
|
323 | ui.status("%d:%s\n" % (t, hg.hex(n))) | |
324 |
|
324 | |||
325 | elif cmd == "log": |
|
325 | elif cmd == "log": | |
326 |
|
326 | |||
327 | if len(args) == 1: |
|
327 | if len(args) == 1: | |
328 | if relpath: |
|
328 | if relpath: | |
329 | args[0] = os.path.join(relpath, args[0]) |
|
329 | args[0] = os.path.join(relpath, args[0]) | |
330 |
|
330 | |||
331 | r = repo.file(args[0]) |
|
331 | r = repo.file(args[0]) | |
332 | for i in range(r.count()): |
|
332 | for i in range(r.count()): | |
333 | n = r.node(i) |
|
333 | n = r.node(i) | |
334 | (p1, p2) = r.parents(n) |
|
334 | (p1, p2) = r.parents(n) | |
335 | (h, h1, h2) = map(hg.hex, (n, p1, p2)) |
|
335 | (h, h1, h2) = map(hg.hex, (n, p1, p2)) | |
336 | (i1, i2) = map(r.rev, (p1, p2)) |
|
336 | (i1, i2) = map(r.rev, (p1, p2)) | |
337 | cr = r.linkrev(n) |
|
337 | cr = r.linkrev(n) | |
338 | cn = hg.hex(repo.changelog.node(cr)) |
|
338 | cn = hg.hex(repo.changelog.node(cr)) | |
339 | print "rev: %4d:%s" % (i, h) |
|
339 | print "rev: %4d:%s" % (i, h) | |
340 | print "changeset: %4d:%s" % (cr, cn) |
|
340 | print "changeset: %4d:%s" % (cr, cn) | |
341 | print "parents: %4d:%s" % (i1, h1) |
|
341 | print "parents: %4d:%s" % (i1, h1) | |
342 | if i2: print " %4d:%s" % (i2, h2) |
|
342 | if i2: print " %4d:%s" % (i2, h2) | |
343 | changes = repo.changelog.read(repo.changelog.node(cr)) |
|
343 | changes = repo.changelog.read(repo.changelog.node(cr)) | |
344 | print "user: %s" % changes[1] |
|
344 | print "user: %s" % changes[1] | |
345 | print "date: %s" % time.asctime( |
|
345 | print "date: %s" % time.asctime( | |
346 | time.localtime(float(changes[2].split(' ')[0]))) |
|
346 | time.localtime(float(changes[2].split(' ')[0]))) | |
347 | print "description:" |
|
347 | print "description:" | |
348 | print changes[4] |
|
348 | print changes[4] | |
349 |
|
349 | |||
350 | elif len(args) > 1: |
|
350 | elif len(args) > 1: | |
351 | print "too many args" |
|
351 | print "too many args" | |
352 | else: |
|
352 | else: | |
353 | print "missing filename" |
|
353 | print "missing filename" | |
354 |
|
354 | |||
355 | elif cmd == "dump": |
|
355 | elif cmd == "dump": | |
356 | if args: |
|
356 | if args: | |
357 | r = repo.file(args[0]) |
|
357 | r = repo.file(args[0]) | |
358 | n = r.tip() |
|
358 | n = r.tip() | |
359 | if len(args) > 1: n = r.lookup(args[1]) |
|
359 | if len(args) > 1: n = r.lookup(args[1]) | |
360 | sys.stdout.write(r.read(n)) |
|
360 | sys.stdout.write(r.read(n)) | |
361 | else: |
|
361 | else: | |
362 | print "missing filename" |
|
362 | print "missing filename" | |
363 |
|
363 | |||
364 | elif cmd == "dumpmanifest": |
|
364 | elif cmd == "dumpmanifest": | |
365 | n = repo.manifest.tip() |
|
365 | n = repo.manifest.tip() | |
366 | if len(args) > 0: |
|
366 | if len(args) > 0: | |
367 | n = repo.manifest.lookup(args[0]) |
|
367 | n = repo.manifest.lookup(args[0]) | |
368 | m = repo.manifest.read(n) |
|
368 | m = repo.manifest.read(n) | |
369 | files = m.keys() |
|
369 | files = m.keys() | |
370 | files.sort() |
|
370 | files.sort() | |
371 |
|
371 | |||
372 | for f in files: |
|
372 | for f in files: | |
373 | print hg.hex(m[f]), f |
|
373 | print hg.hex(m[f]), f | |
374 |
|
374 | |||
375 | elif cmd == "debugindex": |
|
375 | elif cmd == "debugindex": | |
376 | if ".hg" not in args[0]: |
|
376 | if ".hg" not in args[0]: | |
377 | args[0] = ".hg/data/" + repo.file(args[0]).encodepath(args[0]) + "i" |
|
377 | args[0] = ".hg/data/" + repo.file(args[0]).encodepath(args[0]) + "i" | |
378 |
|
378 | |||
379 | r = hg.revlog(open, args[0], "") |
|
379 | r = hg.revlog(open, args[0], "") | |
380 | print " rev offset length base linkrev"+\ |
|
380 | print " rev offset length base linkrev"+\ | |
381 | " p1 p2 nodeid" |
|
381 | " p1 p2 nodeid" | |
382 | for i in range(r.count()): |
|
382 | for i in range(r.count()): | |
383 | e = r.index[i] |
|
383 | e = r.index[i] | |
384 | print "% 6d % 9d % 7d % 6d % 7d %s.. %s.. %s.." % ( |
|
384 | print "% 6d % 9d % 7d % 6d % 7d %s.. %s.. %s.." % ( | |
385 | i, e[0], e[1], e[2], e[3], |
|
385 | i, e[0], e[1], e[2], e[3], | |
386 | hg.hex(e[4][:5]), hg.hex(e[5][:5]), hg.hex(e[6][:5])) |
|
386 | hg.hex(e[4][:5]), hg.hex(e[5][:5]), hg.hex(e[6][:5])) | |
387 |
|
387 | |||
388 | elif cmd == "debugindexdot": |
|
388 | elif cmd == "debugindexdot": | |
389 | if ".hg" not in args[0]: |
|
389 | if ".hg" not in args[0]: | |
390 | args[0] = ".hg/data/" + repo.file(args[0]).encodepath(args[0]) + "i" |
|
390 | args[0] = ".hg/data/" + repo.file(args[0]).encodepath(args[0]) + "i" | |
391 |
|
391 | |||
392 | r = hg.revlog(open, args[0], "") |
|
392 | r = hg.revlog(open, args[0], "") | |
393 | print "digraph G {" |
|
393 | print "digraph G {" | |
394 | for i in range(r.count()): |
|
394 | for i in range(r.count()): | |
395 | e = r.index[i] |
|
395 | e = r.index[i] | |
396 | print "\t%d -> %d" % (r.rev(e[4]), i) |
|
396 | print "\t%d -> %d" % (r.rev(e[4]), i) | |
397 | if e[5] != hg.nullid: |
|
397 | if e[5] != hg.nullid: | |
398 | print "\t%d -> %d" % (r.rev(e[5]), i) |
|
398 | print "\t%d -> %d" % (r.rev(e[5]), i) | |
399 | print "}" |
|
399 | print "}" | |
400 |
|
400 | |||
401 | elif cmd == "merge": |
|
401 | elif cmd == "merge": | |
402 | (c, a, d) = repo.diffdir(repo.root, repo.current) |
|
402 | (c, a, d) = repo.diffdir(repo.root, repo.current) | |
403 | if c: |
|
403 | if c: | |
404 | ui.warn("aborting (outstanding changes in working directory)\n") |
|
404 | ui.warn("aborting (outstanding changes in working directory)\n") | |
405 | sys.exit(1) |
|
405 | sys.exit(1) | |
406 |
|
406 | |||
407 | if args: |
|
407 | if args: | |
408 | paths = {} |
|
408 | paths = {} | |
409 | try: |
|
409 | try: | |
410 | pf = os.path.join(os.environ["HOME"], ".hgpaths") |
|
410 | pf = os.path.join(os.environ["HOME"], ".hgpaths") | |
411 | for l in file(pf): |
|
411 | for l in file(pf): | |
412 | name, path = l.split() |
|
412 | name, path = l.split() | |
413 | paths[name] = path |
|
413 | paths[name] = path | |
414 | except: |
|
414 | except: | |
415 | pass |
|
415 | pass | |
416 |
|
416 | |||
417 | if args[0] in paths: args[0] = paths[args[0]] |
|
417 | if args[0] in paths: args[0] = paths[args[0]] | |
418 |
|
418 | |||
419 | other = hg.repository(ui, args[0]) |
|
419 | other = hg.repository(ui, args[0]) | |
420 | ui.status("requesting changegroup\n") |
|
420 | ui.status("requesting changegroup\n") | |
421 | cg = repo.getchangegroup(other) |
|
421 | cg = repo.getchangegroup(other) | |
422 | repo.addchangegroup(cg) |
|
422 | repo.addchangegroup(cg) | |
423 | else: |
|
423 | else: | |
424 | print "missing source repository" |
|
424 | print "missing source repository" | |
425 |
|
425 | |||
426 | elif cmd == "tags": |
|
426 | elif cmd == "tags": | |
427 | repo.lookup(0) # prime the cache |
|
427 | repo.lookup(0) # prime the cache | |
428 | i = repo.tags.items() |
|
428 | i = repo.tags.items() | |
429 | i.sort() |
|
429 | i.sort() | |
430 | for k, n in i: |
|
430 | for k, n in i: | |
431 | try: |
|
431 | try: | |
432 | r = repo.changelog.rev(n) |
|
432 | r = repo.changelog.rev(n) | |
433 | except KeyError: |
|
433 | except KeyError: | |
434 | r = "?" |
|
434 | r = "?" | |
435 | print "%-30s %5d:%s" % (k, repo.changelog.rev(n), hg.hex(n)) |
|
435 | print "%-30s %5d:%s" % (k, repo.changelog.rev(n), hg.hex(n)) | |
436 |
|
436 | |||
437 | elif cmd == "recover": |
|
437 | elif cmd == "recover": | |
438 | repo.recover() |
|
438 | repo.recover() | |
439 |
|
439 | |||
440 | elif cmd == "undo": |
|
440 | elif cmd == "undo": | |
441 | repo.recover("undo") |
|
441 | repo.recover("undo") | |
442 |
|
442 | |||
443 | elif cmd == "verify": |
|
443 | elif cmd == "verify": | |
444 | filelinkrevs = {} |
|
444 | filelinkrevs = {} | |
445 | filenodes = {} |
|
445 | filenodes = {} | |
446 | manifestchangeset = {} |
|
446 | manifestchangeset = {} | |
447 | changesets = revisions = files = 0 |
|
447 | changesets = revisions = files = 0 | |
448 | errors = 0 |
|
448 | errors = 0 | |
449 |
|
449 | |||
450 | ui.status("checking changesets\n") |
|
450 | ui.status("checking changesets\n") | |
451 | for i in range(repo.changelog.count()): |
|
451 | for i in range(repo.changelog.count()): | |
452 | changesets += 1 |
|
452 | changesets += 1 | |
453 | n = repo.changelog.node(i) |
|
453 | n = repo.changelog.node(i) | |
454 | for p in repo.changelog.parents(n): |
|
454 | for p in repo.changelog.parents(n): | |
455 | if p not in repo.changelog.nodemap: |
|
455 | if p not in repo.changelog.nodemap: | |
456 | ui.warn("changeset %s has unknown parent %s\n" % |
|
456 | ui.warn("changeset %s has unknown parent %s\n" % | |
457 | (hg.short(n), hg.short(p))) |
|
457 | (hg.short(n), hg.short(p))) | |
458 | errors += 1 |
|
458 | errors += 1 | |
459 | try: |
|
459 | try: | |
460 | changes = repo.changelog.read(n) |
|
460 | changes = repo.changelog.read(n) | |
461 | except Exception, inst: |
|
461 | except Exception, inst: | |
462 | ui.warn("unpacking changeset %s: %s\n" % (short(n), inst)) |
|
462 | ui.warn("unpacking changeset %s: %s\n" % (short(n), inst)) | |
463 | errors += 1 |
|
463 | errors += 1 | |
464 |
|
464 | |||
465 | manifestchangeset[changes[0]] = n |
|
465 | manifestchangeset[changes[0]] = n | |
466 | for f in changes[3]: |
|
466 | for f in changes[3]: | |
467 | revisions += 1 |
|
467 | revisions += 1 | |
468 | filelinkrevs.setdefault(f, []).append(i) |
|
468 | filelinkrevs.setdefault(f, []).append(i) | |
469 |
|
469 | |||
470 | ui.status("checking manifests\n") |
|
470 | ui.status("checking manifests\n") | |
471 | for i in range(repo.manifest.count()): |
|
471 | for i in range(repo.manifest.count()): | |
472 | n = repo.manifest.node(i) |
|
472 | n = repo.manifest.node(i) | |
473 | for p in repo.manifest.parents(n): |
|
473 | for p in repo.manifest.parents(n): | |
474 | if p not in repo.manifest.nodemap: |
|
474 | if p not in repo.manifest.nodemap: | |
475 | ui.warn("manifest %s has unknown parent %s\n" % |
|
475 | ui.warn("manifest %s has unknown parent %s\n" % | |
476 | (hg.short(n), hg.short(p))) |
|
476 | (hg.short(n), hg.short(p))) | |
477 | errors += 1 |
|
477 | errors += 1 | |
478 | ca = repo.changelog.node(repo.manifest.linkrev(n)) |
|
478 | ca = repo.changelog.node(repo.manifest.linkrev(n)) | |
479 | cc = manifestchangeset[n] |
|
479 | cc = manifestchangeset[n] | |
480 | if ca != cc: |
|
480 | if ca != cc: | |
481 | ui.warn("manifest %s points to %s, not %s\n" % |
|
481 | ui.warn("manifest %s points to %s, not %s\n" % | |
482 | (hg.hex(n), hg.hex(ca), hg.hex(cc))) |
|
482 | (hg.hex(n), hg.hex(ca), hg.hex(cc))) | |
483 | errors += 1 |
|
483 | errors += 1 | |
484 |
|
484 | |||
485 | try: |
|
485 | try: | |
486 | delta = mdiff.patchtext(repo.manifest.delta(n)) |
|
486 | delta = mdiff.patchtext(repo.manifest.delta(n)) | |
487 | except KeyboardInterrupt: |
|
487 | except KeyboardInterrupt: | |
488 | print "aborted" |
|
488 | print "aborted" | |
489 | sys.exit(0) |
|
489 | sys.exit(0) | |
490 | except Exception, inst: |
|
490 | except Exception, inst: | |
491 | ui.warn("unpacking manifest %s: %s\n" % (hg.short(n), inst)) |
|
491 | ui.warn("unpacking manifest %s: %s\n" % (hg.short(n), inst)) | |
492 | errors += 1 |
|
492 | errors += 1 | |
493 |
|
493 | |||
494 | ff = [ l.split('\0') for l in delta.splitlines() ] |
|
494 | ff = [ l.split('\0') for l in delta.splitlines() ] | |
495 | for f, fn in ff: |
|
495 | for f, fn in ff: | |
496 | filenodes.setdefault(f, {})[hg.bin(fn)] = 1 |
|
496 | filenodes.setdefault(f, {})[hg.bin(fn)] = 1 | |
497 |
|
497 | |||
498 | ui.status("crosschecking files in changesets and manifests\n") |
|
498 | ui.status("crosschecking files in changesets and manifests\n") | |
499 | for f in filenodes: |
|
499 | for f in filenodes: | |
500 | if f not in filelinkrevs: |
|
500 | if f not in filelinkrevs: | |
501 | ui.warn("file %s in manifest but not in changesets\n" % f) |
|
501 | ui.warn("file %s in manifest but not in changesets\n" % f) | |
502 | errors += 1 |
|
502 | errors += 1 | |
503 |
|
503 | |||
504 | for f in filelinkrevs: |
|
504 | for f in filelinkrevs: | |
505 | if f not in filenodes: |
|
505 | if f not in filenodes: | |
506 | ui.warn("file %s in changeset but not in manifest\n" % f) |
|
506 | ui.warn("file %s in changeset but not in manifest\n" % f) | |
507 | errors += 1 |
|
507 | errors += 1 | |
508 |
|
508 | |||
509 | ui.status("checking files\n") |
|
509 | ui.status("checking files\n") | |
510 | ff = filenodes.keys() |
|
510 | ff = filenodes.keys() | |
511 | ff.sort() |
|
511 | ff.sort() | |
512 | for f in ff: |
|
512 | for f in ff: | |
513 | if f == "/dev/null": continue |
|
513 | if f == "/dev/null": continue | |
514 | files += 1 |
|
514 | files += 1 | |
515 | fl = repo.file(f) |
|
515 | fl = repo.file(f) | |
516 | nodes = { hg.nullid: 1 } |
|
516 | nodes = { hg.nullid: 1 } | |
517 | for i in range(fl.count()): |
|
517 | for i in range(fl.count()): | |
518 | n = fl.node(i) |
|
518 | n = fl.node(i) | |
519 |
|
519 | |||
520 | if n not in filenodes[f]: |
|
520 | if n not in filenodes[f]: | |
521 | ui.warn("%s: %d:%s not in manifests\n" % (f, i, hg.short(n))) |
|
521 | ui.warn("%s: %d:%s not in manifests\n" % (f, i, hg.short(n))) | |
522 | print len(filenodes[f].keys()), fl.count(), f |
|
522 | print len(filenodes[f].keys()), fl.count(), f | |
523 | errors += 1 |
|
523 | errors += 1 | |
524 | else: |
|
524 | else: | |
525 | del filenodes[f][n] |
|
525 | del filenodes[f][n] | |
526 |
|
526 | |||
527 | flr = fl.linkrev(n) |
|
527 | flr = fl.linkrev(n) | |
528 | if flr not in filelinkrevs[f]: |
|
528 | if flr not in filelinkrevs[f]: | |
529 | ui.warn("%s:%s points to unexpected changeset rev %d\n" |
|
529 | ui.warn("%s:%s points to unexpected changeset rev %d\n" | |
530 | % (f, hg.short(n), fl.linkrev(n))) |
|
530 | % (f, hg.short(n), fl.linkrev(n))) | |
531 | errors += 1 |
|
531 | errors += 1 | |
532 | else: |
|
532 | else: | |
533 | filelinkrevs[f].remove(flr) |
|
533 | filelinkrevs[f].remove(flr) | |
534 |
|
534 | |||
535 | # verify contents |
|
535 | # verify contents | |
536 | try: |
|
536 | try: | |
537 | t = fl.read(n) |
|
537 | t = fl.read(n) | |
538 | except Exception, inst: |
|
538 | except Exception, inst: | |
539 | ui.warn("unpacking file %s %s: %s\n" % (f, hg.short(n), inst)) |
|
539 | ui.warn("unpacking file %s %s: %s\n" % (f, hg.short(n), inst)) | |
540 | errors += 1 |
|
540 | errors += 1 | |
541 |
|
541 | |||
542 | # verify parents |
|
542 | # verify parents | |
543 | (p1, p2) = fl.parents(n) |
|
543 | (p1, p2) = fl.parents(n) | |
544 | if p1 not in nodes: |
|
544 | if p1 not in nodes: | |
545 | ui.warn("file %s:%s unknown parent 1 %s" % |
|
545 | ui.warn("file %s:%s unknown parent 1 %s" % | |
546 | (f, hg.short(n), hg.short(p1))) |
|
546 | (f, hg.short(n), hg.short(p1))) | |
547 | errors += 1 |
|
547 | errors += 1 | |
548 | if p2 not in nodes: |
|
548 | if p2 not in nodes: | |
549 | ui.warn("file %s:%s unknown parent 2 %s" % |
|
549 | ui.warn("file %s:%s unknown parent 2 %s" % | |
550 | (f, hg.short(n), hg.short(p1))) |
|
550 | (f, hg.short(n), hg.short(p1))) | |
551 | errors += 1 |
|
551 | errors += 1 | |
552 | nodes[n] = 1 |
|
552 | nodes[n] = 1 | |
553 |
|
553 | |||
554 | # cross-check |
|
554 | # cross-check | |
555 | for flr in filelinkrevs[f]: |
|
555 | for flr in filelinkrevs[f]: | |
556 | ui.warn("changeset rev %d not in %s\n" % (flr, f)) |
|
556 | ui.warn("changeset rev %d not in %s\n" % (flr, f)) | |
557 | errors += 1 |
|
557 | errors += 1 | |
558 |
|
558 | |||
559 | for node in filenodes[f]: |
|
559 | for node in filenodes[f]: | |
560 | ui.warn("node %s in manifests not in %s\n" % (hg.hex(n), f)) |
|
560 | ui.warn("node %s in manifests not in %s\n" % (hg.hex(n), f)) | |
561 | errors += 1 |
|
561 | errors += 1 | |
562 |
|
562 | |||
563 | ui.status("%d files, %d changesets, %d total revisions\n" % |
|
563 | ui.status("%d files, %d changesets, %d total revisions\n" % | |
564 | (files, changesets, revisions)) |
|
564 | (files, changesets, revisions)) | |
565 |
|
565 | |||
566 | if errors: |
|
566 | if errors: | |
567 | ui.warn("%d integrity errors encountered!\n" % errors) |
|
567 | ui.warn("%d integrity errors encountered!\n" % errors) | |
568 | sys.exit(1) |
|
568 | sys.exit(1) | |
569 |
|
569 | |||
570 | elif cmd == "serve": |
|
570 | elif cmd == "serve": | |
571 | from mercurial import hgweb |
|
571 | from mercurial import hgweb | |
572 |
|
572 | |||
573 | soptions = {} |
|
573 | soptions = {} | |
574 | opts = [('p', 'port', 8000, 'listen port'), |
|
574 | opts = [('p', 'port', 8000, 'listen port'), | |
575 | ('a', 'address', '', 'interface address'), |
|
575 | ('a', 'address', '', 'interface address'), | |
576 | ('n', 'name', os.getcwd(), 'repository name'), |
|
576 | ('n', 'name', os.getcwd(), 'repository name'), | |
577 | ('t', 'templates', "", 'template map') |
|
577 | ('t', 'templates', "", 'template map') | |
578 | ] |
|
578 | ] | |
579 |
|
579 | |||
580 | args = fancyopts.fancyopts(args, opts, soptions, |
|
580 | args = fancyopts.fancyopts(args, opts, soptions, | |
581 | 'hg serve [options]') |
|
581 | 'hg serve [options]') | |
582 |
|
582 | |||
583 | hgweb.server(repo.root, soptions["name"], soptions["templates"], |
|
583 | hgweb.server(repo.root, soptions["name"], soptions["templates"], | |
584 | soptions["address"], soptions["port"]) |
|
584 | soptions["address"], soptions["port"]) | |
585 |
|
585 | |||
586 | else: |
|
586 | else: | |
587 | if cmd: ui.warn("unknown command\n\n") |
|
587 | if cmd: ui.warn("unknown command\n\n") | |
588 | help() |
|
588 | help() | |
589 | sys.exit(1) |
|
589 | sys.exit(1) |
@@ -1,30 +1,30 | |||||
1 | #!/usr/bin/env python |
|
1 | #!/usr/bin/env python | |
2 |
|
2 | |||
3 | # This is the mercurial setup script. |
|
3 | # This is the mercurial setup script. | |
4 | # |
|
4 | # | |
5 | # './setup.py install', or |
|
5 | # './setup.py install', or | |
6 | # './setup.py --help' for more options |
|
6 | # './setup.py --help' for more options | |
7 |
|
7 | |||
8 | import glob |
|
8 | import glob | |
9 | from distutils.core import setup, Extension |
|
9 | from distutils.core import setup, Extension | |
10 | from distutils.command.install_data import install_data |
|
10 | from distutils.command.install_data import install_data | |
11 |
|
11 | |||
12 | class install_package_data(install_data): |
|
12 | class install_package_data(install_data): | |
13 | def finalize_options(self): |
|
13 | def finalize_options(self): | |
14 | self.set_undefined_options('install', |
|
14 | self.set_undefined_options('install', | |
15 | ('install_lib', 'install_dir')) |
|
15 | ('install_lib', 'install_dir')) | |
16 | install_data.finalize_options(self) |
|
16 | install_data.finalize_options(self) | |
17 |
|
17 | |||
18 | setup(name='mercurial', |
|
18 | setup(name='mercurial', | |
19 |
version='0. |
|
19 | version='0.5', | |
20 | author='Matt Mackall', |
|
20 | author='Matt Mackall', | |
21 | author_email='mpm@selenic.com', |
|
21 | author_email='mpm@selenic.com', | |
22 | url='http://selenic.com/mercurial', |
|
22 | url='http://selenic.com/mercurial', | |
23 | description='scalable distributed SCM', |
|
23 | description='scalable distributed SCM', | |
24 | license='GNU GPL', |
|
24 | license='GNU GPL', | |
25 | packages=['mercurial'], |
|
25 | packages=['mercurial'], | |
26 | ext_modules=[Extension('mercurial.mpatch', ['mercurial/mpatch.c'])], |
|
26 | ext_modules=[Extension('mercurial.mpatch', ['mercurial/mpatch.c'])], | |
27 | data_files=[('mercurial/templates', |
|
27 | data_files=[('mercurial/templates', | |
28 | ['templates/map'] + glob.glob('templates/*.tmpl'))], |
|
28 | ['templates/map'] + glob.glob('templates/*.tmpl'))], | |
29 | cmdclass = { 'install_data' : install_package_data }, |
|
29 | cmdclass = { 'install_data' : install_package_data }, | |
30 | scripts=['hg']) |
|
30 | scripts=['hg']) |
General Comments 0
You need to be logged in to leave comments.
Login now