403Webshell
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 :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /lib64/python3.9/site-packages/mercurial/__pycache__/shelve.cpython-39.opt-1.pyc
a

�+�b(��@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)
�ShelfDirFcCs2|rt�|j�t��|_nt�|j�t��|_dS�N)�vfsmodr�join�	backupdir�	shelvedir)�self�repo�for_backups�r)�6/usr/lib64/python3.9/site-packages/mercurial/shelve.py�__init__IszShelfDir.__init__cCst|j|�Sr!)�Shelfr)r&�namer)r)r*�getOszShelfDir.getc	
Cs�z|j��}Wn6tyD}z|jtjkr,�gWYd}~Sd}~00g}t�}|D]R}|�dd�d}||vrrqT|�|�|�|�}|�	�s�qT|�
�}|�||f�qTt|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+qszShelf.__init__cCs$|j�|jd�o"|j�|jd�S)N�.patch�.hg�rr8r-�r&r)r)r*r8us�zShelf.existscCs|j�|jd�tjS�NrG)r�statr-�ST_MTIMErJr)r)r*r9zszShelf.mtimecCst�|j|jd��|�dS�Ns.shelve)r�simplekeyvaluefilerr-�write)r&r>r)r)r*�	writeinfo}szShelf.writeinfocCs|j�|jd�SrNrIrJr)r)r*�hasinfo�sz
Shelf.hasinfocCst�|j|jd���SrN)rrOrr-�readrJr)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)ZmissingrootsZancestorsofrrH)�compression)r
Zsafeversion�
unfilteredr�outgoingZmakechangegrouprr#r-r	�writebundle�ui)
r&r'�bases�nodeZ	cgversionZbtyperUrWZcgZbundle_filenamer)r)r*rX�s(
��zShelf.writebundlec
	Cs�|jd}|�|�}z�tj}t�|�s,tj}t�|j|||j�}|d}t	j
|||dd|j�|�|d�|d}||kr�|jdd}	||	}|W|�
�S|�
�0dS)NrHstip�unshelvesbundle:)�source�url�targetphases
revduplicates���)r-rr�internal�supportinternal�secretrZ
readbundlerYr	�applybundler#Zchanges�close)
r&r'�trr@�fpr_�genZpretip�	shelvectxZ	shelverevr)r)r*rd�s0


��zShelf.applybundle�rbcCs|�|jd|�SrKrF)r&�moder)r)r*�
open_patch�szShelf.open_patchcCs2dd�}||�D]}|�|�s|�|�SqdS)Ncss:|V|�dd�\}}t�d�D]}d|||fVq dS)Nr/rs%s-%d.%s)r6�	itertools�count)�base�ext�ir)r)r*�gennames�sz'Shelf._backupfilename.<locals>.gennames)r8r#)r&�	backupvfsr@rr�nr)r)r*�_backupfilename�s
zShelf._backupfilenamecCsT|��s|��tD]:}|jd|}|j�|�rt�|j�|�|�	||��qdS�Nr/)
�isdirZmakedir�shelvefileextensionsr-rr8r�renamer#ru)r&rs�suffixr@r)r)r*�movetobackup�s

