^cdZddlZddlZddlZddlZddlmZddlmZm Z m Z ddl m Z m Z mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZm Z m!Z"ddl#m$Z$m%Z%dZ&d Z'gd Z(d Z)Gd d Z*dZ+dZ,GddZ-dZ.GddZ/dZ0dZ1dZ2dZ3dZ4dZ5d;dZ6dZ7dZ8dZ9d Z:d!Z;d"Zd%Z?d&Z@d'ZAd(ZBd)ZCd*ZDd+ZEd,ZFd-ZGd.ZHd/ZId0ZJd1ZKd2ZLd3ZMd4ZNd5ZOd6ZPd7ZQd8ZRd9ZSd:ZTdS)> KKMME KK & & & &dD))))s  ++NF)__name__ __module__ __qualname__r,r1rCr-r+r!r!GsF<<<< %%%*****r-r!chtj|o|jdddkS)Nrsstoreinternal)rsupportinternaluiconfigr)s r+_use_internal_phaserOfs2t$$ ? GNN9h / /; >r-cPt|r tjn tjSr#)rOrinternalsecretrNs r+ _target_phaserSms1$77 J6??V]Jr-cteZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z dd ZdZdZdZdZdZdS)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. c"||_||_dSr#rr0)r(rr0s r+r,zShelf.__init__ys r-cX|dp|ddS)N.shelve.patch.hg)_existsr(s r+r:z Shelf.exists}s'||J''J4<< 6+J+JJr-c:tfd|DS)Nc3\K|]&}jj|zV'dSr#rr:r0).0extr(s r+ z Shelf._exists..s7DD48??49s?33DDDDDDr-)all)r(extss` r+r[z Shelf._existss&DDDDtDDDDDDr-c |dtjS#t$r(|dtjcYSwxYw)NrXrY)_statstatST_MTIMEr6r\s r+r;z Shelf.mtimesZ 8::j))$-8 8  8 8 8::i((7 7 7 7 8s$'/AAcF|j|j|zSr#)rrgr0r(ras r+rfz Shelf._statsx}}TY_---r-cptj|j|jdz|dSNrX)rsimplekeyvaluefilerr0write)r(r?s r+ writeinfozShelf.writeinfos2"48TY-CDDJJ4PPPPPr-cF|j|jdzSrlr_r\s r+hasinfoz Shelf.hasinfosxty:5666r-cjtj|j|jdzSrl)rrmrr0readr\s r+readinfozShelf.readinfos.) Hdi*,  $&& r-c^tj|}|dkrd}d}nd}d}|}tj|||g}tj|||d}|j|jdz} tj |j || ||j|dS) Ns01sHG10BZsHG20sBZ) missingroots ancestorsofrrZ) compression) r safeversion unfilteredr outgoingmakechangegrouprr%r0r writebundlerL) r(r)basesnode cgversionbtyperxr{cgbundle_filenames r+r}zShelf.writebundles+D11   EKKEK  % u4&    (xI N N(-- F(:;; G    H#       r-c |jdz}||} t|}tj|j|||j}|d}t j|||dd|j|z||d}||kr|j dd} || }|| S#| wxYw)NrZstipunshelvesbundle:)sourceurl targetphases revduplicates) r0rrSr readbundlerLr applybundler%changesclose) r(r)trrAfprgenpretip shelvectx shelverevs r+rzShelf.applybundles9v% XXh   '--K%dgr8TXFFC&\F  "x!8!88'     V I""J'78<  O  HHJJJJBHHJJJJs BC C#rbc>||jdz|S)NrYrV)r(modes r+ open_patchzShelf.open_patchsxx I-t444r-c|}t||}tj}t j||g|t jd||d|S)NTgitoptsmatchr) rz_optimized_matchioBytesIOr exportfilerdiffoptsseek)r(r)rrrs r+patch_from_nodezShelf.patch_from_nodesy   t,, Z\\  F D)))        r-c |||dS#ttjf$r|cYSwxYw)Nnode)rrtr6r RepoLookupErrorr)r(r)s r+ load_patchzShelf.load_patchsc %''dmmoog.FGG G!5#89 % % %??$$ $ $ $ %s-0*AAcd}||D].}||s||cS/dS)Nc3K|V|dd\}}tjdD] }d|||fzV dS)Nr3rs%s-%d.%s)r8 itertoolscount)baserais r+gennamesz'Shelf._backupfilename..gennamesscJJJ D!,,ID#_Q'' 3 3!T1cN22222 3 3r-)r:r%)r( backupvfsrArns r+_backupfilenamezShelf._backupfilenamesi 3 3 3 (## ) )A##A&& ) ~~a((((( ) ) )r-c:|s|tD]j}|jdz|z}|j|rAt j|j|| ||kdSNr3) isdirmakedirshelvefileextensionsr0rr:rrenamer%r)r(rsuffixrAs r+ movetobackupzShelf.movetobackups        *  Fy4'&0Hxx((  HMM(++((H==  r-cdtD]'}|j|jdz|z(dSr)rr tryunlinkr0rjs r+deletez Shelf.deletes@' 7 7C H  ty4/#5 6 6 6 6 7 7r-N)r)rErFrG__doc__r,r:r[r;rfrorqrtr}rrrrrrrrHr-r+r/r/qsKKKEEE888 ...QQQ777    4.5555   %%% ) ) )   77777r-r/c\tj|||S)z Create a matcher so that prefetch doesn't attempt to fetch the entire repository pointlessly, and as an optimisation for movedirstate, if needed. )r matchfilesfiles)r)rs r+rrs'  dDJ$4$4$6$6 7 77r-ceZdZdZdZdZdZdZdZdZ e dZ e d Z e d Z e d Ze ddZe dZdS) shelvedstatezHandle 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 shelvedstatekeepsnokeeps:no-active-bookmark interactivec t|d|d<t|d|d<d|ddD|d<d|ddD|d<dS#ttf$r+}t jt j|d}~wwxYw) z@Some basic shelvestate syntactic verification and transformation originalwctx pendingctxc0g|]}|t|SrHrr`hs r+ z4shelvedstate._verifyandtransform..s#LLL!LSVVLLLr-parents c0g|]}|t|SrHrrs r+rz4shelvedstate._verifyandtransform..s3###1#A###r- nodestoremoveN)rsplit ValueErrorKeyErrorr CorruptedStater forcebytestr)clsderrs r+_verifyandtransformz shelvedstate._verifyandtransforms E!$Q%7!8!8Ao "1]#344Am LLQz]-@-@-F-FLLLAjM## !"2 3 9 9$ ? ?###A   H% E E E&z'>s'C'CDD D EsBBC&B;;Ccr||j} t|}n8#t $r+}t jtj |d}~wwxYw | n#| wxYw|S)z.Read version information from shelvestate fileN) r _filenameintreadlinestriprr rrrr)rr)rversionrs r+ _getversionzshelvedstate._getversion sXXcm $ $ "++----//00GG E E E&z'>s'C'CDD D E  HHJJJJBHHJJJJs)3AB B&BBBB4cgd}||j}i} |D]+}|||<, |n#|wxYw|S)z9Read the old position-based version of a shelvestate file) sversionnamerrrrbranchtorestorer activebook)rrrrr)rr)keysrrkeys r+_readoldzshelvedstate._readold,s    XXcm $ $   / /,,..# / HHJJJJBHHJJJJs .A&&A<c||}||jkr||}n`||jkr4tj|j|jd}n!tj td| | |}|d|_ ||d|_ ||d|_|d|_|d|_|d d |_|d |jk|_d |_|d d |jkr|d d |_|d |jk|_nD#tjt4f$r+}tjt9j|d}~wwxYw|S)NT)firstlinenonkeyvalsIthis version of shelve is incompatible with the version used in this reporrrrrrr-rrr)r_versionrrrmrrrsr Abortrrr0wctx pendingctxparents nodestoremover1branchtorestore_keepkeepactivebookmark _noactivebook _interactive interactiverrrrbytestr)rr)rrobjrs r+loadzshelvedstate.loadHs//$'' S\ ! ! T""AA  $ $*48S]CCHH#'IAA+:  """ >#%%CzCHAo./CH!!M"23CNJ-CK !"2 3C "#%%(:C"@"@C uuW~~2CH!$C uu]C((C,===%&UU=#%>%>"eeN33s7GGCOO%x0 > > >&x'7'<'<== = > s-C9F''G(=&G##G(Fr-c |t|t|dd|jDdd|D||r|jn|j|p|jd} | r |j| d<tj |j |j  | d|jzdS)Nrc,g|]}t|SrHr)r`ps r+rz%shelvedstate.save..}s"K"K"Ka3q66"K"K"Kr-c,g|]}t|SrHr)r`rs r+rz%shelvedstate.save..~s(G(G(GAQ(G(G(Gr-)rrrrrrrrrs%d) firstline)rrr%dirstaterr_nokeeprrrrmrrrnr) rr)r0 originalwctxrrrr activebookrr?s r+savezshelvedstate.savels !2!2!4!455z0011 "K"K4=3H3H3J3J"K"K"KLL"ii(G(G(G(G(GHH /"&7SYYCK%:):     4#D "48S];;AA US\1 B     r-cH|j|jddS)NT) ignoremissing)r unlinkpathr)rr)s r+clearzshelvedstate.clears% CM>>>>>r-N)Fr-F)rErFrGrrrrrrr classmethodrrrrrr rHr-r+rrs HI EG*M!L E E[ E  [ [6!![!F   [ 8??[???r-rc\|jdd}t|d}|}|dkr%|t |kr||dz d}nd}||dD]3\}}||kr ||4dS)Nrs maxbackupsT)r*rr)rL configintr!rClenr1r)r) maxbackups backup_dirhgfiles bordermtimer;r0s r+cleanupoldbackupsrs""9m<.gennamessK ## * *Aqz) ) ) ) ) * *r-rsdefault/_\r3rs*a shelved change named '%s' already existss,shelved change names can not contain slashess+shelved change names can not start with '.') r1rbranchreplace startswithr!r:rr r) r)parentrrr0e shelf_dirrr$s @r+ getshelvenamer.s***** 88G  D  AFMMOO AzE MM$ % %E MM% & &E - dD!,,  D>>  d # # * * , , !?@@4GA+a..  4<<5D==+ABB  ??4  Q+a NOOPP P QTNN   A==##**,,   Kr-c#Kth}tj}|||r|}|V|D]X}|}||vr>||| r||Y|dSdS)zireturn all mutable ancestors for ctx (included) Much faster than the revset ancestors(ctx) & draft()N) r collectionsdequer<popleftrrrevr9mutable)ctxr@visitr+r3s r+mutableancestorsr7s 9D    E LL )mmoohhjjkkmm ) )F**,,C$ >>##)LL((( )))))r-Fc*fdfd}|r|nS)Nc tj|d}|r|jjdc}|j_t |}d|i} d} r%t jddditj|} |j |5| |t| d|| cddd|r ||j_SS#1swxYwY |r||j_dSdS#|r ||j_wxYw) NsmqFsphasess new-commiteditforms shelve.shelvedate)editorextrarH)r safehasattrmq checkappliedrSr getcommiteditorr strkwargsrLconfigoverridecommit shelveuserr1) rLr)messagerrhasmqsavedr overrideseditor_r=r>s r+ commitfuncz!getcommitfunc..commitfuncs u--  F*.'*> 'E47'#D)) /=  -G !1-191CD1I1I'' 22  {{HHW%%" #        -',$$ -          -',$$$ - -u -',$,,,,s1AC6 3C< C6CC6C C66Dctj|}tj|d|i}|d}|||||S)Nr3message)r byteskwargsrr)rLr)patsrrrGrLs r+interactivecommitfuncz,getcommitfunc..interactivecommitfuncsL#D)) d4j$33z"z"dGUD999r-rH)r>rr=rQrLs` ` @r+ getcommitfuncrRsO------4::::: %0 ? Z?r-c*|tj|d||}|jr9|t dt |jzdS|t ddS)N)rs4nothing changed (%d missing files, see 'hg status') snothing changed )statusrrdeletedrr)rLr)rPrrgs r+_nothingtoshelvemessagingrVs ;;W]4:tTBB; C CD |+ F G G$,      !())*****r-c dt|i}t||}||t t ||}|||||d5}tj ||g|tj d|ddddS#1swxYwYdS)NrswbTrr) rr!r1rolistr7r}rr rrr)r)rr0rr?rBr~rs r+_shelvecreatedcommitrYs SYY D TNN  t $ $E OOD !$t*-- . .E dE4(((   %  B 4&"5>d#;#;#;5                      s.CCCc|tj|d||d}|jr?d|j|d<|d|jdSdS)NT)runknownshelve_unknown)rTrrr[r%r9)r)rPrr>ss r+_includeunknownfilesr_&st '-T D$?? NNAy"#(::ai#8#8  T qy!!!!!""r-cpt|r|dSt||dSr#)rOrr!)r)rs r+ _finishshelvera-s94  $  $#####r-c|5tj|t||||cdddS#1swxYwYdS)z$subcommand that creates a new shelveN)wlockr checkunfinished _docreatecmd)rLr)rPrs r+ createcmdrf4s 22%%%BdD11222222222222222222s&AA A c|d}|}|d}|}|tkr2d|dddz}nd}|ds||d<dx} x} } |} |dd } |d d } |d d o|d d  } t|||}t|} ddi}| rt||||t|rBt||s2|j|dt!|| d}| st#j|||||}n6t#j|||dd t"jg|Rit+j|}|s:t/|||| t1|| t3j| | dSt7||}t9|||||t=d|z|drH|j5tAj!|||dddn #1swxYwYnntEj#||$tJj&'|}|(s|)||dkr*t||s|j|tU|| t1|| t3j| | dS#t1|| t3j| | wxYw)Nrschanges to: %s rs(changes in empty repository)rNrcdSr#rHxs r+z_docreatecmd..Os$r-reportrFsunknowns addremoverJr3T)r=sshelved as %s r)+rr(r3r descriptionrr1r transactionr.rr__iswctxonnewbranch _isbareshelver setbranchrRr rEdorecord recordfilterrrCrVrlockmodreleaserrYrTr parentchanger movedirstaterupdater mergestatemodrrsunresolvedcountresetra)rLr)rPrrrr+ origbranchdescrrrrincludeunknownr0r>rLrrmss r+rere;s8 :DllnnG QZFJ zz||w 6#5#5#7#7#=#=eQ#G#G#JJ/ 88J   Z!%%D%2<"yy{{  i  ? ?hh~u55 *e44 TXX %> > : T6400.t44i(  : tT5 9 9 9 d # # 9M$,E,E 9 M # #DJ$5$5$7$7 8 8 8"5+dCCC  >"dJdCCDD#$    $T**  D  %b$d ; ; ;( t^444D!!!!!'!t,,T4u555 !&''$./// = ++-- : :$T65999 : : : : : : : : : : : : : : : IdFKKMM * * *)..t44B%%''  d**,, , ,]45N5N , M # #J / / /dBt^444D!!!!! t^444D!!!!s9+E/OA(O*K  O KOKC O'O-c| oD|dd o-|dd o|dd S)NrFsincludesexclude)r1)rPrs r+rrrrsY  ,// / ,U++ + ,U++ + r-cn|d|dkSr)r(rNs r+rqrqs- :    $t*"3"3"5"5 55r-c|5t|}tj|jt }|D]<\}}|||t|= ddddS#1swxYwYdS)z#subcommand that deletes all shelvesN) rcr!r$rr%r&rCr1rr)rLr)r-r_mtimer0s r+ cleanupcmdrs $$TNN Jtx}}Y7788 %1133 $ $LFD MM$   , ,Y 7 7 7 d # # # # $$$$$$$$$$$$$$$$$$$sBB55B9<B9c|s!tjtd|5t j|jt}|D]}t| |}| s$tjtd|z| |t| ddddS#1swxYwYdS)z)subcommand that deletes a specific shelvesno shelved changes specified!shelved change '%s' not foundN) r InputErrorrrcr$rr%r&r!r1r:rr)rLr)rPrr0rBs r+ deletecmdrs> Dq!ABBCCC  $ $Jtx}}Y7788  $ $DTNN&&t,,E<<>> &677$>   y ) ) ) d # # # # $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $sB5C;;C?C?ct|}d}|s|}d}|dt |}|D]c\}}|r||vr |||d}|jr|dC|ddt|z zd} tj |} d tj | d z} || d |dd t| z z| d z } | ||5} | } | snl| dsV| }|rt'j||| z }||n|d|ds|ds ddd| }|dr7t-jt0|D]\}}||||dr3t-j||D]\}}|||dddn #1swxYwYedS)z,subcommand that displays the list of shelvesPs shelve.newestr)r$s shelve.namerhrs(%s)T)abbrevs shelve.age #rsstatN)width)r7plain termwidthpagerr!rCrnquietrrmakedaterager1rrr*rstrip formattedrellipsis readlinesr difflabeliter diffstatui)rLr)rPrr namelabelr-r;r0useddaterrliner difflineschunkr$s r+listcmdrs. t99D E 88::  IHHYI ,,..#1#1 t  D$$  Y'''" 8  HHUOOO  c$ii())) ''+D>>>> M*** c#hh'(((   ]]4 + +D 1 1 1R {{}}t,,;;==D||~~G)24FFHHTNNN  HHUOOON d7m  1 1 1 1 1 1 1 IH~ 1$)OD)$D$D11LE5HHU%H0000G} 1$)$4Ye$L$L$L11LE5HHU%H0000) 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1#1#1s:B+K 2BK  K K ct|}t|dkrE|}|s!tjt d|d\}}|g}|D]M}||s$tjt d|zNt||||dS)z subcommand that displays shelvesrsthere are no shelves to showscannot find shelf %sN) r!rrCr rrr1r:r) rLr)rPrr-shelvesr;r0 shelfnames r+ patchcmdsrsI 4yyA~~'')) B+a ?@@AA Aaj tvFF }}Y''..00 F+a 7889DEE E F BdD!!!!!r-c|j|jkr!tjt ddS)z'check parent while resuming an unshelves5working directory parents do not match unshelve stateN)rrr rr)r)states r+ checkparentsrsE } --////k F G G   0/r-c t|}|d |j|d<n #t$r%t j|tdYntj $r}| tj |dz|dr4td}td}tj |||dr;t|tj td Yd}~nd}~wwxYw|S) Nrrrhcontinuescorrupted shelved state files:please run hg unshelve --abort to abort unshelve operationhintabortspcould not read shelved state file, your working copy may be in an unexpected state please update to some commit )rrr1rr6r wrongtooltocontinuerr rdebugrrrr )rLr)rrrmsgrs r+_loadshelvedstatersh!!$'' 88G   $!JDM :::#D!K..99999   !#&&./// 88K  344CD+c--- - XXh      t $ $ $+6      $ Ls9=,E+E9CEEc|5 t||tj|j|jr(|j|jvrtj||jt|||j |jt|stj |||jddt||t%d|jznI#t||t%d|jzwxYw ddddS#1swxYwYdS)z-subcommand that abort an in-progress unshelveFrbackuptopicsunshelve of '%s' aborted N)rrr clean_updaterr _bookmarksrr mergefilesrrOrrrrr warnrr0rLr)rs r+ unshelveabortrs CC C u % % %  u/ 0 0 0# ?(<(O(O"4)=>>> r4U-= > > >&t,,  e1%y   t $ $ $ GGA344uzA B B B B   t $ $ $ GGA344uzA B B B B BCCCCCCCCCCCCCCCCCCs+EB!C=8AE=AEEEEc|5t||ddi}t|||cdddS#1swxYwYdS)z(logic to abort unshelve using 'hg abortrTN)rcrrrs r+hgabortunshelver(s ..!"dXt,<==Ru--..................s$AA  A c|ddi5tj||t j|||ddddS#1swxYwYdS)zLupdates to wctx and merges the changes from shelvectx into the dirstate.uisquietTN)rDrrzrr revert)rLr)rrs r+rr/s  -t4 5 5,, $ $$$r4+++,,,,,,,,,,,,,,,,,,s>A##A'*A'c|r^||jkrC|j||t d|zdSdSdS)Ns&marked working directory as branch %s )rr(rsrTr)rLr)rs r+ restorebranchr7sy ?dm.B.B.D.DDD 000 8 9 9O K       DDr-c|dswtj|jt}t |||t|dSdS)z&remove related files after an unshelverN)r1r$rr%r&r!rr)rLr)r0rrs r+unshelvecleanupr?sy 88G   Jtx}}Y7788 4  --i888$  r-c ||j}|j}|5t||tj|}|r0tj tdtd||j d}|j }|j 5||j |j|j |dddn #1swxYwYt)|} d| i} |j| d5|j 5||j d|jt/||||||\} } dddn #1swxYwYdddn #1swxYwY| ,|j }td } || n"|j| || }t7j|t;|||j|t?|||j tC|stEj#|||jd d tH%|| stM|||j|tO||j(|td |jzddddS#1swxYwYdS)z.subcommand to continue an in-progress unshelves$unresolved conflicts, can't continues/see 'hg resolve', then 'hg unshelve --continue'rrNr:rr<note: unshelved changes already existed in the working copy Frrsunshelve of '%s' complete ))rr0rrr{rrsr|r rrrrrrx setparentsrnullidrncurrenttransactionrSrLrD_createunshelvectxrTrr<rrzrrrrrOrrrr rrr)rLr)rrrbasenamerrrrrJnewnodeispartialunshelvers r+unshelvecontinuerGs1#KzH 1B1BT5!!!  % * *4 0 0     +9::IJJ  q)* % ] ' ' ) ) ; ; OOE,1133T[ A A A M   7 7 9 9 : : : ; ; ; ; ; ; ; ; ; ; ; ; ; ; ;$D)) /= W # #I{ ; ;  ++--   a 0$+>>>-?i;..**                               ?(I)C IIcNNNN   & &w / / /W I Z   2tUZ333b$ 5666"4((  LD%-e9     4     8 Bej$ 7 7 7tU%9::: !233ej@AAAc1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1BsB'L1 AD5) L15D9 9L1<D9 =1L1.G)>G G)G G)G G) L1)G- -L10G- 1D3L11L58L5c|5t||ddi}t|||d|jicdddS#1swxYwYdS)z,logic to resume unshelve using 'hg continue'rTrN)rcrrrrs r+hgcontinueunshelvers HH!"d[$,?@@D%'5:1FGGHHHHHHHHHHHHHHHHHHs,AAAc|}t|j}|js|js |js||fS|t dddi}t |dd}i}d|d<|d|d<|d d i5tj |||g|} d d d n #1swxYwY|| }||fS) zETemporarily commit working copy changes before moving unshelve commitsLtemporarily committing pending changes (restore with 'hg unshelve --abort') rJrF)r>rr=s pending changes temporary commitrNr<rTN) rT frozensetaddedmodifiedremovedrrRr1rDr rE) rLr)rtmpwctxr^ addedbeforer>rLtempoptsrs r+_commitworkingcopychangesrs_ AAG$$K J$!'$QY$ ##II  6   ) $EUeLLLJH>HZ))HW  -t4 5 5BB~b$ BAABBBBBBBBBBBBBBB4jG K s0CCCc|}d}t||}|r|d}|||vr|ddi5|||}dddn #1swxYwY|8dt|i}| |n||}||fS)z5Recreate commit in the repository during the unshelveNrrT) rzr!r1rqrtrDrrrro)rLr)rrrrBrr?s r+_unshelverestorecommitrs/ ??  D D TNN  x ( (E }})~~( |t4''    148 9 9 4 4))$33I 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 <S!1!1223D OOD ! ! !J ?sB''B+.B+c||d<d|d<g}|se|||||}|dfSt |dd}t j|||ddt jg|Ritj |}||||} | 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. rNTsinteractive-unshelve)textr>userrF)rr=N)rr>r)rorEr>rrrRr rtrurrCrrYbool) rLr)rrrrrPrrLsnodems r+rrs{*!,,..D$(D ! D ++&&((//##!!!!    ~y00d4PPPJ           T " "  G KK  " " $ $oo ^^     E  7 T5 ) )T5(A666 DKK r-c l|d} ||kr| s|dfS|ddtjd} j| d5|tdtj |gdd } | j r| fd t|tD}t||||| |d | | t#jdj5|jt/|||| |\}}d d d n #1swxYwY|'|}td}||n|}tj|d d d n #1swxYwY||fS)zBRebase restored commit from its original location to a destinationrFtoolr-)rs forcemerger:rsrebasing shelved changes )s working-copysshelved changesparent of shelved changeT)labelskeepconflictparentcDg|]}j|SrH) changelogr)r`r3r)s r+rz)_rebaserestoredcommit..s6-0##C((r-rNr)r1rp1rrRrLrDrTrrgraftr|rrangerrrr ConflictResolutionRequiredrrxrrrrz)rLr)rr oldtiprevrpctxrrrrrrJstatsrrrrs ` r+_rebaserestoredcommitrs ((>**K||~~,,....{.%!%# 6 6$*MI    ; 7 7."." !122333   $       @ HHJJJ49)SYY4O4OM   !!   2;?? ? ] ' ' ) )   OOGLLNNDK 8 8 8);D)X{D** &G&                ?I)C IIcNNNNW I L ! ! !]."."."."."."."."."."."."."."."` ' ''s9C#H':AG ? H' G H'G AH''H+.H+c2|d}|sdSt|d}t|j}||z|z }|d|dS)Nr]r\)r>r1rrrTrforget)r)rr shelveunknown addedaftertoforgets r+_forgetunknownfilesr;sOO%%))*;<**K &)&%%%7mmG xx&tG}%%% txx((  = > >     Mi M"1%J#K#KLL L  "/   9dhhw.. 9 GGA677 8 8 8!"dD11  ; T511 1  ;; ;"=>>  ;#BeT:: : ; W  q!JKKLLL 4..,,.. G"1%D#E#EFF F1:a= !/008;<<<<1: D>>  h ' ' . . 0 0Oq!ABBXMNNN r44 0 00r-c T|}dx}} |}|dd}t|}|d}t |}t ||||\} } t ||||\}} t||| d} | | kr| } t|||||||| | | | \} } d| ddi}| |d5t|||| dddn #1swxYwYt||| t|t#||||t%|| | | st'|||||r|t+j|dS#|r|t+j|wxYw)NrcdSr#rHrjs r+rlz_dounshelve..sDr-rmr3r-rr)rzrrprrrrrr(rrr1rDrrrr rrrrwrv)rLr)rrrrrrrrrrrrrJs r+rrs| ??  DD2-yy{{   k..  A AII Dz/t448T4NN0T2xHHi'D)<<<     !6!6!8!8 8 8'..00O'<            ( ( $ $,TXXgs-C-CD   y+ 6 6 2 2 r4y 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2b$0004   i^<<<D)[999  6 Bh 5 5 5   JJLLL   JJLLLs1D)G;E" G;"E&&G;)E&*A%G;;,H'rD)Urr0rrrgi18nrrrrrrr r r r r rrrrvrrrr{rrrrrrrrr$utilsrrr&r'rrFr!rOrSr/rrrrrr!r.r7rRrVrYr_rarfrerrrqrrrrrrrrrrrrrrrrrrrrr rrHr-r+rs    ,   333! ********>KKKG7G7G7G7G7G7G7G7T888G?G?G?G?G?G?G?G?T & & &''' :::%%%P)))$!@!@!@!@H+++    """$$$222K"K"K"\666$$$ $ $ $ ,1,1,1^""""   8CCC&...,,,      7B7B7BtHHH   2*5 5 5 pJ(J(J(Z        ( ( (313131l00000r-