Commit Graph

46 Commits

Author SHA1 Message Date
Matt Mackall
40d3e4ba4e merge with stable 2013-11-22 17:26:58 -06:00
Mads Kiilerich
7014dca534 bisect: report "both good and bad" as such, not as "not directly related" 2013-11-10 18:51:21 +01:00
Augie Fackler
9f876f6c89 cleanup: move stdlib imports to their own import statement
There are a few warnings still produced by my import checker, but
those are false positives produced by modules that share a name with
stdlib modules.
2013-11-06 16:48:06 -05:00
Pierre-Yves David
ea74bd73ed bisect: use changelog for iteration
With changelog filtering, we can not use xrange anymore. We have to use the
changelog to do the iteration. This way, the changelog excludes filtered
revision and we can safely use what we iterate over.

Without this changes, bisect crash with a traceback if there is filtered
revision in the repo. Tests have been updated.
2013-01-22 03:23:02 +01:00
Mads Kiilerich
c4b6cff1d3 bisect: store state sorted 2012-12-12 02:38:14 +01:00
Mads Kiilerich
2f4504e446 fix trivial spelling errors 2012-08-15 22:38:42 +02:00
Bryan O'Sullivan
abdf4a8227 util: subclass deque for Python 2.4 backwards compatibility
It turns out that Python 2.4's deque type is lacking a remove method.
We can't implement remove in terms of find, because it doesn't have
find either.
2012-06-01 17:05:31 -07:00
Bryan O'Sullivan
bef5b61512 cleanup: use the deque type where appropriate
There have been quite a few places where we pop elements off the
front of a list.  This can turn O(n) algorithms into something more
like O(n**2).  Python has provided a deque type that can do this
efficiently since at least 2.4.

As an example of the difference a deque can make, it improves
perfancestors performance on a Linux repo from 0.50 seconds to 0.36.
2012-05-15 10:46:23 -07:00
Bryan O'Sullivan
01cb9841ca bisect: track the current changeset (issue3382)
Introduce a new revset feature, bisect(current), that identifies
the changeset currently being bisected.
2012-05-08 15:29:09 -07:00
Yann E. MORIN
cb4376f349 bisect: remove superfluous parameter in label()
The argument is not used.  This is a left-over of non-published
iterations, and it passed through.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-10-20 00:37:34 +02:00
Matt Mackall
fe45fca7d5 localrepo: convert various repo.set() users to repo.revs() 2011-11-02 13:51:16 -05:00
Wagner Bruna
7a521d704e bisect: add i18n contexts 2011-10-18 09:38:14 -02:00
Yann E. MORIN
21df9c4702 hbisect: add functions to return a label for a cset bisection status
Add two new functions that return a string containing the bisection status
of the node passed in parameter:
 - .label(node): return a multi-char string representing the status of node
 - .shortlabel(node): return a single-char string representing the status
   of node, usually the initial of the label

    bisection status    .label()            .shortlabel()
    ----------------------------------------------------------
    good                'good'              'G'
    good (implicit)     'good (implicit)'   'G'
    bad                 'bad'               'B'
    bad (implicit)      'bad (implicit)'    'B'
    skipped             'skip'              'S'
    untested            'untested'          'U'
    ignored             'ignored'           'I'
    (others)            None                None

There is no point in returning 'range' or 'pruned', as these get covered
by another, more meaningful status in the table above.

In case the node is not being bisected, the functions return None to leave
it up to the caller to decide what to print (nothing, an empty space, or
whatever else suits).

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-09-22 23:28:49 +02:00
Yann E. MORIN
c5cb886778 hbisect: add two new revset descriptions: 'goods' and 'bads'
This patch adds two new revset descriptions:
 - 'goods': the list of topologicaly-good csets:
   - if good csets are topologically before bad csets, yields '::good'
   - else, yields 'good::'
 - and conversely for 'bads'

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-09-24 01:32:50 +02:00
Yann E. MORIN
bd0d47a8d1 revset.bisect: add 'ignored' set to the bisect keyword
The 'ignored' changesets are outside the bisection range, but are
changesets that may have an impact on the outcome of the bisection.

For example, in case there's a merge between the good and bad csets,
but the branch-point is out of the bisection range, and the issue
originates from this branch, the branch will not be visited by bisect
and bisect will find that the culprit cset is the merge.

So, the 'ignored' set is equivalent to:
    (   ( ::bisect(bad) - ::bisect(good) )
      | ( ::bisect(good) - ::bisect(bad) ) )
    - bisect(range)

 - all ancestors of bad csets that are not ancestors of good csets, or
 - all ancestors of good csets that are not ancestors of bad csets
 - but that are not in the bisection range.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-09-20 20:21:04 +02:00
Yann E. MORIN
67456b9f23 hbisect.get: use simpler code with repo.set(), fix 'pruned' set
Use repo.set() wherever possible, instead of locally trying to
reproduce complex graph computations.

'pruned' now means 'all csets that will no longer be visited by the
bisection'. The change is done is this very patch instead of its own
dedicated one becasue the code changes all over the place, and the
previous 'pruned' code was totally rewritten by the cleanup, so it
was easier to just change the behavior at the same time.

