\x89\x50\x4E\x47\x0D\x0A\x1A\x0A PNG  \x89\x50\x4E\x47\x0D\x0A\x1A\x0A  13\c@@sddlmZddlZddlZddlmZddlmZmZm Z m Z ddl m Z m Z mZmZmZmZmZdZdZd efd YZd Zd Zd ZdZdZdZdZdZdZdZ dZ!e"dZ#dZ$dZ%ej&dZ'dZ(dZ)fdZ*dZ+dZ,dZ-d Z.d!Z/d"Z0e1e1d#Z2e"e1e1d$Z3d%Z4e"d&Z5d'Z6dS((i(tabsolute_importNi(t_(tbinthextshorttwdirid(tencodingterrortobsutiltpycompattscmutilttxnutiltutils"bookmarks.active bookmarks.currentcC@s%tj|j|jd\}}|S(sHook so that extensions that mess with the store can hook bm storage. For core, this just handles wether we should see pending bookmarks or the committed ones. Other extensions (like share) may need to tweak this behavior further. t bookmarks(R t trypendingtroottvfs(trepotfptpending((s9/usr/lib64/python2.7/site-packages/mercurial/bookmarks.pyt _getbkfile$s!tbmstorecB@seZdZdZedZejdZdZdZdZ dZ dZ d Z d Z d Zdd Zd ZdZdZdZdZdZdZdZdZdZeddZRS(sStorage for bookmarks. This object should do all bookmark-related reads and writes, so that it's fairly simple to replace the storage underlying bookmarks without having to clone the logic surrounding bookmarks. This type also should manage the active bookmark, if any. This particular bmstore implementation stores bookmarks as {hash}\s{name} (the same format as localtags) in .hg/bookmarks. The mapping is stored as {name: nodeid}. c C@s||_i|_}i|_}t|_t|_|jj}t}y$t |}x|D]}|j }|s~q`ny|j dd\}} ||} | |kr"t j | } | || <|j| } | dkr| g|| RRt_delRR"R#R$R%(R0R?R8R9((s9/usr/lib64/python2.7/site-packages/mercurial/bookmarks.pyt_sets    cC@snt|_|jj|}|j|}t|dkr]|d|ksPt|j|=n |j|dS(Nii(R>RRtpopRR@R=tremove(R0R?R8R9((s9/usr/lib64/python2.7/site-packages/mercurial/bookmarks.pyRKs   cC@s|jj|gS(s@Return a sorted list of bookmarks pointing to the specified node(RR"(R0R8((s9/usr/lib64/python2.7/site-packages/mercurial/bookmarks.pytnamesscC@s|j|}|j|S(N(RR(R0R?R8((s9/usr/lib64/python2.7/site-packages/mercurial/bookmarks.pyt changectxs c C@s|jjd}x|D]\}}|jj|}|dkrS|j|n|j|||dk r|j|}|dk r|d}n||f||R)( R0R?tforcettargettcurRvtanctbmctxtbtdivst deletefromtdelbmst shadowhash((s9/usr/lib64/python2.7/site-packages/mercurial/bookmarks.pyt checkconflictsH ? 1      N(t__name__t __module__t__doc__R;tpropertyR<tsetterRARCRDRERFRGRHRIR#R"RLRKRORPRXRRRjRdR^RtR>R(((s9/usr/lib64/python2.7/site-packages/mercurial/bookmarks.pyR.s0  )                 cC@sd}y|jd}Wn,tk rG}|jtjkrCndSXzzyGtj|jpfdgd}|dks||krd}nWn,tk r}|jtjkrndSXWd|jX|S(s Get the active bookmark. We can have an active bookmark that updates itself as we commit. This function returns the name of that bookmark. It is stored in .hg/bookmarks.current sbookmarks.currenttiN( R#RR+R,R-RR!t readlinesRg(RtmarksR?tfileR:((s9/usr/lib64/python2.7/site-packages/mercurial/bookmarks.pyR./s$"   cC@s||j_|jjdS(s Set the given bookmark to be 'active', meaning that this bookmark will follow new commits that are made. The name is recorded in .hg/bookmarks.current N(RcR<Rd(RR?((s9/usr/lib64/python2.7/site-packages/mercurial/bookmarks.pytactivateNs cC@sd|j_|jjdS(s7 Unset the active bookmark in this repository. N(R#RcR<Rd(R((s9/usr/lib64/python2.7/site-packages/mercurial/bookmarks.pyt deactivateWs cC@sU|j}|j}g|djD]}|j^q#}||koT|||kS(s Tell whether the 'active' bookmark (the one that follows new commits) points to one of the parents of the current working directory (wdir). While this is normally the case, it can on occasion be false; for example, immediately after a pull, the active bookmark can be moved to point to a place different than the wdir. This is solved by running `hg update`. N(t_activebookmarkRcR#tparentsR8(RR?RtpR((s9/usr/lib64/python2.7/site-packages/mercurial/bookmarks.pytisactivewdirparent^s  )cC@sg}|j}g|D]8}|jddd|jdddkr|^q}xa|D]Y}|dks[d|krq[n|r[|||kr[||kr|j|qq[q[W|S(sZfind divergent versions of bm on nodes in deletefrom. the list of bookmark to delete.Ruii(RcR R$(RRtbmttodeleteRRt divergentR?((s9/usr/lib64/python2.7/site-packages/mercurial/bookmarks.pyRxls E  cC@s|jstdn|jjddd}g}xI|jjD]8\}}|jddd|krG|j|qGqGW|S(svGiven a repo with an active bookmark, return divergent bookmark nodes. Args: repo: A repository with an active bookmark. Returns: A list of binary node ids that is the full list of other revisions with bookmarks divergent from the active bookmark. If there were no divergent bookmarks, then this list will contain only one entry. s9headsforactive() only makes sense with an active bookmarkRuii(RR'R RcRDR$(RRUtheadsR?tn((s9/usr/lib64/python2.7/site-packages/mercurial/bookmarks.pytheadsforactive|s  cC@sdd\}}|j}t|r4|dj}n&|rZ|jtd||}n||fS(sReturn a tuple (activemark, movemarkfrom) indicating the active bookmark and where to move the active bookmark from, if needed.Rqsupdating to active bookmark %s N(NN(R#RRR8RzR(R(Rtcheckoutt movemarkfromt activemark((s9/usr/lib64/python2.7/site-packages/mercurial/bookmarks.pytcalculateupdates    c C@s|}|j}|j}|s"tSg}|||kr"||}g|D]A}|jddd|jdddkrI|j|^qI} |jj|jg} g| D]0}|j| ks||kr|j^q}t ||j||r"|j ||jfq"nx-t |||D]} |j | dfq5W|r|j 0|jd} |j|| |WdQXWdQXnt|S(NRuiitbookmark(RcR<R>R RPRRwRvR8RyR$RxR#tlockt transactionRXtbool( RRR8RRR<RTtnewRRRRRS((s9/usr/lib64/python2.7/site-packages/mercurial/bookmarks.pytupdates*    A= "cc@stt|di}|jj}xO|jD]A\}}||r+d|ks^|jdr+||fVq+q+WdS(NRcRu(tgetattrRthasnodeRDtendswith(RRRtktv((s9/usr/lib64/python2.7/site-packages/mercurial/bookmarks.pytlistbinbookmarkss  'cC@s7i}x*t|D]\}}t|||R#R8RXR(RtkeyRVRRSRtexistingRQ((s9/usr/lib64/python2.7/site-packages/mercurial/bookmarks.pyt pushbookmarks    cC@sO|rt|}n"t|}t|}||B}ggggggggf}|dj}|dj} |dj} |dj} |dj} |dj} |dj}|dj}xt|D]}}||kr||kr| |d ||fqG||d d fq||kr>||||d fq||}||}||krt||||fq||kr4||kr4||}||}|j|jkrt|||r| |||fq1| |||fqGt|||r| |||fqG| |||fq| |||fqW|S( sCompare bookmarks between srcmarks and dstmarks This returns tuple "(addsrc, adddst, advsrc, advdst, diverge, differ, invalid)", each are list of bookmarks below: :addsrc: added on src side (removed on dst side, perhaps) :adddst: added on dst side (removed on src side, perhaps) :advsrc: advanced on src side :advdst: advanced on dst side :diverge: diverge :differ: changed, but changeset referred on src is unknown on dst :invalid: unknown on both side :same: same on both side Each elements of lists in result tuple is tuple "(bookmark name, changeset ID on source side, changeset ID on destination side)". Each changeset IDs are 40 hexadecimal digit string or None. Changeset IDs of tuples in "addsrc", "adddst", "differ" or "invalid" list may be unknown for repo. If "targets" is specified, only bookmarks listed in it are examined. iiiiiiiiN(tsetR$RoR#RvRy(Rtsrcmarkstdstmarksttargetstbsett srcmarksett dstmarksettresultstaddsrctadddsttadvsrctadvdsttdivergetdiffertinvalidtsameRtscidtdcidtsctxtdctx((s9/usr/lib64/python2.7/site-packages/mercurial/bookmarks.pytcomparebookmarkssJ                   c C@s|dkrd}n|jdr9tj|j}nx[|jdD]J\}}|jdrytj|j}n||krId||fSqIWxGtddD]6}d||f}||ks|||kr|SqWd S( sReturn appropriate diverged bookmark for specified ``path`` This returns None, if it is failed to assign any divergent bookmark name. This reuses already existing one with "@number" suffix, if it refers ``remotenode``. RuRsfile:tpathss%s@%siids%s@%dN(t startswithR turltpatht configitemstrangeR#( R(RRt localmarkst remotenodeRtutxR((s9/usr/lib64/python2.7/site-packages/mercurial/bookmarks.pyt_diverge#s   cC@s7i}x*|jD]\}}t|||20sHcC@seg}xO|D]G\}}|s(t}n|jtj|t||j|q Wdj|S(smencode a '(bookmark, node)' iterable into a binary stream the binary format is: :node: is a 20 bytes binary node, :bookmark-length: an unsigned short, :bookmark-name: the name of the bookmark (of length ) wdirid (all bits set) will be used as a special value for "missing" R(RR$t _binaryentrytpackR@tjoin(R t binarydataRR8((s9/usr/lib64/python2.7/site-packages/mercurial/bookmarks.pyt binaryencodeHs  cC@stj}g}xtr|j|}t||kr[|rWtjtdnPntj|\}}|j|}t||kr|rtjtdqn|t krd}n|j ||fqW|S(sodecode a binary stream into an '(bookmark, node)' iterable the binary format is: :node: is a 20 bytes binary node, :bookmark-length: an unsigned short, :bookmark-name: the name of the bookmark (of length )) wdirid (all bits set) will be used as a special value for "missing" sbad bookmark streamN( RtsizeRtreadR@RR{RtunpackRR#R$(tstreamt entrysizetbookstentryR8tlengthR((s9/usr/lib64/python2.7/site-packages/mercurial/bookmarks.pyt binarydecode]s"    cC@sI|jd|j}t|||\}}} } } } } }|j}|j}|jddrt|j}}nt|}g}x|D]\}}}||kr|j|||td|fq||kr|j ||jtd|t |d fqqWx:| D]2\}}}|j|||td|fqW|j d|Dx| D]\}}}||kr|j ||j|||td |fqpt |||||}|r|j|||td ||ffqp|td |qpWxZ|| D]N\}}}||kr+|j ||j|||td |fq+q+WxZ| D]R\}}}||kr|j ||jtd|t |d fqqW|rE|}g}x=t|D]/\}}}}|j||f||qW|j|||ndS( Nschecking for updated bookmarks R(tquietbookmarkmovesadding remote bookmark %s s0remote bookmark %s points to locally missing %s i supdating bookmark %s cs@s|]}|dVqdS(iN((t.0R((s9/usr/lib64/python2.7/site-packages/mercurial/bookmarks.pys ssimporting bookmark %s s#divergent bookmark %s stored as %s sAwarning: failed to assign numbered name to divergent bookmark %s (tdebugRcRRzR)t configboolRR$RRNRtdifference_updateRfRRoRX(R(Rt remotemarksRttrfunctexplicitRRRRRRRRRRzR)tchangedRRRtdbRSRQR8twritertmsg((s9/usr/lib64/python2.7/site-packages/mercurial/bookmarks.pytupdatefromremote|sd  *                c @s|jtd|j,}t|jdidd6j}WdQXt|||j}|\}}}} } } } } g|jrdn d|j rfd}nfd }x3|D]+\}}}||t |td qWx3|D]+\}}}||t |td qWx3| D]+\}}}||t |td qGWx3| D]+\}}}||t |td q}Ws|jtddSx!t D]}|j |qWdS(s/Show bookmarks incoming from other to repo s searching for changed bookmarks tlistkeysR t namespaceNcS@s|S(N((tid((s9/usr/lib64/python2.7/site-packages/mercurial/bookmarks.pytscS@s|d S(Ni ((R((s9/usr/lib64/python2.7/site-packages/mercurial/bookmarks.pyRsc@s$jd|||fdS(Ns %-25s %s %s (R$(RRtst(tgetidt incomings(s9/usr/lib64/python2.7/site-packages/mercurial/bookmarks.pytaddsc@s!jd||fdS(Ns %-25s %s (R$(RRR(RR(s9/usr/lib64/python2.7/site-packages/mercurial/bookmarks.pyRstaddedtadvancedtdivergedRsno changed bookmarks found ii( RzRtcommandexecutorRt callcommandtresultRRct debugflagtverboseRRoRk(R(RtpeerteRtrRRRRRRRRRRRRts((RRs9/usr/lib64/python2.7/site-packages/mercurial/bookmarks.pytincomings6        c@s|jtdt|jd}t||j|}|\}}}}} } } } g|jrvdn d|jrfd} nfd} x3|D]+\}}}| |t|tdqWx1|D])\}}}| |dd td qWx3|D]+\}}}| |t|td q Wx3| D]+\}}}| |t|td qVWx3| D]+\}}}| |t|td qWs|jtddSx!t D]}|j |qWdS(s/Show bookmarks outgoing from repo to other s searching for changed bookmarks R cS@s|S(N((R((s9/usr/lib64/python2.7/site-packages/mercurial/bookmarks.pyRscS@s|d S(Ni ((R((s9/usr/lib64/python2.7/site-packages/mercurial/bookmarks.pyRsc@s$jd|||fdS(Ns %-25s %s %s (R$(RRR(Rt outgoings(s9/usr/lib64/python2.7/site-packages/mercurial/bookmarks.pyRsc@s!jd||fdS(Ns %-25s %s (R$(RRR(RR (s9/usr/lib64/python2.7/site-packages/mercurial/bookmarks.pyRsRRi(tdeletedRRRsno changed bookmarks found ii( RzRRRRRcRRRRoRk(R(RtotherRRRRRRRRRRRRRRR((RR s9/usr/lib64/python2.7/site-packages/mercurial/bookmarks.pytoutgoings6        c C@s|j,}t|jdidd6j}WdQXt|||j}|\}}}}} } } } t|t|fS(sCompare bookmarks between repo and other for "hg summary" output This returns "(# of incoming, # of outgoing)" tuple. RR RN(RRRRRRcR@( RRRRRRRRRRRRR((s9/usr/lib64/python2.7/site-packages/mercurial/bookmarks.pytsummarys cC@se|j}||krtS|s&tS|jrT|jtj||jgkS|j|SdS(s?Is the new bookmark destination a valid update from the old oneN(t unfilteredR>RtobsstoreR8Rt foregroundt isancestorof(RRVR((s9/usr/lib64/python2.7/site-packages/mercurial/bookmarks.pyRy"s   %cC@sA|j}|s*tjtdntj||d|S(svreturn a valid version of a potential bookmark name Raises an abort error if the bookmark name is not valid. s4bookmark names cannot consist entirely of whitespaceR(RRR{RR t checknewlabel(RR?((s9/usr/lib64/python2.7/site-packages/mercurial/bookmarks.pyt checkformat2s  cC@s|j}g}xe|D]]}||krDtjtd|n||jkr`t|n|j|dfqW|j|||dS(s]remove a mark from the bookmark store Raises an abort error if mark does not exist. sbookmark '%s' does not existN( RcRR{RRRR$R#RX(RRSRORRQR?((s9/usr/lib64/python2.7/site-packages/mercurial/bookmarks.pytdelete>s    c C@s|j}t||}||kr@tjtd|ng}x-|j||D]} |j| dfqYW|j|||f|dfg|j ||||j |kr| rt ||ndS(srename a bookmark from old to new If force is specified, then the new name can overwrite an existing bookmark. If inactive is specified, then do not activate the new bookmark. Raises an abort error if old is not in the bookmark store. sbookmark '%s' does not existN( RcRRR{RRR$R#textendRXRR( RRSRVRRtinactiveRR?RQR((s9/usr/lib64/python2.7/site-packages/mercurial/bookmarks.pytrenameMs  #cC@s|j}|dj}d}g} d} |rLtj||gd}nx|D]} t|| } |dkr}| }n|r| |jkrt|dS|} |rtj||} | j r| j d } n| j} nx0|j | || D]}| j |dfqW| j | | fqSW| r|j jtd| | jrtj|d| | }|j jd|qn|j||| | r|||kr| rt||n(|| kr||jkrt|ndS(s$add a list of bookmarks If force is specified, then the new name can overwrite an existing bookmark. If inactive is specified, then do not activate any bookmark. Otherwise, the first bookmark is activated. Raises an abort error if old is not in the bookmark store. RqtnowarnNi s bookmarking hidden changeset %s s%ss(%s) (RcR8R#R tunhidehashlikerevsRRRt revsinglethiddenRRR$R(R)RtobsoleteRt_getfilteredreasonRXR(RRSRORvRRRRtnewactRQt hiddenrevR?ttgttctxRR((s9/usr/lib64/python2.7/site-packages/mercurial/bookmarks.pyt addbookmarkscsB       c C@s6|j}t|dkr=|jr=|jtdnxt|jD]\}\}}}|j|jd||j s|j d|d|n|j dd|d|dd t j |} |j|j d | d |jj|||d||jd t|k|j d qPWdS(sprivate method to print bookmarks Provides a way for extensions to control how bookmarks are printed (e.g. prepend or postpend names) isno bookmarks set Rs %s tlabelRs%sRisrev nodes %d:%sR<s N(thexfuncR@tisplainRzRRoRDt startitemtcontexttquietRZRkRtcolwidtht condwriteRRvtdatatactivebookmarklabel( R(RtfmtbmarksthexfntbmarkRtprefixR#tpad((s9/usr/lib64/python2.7/site-packages/mercurial/bookmarks.pyt_printbookmarkss (  "c C@s|j}i}x|p|D]v}||krJtjtd|n|j}||krodt}} n d\}} |||| f||RR"R3R5R7(((s9/usr/lib64/python2.7/site-packages/mercurial/bookmarks.pytsL  "4          L     = . -   3