Mercurial > public > mercurial-scm > hg-stable
comparison 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 |
comparison
equal
deleted
inserted
replaced
13326:535a891284da | 13327:dc11e30b48a3 |
---|---|
1303 cg = remote.changegroupsubset(fetch, heads, 'pull') | 1303 cg = remote.changegroupsubset(fetch, heads, 'pull') |
1304 return self.addchangegroup(cg, 'pull', remote.url(), lock=lock) | 1304 return self.addchangegroup(cg, 'pull', remote.url(), lock=lock) |
1305 finally: | 1305 finally: |
1306 lock.release() | 1306 lock.release() |
1307 | 1307 |
1308 def checkpush(self, force, revs): | |
1309 """Extensions can override this function if additional checks have | |
1310 to be performed before pushing, or call it if they override push | |
1311 command. | |
1312 """ | |
1313 pass | |
1314 | |
1308 def push(self, remote, force=False, revs=None, newbranch=False): | 1315 def push(self, remote, force=False, revs=None, newbranch=False): |
1309 '''Push outgoing changesets (limited by revs) from the current | 1316 '''Push outgoing changesets (limited by revs) from the current |
1310 repository to remote. Return an integer: | 1317 repository to remote. Return an integer: |
1311 - 0 means HTTP error *or* nothing to push | 1318 - 0 means HTTP error *or* nothing to push |
1312 - 1 means we pushed and remote head count is unchanged *or* | 1319 - 1 means we pushed and remote head count is unchanged *or* |
1319 # repo (local filesystem, old ssh servers). | 1326 # repo (local filesystem, old ssh servers). |
1320 # | 1327 # |
1321 # unbundle assumes local user cannot lock remote repo (new ssh | 1328 # unbundle assumes local user cannot lock remote repo (new ssh |
1322 # servers, http servers). | 1329 # servers, http servers). |
1323 | 1330 |
1331 self.checkpush(force, revs) | |
1324 lock = None | 1332 lock = None |
1325 unbundle = remote.capable('unbundle') | 1333 unbundle = remote.capable('unbundle') |
1326 if not unbundle: | 1334 if not unbundle: |
1327 lock = remote.lock() | 1335 lock = remote.lock() |
1328 try: | 1336 try: |