def __init__(self, ui, path): self._url = path self.ui = ui self.root = path u = util.url(path.rstrip('/') + "/.hg") self.path, authinfo = u.authinfo() opener = build_opener(ui, authinfo) self.opener = opener(self.path) self.vfs = self.opener self._phasedefaults = [] self.names = namespaces.namespaces() try: requirements = scmutil.readrequires(self.vfs, self.supported) except IOError as inst: if inst.errno != errno.ENOENT: raise requirements = set() # check if it is a non-empty old-style repository try: fp = self.vfs("00changelog.i") fp.read(1) fp.close() except IOError as inst: if inst.errno != errno.ENOENT: raise # we do not care about empty old-style repositories here msg = _("'%s' does not appear to be an hg repository") % path raise error.RepoError(msg) # setup store self.store = store.store(requirements, self.path, opener) self.spath = self.store.path self.svfs = self.store.opener self.sjoin = self.store.join self._filecache = {} self.requirements = requirements self.manifest = manifest.manifest(self.svfs) self.changelog = changelog.changelog(self.svfs) self._tags = None self.nodetagscache = None self._branchcaches = {} self._revbranchcache = None self.encodepats = None self.decodepats = None self._transref = None
class statichttprepository(localrepo.localrepository): def __init__(self, ui, path): self._url = path self.ui = ui self.path = path.rstrip('/') + "/.hg" self.opener = opener(self.path) # find requirements try: requirements = self.opener("requires").read().splitlines() except IOError, inst: if inst.errno == errno.ENOENT: msg = _("'%s' does not appear to be an hg repository") % path raise repo.RepoError(msg) else: requirements = [] # check them for r in requirements: if r not in self.supported: raise repo.RepoError(_("requirement '%s' not supported") % r) # setup store if "store" in requirements: self.encodefn = util.encodefilename self.decodefn = util.decodefilename self.spath = self.path + "/store" else: self.encodefn = lambda x: x self.decodefn = lambda x: x self.spath = self.path self.sopener = util.encodedopener(opener(self.spath), self.encodefn) self.manifest = manifest.manifest(self.sopener) self.changelog = changelog.changelog(self.sopener) self.tagscache = None self.nodetagscache = None self.encodepats = None self.decodepats = None
# check them for r in requirements: if r not in self.supported: raise error.RepoError(_("requirement '%s' not supported") % r) # setup store def pjoin(a, b): return a + '/' + b self.store = store.store(requirements, self.path, opener, pjoin) self.spath = self.store.path self.sopener = self.store.opener self.sjoin = self.store.join self.manifest = manifest.manifest(self.sopener) self.changelog = changelog.changelog(self.sopener) self.tagscache = None self.nodetagscache = None self.encodepats = None self.decodepats = None def url(self): return self._url def local(self): return False def lock(self, wait=True): raise util.Abort(_('cannot lock static-http repository')) def instance(ui, path, create):
raise # we do not care about empty old-style repositories here msg = _("'%s' does not appear to be an hg repository") % path raise error.RepoError(msg) # setup store self.store = store.store(requirements, self.path, opener) self.spath = self.store.path self.sopener = self.store.opener self.svfs = self.sopener self.sjoin = self.store.join self._filecache = {} self.requirements = requirements self.manifest = manifest.manifest(self.sopener) self.changelog = changelog.changelog(self.sopener) self._tags = None self.nodetagscache = None self._branchcaches = {} self.encodepats = None self.decodepats = None def _restrictcapabilities(self, caps): return caps.difference(["pushkey"]) def url(self): return self._url def local(self): return False
def __init__(self, opener, opener2): changelog.changelog.__init__(self, opener) linkmapper = None changelog2 = changelog.changelog(opener2) unionrevlog.__init__(self, opener, self.indexfile, changelog2, linkmapper)
raise # we do not care about empty old-style repositories here msg = _("'%s' does not appear to be an hg repository") % path raise error.RepoError(msg) # setup store self.store = store.store(requirements, self.path, opener) self.spath = self.store.path self.svfs = self.store.opener self.sopener = self.svfs self.sjoin = self.store.join self._filecache = {} self.requirements = requirements self.manifest = manifest.manifest(self.svfs) self.changelog = changelog.changelog(self.svfs) self._tags = None self.nodetagscache = None self._branchcaches = {} self.encodepats = None self.decodepats = None def _restrictcapabilities(self, caps): caps = super(statichttprepository, self)._restrictcapabilities(caps) return caps.difference(["pushkey"]) def url(self): return self._url def local(self): return False
raise # we do not care about empty old-style repositories here msg = _("'%s' does not appear to be an hg repository") % path raise error.RepoError(msg) # setup store self.store = store.store(requirements, self.path, opener) self.spath = self.store.path self.svfs = self.store.opener self.sopener = self.svfs self.sjoin = self.store.join self._filecache = {} self.requirements = requirements self.manifest = manifest.manifest(self.svfs) self.changelog = changelog.changelog(self.svfs) self._tags = None self.nodetagscache = None self._branchcaches = {} self._revbranchcache = None self.encodepats = None self.decodepats = None self._transref = None def _restrictcapabilities(self, caps): caps = super(statichttprepository, self)._restrictcapabilities(caps) return caps.difference(["pushkey"]) def url(self): return self._url
def main(argv): global infmt, outfmt, pkgnm, emails innm, outnm = parse_args(argv) if not infmt: if innm[-8:] == ".changes": infmt = "rpm" elif innm[-10:] == ".changelog": infmt = "deb" else: print_("ERROR: Can not determine input format", file=sys.stderr) sys.exit(2) if not outfmt: if outnm[-8:] == ".changes": outfmt = "rpm" elif outnm[-10:] == ".changelog": outfmt = "deb" else: print_("ERROR: Can not determine output format", file=sys.stderr) sys.exit(2) if not pkgnm: idx = innm.rfind('.') if idx > 0: pkgnm = os.path.basename(innm[0:idx]) else: idx = outnm.rfind('.') if idx > 0: pkgnm = os.path.basename(outnm[0:idx]) elif infmt == 'rpm': print_("WARN: Can not determine package name format", file=sys.stderr) if innm == '-': infd = sys.stdin else: infd = open(innm, 'r') if emaildb: if emails: emails = emailsdb(guess = guessmail).addrappend(EMAILDB, emails) else: emails = emailsdb(guess = guessmail) chglog = changelog.changelog(pkgnm = pkgnm, distover = dist, initver = initver, emaildb = emails) if infmt == 'rpm': chglog.rpmparse(infd, joinln, tolerant, maxent) elif infmt == 'deb': chglog.debparse(infd, joinln, tolerant, maxent) else: print_("ERROR: Input format %s unknown" % infmt) sys.exit(3) infd.close() if outnm == '-': outfd = sys.stdout else: outfd = open(outnm, 'w') if outfmt == 'rpm': print_(chglog.rpmout(), file=outfd, end='') elif outfmt == 'deb': print_(chglog.debout(), file=outfd, end='') else: print_("ERROR: Output format %s unknown" % outfmt) sys.exit(4) outfd.close() return 0