Mercurial > hg
comparison mercurial/exchange.py @ 45214:6063c1857d0a stable
exchange: backout changeset c26335fa4225
Changeset c26335fa4225 has good intends but introduce significant behavior
regressions for multiple important cases. In short there are many case where
push would have caught instability creation/propagation that are no longer
covered. These behavior have been covered for many years and even if some
related case are not currently caught, the covered one should not be regressed.
The next four changesets introduce tests for some of these cases. However we
could produce many more tests cases since the area is wide and they are many
possible combination. (And we should cover them when getting back to this issue)
Since 5.5 is one week away, the most reasonable approach seems to back this out
while we devise a new way to move forward that preserve the current behavior,
catch more issues and also improves the situation that c26335fa4225 target.
In addition to the behavior change, c26335fa4225 also introduced output
changes. These output changes does not requires a backout per-se, but are part of
the same changeset. However they come with a couple of issues that also requires
attention:
1) the bulk of the error message have been shoehorned into a multiple line abort
message. This seems quite different from what we usually do. The abort message
should be a compact and efficient message, with extra details being issued as
normal error output beforehand. (with --verbose/--quiet) support.
2) the current output is unbounded, so if there is many (tens, hundreds,
thousands, …) of unstable/obsolete changeset involved in the push, the output
can quickly become a scary and un-usuable wall of text. So we need some
limitation here (same as we have with the remote head list that says A, B , C
and # others).
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 23 Jul 2020 16:57:56 +0200 |
parents | c26335fa4225 |
children | e58e234096de |
comparison
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 |