�zShelf.movetobackupcCs$tD]}|j�|jd|�qdSrv)rxrZ	tryunlinkr-)r&rpr)r)r*�delete�szShelf.deleteN)rj)rCrDrE�__doc__r+r8r9rQrRrTrXrdrlrur{r|r)r)r)r*r,is
r,c@sreZdZdZdZdZdZdZdZdZ	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<Wn:tttfy�}zt�t�|���WYd	}~n
d	}~00d	S)
z@Some basic shelvestate syntactic verification and transformation�originalwctx�
pendingctxcSsg|]}t|��qSr)�r��.0�hr)r)r*�
<listcomp>��z4shelvedstate._verifyandtransform.<locals>.<listcomp>�parents� cSsg|]}t|��qSr)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
Csr|�|j�}zVzt|�����}Wn4tyV}zt�t�	|���WYd}~n
d}~00W|�
�n
|�
�0|S)z.Read version information from shelvestate fileN)r�	_filename�int�readline�stripr�r
r�rr�re)r�r'rg�versionr=r)r)r*�_getversion�s(zshelvedstate._getversioncCsNgd�}|�|j�}i}z&|D]}|����||<qW|��n
|��0|S)z9Read the old position-based version of a shelvestate file)	sversion�namer�r�r�r��branchtorestorer��
activebook)rr�r�r�re)r�r'�keysrgr��keyr)r)r*�_readolds
zshelvedstate._readoldc
Cs:|�|�}||jkr |�|�}n2||jkrDt�|j|j�jdd�}nt�	t
d���|�|�z�|�}|d|_||d|_
||d|_|d|_|d|_|�d	d
�|_|�d�|jk|_d
|_|�dd
�|jkr�|�dd
�|_|�d
�|jk|_Wn<tjtf�y4}zt�t�|���WYd}~n
d}~00|S)NT)ZfirstlinenonkeyvalsIthis version of shelve is incompatible with the version used in this repor�r�r�r�r�r�r�r�r�r�)r��_versionr�rrOrr�rSr
�Abortrr�r-�wctx�
pendingctx�parents�
nodestoremover.�branchtorestore�_keep�keep�activebookmark�
_noactivebook�_interactive�interactiveZRepoLookupErrorr�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��||rL|jn|j|pX|jd�}
|	rl|j|
d<t	�
|j|j�j
|
d|jd�dS)	Nr�cSsg|]}t|��qSr)�r)r��pr)r)r*r�Rr�z%shelvedstate.save.<locals>.<listcomp>cSsg|]}t|��qSr)r�)r�rtr)r)r*r�Sr�)r�r�r�r�r�r�r�r�r�s%d)�	firstline)rr[r#�dirstater�r��_nokeepr�r�rrOrr�rPr�)r�r'r-Zoriginalwctxr�r�r�r�Z
activebookr�r>r)r)r*�saveAs

�


�zshelvedstate.savecCs|jj|jdd�dS)NT)Z
ignoremissing)rZ
unlinkpathr�)r�r'r)r)r*�clear^szshelvedstate.clearN)Fr�F)rCrDrEr}r�r�r�r�r�r��classmethodr�r�r�r�r�r�r)r)r)r*r~�s,



#	�r~cCs~|j�dd�}t|dd�}|��}|dkrH|t|�krH||dd}nd}||d�D] \}}||krjqX|�|���qXdS)Nrs
maxbackupsT)r(rr)rYZ	configintr rB�lenr.r|)r'Z
maxbackupsZ
backup_dirZhgfilesZbordermtimer9r-r)r)r*�cleanupoldbackupscsr�cCs|j}|rt�|�|Sr!)�_activebookmarkrZ
deactivate)r'r�r)r)r*�_backupactivebookmarkrs
r�cCs|rt�||�dSr!)r�activate)r'Zmarkr)r)r*�_restoreactivebookmarkysr�cCs,d}|j�||�|��|j�d|�dS)z@Abort current transaction for shelve/unshelve, but keep dirstatesdirstate.shelveN)r�Z
savebackup�abortZ
restorebackup)r'rfZdirstatebackupnamer)r)r*�_aborttransaction~sr�cs��fdd�}|�d�}|jp&|��p&d���dd����dd����d�rX��ddd	��|r�t|��|���r�td
�|}t�	|��d|vs�d|vr�t�	td���|�d�r�t�	td���n*t|�}|�D]}|�|���s�|}q�q�|S)
z/Decide on the name this shelve is going to havec3s(�Vt�d�D]}d�|fVqdS)Nrs%s-%02d)rmrn)rq��labelr)r*rr�szgetshelvename.<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�optsrrr-�e�	shelf_dirrtr)r�r*�
getshelvename�s.


�

r�ccsnth}t��}|�|�|rj|��}|��V|��D]0}|��}||vr6|�|�|�	�r6|�|�q6qdS)zireturn all mutable ancestors for ctx (included)

    Much faster than the revset ancestors(ctx) & draft()N)
r�collections�dequer:�popleftr[r��revr7Zmutable)�ctxr?Zvisitr�r�r)r)r*�mutableancestors�s


r�Fcs&��fdd���fdd�}|r"|S�S)Nc
	s�t�|d�}|r"|jjd}|j_tj}t�|�s8tj}d|i}z�d}	�rdtj	fddit
�|���}	|j�
|��:|j|t|�d�||	�d�Wd�W|r�||j_S1s�0YW|r�||j_n|r�||j_0dS)NsmqF�sphasess
new-commitZeditforms
shelve.shelve�date��editor�extra)rZsafehasattrZmqZcheckappliedrrarbrcrZgetcommiteditorr�	strkwargsrY�configoverride�commit�
shelveuserr.)
rYr'�message�matchr�ZhasmqZsavedr_�	overridesZeditor_r�r)r*�
commitfunc�s>
���	�	
�z!getcommitfunc.<locals>.commitfunccs4t�|�}t�|d|i�}|d}�|||||�S)Nr/�message)r�byteskwargsrr�)rYr'�patsr�r�r�)r�r)r*�interactivecommitfunc�s
z,getcommitfunc.<locals>.interactivecommitfuncr))r�r�r�r�r))r�r�r�r*�
getcommitfunc�sr�cCsL|jt�|d||�d�}|jr:|�td�t|j��n|�td��dS)N)r�s4nothing changed (%d missing files, see 'hg status')
snothing changed
)�statusrr��deletedrr�)rYr'r�r�rLr)r)r*�_nothingtoshelvemessaging�s��r�cCs�dt|�i}t|��|�}|�|�tt||��}|�|||�|�d��.}tj	||g|t
jdd�|d�Wd�n1s�0YdS)N�nodeswbT)�git)r�r�)rr r.rQ�listr�rXrlrZ
exportfilerZdiffopts)r'r[r-r�r>rArZrgr)r)r*�_shelvecreatedcommit�s
�r�cCsF|jt�|d||�dd�}|jrBd�|j�|d<|d�|j�dS)NT)r��unknown��shelve_unknown)r�rr�r�r#r7)r'r�r�r��sr)r)r*�_includeunknownfiles�sr�cCs"t�|�r|��n
t||�dSr!)rrbrer�)r'rfr)r)r*�
_finishshelves

r�cCsD|���(t�|�t||||�Wd�S1s60YdS)z$subcommand that creates a new shelveN)�wlockr�checkunfinished�_docreatecmd)rYr'r�r�r)r)r*�	createcmds

r�c
Cs�|d}|��}|d}|��}|��tkrFd|���dd�d}nd}|�d�s\||d<d}	}
}�z|��}	|jddd	�d
�}
|�dd�}|�d
d�o�|�dd�}
t	|||�}t
|�}ddi}|
r�t||||�t|��rt
||��s|j�|d���t||dd�}|�s,t�|||||�}n*tj|||ddtjg|�Rit�|���}|�s�t||||�Wt||�t�|
|	�dSt�|||���}t||||�|�t d�|�|d�r|j�!��t�"|||�Wd�n1�s�0Yn.t#�$||�%��t&j'�(|�}|�)��s.|�*�||d��k�rXt
||��sX|j�|�t+||
�Wt||�t�|
|	�nt||�t�|
|	�0dS)Nrschanges to: %s�
rs(changes in empty repository)r�rcSsdSr!r)��xr)r)r*�<lambda>&r�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��	setbranchr�rr��dorecord�recordfilterrr�r�r��lockmod�releaser�
matchfiles�filesr�r�r�parentchangeZmovedirstater�updater[�
mergestatemodrrS�unresolvedcount�resetr�)rYr'r�r�r�r�r�Z
origbranch�descrrfr�r�Zincludeunknownr-r�r�r[r��msr)r)r*r�s|
����

