Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /lib64/python3.9/site-packages/mercurial/__pycache__/ |
Upload File : |
a �+�b�/ � @ s d Z ddlmZ ddlZddlmZ ddlmZmZm Z ddl mZ ejrhddl mZmZ eefD ]ZqbG d d � d e�ZG dd� de�Zg Zi Zd&dd�Zdd� Zejdd� �Zdd� Zdd� Zeddded�ed�ed�d� ed d!dded"�d#� d$d%� ZdS )'a^ 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 CBOR format to encode the data. � )�absolute_importN� )�_)�error�pycompat�util)�cborutil)�Any�Dictc @ s@ e Zd ZdZdd� Zdd� Zdd� Zdd � Zd d� Zdd � Z dS )�cmdstatea� 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 || _ || _dS )zorepo is the repo object fname is the file name in which data should be stored in .hg directory N)�_repo�fname)�self�repor � r �5/usr/lib64/python3.9/site-packages/mercurial/state.py�__init__9 s zcmdstate.__init__c C s | � � S )z=read the existing state file and return a dict of data stored)�_read�r r r r �read@ s z cmdstate.readc C st t |t�st�d��| jj| jddd��8}|�d| � t� |�D ]}|�|� qBW d � n1 sf0 Y dS )z�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 integers wbT)Z atomictemps %d N) � isinstance�intr �ProgrammingErrorr �vfsr �writer Zstreamencode)r �version�data�fp�chunkr r r �saveE s �z cmdstate.savec C st | j �| jd��P}zt|�� � W n ty> t�d��Y n0 t� |� � �d W d � S 1 sf0 Y dS )ztreads the state file and returns a dictionary which contain data in the same format as it was before storings rbs# unknown version of state file foundr N)r r r r �readline� ValueErrorr ZCorruptedStater Z decodeallr )r r r r r r T s � zcmdstate._readc C s t j| jj�| j�dd� dS )zdrop the state file if existsT)Z ignoremissingN)r Z unlinkpathr r �joinr r r r r �deletea s zcmdstate.deletec C s | j j�| j�S )z*check whether the state file exists or not)r r �existsr r r r r r$ e s zcmdstate.existsN) �__name__� __module__�__qualname__�__doc__r r r r r# r$ r r r r r + s r c @ s@ e Zd ZdZdd� Zdd� Zdd� Zdd � Zd d� Zdd � Z dS )�_statecheckac a utility class that deals with multistep operations like graft, histedit, bisect, update etc and check whether such commands are in an unfinished conditition or not and return appropriate message and hint. It also has the ability to register and determine the states of any new multistep operation or multistep command extension. c C sX || _ || _|| _|| _|| _|| _|| _|| _d| _| | _ | | _ || _|| _| | _ d S )NF)�_opname�_fnameZ _clearableZ_allowcommitZ_reportonlyZ _continueflag� _stopflag� _childopnames�_delegating�_cmdmsg�_cmdhint�_statushint� abortfunc�continuefunc)r �opnamer � clearable�allowcommit� reportonly�continueflag�stopflag�childopnames�cmdmsg�cmdhint� statushintr2 r3 r r r r s s z_statecheck.__init__c C s<