tests/fakemergerecord.py
author Matt Harbison <matt_harbison@yahoo.com>
Wed, 17 Jan 2018 21:44:32 -0500
changeset 35695 dd672e3d059f
parent 32376 46ba2cdda476
child 36211 8173eeb69fb3
permissions -rw-r--r--
lfs: raise an error if the server sends an unsolicited oid This shouldn't happen. But we shouldn't ignore it if it does, because something else is likely to go wrong.

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