mò óRÅDc@svdkTdklZdkTeeƒdƒd ad„Z de fd„ƒYZ de fd„ƒYZ d d„Z d S( (t*(sgettexts#mercurial:templater,util os re timecCsdditt|ƒƒdS(Nt(t,t)(tjointmaptstrtids(R((t2/usr/lib/python2.4/site-packages/hgext/bugzilla.pytbuglist>st bugzilla_2_16cBsVtZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z RS( s"support for bugzilla version 2.16.c Cs‰||_|iidddƒ}|iidddƒ}|iiddƒ}|iidddƒ}t|iiddd ƒƒ}|iidd ƒ}|o|ii |ƒn|ii t d ƒ|||d t |ƒfƒtid|d|d |d|d|ƒ|_|iiƒ|_|idƒ|iiƒ}t |ƒdjotit dƒƒ‚n|dd|_h|_dS(Ntbugzillathostt localhosttusertbugstpasswordtdbttimeoutitusermaps'connecting to %s:%s as %s, password %s Rtpasswdtconnect_timeouts5select fieldid from fielddefs where name = "longdesc"isunknown database schemai(tuitselftconfigR RRRtintRRt readconfigtnotet_tlentMySQLdbtconnecttconntcursortruntfetchallRtutiltAbortt longdesc_idtuser_ids( RRRRRRR RR((Rt__init__Ds& 0 cOsy|iitdƒ||fƒy|ii||ŽWn;ti j o,}|iitdƒ||fƒ‚nXdS(s run a query.s query: %s %s sfailed query: %s %s N( RRRRtargstkwargsR!texecuteRt MySQLErrorterr(RR)R*R-((RR"Zs  cCsS|idt|ƒƒg}|iiƒD]}||dq+~}|iƒ|S(s&filter not-existing bug ids from list.s*select bug_id from bugs where bug_id in %siN( RR"R Rt_[1]R!R#tctsort(RRR.R/((Rtfilter_real_bug_idscs . cCsŸ|idt|ƒt|ƒfƒti|ƒ}xP|i i ƒD]?\}|i i tdƒ|t|ƒfƒ|i|dƒqBW|iƒ}|iƒ|S(s>filter bug ids from list that already refer to this changeset.s]select bug_id from longdescs where bug_id in %s and thetext like "%%%s%%"s(bug %d already knows about changeset %s N(RR"R RtshorttnodetdicttfromkeystunknownR!R#tidRtstatusRtpoptNonetkeysR0(RR3RR6R7((Rtfilter_unknown_bug_idsjs# &  cCsã|iitdƒƒx°|D]¨}|iitdƒ|ƒ|iidddƒ|}ti d|ƒ}|i ƒ}|i ƒ}|o:|ii|ƒtitdƒti|ƒdƒ‚qqW|iitd ƒƒd S( stell bugzilla to send mail.stelling bugzilla to send mail: s bug %s R tnotifys@cd /var/www/html/bugzilla && ./processmail %s nobody@nowhere.coms (%s) 2>&1sbugzilla notify command %sisdone N(RRR8RRR7RtcmdtostpopentfptreadtouttclosetrettwarnR$R%t explain_exit(RRRAR>RER7RC((RR=ys   .cCsÐy|i|SWnºtj o®yt|ƒ}Wnƒtj ow|iit dƒ|ƒ|i d|ƒ|i i ƒ}t|ƒdjot|ƒ‚nt|ddƒ}nX||i|<|SnXdS(s!look up numeric bugzilla user id.slooking up user %s sPselect userid from profiles where login_name like %siiN(RR'RtKeyErrorRtuseridt ValueErrorRRRR"R!R#tallR(RRRKRI((Rt get_user_id‹s cCsHxA|iidƒD]-\}}|iƒ|iƒjo|SqqW|S(s,map name of committer to bugzilla user name.RN(RRt configitemst committertbzusertlowerR(RRRNRO((Rt map_committers   cCs|i|ƒ}y|i|ƒ}Wn”tj oˆyL|iiddƒ}|pt i t dƒ|ƒ‚n|i|ƒ}Wq¹tj o&t i t dƒ||fƒ‚q¹XnXt idƒ}|id||||fƒ|id||||ifƒdS( smadd comment to bug. try adding comment as committer of changeset, otherwise as default bugzilla user.R ROs#cannot find bugzilla user id for %ss)cannot find bugzilla user id for %s or %ss%Y-%m-%d %H:%M:%Ssvinsert into longdescs (bug_id, who, bug_when, thetext) values (%s, %s, %s, %s)sfinsert into bugs_activity (bug_id, who, bug_when, fieldid) values (%s, %s, %s, %s)N(RRQRNRRLRIRHRRt defaultuserR$R%RttimetstrftimetnowR"tbugidttextR&(RRVRWRNRRRIRRU((Rt add_comment¤s")  ( t__name__t __module__t__doc__R(R"R1R<R=RLRQRX(((RR As       R cBs\tZhde