tests/fakemergerecord.py
author Matt Harbison <matt_harbison@yahoo.com>
Sun, 14 Jan 2018 15:56:22 -0500
changeset 35658 a1222a8cc93b
parent 32337 46ba2cdda476
child 36173 8173eeb69fb3
permissions -rw-r--r--
lfs: add the '{oid}' template keyword to '{lfs_files}' The 'sha256:' prefix is skipped because this seems like the most convenient way to consume it. Maybe we should also add a '{oid_type}' keyword? Then again, that can be added in the future if a different algorithm is supported.

# Extension to write out fake unsupported records into the merge state
#
#

from __future__ import absolute_import

from mercurial import (
    merge,
    registrar,
)

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

@command('fakemergerecord',
         [('X', 'mandatory', None, 'add a fake mandatory record'),
          ('x', 'advisory', None, 'add a fake advisory record')], '')
def fakemergerecord(ui, repo, *pats, **opts):
    with repo.wlock():
        ms = merge.mergestate.read(repo)
        records = ms._makerecords()
        if opts.get('mandatory'):
            records.append(('X', 'mandatory record'))
        if opts.get('advisory'):
            records.append(('x', 'advisory record'))
        ms._writerecords(records)