view tests/remotefilelog-getflogheads.py @ 46781:1099ca176ba1

mergestate: don't pop stateextras when there are no conflicts on filemerge Even if `filemerge.filemerge()` didn't result in conflicts, we should not remove stateextras for a file since we now use that for more things than just merge time information. We use stateextras to store information which is required to be used by commit. I tracked this down while finding why a patch of mine which adds more commit related information does not work as expected and looses the extras in mergestate. Differential Revision: https://phab.mercurial-scm.org/D10148
author Pulkit Goyal <7895pulkit@gmail.com>
date Wed, 10 Mar 2021 13:08:41 +0530
parents a4c19a162615
children 3000f2100711
line wrap: on
line source

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'))