comparison mercurial/bundlerepo.py @ 2673:109a22f5434a

hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks all repository classes now have url() method that returns url of repo.
author Vadim Gelfer <vadim.gelfer@gmail.com>
date Tue, 25 Jul 2006 13:50:32 -0700
parents f116ddea537f
children 386f04d6ecb3
comparison
equal deleted inserted replaced
2671:82864a2eb709 2673:109a22f5434a
157 bundlefile, linkmapper) 157 bundlefile, linkmapper)
158 158
159 class bundlerepository(localrepo.localrepository): 159 class bundlerepository(localrepo.localrepository):
160 def __init__(self, ui, path, bundlename): 160 def __init__(self, ui, path, bundlename):
161 localrepo.localrepository.__init__(self, ui, path) 161 localrepo.localrepository.__init__(self, ui, path)
162
163 self._url = 'bundle:' + bundlename
164 if path: self._url += '+' + path
165
162 self.tempfile = None 166 self.tempfile = None
163 self.bundlefile = open(bundlename, "rb") 167 self.bundlefile = open(bundlename, "rb")
164 header = self.bundlefile.read(6) 168 header = self.bundlefile.read(6)
165 if not header.startswith("HG"): 169 if not header.startswith("HG"):
166 raise util.Abort(_("%s: not a Mercurial bundle file") % bundlename) 170 raise util.Abort(_("%s: not a Mercurial bundle file") % bundlename)
206 break 210 break
207 self.bundlefilespos[f] = self.bundlefile.tell() 211 self.bundlefilespos[f] = self.bundlefile.tell()
208 for c in changegroup.chunkiter(self.bundlefile): 212 for c in changegroup.chunkiter(self.bundlefile):
209 pass 213 pass
210 214
215 def url(self):
216 return self._url
217
211 def dev(self): 218 def dev(self):
212 return -1 219 return -1
213 220
214 def file(self, f): 221 def file(self, f):
215 if f[0] == '/': 222 if f[0] == '/':