Commit Graph

63 Commits

Author SHA1 Message Date
Stanislau Hlebik
1b816bd86e revert bisect change
Summary:
In D7001328 we've added a new feature that skips commtis if there are no
changes relative to the sparse checkout. Unfortunately that causes lots of
treepacks downloads and makes bisect unusable. Let's revert the change.

Reviewed By: ryanmce, farnz

Differential Revision: D7182016

fbshipit-source-id: 274b29ca6a7b4c3faf83883b64f5ad3b0289873e
2018-04-13 21:51:23 -07:00
Serafeim Mellos
3a42733be6 Teach bisect to ignore empty commits on sparse checkouts
Summary: Skip empty commits in sparse repositories when doing bisection

Reviewed By: ryanmce, farnz

Differential Revision: D7001328

fbshipit-source-id: 8493d20389410b522e70ce41cc3e33ac9361781d
2018-04-13 21:51:12 -07:00
Jun Wu
2946a1c198 codemod: use single blank line
Summary: This makes test-check-code cleaner.

Reviewed By: ryanmce

Differential Revision: D6937934

fbshipit-source-id: 8f92bc32f75b9792ac67db77bb3a8756b37fa941
2018-04-13 21:51:08 -07:00
David Soria Parra
7766b6cfbc hbisect: use a defaultdict to avoid large allocations for a large changelogs
We can avoid a SPACE(len(changelog)) allocation by using a defaultdict.

Test Plan:
    python run-tests.py test-bisect*

Differential Revision: https://phab.mercurial-scm.org/D1499
2017-11-23 14:13:14 -08:00
David Soria Parra
690d883f70 hbisect: use a revset for ancestor calculation
Since we have revsets we can be more concise in doing the ancestor calulcation.
Significant commits are all descendent of the topmost good commits.

Test Plan:
    python run-tests.py test-bisect*

Differential Revision: https://phab.mercurial-scm.org/D1498
2017-11-23 14:12:55 -08:00
David Soria Parra
10f01a10fc hbisect: pass repo into hbisect.bisect
Pass repo into the bisect function to get more flexibility in what we can call.
This will allow us to use revsets to rewrite parts of the ancestor and children
calculation in later patches.

Test Plan:
    python run-tests.py test-bisect*

Differential Revision: https://phab.mercurial-scm.org/D1497
2017-11-23 14:11:27 -08:00
Augie Fackler
7afc787907 hbisect: avoid shadowing a variable in a list comprehension 2016-11-10 16:33:23 -05:00
Pierre-Yves David
7afebe8fb3 bisect: move check_state into the bisect module
Now that the function is simpler, we resume our quest to move the logic into the
bisect module. In the process, we add basic documentation.
2016-08-24 04:25:20 +02:00
Pierre-Yves David
452cc705b7 bisect: move 'printresult' in the 'hbisect' module
The logic is already extracted into a closure. We move it into the module
dedicated to bisect.

A minor change is applied: the creation of the 'displayer' is kept in the main
command function, it remove the needs to import 'cmdutil' in 'hbisect'. This
would create an import circle otherwise.
2016-08-24 04:19:11 +02:00
Pierre-Yves David
88806a61a8 bisect: move the 'extendrange' to the 'hbisect' module
We have a module ready to host any bisect logic. That logic was already isolated
in a function so we just migrate it as is.
2016-08-24 04:16:07 +02:00
Pierre-Yves David
8a0460c873 bisect: extract the 'reset' logic into its own function
This is part of small clean up movement. The bisect module seem more appropriate
to host the bisect logic. The cleanup itself is motivated by some higher level
cleanup around vfs and locking.
2016-08-24 04:13:53 +02:00
Bryan O'Sullivan
9e950df349 with: use context manager in bisect save_state 2016-01-15 13:14:49 -08:00
Bryan O'Sullivan
6d56e2235c hbisect: use tryreadlines to load state
This closes the file handle after reading, which stops PyPy from
leaking open file handles and thus failing test-bisect3.t.
2015-12-27 23:55:54 +09:00
Pierre-Yves David
30913031d4 error: get Abort from 'error' instead of 'util'
The home of 'Abort' is 'error' not 'util' however, a lot of code seems to be
confused about that and gives all the credit to 'util' instead of the
hardworking 'error'. In a spirit of equity, we break the cycle of injustice and
give back to 'error' the respect it deserves. And screw that 'util' poser.

For great justice.
2015-10-08 12:55:45 -07:00
Gregory Szorc
0907386697 hbisect: use absolute_import 2015-08-08 19:22:11 -07:00
Martin von Zweigbergk
4127f67694 util: drop alias for collections.deque
Now that util.deque is just an alias for collections.deque, let's just
remove it.
2015-05-16 11:28:04 -07:00
Angel Ezquerra
88cbab7845 localrepo: remove all external users of localrepo.opener
This change touches every module in which repository.opener was being used, and
changes it for the equivalent repository.vfs. This is meant to make it easier
to split the repository.vfs into several separate vfs.

It should now be possible to remove localrepo.opener.
2015-01-15 23:17:12 +01:00
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