2018-05-30 12:16:33 +03:00
|
|
|
"""test helper extension to create commits with multiple extra fields"""
|
2014-08-31 16:13:39 +04:00
|
|
|
|
2019-01-30 03:25:33 +03:00
|
|
|
from edenscm.mercurial import cmdutil, commands, scmutil
|
2014-08-31 16:13:39 +04:00
|
|
|
|
2018-07-06 03:45:27 +03:00
|
|
|
|
2014-08-31 16:13:39 +04:00
|
|
|
cmdtable = {}
|
2017-05-23 01:45:54 +03:00
|
|
|
try:
|
2019-01-30 03:25:33 +03:00
|
|
|
from edenscm.mercurial import registrar
|
2018-05-30 12:16:33 +03:00
|
|
|
|
2017-05-23 01:45:54 +03:00
|
|
|
command = registrar.command(cmdtable)
|
|
|
|
except (ImportError, AttributeError):
|
|
|
|
command = cmdutil.command(cmdtable)
|
2018-05-30 12:16:33 +03:00
|
|
|
testedwith = "internal"
|
|
|
|
|
2014-08-31 16:13:39 +04:00
|
|
|
|
2018-05-30 12:16:33 +03:00
|
|
|
@command(
|
|
|
|
"commitextra",
|
|
|
|
[("", "field", [], "extra data to store", "FIELD=VALUE")]
|
|
|
|
+ commands.commitopts
|
|
|
|
+ commands.commitopts2,
|
|
|
|
"commitextra",
|
|
|
|
)
|
2014-08-31 16:13:39 +04:00
|
|
|
def commitextra(ui, repo, *pats, **opts):
|
2018-05-30 12:16:33 +03:00
|
|
|
"""make a commit with extra fields"""
|
|
|
|
fields = opts.get("field")
|
2014-08-31 16:13:39 +04:00
|
|
|
extras = {}
|
|
|
|
for field in fields:
|
2018-05-30 12:16:33 +03:00
|
|
|
k, v = field.split("=", 1)
|
2014-08-31 16:13:39 +04:00
|
|
|
extras[k] = v
|
2019-09-05 02:58:40 +03:00
|
|
|
message = cmdutil.logmessage(repo, opts)
|
2018-05-30 12:16:33 +03:00
|
|
|
repo.commit(
|
|
|
|
message,
|
|
|
|
opts.get("user"),
|
|
|
|
opts.get("date"),
|
|
|
|
match=scmutil.match(repo[None], pats, opts),
|
|
|
|
extra=extras,
|
|
|
|
)
|
2014-08-31 16:13:39 +04:00
|
|
|
return 0
|