Show More
@@ -164,13 +164,6 b' def clone(ui, source, dest=None, pull=Fa' | |||
|
164 | 164 | copy = False |
|
165 | 165 | |
|
166 | 166 | if copy: |
|
167 | def force_copy(src, dst): | |
|
168 | if not os.path.exists(src): | |
|
169 | # Tolerate empty source repository and optional files | |
|
170 | return | |
|
171 | util.copyfiles(src, dst) | |
|
172 | ||
|
173 | src_store = os.path.realpath(src_repo.spath) | |
|
174 | 167 | if not os.path.exists(dest): |
|
175 | 168 | os.mkdir(dest) |
|
176 | 169 | try: |
@@ -182,28 +175,18 b' def clone(ui, source, dest=None, pull=Fa' | |||
|
182 | 175 | raise util.Abort(_("destination '%s' already exists") |
|
183 | 176 | % dest) |
|
184 | 177 | raise |
|
185 | if src_repo.spath != src_repo.path: | |
|
186 | # XXX racy | |
|
187 | dummy_changelog = os.path.join(dest_path, "00changelog.i") | |
|
188 | # copy the dummy changelog | |
|
189 | force_copy(src_repo.join("00changelog.i"), dummy_changelog) | |
|
190 | dest_store = os.path.join(dest_path, "store") | |
|
191 | os.mkdir(dest_store) | |
|
192 | else: | |
|
193 | dest_store = dest_path | |
|
194 | # copy the requires file | |
|
195 | force_copy(src_repo.join("requires"), | |
|
196 | os.path.join(dest_path, "requires")) | |
|
197 | # we lock here to avoid premature writing to the target | |
|
198 | dest_lock = lock.lock(os.path.join(dest_store, "lock")) | |
|
199 | 178 | |
|
200 | files = ("data", | |
|
201 | "00manifest.d", "00manifest.i", | |
|
202 | "00changelog.d", "00changelog.i") | |
|
203 | for f in files: | |
|
204 |
|
|
|
205 |
|
|
|
206 | force_copy(src, dst) | |
|
179 | for f in src_repo.store.copylist(): | |
|
180 | src = os.path.join(src_repo.path, f) | |
|
181 | if os.path.exists(src): | |
|
182 | dst = os.path.join(dest_path, f) | |
|
183 | dstbase = os.path.dirname(dst) | |
|
184 | if not os.path.exists(dstbase): | |
|
185 | os.mkdir(dstbase) | |
|
186 | if dst.endswith('data'): | |
|
187 | # lock to avoid premature writing to the target | |
|
188 | dest_lock = lock.lock(os.path.join(dstbase, "lock")) | |
|
189 | util.copyfiles(src, dst) | |
|
207 | 190 | |
|
208 | 191 | # we need to re-init the repo after manually copying the data |
|
209 | 192 | # into it |
@@ -46,6 +46,8 b' def _calcmode(path):' | |||
|
46 | 46 | mode = None |
|
47 | 47 | return mode |
|
48 | 48 | |
|
49 | _data = 'data 00manifest.d 00manifest.i 00changelog.d 00changelog.i' | |
|
50 | ||
|
49 | 51 | class basicstore: |
|
50 | 52 | '''base class for local repository stores''' |
|
51 | 53 | def __init__(self, path, opener): |
@@ -90,6 +92,9 b' class basicstore:' | |||
|
90 | 92 | for x in meta: |
|
91 | 93 | yield x |
|
92 | 94 | |
|
95 | def copylist(self): | |
|
96 | return ['requires'] + _data.split() | |
|
97 | ||
|
93 | 98 | class encodedstore(basicstore): |
|
94 | 99 | def __init__(self, path, opener): |
|
95 | 100 | self.path = os.path.join(path, 'store') |
@@ -109,6 +114,10 b' class encodedstore(basicstore):' | |||
|
109 | 114 | def join(self, f): |
|
110 | 115 | return os.path.join(self.path, encodefilename(f)) |
|
111 | 116 | |
|
117 | def copylist(self): | |
|
118 | return (['requires', '00changelog.i'] + | |
|
119 | ['store/' + f for f in _data.split()]) | |
|
120 | ||
|
112 | 121 | def store(requirements, path, opener): |
|
113 | 122 | if 'store' in requirements: |
|
114 | 123 | return encodedstore(path, opener) |
General Comments 0
You need to be logged in to leave comments.
Login now