diff mercurial/localrepo.py @ 17169:c18ecebed3f1

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.
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Tue, 10 Jul 2012 01:32:18 +0200
parents be016e96117a
children 12fdaa30063a
line wrap: on
line diff
--- a/mercurial/localrepo.py	Thu Jul 05 19:53:04 2012 +0200
+++ b/mercurial/localrepo.py	Tue Jul 10 01:32:18 2012 +0200
@@ -1737,6 +1737,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))