sapling/hgext3rd/commitextras.py
Jun Wu f08e17d3ed testedwith: change testedwith to "ships-with-fb-hgext"
Summary:
Using `testedwith = 'internal'` is not a good habit [1]. Having it
auto-updated in batch would also introduce a lot of churn. This diff makes
them "ships-with-fb-hgext". If we do want to fill the ideal "testedwith"
information, we could put it in a centric place, like a "fbtestedwith"
extension rewriting those "ships-with-fb-hgext" on the fly.

Maybe having in-repo tags for tested Mercurial releases is also a good idea.

[1]: www.mercurial-scm.org/repo/hg/rev/2af1014c2534

Test Plan: `arc lint`

Reviewers: #sourcecontrol, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D4244689

Signature: t1:4244689:1480440027:3dc18d017b48beba1176fbfd120351889259eb4b
2016-11-29 13:24:07 +00:00

42 lines
1.2 KiB
Python

# commitextras.py
#
# Copyright 2013 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 mercurial.i18n import _
from mercurial import (
cmdutil,
commands,
extensions,
)
cmdtable = {}
command = cmdutil.command(cmdtable)
testedwith = 'ships-with-fb-hgext'
def extsetup(ui):
entry = extensions.wrapcommand(commands.table, 'commit', _commit)
options = entry[1]
options.append(('', 'extra', [],
_('set a changeset\'s extra values'), _("KEY=VALUE")))
def _commit(orig, ui, repo, *pats, **opts):
origcommit = repo.commit
try:
def _wrappedcommit(*innerpats, **inneropts):
extras = opts.get('extra')
if extras:
for raw in extras:
k, v = raw.split('=', 1)
inneropts['extra'][k] = v
return origcommit(*innerpats, **inneropts)
# This __dict__ logic is needed because the normal
# extension.wrapfunction doesn't seem to work.
repo.__dict__['commit'] = _wrappedcommit
return orig(ui, repo, *pats, **opts)
finally:
del repo.__dict__['commit']