repo-bisect: do proper bisect
The bisect code was a bit confused, and would always look at the versions at the boundaries, instead of the versions in the middle, thus not doing a proper bisect. This change fixes this behaviour, the revision tested will be in the middle of the current range, and will then become the lower (for a good revision) or upper (for a bad revision) boundary for the next iteration.
This commit is contained in:
parent
3535ffb18c
commit
0d2ae5b4ac
26
repo-bisect
26
repo-bisect
|
@ -184,6 +184,16 @@ def repo_sync_to_date(date):
|
||||||
git_reset_hard(manifest_rev)
|
git_reset_hard(manifest_rev)
|
||||||
os.chdir(cwd)
|
os.chdir(cwd)
|
||||||
|
|
||||||
|
def state_to_mid(state):
|
||||||
|
d1 = string_to_datetime(state['start'])
|
||||||
|
d2 = string_to_datetime(state['end'])
|
||||||
|
mid = datetime_mid(d1, d2)
|
||||||
|
return datetime_to_string(mid)
|
||||||
|
|
||||||
|
def repo_sync_to_mid(state):
|
||||||
|
mid = state_to_mid(state)
|
||||||
|
repo_sync_to_date(mid)
|
||||||
|
|
||||||
def state_read():
|
def state_read():
|
||||||
s = dict()
|
s = dict()
|
||||||
f = open('.repo/bisect', 'r')
|
f = open('.repo/bisect', 'r')
|
||||||
|
@ -231,27 +241,21 @@ if action == 'start':
|
||||||
state['end'] = argv[2]
|
state['end'] = argv[2]
|
||||||
state_write(state)
|
state_write(state)
|
||||||
if not cfg['nosync']:
|
if not cfg['nosync']:
|
||||||
repo_sync_to_date(state['start'])
|
repo_sync_to_mid(state)
|
||||||
if action == 'good':
|
if action == 'good':
|
||||||
state = state_read()
|
state = state_read()
|
||||||
d1 = string_to_datetime(state['start'])
|
state['start'] = state_to_mid(state)
|
||||||
d2 = string_to_datetime(state['end'])
|
|
||||||
mid = datetime_mid(d1, d2)
|
|
||||||
state['start'] = datetime_to_string(mid)
|
|
||||||
state_write(state)
|
state_write(state)
|
||||||
print "bisect: start=%s, end=%s" % (state['start'], state['end'])
|
print "bisect: start=%s, end=%s" % (state['start'], state['end'])
|
||||||
if not cfg['nosync']:
|
if not cfg['nosync']:
|
||||||
repo_sync_to_date(state['start'])
|
repo_sync_to_mid(state)
|
||||||
if action == 'bad':
|
if action == 'bad':
|
||||||
state = state_read()
|
state = state_read()
|
||||||
d1 = string_to_datetime(state['start'])
|
state['end'] = state_to_mid(state)
|
||||||
d2 = string_to_datetime(state['end'])
|
|
||||||
mid = datetime_mid(d1, d2)
|
|
||||||
state['end'] = datetime_to_string(mid)
|
|
||||||
state_write(state)
|
state_write(state)
|
||||||
print "bisect: start=%s, end=%s" % (state['start'], state['end'])
|
print "bisect: start=%s, end=%s" % (state['start'], state['end'])
|
||||||
if not cfg['nosync']:
|
if not cfg['nosync']:
|
||||||
repo_sync_to_date(state['start'])
|
repo_sync_to_mid(state)
|
||||||
if action == 'reset':
|
if action == 'reset':
|
||||||
state_delete()
|
state_delete()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue