annotate hgext/pager.py @ 6858:8f256bf98219

Add support for multiple possible bisect results (issue1228, issue1182) The real reason for both issue is that bisect can not handle cases where there are multiple possibilities for the result. Example (from issue1228): rev 0 -> good rev 1 -> skipped rev 2 -> skipped rev 3 -> skipped rev 4 -> bad Note that this patch does not only fix the reported Assertion Error but also the problem of a non converging bisect: hg init for i in `seq 3`; do echo $i > $i; hg add $i; hg ci -m$i; done hg bisect -b 2 hg bisect -g 0 hg bisect -s From this state on, you can: a) mark as bad forever (non converging!) b) mark as good to get an inconsistent state c) skip for the Assertion Error Minor description and code edits by pmezard.
author Bernhard Leiner <bleiner@gmail.com>
date Sat, 02 Aug 2008 22:10:10 +0200
parents db5324d3c257
children 7ef281e78c64
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6323
6e1308a09ffd Use the pager given by the environment to display long output
David Soria Parra <dsp@php.net>
parents:
diff changeset
1 # pager.py - display output using a pager
6e1308a09ffd Use the pager given by the environment to display long output
David Soria Parra <dsp@php.net>
parents:
diff changeset
2 #
6e1308a09ffd Use the pager given by the environment to display long output
David Soria Parra <dsp@php.net>
parents:
diff changeset
3 # Copyright 2008 David Soria Parra <dsp@php.net>
6e1308a09ffd Use the pager given by the environment to display long output
David Soria Parra <dsp@php.net>
parents:
diff changeset
4 #
6e1308a09ffd Use the pager given by the environment to display long output
David Soria Parra <dsp@php.net>
parents:
diff changeset
5 # This software may be used and distributed according to the terms
6e1308a09ffd Use the pager given by the environment to display long output
David Soria Parra <dsp@php.net>
parents:
diff changeset
6 # of the GNU General Public License, incorporated herein by reference.
6e1308a09ffd Use the pager given by the environment to display long output
David Soria Parra <dsp@php.net>
parents:
diff changeset
7 #
6324
ee1077b41d5c pager: further simplify code, clean up comments
Matt Mackall <mpm@selenic.com>
parents: 6323
diff changeset
8 # To load the extension, add it to your .hgrc file:
6323
6e1308a09ffd Use the pager given by the environment to display long output
David Soria Parra <dsp@php.net>
parents:
diff changeset
9 #
6e1308a09ffd Use the pager given by the environment to display long output
David Soria Parra <dsp@php.net>
parents:
diff changeset
10 # [extension]
6e1308a09ffd Use the pager given by the environment to display long output
David Soria Parra <dsp@php.net>
parents:
diff changeset
11 # hgext.pager =
6e1308a09ffd Use the pager given by the environment to display long output
David Soria Parra <dsp@php.net>
parents:
diff changeset
12 #
6324
ee1077b41d5c pager: further simplify code, clean up comments
Matt Mackall <mpm@selenic.com>
parents: 6323
diff changeset
13 # To set the pager that should be used, set the application variable:
6323
6e1308a09ffd Use the pager given by the environment to display long output
David Soria Parra <dsp@php.net>
parents:
diff changeset
14 #
6e1308a09ffd Use the pager given by the environment to display long output
David Soria Parra <dsp@php.net>
parents:
diff changeset
15 # [pager]
6324
ee1077b41d5c pager: further simplify code, clean up comments
Matt Mackall <mpm@selenic.com>
parents: 6323
diff changeset
16 # pager = LESS='FSRX' less
6323
6e1308a09ffd Use the pager given by the environment to display long output
David Soria Parra <dsp@php.net>
parents:
diff changeset
17 #
6324
ee1077b41d5c pager: further simplify code, clean up comments
Matt Mackall <mpm@selenic.com>
parents: 6323
diff changeset
18 # If no pager is set, the pager extensions uses the environment
ee1077b41d5c pager: further simplify code, clean up comments
Matt Mackall <mpm@selenic.com>
parents: 6323
diff changeset
19 # variable $PAGER. If neither pager.pager, nor $PAGER is set, no pager
ee1077b41d5c pager: further simplify code, clean up comments
Matt Mackall <mpm@selenic.com>
parents: 6323
diff changeset
20 # is used.
6323
6e1308a09ffd Use the pager given by the environment to display long output
David Soria Parra <dsp@php.net>
parents:
diff changeset
21 #
6e1308a09ffd Use the pager given by the environment to display long output
David Soria Parra <dsp@php.net>
parents:
diff changeset
22 # If you notice "BROKEN PIPE" error messages, you can disable them
6324
ee1077b41d5c pager: further simplify code, clean up comments
Matt Mackall <mpm@selenic.com>
parents: 6323
diff changeset
23 # by setting:
6323
6e1308a09ffd Use the pager given by the environment to display long output
David Soria Parra <dsp@php.net>
parents:
diff changeset
24 #
6324
ee1077b41d5c pager: further simplify code, clean up comments
Matt Mackall <mpm@selenic.com>
parents: 6323
diff changeset
25 # [pager]
ee1077b41d5c pager: further simplify code, clean up comments
Matt Mackall <mpm@selenic.com>
parents: 6323
diff changeset
26 # quiet = True
6323
6e1308a09ffd Use the pager given by the environment to display long output
David Soria Parra <dsp@php.net>
parents:
diff changeset
27
6e1308a09ffd Use the pager given by the environment to display long output
David Soria Parra <dsp@php.net>
parents:
diff changeset
28 import sys, os, signal
6e1308a09ffd Use the pager given by the environment to display long output
David Soria Parra <dsp@php.net>
parents:
diff changeset
29
6e1308a09ffd Use the pager given by the environment to display long output
David Soria Parra <dsp@php.net>
parents:
diff changeset
30 def uisetup(ui):
6324
ee1077b41d5c pager: further simplify code, clean up comments
Matt Mackall <mpm@selenic.com>
parents: 6323
diff changeset
31 p = ui.config("pager", "pager", os.environ.get("PAGER"))
6456
db5324d3c257 Pager extension: switch it off if --debugger is set
Gilles Moris <gilles.moris@free.fr>
parents: 6455
diff changeset
32 if p and sys.stdout.isatty() and '--debugger' not in sys.argv:
6324
ee1077b41d5c pager: further simplify code, clean up comments
Matt Mackall <mpm@selenic.com>
parents: 6323
diff changeset
33 if ui.configbool('pager', 'quiet'):
ee1077b41d5c pager: further simplify code, clean up comments
Matt Mackall <mpm@selenic.com>
parents: 6323
diff changeset
34 signal.signal(signal.SIGPIPE, signal.SIG_DFL)
ee1077b41d5c pager: further simplify code, clean up comments
Matt Mackall <mpm@selenic.com>
parents: 6323
diff changeset
35 sys.stderr = sys.stdout = os.popen(p, "wb")