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 # this message are here for 80 char limit reason |
908 obsoletes = [] |
909 mso = _(b"push includes obsolete changeset: %s!") |
909 unstables = [] |
910 mspd = _(b"push includes phase-divergent changeset: %s!") |
910 for node in outgoing.missing: |
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: |
|
922 ctx = unfi[node] |
911 ctx = unfi[node] |
923 if ctx.obsolete(): |
912 if ctx.obsolete(): |
924 raise error.Abort(mso % ctx) |
913 obsoletes.append(ctx) |
925 elif ctx.isunstable(): |
914 elif ctx.isunstable(): |
926 # TODO print more than one instability in the abort |
915 unstables.append(ctx) |
927 # message |
916 if obsoletes or unstables: |
928 raise error.Abort(mst[ctx.instabilities()[0]] % ctx) |
917 msg = b"" |
|
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) |
929 |
934 |
930 discovery.checkheads(pushop) |
935 discovery.checkheads(pushop) |
931 return True |
936 return True |
932 |
937 |
933 |
938 |