o ]LbLD @sddlmZddlmZddlmZmZmZmZm Z ddZ ddZ d d Z d d Z d dZgdZe e e edZd@ddZededfededfdededfededfdededfededfdededfededfded edfed!edfded"d#fed$d#fded"ed%fed$ed%fded&ed'fed&ed(fded)d#fed)d#fded*d#fed+ed,fdd- ZdAd/d0Z #dBd2d3Z #dBd4d5Zd6d7Zd8d9Zd:d;Zdd?Zd#S)C)absolute_import)_) bookmarkserrorobsutilscmutilstackc Cs|jj}|jj}|jj}t}t||}|rF|}t|||}|s-| ||n|D]} | D]} || } | dkrB| | q3q/|s|S)zReturn all changesets that may be a new parent for orphan `rev`. This function works fine on non-orphan revisions, it's just silly because there's no destination implied by obsolete markers, so it'll return nothing. ) changelognode parentrevsrevsetlistpoprsuccessorssetsextendadd) reportonodeparentstorevdesttovisitrsuccsetsssndrr 4/usr/lib/python3/dist-packages/mercurial/destutil.pyorphanpossibledestinations&  r"cCsd}|d}|}d}|rQ|sQt||}|r.dd|D}|d|}n|}|r>|}|s6|}|durQt |rQ|d}||dfS)z9decide of an update destination from obsolescence markersNcSsg|] }|D]}|qqSr r ).0subrr r r! Jsz"_destupdateobs..smax(%ln).) p1obsoletechildrenrrr revsfirstrisactivewdirparent)rcleanr wcr'movemark successorsr r r!_destupdateobs0s"  r1cCs2d}t|j|\}}|dur|j|}|||fS)z4decide on an update destination from active bookmarkN)rcalculateupdateui _bookmarks)rr-r activemarkr/r r r!_destupdatebook[s   r6cCs|d}d}}|}|r|d}||vr5||}|r)|d|}t|r4|d}n|dkrE|sE|d}n|d}||dfS)z_decide on an update destination from current branch This ignores closed branch heads. Nr& max(.::(%ln))sdefaultsmax(head() and not closed())) branch branchmap branchheadsr*r+rr,r r')rr-r.r/r currentbranchheadsr r r!_destupdatebranches        r=cCs|d}|}d}||vr9|j|dd}|sJd|d|}|dus-Jdt|r8|d}n |d}|dusFJd ||dfS) zCdecide on an update destination from closed heads in current branchNTcloseds any branch has at least one headr7s4any revision has at least one descendant branch headr&stips%'tip' exists even in empty repository) r8r9r:r*r+rr,r lookup)rr-r.r;r/r<r r r r!_destupdatebranchfallbacks        rA)s evolutionsbookmarksbranchsbranchfallbackFcCsLd}}}tD]}t|||\}}}|durnq||}|||fS)a"destination for bare update operation return (rev, movemark, activemark) - rev: the revision to update to, - movemark: node to move the active bookmark from (cf bookmark.calculate update), - activemark: a bookmark to activate at the end of the update. N)destupdatestepsdestupdatestepmapr)rr-r r/r5steprr r r! destupdates   rEsTmultiple matching bookmarks to merge - please merge with an explicit rev or bookmarks4run 'hg heads' to see all heads, specify rev with -rsTmultiple matching bookmarks to rebase - please rebase to an explicit rev or bookmarks<run 'hg heads' to see all heads, specify destination with -d)mergesrebasesMno matching bookmark to merge - please merge with an explicit rev or bookmarksMno matching bookmark to rebase - please rebase to an explicit rev or bookmarks<branch '%s' has %d heads - please merge with an explicit revs2run 'hg heads .' to see heads, specify rev with -rs;branch '%s' has %d heads - please rebase to an explicit revs:run 'hg heads .' to see heads, specify destination with -ds8heads are bookmarked - please merge with an explicit revs7heads are bookmarked - please rebase to an explicit revs<branch '%s' has one head - please merge with an explicit revs;branch '%s' has one head - please rebase to an explicit revsnothing to mergeNsnothing to rebasesuse 'hg update' insteads(working directory not at a head revisions2use 'hg update' or merge with an explicit revisions1use 'hg update' or rebase to an explicit revisionssource set is emptys)source set is rooted in multiple branchess.rebaseset is rooted in multiple named branchess+specify an explicit destination with --dest) toomanybookmarksnootherbookmarks toomanyheadsbookmarkedheadsnootherbranchheads nootherheadsnootherheadsbehind notatheadsemptysourcesetmultiplebranchessourcesetrFc Csd}t|}|j|j}t|dkr#||dkr|d}n/|d}n*t|dkr8td|\}}tj||dt|dkrMtd|\}}tj||d|dusSJ|S)z2find merge destination in the active bookmark caseNrrrGhintrH) rheadsforactiver4_activebookmarklen msgdestmergerManyMergeDestAbortNoMergeDestAbort) raction sourceset destspacer bmheadscurheadmsgrSr r r!_destmergebooks         r`Tc Cs d}|dur||jg}|j}n:|s'td|\}}tj||dd}|d||D]} |durK| |krKtd|\}}tj||d| }q0| |} | d|| } |r| st | dkrqtd|\}}ntd |\}}tj ||dt| d | |} t| d | } |durt| d || } t | dkrtd |\}}||t | df;}tj||d| s| rtd|\}}n(t | dkrtd|\}}||;}n| std|\}}ntd|\}}tj||d| d}|dusJ|S)z,find merge destination based on branch headsNrOrRsroots(%ld::%ld)rPs %ld and %lnrrMrNs %ln - (%ld::)s%ld - bookmark()s %ld and %ldrIrJrKrLr)dirstater'rr8rWrrYrrXr:r*rVr<Abortr) rrZr[ onheadcheckr\r r8r_rSctxbheadsonheadnbhsr r r!_destmergebranch2sR     rhcCs6|jr t||||d}n t|||||d}||S)zreturn the default destination for a merge (or raise exception about why it can't pick one) :action: the action being performed, controls emitted error message )rZr[r\)rZr[rcr\)rUr`rhr)rrZr[rcr\r r r r! destmerge{s  ricCsR|dd}|durt|}n|rt||g}nttd|r'|SdS)z0Default base revision to edit for `hg histedit`.shistedits defaultrevNs0config option histedit.defaultrev can't be empty) configr getstackrrevranger ConfigErrorrmin)r3rdefaultr*r r r! desthistedits  rpcCst|}|r |SdS)N)r rkr+)r3rr*r r r! stackbases rqcsdt|}|j|j|dr.fdd|D}|r0td}||t||jfdSdSdS)Ns%n and parents()csg|]}|kr|qSr r )r#br^r r!r%sz$_statusotherbook..s&%i other divergent bookmarks for "%s" )rrTr4rUr*rstatusrV)r3rr]r_r rsr!_statusotherbooks   rucCs|j}|j|dd}||}|d|rm|d|}|drF|td||r;|tdt|dS|td|dS|ro|d}|td || d d f|td t||fdSdSdS) NTr>s%ln and parents()s%ln - parents()r&sCno open descendant heads on branch "%s", updating to a closed head sJ(committing will reopen the head, use 'hg heads .' to see %i other heads) s%(committing will reopen branch "%s") supdated to "%s: %s"  rs%i other heads for branch "%s" ) rar8r:r* closesbranchwarnrrVrt descriptionsplit)r3rr;allheadsr< otherheadsr^r r r!_statusotherbranchheadssL      r}cCs"|jr t||dSt||dS)zPrint message about other headN)rUrur})r3rr r r!statusotherdestssr~)F)rFNN)rFNTN) __future__ri18nrrrrrr r"r1r6r=rArBrCrErWr`rhrirprqrur}r~r r r r!s  "+        g J  /