Skip to content

Commit

Permalink
hgmo: attempt alternate monkeypatching of fastannotate (bug 1504794)
Browse files Browse the repository at this point in the history
I think this will be more resilient than the previous code...
  • Loading branch information
indygreg committed Nov 7, 2018
1 parent affc558 commit 46cdb8f
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions hgext/hgmo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -996,17 +996,29 @@ def extsetup(ui):
setattr(webcommands, 'repoinfo', repoinfowebcommand)
webcommands.__all__.append('repoinfo')

# fastannotate in Mercurial 4.8 has buggy hgweb support. Fix that.

def reposetup(ui, repo):
import hgext.fastannotate.support as fasupport

# fastannotate in Mercurial 4.8 has buggy hgweb support. We always remove
# its monkeypatch if present.
try:
extensions.unwrapfunction(webutil, 'annotate',
fasupport._hgwebannotate)
except ValueError:
pass

# And we install our own if fastannotate is enabled.
try:
fastannotate = extensions.find('fastannotate')
except KeyError:
fastannotate = None

if fastannotate:
import hgext.fastannotate.support as fasupport
if fastannotate and 'hgweb' in ui.configlist('fastannotate', 'modes'):
# Guard against recursive chaining, since we're in reposetup().
try:
extensions.unwrapfunction(webutil, 'annotate',
fasupport._hgwebannotate)
hgwebfastannotate)
except ValueError:
pass

Expand Down

0 comments on commit 46cdb8f

Please sign in to comment.