HEX
Server: Apache
System: Linux p102.lithium.hosting 4.18.0-553.141.1.el8_10.x86_64 #1 SMP Fri Jul 10 17:48:02 UTC 2026 x86_64
User: bvzmoamr (9955)
PHP: 8.1.34
Disabled: syslog
Upload Files
File: //usr/lib64/python2.7/site-packages/mercurial/state.pyo
�
1�3\c@@sVdZddlmZddlmZmZddlmZdefd��YZ	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@sDeZdZd�Zd�Zd�Zd�Zd�Zd�ZRS(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.
    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
|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.pytread3scC@s�t|t�s!tjd��n|jj|jddt��?}|jd|�x$t	j
|�D]}|j|�qcWWdQXdS(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 integertwbt
atomictemps%d
N(t
isinstancetintRtProgrammingErrorRtvfsRtTruetwriteRtstreamencode(Rtversiontdatatfptchunk((s5/usr/lib64/python2.7/site-packages/mercurial/state.pytsave7s!c	C@ss|jj|jd��U}yt|j��Wn tk
rQtjd��nXtj	|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|j�dt�dS(sdrop the state file if existst
ignoremissingN(Rt
unlinkpathRRtjoinRR(R((s5/usr/lib64/python2.7/site-packages/mercurial/state.pytdeleteQscC@s|jjj|j�S(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	RRR
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.pyt<module>s