Chromium Code Reviews| Index: tools/bisect-builds.py |
| diff --git a/tools/bisect-builds.py b/tools/bisect-builds.py |
| index 11711cd02d28fae3ab37de268b9203fcf85e2a82..589e26d889022f8f99826620586781409edc6b20 100644 |
| --- a/tools/bisect-builds.py |
| +++ b/tools/bisect-builds.py |
| @@ -204,17 +204,11 @@ def ParseDirectoryIndexRecent(context): |
| return re.findall(r"<a href=\"(\d+)/\">\1/</a>", document) |
| -def GetRevList(context): |
| +def GetRevList(context, revlist): |
| """Gets the list of revision numbers between |good_revision| and |
| |bad_revision| of the |context|.""" |
|
Nico
2011/07/21 16:17:31
Update docstring.
jbates
2011/07/21 17:36:01
Done.
|
| # Download the revlist and filter for just the range between good and bad. |
| rev_range = range(context.good_revision, context.bad_revision) |
| - revisions = [] |
| - if context.use_recent: |
| - revisions = ParseDirectoryIndexRecent(context) |
| - else: |
| - revisions = ParseDirectoryIndex(context) |
| - revlist = map(int, revisions) |
| revlist = filter(lambda r: r in rev_range, revlist) |
| revlist.sort() |
| return revlist |
| @@ -345,12 +339,6 @@ def main(): |
| parser.add_option('-p', '--profile', '--user-data-dir', type = 'str', |
| help = 'Profile to use; this will not reset every run. ' + |
| 'Defaults to a clean profile.', default = 'profile') |
| - parser.add_option('-r', '--recent', |
| - dest = "recent", |
| - default = False, |
| - action = "store_true", |
| - help = 'Use recent builds from about the last 2 months ' + |
| - 'for higher granularity bisecting.') |
| (opts, args) = parser.parse_args() |
| if opts.archive is None: |
| @@ -366,7 +354,7 @@ def main(): |
| return 1 |
| # Create the context. Initialize 0 for the revisions as they are set below. |
| - context = PathContext(opts.archive, 0, 0, opts.recent) |
| + context = PathContext(opts.archive, 0, 0, False) |
|
Nico
2011/07/21 16:17:31
Name parameter (|..., use_recent=False)|) – more r
jbates
2011/07/21 17:36:01
Done.
|
| # Pick a starting point, try to get HEAD for this. |
| if opts.bad: |
| @@ -400,8 +388,34 @@ def main(): |
| context.good_revision = good_rev |
| context.bad_revision = bad_rev |
| + # Get recent revision list and check whether it's sufficient. |
| + all_revs_recent = map(int, ParseDirectoryIndexRecent(context)) |
| + all_revs_recent.sort() |
|
Nico
2011/07/21 16:17:31
I think you want
all_revs_recent = all_revs_re
jbates
2011/07/21 17:36:01
Done.
|
| + # Skipping 0 since it might be deleted off the server soon: |
| + oldest_recent_rev = all_revs_recent[1] |
|
Nico
2011/07/21 16:17:31
and then use [0] here
jbates
2011/07/21 17:36:01
Done.
|
| + if good_rev >= oldest_recent_rev: |
| + # The range is within recent builds, so switch on use_recent. |
| + context.use_recent = True |
| + elif bad_rev >= oldest_recent_rev: |
| + # The range spans both old and recent builds. |
| + # If oldest_recent_rev is good, we bisect the recent builds. |
| + context.use_recent = True # set True to test recent build |
|
Nico
2011/07/21 16:17:31
Remove comment
jbates
2011/07/21 17:36:01
Done.
|
| + TryRevision(context, oldest_recent_rev, opts.profile, args) |
| + if AskIsGoodBuild(oldest_recent_rev): |
| + # context.use_recent is True |
| + context.good_revision = oldest_recent_rev |
| + else: |
| + context.use_recent = False |
| + context.bad_revision = oldest_recent_rev |
| + |
| + all_revs = [] |
| + if context.use_recent: |
| + all_revs = all_revs_recent |
|
Nico
2011/07/21 16:17:31
This includes 0 -- probably not intentional? (henc
jbates
2011/07/21 17:36:01
0 would be filtered out before bisecting, but I li
|
| + else: |
| + all_revs = map(int, ParseDirectoryIndex(context)) |
| + |
| # Get a list of revisions to bisect across. |
| - revlist = GetRevList(context) |
| + revlist = GetRevList(context, all_revs) |
| if len(revlist) < 2: # Don't have enough builds to bisect |
| print 'We don\'t have enough builds to bisect. revlist: %s' % revlist |
| sys.exit(1) |