³ò KKc@sËddkZddkZddkZddkZddklZddkiZddkl Z ddk l Z ddk l Z ddklZddklZddklZlZdd klZdd klZd efd „ƒYZd efd„ƒYZde fd„ƒYZde fd„ƒYZdefd„ƒYZde fd„ƒYZdefd„ƒYZde fd„ƒYZ defd„ƒYZ!defd„ƒYZ"defd „ƒYZ#dS(!iÿÿÿÿN(t make_option(t parse_bug_id(tAbstractSequencedCommand(tbug_comment_from_svn_revision(t CommitterList(t pluralize(terrortlog(tMock(tAbstractDeclarativeCommandtCommitMessageForCurrentDiffcBseZdZdZd„ZRS(scommit-messages;Print a commit message suitable for the uncommitted changescCs5ti|iƒiƒd|iƒiƒiƒGHdS(Ns%s(tostchdirtscmt checkout_roottcommit_message_for_this_committmessage(tselftoptionstargsttool((sR/usr/local/google/WebKitToT/WebKit/WebKitTools/Scripts/webkitpy/commands/upload.pytexecute5s(t__name__t __module__tnamet help_textR(((sR/usr/local/google/WebKitToT/WebKit/WebKitTools/Scripts/webkitpy/commands/upload.pyR 1stAssignToCommittercBs&eZdZdZd„Zd„ZRS(sassign-to-committers9Assign bug to whoever attached the most recent r+'d patchc Cstƒ}|iii|ƒ}|iƒ}||iiijo(td|||i|ƒfƒdSn|iii|ƒ}|ptd|ƒdSn|d}|d}|i|ƒ}|ptd||fƒdSnd|d|i f} |iii ||i ƒ| ƒdS(Ns&Bug %s is already assigned to %s (%s).s-Bug %s has no non-obsolete patches, ignoring.iÿÿÿÿtattacher_emailsCAttacher %s is not a committer. Bug %s likely needs commit-queue+.sTAttachment %s was posted by a committer and has review+, assigning to %s for commit.tid( RRtbugst fetch_bugtassigned_to_emailtunassigned_emailRtcommitter_by_emailtfetch_reviewed_patches_from_bugt full_namet reassign_bugtbugzilla_email( Rtbug_idt committerstbugRtreviewed_patchest latest_patchRt committertreassign_message((sR/usr/local/google/WebKitToT/WebKit/WebKitTools/Scripts/webkitpy/commands/upload.pyt"_assign_bug_to_last_patch_attacher>s$     cCs.x'|iiiƒD]}|i|ƒqWdS(N(Rtqueriest&fetch_bug_ids_from_pending_commit_listR-(RRRRR&((sR/usr/local/google/WebKitToT/WebKit/WebKitTools/Scripts/webkitpy/commands/upload.pyRUs(RRRRR-R(((sR/usr/local/google/WebKitToT/WebKit/WebKitTools/Scripts/webkitpy/commands/upload.pyR:s tObsoleteAttachmentscBs/eZdZdZdZeigZd„ZRS(sobsolete-attachmentss)Mark all attachments on a bug as obsoletetBUGIDcCsh|ddR4tPromptForBugOrTitlet CreateBugtPrepareChangeLogR2(((sR/usr/local/google/WebKitToT/WebKit/WebKitTools/Scripts/webkitpy/commands/upload.pyRB„s tUploadcBseeZdZdZdZeZeiei ei ei ei ei eieigZdZd„ZRS(tuploads5Automates the process of uploading a patch for reviews[BUGID]s–upload uploads the current diff to bugs.webkit.org. If no bug id is provided, upload will create a bug. If the current diff does not have a ChangeLog, upload will prepare a ChangeLog. Once a patch is read, upload will open the ChangeLogs for editing using the command in the EDITOR environment variable and will display the diff using the command in the PAGER environment variable.cCs#h}|i|||ƒ|d<|S(NR&(R:(RRRRR9((sR/usr/local/google/WebKitToT/WebKit/WebKitTools/Scripts/webkitpy/commands/upload.pyR2«s(RRRRR3R=R>R4R?RDRERFt EditChangeLogR@R5RAt long_helpR2(((sR/usr/local/google/WebKitToT/WebKit/WebKitTools/Scripts/webkitpy/commands/upload.pyRG”s tEditChangeLogscBs&eZdZdZeZeigZRS(sedit-changelogss$Opens modified ChangeLogs in $EDITOR(RRRRR=R>R4RI(((sR/usr/local/google/WebKitToT/WebKit/WebKitTools/Scripts/webkitpy/commands/upload.pyRK±st PostCommitscBs>eZdZdZdZd„Zd„Zd„Zd„ZRS(s post-commitss6Attach a range of local commits to bugs as patch filest COMMITISHc Cs§tddddddddd d ƒtd dd dd dtd dƒtddddddddd dƒtiitiitiig}ti|d|dt ƒdS(Ns-bs--bug-idtactiontstorettypetstringtdestR&thelps7Specify bug id if no URL is provided in the commit log.s--add-log-as-commentt store_truetadd_log_as_commenttdefaults=Add commit log message as a comment when uploading the patch.s-ms --descriptiont descriptionsPDescription string for the attachment (default: description from commit message)Rtrequires_local_commits( RtFalseR4tOptionstobsolete_patchestreviewtrequest_commitR t__init__R=(RR((sR/usr/local/google/WebKitToT/WebKit/WebKitTools/Scripts/webkitpy/commands/upload.pyR^¿s$!$  cCsMd}|io9|idtƒ}|d7}||iƒi|ƒ7}n|S(Ntlstrips--- (tNoneRUtbodyR=R t files_changed_summary_for_commit(RRtcommit_messageRt commit_idt comment_text((sR/usr/local/google/WebKitToT/WebKit/WebKitTools/Scripts/webkitpy/commands/upload.pyt_comment_text_for_commitÊs   cCs"|iƒi|ƒ}ti|ƒS(N(R tcreate_patch_from_local_committStringIO(RRRdR7((sR/usr/local/google/WebKitToT/WebKit/WebKitTools/Scripts/webkitpy/commands/upload.pyt_diff_file_for_commitÒsc Cs—|iƒi|ƒ}t|ƒdjo!tdtdt|ƒƒƒntƒ}x>|D]6}|iƒi|ƒ}|ip,t|i ƒƒpt|iƒi |ƒƒ}|pt d|ƒqYn|i oF||jo9h|d<} t i||ƒi| ƒ|i|ƒn|i||ƒ} |ip|idtdtƒ} |i||||ƒ} |ii|| | | d|id |iƒqYWdS( Ni sdwebkit-patch does not support attaching %s at once. Are you sure you passed the right commit range?tpatchsBSkipping %s: No bug id found in commit or specified with --bug-id.R&R_t strip_urltmark_for_reviewtmark_for_commit_queue(R t#commit_ids_from_commitish_argumentstlenRRtsettcommit_message_for_local_commitR&RRRgRR[R4R5truntaddRiRWR=RfRtadd_patch_to_bugR\R]( RRRRt commit_idsthave_obsoleted_patchesRdRcR&R9t diff_fileRWRe((sR/usr/local/google/WebKitToT/WebKit/WebKitTools/Scripts/webkitpy/commands/upload.pyRÖs&! 8"( RRRRR3R^RfRiR(((sR/usr/local/google/WebKitToT/WebKit/WebKitTools/Scripts/webkitpy/commands/upload.pyRLºs  t MarkBugFixedcBs>eZdZdZdZd„Zd„Zd„Zd„ZRS(smark-bug-fixedsMark the specified bug as fixeds[SVN_REVISION]c Cs¡tddddddddd ƒtd dddddd dd ƒtd dddtddddƒtddddtddddƒg}ti|d|ƒdS(Ns--bug-idRNRORPRQRRR&RSs7Specify bug id if no URL is provided in the commit log.s --commenttcommentsText to include in bug comment.s--openRTRVtopen_bugs+Open bug in default web browser (Mac only).s --update-onlyt update_onlys,Add comment to the bug, but do not close it.R(RRYR R^(RR((sR/usr/local/google/WebKitToT/WebKit/WebKitTools/Scripts/webkitpy/commands/upload.pyR^ôs !!!'cCs.|p|iƒiƒSn|iƒi|ƒS(N(R tlast_svn_commit_logtsvn_commit_log(RRt svn_revision((sR/usr/local/google/WebKitToT/WebKit/WebKitTools/Scripts/webkitpy/commands/upload.pyt_fetch_commit_logýscCsé|i||ƒ}|pt|ƒ}n|p6tid|tiƒ}|o|idƒ}qfn| p| oig}|p|idƒn|p|idƒntddi|ƒ|o d|ndfƒn||fS( Ns^r(?P\d+) \|R~sbug ids svn revisions+Could not find %s on command-line or in %s.s or sr%ss last commit( RRtretsearcht MULTILINEtgrouptappendRtjoin(RRR&R~t commit_logtmatcht not_found((sR/usr/local/google/WebKitToT/WebKit/WebKitTools/Scripts/webkitpy/commands/upload.pyt"_determine_bug_id_and_svn_revisions -cCsÁ|i}|o|d}|oPtid|tiƒo|d}ntid|ƒptd|ƒqqnt}| p| o%t}|i|||ƒ\}}ntd|i i |ƒ|i i |ƒdfƒtd|ƒ|i o |i i|i i |ƒƒn|o%|i id ƒptdƒq@nt|ƒ}|iod |i|f}n|io%td |ƒ|i i||ƒn"td |ƒ|i i||ƒdS( Nis ^r[0-9]+$is^[0-9]+$sInvalid svn revision: '%s's Bug: <%s> %sttitles Revision: %ssIs this correct?s%s %ssAdding comment to Bug %s.s7Adding comment to Bug %s and marking as Resolved/Fixed.(R&R€R‡t IGNORECASERRYR=R‰RRtbug_url_for_bug_idtfetch_bug_dictionaryRztusertopen_urltconfirmtexitRRyR{tpost_comment_to_bugtclose_bug_as_fixed(RRRRR&R~t needs_promptt bug_comment((sR/usr/local/google/WebKitToT/WebKit/WebKitTools/Scripts/webkitpy/commands/upload.pyRs4 0     ( RRRRR3R^RR‰R(((sR/usr/local/google/WebKitToT/WebKit/WebKitTools/Scripts/webkitpy/commands/upload.pyRxðs  REcBsGeZdZdZdZd„Zd„Zd„Zd„Zd„Z RS(s create-bugs0Create a bug from local changes or local commitss [COMMITISH]cCs’tiitiitddddddtddƒtd dddd dtdd ƒtd dd dddtddƒg}ti|d|ƒdS(Ns --no-promptRNt store_falseRRtpromptRVRSs@Do not prompt for bug title and comment; use commit log instead.s --no-reviewR\s!Do not mark the patch for review.s--request-commitRTR]s3Mark the patch as needing auto-commit after review.R( R4RZtcct componentRR=RYR R^(RR((sR/usr/local/google/WebKitToT/WebKit/WebKitTools/Scripts/webkitpy/commands/upload.pyR^Cs   !!'c Cs†|iƒi|ƒ}t|ƒdjotdt|ƒƒn|d}d}d}|io|iƒ\}}nc|iƒi|ƒ}|idtdtƒ}|i dtƒ}|d7}||iƒi |ƒ7}|iƒi |ƒ} t i | ƒ} |i i|||i| dd |id |id |iƒ} | oCt|ƒd jo0| |_t|_ti|||d |ƒndS( Nis8Are you sure you want to create one bug with %s patches?itR_Rks--- tPatchR˜RlRmi(R RnRoRR—t prompt_for_bug_title_and_commentRqRWR=RaRbRgRhRt create_bugR™R˜R\R]R&RYR[RLR( RRRRRuRdt bug_titleReRcR7RwR&((sR/usr/local/google/WebKitToT/WebKit/WebKitTools/Scripts/webkitpy/commands/upload.pytcreate_bug_from_commitMs(   <  c CsÉd}d}|io|iƒ\}}n=|iƒiƒ}|idtdtƒ}|idtƒ}|iƒiƒ}ti|ƒ}|i i |||i |dd|i d|i d|iƒ} dS(NRšR_RkR›R˜RlRm(R—RœR RRWR=RaR8RhRRR™R˜R\R]( RRRRRžReRcR7RwR&((sR/usr/local/google/WebKitToT/WebKit/WebKitTools/Scripts/webkitpy/commands/upload.pytcreate_bug_from_patchis cCsitdƒ}dGHtiiƒ}ytiidtiƒWntj onXdi|ƒ}||fS(Ns Bug title: s*Bug comment (hit ^D on blank line to end):iRš( t raw_inputtsyststdint readlinestseekR tSEEK_ENDtIOErrorR…(RRžtlinesRe((sR/usr/local/google/WebKitToT/WebKit/WebKitTools/Scripts/webkitpy/commands/upload.pyRœws cCs\t|ƒo8|iƒiƒptdƒn|i|||ƒn|i|||ƒdS(NsEExtra arguments not supported; patch is taken from working directory.(RoR tsupports_local_commitsRRŸR (RRRR((sR/usr/local/google/WebKitToT/WebKit/WebKitTools/Scripts/webkitpy/commands/upload.pyR†s  ( RRRRR3R^RŸR RœR(((sR/usr/local/google/WebKitToT/WebKit/WebKitTools/Scripts/webkitpy/commands/upload.pyRE>s   ($R R€RhR¢toptparseRtwebkitpy.stepsR4twebkitpy.bugzillaRt*webkitpy.commands.abstractsequencedcommandRtwebkitpy.commentsRtwebkitpy.committersRtwebkitpy.grammarRtwebkitpy.webkit_loggingRRt webkitpy.mockRtwebkitpy.multicommandtoolR R RR0R6R;RBRGRKRLRxRE(((sR/usr/local/google/WebKitToT/WebKit/WebKitTools/Scripts/webkitpy/commands/upload.pyss0         6N