�
0

�
r�cCs0|o.|�dd�o.|�dd�o.|�dd�S)Nr�Fsincludesexclude)r.)r�r�r)r)r*rcs���rcCs|d��|d��kSrv)r��r'r)r)r*rlsrcCsp|���Tt|�}t�|j�t��}|��D] \}}|�|��|�t	|�q,Wd�n1sb0YdS)z#subcommand that deletes all shelvesN)
r�r r"rr#r$rBr.r{r�)rYr'r�rsZ_mtimer-r)r)r*�
cleanupcmdps
rcCs�|st�td���|���ft�|j�t��}|D]>}t|��	|�}|�
�s^t�td�|��|�|�t|�q2Wd�n1s�0YdS)z)subcommand that deletes a specific shelvesno shelved changes specified!�shelved change '%s' not foundN)
r
�
InputErrorrr�r"rr#r$r r.r8r{r�)rYr'r�rsr-rAr)r)r*�	deletecmd{s

�
rc	Cs�t|�}d}|��s|��}d}|�d�t|�}|��D�]�\}}|rR||vrRq:|j||d�d}|jrv|�d�q:|�ddt|��d}	t	�
|�}
d	tj|
d
d�}|j|dd�|�dd
t|��|	d
7}	|�
|�����}|��}
|
s��q4|
�d�s�|
��}|���r$t�|||	�}|�|��q4q�|�d�|d�s`|d�s`Wd�q:|��}|d�r�t�t|�D]\}}|j||d��q~|d�r�tj||d�D]\}}|j||d��q�Wd�q:1�s�0Yq:dS)z,subcommand that displays the list of shelves�Ps
shelve.newestrr�sshelve.namer�r��s(%s)T)Zabbrevs
shelve.age��#rsstatN)�width)r5ZplainZ	termwidthZpagerr rBrP�quietr�rZmakedater�ager.rlr�r��rstrip�	formattedrZellipsis�	readlinesrZ	difflabel�iterZ
diffstatui)rYr'r�r�rZ	namelabelr�r9r-�used�daterrg�linerZ	difflines�chunkr�r)r)r*�listcmd�sT








r%c	Cs|t|�}t|�dkr@|��}|s.t�td���|d\}}|g}|D]$}|�|���sDt�td�|��qDt||||�dS)z subcommand that displays shelvesrsthere are no shelves to showscannot find shelf %sN)	r r�rBr
r�rr.r8r%)	rYr'r�r�r�Zshelvesr9r-Z	shelfnamer)r)r*�	patchcmds�sr&cCs"|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�r(c
Cs�z&t�|�}|�d�dur$|j|d<Wn�tyh}z*|jtjkrD�t�|t	d��WYd}~n�d}~0t
jy�}zl|�t
�|�d�|�d�r�t	d�}t	d�}t
j||d��n"|�d�r�t�|�t
�t	d	���WYd}~n
d}~00|S)
Nr�r\r��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��IOErrorr3r4rZwrongtooltocontinuerr
r��debugrr�r�r�)rYr'r�r'r=�msgr+r)r)r*�_loadshelvedstate�s0
$
�

��r0cCs�|����z�t||�t�|j�|jrB|j|jvrBt�||j�t	|||j
|j�t�|�stt
j|||jddd�Wt�|�|�td�|j�n t�|�|�td�|j�0Wd�n1s�0YdS)z-subcommand that abort an in-progress unshelveFr�ZbackupZtopicsunshelve of '%s' aborted
N)rr(rZclean_updater�r�Z
_bookmarksrr��
mergefilesr�rrbrr�r�r~r��warnrr-�rYr'r'r)r)r*�
unshelveabort�s


