##// END OF EJS Templates
debug: add debugwhyunstable that explains instabilities...
av6 -
r36972:efc4fb34 default
parent child Browse files
Show More
@@ -2529,6 +2529,17 b' def debugwalk(ui, repo, *pats, **opts):'
2529 2529 line = fmt % (abs, f(m.rel(abs)), m.exact(abs) and 'exact' or '')
2530 2530 ui.write("%s\n" % line.rstrip())
2531 2531
2532 @command('debugwhyunstable', [], _('REV'))
2533 def debugwhyunstable(ui, repo, rev):
2534 """explain instabilities of a changeset"""
2535 for entry in obsutil.whyunstable(repo, repo[rev]):
2536 dnodes = ''
2537 if entry.get('divergentnodes'):
2538 dnodes = ' '.join('%s (%s)' % (ctx.hex(), ctx.phasestr())
2539 for ctx in entry['divergentnodes']) + ' '
2540 ui.write('%s: %s%s %s\n' % (entry['instability'], dnodes,
2541 entry['reason'], entry['node']))
2542
2532 2543 @command('debugwireargs',
2533 2544 [('', 'three', '', 'three'),
2534 2545 ('', 'four', '', 'four'),
@@ -923,3 +923,55 b' def _getfilteredreason(repo, changeid, c'
923 923
924 924 args = (changeid, firstsuccessors, remainingnumber)
925 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
@@ -122,6 +122,7 b' Show debug commands if there are no othe'
122 122 debugupdatecaches
123 123 debugupgraderepo
124 124 debugwalk
125 debugwhyunstable
125 126 debugwireargs
126 127 debugwireproto
127 128
@@ -306,6 +307,7 b' Show all commands + options'
306 307 debugupdatecaches:
307 308 debugupgraderepo: optimize, run
308 309 debugwalk: include, exclude
310 debugwhyunstable:
309 311 debugwireargs: three, four, five, ssh, remotecmd, insecure
310 312 debugwireproto: localssh, peer, noreadstderr, ssh, remotecmd, insecure
311 313 files: rev, print0, include, exclude, template, subrepos
@@ -985,6 +985,8 b' Test list of internal help commands'
985 985 debugupgraderepo
986 986 upgrade a repository to use different features
987 987 debugwalk show how files match on given patterns
988 debugwhyunstable
989 explain instabilities of a changeset
988 990 debugwireargs
989 991 (no help text available)
990 992 debugwireproto
@@ -717,3 +717,6 b' Use scmutil.cleanupnodes API to create d'
717 717 a178212c3433c4e77b573f6011e29affb8aefa33 1a2a9b5b0030632400aa78e00388c20f99d3ec44 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'test'}
718 718 a178212c3433c4e77b573f6011e29affb8aefa33 ad6478fb94ecec98b86daae98722865d494ac561 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'test', 'user': 'test'}
719 719 ad6478fb94ecec98b86daae98722865d494ac561 70d5a63ca112acb3764bc1d7320ca90ea688d671 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '9', 'operation': 'test', 'user': 'test'}
720
721 $ hg debugwhyunstable 1a2a9b5b0030
722 content-divergent: 70d5a63ca112acb3764bc1d7320ca90ea688d671 (draft) predecessor a178212c3433c4e77b573f6011e29affb8aefa33
@@ -1033,6 +1033,12 b' test summary output'
1033 1033 orphan: 2 changesets
1034 1034 phase-divergent: 1 changesets
1035 1035
1036 test debugwhyunstable output
1037
1038 $ hg debugwhyunstable 50c51b361e60
1039 orphan: obsolete parent 3de5eca88c00aa039da7399a220f4a5221faa585
1040 phase-divergent: immutable predecessor 245bde4270cd1072a27757984f9cda8ba26f08ca
1041
1036 1042 #if serve
1037 1043
1038 1044 $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
General Comments 0
You need to be logged in to leave comments. Login now