Mercurial > public > mercurial-scm > hg
comparison mercurial/localrepo.py @ 21043:6c383c871fdb
localrepo: introduce "prepushoutgoinghooks" to extend outgoing check easily
This patch introduces "prepushoutgoinghooks" to extend outgoing check
before pushing changesets to remote easily.
This chooses the function returning "util.hooks" instead of the one to
be overridden.
The latter may cause problems silently, if one of overriders forgets
(or fails) to execute a kind of "super(xxx, self).overridden(...)". In
the other hand, the former can ensure that all registered functions
are invoked, unless one of them raises an exception.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Wed, 16 Apr 2014 00:37:24 +0900 |
parents | 298c9f346dde |
children | c15b66a6bbb4 |
comparison
equal
deleted
inserted
replaced
21042:32b3331f18eb | 21043:6c383c871fdb |
---|---|
1694 to be performed before pushing, or call it if they override push | 1694 to be performed before pushing, or call it if they override push |
1695 command. | 1695 command. |
1696 """ | 1696 """ |
1697 pass | 1697 pass |
1698 | 1698 |
1699 @unfilteredpropertycache | |
1700 def prepushoutgoinghooks(self): | |
1701 """Return util.hooks consists of "(repo, remote, outgoing)" | |
1702 functions, which are called before pushing changesets. | |
1703 """ | |
1704 return util.hooks() | |
1705 | |
1699 def push(self, remote, force=False, revs=None, newbranch=False): | 1706 def push(self, remote, force=False, revs=None, newbranch=False): |
1700 return exchange.push(self, remote, force, revs, newbranch) | 1707 return exchange.push(self, remote, force, revs, newbranch) |
1701 | 1708 |
1702 def stream_in(self, remote, requirements): | 1709 def stream_in(self, remote, requirements): |
1703 lock = self.lock() | 1710 lock = self.lock() |