https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/mercurial/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/mercurial/__pycache__/shelve.cpython-310.pyc
o

�]Lb(��@s*dZddlmZddlZddlZddlZddlZddlmZddl	m
Z
mZmZddl
mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z$ddl%m&Z&m'Z'd	Z(d
Z)gd�Z*dZ+Gd
d�de,�Z-Gdd�de,�Z.Gdd�de,�Z/dd�Z0dd�Z1dd�Z2dd�Z3dd�Z4dd�Z5d^d d!�Z6d"d#�Z7d$d%�Z8d&d'�Z9d(d)�Z:d*d+�Z;d,d-�Z<d.d/�Z=d0d1�Z>d2d3�Z?d4d5�Z@d6d7�ZAd8d9�ZBd:d;�ZCd<d=�ZDd>d?�ZEd@dA�ZFdBdC�ZGdDdE�ZHdFdG�ZIdHdI�ZJdJdK�ZKdLdM�ZLdNdO�ZMdPdQ�ZNdRdS�ZOdTdU�ZPdVdW�ZQdXdY�ZRdZd[�ZSd\d]�ZTdS)_a@save and restore changes to the working directory

The "hg shelve" command saves changes made to the working directory
and reverts those changes, resetting the working directory to a clean
state.

Later on, the "hg unshelve" command restores the changes saved by "hg
shelve". Changes can be restored even after updating to a different
parent, in which case Mercurial's merge machinery will resolve any
conflicts if necessary.

You can have more than one shelved change outstanding at a time; each
shelved change has a distinct name. For details, see the help for "hg
shelve".
�)�absolute_importN�)�_)�bin�hex�nullrev)�	bookmarks�bundle2�changegroup�cmdutil�	discovery�error�exchange�hg�lock�mdiff�merge�
mergestate�patch�phases�pycompat�repair�scmutil�templatefilters�util�vfs)�dateutil�
stringutils
shelve-backupsshelved)shg�patch�shelvesshelve@localhostc@s&eZdZd	dd�Zdd�Zdd�ZdS)
�ShelfDirFcCs4|rt�|j�t��|_dSt�|j�t��|_dS�N)�vfsmodr�join�	backupdir�	shelvedir)�self�repo�for_backups�r)�2/usr/lib/python3/dist-packages/mercurial/shelve.py�__init__IszShelfDir.__init__cCst|j|�Sr!)�Shelfr)r&�namer)r)r*�getOszShelfDir.getc	
Cs�z|j��}Wnty"}z|jtjkr�gWYd}~Sd}~wwg}t�}|D])}|�dd�d}||vr9q*|�|�|�|�}|�	�sHq*|�
�}|�||f�q*t|dd�S)z2return all shelves in repo as list of (time, name)N�.rrT)�reverse)
r�listdir�OSError�errno�ENOENT�set�rsplit�addr.�exists�mtime�append�sorted)	r&�names�err�info�seen�filenamer-�shelfr9r)r)r*�listshelvesRs*��

zShelfDir.listshelvesN�F)�__name__�
__module__�__qualname__r+r.rBr)r)r)r*r Hs
r c@sreZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zddd�Zdd�Z
dd�Zdd�ZdS)r,aRepresents a shelf, including possibly multiple files storing it.

    Old shelves will have a .patch and a .hg file. Newer shelves will
    also have a .shelve file. This class abstracts away some of the
    differences and lets you work with the shelf as a whole.
    cCs||_||_dSr!�rr-)r&rr-r)r)r*r+qs
zShelf.__init__cCs$|j�|jd�o|j�|jd�S)N�.patch�.hg�rr8r-�r&r)r)r*r8us�zShelf.existscCs|j�|jd�tjS�NrH)r�statr-�ST_MTIMErKr)r)r*r9z�zShelf.mtimecCst�|j|jd��|�dS�Ns.shelve)r�simplekeyvaluefilerr-�write)r&r>r)r)r*�	writeinfo}szShelf.writeinfocCs|j�|jd�SrPrJrKr)r)r*�hasinfo��z
Shelf.hasinfocCst�|j|jd���SrP)rrQrr-�readrKr)r)r*�readinfo�s
��zShelf.readinfoc
Cs~t�|�}|dkrd}d}nd}d}|��}tj|||gd�}t�|||d�}|j�|jd�}	t	j
|j||	||j|d�dS)	Ns01sHG10BZsHG20sBZ)�missingroots�ancestorsofrrI)�compression)r
�safeversion�
unfilteredr�outgoing�makechangegrouprr#r-r	�writebundle�ui)
r&r'�bases�node�	cgversion�btyperZr]�cg�bundle_filenamer)r)r*r_�s(
�
�zShelf.writebundlec
	Cs�|jd}|�|�}zDtj}t�|�stj}t�|j|||j�}|d}t	j
|||dd|j�|�|d�|d}||krH|jdd}	||	}|W|�
�S|�
�w)NrIstip�unshelvesbundle:)�source�url�targetphases
revduplicates���)r-rr�internal�supportinternal�secretr�
readbundler`r	�applybundler#�changes�close)
r&r'�trr@�fprj�gen�pretip�	shelvectx�	shelverevr)r)r*rp�s,


�zShelf.applybundle�rbcCs|�|jd|�SrLrG)r&�moder)r)r*�
open_patch�rUzShelf.open_patchcCs2dd�}||�D]}|�|�s|�|�SqdS)Ncss<�|V|�dd�\}}t�d�D]
}d|||fVqdS)Nr/rs%s-%d.%s)r6�	itertools�count)�base�ext�ir)r)r*�gennames�s��z'Shelf._backupfilename.<locals>.gennames)r8r#)r&�	backupvfsr@r��nr)r)r*�_backupfilename�s
��zShelf._backupfilenamecCsT|��s|��tD]}|jd|}|j�|�r't�|j�|�|�	||��q
dS�Nr/)
�isdir�makedir�shelvefileextensionsr-rr8r�renamer#r�)r&r��suffixr@r)r)r*�movetobackup�s

���zShelf.movetobackupcCs$tD]
}|j�|jd|�qdSr�)r�r�	tryunlinkr-)r&rr)r)r*�delete�s�zShelf.deleteN)ry)rDrErF�__doc__r+r8r9rSrTrWr_rpr{r�r�r�r)r)r)r*r,is
r,c@sxeZdZdZdZdZdZdZdZdZ	e
dd	��Ze
d
d��Ze
dd
��Z
e
dd��Ze
			ddd��Ze
dd��ZdS)�shelvedstatez�Handle persistence during unshelving operations.

    Handles saving and restoring a shelved state. Ensures that different
    versions of a shelved state are possible and handles them appropriately.
    �sshelvedstate�keepsnokeeps:no-active-bookmark�interactivec
Cs�z/t|d�|d<t|d�|d<dd�|d�d�D�|d<dd�|d�d�D�|d<Wd	StttfyF}zt�t�|���d	}~ww)
z@Some basic shelvestate syntactic verification and transformation�originalwctx�
pendingctxcS�g|]}t|��qSr)�r��.0�hr)r)r*�
<listcomp>��z4shelvedstate._verifyandtransform.<locals>.<listcomp>�parents� cSr�r)r�r�r)r)r*r��s��
nodestoremoveN)	r�split�
ValueError�	TypeError�KeyErrorr
�CorruptedStater�forcebytestr)�cls�dr=r)r)r*�_verifyandtransform�s���z shelvedstate._verifyandtransformc
Csd|�|j�}z&z
t|�����}Wnty%}zt�t�	|���d}~wwW|�
�|S|�
�w)z.Read version information from shelvestate fileN)r�	_filename�int�readline�stripr�r
r�rr�rr)r�r'rt�versionr=r)r)r*�_getversion�s���
�zshelvedstate._getversioncCsLgd�}|�|j�}i}z|D]
}|����||<qW|��|S|��w)z9Read the old position-based version of a shelvestate file)	sversion�namer�r�r�r��branchtorestorer��
activebook)rr�r�r�rr)r�r'�keysrtr��keyr)r)r*�_readolds
�
�zshelvedstate._readoldc
Cs*|�|�}||jkr|�|�}n||jkr"t�|j|j�jdd�}nt�	t
d���|�|�zO|�}|d|_||d|_
||d|_|d|_|d|_|�d	d
�|_|�d�|jk|_d
|_|�dd
�|jkrr|�dd
�|_|�d
�|jk|_W|Stjtfy�}zt�t�|���d}~ww)NT)�firstlinenonkeyvalsIthis version of shelve is incompatible with the version used in this repor�r�r�r�r�r��r�r�r�)r��_versionr�rrQrr�rVr
�Abortrr�r-�wctx�
pendingctx�parents�
nodestoremover.�branchtorestore�_keep�keep�activebookmark�
_noactivebook�_interactive�interactive�RepoLookupErrorr�r�r�bytestr)r�r'r�r��objr=r)r)r*�loads>


���



���zshelvedstate.loadFr�c
	Cs�|t|���t|���d�dd�|j��D��d�dd�|D��||r&|jn|j|p,|jd�}
|	r6|j|
d<t	�
|j|j�j
|
d|jd�dS)	Nr�cSr�r)�r)r��pr)r)r*r�Rr�z%shelvedstate.save.<locals>.<listcomp>cSr�r)r�)r�r�r)r)r*r�Sr�)r�r�r�r�r�r�r�r�r�s%d)�	firstline)rrbr#�dirstater�r��_nokeepr�r�rrQrr�rRr�)r�r'r-�originalwctxr�r�r�r��
activebookr�r>r)r)r*�saveAs

�



�zshelvedstate.savecCs|jj|jdd�dS)NT)�
ignoremissing)r�
unlinkpathr�)r�r'r)r)r*�clear^szshelvedstate.clearN)Fr�F)rDrErFr�r�r�r�r�r�r��classmethodr�r�r�r�r�r�r)r)r)r*r��s.



#	�r�cCs~|j�dd�}t|dd�}|��}|dkr$|t|�kr$||dd}nd}||d�D]\}}||kr5q,|�|���q,dS)Nrs
maxbackupsT)r(rr)r`�	configintr rB�lenr.r�)r'�
maxbackups�
backup_dir�hgfiles�bordermtimer9r-r)r)r*�cleanupoldbackupscs�r�cCs|j}|r
t�|�|Sr!)�_activebookmarkr�
deactivate)r'r�r)r)r*�_backupactivebookmarkrs
r�cCs|r
t�||�dSdSr!)r�activate)r'�markr)r)r*�_restoreactivebookmarkys�r�cCs,d}|j�||�|��|j�d|�dS)z@Abort current transaction for shelve/unshelve, but keep dirstatesdirstate.shelveN)r��
savebackup�abort�
restorebackup)r'rs�dirstatebackupnamer)r)r*�_aborttransaction~sr�cs��fdd�}|�d�}|jp|��pd���dd����dd����d�r,��ddd	��|r_t|��|���rBtd
�|}t�	|��d|vsJd|vrQt�	td���|�d�r]t�	td���|St|�}|�D]}|�|���st|}|Sqf|S)
z/Decide on the name this shelve is going to havec3s*��Vt�d�D]	}d�|fVq	dS)Nrs%s-%02d)r|r})r���labelr)r*r��s
��zgetshelvename.<locals>.gennamesr�sdefault�/�_�\r/rs*a shelved change named '%s' already existss,shelved change names can not contain slashess+shelved change names can not start with '.')
r.r��branch�replace�
startswithr r8rr
r�)r'�parent�optsr�r-�e�	shelf_dirr�r)r�r*�
getshelvename�s4


�
	�
�r�ccsv�th}t��}|�|�|r9|��}|��V|��D]}|��}||vr4|�|�|�	�r4|�|�q|sdSdS)zireturn all mutable ancestors for ctx (included)

    Much faster than the revset ancestors(ctx) & draft()N)
r�collections�dequer:�popleftrbr��revr7�mutable)�ctxr?�visitr�r�r)r)r*�mutableancestors�s�



��r�Fcs&��fdd���fdd�}|r|S�S)Nc
	s�t�|d�}|r|jjd}|j_tj}t�|�stj}d|i}zHd}	�r2tj	dddit
