Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 46798:f51ff655d338
bisect: use standard one-line commit summary
This makes bisect use the standardized support for one-line commit
summary I added a while back. That means that it will respect the
`command-templates.oneline-summary` config. If also means that the
default output now includes the first line of the commit message (see
test impact).
Differential Revision: https://phab.mercurial-scm.org/D10245
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 19 Mar 2021 23:16:09 -0700 |
parents | e2f7b2695ba1 |
children | b26f9560f40d |
comparison
equal
deleted
inserted
replaced
46797:bcdcb4423ae3 | 46798:f51ff655d338 |
---|---|
1105 raise error.Abort(_(b"%s killed") % command) | 1105 raise error.Abort(_(b"%s killed") % command) |
1106 else: | 1106 else: |
1107 transition = b"bad" | 1107 transition = b"bad" |
1108 state[transition].append(node) | 1108 state[transition].append(node) |
1109 ctx = repo[node] | 1109 ctx = repo[node] |
1110 ui.status( | 1110 summary = cmdutil.format_changeset_summary(ui, ctx, b'bisect') |
1111 _(b'changeset %d:%s: %s\n') % (ctx.rev(), ctx, transition) | 1111 ui.status(_(b'changeset %s: %s\n') % (summary, transition)) |
1112 ) | |
1113 hbisect.checkstate(state) | 1112 hbisect.checkstate(state) |
1114 # bisect | 1113 # bisect |
1115 nodes, changesets, bgood = hbisect.bisect(repo, state) | 1114 nodes, changesets, bgood = hbisect.bisect(repo, state) |
1116 # update to next check | 1115 # update to next check |
1117 node = nodes[0] | 1116 node = nodes[0] |
1123 | 1122 |
1124 # actually bisect | 1123 # actually bisect |
1125 nodes, changesets, good = hbisect.bisect(repo, state) | 1124 nodes, changesets, good = hbisect.bisect(repo, state) |
1126 if extend: | 1125 if extend: |
1127 if not changesets: | 1126 if not changesets: |
1128 extendnode = hbisect.extendrange(repo, state, nodes, good) | 1127 extendctx = hbisect.extendrange(repo, state, nodes, good) |
1129 if extendnode is not None: | 1128 if extendctx is not None: |
1130 ui.write( | 1129 ui.write( |
1131 _(b"Extending search to changeset %d:%s\n") | 1130 _(b"Extending search to changeset %s\n") |
1132 % (extendnode.rev(), extendnode) | 1131 % cmdutil.format_changeset_summary(ui, extendctx, b'bisect') |
1133 ) | 1132 ) |
1134 state[b'current'] = [extendnode.node()] | 1133 state[b'current'] = [extendctx.node()] |
1135 hbisect.save_state(repo, state) | 1134 hbisect.save_state(repo, state) |
1136 return mayupdate(repo, extendnode.node()) | 1135 return mayupdate(repo, extendctx.node()) |
1137 raise error.StateError(_(b"nothing to extend")) | 1136 raise error.StateError(_(b"nothing to extend")) |
1138 | 1137 |
1139 if changesets == 0: | 1138 if changesets == 0: |
1140 hbisect.printresult(ui, repo, state, displayer, nodes, good) | 1139 hbisect.printresult(ui, repo, state, displayer, nodes, good) |
1141 else: | 1140 else: |
1144 # compute the approximate number of remaining tests | 1143 # compute the approximate number of remaining tests |
1145 tests, size = 0, 2 | 1144 tests, size = 0, 2 |
1146 while size <= changesets: | 1145 while size <= changesets: |
1147 tests, size = tests + 1, size * 2 | 1146 tests, size = tests + 1, size * 2 |
1148 rev = repo.changelog.rev(node) | 1147 rev = repo.changelog.rev(node) |
1148 summary = cmdutil.format_changeset_summary(ui, repo[rev], b'bisect') | |
1149 ui.write( | 1149 ui.write( |
1150 _( | 1150 _( |
1151 b"Testing changeset %d:%s " | 1151 b"Testing changeset %s " |
1152 b"(%d changesets remaining, ~%d tests)\n" | 1152 b"(%d changesets remaining, ~%d tests)\n" |
1153 ) | 1153 ) |
1154 % (rev, short(node), changesets, tests) | 1154 % (summary, changesets, tests) |
1155 ) | 1155 ) |
1156 state[b'current'] = [node] | 1156 state[b'current'] = [node] |
1157 hbisect.save_state(repo, state) | 1157 hbisect.save_state(repo, state) |
1158 return mayupdate(repo, node) | 1158 return mayupdate(repo, node) |
1159 | 1159 |