Mercurial > public > mercurial-scm > hg
comparison mercurial/localrepo.py @ 17834:743d04dd48ec
push: refuse to push bumped changeset
This applies the same logic as used for `obsolete` and `unstable` changesets.
Refuse to push them without force.
We'll probably want to factor this logic with two new functions
`pctx.troubled()` and `ctx.troubles()`. But I'm waiting for the third
"trouble" to make it into core.
author | Pierre-Yves David <pierre-yves.david@logilab.fr> |
---|---|
date | Fri, 19 Oct 2012 00:50:12 +0200 |
parents | 0c1185f6ddd7 |
children | 526081552f3d |
comparison
equal
deleted
inserted
replaced
17833:0c1185f6ddd7 | 17834:743d04dd48ec |
---|---|
1870 # then, save the iteration | 1870 # then, save the iteration |
1871 if self.obsstore: | 1871 if self.obsstore: |
1872 # this message are here for 80 char limit reason | 1872 # this message are here for 80 char limit reason |
1873 mso = _("push includes obsolete changeset: %s!") | 1873 mso = _("push includes obsolete changeset: %s!") |
1874 msu = _("push includes unstable changeset: %s!") | 1874 msu = _("push includes unstable changeset: %s!") |
1875 msb = _("push includes bumped changeset: %s!") | |
1875 # If we are to push if there is at least one | 1876 # If we are to push if there is at least one |
1876 # obsolete or unstable changeset in missing, at | 1877 # obsolete or unstable changeset in missing, at |
1877 # least one of the missinghead will be obsolete or | 1878 # least one of the missinghead will be obsolete or |
1878 # unstable. So checking heads only is ok | 1879 # unstable. So checking heads only is ok |
1879 for node in outgoing.missingheads: | 1880 for node in outgoing.missingheads: |
1880 ctx = self[node] | 1881 ctx = self[node] |
1881 if ctx.obsolete(): | 1882 if ctx.obsolete(): |
1882 raise util.Abort(_(mso) % ctx) | 1883 raise util.Abort(_(mso) % ctx) |
1883 elif ctx.unstable(): | 1884 elif ctx.unstable(): |
1884 raise util.Abort(_(msu) % ctx) | 1885 raise util.Abort(_(msu) % ctx) |
1886 elif ctx.bumped(): | |
1887 raise util.Abort(_(msb) % ctx) | |
1885 discovery.checkheads(self, remote, outgoing, | 1888 discovery.checkheads(self, remote, outgoing, |
1886 remoteheads, newbranch, | 1889 remoteheads, newbranch, |
1887 bool(inc)) | 1890 bool(inc)) |
1888 | 1891 |
1889 # create a changegroup from local | 1892 # create a changegroup from local |