[PATCH 7 of 7] push: refuse to push bumped changeset
pierre-yves.david at logilab.fr
pierre-yves.david at logilab.fr
Wed Oct 3 05:13:07 CDT 2012
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1349258654 -7200
# Node ID ac012890cc7985e8510b73dc75d964abc2de3fcc
# Parent 0fa428945d3068e04ca11c07a395974c30048a13
push: refuse to push bumped changeset
This apply the same logic than the on used for `obsolete` and `unstable`
changeset. Refuse to push them without force.
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1867,20 +1867,23 @@ class localrepository(object):
# then, save the iteration
if self.obsstore:
# this message are here for 80 char limit reason
mso = _("push includes an obsolete changeset: %s!")
msu = _("push includes an unstable changeset: %s!")
+ msb = _("push includes an bumped changeset: %s!")
# If we are to push if there is at least one
# obsolete or unstable changeset in missing, at
# least one of the missinghead will be obsolete or
# unstable. So checking heads only is ok
for node in outgoing.missingheads:
ctx = self[node]
if ctx.obsolete():
raise util.Abort(_(mso) % ctx)
elif ctx.unstable():
raise util.Abort(_(msu) % ctx)
+ elif ctx.bumped():
+ raise util.Abort(_(msb) % ctx)
discovery.checkheads(self, remote, outgoing,
remoteheads, newbranch,
bool(inc))
# create a changegroup from local
diff --git a/tests/test-obsolete-checkheads.t b/tests/test-obsolete-checkheads.t
--- a/tests/test-obsolete-checkheads.t
+++ b/tests/test-obsolete-checkheads.t
@@ -36,10 +36,11 @@ Check that obsolete properly strip heads
New head replaces old head
==========================
setup
+(we add the 1 flags to prevent bumped error during the test)
$ mkcommit old
$ hg push
pushing to $TESTTMP/remote (glob)
searching for changes
@@ -48,11 +49,11 @@ setup
adding file changes
added 1 changesets with 1 changes to 1 files
$ hg up -q '.^'
$ mkcommit new
created new head
- $ hg debugobsolete `getid old` `getid new`
+ $ hg debugobsolete --flags 1 `getid old` `getid new`
$ hg glog --hidden
@ 71e3228bffe1 (draft) add new
|
| x c70b08862e08 (draft) add old
|/
diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
--- a/tests/test-obsolete.t
+++ b/tests/test-obsolete.t
@@ -164,10 +164,18 @@ And that bumped changeset are detected
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: add new_3_c
+And that we can't push bumped changeset
+
+ $ hg push ../tmpa
+ pushing to ../tmpa
+ searching for changes
+ abort: push includes an bumped changeset: 5601fb93a350!
+ [255]
+
Fixing "bumped" situation
We need to create a clone of 5 and add a special marker with a flag
$ hg up '5^'
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
More information about the Mercurial-devel
mailing list