Bug 26666

Summary: bugzilla-tool continues execution even if subcommands fail
Product: WebKit Reporter: Eric Seidel (no email) <eric>
Component: Tools / TestsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal    
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: OS X 10.5   
Attachments:
Description Flags
Make SCM.run_command smarter and use it more levin: review+

Description Eric Seidel (no email) 2009-06-23 17:24:34 PDT
bugzilla-tool continues execution even if subcommands fail

I've noticed in a couple places that bugzilla-tool will continue executing even if the underlying "git svn rebase" command fails (due to a conflict for instance).

This is bad, and we should make bugzilla-tool more robust against this kind of failure by throwing ScriptExceptions (that's what there designed for).

That will allow the eventual land-everything-in-the-commit-queue mode to work and recover from build/update failures, while still allowing normal usage to error out correctly.
Comment 1 Eric Seidel (no email) 2009-06-23 17:25:26 PDT
Created attachment 31760 [details]
Make SCM.run_command smarter and use it more


---
 2 files changed, 47 insertions(+), 49 deletions(-)
Comment 2 Dimitri Glazkov (Google) 2009-06-23 17:32:38 PDT
What the heck kind of bug number is that?
Comment 3 Eric Seidel (no email) 2009-06-23 17:58:27 PDT
Clearly bugzilla-tool ate from the tree of knowledge and must now be banished from the garden of goodness.
Comment 4 David Levin 2009-06-23 18:11:08 PDT
Comment on attachment 31760 [details]
Make SCM.run_command smarter and use it more

Only one comment:

> diff --git a/WebKitTools/Scripts/modules/scm.py b/WebKitTools/Scripts/modules/scm.py
> +    def run_command(command, cwd=None, input=None, raise_on_failure=True, return_exit_code=False):
> +        stdin = subprocess.PIPE if input else None
> +        process = subprocess.Popen(command, stdout=subprocess.PIPE, stdin=stdin, shell=True, cwd=cwd)
> +        output = process.communicate(input)[0].rstrip()
> +        exit_code = process.wait()
> +        if raise_on_failure and exit_code != 0:

Use:
        if raise_on_failure and exit_code:
Comment 5 Eric Seidel (no email) 2009-06-23 18:31:59 PDT
Committing to http://svn.webkit.org/repository/webkit/trunk ...
	M	WebKitTools/ChangeLog
	M	WebKitTools/Scripts/bugzilla-tool
	M	WebKitTools/Scripts/modules/scm.py
Committed r45026
http://trac.webkit.org/changeset/45026