mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 15:27:13 +03:00
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
This commit is contained in:
parent
573a8eb9cc
commit
1b816bd86e
@ -19,7 +19,6 @@ from .node import (
|
||||
)
|
||||
from . import (
|
||||
error,
|
||||
util,
|
||||
)
|
||||
|
||||
def bisect(repo, state):
|
||||
@ -36,21 +35,12 @@ def bisect(repo, state):
|
||||
changelog = repo.changelog
|
||||
clparents = changelog.parentrevs
|
||||
skip = set([changelog.rev(n) for n in state['skip']])
|
||||
empty = set()
|
||||
|
||||
def buildancestors(bad, good):
|
||||
def ctxmatch(rev):
|
||||
if not util.safehasattr(repo, 'sparsematch'):
|
||||
return True
|
||||
ctx = repo[rev]
|
||||
sparsematch = repo.sparsematch(rev)
|
||||
return any(f for f in ctx.files() if sparsematch(f))
|
||||
badrev = min([changelog.rev(n) for n in bad])
|
||||
ancestors = collections.defaultdict(lambda: None)
|
||||
for rev in repo.revs("descendants(%ln) - ancestors(%ln)", good, good):
|
||||
ancestors[rev] = []
|
||||
if not ctxmatch(rev):
|
||||
empty.add(rev)
|
||||
if ancestors[badrev] is None:
|
||||
return badrev, None
|
||||
return badrev, ancestors
|
||||
@ -88,11 +78,9 @@ def bisect(repo, state):
|
||||
# have we narrowed it down to one entry?
|
||||
# or have all other possible candidates besides 'bad' have been skipped?
|
||||
tot = len(candidates)
|
||||
unskipped = [c for c in candidates if (c not in skip) and (c != badrev)
|
||||
and (c not in empty)]
|
||||
unskipped = [c for c in candidates if (c not in skip) and (c != badrev)]
|
||||
if tot == 1 or not unskipped:
|
||||
return ([changelog.node(c) for c in candidates if c not in empty],
|
||||
0, good)
|
||||
return ([changelog.node(c) for c in candidates], 0, good)
|
||||
perfect = tot // 2
|
||||
|
||||
# find the best node to test
|
||||
@ -111,14 +99,13 @@ def bisect(repo, state):
|
||||
x = len(a) # number of ancestors
|
||||
y = tot - x # number of non-ancestors
|
||||
value = min(x, y) # how good is this test?
|
||||
if value > best_len and rev not in skip and rev not in empty:
|
||||
if value > best_len and rev not in skip:
|
||||
best_len = value
|
||||
best_rev = rev
|
||||
if value == perfect: # found a perfect candidate? quit early
|
||||
break
|
||||
|
||||
# all downhill from here?
|
||||
if y < perfect and rev not in skip and rev not in empty:
|
||||
if y < perfect and rev not in skip: # all downhill from here?
|
||||
# poison children
|
||||
poison.update(children.get(rev, []))
|
||||
continue
|
||||
|
@ -1,81 +0,0 @@
|
||||
# Simple sparse linear repository with empty commits to showcase how bisect
|
||||
# skips them. We mark the latest as bad and the first as good and we expect
|
||||
# the bisect algorithm to skip the empty commits (2,3) which are visited by
|
||||
# using the default version
|
||||
#
|
||||
# 7: kb (known bad)
|
||||
# |
|
||||
# 6: ec (empty commit)
|
||||
# |
|
||||
# 5: c (commit)
|
||||
# |
|
||||
# 4: x (introduce fault)
|
||||
# |
|
||||
# 3: ec (empty commit)
|
||||
# |
|
||||
# 2: ec (empty commit)
|
||||
# |
|
||||
# 1: c (commit)
|
||||
# |
|
||||
# 0: kg (known good)
|
||||
#
|
||||
|
||||
test bisect-sparse
|
||||
$ hg init myrepo
|
||||
$ cd myrepo
|
||||
$ cat > .hg/hgrc <<EOF
|
||||
> [extensions]
|
||||
> sparse=$TESTDIR/../hgext/fbsparse.py
|
||||
> strip=
|
||||
> EOF
|
||||
|
||||
$ echo a > show
|
||||
$ echo x > hide
|
||||
$ hg ci -Aqm 'known good'
|
||||
|
||||
$ echo a >> show
|
||||
$ echo y >> hide
|
||||
$ hg ci -Aqm 'on top of good'
|
||||
|
||||
$ echo y >> hide
|
||||
$ hg ci -Aqm 'empty sparse 1'
|
||||
|
||||
$ echo y >> hide
|
||||
$ hg ci -Aqm 'empty sparse 2'
|
||||
|
||||
$ echo a >> show
|
||||
$ echo y >> hide
|
||||
$ hg ci -Aqm 'introduce fault'
|
||||
|
||||
$ echo a >> show
|
||||
$ echo y >> hide
|
||||
$ hg ci -Aqm 'on top of bad'
|
||||
|
||||
$ echo y >> hide
|
||||
$ hg ci -Aqm 'empty sparse 1'
|
||||
|
||||
$ echo y >> hide
|
||||
$ hg ci -Aqm 'empty sparse 2'
|
||||
|
||||
$ hg sparse --include show
|
||||
|
||||
verify bisect skips empty sparse commits (2,3)
|
||||
|
||||
$ hg up -r 0
|
||||
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
||||
$ hg bisect --good
|
||||
$ hg up default
|
||||
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
||||
$ hg bisect --bad
|
||||
Testing changeset 4:4c3171169989 (7 changesets remaining, ~2 tests)
|
||||
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
||||
$ hg bisect --bad
|
||||
Testing changeset 1:4a28797ad698 (4 changesets remaining, ~2 tests)
|
||||
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
||||
$ hg bisect --good
|
||||
The first bad revision is:
|
||||
changeset: 4:4c3171169989
|
||||
user: test
|
||||
date: Thu Jan 01 00:00:00 1970 +0000
|
||||
summary: introduce fault
|
||||
|
Loading…
Reference in New Issue
Block a user