�|���}	|j�
|��|j|t|�d�||	�d�Wd�W|rU||j_SS1sYwYW|rg||j_dSdS|ro||j_w)	NsmqF�sphasess
new-commit�editforms
shelve.shelve�date��editor�extrar))r�safehasattr�mq�checkappliedrrlrmrnr�getcommiteditorr�	strkwargsr`�configoverride�commit�
shelveuserr.)
r`r'�message�matchr��hasmq�savedrj�	overrides�editor_r�r)r*�
commitfunc�sB
����

��
�
z!getcommitfunc.<locals>.commitfunccs4t�|�}t�|d|i�}|d}�|||||�S)Nr/�message)r�byteskwargsrr	)r`r'�patsr�r	r)rr)r*�interactivecommitfunc�s
z,getcommitfunc.<locals>.interactivecommitfuncr))r�r�r�rr))rr�r�r*�
getcommitfunc�srcCsN|jt�|d||�d�}|jr|�td�t|j��dS|�td��dS)N)r	s4nothing changed (%d missing files, see 'hg status')
snothing changed
)�statusrr	�deletedrr�)r`r'rr�rMr)r)r*�_nothingtoshelvemessaging�s��rcCs�dt|�i}t|��|�}|�|�tt||��}|�|||�|�d��}tj	||g|t
jdd�|d�Wd�dS1sAwYdS)N�nodeswbT)�git)r�r	)rr r.rS�listr�r_r{r�
exportfiler�diffopts)r'rbr-r	r>rArartr)r)r*�_shelvecreatedcommit�s
�"�rcCsJ|jt�|d||�dd�}|jr#d�|j�|d<|d�|j�dSdS)NT)r	�unknown��shelve_unknown)rrr	rr#r7)r'rr�r��sr)r)r*�_includeunknownfiles�s
�r!cCs$t�|�r|��dSt||�dSr!)rrmrrr�)r'rsr)r)r*�
_finishshelves
r"cCsD|���t�|�t||||�Wd�S1swYdS)z$subcommand that creates a new shelveN)�wlockr�checkunfinished�_docreatecmd)r`r'rr�r)r)r*�	createcmds

$�r&c
Cs�|d}|��}|d}|��}|��tkr#d|���dd�d}nd}|�d�s.||d<d}	}
}�z|��}	|jddd	�d
�}
|�dd�}|�d
d�oU|�dd�}
t	|||�}t
|�}ddi}|
rmt||||�t|�r�t
||�s�|j�|d���t||dd�}|s�t�|||||�}ntj|||ddtjg|�Rit�|���}|s�t||||�Wt||�t�|
|	�dSt�|||���}t||||�|�t d�|�|dr�|j�!��t�"|||�Wd�n1s�wYnt#�$||�%��t&j'�(|�}|�)��s|�*�||d��k�r&t
||��s&|j�|�t+||
�Wt||�t�|
|	�dSt||�t�|
|	�w)Nrschanges to: %s�
rs(changes in empty repository)rrcS�dSr!r)��xr)r)r*�<lambda>&�z_docreatecmd.<locals>.<lambda>��reportr�Fsunknowns	addremove�internalr/T)r�sshelved as %s
r�),r�r�r�r�descriptionr�r.r�transactionr�r�r!�_iswctxonnewbranch�
_isbareshelver��	setbranchrrr�dorecord�recordfilterrrrr��lockmod�releaser�
matchfiles�filesrrr�parentchange�movedirstater�updaterb�
mergestatemodrrV�unresolvedcount�resetr")r`r'rr�r�r�r��
origbranch�descrrsr�r��includeunknownr-r�rrbr	�msr)r)r*r%s~
����

���


�r%cCs0|o|�dd�o|�dd�o|�dd�S)Nr�Fsincludesexclude)r.)rr�r)r)r*r3cs���r3cCs|d��|d��kSr�)r��r'r)r)r*r2lrOr2cCsr|���+t|�}t�|j�t��}|��D]\}}|�|��|�t	|�qWd�dS1s2wYdS)z#subcommand that deletes all shelvesN)
r#r r"rr#r$rBr.r�r�)r`r'r�r��_mtimer-r)r)r*�
cleanupcmdps

