Mercurial > hg-git
view tests/commitextra.py @ 1102:93cb29247d61
exchange: check for remote refs to determine if we're cloning
The exchange.pull wrapper function was checking whether any paths were
configured yet as a proxy to determine whether we're doing the initial
clone or a subsequent pull. Core hg @ bdae51a83dfb (released in 4.5) now
sets the 'default' path on the ui object before exchange.pull is called,
but we can check a bit more directly by checking if we have any remote
refs yet. This is the same as a check we do in GitHandler.fetch_pack().
author | Kevin Bullock <kbullock@ringworld.org> |
---|---|
date | Sat, 03 Feb 2018 14:54:35 -0600 |
parents | f2118a7dd764 |
children |
line wrap: on
line source
'''test helper extension to create commits with multiple extra fields''' from mercurial import cmdutil, commands, scmutil cmdtable = {} try: from mercurial import registrar command = registrar.command(cmdtable) except (ImportError, AttributeError): 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