tests/remotefilelog-getflogheads.py
author Pierre-Yves David <pierre-yves.david@octobus.net>
Wed, 24 Mar 2021 00:04:58 +0100
changeset 46828 395cf404e76a
parent 46663 a4c19a162615
child 46955 3000f2100711
permissions -rw-r--r--
path: error out if the `path://` reference point to an unknown path Differential Revision: https://phab.mercurial-scm.org/D10265

from __future__ import absolute_import

from mercurial.i18n import _
from mercurial import (
    hg,
    registrar,
)

cmdtable = {}
command = registrar.command(cmdtable)


@command(b'getflogheads', [], b'path')
def getflogheads(ui, repo, path):
    """
    Extension printing a remotefilelog's heads

    Used for testing purpose
    """

    dest = repo.ui.expandpath(b'default')
    peer = hg.peer(repo, {}, dest)

    try:
        flogheads = peer.x_rfl_getflogheads(path)
    finally:
        peer.close()

    if flogheads:
        for head in flogheads:
            ui.write(head + b'\n')
    else:
        ui.write(_(b'EMPTY\n'))