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