sapling/edenscm/hgext/debugcommitmessage.py
Jun Wu 9e0a7c41a4 subrepo: remove subrepo support
Summary:
Subrepo is another unloved features that we don't want to support.

Aggressively remove it everywhere, instead of just turning off configs.

I didn't spend much time to split this commit so it's smaller and more friendly
to review. But it seems tests are passing.

Reviewed By: sfilipco

Differential Revision: D14220099

fbshipit-source-id: adc512a047d99cd4bafd0362e3e9b24e71defe13
2019-03-11 10:43:55 -07:00

46 lines
1.2 KiB
Python

# Copyright 2016 Facebook, Inc.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
from edenscm.mercurial import cmdutil, context, error, registrar
from edenscm.mercurial.i18n import _
cmdtable = {}
command = registrar.command(cmdtable)
@command("debugcommitmessage", [], _("FORM"))
def debugcommitmessage(ui, repo, *args):
form = None
if len(args) > 1:
raise error.Abort(_("provide at most one form"))
elif len(args) > 0:
form = args[0]
status = repo.status()
text = ""
user = None
date = None
extra = None
ctx = context.workingcommitctx(repo, status, text, user, date, extra)
editform = form or "commit.normal.normal"
extramsg = _("Leave message empty to abort commit.")
forms = [e for e in editform.split(".") if e]
forms.insert(0, "changeset")
while forms:
ref = ".".join(forms)
tmpl = repo.ui.config("committemplate", ref)
if tmpl:
committext = cmdutil.buildcommittemplate(repo, ctx, extramsg, ref)
break
forms.pop()
else:
committext = cmdutil.buildcommittext(repo, ctx, extramsg)
ui.status(committext)