�
�
r5cCsH|���,t||ddi�}t|||�Wd�S1s:0YdS)z(logic to  abort unshelve using 'hg abortr,TN)r�r0r5r4r)r)r*�hgabortunshelves
r6cCsP|�ddi��.t�||���t�|||�Wd�n1sB0YdS)zLupdates to wctx and merges the changes from shelvectx into the
    dirstate.��uisquietTN)r�rrr[rZrevert)rYr'r�rir)r)r*r2sr2cCs4|r0||j��kr0|j�|�|�td�|�dS)Ns&marked working directory as branch %s
)r�r�rr�r)rYr'r�r)r)r*�
restorebranchs

�r9cCs<|�d�s8t�|j�t��}t|��|��|�t|�dS)z&remove related files after an unshelver�N)r.r"rr#r$r r{r�)rYr'r-r�rsr)r)r*�unshelvecleanups
r:c
Cs8|j}|j}|����t||�tj�|�}|��rLtj	t
d�t
d�d��||jd}|j}|j
���4|�|j��|j�|j
�|���Wd�n1s�0Ytj}	t�|�s�tj}	d|	i}
|j�|
d��f|j
���:|�|jd|j�t||||||�\}}Wd�n1�s(0YWd�n1�sH0Y|du�rv|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�n1�s*0YdS)z.subcommand to continue an in-progress unshelves$unresolved conflicts, can't continues/see 'hg resolve', then 'hg unshelve --continue'r*rNr�r\r�<note: unshelved changes already existed in the working copy
Frr1sunshelve of '%s' complete
)+r�r-rr(rrrSr
r
r�rr�r�r�r
�
setparentsr[�nullidrPZcurrenttransactionrrarbrcrYr��_createunshelvectxr�r�r:rrr2r�r9r�rr�r~r�r:r�r�)rYr'r'r�r��basenamerrir�r_r��newnode�ispartialunshelver/r)r)r*�unshelvecontinue#sZ
�.
�H
�
�
rBcCsP|���4t||ddi�}t|||d|ji�Wd�S1sB0YdS)z,logic to resume unshelve using 'hg continue'r)Tr�N)r�r0rBr�r4r)r)r*�hgcontinueunshelve_s
rCc
Cs�|��}t|j�}|js,|js,|js,||fS|�td��ddi}t|ddd�}i}d|d<|�d�|d<|�d	d
i��"t	�
|||g|�}	Wd�n1s�0Y||	}||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 commitr�r�r7TN)r��	frozenset�addedZmodifiedZremovedrr�r.r�rr�)
rYr'r��tmpwctxr��addedbeforer�r�Ztempoptsr[r)r)r*�_commitworkingcopychangesfs$
��0rHcCs�|��}d}t|��|�}|��r.|��d}|dus>||vr�|�ddi��|�||�}Wd�n1sn0Y|dur�dt|���i}|�	|�n||}||fS)z5Recreate commit in the repository during the unshelveNr�r7T)
rVr r.rRrTr�rdrr[rQ)rYr'rfr?r[rArir>r)r)r*�_unshelverestorecommits*rIcCs�|��|d<d|d<g}|sF|j|��|��|��|��d�}|dfSt|��ddd�}tj|||ddtjg|�Rit	�
|���}|j|��|��|��d�}	|	r�t�|||	�
��}
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.
    r�Tsinteractive-unshelve)�textr��userr"F)r�r�N)rJr�rK)r�r�r�rKr"r�rrrrr�rrr	r��bool)rYr'rir?r�r�r�r@r�Zsnode�mr)r)r*r>�sB����
