Show More
@@ -0,0 +1,14 b'' | |||
|
1 | #!/bin/sh | |
|
2 | ||
|
3 | mkdir t | |
|
4 | cd t | |
|
5 | hg init | |
|
6 | echo a > a | |
|
7 | hg add a | |
|
8 | hg commit -m test -d "1000000 0" | |
|
9 | rm .hg/requires | |
|
10 | hg tip | |
|
11 | echo indoor-pool > .hg/requires | |
|
12 | hg tip | |
|
13 | ||
|
14 | true |
@@ -0,0 +1,7 b'' | |||
|
1 | changeset: 0:0acdaf898367 | |
|
2 | tag: tip | |
|
3 | user: test | |
|
4 | date: Mon Jan 12 13:46:40 1970 +0000 | |
|
5 | summary: test | |
|
6 | ||
|
7 | abort: requirement 'indoor-pool' not supported! |
@@ -149,13 +149,23 b' def clone(ui, source, dest=None, pull=Fa' | |||
|
149 | 149 | copy = False |
|
150 | 150 | |
|
151 | 151 | if copy: |
|
152 | # we lock here to avoid premature writing to the target | |
|
152 | def force_copy(src, dst): | |
|
153 | try: | |
|
154 | util.copyfiles(src, dst) | |
|
155 | except OSError, inst: | |
|
156 | if inst.errno != errno.ENOENT: | |
|
157 | raise | |
|
158 | ||
|
153 | 159 | src_store = os.path.realpath(src_repo.spath) |
|
154 | 160 | dest_path = os.path.realpath(os.path.join(dest, ".hg")) |
|
155 | 161 | dest_store = dest_path |
|
156 | 162 | if not os.path.exists(dest): |
|
157 | 163 | os.mkdir(dest) |
|
158 | 164 | os.mkdir(dest_path) |
|
165 | # copy the requires file | |
|
166 | force_copy(src_repo.join("requires"), | |
|
167 | os.path.join(dest_path, "requires")) | |
|
168 | # we lock here to avoid premature writing to the target | |
|
159 | 169 | dest_lock = lock.lock(os.path.join(dest_store, "lock")) |
|
160 | 170 | |
|
161 | 171 | files = ("data", |
@@ -164,11 +174,7 b' def clone(ui, source, dest=None, pull=Fa' | |||
|
164 | 174 | for f in files: |
|
165 | 175 | src = os.path.join(src_store, f) |
|
166 | 176 | dst = os.path.join(dest_store, f) |
|
167 | try: | |
|
168 | util.copyfiles(src, dst) | |
|
169 | except OSError, inst: | |
|
170 | if inst.errno != errno.ENOENT: | |
|
171 | raise | |
|
177 | force_copy(src, dst) | |
|
172 | 178 | |
|
173 | 179 | # we need to re-init the repo after manually copying the data |
|
174 | 180 | # into it |
@@ -16,6 +16,7 b' demandload(globals(), "os revlog time ut' | |||
|
16 | 16 | |
|
17 | 17 | class localrepository(repo.repository): |
|
18 | 18 | capabilities = ('lookup', 'changegroupsubset') |
|
19 | supported = ('revlogv1',) | |
|
19 | 20 | |
|
20 | 21 | def __del__(self): |
|
21 | 22 | self.transhandle = None |
@@ -44,10 +45,27 b' class localrepository(repo.repository):' | |||
|
44 | 45 | os.mkdir(self.path) |
|
45 | 46 | #if self.spath != self.path: |
|
46 | 47 | # os.mkdir(self.spath) |
|
48 | requirements = ("revlogv1",) | |
|
49 | reqfile = self.opener("requires", "w") | |
|
50 | for r in requirements: | |
|
51 | reqfile.write("%s\n" % r) | |
|
52 | reqfile.close() | |
|
47 | 53 | else: |
|
48 | 54 | raise repo.RepoError(_("repository %s not found") % path) |
|
49 | 55 | elif create: |
|
50 | 56 | raise repo.RepoError(_("repository %s already exists") % path) |
|
57 | else: | |
|
58 | # find requirements | |
|
59 | try: | |
|
60 | requirements = self.opener("requires").read().splitlines() | |
|
61 | except IOError, inst: | |
|
62 | if inst.errno != errno.ENOENT: | |
|
63 | raise | |
|
64 | requirements = [] | |
|
65 | # check them | |
|
66 | for r in requirements: | |
|
67 | if r not in self.supported: | |
|
68 | raise repo.RepoError(_("requirement '%s' not supported") % r) | |
|
51 | 69 | |
|
52 | 70 | # setup store |
|
53 | 71 | self.spath = self.path |
@@ -37,7 +37,20 b' class statichttprepository(localrepo.loc' | |||
|
37 | 37 | self.ui = ui |
|
38 | 38 | self.revlogversion = 0 |
|
39 | 39 | self.opener = opener(self.path) |
|
40 | # find requirements | |
|
41 | try: | |
|
42 | requirements = self.opener("requires").read().splitlines() | |
|
43 | except IOError: | |
|
44 | requirements = [] | |
|
45 | # check them | |
|
46 | for r in requirements: | |
|
47 | if r not in self.supported: | |
|
48 | raise repo.RepoError(_("requirement '%s' not supported") % r) | |
|
49 | ||
|
50 | # setup store | |
|
51 | self.spath = self.path | |
|
40 | 52 | self.sopener = opener(self.spath) |
|
53 | ||
|
41 | 54 | self.manifest = manifest.manifest(self.sopener) |
|
42 | 55 | self.changelog = changelog.changelog(self.sopener) |
|
43 | 56 | self.tagscache = None |
General Comments 0
You need to be logged in to leave comments.
Login now