�"�rGcCs�|s	t�td���|���4t�|j�t��}|D]}t|��	|�}|�
�s/t�td�|��|�|�t|�qWd�dS1sDwYdS)z)subcommand that deletes a specific shelvesno shelved changes specified!�shelved change '%s' not foundN)
r
�
InputErrorrr#r"rr#r$r r.r8r�r�)r`r'rr�r-rAr)r)r*�	deletecmd{s

�

�"�rJc	Cs�t|�}d}|��s|��}d}|�d�t|�}|��D]�\}}|r(||vr(q|j||d�d}|jr:|�d�q|�ddt|��d}	t	�
|�}
d	tj|
d
d�}|j|dd�|�dd
t|��|	d
7}	|�
|����r}	|��}
|
s{n|
�d�s�|
��}|��r�t�|||	�}|�|�nqt|�d�|ds�|ds�	Wd�q|��}|dr�t�t|�D]\}}|j||d�q�|dr�tj||d�D]\}}|j||d�q�Wd�n1s�wYqdS)z,subcommand that displays the list of shelves�Ps
shelve.newestrr�sshelve.namer'r��s(%s)T)�abbrevs
shelve.age��#rsstatN)�width)r5�plain�	termwidth�pagerr rBrR�quietr�r�makedater�ager.r{r�r��rstrip�	formattedr�ellipsis�	readlinesr�	difflabel�iter�
diffstatui)r`r'rr�rP�	namelabelr�r9r-�used�daterVrt�linerB�	difflines�chunkr�r)r)r*�listcmd�sb




�

�����rdc	Cs|t|�}t|�dkr |��}|st�td���|d\}}|g}|D]}|�|���s4t�td�|��q"t||||�dS)z subcommand that displays shelvesrsthere are no shelves to showscannot find shelf %sN)	r r�rBr
r�rr.r8rd)	r`r'rr�r��shelvesr9r-�	shelfnamer)r)r*�	patchcmds�s�rgcCs"|j|j��krt�td���dS)z'check parent while resuming an unshelves5working directory parents do not match unshelve stateN)r�r�r
r�r)r'�stater)r)r*�checkparents�s
��ric
Cs�zt�|�}|�d�dur|j|d<W|SW|Sty9}z|jtjkr&�t�|t	d��WYd}~|Sd}~wt
jy{}z6|�t
�|�d�|�d�r_t	d�}t	d�}t
j||d��|�d�rpt�|�t
�t	d	���WYd}~|Sd}~ww)
Nr�rgr'�continuescorrupted shelved state files:please run hg unshelve --abort to abort unshelve operation��hint�abortspcould not read shelved state file, your working copy may be in an unexpected state
please update to some commit
)r�r�r.r��IOErrorr3r4r�wrongtooltocontinuerr
r��debugrr�r�r�)r`r'r�rhr=�msgrlr)r)r*�_loadshelvedstate�s@
����
�

��
�	��rrcCs�|���_zEt||�t�|j�|jr!|j|jvr!t�||j�t	|||j
|j�t�|�s:t
j|||jddd�Wt�|�|�td�|j�nt�|�|�td�|j�wWd�dS1sfwYdS)z-subcommand that abort an in-progress unshelveFr��backup�topicsunshelve of '%s' aborted
N)rrir�clean_updater�r��
_bookmarksrr��
mergefilesr�rrmrr�r�r�r��warnrr-�r`r'rhr)r)r*�
unshelveabort�s"


��

�"�r{cCsH|���t||ddi�}t|||�Wd�S1swYdS)z(logic to  abort unshelve using 'hg abortrmTN)r#rrr{rzr)r)r*�hgabortunshelves

$�r|cCsR|�ddi��t�||���t�|||�Wd�dS1s"wYdS)zLupdates to wctx and merges the changes from shelvectx into the
    dirstate.��uisquietTN)rrr=rbr�revert)r`r'r�rwr)r)r*rxs"�rxcCs<|r||j��kr|j�|�|�td�|�dSdSdS)Ns&marked working directory as branch %s
)r�r�r4rr)r`r'r�r)r)r*�
restorebranchs
��r�cCs@|�d�st�|j�t��}t|��|��|�t|�dSdS)z&remove related files after an unshelver�N)r.r"rr#r$r r�r�)r`r'r-r�r�r)r)r*�unshelvecleanups

