921 firstsuccessors = ', '.join(succs[:2]) |
921 firstsuccessors = ', '.join(succs[:2]) |
922 remainingnumber = len(succs) - 2 |
922 remainingnumber = len(succs) - 2 |
923 |
923 |
924 args = (changeid, firstsuccessors, remainingnumber) |
924 args = (changeid, firstsuccessors, remainingnumber) |
925 return filteredmsgtable['superseded_split_several'] % args |
925 return filteredmsgtable['superseded_split_several'] % args |
|
926 |
|
927 def divergentsets(repo, ctx): |
|
928 """Compute sets of commits divergent with a given one""" |
|
929 cache = {} |
|
930 base = {} |
|
931 for n in allpredecessors(repo.obsstore, [ctx.node()]): |
|
932 if n == ctx.node(): |
|
933 # a node can't be a base for divergence with itself |
|
934 continue |
|
935 nsuccsets = successorssets(repo, n, cache) |
|
936 for nsuccset in nsuccsets: |
|
937 if ctx.node() in nsuccset: |
|
938 # we are only interested in *other* successor sets |
|
939 continue |
|
940 if tuple(nsuccset) in base: |
|
941 # we already know the latest base for this divergency |
|
942 continue |
|
943 base[tuple(nsuccset)] = n |
|
944 return [{'divergentnodes': divset, 'commonpredecessor': b} |
|
945 for divset, b in base.iteritems()] |
|
946 |
|
947 def whyunstable(repo, ctx): |
|
948 result = [] |
|
949 if ctx.orphan(): |
|
950 for parent in ctx.parents(): |
|
951 kind = None |
|
952 if parent.orphan(): |
|
953 kind = 'orphan' |
|
954 elif parent.obsolete(): |
|
955 kind = 'obsolete' |
|
956 if kind is not None: |
|
957 result.append({'instability': 'orphan', |
|
958 'reason': '%s parent' % kind, |
|
959 'node': parent.hex()}) |
|
960 if ctx.phasedivergent(): |
|
961 predecessors = allpredecessors(repo.obsstore, [ctx.node()], |
|
962 ignoreflags=bumpedfix) |
|
963 immutable = [repo[p] for p in predecessors |
|
964 if p in repo and not repo[p].mutable()] |
|
965 for predecessor in immutable: |
|
966 result.append({'instability': 'phase-divergent', |
|
967 'reason': 'immutable predecessor', |
|
968 'node': predecessor.hex()}) |
|
969 if ctx.contentdivergent(): |
|
970 dsets = divergentsets(repo, ctx) |
|
971 for dset in dsets: |
|
972 divnodes = [repo[n] for n in dset['divergentnodes']] |
|
973 result.append({'instability': 'content-divergent', |
|
974 'divergentnodes': divnodes, |
|
975 'reason': 'predecessor', |
|
976 'node': nodemod.hex(dset['commonpredecessor'])}) |
|
977 return result |