comparison mercurial/localrepo.py @ 17172:12fdaa30063a

push: refuse to push unstable changesets without force User should resolve unstability locally before pushing the same way we encourage user to merge locally instead of pushing a new remote head. If we are to push obsolete changeset, at least one set of the pushed set will be either obsolete or unstable. The check is narrowed to only heads.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Tue, 10 Jul 2012 01:39:03 +0200
parents c18ecebed3f1
children 4253cfee08ef
comparison
equal deleted inserted replaced
17171:9c750c3e4fac 17172:12fdaa30063a
1739 if not force: 1739 if not force:
1740 # if self.obsstore == False --> no obsolete 1740 # if self.obsstore == False --> no obsolete
1741 # then, save the iteration 1741 # then, save the iteration
1742 if self.obsstore: 1742 if self.obsstore:
1743 # this message are here for 80 char limit reason 1743 # this message are here for 80 char limit reason
1744 msg = _("push includes an obsolete changeset: %s!") 1744 mso = _("push includes an obsolete changeset: %s!")
1745 for node in outgoing.missing: 1745 msu = _("push includes an unstable changeset: %s!")
1746 # If we are to push if there is at least one
1747 # obsolete or unstable changeset in missing, at
1748 # least one of the missinghead will be obsolete or
1749 # unstable. So checking heads only is ok
1750 for node in outgoing.missingheads:
1746 ctx = self[node] 1751 ctx = self[node]
1747 if ctx.obsolete(): 1752 if ctx.obsolete():
1748 raise util.Abort(msg % ctx) 1753 raise util.Abort(_(mso) % ctx)
1754 elif ctx.unstable():
1755 raise util.Abort(_(msu) % ctx)
1749 discovery.checkheads(self, remote, outgoing, 1756 discovery.checkheads(self, remote, outgoing,
1750 remoteheads, newbranch, 1757 remoteheads, newbranch,
1751 bool(inc)) 1758 bool(inc))
1752 1759
1753 # create a changegroup from local 1760 # create a changegroup from local