File: //lib64/python2.7/site-packages/mercurial/state.pyo
�
1�3\c @@ sV d Z d d l m Z d d l m Z m Z d d l m Z d e f d � � YZ d S( 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 ( t absolute_importi ( t errort util( t cborutilt cmdstatec B@ sD e Z d Z d � Z d � Z d � Z d � Z d � Z d � Z RS( s� a 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.
c C@ s | | _ | | _ d S( sp repo is the repo object
fname is the file name in which data should be stored in .hg directory
N( t _repot fname( t selft repoR ( ( s5 /usr/lib64/python2.7/site-packages/mercurial/state.pyt __init__, s c C@ s
| j � S( 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.pyt read3 s c C@ s� t | t � s! t j d � � n | j j | j d d t ��? } | j d | � x$ t j
| � D] } | j | � qc WWd QXd S( s� write all the state data stored to .hg/<filename> file
we use third-party library cbor to serialize data to write in the file.
s* version of state file should be an integert wbt
atomictemps %d
N( t
isinstancet intR t ProgrammingErrorR t vfsR t Truet writeR t streamencode( R t versiont datat fpt chunk( ( s5 /usr/lib64/python2.7/site-packages/mercurial/state.pyt save7 s !c C@ ss | j j | j d � �U } y t | j � � Wn t k
rQ t j d � � n Xt j | j
� � d SWd QXd S( st reads the state file and returns a dictionary which contain
data in the same format as it was before storingt rbs# unknown version of state file foundi N( R R R R t readlinet
ValueErrorR t CorruptedStateR t decodeallR ( R R ( ( s5 /usr/lib64/python2.7/site-packages/mercurial/state.pyR
E s
c C@ s) t j | j j j | j � d t �d S( s drop the state file if existst
ignoremissingN( R t
unlinkpathR R t joinR R ( R ( ( s5 /usr/lib64/python2.7/site-packages/mercurial/state.pyt deleteQ s c C@ s | j j j | j � S( s* check whether the state file exists or not( R R t existsR ( R ( ( s5 /usr/lib64/python2.7/site-packages/mercurial/state.pyR# U s ( t __name__t
__module__t __doc__R R R R
R"