Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 30128:e37ee8367ab4
bisect: build a displayer only once
There is multiple spot using this, building it early will help to extract more
of the logic into the bisect module.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Wed, 24 Aug 2016 05:06:21 +0200 |
parents | 1ee65f1a11a5 |
children | 7be610198360 |
comparison
equal
deleted
inserted
replaced
30127:1ee65f1a11a5 | 30128:e37ee8367ab4 |
---|---|
877 if noupdate: | 877 if noupdate: |
878 return | 878 return |
879 cmdutil.bailifchanged(repo) | 879 cmdutil.bailifchanged(repo) |
880 return hg.clean(repo, node, show_stats=show_stats) | 880 return hg.clean(repo, node, show_stats=show_stats) |
881 | 881 |
882 displayer = cmdutil.show_changeset(ui, repo, {}) | |
883 | |
882 if command: | 884 if command: |
883 changesets = 1 | 885 changesets = 1 |
884 if noupdate: | 886 if noupdate: |
885 try: | 887 try: |
886 node = state['current'][0] | 888 node = state['current'][0] |
919 node = nodes[0] | 921 node = nodes[0] |
920 mayupdate(repo, node, show_stats=False) | 922 mayupdate(repo, node, show_stats=False) |
921 finally: | 923 finally: |
922 state['current'] = [node] | 924 state['current'] = [node] |
923 hbisect.save_state(repo, state) | 925 hbisect.save_state(repo, state) |
924 displayer = cmdutil.show_changeset(ui, repo, {}) | |
925 hbisect.printresult(ui, repo, state, displayer, nodes, bgood) | 926 hbisect.printresult(ui, repo, state, displayer, nodes, bgood) |
926 return | 927 return |
927 | 928 |
928 hbisect.checkstate(state) | 929 hbisect.checkstate(state) |
929 | 930 |
939 hbisect.save_state(repo, state) | 940 hbisect.save_state(repo, state) |
940 return mayupdate(repo, extendnode.node()) | 941 return mayupdate(repo, extendnode.node()) |
941 raise error.Abort(_("nothing to extend")) | 942 raise error.Abort(_("nothing to extend")) |
942 | 943 |
943 if changesets == 0: | 944 if changesets == 0: |
944 displayer = cmdutil.show_changeset(ui, repo, {}) | |
945 hbisect.printresult(ui, repo, state, displayer, nodes, good) | 945 hbisect.printresult(ui, repo, state, displayer, nodes, good) |
946 else: | 946 else: |
947 assert len(nodes) == 1 # only a single node can be tested next | 947 assert len(nodes) == 1 # only a single node can be tested next |
948 node = nodes[0] | 948 node = nodes[0] |
949 # compute the approximate number of remaining tests | 949 # compute the approximate number of remaining tests |