tests/fakemergerecord.py
changeset 27027 a01ecbcfaf84
child 29766 b303b3817d0e
equal deleted inserted replaced
27026:c93b44b79359 27027:a01ecbcfaf84
       
     1 # Extension to write out fake unsupported records into the merge state
       
     2 #
       
     3 #
       
     4 
       
     5 from __future__ import absolute_import
       
     6 
       
     7 from mercurial import (
       
     8     cmdutil,
       
     9     merge,
       
    10 )
       
    11 
       
    12 cmdtable = {}
       
    13 command = cmdutil.command(cmdtable)
       
    14 
       
    15 @command('fakemergerecord',
       
    16          [('X', 'mandatory', None, 'add a fake mandatory record'),
       
    17           ('x', 'advisory', None, 'add a fake advisory record')], '')
       
    18 def fakemergerecord(ui, repo, *pats, **opts):
       
    19     ms = merge.mergestate.read(repo)
       
    20     records = ms._makerecords()
       
    21     if opts.get('mandatory'):
       
    22         records.append(('X', 'mandatory record'))
       
    23     if opts.get('advisory'):
       
    24         records.append(('x', 'advisory record'))
       
    25     ms._writerecords(records)