\x89\x50\x4E\x47\x0D\x0A\x1A\x0A PNG  \x89\x50\x4E\x47\x0D\x0A\x1A\x0A  13\c@@sdZddlmZddlZddlZddlZddlZddlmZddl m Z m Z m Z m Z mZmZmZmZmZmZmZmZmZmZddlmZmZmZiZejeZdZdZdZ d Z!iej"e 6Z#d Z$d Z%d Z&d Z'dZ(dZ)dZ*dZ+dZ,dZ-dZ.dej/ddfdYZ0de1fdYZ2d(Z3edd)d*gge j5D]Z6e6d$e3kre6^qd%d&ej7d'Z8dS(+strack previous positions of bookmarks (EXPERIMENTAL) This extension adds a new command: `hg journal`, which shows you where bookmarks were previously located. i(tabsolute_importN(t_(t bookmarkstcmdutiltdispatchtencodingterrort extensionsthgt localrepotlockt logcmdutiltnodetpycompatt registrartutil(tdateutiltprocutilt stringutilsships-with-hg-coretbookmarkt wdirparentcC@sitjtdttjtjdttjtj dt tjt dt tjt dt dS(Nt runcommandt_writetdirstatet postsharet copystore(Rt wrapfunctionRRRtbmstoretrecordbookmarkst wrapfilecacheR tlocalrepositoryt wrapdirstateRt wrappostsharetunsharejournal(tui((s3/usr/lib64/python2.7/site-packages/hgext/journal.pytextsetupCs cC@s`|jr\t||_|jjdtj|d\}}|r\t||q\ndS(Nt namejournalR(tlocaltjournalstoragetjournalt_wlockfreeprefixtaddR t isfilecachedt_setupdirstate(R"trepoRtcached((s3/usr/lib64/python2.7/site-packages/hgext/journal.pyt reposetupKs  cG@s#tj|||||||S(s;Track the command line options for recording in the journal(R&t recordcommand(torigtluiR,tcmdtfullargstargs((s3/usr/lib64/python2.7/site-packages/hgext/journal.pyRWs cC@s |j|_|jdtdS(NR'(R'R&taddparentchangecallbacktrecorddirstateparents(R,R((s3/usr/lib64/python2.7/site-packages/hgext/journal.pyR+\s cC@s2||}tj|dr.t||n|S(s5Make journal storage available to the dirstate objectR'(Rt safehasattrR+(R0R,R((s3/usr/lib64/python2.7/site-packages/hgext/journal.pyRas cC@st|}t|}tj|dr|dtjkrG|d n|}|dtjkrj|d n|}|jjtd||ndS(s3Records all dirstate parent changes in the journal.R&it.N(tlistRR7R tnullidR&trecordtwdirparenttype(Rtoldtnewt oldhashest newhashes((s3/usr/lib64/python2.7/site-packages/hgext/journal.pyR6hs  ## cC@s|j}tj|drtj|}xZ|jD]I\}}|j|tj}||kr7|j j t |||q7q7Wn|||S(s,Records all bookmark changes in the journal.R'( t_repoRR7RRt iteritemstgetR R:R'R;t bookmarktype(R0tstoretfpR,toldmarkstmarktvaluetoldvalue((s3/usr/lib64/python2.7/site-packages/hgext/journal.pyRts  #cC@sVy t|jjdjSWn/tk rQ}|jtjkrJntSXdS(s,A set of shared features for this repositorytsharedN(tsettvfstreadt splitlinestIOErrorterrnotENOENT(R,tinst((s3/usr/lib64/python2.7/site-packages/hgext/journal.pyt_readsharedfeaturess  co@s|jdt}g|D]}t|^q}i}xKt|D]=\}}yt|||g||sRU(tpathRKRR7RtsharedreposourceRTRMtexiststjointrenameR't_opentFalseRbtminR( R0R"R,trepopatht sharedrepot journalpathtstorageR%RKtentry((Rns3/usr/lib64/python2.7/site-packages/hgext/journal.pyR!s  (t journalentryu journalentryu9timestamp user command namespace name oldhashes newhashescB@s5eZdZedZdZejeZRS(sIndividual journal entry * timestamp: a mercurial (time, timezone) tuple * user: the username that ran the command * namespace: the entry namespace, an opaque string * name: the name of the changed item, opaque string with meaning in the namespace * command: the hg command that triggered this record * oldhashes: a tuple of one or more binary hashes for the old location * newhashes: a tuple of one or more binary hashes for the new location Handles serialisation from and to the storage format. Fields are separated by newlines, hashes are written out in hex separated by commas, timestamp and timezone are separated by a space. c C@s|jd\}}}}}}}|j\} } t| t| } } td|jdD}td|jdD}|| | f||||||S(Ns cs@s|]}tj|VqdS(N(R tbin(Rlthash((s3/usr/lib64/python2.7/site-packages/hgext/journal.pys st,cs@s|]}tj|VqdS(N(R R}(RlR~((s3/usr/lib64/python2.7/site-packages/hgext/journal.pys s(tsplittfloattintttuple( tclstlinettimetusertcommandRktnameR?R@t timestampttz((s3/usr/lib64/python2.7/site-packages/hgext/journal.pyt fromstorages$cC@sdjttj|j}djg|jD]}tj|^q.}djg|jD]}tj|^q\}dj||j |j |j |j ||fS(s bytes representation for storaget Rs ( RrtmapR tbytestrRR?R thexR@RRRkR(tselfRR~R?R@((s3/usr/lib64/python2.7/site-packages/hgext/journal.pyt __bytes__s ..( t__name__t __module__t__doc__t classmethodRRRt strmethodt__str__(((s3/usr/lib64/python2.7/site-packages/hgext/journal.pyR|s R&cB@seZdZd Zd ZdZedZe dZ dZ dZ dZ dZd d dZd Zd ed ZRS(seStorage for journal entries Entries are divided over two files; one with entries that pertain to the local working copy *only*, and one with entries that are shared across multiple working copies when shared using the share extension. Entries are stored with NUL bytes as separators. See the journalentry class for the per-entry structure. The file format starts with an integer version, delimited by a NUL. This storage uses a dedicated lock; this makes it easier to avoid issues with adding entries that added when the regular wlock is unlocked (e.g. the dirstate). cC@stj|_|j|_|j|_d|_|_|jrt |}t j |}|dk rd|kr|j|_||_qndS(NR'( RtgetuserRR"RMtNoneRnt sharedvfsRKRTRRp(RR,tfeaturesRx((s3/usr/lib64/python2.7/site-packages/hgext/journal.pyt__init__s     cC@sHdjttjtj}d|krD|jddd}n|S(NRs is ...(RrRRt shellquoteR&t_currentcommandt partition(Rt commandstr((s3/usr/lib64/python2.7/site-packages/hgext/journal.pyRs  cG@s ||_dS(s:Set the current hg arguments, stored with recorded entriesN(R(RR3((s3/usr/lib64/python2.7/site-packages/hgext/journal.pyR/scC@s7|dkrdS|}|dks/|j r3dS|S(soReturns the lock if it's held, or None if it's not. (This is copied from the localrepo class) N(Rtheld(Rtlockreftl((s3/usr/lib64/python2.7/site-packages/hgext/journal.pyt _currentlock!s   cC@s|j|jd k r0tjtdntd|j}ytj|ddd|}Wntjk r}|j j td||j ftj|d|j j ddd|}|j j td |j nXtj||_|S( s"Create a lock for the journal files%journal lock does not support nestings journal of %ssnamejournal.lockitdescs"waiting for lock on %s held by %r R"ttimeoutsgot lock after %s seconds N(Rt_lockrefRRtAbortRtbaseR tLockHeldR"twarntlockert configinttdelaytweakreftref(RRMRRRS((s3/usr/lib64/python2.7/site-packages/hgext/journal.pytjlock-s !cC@st|ts|g}nt|ts6|g}nttj|j|j||||}|j}|jdk rt j ||j kr|j}qn|j ||dS(sRecord a new journal entry * namespace: an opaque string; this can be used to filter on the type of recorded entries. * name: the name defining this entry; for bookmarks, this is the bookmark name. Can be filtered on when retrieving entries. * oldhashes and newhashes: each a single binary hash, or a list of binary hashes. These represent the old and new position of the named item. N(t isinstanceR9R|RtmakedateRRRMRRRjRCRnR(RRkRR?R@R{RM((s3/usr/lib64/python2.7/site-packages/hgext/journal.pyR;?s     c C@s|j|d}|ddd}|jdtj|jdjdd}|r|dtkr|jj t d|dS|s|j dtdn|jdtj |j t |dWdQXWdQXdS( NR$tmodesa+biiss%ds&unsupported journal file version '%s' (RRtseektostSEEK_SETRNRtstorageversionR"RRRetSEEK_ENDtbytes(RRMR{tversiontf((s3/usr/lib64/python2.7/site-packages/hgext/journal.pyR]s cc@s|dk r"tj|d}n|dk rDtj|d}nxW|D]O}|dk rs||j rsqKn|dk r||j rqKn|VqKWdS(sUYield all journal entries with the given namespace or name Both the namespace and the name are optional; if neither is given all entries in the journal are produced. Matching supports regular expressions by using the `re:` prefix (use `literal:` to match names or namespaces that start with `re:`) iN(RRt stringmatcherRkR(RRkRR{((s3/usr/lib64/python2.7/site-packages/hgext/journal.pytfilteredts   c@sTjj}jdkr%|SfdjjD}t||S(slIterate over the storage Yields journalentry instances for each contained journal record. c3@s0|]&}tj|jjkr|VqdS(N(RjRCRkRn(RlRm(R(s3/usr/lib64/python2.7/site-packages/hgext/journal.pys sN(RtRMRRRb(RR%RK((Rs3/usr/lib64/python2.7/site-packages/hgext/journal.pyt__iter__s "R$c c@s|j|sdS||}|j}WdQX|jd}|oP|d}|dtkr|prtd}tjtd|n|d}|rt|}nx(|D] }|sqntj |VqWdS(Nsis%ds not availables!unknown journal file version '%s'i( RqRNRRRRRtreversedR|R( RRMRhRiRtrawtlinesRR((s3/usr/lib64/python2.7/site-packages/hgext/journal.pyRts   (N(RRRRRRRtpropertyRRR/RRR;RRRtTrueRt(((s3/usr/lib64/python2.7/site-packages/hgext/journal.pyR&s      s no-mergestgraphR'ttallsshow history for all namestctcommitssshow commit metadatais[OPTION]... [BOOKMARKNAME]t helpcategoryc@stj|}d}|jdrK|rBtjtdnd}n|r^|d}n|jd|fd}|jddkr|dkrtd }n d |}|jtd |nt j |}d}|j dxt |j jd |D]\} }| |kr-Pnjj|jd d||jjdd||jj|jdd|jj|jdp|jdd d|jj|jddj|jdjdd|j|jdrjr3t j|||} n$t j||jdd|} x_|jD]T} y|| } | j| Wqatj k r} j!dtj"| qaXqaW| j#qqWj$|dkr|jtdndS( szshow the previous position of bookmarks and the working copy The journal is used to see the previous commits that bookmarks and the working copy pointed to. By default the previous locations for the working copy. Passing a bookmark name will show all the previous positions of that bookmark. Use the --all switch to show previous locations for all bookmarks and the working copy; each line will then include the bookmark name, or '.' for the working copy, as well. If `name` starts with `re:`, the remainder of the name is treated as a regular expression. To match a name that actually starts with `re:`, use the prefix `literal:`. By default hg journal only shows the commit hash and the command that was running at that time. -v/--verbose will show the prior hash, the user, and the time at which it happened. Use -c/--commits to output log information on each commit hash; at this point you can use the usual `--patch`, `--git`, `--stat` and `--template` switches to alter the log output for these. `hg journal -T json` can be used to produce machine readable output. R8Rs/You can't combine --all and filtering on a nameiR'c@s%jtj|ddddS(NRR tsepR(t formatlistRthexfunc(tnodes(tfm(s3/usr/lib64/python2.7/site-packages/hgext/journal.pyt formatnodessttemplatetjsonsthe working copy and bookmarkss'%s'sprevious locations of %s: Rtoldnodess%s -> tnewnodess%sRs %-8ssre:s %-8stdates %ss%Y-%m-%d %H:%M %1%2Rs %s Rt changesetstdiffoptss%s sno recorded locations N(%R t byteskwargsRCRRRRt formattertstatusR tgetlimittpagerRYR'Rt startitemt condwritetverboseR?ReR@Rt startswithRt formatdateRRtisplaintchangesetdisplayertchangesetformattertnestedtshowtRepoLookupErrortplainRtclosetend(R"R,R4toptsRRt displaynametlimitR{tcountt displayerR~tctxRm((Rs3/usr/lib64/python2.7/site-packages/hgext/journal.pyR's`      (    "  (s no-mergesR(RRNsshow history for all names(RRNsshow commit metadata(9Rt __future__Rt collectionsRQRRtmercurial.i18nRt mercurialRRRRRRRR R R R R RRtmercurial.utilsRRRtcmdtableRt testedwithRRDR<tsharedbookmarksRjR#R.RR+RR6RRTRbR R!t namedtupleR|tobjectR&t _ignoreoptsRtlogoptstopttCATEGORY_CHANGE_ORGANIZATIONR'(((s3/usr/lib64/python2.7/site-packages/hgext/journal.pyt sN    ^         (*