equal
deleted
inserted
replaced
316 |
316 |
317 return file(f, mode) |
317 return file(f, mode) |
318 |
318 |
319 return o |
319 return o |
320 |
320 |
|
321 class RepoError(Exception): pass |
|
322 |
321 class localrepository: |
323 class localrepository: |
322 def __init__(self, ui, path=None, create=0): |
324 def __init__(self, ui, path=None, create=0): |
323 self.remote = 0 |
325 self.remote = 0 |
324 if path and path[:7] == "http://": |
326 if path and path[:7] == "http://": |
325 self.remote = 1 |
327 self.remote = 1 |
328 if not path: |
330 if not path: |
329 p = os.getcwd() |
331 p = os.getcwd() |
330 while not os.path.isdir(os.path.join(p, ".hg")): |
332 while not os.path.isdir(os.path.join(p, ".hg")): |
331 oldp = p |
333 oldp = p |
332 p = os.path.dirname(p) |
334 p = os.path.dirname(p) |
333 if p == oldp: raise "No repo found" |
335 if p == oldp: raise RepoError("no repo found") |
334 path = p |
336 path = p |
335 self.path = os.path.join(path, ".hg") |
337 self.path = os.path.join(path, ".hg") |
336 |
338 |
337 if not create and not os.path.isdir(self.path): |
339 if not create and not os.path.isdir(self.path): |
338 raise "repository %s not found" % self.path |
340 raise RepoError("repository %s not found" % self.path) |
339 |
341 |
340 self.root = path |
342 self.root = path |
341 self.ui = ui |
343 self.ui = ui |
342 |
344 |
343 if create: |
345 if create: |
909 break |
911 break |
910 p, f = i, f * 2 |
912 p, f = i, f * 2 |
911 |
913 |
912 for f in fetch: |
914 for f in fetch: |
913 if f in m: |
915 if f in m: |
914 raise "already have", short(f[:4]) |
916 raise RepoError("already have changeset " + short(f[:4])) |
915 |
917 |
916 self.ui.note("adding new changesets starting at " + |
918 self.ui.note("adding new changesets starting at " + |
917 " ".join([short(f) for f in fetch]) + "\n") |
919 " ".join([short(f) for f in fetch]) + "\n") |
918 |
920 |
919 self.ui.debug("%d total queries\n" % reqcnt) |
921 self.ui.debug("%d total queries\n" % reqcnt) |