�r>csz|�d�}|��|����kr*|s*|dfS|�dd�tjd�}�j�|d���|�td��t	j
�|gd�d	d
�}
|
jr�|���fdd�t
�|t���D�}t��|||||	|�d
�|
|�	t�d���j���8��|���j�t|�||||�\}}Wd�n1�s0Y|du�r@|}td�}|�|�n�|}t	�|�Wd�n1�sh0Y||fS)zBRebase restored commit from its original location to a destinationr�F�toolr�)�r8s
forcemerger�r\srebasing shelved changes
)sworking-copysshelved changesparent of shelved changeT)�labelsZkeepconflictparentcsg|]}�j�|��qSr))�	changelogr[)r�r�rr)r*r��s�z)_rebaserestoredcommit.<locals>.<listcomp>r�Nr;)r.r[�p1rrcrYr�r�rrZgraftr
rerZxranger�r~r�r
ZConflictResolutionRequiredr�r
r<r=r>r)rYr'r�rf�	oldtiprevr?�pctxrFrir�r�r�r�Zstatsr�r@rAr/r)rr*�_rebaserestoredcommit�sZ

��

��
�(
�*rUcCsP|���d�}|sdSt|�d��}t|��j�}||@|}|d�|�dS)Nr�r�)r�r.rDr�r�rEZforget)r'rirGZ
shelveunknownZ
addedafterZtoforgetr)r)r*�_forgetunknownfilessrVcCs*t||�|��j�||�t||�dSr!)r�rVrQr�r�)r'rSrfr�r)r)r*�_finishunshelve&s
rWcCsJt|��j�}t|���}|�|�}|rFtd�}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 missingr*N)r5r�r�r	�intersectionrr
r�)rYr'riZ	wcdeletedZ
shelvetouchedrXrMr+r)r)r*�_checkunshelveuntrackedproblems0s
rYc	Os�t�|�}|�d�}|�d�}|�d�}|s:|s:t�|�t|�}|�d�rZ|�|d�|rv|�d�rvt�t	d���|s�|�r|r�|r�t�t	d���|r�t�t	d���|r�|�d	d
�r�|�
t	d��t|||�}|r�t|||�S|r�|r�t�t	d���n|�r|t
||||�Snlt|�d
k�r.t�t	d���nN|�stt|���}|�sTt�t	d���|dd
}|�t	d�|�n|d}t|��|����s�t�t	d�|��t||||�S)Nr,r)r�r�r�s,--keep on --interactive is not yet supporteds"cannot use both abort and continues:cannot combine abort/continue with naming a shelved changerNFstool 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'
r)rr�r.rr�r�r:r
rrr3r0r5rBr�r rBZ
StateErrorr�r8�_dounshelve)	rYr'Zshelvedr�ZabortfZ	continuefr�r'r?r)r)r*�unshelvecmd<sZ





�
���r[cCs�|��}d}}�zP|��}|jddd�d�}t|�}|d}|}t|�}	t||||�\}}
t||||�\}}t|||�d}|��|�	���kr�|��}t
|||||||||||	�\}}
d|�dd�i}|�|d��t
||||�Wd�n1s�0Yt|||�t�|�t||||	�t|||
�|
�sHt||||�W|�rX|��t�|�n|�rr|��t�|�0dS)	Nr\cSsdSr!r)r�r)r)r*r�wr�z_dounshelve.<locals>.<lambda>r�r/r�rOrN)rVrrr�r�rHrIrYr�rRrUr.r�r2r9r~r�rWrVr:rr)rYr'r?r�rrfrSrTrFr�rGrir�rAr�r)r)r*rZrsZ��
,
�rZ)F)Ur}Z
__future__rr�r3rmrLZi18nrr[rrr�rr	r
rrr
rrrrrrrrrrrrrrrrr"Zutilsrrr$r%rxr��objectr r,r~r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr%r&r(r0r5r6r2r9r:rBrCrHrIr>rUrVrWrYr[rZr)r)r)r*�<module>slX!p(
&Q	/<8N
6

Youez - 2016 - github.com/yon3zu
LinuXploit