view tests/commitextra.py @ 1017:fd9ff03e200e

Added tag 0.8.6 for changeset 1bd9d9a0201c
author Kevin Bullock <kbullock@ringworld.org>
date Tue, 18 Apr 2017 23:42:29 -0500
parents eb9ebc7ed061
children f2118a7dd764
line wrap: on
line source

'''test helper extension to create commits with multiple extra fields'''

from mercurial import cmdutil, commands, scmutil

cmdtable = {}
command = cmdutil.command(cmdtable)
testedwith = 'internal'

@command('commitextra',
         [('', 'field', [],
           'extra data to store', 'FIELD=VALUE'),
         ] + commands.commitopts + commands.commitopts2,
         'commitextra')
def commitextra(ui, repo, *pats, **opts):
    '''make a commit with extra fields'''
    fields = opts.get('field')
    extras = {}
    for field in fields:
        k, v = field.split('=', 1)
        extras[k] = v
    message = cmdutil.logmessage(ui, opts)
    repo.commit(message, opts.get('user'), opts.get('date'),
                match=scmutil.match(repo[None], pats, opts), extra=extras)
    return 0