debuginstall: use codecs.lookup() to detect invalid encoding
encoding.fromlocal() never tries to decode an ascii string since
853574db5b12,
and there's no universal non-ascii string which can be decoded as any valid
character set.
extensions: fix wrapcommand/function of class instance
5361771f9714 changed _updatewrapper() to copy the __name__ attribute, but
not all callable objects has __name__.
Spotted by loading mq with extdiff.
changegroup: avoid creating empty changegroup part
Previously this check happened in the changegroup code itself. Since its
refactor, this logic needs to move out to callers that care about it, such as
this one. Otherwise we get empty bundle devel-warnings in certain extensions.
Differential Revision: https://phab.mercurial-scm.org/D690