comparison hgext/obsolete.py @ 376:188afb394e10 stable

obsolete: move hint punching to push Core does not raise the warning in check heads
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Wed, 25 Jul 2012 17:43:38 +0200
parents 1525b240d806
children 1d6cc8c22cd9 9dda5c1f6a45
comparison
equal deleted inserted replaced
375:1525b240d806 376:188afb394e10
485 485
486 * prevent unstability to be pushed 486 * prevent unstability to be pushed
487 * patch remote to ignore obsolete heads on remote 487 * patch remote to ignore obsolete heads on remote
488 """ 488 """
489 # do not push instability 489 # do not push instability
490 try: 490 for h in outgoing.missingheads:
491 for h in outgoing.missingheads: 491 # checking heads only is enought because any thing base on obsolete
492 # checking heads only is enought because any thing base on obsolete 492 # changeset is either obsolete or unstable.
493 # changeset is either obsolete or unstable. 493 ctx = repo[h]
494 ctx = repo[h] 494 if ctx.unstable():
495 if ctx.unstable(): 495 raise util.Abort(_("push includes an unstable changeset: %s!")
496 raise util.Abort(_("push includes an unstable changeset: %s!") 496 % ctx)
497 % ctx) 497 if ctx.obsolete():
498 if ctx.obsolete(): 498 raise util.Abort(_("push includes an obsolete changeset: %s!")
499 raise util.Abort(_("push includes an obsolete changeset: %s!") 499 % ctx)
500 % ctx) 500 if ctx.latecomer():
501 if ctx.latecomer(): 501 raise util.Abort(_("push includes an latecomer changeset: %s!")
502 raise util.Abort(_("push includes an latecomer changeset: %s!") 502 % ctx)
503 % ctx) 503 if ctx.conflicting():
504 if ctx.conflicting(): 504 raise util.Abort(_("push includes conflicting changeset: %s!")
505 raise util.Abort(_("push includes conflicting changeset: %s!") 505 % ctx)
506 % ctx)
507 except util.Abort, ex:
508 hint = _("use 'hg stabilize' to get a stable history (or --force to proceed)")
509 if (len(ex.args) >= 1
510 and ex.args[0].startswith('push includes ')
511 and ex.hint is None):
512 ex.hint = hint
513 raise
514 ### patch remote branch map 506 ### patch remote branch map
515 # do not read it this burn eyes 507 # do not read it this burn eyes
516 try: 508 try:
517 if 'oldbranchmap' not in vars(remote): 509 if 'oldbranchmap' not in vars(remote):
518 remote.oldbranchmap = remote.branchmap 510 remote.oldbranchmap = remote.branchmap
1206 l.release() 1198 l.release()
1207 1199
1208 def push(self, remote, *args, **opts): 1200 def push(self, remote, *args, **opts):
1209 """wrapper around pull that pull obsolete relation""" 1201 """wrapper around pull that pull obsolete relation"""
1210 self._turn_extinct_secret() 1202 self._turn_extinct_secret()
1211 result = opush(remote, *args, **opts) 1203 try:
1204 result = opush(remote, *args, **opts)
1205 except util.Abort, ex:
1206 hint = _("use 'hg stabilize' to get a stable history (or --force to proceed)")
1207 if (len(ex.args) >= 1
1208 and ex.args[0].startswith('push includes ')
1209 and ex.hint is None):
1210 ex.hint = hint
1211 raise
1212 if 'obsolete' in remote.listkeys('namespaces') and self.obsstore: 1212 if 'obsolete' in remote.listkeys('namespaces') and self.obsstore:
1213 data = self.obsstore._writemarkers() 1213 data = self.obsstore._writemarkers()
1214 r = remote.pushkey('obsolete', 'dump', '', 1214 r = remote.pushkey('obsolete', 'dump', '',
1215 base85.b85encode(data)) 1215 base85.b85encode(data))
1216 if not r: 1216 if not r: