-=[ Mr. Bumblebee ]=-
_Indonesia_

Path : /usr/lib/python2.7/dist-packages/hgext/
File Upload :
Current File : //usr/lib/python2.7/dist-packages/hgext/histedit.pyc


\,Tc
@sDdZyddlZejWnek
r<ddlZnXddlZddlZddlZddlm	Z	ddlm
Z
ddlmZddlmZddlm
Z
ddlmZdd	lmZdd
lmZddlmZddlmZdd
lmZddlmZddlmZddlmZiZe	jeZdZedZdZdZdZ dZ!dZ"dZ#dZ$dZ%dZ&de(idZ)i
e!d6e!d6e"d6e"d 6e#d!6e#d"6e%d#6e%d$6e&d%6e&d&6Z*ed'd(d)d(ed*fd+d,e(ed-fd.d/e(ed0fd(d1e(ed2fd3d4e(ed5fd!d6e(ed7fd8d9ged:fged;d<Z+d=Z,d>Z-d?Z.d@Z/dAZ0dBZ1dCZ2dDZ3dEZ4dFZ5dGZ6dHZ7dIZ8dS(Jsinteractive history editing

With this extension installed, Mercurial gains one new command: histedit. Usage
is as follows, assuming the following history::

 @  3[tip]   7c2fd3b9020c   2009-04-27 18:04 -0500   durin42
 |    Add delta
 |
 o  2   030b686bedc4   2009-04-27 18:04 -0500   durin42
 |    Add gamma
 |
 o  1   c561b4e977df   2009-04-27 18:04 -0500   durin42
 |    Add beta
 |
 o  0   d8d2fcd0e319   2009-04-27 18:04 -0500   durin42
      Add alpha

If you were to run ``hg histedit c561b4e977df``, you would see the following
file open in your editor::

 pick c561b4e977df Add beta
 pick 030b686bedc4 Add gamma
 pick 7c2fd3b9020c Add delta

 # Edit history between c561b4e977df and 7c2fd3b9020c
 #
 # Commits are listed from least to most recent
 #
 # Commands:
 #  p, pick = use commit
 #  e, edit = use commit, but stop for amending
 #  f, fold = use commit, but combine it with the one above
 #  d, drop = remove commit from history
 #  m, mess = edit message without changing commit content
 #

In this file, lines beginning with ``#`` are ignored. You must specify a rule
for each revision in your history. For example, if you had meant to add gamma
before beta, and then wanted to add delta in the same revision as beta, you
would reorganize the file to look like this::

 pick 030b686bedc4 Add gamma
 pick c561b4e977df Add beta
 fold 7c2fd3b9020c Add delta

 # Edit history between c561b4e977df and 7c2fd3b9020c
 #
 # Commits are listed from least to most recent
 #
 # Commands:
 #  p, pick = use commit
 #  e, edit = use commit, but stop for amending
 #  f, fold = use commit, but combine it with the one above
 #  d, drop = remove commit from history
 #  m, mess = edit message without changing commit content
 #

At which point you close the editor and ``histedit`` starts working. When you
specify a ``fold`` operation, ``histedit`` will open an editor when it folds
those revisions together, offering you a chance to clean up the commit message::

 Add beta
 ***
 Add delta

Edit the commit message to your liking, then close the editor. For
this example, let's assume that the commit message was changed to
``Add beta and delta.`` After histedit has run and had a chance to
remove any old or temporary revisions it needed, the history looks
like this::

 @  2[tip]   989b4d060121   2009-04-27 18:04 -0500   durin42
 |    Add beta and delta.
 |
 o  1   081603921c3f   2009-04-27 18:04 -0500   durin42
 |    Add gamma
 |
 o  0   d8d2fcd0e319   2009-04-27 18:04 -0500   durin42
      Add alpha

Note that ``histedit`` does *not* remove any revisions (even its own temporary
ones) until after it has completed all the editing operations, so it will
probably perform several strip operations when it's done. For the above example,
it had to run strip twice. Strip can be slow depending on a variety of factors,
so you might need to be a little patient. You can choose to keep the original
revisions by passing the ``--keep`` flag.

The ``edit`` operation will drop you back to a command prompt,
allowing you to edit files freely, or even use ``hg record`` to commit
some changes as a separate commit. When you're done, any remaining
uncommitted changes will be committed as well. When done, run ``hg
histedit --continue`` to finish this step. You'll be prompted for a
new commit message, but the default commit message will be the
original message for the ``edit`` ed revision.

The ``message`` operation will give you a chance to revise a commit
message without changing the contents. It's a shortcut for doing
``edit`` immediately followed by `hg histedit --continue``.

If ``histedit`` encounters a conflict when moving a revision (while
handling ``pick`` or ``fold``), it'll stop in a similar manner to
``edit`` with the difference that it won't prompt you for a commit
message when done. If you decide at this point that you don't like how
much work it will be to rearrange history, or that you made a mistake,
you can use ``hg histedit --abort`` to abandon the new changes you
have made and return to the state before you attempted to edit your
history.

If we clone the histedit-ed example repository above and add four more
changes, such that we have the following history::

   @  6[tip]   038383181893   2009-04-27 18:04 -0500   stefan
   |    Add theta
   |
   o  5   140988835471   2009-04-27 18:04 -0500   stefan
   |    Add eta
   |
   o  4   122930637314   2009-04-27 18:04 -0500   stefan
   |    Add zeta
   |
   o  3   836302820282   2009-04-27 18:04 -0500   stefan
   |    Add epsilon
   |
   o  2   989b4d060121   2009-04-27 18:04 -0500   durin42
   |    Add beta and delta.
   |
   o  1   081603921c3f   2009-04-27 18:04 -0500   durin42
   |    Add gamma
   |
   o  0   d8d2fcd0e319   2009-04-27 18:04 -0500   durin42
        Add alpha

If you run ``hg histedit --outgoing`` on the clone then it is the same
as running ``hg histedit 836302820282``. If you need plan to push to a
repository that Mercurial does not detect to be related to the source
repo, you can add a ``--force`` option.
iN(tcmdutil(t	discovery(terror(tcopies(tcontext(thg(tnode(trepair(tscmutil(tutil(tobsolete(tmerge(trelease(t_tinternalsF# Edit history between %s and %s
#
# Commits are listed from least to most recent
#
# Commands:
#  p, pick = use commit
#  e, edit = use commit, but stop for amending
#  f, fold = use commit, but combine it with the one above
#  d, drop = remove commit from history
#  m, mess = edit message without changing commit content
#
cs%jfd}|S(s>Build a commit function for the replacement of <src>

    This function ensure we apply the same treatment to all changesets.

    - Add a 'histedit_source' entry in extra.

    Note that fold have its own separated logic because its handling is a bit
    different and not easily factored out of the fold method.
    csjjdd}z\jjddd|jdij}j|d<||d<j|SWdjj|XdS(Ntphasess
new-committhistedittextrathistedit_source(tuitbackupconfigt	setconfigtgettcopythextcommitt
restoreconfig(tkwargstphasebackupR(tphasemintrepotsrc(s2/usr/lib/python2.7/dist-packages/hgext/histedit.pyt
commitfuncs
(tphase(RRR ((RRRs2/usr/lib/python2.7/dist-packages/hgext/histedit.pyt
commitfuncfors
cCs|jjd}|jj|krYtj||||tjfdtd}nzY|j	j
dd|jdddtj
||jttt|jj}Wd|j	j
ddddX|j|tj|jjtj||j|jj|S(	s@Merge changeset from ctx (only) in the current working directoryitallRt
forcemergettooltRN(tdirstatetparentstp1RRtreverttnullidtTruetNoneRRRtmergemodtupdatetFalset
setparentstwritetduplicatecopiestrev(RRtctxtoptstwcpartstats((s2/usr/lib/python2.7/dist-packages/hgext/histedit.pytapplychangess%	
%cst|jd|}|s%dS|jdt}x!|D]}|j|jqEWtjfd}g|D]}||s|^q}jfd}	|j	dr|d}
n|j
}
|j	d}|j	d}|j	d}
|jj|j
jf}tj|d	|d
|
d|d|	d|d|d|
d
tjdt}|j|S(scollapse the set of revisions from first to last as new one.

    Expected commit options are:
        - message
        - date
        - username
    Commit message is edited in all cases.

    This function works in memory.s%d::%dics|jkrwj|}|jkrpj|}|j|jkoo|j|jkStSn|jkSdS(N(tmanifesttfilectxtdatatflagsR0(tftatb(tbasetlast(s2/usr/lib/python2.7/dist-packages/hgext/histedit.pytsamefilescs{|krn|}|j}tj||j|jdd|kdd|kdj|}|StdS(Ntislinktltisexectxtcopied(R=Rt
memfilectxtpathR<RtIOError(RR5RJtfctxR=tmctx(RHtheadmfRB(s2/usr/lib/python2.7/dist-packages/hgext/histedit.pyt	filectxfns
	tmessagetusertdateRR(ttexttfilesROteditorteditN(tlisttsetR-R(R/RTRt
pathcopiesR:RtdescriptionR)Rtp2RtmemctxRtgetcommiteditorR,t	commitctx(RtfirstRBt
commitoptstctxsRTR5RCR>RORPRQRRRR(tnew((RARHRNRBs2/usr/lib/python2.7/dist-packages/hgext/histedit.pytcollapses:
	
%
$c
	Cs8||}|jd|kr;|jd||gfStj||jt||||}|r|ddkrtjtdnt	||}|d|j
d|jd|jd|j
}|dkr|jtd	tj||gfS||}	|	|j|ffgfS(
Nisnode %s unchanged
is0Fix up the change and run hg histedit --continueRSRQRRRs%s: empty changeset
(R(tdebugRR/RR9RtInterventionRequiredR
R"RZRQRRRR-twarnR(
RRR5thaR6toldctxR8RtnRb((s2/usr/lib/python2.7/dist-packages/hgext/histedit.pytpick4s"



cCsL||}tj||jt||||tjtddS(Ns|Make changes as needed, you may commit or record as needed now.
When you are finished, run hg histedit --continue to resume.(RR/RR9RReR
(RRR5RgR6Rh((s2/usr/lib/python2.7/dist-packages/hgext/histedit.pyRVJs

c	Cs||}tj||jt||||}|rc|ddkrctjtdn|jdd|d|jd|j	d|j
}|dkr|jtd	tj
||gfSt||||||gS(
Niis0Fix up the change and run hg histedit --continueRSsfold-temp-revision %sRQRRRs%s: empty changeset(RR/RR9RReR
RRQRRRR-RfRt
finishfold(RRR5RgR6RhR8Ri((s2/usr/lib/python2.7/dist-packages/hgext/histedit.pytfoldRs

cCs|jdj}tj|||j}|j|d<dj|jgg|D]}	||	j^q[|jgd}
|
|d<t|j	|j	|d<|j
j}d|j|jf|d<||d	<|jj
d
d}zQt|j|j}
|jjd
d|
dt|||||}Wd|jj|X|dkr|gfStj|||j|ff|j|ff||ffg}x$|D]}|j||ffqW|||fS(
NiRQs
***
s
RPRRs%s,%sRRRs
new-commitR(R(RRR/RRQtjoinRZtmaxRRRRRRR!RRcRR-tappend(RRR5RhtnewnodeR6tinternalchangestparentR`trt
newmessageRRRRitreplacementstich((s2/usr/lib/python2.7/dist-packages/hgext/histedit.pyRkas6-
 


cCs|||jdfgfS(N((R(RRR5RgR6((s2/usr/lib/python2.7/dist-packages/hgext/histedit.pytdropsc
Cs||}tj||jt||||}|rc|ddkrctjtdn|j}t||}|d|d|j	d|j
d|jdtj
d	t}	||	}
|j|
jkr|
|j|	ffgfS|
gfS(
Niis0Fix up the change and run hg histedit --continueRSRQRRRRURV(RR/RR9RReR
RZR"RQRRRRR]R,(RRR5RgR6RhR8RPRRbtnewctx((s2/usr/lib/python2.7/dist-packages/hgext/histedit.pyRPs
$
cCsb|j|pd|pd}tj|d
d \}}|jtdtj|tj|||d
\}}tj	|||}|rg|D]}	|j
|	^q}ntj|||d|}
|
j
stjtdnt|jd|
j
}dt|krQtd	}td
}
tj|d|
n|j
|dS(sVutility function to find the first outgoing changeset

    Used by initialisation codesdefault-pushtdefaultiscomparing with %s
tforcesno outgoing ancestorss
roots(%ln)is&there are ambiguous outgoing revisionss&see "hg help histedit" for more detailthintiN(t
expandpathRtparseurlR-tstatusR
R	thidepasswordt
addbranchrevstpeertlookupRtfindcommonoutgoingtmissingtAbortRWtrevstlen(RRtremoteRzR6tdestRtcheckouttotherR4toutgoingtrootstmsgR{((s2/usr/lib/python2.7/dist-packages/hgext/histedit.pytfindoutgoings  %	tpRjteRVR>RltdRwtmtmessRR&tcommandss+Read history edits from the specified file.tctcontinues$continue an edit already in progresstktkeeps,don't strip old nodes after edit is completetabortsabort an edit in progresstoRs#changesets not found in destinationRzs.force outgoing even for unrelated repositoriesRsR4sfirst revision to be editedsANCESTOR | --outgoing [URL]cOsNd}}z/|j}|j}t||||Wdt||XdS(sinteractively edit changeset history

    This command edits changesets between ANCESTOR and the parent of
    the working directory.

    With --outgoing, this edits changesets not found in the
    destination repository. If URL of the destination is omitted, the
    'default-push' (or 'default') path will be used.

    For safety, this command is aborted, also if there are ambiguous
    outgoing revisions which may confuse users: for example, there are
    multiple branches containing outgoing revisions.

    Use "min(outgoing() and ::.)" or similar revset specification
    instead of --outgoing to specify edit target revision exactly in
    such ambiguous situation. See :hg:`help revsets` for detail about
    selecting revisions.

    Returns 0 on success, 1 if user intervention is required (not only
    for intentional "edit" command, but also for resolving unexpected
    conflicts).
    N(R-twlocktlockt	_histeditR(RRtfreeargsR6RR((s2/usr/lib/python2.7/dist-packages/hgext/histedit.pyRs#
c+stdd}|r9|jr9tjtdn|jd}|jd}|jd}|jd}|jdd}	|jd	g}
d
}|r|rtjtdn|r	tj|||
||	frtjtdnd}n|rKtj||
||	frBtjtd
nd}ntj	j
tj	jj	drtjtdn|r|
rtjtdnt|dkrtjtdqn7|
j
|t|
dkrtjtdn|dkrnt\}}	}
}}|}t|||	|\}}|j
|n|dkrzt\}}	}
}}t|\}}}}|jdtj|gdjD]}|j^q}x;|t|gBD]&}||krtj|PqqWt|d|t|d|tjtj	jj	ddStjtjjj\}}|r|r|d}nd}t||||}n^tjdt j!|
}t|dkr1tjtdn|dj}|jdt"}
t#|||
}
|
stjtdtj|ng|
D]}|^q}|	sXdjg|D]}t$|^q}	|	d7}	|	t%tj|tj|f7}	|j&|	|j'}	t(jdd}|j)|	|j*n:|	d krpt+j,}nt(|	}|j-}	|j*gd!|	j.DD]#} | r| dd"kr| ^q}	t/|	|}	|jd}|jdt"}
g}x|	rt0|j|	|
|||	j1d\}!}"|jd#|!|"ft2|!}#|#|||"|\}}$|j
|$qWtj3|jt|\}}}%}&|rx|j4D]\}'}(|(s|jd$tj|'q|jd%tj|'tj|(dft|(dkrd&})x/|(dD] }|j|)tj|q`WqqWn|
sN|rt5||||&nt6j7r8g}*xWt8|d'j9j:D]=}'||'}(|*j;|'t<fd(|(DfqW|*rKt6j=|*qKqNt|d)|nt|d|tjtj	jj	dtj	j
j>d*rtjj>d*ndS(+Ntmqssource has mq patches appliedRRRRzRR&R4Rbs$--force only allowed with --outgoings$no arguments allowed with --continues!no arguments allowed with --abortshistedit-states;history edit already in progress, try --continue or --aborts$no revisions allowed with --outgoingis.only one repo argument allowed with --outgoings/histedit requires exactly one ancestor revisionsrestore wc to old parent %s
tcreatedttempis
roots(%ld)s9The specified revisions must have exactly one common rootRs*%s is not an ancestor of working directorys
s

shistedit-last-edit.txttwt-css|]}|jVqdS(N(tstrip(t.0Rs((s2/usr/lib/python2.7/dist-packages/hgext/histedit.pys	<genexpr>Vst#shistedit: processing %s %s
shistedit: %s is dropped
shistedit: %s is replaced by %s
s'histedit:                            %stkeyc3s|]}|VqdS(N((Rts(R(s2/usr/lib/python2.7/dist-packages/hgext/histedit.pys	<genexpr>streplacedtundo(?tgetattrR-tappliedR	RR
RtanytosRJtexistsRmRtextendt	readstatetbootstrapcontinuetprocessreplacementRdRtshortR(RXRtcleantcleanupnodetunlinkRtcheckunfinishedt
bailifchangedR'RRWRtrevrangeR0tbetweentmakedescteditcommentRVtusernametopenR2tclosetsyststdintreadt
splitlinestverifyrulest
writestatetpoptactiontableR/t	iteritemst
movebookmarksR
t_enabledtsortedt	changelogR4Rottuplet
createmarkerstsjoin(+RRRR6RtoutgtcontRRztrulesRtgoalt
parentctxnodeRttopmostRut	parentctxtrepltmappingttmpnodestleafst_ntmRtparentnodesRitemptyRtroottrrRsRaR>REtactionRgtactfunctreplacement_RtntmtprectsuccsRtmarkers((Rs2/usr/lib/python2.7/dist-packages/hgext/histedit.pyRs
		$

)


$(
&


#	
	$(	

$cCsg|jd|D]}|j^q}|jtjkr|sztd}td}tj||d|n|jdn|S(Ns(%d::.)s*%s is not an ancestor of working directorys,use "histedit --abort" to clear broken stateR{i(RXRR+R
R	RR(RR5RtnewchildrenRR{((s2/usr/lib/python2.7/dist-packages/hgext/histedit.pytgatherchildrens+cCs|jd\}}||}t||}d}	|jd \}
}}}
|
sh|sh|sh|
r|dkrd|}n|j}|dk}tjd|}t||}|d
|d|jd|j	d
|j
d|}	|	dk	r|j|	qng}|j|krL|j|jt
|fn|dkr|r|	dkrw|d}	n
|jt|||||	||\}}|j|q|j|j|jffn|r||d}n||fS(NiiR>Rlsfold-temp-revision %sRRVRRRSRQRRRRUi(R>sfold(RseditRR(R>sfold(RRR-R~RZRR]R"RQRRRRoRRRkR(RRRRR6RtcurrentnodeR5RRbRR?RsRRPteditoptRURRuR((s2/usr/lib/python2.7/dist-packages/hgext/histedit.pyRs@

	"

%cCst|jd||}|r|rtjr_|jd||r_tjtdn|jd|rtjtdn|d}|jstjtd|qng|D]}|j	^qS(soselect and validate the set of revision to edit

    When keep is false, the specified set can't have children.s%n::%ns(%ld::) - (%ld)s+cannot edit history that would orphan nodess(%ld) and merge()s(cannot edit history that contains mergesis#cannot edit immutable changeset: %s(
RWRXR
RRR	RR
R!R(RtoldRbRRaRR((s2/usr/lib/python2.7/dist-packages/hgext/histedit.pyRs


cCsNttjj|jdd}tj|||||f||jdS(Nshistedit-stateR(RRRJRmtpickletdumpR(Rt
parentnodeRRRRutfp((s2/usr/lib/python2.7/dist-packages/hgext/histedit.pyRs!cCsry"ttjj|jd}Wn@tk
rd}|jtjkrLntjt	dnXt
j|S(sIReturns a tuple of (parentnode, rules, keep, topmost, replacements).
    shistedit-statesno histedit in progress(RRRJRmRKterrnotENOENTR	RR
Rtload(RRterr((s2/usr/lib/python2.7/dist-packages/hgext/histedit.pyRs"cCsTd}|jr+|jjd}nd||j|f}tj|dS(slbuild a initial action line for a ctx `c`

    line are in the form:

      pick <hash> <rev> <summary>
    R&is
pick %s %d %siP(RZRR4R	tellipsis(Rtsummarytline((s2/usr/lib/python2.7/dist-packages/hgext/histedit.pyRs
cCsg}td|D}t}xB|D]:}d|krZtjtd|n|jdd\}}|jjddd}	yt||	}	Wn-tjk
rtjtd|	nX|	|krtjtdn|	|krtjtd|	n|j	|	|t
krStjtd	|n|j||	gq,Wt||}
|
rtjtd
|
ddtdn|S(
sVerify that there exists exactly one edit rule per given changeset.

    Will abort if there are to many or too few rules, a malformed rule,
    or a rule on a changeset outside of the user-given range.
    css|]}t|VqdS(N(tstr(RR((s2/usr/lib/python2.7/dist-packages/hgext/histedit.pys	<genexpr>st smalformed line "%s"iisunknown changeset %s listeds1may not use changesets other than the ones listeds#duplicated command for changeset %ssunknown action "%s"smissing rules for changeset %sR{s#do you want to use the drop action?(
RXR	RR
tsplitRRRt	RepoErrortaddRRoR(RRRatparsedtexpectedtseenRsRtrestRgR((s2/usr/lib/python2.7/dist-packages/hgext/histedit.pyRs4	

cCst}t}i}xT|D]L}|j|d|j|d|j|dtj|dqW||}||@}t|}i}	x|r-xt|D]{}
||
}xht|D]C}||krPq||	kr|j||j|	|qqW||	|
<|j|
qWqWx|D]
}
|	|
=q5W|jj}x3|	jD]%\}}t	|d|j
|	|<q_W|rt	|d|jjd}n;|	sd}n,|t	|	d|jjdj
j}|	|||fS(sprocess the list of replacements to return

    1) the final mapping between original and created nodes
    2) the list of temporary node created by histedit
    3) the list of new commit created by histeditiiRiN(RXR/Rt
setdefaultRWtremoveRtnodemaptitemsRRR4R-R)R(RRutallsuccsRtfullmappingtrepRbRt	toproceedtfinalRGRRRitnmRt
newtopmost((s2/usr/lib/python2.7/dist-packages/hgext/histedit.pyR!sB		
(

	



	,cCsQ|s
dSg}xt|jjD]\}}||krW|j||fq&n|}|j|d}	|	dkrq&nx5|	s||jj}|j||f}	qW|j||	dfq&W|rM|j}
xZ|D]R\}}	|
|}|jt	d|tj
|tj
|	f|	|
|<qW|
jndS(s,Move bookmark from old to newly created nodeNis,histedit: moving bookmarks %s from %s to %s
(Rt
_bookmarksRRoRR-R)RtnoteR
RR2(RRRt
oldtopmostRtmovestbkRRARbtmarkstmark((s2/usr/lib/python2.7/dist-packages/hgext/histedit.pyR\s."		
#c	Cs|jd|djg|D]}tj|^qfd}z|j}|jj}g|D]}||krd|^qd}g|jd|D]}|j^q}x!|D]}t	j
|||qWWdt|XdS(sdstrip a group of nodes from the repository

    The set of node to strip may contains unknown nodes.sshould strip %s nodes %s
s, s
roots(%ln)N(RdRmRRR-RRRRXRRR(	RRtnametnodesRiRRRR((s2/usr/lib/python2.7/dist-packages/hgext/histedit.pyR~s	3%+
cCsztjj|jdsdSt|\}}}}}|rv|jtd|jtddt|ndS(Nshistedit-states!hist:   %s (histedit --continue)
s%d remainingshistedit.remaining(	RRJRRmRR2R
tlabelR(RRRRRRRu((s2/usr/lib/python2.7/dist-packages/hgext/histedit.pytsummaryhookscCsBtjjdttjjdtttdtdgdS(NRshistedit-stateshistedit in progresss5use 'hg histedit --continue' or 'hg histedit --abort'(	RtsummaryhooksRRtunfinishedstatesRoR0R,R
(R((s2/usr/lib/python2.7/dist-packages/hgext/histedit.pytextsetups	(9t__doc__tcPickleRRtImportErrorRRRt	mercurialRRRRRRRRRR	R
RR.tmercurial.lockRtmercurial.i18nR
tcmdtabletcommandt
testedwithRR"R9RcRjRVRlRkRwRPR-R0RRRRRRRRRRRRRRRR(((s2/usr/lib/python2.7/dist-packages/hgext/histedit.pyt<module>s
				G				&		

			 			5					!	;	"		

Copyright © 2017 || Recoded By Mr.Bumblebee