##// END OF EJS Templates
bundlerepo: remove old style check of file names...
Mads Kiilerich -
r18418:e7212613 default
parent child Browse files
Show More
@@ -1,382 +1,380 b''
1 # bundlerepo.py - repository class for viewing uncompressed bundles
1 # bundlerepo.py - repository class for viewing uncompressed bundles
2 #
2 #
3 # Copyright 2006, 2007 Benoit Boissinot <bboissin@gmail.com>
3 # Copyright 2006, 2007 Benoit Boissinot <bboissin@gmail.com>
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 """Repository class for viewing uncompressed bundles.
8 """Repository class for viewing uncompressed bundles.
9
9
10 This provides a read-only repository interface to bundles as if they
10 This provides a read-only repository interface to bundles as if they
11 were part of the actual repository.
11 were part of the actual repository.
12 """
12 """
13
13
14 from node import nullid
14 from node import nullid
15 from i18n import _
15 from i18n import _
16 import os, tempfile, shutil
16 import os, tempfile, shutil
17 import changegroup, util, mdiff, discovery, cmdutil, scmutil
17 import changegroup, util, mdiff, discovery, cmdutil, scmutil
18 import localrepo, changelog, manifest, filelog, revlog, error
18 import localrepo, changelog, manifest, filelog, revlog, error
19
19
20 class bundlerevlog(revlog.revlog):
20 class bundlerevlog(revlog.revlog):
21 def __init__(self, opener, indexfile, bundle, linkmapper):
21 def __init__(self, opener, indexfile, bundle, linkmapper):
22 # How it works:
22 # How it works:
23 # To retrieve a revision, we need to know the offset of the revision in
23 # To retrieve a revision, we need to know the offset of the revision in
24 # the bundle (an unbundle object). We store this offset in the index
24 # the bundle (an unbundle object). We store this offset in the index
25 # (start).
25 # (start).
26 #
26 #
27 # basemap is indexed with revisions coming from the bundle, and it
27 # basemap is indexed with revisions coming from the bundle, and it
28 # maps to the revision that is the base of the corresponding delta.
28 # maps to the revision that is the base of the corresponding delta.
29 #
29 #
30 # To differentiate a rev in the bundle from a rev in the revlog, we
30 # To differentiate a rev in the bundle from a rev in the revlog, we
31 # check revision against basemap.
31 # check revision against basemap.
32 opener = scmutil.readonlyvfs(opener)
32 opener = scmutil.readonlyvfs(opener)
33 revlog.revlog.__init__(self, opener, indexfile)
33 revlog.revlog.__init__(self, opener, indexfile)
34 self.bundle = bundle
34 self.bundle = bundle
35 self.basemap = {} # mapping rev to delta base rev
35 self.basemap = {} # mapping rev to delta base rev
36 n = len(self)
36 n = len(self)
37 chain = None
37 chain = None
38 self.bundlerevs = set() # used by 'bundle()' revset expression
38 self.bundlerevs = set() # used by 'bundle()' revset expression
39 while True:
39 while True:
40 chunkdata = bundle.deltachunk(chain)
40 chunkdata = bundle.deltachunk(chain)
41 if not chunkdata:
41 if not chunkdata:
42 break
42 break
43 node = chunkdata['node']
43 node = chunkdata['node']
44 p1 = chunkdata['p1']
44 p1 = chunkdata['p1']
45 p2 = chunkdata['p2']
45 p2 = chunkdata['p2']
46 cs = chunkdata['cs']
46 cs = chunkdata['cs']
47 deltabase = chunkdata['deltabase']
47 deltabase = chunkdata['deltabase']
48 delta = chunkdata['delta']
48 delta = chunkdata['delta']
49
49
50 size = len(delta)
50 size = len(delta)
51 start = bundle.tell() - size
51 start = bundle.tell() - size
52
52
53 link = linkmapper(cs)
53 link = linkmapper(cs)
54 if node in self.nodemap:
54 if node in self.nodemap:
55 # this can happen if two branches make the same change
55 # this can happen if two branches make the same change
56 chain = node
56 chain = node
57 self.bundlerevs.add(self.nodemap[node])
57 self.bundlerevs.add(self.nodemap[node])
58 continue
58 continue
59
59
60 for p in (p1, p2):
60 for p in (p1, p2):
61 if p not in self.nodemap:
61 if p not in self.nodemap:
62 raise error.LookupError(p, self.indexfile,
62 raise error.LookupError(p, self.indexfile,
63 _("unknown parent"))
63 _("unknown parent"))
64
64
65 if deltabase not in self.nodemap:
65 if deltabase not in self.nodemap:
66 raise LookupError(deltabase, self.indexfile,
66 raise LookupError(deltabase, self.indexfile,
67 _('unknown delta base'))
67 _('unknown delta base'))
68
68
69 baserev = self.rev(deltabase)
69 baserev = self.rev(deltabase)
70 # start, size, full unc. size, base (unused), link, p1, p2, node
70 # start, size, full unc. size, base (unused), link, p1, p2, node
71 e = (revlog.offset_type(start, 0), size, -1, -1, link,
71 e = (revlog.offset_type(start, 0), size, -1, -1, link,
72 self.rev(p1), self.rev(p2), node)
72 self.rev(p1), self.rev(p2), node)
73 self.basemap[n] = baserev
73 self.basemap[n] = baserev
74 self.index.insert(-1, e)
74 self.index.insert(-1, e)
75 self.nodemap[node] = n
75 self.nodemap[node] = n
76 self.bundlerevs.add(n)
76 self.bundlerevs.add(n)
77 chain = node
77 chain = node
78 n += 1
78 n += 1
79
79
80 def _chunk(self, rev):
80 def _chunk(self, rev):
81 # Warning: in case of bundle, the diff is against self.basemap,
81 # Warning: in case of bundle, the diff is against self.basemap,
82 # not against rev - 1
82 # not against rev - 1
83 # XXX: could use some caching
83 # XXX: could use some caching
84 if rev not in self.basemap:
84 if rev not in self.basemap:
85 return revlog.revlog._chunk(self, rev)
85 return revlog.revlog._chunk(self, rev)
86 self.bundle.seek(self.start(rev))
86 self.bundle.seek(self.start(rev))
87 return self.bundle.read(self.length(rev))
87 return self.bundle.read(self.length(rev))
88
88
89 def revdiff(self, rev1, rev2):
89 def revdiff(self, rev1, rev2):
90 """return or calculate a delta between two revisions"""
90 """return or calculate a delta between two revisions"""
91 if rev1 in self.basemap and rev2 in self.basemap:
91 if rev1 in self.basemap and rev2 in self.basemap:
92 # hot path for bundle
92 # hot path for bundle
93 revb = self.basemap[rev2]
93 revb = self.basemap[rev2]
94 if revb == rev1:
94 if revb == rev1:
95 return self._chunk(rev2)
95 return self._chunk(rev2)
96 elif rev1 not in self.basemap and rev2 not in self.basemap:
96 elif rev1 not in self.basemap and rev2 not in self.basemap:
97 return revlog.revlog.revdiff(self, rev1, rev2)
97 return revlog.revlog.revdiff(self, rev1, rev2)
98
98
99 return mdiff.textdiff(self.revision(self.node(rev1)),
99 return mdiff.textdiff(self.revision(self.node(rev1)),
100 self.revision(self.node(rev2)))
100 self.revision(self.node(rev2)))
101
101
102 def revision(self, nodeorrev):
102 def revision(self, nodeorrev):
103 """return an uncompressed revision of a given node or revision
103 """return an uncompressed revision of a given node or revision
104 number.
104 number.
105 """
105 """
106 if isinstance(nodeorrev, int):
106 if isinstance(nodeorrev, int):
107 rev = nodeorrev
107 rev = nodeorrev
108 node = self.node(rev)
108 node = self.node(rev)
109 else:
109 else:
110 node = nodeorrev
110 node = nodeorrev
111 rev = self.rev(node)
111 rev = self.rev(node)
112
112
113 if node == nullid:
113 if node == nullid:
114 return ""
114 return ""
115
115
116 text = None
116 text = None
117 chain = []
117 chain = []
118 iterrev = rev
118 iterrev = rev
119 # reconstruct the revision if it is from a changegroup
119 # reconstruct the revision if it is from a changegroup
120 while iterrev in self.basemap:
120 while iterrev in self.basemap:
121 if self._cache and self._cache[1] == iterrev:
121 if self._cache and self._cache[1] == iterrev:
122 text = self._cache[2]
122 text = self._cache[2]
123 break
123 break
124 chain.append(iterrev)
124 chain.append(iterrev)
125 iterrev = self.basemap[iterrev]
125 iterrev = self.basemap[iterrev]
126 if text is None:
126 if text is None:
127 text = revlog.revlog.revision(self, iterrev)
127 text = revlog.revlog.revision(self, iterrev)
128
128
129 while chain:
129 while chain:
130 delta = self._chunk(chain.pop())
130 delta = self._chunk(chain.pop())
131 text = mdiff.patches(text, [delta])
131 text = mdiff.patches(text, [delta])
132
132
133 self._checkhash(text, node, rev)
133 self._checkhash(text, node, rev)
134 self._cache = (node, rev, text)
134 self._cache = (node, rev, text)
135 return text
135 return text
136
136
137 def addrevision(self, text, transaction, link, p1=None, p2=None, d=None):
137 def addrevision(self, text, transaction, link, p1=None, p2=None, d=None):
138 raise NotImplementedError
138 raise NotImplementedError
139 def addgroup(self, revs, linkmapper, transaction):
139 def addgroup(self, revs, linkmapper, transaction):
140 raise NotImplementedError
140 raise NotImplementedError
141 def strip(self, rev, minlink):
141 def strip(self, rev, minlink):
142 raise NotImplementedError
142 raise NotImplementedError
143 def checksize(self):
143 def checksize(self):
144 raise NotImplementedError
144 raise NotImplementedError
145
145
146 class bundlechangelog(bundlerevlog, changelog.changelog):
146 class bundlechangelog(bundlerevlog, changelog.changelog):
147 def __init__(self, opener, bundle):
147 def __init__(self, opener, bundle):
148 changelog.changelog.__init__(self, opener)
148 changelog.changelog.__init__(self, opener)
149 linkmapper = lambda x: x
149 linkmapper = lambda x: x
150 bundlerevlog.__init__(self, opener, self.indexfile, bundle,
150 bundlerevlog.__init__(self, opener, self.indexfile, bundle,
151 linkmapper)
151 linkmapper)
152
152
153 class bundlemanifest(bundlerevlog, manifest.manifest):
153 class bundlemanifest(bundlerevlog, manifest.manifest):
154 def __init__(self, opener, bundle, linkmapper):
154 def __init__(self, opener, bundle, linkmapper):
155 manifest.manifest.__init__(self, opener)
155 manifest.manifest.__init__(self, opener)
156 bundlerevlog.__init__(self, opener, self.indexfile, bundle,
156 bundlerevlog.__init__(self, opener, self.indexfile, bundle,
157 linkmapper)
157 linkmapper)
158
158
159 class bundlefilelog(bundlerevlog, filelog.filelog):
159 class bundlefilelog(bundlerevlog, filelog.filelog):
160 def __init__(self, opener, path, bundle, linkmapper, repo):
160 def __init__(self, opener, path, bundle, linkmapper, repo):
161 filelog.filelog.__init__(self, opener, path)
161 filelog.filelog.__init__(self, opener, path)
162 bundlerevlog.__init__(self, opener, self.indexfile, bundle,
162 bundlerevlog.__init__(self, opener, self.indexfile, bundle,
163 linkmapper)
163 linkmapper)
164 self._repo = repo
164 self._repo = repo
165
165
166 def _file(self, f):
166 def _file(self, f):
167 self._repo.file(f)
167 self._repo.file(f)
168
168
169 class bundlepeer(localrepo.localpeer):
169 class bundlepeer(localrepo.localpeer):
170 def canpush(self):
170 def canpush(self):
171 return False
171 return False
172
172
173 class bundlerepository(localrepo.localrepository):
173 class bundlerepository(localrepo.localrepository):
174 def __init__(self, ui, path, bundlename):
174 def __init__(self, ui, path, bundlename):
175 self._tempparent = None
175 self._tempparent = None
176 try:
176 try:
177 localrepo.localrepository.__init__(self, ui, path)
177 localrepo.localrepository.__init__(self, ui, path)
178 except error.RepoError:
178 except error.RepoError:
179 self._tempparent = tempfile.mkdtemp()
179 self._tempparent = tempfile.mkdtemp()
180 localrepo.instance(ui, self._tempparent, 1)
180 localrepo.instance(ui, self._tempparent, 1)
181 localrepo.localrepository.__init__(self, ui, self._tempparent)
181 localrepo.localrepository.__init__(self, ui, self._tempparent)
182 self.ui.setconfig('phases', 'publish', False)
182 self.ui.setconfig('phases', 'publish', False)
183
183
184 if path:
184 if path:
185 self._url = 'bundle:' + util.expandpath(path) + '+' + bundlename
185 self._url = 'bundle:' + util.expandpath(path) + '+' + bundlename
186 else:
186 else:
187 self._url = 'bundle:' + bundlename
187 self._url = 'bundle:' + bundlename
188
188
189 self.tempfile = None
189 self.tempfile = None
190 f = util.posixfile(bundlename, "rb")
190 f = util.posixfile(bundlename, "rb")
191 self.bundle = changegroup.readbundle(f, bundlename)
191 self.bundle = changegroup.readbundle(f, bundlename)
192 if self.bundle.compressed():
192 if self.bundle.compressed():
193 fdtemp, temp = tempfile.mkstemp(prefix="hg-bundle-",
193 fdtemp, temp = tempfile.mkstemp(prefix="hg-bundle-",
194 suffix=".hg10un", dir=self.path)
194 suffix=".hg10un", dir=self.path)
195 self.tempfile = temp
195 self.tempfile = temp
196 fptemp = os.fdopen(fdtemp, 'wb')
196 fptemp = os.fdopen(fdtemp, 'wb')
197
197
198 try:
198 try:
199 fptemp.write("HG10UN")
199 fptemp.write("HG10UN")
200 while True:
200 while True:
201 chunk = self.bundle.read(2**18)
201 chunk = self.bundle.read(2**18)
202 if not chunk:
202 if not chunk:
203 break
203 break
204 fptemp.write(chunk)
204 fptemp.write(chunk)
205 finally:
205 finally:
206 fptemp.close()
206 fptemp.close()
207
207
208 f = util.posixfile(self.tempfile, "rb")
208 f = util.posixfile(self.tempfile, "rb")
209 self.bundle = changegroup.readbundle(f, bundlename)
209 self.bundle = changegroup.readbundle(f, bundlename)
210
210
211 # dict with the mapping 'filename' -> position in the bundle
211 # dict with the mapping 'filename' -> position in the bundle
212 self.bundlefilespos = {}
212 self.bundlefilespos = {}
213
213
214 @localrepo.unfilteredpropertycache
214 @localrepo.unfilteredpropertycache
215 def changelog(self):
215 def changelog(self):
216 # consume the header if it exists
216 # consume the header if it exists
217 self.bundle.changelogheader()
217 self.bundle.changelogheader()
218 c = bundlechangelog(self.sopener, self.bundle)
218 c = bundlechangelog(self.sopener, self.bundle)
219 self.manstart = self.bundle.tell()
219 self.manstart = self.bundle.tell()
220 return c
220 return c
221
221
222 @localrepo.unfilteredpropertycache
222 @localrepo.unfilteredpropertycache
223 def manifest(self):
223 def manifest(self):
224 self.bundle.seek(self.manstart)
224 self.bundle.seek(self.manstart)
225 # consume the header if it exists
225 # consume the header if it exists
226 self.bundle.manifestheader()
226 self.bundle.manifestheader()
227 m = bundlemanifest(self.sopener, self.bundle, self.changelog.rev)
227 m = bundlemanifest(self.sopener, self.bundle, self.changelog.rev)
228 self.filestart = self.bundle.tell()
228 self.filestart = self.bundle.tell()
229 return m
229 return m
230
230
231 @localrepo.unfilteredpropertycache
231 @localrepo.unfilteredpropertycache
232 def manstart(self):
232 def manstart(self):
233 self.changelog
233 self.changelog
234 return self.manstart
234 return self.manstart
235
235
236 @localrepo.unfilteredpropertycache
236 @localrepo.unfilteredpropertycache
237 def filestart(self):
237 def filestart(self):
238 self.manifest
238 self.manifest
239 return self.filestart
239 return self.filestart
240
240
241 def url(self):
241 def url(self):
242 return self._url
242 return self._url
243
243
244 def file(self, f):
244 def file(self, f):
245 if not self.bundlefilespos:
245 if not self.bundlefilespos:
246 self.bundle.seek(self.filestart)
246 self.bundle.seek(self.filestart)
247 while True:
247 while True:
248 chunkdata = self.bundle.filelogheader()
248 chunkdata = self.bundle.filelogheader()
249 if not chunkdata:
249 if not chunkdata:
250 break
250 break
251 fname = chunkdata['filename']
251 fname = chunkdata['filename']
252 self.bundlefilespos[fname] = self.bundle.tell()
252 self.bundlefilespos[fname] = self.bundle.tell()
253 while True:
253 while True:
254 c = self.bundle.deltachunk(None)
254 c = self.bundle.deltachunk(None)
255 if not c:
255 if not c:
256 break
256 break
257
257
258 if f[0] == '/':
259 f = f[1:]
260 if f in self.bundlefilespos:
258 if f in self.bundlefilespos:
261 self.bundle.seek(self.bundlefilespos[f])
259 self.bundle.seek(self.bundlefilespos[f])
262 return bundlefilelog(self.sopener, f, self.bundle,
260 return bundlefilelog(self.sopener, f, self.bundle,
263 self.changelog.rev, self)
261 self.changelog.rev, self)
264 else:
262 else:
265 return filelog.filelog(self.sopener, f)
263 return filelog.filelog(self.sopener, f)
266
264
267 def close(self):
265 def close(self):
268 """Close assigned bundle file immediately."""
266 """Close assigned bundle file immediately."""
269 self.bundle.close()
267 self.bundle.close()
270 if self.tempfile is not None:
268 if self.tempfile is not None:
271 os.unlink(self.tempfile)
269 os.unlink(self.tempfile)
272 if self._tempparent:
270 if self._tempparent:
273 shutil.rmtree(self._tempparent, True)
271 shutil.rmtree(self._tempparent, True)
274
272
275 def cancopy(self):
273 def cancopy(self):
276 return False
274 return False
277
275
278 def peer(self):
276 def peer(self):
279 return bundlepeer(self)
277 return bundlepeer(self)
280
278
281 def getcwd(self):
279 def getcwd(self):
282 return os.getcwd() # always outside the repo
280 return os.getcwd() # always outside the repo
283
281
284
282
285 def instance(ui, path, create):
283 def instance(ui, path, create):
286 if create:
284 if create:
287 raise util.Abort(_('cannot create new bundle repository'))
285 raise util.Abort(_('cannot create new bundle repository'))
288 parentpath = ui.config("bundle", "mainreporoot", "")
286 parentpath = ui.config("bundle", "mainreporoot", "")
289 if not parentpath:
287 if not parentpath:
290 # try to find the correct path to the working directory repo
288 # try to find the correct path to the working directory repo
291 parentpath = cmdutil.findrepo(os.getcwd())
289 parentpath = cmdutil.findrepo(os.getcwd())
292 if parentpath is None:
290 if parentpath is None:
293 parentpath = ''
291 parentpath = ''
294 if parentpath:
292 if parentpath:
295 # Try to make the full path relative so we get a nice, short URL.
293 # Try to make the full path relative so we get a nice, short URL.
296 # In particular, we don't want temp dir names in test outputs.
294 # In particular, we don't want temp dir names in test outputs.
297 cwd = os.getcwd()
295 cwd = os.getcwd()
298 if parentpath == cwd:
296 if parentpath == cwd:
299 parentpath = ''
297 parentpath = ''
300 else:
298 else:
301 cwd = os.path.join(cwd,'')
299 cwd = os.path.join(cwd,'')
302 if parentpath.startswith(cwd):
300 if parentpath.startswith(cwd):
303 parentpath = parentpath[len(cwd):]
301 parentpath = parentpath[len(cwd):]
304 u = util.url(path)
302 u = util.url(path)
305 path = u.localpath()
303 path = u.localpath()
306 if u.scheme == 'bundle':
304 if u.scheme == 'bundle':
307 s = path.split("+", 1)
305 s = path.split("+", 1)
308 if len(s) == 1:
306 if len(s) == 1:
309 repopath, bundlename = parentpath, s[0]
307 repopath, bundlename = parentpath, s[0]
310 else:
308 else:
311 repopath, bundlename = s
309 repopath, bundlename = s
312 else:
310 else:
313 repopath, bundlename = parentpath, path
311 repopath, bundlename = parentpath, path
314 return bundlerepository(ui, repopath, bundlename)
312 return bundlerepository(ui, repopath, bundlename)
315
313
316 def getremotechanges(ui, repo, other, onlyheads=None, bundlename=None,
314 def getremotechanges(ui, repo, other, onlyheads=None, bundlename=None,
317 force=False):
315 force=False):
318 '''obtains a bundle of changes incoming from other
316 '''obtains a bundle of changes incoming from other
319
317
320 "onlyheads" restricts the returned changes to those reachable from the
318 "onlyheads" restricts the returned changes to those reachable from the
321 specified heads.
319 specified heads.
322 "bundlename", if given, stores the bundle to this file path permanently;
320 "bundlename", if given, stores the bundle to this file path permanently;
323 otherwise it's stored to a temp file and gets deleted again when you call
321 otherwise it's stored to a temp file and gets deleted again when you call
324 the returned "cleanupfn".
322 the returned "cleanupfn".
325 "force" indicates whether to proceed on unrelated repos.
323 "force" indicates whether to proceed on unrelated repos.
326
324
327 Returns a tuple (local, csets, cleanupfn):
325 Returns a tuple (local, csets, cleanupfn):
328
326
329 "local" is a local repo from which to obtain the actual incoming
327 "local" is a local repo from which to obtain the actual incoming
330 changesets; it is a bundlerepo for the obtained bundle when the
328 changesets; it is a bundlerepo for the obtained bundle when the
331 original "other" is remote.
329 original "other" is remote.
332 "csets" lists the incoming changeset node ids.
330 "csets" lists the incoming changeset node ids.
333 "cleanupfn" must be called without arguments when you're done processing
331 "cleanupfn" must be called without arguments when you're done processing
334 the changes; it closes both the original "other" and the one returned
332 the changes; it closes both the original "other" and the one returned
335 here.
333 here.
336 '''
334 '''
337 tmp = discovery.findcommonincoming(repo, other, heads=onlyheads,
335 tmp = discovery.findcommonincoming(repo, other, heads=onlyheads,
338 force=force)
336 force=force)
339 common, incoming, rheads = tmp
337 common, incoming, rheads = tmp
340 if not incoming:
338 if not incoming:
341 try:
339 try:
342 if bundlename:
340 if bundlename:
343 os.unlink(bundlename)
341 os.unlink(bundlename)
344 except OSError:
342 except OSError:
345 pass
343 pass
346 return repo, [], other.close
344 return repo, [], other.close
347
345
348 bundle = None
346 bundle = None
349 bundlerepo = None
347 bundlerepo = None
350 localrepo = other.local()
348 localrepo = other.local()
351 if bundlename or not localrepo:
349 if bundlename or not localrepo:
352 # create a bundle (uncompressed if other repo is not local)
350 # create a bundle (uncompressed if other repo is not local)
353
351
354 if other.capable('getbundle'):
352 if other.capable('getbundle'):
355 cg = other.getbundle('incoming', common=common, heads=rheads)
353 cg = other.getbundle('incoming', common=common, heads=rheads)
356 elif onlyheads is None and not other.capable('changegroupsubset'):
354 elif onlyheads is None and not other.capable('changegroupsubset'):
357 # compat with older servers when pulling all remote heads
355 # compat with older servers when pulling all remote heads
358 cg = other.changegroup(incoming, "incoming")
356 cg = other.changegroup(incoming, "incoming")
359 rheads = None
357 rheads = None
360 else:
358 else:
361 cg = other.changegroupsubset(incoming, rheads, 'incoming')
359 cg = other.changegroupsubset(incoming, rheads, 'incoming')
362 bundletype = localrepo and "HG10BZ" or "HG10UN"
360 bundletype = localrepo and "HG10BZ" or "HG10UN"
363 fname = bundle = changegroup.writebundle(cg, bundlename, bundletype)
361 fname = bundle = changegroup.writebundle(cg, bundlename, bundletype)
364 # keep written bundle?
362 # keep written bundle?
365 if bundlename:
363 if bundlename:
366 bundle = None
364 bundle = None
367 if not localrepo:
365 if not localrepo:
368 # use the created uncompressed bundlerepo
366 # use the created uncompressed bundlerepo
369 localrepo = bundlerepo = bundlerepository(ui, repo.root, fname)
367 localrepo = bundlerepo = bundlerepository(ui, repo.root, fname)
370 # this repo contains local and other now, so filter out local again
368 # this repo contains local and other now, so filter out local again
371 common = repo.heads()
369 common = repo.heads()
372
370
373 csets = localrepo.changelog.findmissing(common, rheads)
371 csets = localrepo.changelog.findmissing(common, rheads)
374
372
375 def cleanup():
373 def cleanup():
376 if bundlerepo:
374 if bundlerepo:
377 bundlerepo.close()
375 bundlerepo.close()
378 if bundle:
376 if bundle:
379 os.unlink(bundle)
377 os.unlink(bundle)
380 other.close()
378 other.close()
381
379
382 return (localrepo, csets, cleanup)
380 return (localrepo, csets, cleanup)
General Comments 0
You need to be logged in to leave comments. Login now