diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -103,6 +103,9 @@ def push(repo, remote, force=False, revs try: _pushdiscovery(pushop) if _pushcheckoutgoing(pushop): + pushop.repo.prepushoutgoinghooks(pushop.repo, + pushop.remote, + pushop.outgoing) _pushchangeset(pushop) _pushcomputecommonheads(pushop) _pushsyncphase(pushop) diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -1696,6 +1696,13 @@ class localrepository(object): """ pass + @unfilteredpropertycache + def prepushoutgoinghooks(self): + """Return util.hooks consists of "(repo, remote, outgoing)" + functions, which are called before pushing changesets. + """ + return util.hooks() + def push(self, remote, force=False, revs=None, newbranch=False): return exchange.push(self, remote, force, revs, newbranch)