##// END OF EJS Templates
mq: factor out push conditions checks...
Patrick Mezard -
r13327:dc11e30b default
parent child Browse files
Show More
@@ -2919,7 +2919,7 b' def reposetup(ui, repo):'
2919 return super(mqrepo, self).commit(text, user, date, match, force,
2919 return super(mqrepo, self).commit(text, user, date, match, force,
2920 editor, extra)
2920 editor, extra)
2921
2921
2922 def push(self, remote, force=False, revs=None, newbranch=False):
2922 def checkpush(self, force, revs):
2923 if self.mq.applied and not force:
2923 if self.mq.applied and not force:
2924 haspatches = True
2924 haspatches = True
2925 if revs:
2925 if revs:
@@ -2930,7 +2930,7 b' def reposetup(ui, repo):'
2930 haspatches = bool([n for n in revs if n in applied])
2930 haspatches = bool([n for n in revs if n in applied])
2931 if haspatches:
2931 if haspatches:
2932 raise util.Abort(_('source has mq patches applied'))
2932 raise util.Abort(_('source has mq patches applied'))
2933 return super(mqrepo, self).push(remote, force, revs, newbranch)
2933 super(mqrepo, self).checkpush(force, revs)
2934
2934
2935 def _findtags(self):
2935 def _findtags(self):
2936 '''augment tags from base class with patch tags'''
2936 '''augment tags from base class with patch tags'''
@@ -1305,6 +1305,13 b' class localrepository(repo.repository):'
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:
@@ -1321,6 +1328,7 b' class localrepository(repo.repository):'
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:
General Comments 0
You need to be logged in to leave comments. Login now