Beispiel #1
0
 def _clear(self):
     self._filecounter = 0
     # A mapping of svn paths to CopiedFile entries
     self._svncopies = {}
     # A mapping of batons to (path, data, isexec, islink, copypath) tuples
     # data is a SimpleStringIO if the file was edited, a string
     # otherwise.
     self._openfiles = {}
     # A mapping of file paths to batons
     self._openpaths = {}
     self._deleted = set()
     self._getctx = hgutil.lrucachefunc(self.repo.changectx)
     # A map from directory baton to path
     self._opendirs = {}
     self._missing = set()
Beispiel #2
0
# extracted from mercurial.context.basefilectx.annotate. slightly modified
# so it takes an extra "blocks" parameter calculated elsewhere, instead of
# calculating diff here.
def _pair(parent, child, blocks):
    for (a1, a2, b1, b2), t in blocks:
        # Changed blocks ('!') or blocks made only of blank lines ('~')
        # belong to the child.
        if t == '=':
            child[0][b1:b2] = parent[0][a1:a2]
    return child


# like scmutil.revsingle, but with lru cache, so their states (like manifests)
# could be reused
_revsingle = util.lrucachefunc(scmutil.revsingle)


def resolvefctx(repo, rev, path, resolverev=False, adjustctx=None):
    """(repo, str, str) -> fctx

    get the filectx object from repo, rev, path, in an efficient way.

    if resolverev is True, "rev" is a revision specified by the revset
    language, otherwise "rev" is a nodeid, or a revision number that can
    be consumed by repo.__getitem__.

    if adjustctx is not None, the returned fctx will point to a changeset
    that introduces the change (last modified the file). if adjustctx
    is 'linkrev', trust the linkrev and do not adjust it. this is noticeably
    faster for big repos but is incorrect for some cases.