Mercurial > public > mercurial-scm > hg-stable
diff mercurial/localrepo.py @ 13327:dc11e30b48a3
mq: factor out push conditions checks
Some extensions (e.g. hgsubversion) completely override push command. Because
extensions load order is unspecified, if hgsubversion loads before mq, mq
checks about not pushing applied patches will be bypassed. Short of finding a
way to fix load order, extracting the checking logic will allow
hgsubversion-like extensions to run the check themselves.
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Mon, 31 Jan 2011 22:16:33 +0100 |
parents | 5ccdca7df211 |
children | 4e33ef68b1f8 |
line wrap: on
line diff
--- a/mercurial/localrepo.py Thu Jan 27 15:51:26 2011 -0600 +++ b/mercurial/localrepo.py Mon Jan 31 22:16:33 2011 +0100 @@ -1305,6 +1305,13 @@ finally: lock.release() + def checkpush(self, force, revs): + """Extensions can override this function if additional checks have + to be performed before pushing, or call it if they override push + command. + """ + pass + def push(self, remote, force=False, revs=None, newbranch=False): '''Push outgoing changesets (limited by revs) from the current repository to remote. Return an integer: @@ -1321,6 +1328,7 @@ # unbundle assumes local user cannot lock remote repo (new ssh # servers, http servers). + self.checkpush(force, revs) lock = None unbundle = remote.capable('unbundle') if not unbundle: