Mercurial > hg
annotate mercurial/statichttprepo.py @ 12061:f7557345b199
Merge with stable
author | Martin Geisler <mg@lazybytes.net> |
---|---|
date | Fri, 27 Aug 2010 13:18:25 +0200 |
parents | aaf9968bd8b7 |
children | 61c9bc3da402 |
rev | line source |
---|---|
1101 | 1 # statichttprepo.py - simple http repository class for mercurial |
2 # | |
3 # This provides read-only repo access to repositories exported via static http | |
4 # | |
4635
63b9d2deed48
Updated copyright notices and add "and others" to "hg version"
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4258
diff
changeset
|
5 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com> |
1101 | 6 # |
8225
46293a0c7e9f
updated license to be explicit about GPL version 2
Martin Geisler <mg@lazybytes.net>
parents:
7873
diff
changeset
|
7 # This software may be used and distributed according to the terms of the |
10263 | 8 # GNU General Public License version 2 or any later version. |
1101 | 9 |
3891 | 10 from i18n import _ |
7637 | 11 import changelog, byterange, url, error |
7873
4a4c7f6a5912
cleanup: drop unused imports
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
7637
diff
changeset
|
12 import localrepo, manifest, util, store |
6028
6605a03cbf87
make static-http work with empty repos (issue965)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
5321
diff
changeset
|
13 import urllib, urllib2, errno |
1325
57220daf40e9
Move urllib error handling from revlog into statichttprepo, where it belongs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1101
diff
changeset
|
14 |
7274
95f3694cc5a4
statichttprepo: cleanups, use url.py (proxy, password support)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7211
diff
changeset
|
15 class httprangereader(object): |
95f3694cc5a4
statichttprepo: cleanups, use url.py (proxy, password support)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7211
diff
changeset
|
16 def __init__(self, url, opener): |
95f3694cc5a4
statichttprepo: cleanups, use url.py (proxy, password support)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7211
diff
changeset
|
17 # we assume opener has HTTPRangeHandler |
95f3694cc5a4
statichttprepo: cleanups, use url.py (proxy, password support)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7211
diff
changeset
|
18 self.url = url |
95f3694cc5a4
statichttprepo: cleanups, use url.py (proxy, password support)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7211
diff
changeset
|
19 self.pos = 0 |
95f3694cc5a4
statichttprepo: cleanups, use url.py (proxy, password support)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7211
diff
changeset
|
20 self.opener = opener |
11066
26abd91d9e84
static-http: mimic more closely localrepo (issue2164: allow clone -r )
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10263
diff
changeset
|
21 self.name = url |
7274
95f3694cc5a4
statichttprepo: cleanups, use url.py (proxy, password support)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7211
diff
changeset
|
22 def seek(self, pos): |
95f3694cc5a4
statichttprepo: cleanups, use url.py (proxy, password support)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7211
diff
changeset
|
23 self.pos = pos |
95f3694cc5a4
statichttprepo: cleanups, use url.py (proxy, password support)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7211
diff
changeset
|
24 def read(self, bytes=None): |
95f3694cc5a4
statichttprepo: cleanups, use url.py (proxy, password support)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7211
diff
changeset
|
25 req = urllib2.Request(self.url) |
95f3694cc5a4
statichttprepo: cleanups, use url.py (proxy, password support)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7211
diff
changeset
|
26 end = '' |
95f3694cc5a4
statichttprepo: cleanups, use url.py (proxy, password support)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7211
diff
changeset
|
27 if bytes: |
95f3694cc5a4
statichttprepo: cleanups, use url.py (proxy, password support)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7211
diff
changeset
|
28 end = self.pos + bytes - 1 |
95f3694cc5a4
statichttprepo: cleanups, use url.py (proxy, password support)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7211
diff
changeset
|
29 req.add_header('Range', 'bytes=%d-%s' % (self.pos, end)) |
95f3694cc5a4
statichttprepo: cleanups, use url.py (proxy, password support)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7211
diff
changeset
|
30 |
1325
57220daf40e9
Move urllib error handling from revlog into statichttprepo, where it belongs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1101
diff
changeset
|
31 try: |
7274
95f3694cc5a4
statichttprepo: cleanups, use url.py (proxy, password support)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7211
diff
changeset
|
32 f = self.opener.open(req) |
95f3694cc5a4
statichttprepo: cleanups, use url.py (proxy, password support)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7211
diff
changeset
|
33 data = f.read() |
8612
e10e984bea46
statichttprepo: handle remote not supporting Range headers
Patrick Mezard <pmezard@gmail.com>
parents:
8225
diff
changeset
|
34 if hasattr(f, 'getcode'): |
e10e984bea46
statichttprepo: handle remote not supporting Range headers
Patrick Mezard <pmezard@gmail.com>
parents:
8225
diff
changeset
|
35 # python 2.6+ |
e10e984bea46
statichttprepo: handle remote not supporting Range headers
Patrick Mezard <pmezard@gmail.com>
parents:
8225
diff
changeset
|
36 code = f.getcode() |
e10e984bea46
statichttprepo: handle remote not supporting Range headers
Patrick Mezard <pmezard@gmail.com>
parents:
8225
diff
changeset
|
37 elif hasattr(f, 'code'): |
e10e984bea46
statichttprepo: handle remote not supporting Range headers
Patrick Mezard <pmezard@gmail.com>
parents:
8225
diff
changeset
|
38 # undocumented attribute, seems to be set in 2.4 and 2.5 |
e10e984bea46
statichttprepo: handle remote not supporting Range headers
Patrick Mezard <pmezard@gmail.com>
parents:
8225
diff
changeset
|
39 code = f.code |
e10e984bea46
statichttprepo: handle remote not supporting Range headers
Patrick Mezard <pmezard@gmail.com>
parents:
8225
diff
changeset
|
40 else: |
e10e984bea46
statichttprepo: handle remote not supporting Range headers
Patrick Mezard <pmezard@gmail.com>
parents:
8225
diff
changeset
|
41 # Don't know how to check, hope for the best. |
e10e984bea46
statichttprepo: handle remote not supporting Range headers
Patrick Mezard <pmezard@gmail.com>
parents:
8225
diff
changeset
|
42 code = 206 |
1821
0b3f4be5c5bf
Catch urllib errors for old-http in a nicer way.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1598
diff
changeset
|
43 except urllib2.HTTPError, inst: |
6028
6605a03cbf87
make static-http work with empty repos (issue965)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
5321
diff
changeset
|
44 num = inst.code == 404 and errno.ENOENT or None |
6605a03cbf87
make static-http work with empty repos (issue965)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
5321
diff
changeset
|
45 raise IOError(num, inst) |
1325
57220daf40e9
Move urllib error handling from revlog into statichttprepo, where it belongs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1101
diff
changeset
|
46 except urllib2.URLError, inst: |
1821
0b3f4be5c5bf
Catch urllib errors for old-http in a nicer way.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1598
diff
changeset
|
47 raise IOError(None, inst.reason[1]) |
1101 | 48 |
8612
e10e984bea46
statichttprepo: handle remote not supporting Range headers
Patrick Mezard <pmezard@gmail.com>
parents:
8225
diff
changeset
|
49 if code == 200: |
e10e984bea46
statichttprepo: handle remote not supporting Range headers
Patrick Mezard <pmezard@gmail.com>
parents:
8225
diff
changeset
|
50 # HTTPRangeHandler does nothing if remote does not support |
e10e984bea46
statichttprepo: handle remote not supporting Range headers
Patrick Mezard <pmezard@gmail.com>
parents:
8225
diff
changeset
|
51 # Range headers and returns the full entity. Let's slice it. |
e10e984bea46
statichttprepo: handle remote not supporting Range headers
Patrick Mezard <pmezard@gmail.com>
parents:
8225
diff
changeset
|
52 if bytes: |
e10e984bea46
statichttprepo: handle remote not supporting Range headers
Patrick Mezard <pmezard@gmail.com>
parents:
8225
diff
changeset
|
53 data = data[self.pos:self.pos + bytes] |
e10e984bea46
statichttprepo: handle remote not supporting Range headers
Patrick Mezard <pmezard@gmail.com>
parents:
8225
diff
changeset
|
54 else: |
e10e984bea46
statichttprepo: handle remote not supporting Range headers
Patrick Mezard <pmezard@gmail.com>
parents:
8225
diff
changeset
|
55 data = data[self.pos:] |
e10e984bea46
statichttprepo: handle remote not supporting Range headers
Patrick Mezard <pmezard@gmail.com>
parents:
8225
diff
changeset
|
56 elif bytes: |
7274
95f3694cc5a4
statichttprepo: cleanups, use url.py (proxy, password support)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7211
diff
changeset
|
57 data = data[:bytes] |
8612
e10e984bea46
statichttprepo: handle remote not supporting Range headers
Patrick Mezard <pmezard@gmail.com>
parents:
8225
diff
changeset
|
58 self.pos += len(data) |
7274
95f3694cc5a4
statichttprepo: cleanups, use url.py (proxy, password support)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7211
diff
changeset
|
59 return data |
11066
26abd91d9e84
static-http: mimic more closely localrepo (issue2164: allow clone -r )
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10263
diff
changeset
|
60 def __iter__(self): |
26abd91d9e84
static-http: mimic more closely localrepo (issue2164: allow clone -r )
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10263
diff
changeset
|
61 return iter(self.read().splitlines(1)) |
26abd91d9e84
static-http: mimic more closely localrepo (issue2164: allow clone -r )
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10263
diff
changeset
|
62 def close(self): |
26abd91d9e84
static-http: mimic more closely localrepo (issue2164: allow clone -r )
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10263
diff
changeset
|
63 pass |
7274
95f3694cc5a4
statichttprepo: cleanups, use url.py (proxy, password support)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7211
diff
changeset
|
64 |
95f3694cc5a4
statichttprepo: cleanups, use url.py (proxy, password support)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7211
diff
changeset
|
65 def build_opener(ui, authinfo): |
95f3694cc5a4
statichttprepo: cleanups, use url.py (proxy, password support)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7211
diff
changeset
|
66 # urllib cannot handle URLs with embedded user or passwd |
95f3694cc5a4
statichttprepo: cleanups, use url.py (proxy, password support)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7211
diff
changeset
|
67 urlopener = url.opener(ui, authinfo) |
95f3694cc5a4
statichttprepo: cleanups, use url.py (proxy, password support)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7211
diff
changeset
|
68 urlopener.add_handler(byterange.HTTPRangeHandler()) |
95f3694cc5a4
statichttprepo: cleanups, use url.py (proxy, password support)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7211
diff
changeset
|
69 |
95f3694cc5a4
statichttprepo: cleanups, use url.py (proxy, password support)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7211
diff
changeset
|
70 def opener(base): |
95f3694cc5a4
statichttprepo: cleanups, use url.py (proxy, password support)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7211
diff
changeset
|
71 """return a function that opens files over http""" |
95f3694cc5a4
statichttprepo: cleanups, use url.py (proxy, password support)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7211
diff
changeset
|
72 p = base |
11066
26abd91d9e84
static-http: mimic more closely localrepo (issue2164: allow clone -r )
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10263
diff
changeset
|
73 def o(path, mode="r", atomictemp=None): |
26abd91d9e84
static-http: mimic more closely localrepo (issue2164: allow clone -r )
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10263
diff
changeset
|
74 if 'a' in mode or 'w' in mode: |
26abd91d9e84
static-http: mimic more closely localrepo (issue2164: allow clone -r )
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10263
diff
changeset
|
75 raise IOError('Permission denied') |
7274
95f3694cc5a4
statichttprepo: cleanups, use url.py (proxy, password support)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7211
diff
changeset
|
76 f = "/".join((p, urllib.quote(path))) |
95f3694cc5a4
statichttprepo: cleanups, use url.py (proxy, password support)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7211
diff
changeset
|
77 return httprangereader(f, urlopener) |
95f3694cc5a4
statichttprepo: cleanups, use url.py (proxy, password support)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7211
diff
changeset
|
78 return o |
95f3694cc5a4
statichttprepo: cleanups, use url.py (proxy, password support)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7211
diff
changeset
|
79 |
11155
245a67fe2574
static-http: disable lazy parsing
Matt Mackall <mpm@selenic.com>
parents:
11066
diff
changeset
|
80 opener.options = {'nonlazy': 1} |
7274
95f3694cc5a4
statichttprepo: cleanups, use url.py (proxy, password support)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7211
diff
changeset
|
81 return opener |
1101 | 82 |
83 class statichttprepository(localrepo.localrepository): | |
84 def __init__(self, ui, path): | |
2673
109a22f5434a
hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2072
diff
changeset
|
85 self._url = path |
1101 | 86 self.ui = ui |
3853
c0b449154a90
switch to the .hg/store layout, fix the tests
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3851
diff
changeset
|
87 |
11066
26abd91d9e84
static-http: mimic more closely localrepo (issue2164: allow clone -r )
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10263
diff
changeset
|
88 self.root = path |
7274
95f3694cc5a4
statichttprepo: cleanups, use url.py (proxy, password support)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7211
diff
changeset
|
89 self.path, authinfo = url.getauthinfo(path.rstrip('/') + "/.hg") |
95f3694cc5a4
statichttprepo: cleanups, use url.py (proxy, password support)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7211
diff
changeset
|
90 |
95f3694cc5a4
statichttprepo: cleanups, use url.py (proxy, password support)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7211
diff
changeset
|
91 opener = build_opener(ui, authinfo) |
1101 | 92 self.opener = opener(self.path) |
6028
6605a03cbf87
make static-http work with empty repos (issue965)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
5321
diff
changeset
|
93 |
3851
8f18e31c4441
add "requires" file to the repo, specifying the requirements
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3794
diff
changeset
|
94 # find requirements |
8f18e31c4441
add "requires" file to the repo, specifying the requirements
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3794
diff
changeset
|
95 try: |
8f18e31c4441
add "requires" file to the repo, specifying the requirements
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3794
diff
changeset
|
96 requirements = self.opener("requires").read().splitlines() |
6028
6605a03cbf87
make static-http work with empty repos (issue965)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
5321
diff
changeset
|
97 except IOError, inst: |
7178
98b6c3dde237
Fix Debian bug #494889 (fetching from static-http://... broken)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6312
diff
changeset
|
98 if inst.errno != errno.ENOENT: |
98b6c3dde237
Fix Debian bug #494889 (fetching from static-http://... broken)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6312
diff
changeset
|
99 raise |
98b6c3dde237
Fix Debian bug #494889 (fetching from static-http://... broken)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6312
diff
changeset
|
100 # check if it is a non-empty old-style repository |
98b6c3dde237
Fix Debian bug #494889 (fetching from static-http://... broken)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6312
diff
changeset
|
101 try: |
98b6c3dde237
Fix Debian bug #494889 (fetching from static-http://... broken)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6312
diff
changeset
|
102 self.opener("00changelog.i").read(1) |
98b6c3dde237
Fix Debian bug #494889 (fetching from static-http://... broken)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6312
diff
changeset
|
103 except IOError, inst: |
98b6c3dde237
Fix Debian bug #494889 (fetching from static-http://... broken)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6312
diff
changeset
|
104 if inst.errno != errno.ENOENT: |
98b6c3dde237
Fix Debian bug #494889 (fetching from static-http://... broken)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6312
diff
changeset
|
105 raise |
98b6c3dde237
Fix Debian bug #494889 (fetching from static-http://... broken)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6312
diff
changeset
|
106 # we do not care about empty old-style repositories here |
6028
6605a03cbf87
make static-http work with empty repos (issue965)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
5321
diff
changeset
|
107 msg = _("'%s' does not appear to be an hg repository") % path |
7637 | 108 raise error.RepoError(msg) |
7178
98b6c3dde237
Fix Debian bug #494889 (fetching from static-http://... broken)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6312
diff
changeset
|
109 requirements = [] |
6028
6605a03cbf87
make static-http work with empty repos (issue965)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
5321
diff
changeset
|
110 |
3851
8f18e31c4441
add "requires" file to the repo, specifying the requirements
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3794
diff
changeset
|
111 # check them |
8f18e31c4441
add "requires" file to the repo, specifying the requirements
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3794
diff
changeset
|
112 for r in requirements: |
8f18e31c4441
add "requires" file to the repo, specifying the requirements
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3794
diff
changeset
|
113 if r not in self.supported: |
7637 | 114 raise error.RepoError(_("requirement '%s' not supported") % r) |
3851
8f18e31c4441
add "requires" file to the repo, specifying the requirements
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3794
diff
changeset
|
115 |
8f18e31c4441
add "requires" file to the repo, specifying the requirements
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3794
diff
changeset
|
116 # setup store |
6988 | 117 def pjoin(a, b): |
118 return a + '/' + b | |
119 self.store = store.store(requirements, self.path, opener, pjoin) | |
6897
faea0d27e38f
statichttp: use store class
Matt Mackall <mpm@selenic.com>
parents:
6840
diff
changeset
|
120 self.spath = self.store.path |
faea0d27e38f
statichttp: use store class
Matt Mackall <mpm@selenic.com>
parents:
6840
diff
changeset
|
121 self.sopener = self.store.opener |
faea0d27e38f
statichttp: use store class
Matt Mackall <mpm@selenic.com>
parents:
6840
diff
changeset
|
122 self.sjoin = self.store.join |
3851
8f18e31c4441
add "requires" file to the repo, specifying the requirements
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3794
diff
changeset
|
123 |
3791
8643b9f90b51
introduce localrepo.spath for the store path, sopener fixes
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3457
diff
changeset
|
124 self.manifest = manifest.manifest(self.sopener) |
8643b9f90b51
introduce localrepo.spath for the store path, sopener fixes
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3457
diff
changeset
|
125 self.changelog = changelog.changelog(self.sopener) |
9146
5614a628d173
localrepo: rename in-memory tag cache instance attributes (issue548).
Greg Ward <greg-hg@gerg.ca>
parents:
8612
diff
changeset
|
126 self._tags = None |
1101 | 127 self.nodetagscache = None |
11066
26abd91d9e84
static-http: mimic more closely localrepo (issue2164: allow clone -r )
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10263
diff
changeset
|
128 self._branchcache = None |
26abd91d9e84
static-http: mimic more closely localrepo (issue2164: allow clone -r )
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10263
diff
changeset
|
129 self._branchcachetip = None |
1598
14d1f1868bf6
cleanup of revlog.group when repository is local
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1325
diff
changeset
|
130 self.encodepats = None |
14d1f1868bf6
cleanup of revlog.group when repository is local
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1325
diff
changeset
|
131 self.decodepats = None |
12037
aaf9968bd8b7
statichttprepo: disable pushkey
Matt Mackall <mpm@selenic.com>
parents:
11155
diff
changeset
|
132 self.capabilities.remove("pushkey") |
1101 | 133 |
2673
109a22f5434a
hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2072
diff
changeset
|
134 def url(self): |
7211 | 135 return self._url |
2673
109a22f5434a
hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2072
diff
changeset
|
136 |
1101 | 137 def local(self): |
138 return False | |
2740
386f04d6ecb3
clean up hg.py: move repo constructor code into each repo module
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2673
diff
changeset
|
139 |
7005
7739b61897df
do not pretend to lock static-http repositories (issue994)
Martin Geisler <mg@daimi.au.dk>
parents:
6988
diff
changeset
|
140 def lock(self, wait=True): |
7739b61897df
do not pretend to lock static-http repositories (issue994)
Martin Geisler <mg@daimi.au.dk>
parents:
6988
diff
changeset
|
141 raise util.Abort(_('cannot lock static-http repository')) |
7739b61897df
do not pretend to lock static-http repositories (issue994)
Martin Geisler <mg@daimi.au.dk>
parents:
6988
diff
changeset
|
142 |
2740
386f04d6ecb3
clean up hg.py: move repo constructor code into each repo module
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2673
diff
changeset
|
143 def instance(ui, path, create): |
386f04d6ecb3
clean up hg.py: move repo constructor code into each repo module
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2673
diff
changeset
|
144 if create: |
386f04d6ecb3
clean up hg.py: move repo constructor code into each repo module
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2673
diff
changeset
|
145 raise util.Abort(_('cannot create new static-http repository')) |
4853
bf10a03a6b24
Removed deprecated hg:// and old-http:// protocols (issue406)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4635
diff
changeset
|
146 return statichttprepository(ui, path[7:]) |