def openrevlog(repo, cmd, file_, opts):
    """opens the changelog, manifest, a filelog or a given revlog"""
    cl = opts['changelog']
    mf = opts['manifest']
    msg = None
    if cl and mf:
        msg = _('cannot specify --changelog and --manifest at the same time')
    elif cl or mf:
        if file_:
            msg = _('cannot specify filename with --changelog or --manifest')
        elif not repo:
            msg = _('cannot specify --changelog or --manifest '
                    'without a repository')
    if msg:
        raise util.Abort(msg)

    r = None
    if repo:
        if cl:
            r = repo.changelog
        elif mf:
            r = repo.manifest
        elif file_:
            filelog = repo.file(file_)
            if len(filelog):
                r = filelog
    if not r:
        if not file_:
            raise error.CommandError(cmd, _('invalid arguments'))
        if not os.path.isfile(file_):
            raise util.Abort(_("revlog '%s' not found") % file_)
        r = revlog.revlog(scmutil.opener(os.getcwd(), audit=False),
                          file_[:-2] + ".i")
    return r
Exemple #2
0
def openrevlog(repo, cmd, file_, opts):
    """opens the changelog, manifest, a filelog or a given revlog"""
    cl = opts['changelog']
    mf = opts['manifest']
    msg = None
    if cl and mf:
        msg = _('cannot specify --changelog and --manifest at the same time')
    elif cl or mf:
        if file_:
            msg = _('cannot specify filename with --changelog or --manifest')
        elif not repo:
            msg = _('cannot specify --changelog or --manifest '
                    'without a repository')
    if msg:
        raise util.Abort(msg)

    r = None
    if repo:
        if cl:
            r = repo.changelog
        elif mf:
            r = repo.manifest
        elif file_:
            filelog = repo.file(file_)
            if len(filelog):
                r = filelog
    if not r:
        if not file_:
            raise error.CommandError(cmd, _('invalid arguments'))
        if not os.path.isfile(file_):
            raise util.Abort(_("revlog '%s' not found") % file_)
        r = revlog.revlog(scmutil.opener(os.getcwd(), audit=False),
                          file_[:-2] + ".i")
    return r
Exemple #3
0
 def readpending(self, file):
     if not self.opener.exists(file):
         return # no pending data for changelog
     r = revlog.revlog(self.opener, file)
     self.index = r.index
     self.nodemap = r.nodemap
     self._nodecache = r._nodecache
     self._chunkcache = r._chunkcache
Exemple #4
0
    def readpending(self, file):
        """read index data from a "pending" file

        During a transaction, the actual changeset data is already stored in the
        main file, but not yet finalized in the on-disk index. Instead, a
        "pending" index is written by the transaction logic. If this function
        is running, we are likely in a subprocess invoked in a hook. The
        subprocess is informed that it is within a transaction and needs to
        access its content.

        This function will read all the index data out of the pending file and
        extend the main index."""

        if not self.opener.exists(file):
            return # no pending data for changelog
        r = revlog.revlog(self.opener, file)
        self.index = r.index
        self.nodemap = r.nodemap
        self._nodecache = r._nodecache
        self._chunkcache = r._chunkcache
Exemple #5
0
    def readpending(self, file):
        """read index data from a "pending" file

        During a transaction, the actual changeset data is already stored in the
        main file, but not yet finalized in the on-disk index. Instead, a
        "pending" index is written by the transaction logic. If this function
        is running, we are likely in a subprocess invoked in a hook. The
        subprocess is informed that it is within a transaction and needs to
        access its content.

        This function will read all the index data out of the pending file and
        extend the main index."""

        if not self.opener.exists(file):
            return  # no pending data for changelog
        r = revlog.revlog(self.opener, file)
        self.index = r.index
        self.nodemap = r.nodemap
        self._nodecache = r._nodecache
        self._chunkcache = r._chunkcache
 def readpending(self, file):
     r = revlog.revlog(self.opener, file)
     self.index = r.index
     self.nodemap = r.nodemap
     self._chunkcache = r._chunkcache
 def readpending(self, file):
     r = revlog.revlog(self.opener, file)
     self.index = r.index
     self.nodemap = r.nodemap
     self._chunkcache = r._chunkcache