\x89\x50\x4E\x47\x0D\x0A\x1A\x0A PNG  \x89\x50\x4E\x47\x0D\x0A\x1A\x0A  13\c@@sVdZddlmZddlmZmZddlmZdefdYZ dS( sz This file contains class to wrap the state for commands and other related logic. All the data related to the command state is stored as dictionary in the object. The class has methods using which the data can be stored to disk in a file under .hg/ directory. We store the data on disk in cbor, for which we use the third party cbor library to serialize and deserialize data. i(tabsolute_importi(terrortutil(tcborutiltcmdstatecB@sDeZdZdZdZdZdZdZdZRS(sa wrapper class to store the state of commands like `rebase`, `graft`, `histedit`, `shelve` etc. Extensions can also use this to write state files. All the data for the state is stored in the form of key-value pairs in a dictionary. The class object can write all the data to a file in .hg/ directory and can populate the object data reading that file. Uses cbor to serialize and deserialize data while writing and reading from disk. cC@s||_||_dS(sp repo is the repo object fname is the file name in which data should be stored in .hg directory N(t_repotfname(tselftrepoR((s5/usr/lib64/python2.7/site-packages/mercurial/state.pyt__init__,s cC@s |jS(s=read the existing state file and return a dict of data stored(t_read(R((s5/usr/lib64/python2.7/site-packages/mercurial/state.pytread3scC@st|ts!tjdn|jj|jddt?}|jd|x$t j |D]}|j|qcWWdQXdS(swrite all the state data stored to .hg/ file we use third-party library cbor to serialize data to write in the file. s*version of state file should be an integertwbt atomictemps%d N( t isinstancetintRtProgrammingErrorRtvfsRtTruetwriteRt streamencode(Rtversiontdatatfptchunk((s5/usr/lib64/python2.7/site-packages/mercurial/state.pytsave7s !c C@ss|jj|jdU}yt|jWn tk rQtjdnXtj |j dSWdQXdS(streads the state file and returns a dictionary which contain data in the same format as it was before storingtrbs#unknown version of state file foundiN( RRRRtreadlinet ValueErrorRtCorruptedStateRt decodeallR (RR((s5/usr/lib64/python2.7/site-packages/mercurial/state.pyR Es  cC@s)tj|jjj|jdtdS(sdrop the state file if existst ignoremissingN(Rt unlinkpathRRtjoinRR(R((s5/usr/lib64/python2.7/site-packages/mercurial/state.pytdeleteQscC@s|jjj|jS(s*check whether the state file exists or not(RRtexistsR(R((s5/usr/lib64/python2.7/site-packages/mercurial/state.pyR#Us( t__name__t __module__t__doc__R R RR R"R#(((s5/usr/lib64/python2.7/site-packages/mercurial/state.pyRs     N( R&t __future__RtRRtutilsRtobjectR(((s5/usr/lib64/python2.7/site-packages/mercurial/state.pyts