[PATCH V3] push: refuse to push obsolete changesets
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Mon Jul 9 18:41:46 CDT 2012
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1341876738 -7200
# Node ID 0b01db5dcbcf626acc91133db5953eeb4e5dcaa2
# Parent 4afb28fd4010adcb5cb98017c237e34ebcf486bf
push: refuse to push obsolete changesets
This is a first version. Simple but not very efficient.
Note that this changeset introduce the "obsolete" word in the UI.
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1732,6 +1732,15 @@
else:
# something to push
if not force:
+ # if self.obsstore == False --> no obsolete
+ # then, save the iteration
+ if self.obsstore:
+ # this message are here for 80 char limit reason
+ msg = _("push includes an obsolete changeset: %s!")
+ for node in outgoing.missing:
+ ctx = self[node]
+ if ctx.obsolete():
+ raise util.Abort(msg % ctx)
discovery.checkheads(self, remote, outgoing,
remoteheads, newbranch,
bool(inc))
diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
--- a/tests/test-obsolete.t
+++ b/tests/test-obsolete.t
@@ -171,10 +171,16 @@
$ hg -R tmpb push tmpd
pushing to tmpd
searching for changes
+ abort: push includes an obsolete changeset: cdbce2fbb163!
+ [255]
+ $ hg -R tmpd debugobsolete
+ $ hg -R tmpb push tmpd --rev 5601fb93a350 --rev 245bde4270cd
+ pushing to tmpd
+ searching for changes
adding changesets
adding manifests
adding file changes
- added 6 changesets with 6 changes to 6 files (+3 heads)
+ added 4 changesets with 4 changes to 4 files (+1 heads)
$ hg -R tmpd debugobsolete
ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 {'date': '1338 0', 'user': 'test'}
cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 {'date': '1337 0', 'user': 'test'}
More information about the Mercurial-devel
mailing list