�r�c
Cs0|j}|j}|����t||�tj�|�}|��r&tj	t
d�t
d�d��||jd}|j}|j
���|�|j��|j�|j
�|���Wd�n1sRwYtj}	t�|�sbtj}	d|	i}
|j�|
d��2|j
���|�|jd|j�t||||||�\}}Wd�n1s�wYWd�n1s�wY|dur�|j}t
d	�}
|�|
�n
|j�|�||}t�|�t |||j!|�t"|||j#�t�|�s�t$j%|||jd
dd�t&�'|�|s�t(|||j|�t)||j*�|�t
d
�|j�Wd�dS1�swYdS)z.subcommand to continue an in-progress unshelves$unresolved conflicts, can't continues/see 'hg resolve', then 'hg unshelve --continue'rkrNr�rgr�<note: unshelved changes already existed in the working copy
Frrssunshelve of '%s' complete
)+r�r-rrir>rrVr?r
r�rr�r�r�r;�
setparentsrb�nullidrR�currenttransactionrrlrmrnr`r�_createunshelvectxrr�r:rr=rxr�r�r�rr�r�r�r�r�r�)r`r'rhr�r��basenamerDrwr�rjr�newnode�ispartialunshelverqr)r)r*�unshelvecontinue#sd
��

�����

�
$�r�cCsP|���t||ddi�}t|||d|ji�Wd�S1s!wYdS)z,logic to resume unshelve using 'hg continue'rjTr�N)r#rrr�r�rzr)r)r*�hgcontinueunshelve_s
$�r�c
Cs�|��}t|j�}|js|js|js||fS|�td��ddi}t|ddd�}i}d|d<|�d�|d<|�d	d
i��t	�
|||g|�}	Wd�n1sPwY||	}||fS)zETemporarily commit working copy changes before moving unshelve commitsLtemporarily committing pending changes (restore with 'hg unshelve --abort')
r/rF)r�r�r�s pending changes temporary commitrr�r}TN)r�	frozenset�added�modified�removedrrr.rrr)
r`r'r��tmpwctxr �addedbeforer�r�tempoptsrbr)r)r*�_commitworkingcopychangesfs&
���r�cCs�|��}d}t|��|�}|��r|��d}|dus||vrQ|�ddi��|�||�}Wd�n1s7wY|durMdt|���i}|�	|�||fS||}||fS)z5Recreate commit in the repository during the unshelveNrr}T)
r\r r.rTrWrrprrbrS)r`r'rsr�rbrArwr>r)r)r*�_unshelverestorecommits�
�r�cCs�|��|d<d|d<g}|s#|j|��|��|��|��d�}|dfSt|��ddd�}tj|||ddtjg|�Rit	�
|���}|j|��|��|��d�}	|	rbt�|||	�
��}
t||	||
�|t|	�fS)	ayHandles the creation of unshelve commit and updates the shelve if it
    was partially unshelved.

    If interactive is:

      * False: Commits all the changes in the working directory.
      * True: Prompts the user to select changes to unshelve and commit them.
              Update the shelve with remaining changes.

    Returns the node of the new commit formed and a bool indicating whether
    the shelve was partially unshelved.Creates a commit ctx to unshelve
    interactively or non-interactively.

    The user might want to unshelve certain changes only from the stored
    shelve in interactive. So, we would create two commits. One with requested
    changes to unshelve at that time and the latter is shelved for future.

    Here, we return both the newnode which is created interactively and a
    bool to know whether the shelve is partly done or completely done.
    rTsinteractive-unshelve)�textr��userr`F)r�r�N)r�r�r�)r0rr�r�r`rrr5r6rrrr9r:r�bool)r`r'rwr�r�r�rr�r�snode�mr)r)r*r��sB����
�r�cs�|�d�}|��|����kr|s|dfS|�dd�tjd�}�j�|d���|�td��t	j
�|gd�d	d
�}
|
jrd|���fdd�t
�|t���D�}t��|||||	|�d
�|
|�	t�d���j�����|���j�t|�||||�\}}Wd�n1s�wY|dur�|}td�}|�|�n�|}t	�|�Wd�||fSWd�||fS1s�wY||fS)zBRebase restored commit from its original location to a destinationr�F�toolr�)�r~s
forcemerger�rgsrebasing shelved changes
)sworking-copysshelved changesparent of shelved changeT)�labels�keepconflictparentcsg|]}�j�|��qSr))�	changelogrb)r�r�rEr)r*r��s
��z)_rebaserestoredcommit.<locals>.<listcomp>r�Nr�)r.rb�p1rrnr`rrrr�graftr?rrr�xranger�r�r�r
�ConflictResolutionRequiredr�r;r�r�r�r=)r`r'r�rs�	oldtiprevr��pctxr�rwr�r�r�r�statsr�r�r�rqr)rEr*�_rebaserestoredcommit�sh

��

��

���
�1�
�1�1r�cCsP|���d�}|sdSt|�d��}t|��j�}||@|}|d�|�dS)Nrr)r�r.r�r�rr��forget)r'rwr��
shelveunknown�
addedafter�toforgetr)r)r*�_forgetunknownfilessr�cCs*t||�|��j�||�t||�dSr!)r�r\r�r�r�)r'r�rsr�r)r)r*�_finishunshelve&s
r�cCsJt|��j�}t|���}|�|�}|r#td�}td�}tj||d��dS)zYCheck potential problems which may result from working
    copy having untracked changes.s$shelved change touches missing filess,run hg status to see which files are missingrkN)r5rrr:�intersectionrr
r�)r`r'rw�	wcdeleted�
shelvetouchedr�r�rlr)r)r*�_checkunshelveuntrackedproblems0s
�r�c	Os�t�|�}|�d�}|�d�}|�d�}|s|st�|�t|�}|�d�r-|�|d�|r;|�d�r;t�t	d���|s?|r�|rJ|rJt�t	d���|rSt�t	d���|rb|�d	d
�rb|�
t	d��t|||�}|rpt|||�S|r{|r{t�t	d���|r�t
||||�Sn2t|�d
kr�t�t	d���|s�t|���}|s�t�t	d���|dd
}|�t	d�|�n|d}t|��|���s�t�t	d�|��t||||�S)Nrmrjr�r�r�s,--keep on --interactive is not yet supporteds"cannot use both abort and continues:cannot combine abort/continue with naming a shelved changer�Fstool option will be ignored
s(cannot use both continue and interactivers&can only unshelve one change at a timesno shelved changes to apply!rsunshelving change '%s'
rH)rrr.rr$rr:r
rIrryrrr{r�r�r rB�
StateErrorrr8�_dounshelve)	r`r'�shelvedr��abortf�	continuefr�rhr�r)r)r*�unshelvecmd<s\





�����r�cCsx|��}d}}z�|��}|jddd�d�}t|�}|d}|}t|�}	t||||�\}}
t||||�\}}t|||�d}|��|�	���krL|��}t
|||||||||||	�\}}
d|�dd�i}|�|d��t
||||�Wd�n1s|wYt|||�t�|�t||||	�t|||
�|
s�t||||�W|r�|��t�|�dS|r�|��t�|�w)	NrgcSr(r!r)r)r)r)r*r+wr,z_dounshelve.<locals>.<lambda>r-r/r�r�r�)r\rr1r�r�r�r�r�r�r�r�r.rrxr�r�r�r�r�r�r8r7)r`r'r�r�rrsr�r�r�r�r�rwr�r�rr)r)r*r�rs^��
�
��r�rC)Ur��
__future__rr�r3r|rM�i18nrrbrrr�rr	r
rrr
rrrr7rrrr>rrrrrrrrr"�utilsrrr$r%r�r�objectr r,r�r�r�r�r�r�r�rrrr!r"r&r%r3r2rGrJrdrgrirrr{r|rxr�r�r�r�r�r�r�r�r�r�r�r�r�r)r)r)r*�<module>snX!p(
&Q	/<8N
6

https://t.me/RX1948 - 2025