The previous series went in too fast for this cleanup pass to be
included, so here it is. ;-)

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-09-20 20:19:48 +02:00
Yann E. MORIN
bc668406c8 revset.bisect: add new 'untested' set to the bisect keyword
The 'untested' set is made of changesets that are in the bisection range
but for which the status is still unknown, and that can later be used to
further decide on the bisection outcome.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-09-17 14:33:20 +02:00
Yann E. MORIN
414f1cadec revset.bisect: add new 'pruned' set to the bisect keyword
The 'pruned' set is made of changesets that did participate to
the bisection. They are made of
 - all good changesets
 - all bad changsets
 - all skipped changesets, provided they are in the bisection range

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-09-17 17:30:35 +02:00
Yann E. MORIN
fdcfe85b83 revset.bisect: add new 'range' set to the bisect keyword
The 'range' set is made of all changesets that make the bisection
range, that is
 - csets that are ancestors of bad csets and descendants of good csets
 or
 - csets that are ancestors of good csets and descendants of bad csets

That is, roughly equivalent of:
  bisect(good)::bisect(bad) | bisect(bad)::bisect(good)

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-09-17 17:33:34 +02:00
Yann E. MORIN
0223cbb500 revset.bisect: move bisect() code to hbisect.py
Computing the ranges of csets in the bisection belongs to the hbisect
code. This allows for reusing the status computation from many places,
not only the revset code, but also to later display the bisection status
of a cset...

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-09-17 00:20:45 +02:00
Greg Ward
bc1dfb1ac9 atomictempfile: make close() consistent with other file-like objects.
The usual contract is that close() makes your writes permanent, so
atomictempfile's use of close() to *discard* writes (and rename() to
keep them) is rather unexpected. Thus, change it so close() makes
things permanent and add a new discard() method to throw them away.
discard() is only used internally, in __del__(), to ensure that writes
are discarded when an atomictempfile object goes out of scope.

I audited mercurial.*, hgext.*, and ~80 third-party extensions, and
found no one using the existing semantics of close() to discard
writes, so this should be safe.
2011-08-25 20:21:04 -04:00
Alexander Krauss
94dc232b7a hbisect: do not assume that min(good) is an ancestor of min(bad)
The included test used to report "inconsistent state", which is
incorrect. While this situation cannot occur when the user sticks to
the suggested bisect sequence. However, adding more consistent
good/bad information to the bisect state should be tolerated as well.
2011-07-17 00:36:43 +02:00
Alexander Krauss
bdbc8a1f4b hbisect: more consistent variable name 2011-07-17 00:35:31 +02:00
Alexander Krauss
e93d7080fd hbisect: confine loop to the relevant interval
In this context we know that ancestors[rev] == None for all rev <= goodrev,
so looping further back is unnecessary (and confusing).
2011-07-16 12:22:40 +02:00
Martin Geisler
4c02a87d5a hbisect: use real Booleans instead of 0/1 2011-05-06 10:02:46 +02:00
Martin Geisler
5f46f16fb7 Lowercase error messages 2010-08-29 22:37:58 +02:00
Matt Mackall
f710302a5d bisect: better message for unrelated starting revisions 2010-08-20 17:16:37 -05:00
Matt Mackall
595d66f424 Update license to GPLv2+ 2010-01-19 22:20:08 -06:00
Matt Mackall
34aac1e48a bisect: limit considered set to descendants of first good rev 2009-10-12 14:59:28 -05:00
Martin Geisler
1dfd32f41d hbisect: use set.update for bulk updates 2009-05-17 16:57:12 +02:00
Benoit Boissinot
dbf61e11b8 bisect: use set instead of dict 2009-05-17 03:40:54 +02:00
Martin Geisler
7d509c2459 add blank line after copyright notices and after header 2009-04-26 01:25:53 +02:00
Martin Geisler
750183bdad updated license to be explicit about GPL version 2 2009-04-26 01:08:54 +02:00
Martin Geisler
e2222d3c43 replace set-like dictionaries with real sets
Many of the dictionaries created by dict.fromkeys were emulating sets.
These can now be replaced with real sets.
2009-04-22 00:57:28 +02:00
Ronny Pfannschmidt
5356baa346 switch lock releasing in the core from gc to explicit 2009-04-22 02:01:22 +02:00
Benoit Boissinot
6469b223b7 bisect: use integer division 2009-03-28 17:29:14 +01:00
Bernhard Leiner
586b4a2c7c Circumvent removal of valid bisect candidates due to previously skipped ones
As reported in issue 1445:
A valid candidate revision for a bisect test is not considered for testing
due to its skipped ancestor. If this revision is the only untested one left
an assertion error occurs.
2008-12-27 19:05:26 +01:00
Alexander Solovyov
df3cbc6026 bisect: ability to check revision with command 2008-10-10 16:58:14 +03:00
Patrick Mezard
d5320d378a Merge with crew-stable 2008-08-02 23:45:10 +02:00
Bernhard Leiner
5e75dbce63 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.
2008-08-02 22:10:10 +02:00
Matt Mackall
a65ef7bc5d util: add sort helper 2008-06-27 18:28:45 -05:00
Matt Mackall
bc715be859 add __len__ and __iter__ methods to repo and revlog 2008-06-26 14:35:50 -05:00
Joel Rosdahl
c26213193c Avoid importing mercurial.node/mercurial.repo stuff from mercurial.hg 2008-03-06 22:51:16 +01:00
Matt Mackall
6b6b2e0e73 bisect: improve tests
- test skipping
- test noupdate
- test bad->good search
- test inconsistent state
2007-12-31 18:20:34 -06:00
Matt Mackall
917f5ce70a bisect: handle search for bad to good transitions
Automatically detect whether we're looking for a bad to good
transition rather than the usual good to bad transition by detecting
when badrev is inside the good set and flipping good/bad.
2007-12-31 18:20:34 -06:00
Matt Mackall
bee8b54b36 bisect: make bisect a built-in command 2007-12-31 18:20:34 -06:00