Bug 46407 - Allow rebaselines for webkit-patch rebaseline to be chosen
Summary: Allow rebaselines for webkit-patch rebaseline to be chosen
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other All
: P2 Normal
Assignee: Mihai Parparita
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-23 14:38 PDT by Mihai Parparita
Modified: 2010-09-24 18:36 PDT (History)
4 users (show)

See Also:


Attachments
Patch (4.00 KB, patch)
2010-09-23 14:39 PDT, Mihai Parparita
no flags Details | Formatted Diff | Diff
Patch (4.89 KB, patch)
2010-09-24 16:02 PDT, Mihai Parparita
no flags Details | Formatted Diff | Diff
Patch (5.09 KB, patch)
2010-09-24 16:14 PDT, Mihai Parparita
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mihai Parparita 2010-09-23 14:38:12 PDT
Allow rebaselines for webkit-patch rebaseline to be chosen
Comment 1 Mihai Parparita 2010-09-23 14:39:06 PDT
Created attachment 68594 [details]
Patch
Comment 2 Mihai Parparita 2010-09-23 14:39:37 PDT
Adam or Eric, can you review?
Comment 3 WebKit Review Bot 2010-09-23 14:40:25 PDT
Attachment 68594 [details] did not pass style-queue:

Failed to run "['WebKitTools/Scripts/check-webkit-style']" exit_code: 1
WebKitTools/Scripts/webkitpy/tool/commands/rebaseline.py:77:  whitespace before ']'  [pep8/E202] [5]
Total errors found: 1 in 3 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 4 Adam Barth 2010-09-24 12:20:49 PDT
Comment on attachment 68594 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=68594&action=review

Good idea.  I'd prefer if we could avoid adding more command line arguments.  They add complexity, especially for commands that aren't used that often.

> WebKitTools/Scripts/webkitpy/common/system/user.py:77
> -        result = int(cls.prompt("Enter a number: ")) - 1
> -        return list_items[result]
> +        if can_choose_multiple:
> +            response = cls.prompt("Enter one or more numbers (comma-separated): ")
> +            indices = [int(r) - 1 for r in re.split("\s*,\s*", response)]
> +            return [list_items[i] for i in indices]
> +        else:
> +            result = int(cls.prompt("Enter a number: ")) - 1
> +            return list_items[result]

Do we want better error handling if the user doesn't enter an int?

> WebKitTools/Scripts/webkitpy/tool/commands/rebaseline.py:115
> +        if options.choose_rebaselines:
> +            tests_to_update = self._tool.user.prompt_with_list("Which test(s) to rebaseline:", tests_to_update, can_choose_multiple=True)

Rather than making it a command-line option, can we just have prompt_with_list+can_choose_multiple make it easy to choose all?  Maybe the empty string is how you choose all?
Comment 5 Adam Barth 2010-09-24 12:22:16 PDT
Alternatively, the string "all" could mean choose all.
Comment 6 Mihai Parparita 2010-09-24 16:02:20 PDT
Created attachment 68779 [details]
Patch
Comment 7 Mihai Parparita 2010-09-24 16:02:54 PDT
(In reply to comment #5)
> Alternatively, the string "all" could mean choose all.

I like that. Also added basic validation (and a test).
Comment 8 Adam Barth 2010-09-24 16:06:54 PDT
Comment on attachment 68779 [details]
Patch

Great.  Thanks!
Comment 9 Eric Seidel (no email) 2010-09-24 16:07:50 PDT
Comment on attachment 68779 [details]
Patch

Interesting.  I had assumed that users would just git revert ones they didn't want to change. But this works too.  I like the new features in prompt_with_list.  I'm torn as to if raw_input should have been mocked through the use of an instance method on User instead of a parameter to the function.

In general looks fine.  Yay tests!

What does enter do?  Seems we should test the empty input string/default value too.  I would expect enter to just do "all" in the case of rebaseline tool.
Comment 10 Mihai Parparita 2010-09-24 16:14:21 PDT
(In reply to comment #9)
> (From update of attachment 68779 [details])
> Interesting.  I had assumed that users would just git revert ones they didn't want to change.

My usecase was that I was trying to be a good citizen and updatet the baselines for Windows for a test I had just changed. The Windows bot often has lots of other failing tests, so it was annoying to revert all baselines that got downloaded except for the one that I was interested in.

> But this works too.  I like the new features in prompt_with_list.  I'm torn as to if raw_input should have been mocked through the use of an instance method on User instead of a parameter to the function.

But prompt and prompt_with_list are both class methods (not sure if the FIXME above is still relevant).

> What does enter do?  Seems we should test the empty input string/default value too.  I would expect enter to just do "all" in the case of rebaseline tool.

Sure, I can do that.
Comment 11 Mihai Parparita 2010-09-24 16:14:53 PDT
Created attachment 68783 [details]
Patch
Comment 12 WebKit Commit Bot 2010-09-24 18:36:44 PDT
Comment on attachment 68783 [details]
Patch

Clearing flags on attachment: 68783

Committed r68317: <http://trac.webkit.org/changeset/68317>
Comment 13 WebKit Commit Bot 2010-09-24 18:36:49 PDT
All reviewed patches have been landed.  Closing bug.