tests/fakemergerecord.py
author Yuya Nishihara <yuya@tcha.org>
Sat, 01 Oct 2016 20:11:48 +0900
changeset 30043 49d5434d68fb
parent 29754 b303b3817d0e
child 32337 46ba2cdda476
permissions -rw-r--r--
revset: extract function that creates range set from computed revisions So we can pass m=0 to _makerangeset() even if the revision 0 is hidden. Hidden revisions are filtered by spanset.

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

from __future__ import absolute_import

from mercurial import (
    cmdutil,
    merge,
)

cmdtable = {}
command = cmdutil.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)