mercurial/exchange.py
branchstable
changeset 45214 6063c1857d0a
parent 45156 c26335fa4225
child 45371 e58e234096de
equal deleted inserted replaced
45212:41021660baa1 45214:6063c1857d0a
   903     # something to push
   903     # something to push
   904     if not pushop.force:
   904     if not pushop.force:
   905         # if repo.obsstore == False --> no obsolete
   905         # if repo.obsstore == False --> no obsolete
   906         # then, save the iteration
   906         # then, save the iteration
   907         if unfi.obsstore:
   907         if unfi.obsstore:
   908             obsoletes = []
   908             # this message are here for 80 char limit reason
   909             unstables = []
   909             mso = _(b"push includes obsolete changeset: %s!")
   910             for node in outgoing.missing:
   910             mspd = _(b"push includes phase-divergent changeset: %s!")
       
   911             mscd = _(b"push includes content-divergent changeset: %s!")
       
   912             mst = {
       
   913                 b"orphan": _(b"push includes orphan changeset: %s!"),
       
   914                 b"phase-divergent": mspd,
       
   915                 b"content-divergent": mscd,
       
   916             }
       
   917             # If we are to push if there is at least one
       
   918             # obsolete or unstable changeset in missing, at
       
   919             # least one of the missinghead will be obsolete or
       
   920             # unstable. So checking heads only is ok
       
   921             for node in outgoing.ancestorsof:
   911                 ctx = unfi[node]
   922                 ctx = unfi[node]
   912                 if ctx.obsolete():
   923                 if ctx.obsolete():
   913                     obsoletes.append(ctx)
   924                     raise error.Abort(mso % ctx)
   914                 elif ctx.isunstable():
   925                 elif ctx.isunstable():
   915                     unstables.append(ctx)
   926                     # TODO print more than one instability in the abort
   916             if obsoletes or unstables:
   927                     # message
   917                 msg = b""
   928                     raise error.Abort(mst[ctx.instabilities()[0]] % ctx)
   918                 if obsoletes:
       
   919                     msg += _(b"push includes obsolete changesets:\n")
       
   920                     msg += b"\n".join(b'  %s' % ctx for ctx in obsoletes)
       
   921                 if unstables:
       
   922                     if msg:
       
   923                         msg += b"\n"
       
   924                     msg += _(b"push includes unstable changesets:\n")
       
   925                     msg += b"\n".join(
       
   926                         b'  %s (%s)'
       
   927                         % (
       
   928                             ctx,
       
   929                             b", ".join(_(ins) for ins in ctx.instabilities()),
       
   930                         )
       
   931                         for ctx in unstables
       
   932                     )
       
   933                 raise error.Abort(msg)
       
   934 
   929 
   935         discovery.checkheads(pushop)
   930         discovery.checkheads(pushop)
   936     return True
   931     return True
   937 
   932 
   938 
   933