-=[ Mr. Bumblebee ]=-
_Indonesia_

Path : /usr/lib/python2.7/dist-packages/bzrlib/
File Upload :
Current File : //usr/lib/python2.7/dist-packages/bzrlib/shelf_ui.pyc


Nc@@sddlmZddlmZddlZddlZddlZddlmZm	Z	m
Z
mZmZm
Z
mZmZmZmZmZmZddlmZdefdYZdefd	YZd
efdYZdefd
YZdefdYZdS(i(tabsolute_import(tStringION(tbuiltinstdeltatdiffterrorstosutilstpatchestpatiencedifftshelfttextfilettracetuitworkingtree(tgettextt	UseEditorcB@seZdZRS(s)Use an editor instead of selecting hunks.(t__name__t
__module__t__doc__(((s3/usr/lib/python2.7/dist-packages/bzrlib/shelf_ui.pyR(st
ShelfReportercB@seZiedd6edd6edd6edd6edd	6ed
d6edd
6edd6ZeZdZdZdZdZ	dZ
dZRS(sShelve adding file "%(path)s"?sadd filesShelve binary changes?tbinarys0Shelve changing "%s" from %(other)s to %(this)s?schange kinds Shelve removing file "%(path)s"?sdelete filesShelve %d change(s)?tfinalsShelve?thunksDShelve changing target of "%(path)s" from "%(other)s" to "%(this)s"?s
modify targets*Shelve renaming "%(other)s" => "%(this)s"?trenamecC@stj|_dS(N(Rt_ChangeReportertdelta_reporter(tself((s3/usr/lib/python2.7/dist-packages/bzrlib/shelf_ui.pyt__init__=scC@stjddS(s.Report that no changes were selected to apply.sNo changes to shelve.N(Rtwarning(R((s3/usr/lib/python2.7/dist-packages/bzrlib/shelf_ui.pyt
no_changes@scC@stjtd|dS(s&Report the id changes were shelved to.sChanges shelved with id "%d".N(RtnoteR(Rtshelf_id((s3/usr/lib/python2.7/dist-packages/bzrlib/shelf_ui.pyt
shelved_idDscC@stjtddS(s/Report that changes were made without shelving.sSelected changes destroyed.N(RRR(R((s3/usr/lib/python2.7/dist-packages/bzrlib/shelf_ui.pytchanges_destroyedHscC@s6tjtd|j}tj||jdS(s&Report the changes that were selected.sSelected changes:N(RRRtiter_changesRtreport_changesR(Rt	transformtchanges((s3/usr/lib/python2.7/dist-packages/bzrlib/shelf_ui.pytselected_changesLscC@s|ddkr/i|dd6|dd6}n|ddkrii|dd	6|dd6|dd6}nK|dd
kri|dd	6|dd6|dd6}ni|dd	6}|j|d|}|S(s+Determine the prompt for a change to apply.iRitthisitotherschange kinditpaths
modify target(tvocab(Rtchangetvalstprompt((s3/usr/lib/python2.7/dist-packages/bzrlib/shelf_ui.pyt
prompt_changeRs**(RRRR*tFalsetinvert_diffRRR R!R&R.(((s3/usr/lib/python2.7/dist-packages/bzrlib/shelf_ui.pyR,s





					t
ApplyReportercB@seZiedd6edd6edd6edd6edd	6ed
d6edd
6edd6ZeZdZRS(sDelete file "%(path)s"?sadd filesApply binary changes?Rs-Change "%(path)s" from %(this)s to %(other)s?schange kindsAdd file "%(path)s"?sdelete filesApply %d change(s)?Rs
Apply change?Rs;Change target of "%(path)s" from "%(this)s" to "%(other)s"?s
modify targets!Rename "%(this)s" => "%(other)s"?RcC@sdS(N((R((s3/usr/lib/python2.7/dist-packages/bzrlib/shelf_ui.pyR!ps(RRRR*tTrueR0R!(((s3/usr/lib/python2.7/dist-packages/bzrlib/shelf_ui.pyR1`s





tShelverc	B@seZdZdeeddedddZededddedZdZdZ	edZ
dZedZdZ
d	Zd
ZedZRS(
s3Interactively shelve the changes in a working tree.cC@s||_||_||_|jdkr9tj|_n|	dkrT|j}	n|	|_||_||_	||_
||_||_|
dkrt
}
n|
|_|jjj}|j|||_|jjdS(sConstructor.

        :param work_tree: The working tree to shelve changes from.
        :param target_tree: The "unchanged" / old tree to compare the
            work_tree to.
        :param auto: If True, shelve each possible change.
        :param auto_apply: If True, shelve changes with no final prompt.
        :param file_list: If supplied, only files in this list may be shelved.
        :param message: The message to associate with the shelved changes.
        :param destroy: Change the working tree without storing the shelved
            changes.
        :param manager: The shelf manager to use.
        :param reporter: Object for reporting changes to user.
        N(t	work_treettarget_treetdiff_writertNonetsyststdouttget_shelf_managertmanagertautot
auto_applyt	file_listtmessagetdestroyRtreportertbrancht
get_configtget_change_editort
change_editortlock_tree_write(RR4R5R6R<R=R>R?R@R;RAtconfig((s3/usr/lib/python2.7/dist-packages/bzrlib/shelf_ui.pyRws&										c
	C@s|dkrd}n.|rCg|D]}tj||^q"}ntjj|\}	}
|	jzMtjd||	j	|	}|	j
|}||	|||||||SWd|	jXdS(saCreate a shelver from commandline arguments.

        The returned shelver wil have a work_tree that is locked and should
        be unlocked.

        :param revision: RevisionSpec of the revision to compare to.
        :param all: If True, shelve all changes without prompting.
        :param file_list: If supplied, only files in this list may be  shelved.
        :param message: The message to associate with the shelved changes.
        :param directory: The directory containing the working tree.
        :param destroy: Change the working tree without storing the shelved
            changes.
        u.tshelf2N(R7RtpathjoinR
tWorkingTreetopen_containingRFRt_get_one_revision_treeRBtsafe_relpath_filestunlock(
tklassR6trevisiontallR>R?t	directoryR@tfttreeR)R5tfiles((s3/usr/lib/python2.7/dist-packages/bzrlib/shelf_ui.pyt	from_argss	(
cC@stj|j|j|j}tj|_d}zrx|jD]}|ddkry||j	||d7}Wqt
jk
r|j|j
jdr|d7}|j|dqqXqC|j|j
j|rC|j||d7}qCqCW|dkr|j
j|j|jsF|j|j
jd|r|jri|j|j
jq|jj||j}|j
j|qn
|j
jWdtj|j|jXdS(s!Interactively shelve the changes.ismodify textiRRN( R	tShelfCreatorR4R5R>ttempfiletmkdtempttempdirtiter_shelvablethandle_modify_textRt
BinaryFiletprompt_boolRAR*tshelve_content_changeR.t
shelve_changeR&twork_transformR=R@R$R!R;tshelve_changesR?R Rtshutiltrmtreetfinalize(Rtcreatortchanges_shelvedR+R((s3/usr/lib/python2.7/dist-packages/bzrlib/shelf_ui.pytruns<

	
cC@s0|jdk	r|jjn|jjdS(N(RER7tfinishR4RN(R((s3/usr/lib/python2.7/dist-packages/bzrlib/shelf_ui.pyResc
C@st}|r$|j}|j}n|j}|j}|j|}|j|}tj|||dtj}|j|||dd}	|jdt	j
|S(s&Return a parsed version of a file's patch.

        :param file_id: The id of the file to generate a patch for.
        :param invert: If True, provide an inverted patch (insertions displayed
            as removals, removals displayed as insertions).
        :return: A patches.Patch.
        t
path_encodingtfilei(RR4R5tid2pathRtDiffTextRtget_terminal_encodingtseekRtparse_patch(
Rtfile_idtinvertt	diff_filetold_treetnew_treetold_pathtnew_pathttext_differtpatch((s3/usr/lib/python2.7/dist-packages/bzrlib/shelf_ui.pytget_parsed_patchs				
cC@stjj||d|S(Ntdefault(Rt
ui_factorytchoose(RR?tchoicesR{((s3/usr/lib/python2.7/dist-packages/bzrlib/shelf_ui.pyR-scC@s|jr
tSd}d}|r6|d7}|d7}n|d7}|d7}|j||d}|dkrtd}n
||}|d	krtS|dkr|rtn|d
krt|_tS|dkrtjntSdS(
sPrompt the user with a yes/no question.

        This may be overridden by self.auto.  It may also *set* self.auto.  It
        may also raise UserAbort.
        :param question: The question to ask the user.
        :return: True or False
        tyns&yes
&Notes
&edit manuallytfqs
&finish
&quititntyRStqN(R<R2R-R7RRt	UserAbortR/(Rtquestiontallow_editortalternatives_charstalternativestchoicetchar((s3/usr/lib/python2.7/dist-packages/bzrlib/shelf_ui.pyR^s.	



	
		cC@s|jj|}y|j|||\}}Wn)tk
r\|j||\}}nX|dkr||j||n|S(sHandle modified text, by using hunk selection or file editing.

        :param creator: A ShelfCreator.
        :param file_id: The id of the file that was modified.
        :return: The number of changes.
        i(R4tget_file_linest
_select_hunksRt
_edit_filetshelve_lines(RRfRqtwork_tree_linestlinestchange_count((s3/usr/lib/python2.7/dist-packages/bzrlib/shelf_ui.pyR\%s
c
C@s|jjr|}n|jj|}tj|tj||j||jj}g}|js(d}|jj	|j
x|jD]}|jj	t||j
|jjdd|jdk	}	|jjs|	}	n|	r
|j|7_|j|q||j|j8}qWntjj|jjrPt|}
nt|jt|}
tj||}t|}||
fS(sProvide diff hunk selection for modified text.

        If self.reporter.invert_diff is True, the diff is inverted so that
        insertions are displayed as removals and vice versa.

        :param creator: a ShelfCreator
        :param file_id: The id of the file to shelve.
        :param work_tree_lines: Line contents of the file in the working tree.
        :return: number of shelved hunks.
        iRRN(RAR0R5RR
tcheck_text_linesRzR<R6twritet
get_headerthunkststrR^R*RER7tmod_postappendt	mod_ranget
orig_rangeR8R9tflushtlenRtiter_patched_from_hunkstlist(
RRfRqRttarget_linestparsedtfinal_hunkstoffsetRtselectedRtpatchedR((s3/usr/lib/python2.7/dist-packages/bzrlib/shelf_ui.pyR6s:	

	

		cC@s1tj|jj|}||j||fS(s:
        :param file_id: id of the file to edit.
        :param work_tree_lines: Line contents of the file in the working tree.
        :return: (lines, change_region_count), where lines is the new line
            content of the file, and change_region_count is the number of
            changed regions.
        (Rtsplit_linesREt	edit_filet_count_changed_regions(RRqRR((s3/usr/lib/python2.7/dist-packages/bzrlib/shelf_ui.pyRbscC@s/tjd||}|j}t|dS(Ni(RtPatienceSequenceMatcherR7tget_matching_blocksR(t	old_linest	new_linestmatchertblocks((s3/usr/lib/python2.7/dist-packages/bzrlib/shelf_ui.pyRms	N(RRRR7R/RtclassmethodRVRhReRzR-R^R\RRtstaticmethodR(((s3/usr/lib/python2.7/dist-packages/bzrlib/shelf_ui.pyR3ts 	#		%		#		,	t	UnshelvercB@s\eZdZedddddZeeeeddZdZ	dZ
dZRS(	s%Unshelve changes into a working tree.tapplyt.c	C@sdtjj|\}}|jy|j}|dk	rsyt|}Wqtk
rotj	|qXn0|j
}|dkrtjtdnt
}t
}	t
}
t}|dkrt}t}	nW|dkrt}t}	t
}n6|dkrt}t}
n|dkr-t
}t}	nWn|jnX||||||	|
||S(sCreate an unshelver from commandline arguments.

        The returned shelver will have a tree that is locked and should
        be unlocked.

        :param shelf_id: Integer id of the shelf, as a string.
        :param action: action to perform.  May be 'apply', 'dry-run',
            'delete', 'preview'.
        :param directory: The directory to unshelve changes into.
        :param write_diff_to: See Unshelver.__init__().
        sNo changes are shelved.sdry-runtpreviewsdelete-onlytkeepN(R
RJRKRFR:R7tintt
ValueErrorRtInvalidShelfIdt
last_shelftBzrCommandErrorRR2R/RN(RORtactionRRt
write_diff_toRTR)R;t
apply_changestdelete_shelft
read_shelft	show_diff((s3/usr/lib/python2.7/dist-packages/bzrlib/shelf_ui.pyRVxsD

			

c		C@sX||_|j}||_||_||_||_||_||_||_dS(sConstructor.

        :param tree: The working tree to unshelve into.
        :param manager: The ShelveManager containing the shelved changes.
        :param shelf_id:
        :param apply_changes: If True, apply the shelved changes to the
            working tree.
        :param delete_shelf: If True, delete the changes from the shelf.
        :param read_shelf: If True, read the changes from the shelf.
        :param show_diff: If True, show the diff that would result from
            unshelving the changes.
        :param write_diff_to: A file-like object where the diff will be
            written to. If None, ui.ui_factory.make_output_stream() will
            be used.
        N(	RTR:R;RRRRRR(	RRTR;RRRRRR((s3/usr/lib/python2.7/dist-packages/bzrlib/shelf_ui.pyRs							cC@sV|jj|jjg}z|jrtjtd|j|jj	|j}|j
|j|jdk	rtjtd|jntj}|jd}||_|jr|jq|jr|j|q|j|n|jr/|jj|jtjtd|jnWdxt|D]
}|q@WXdS(s!Perform the unshelving operation.sUsing changes with id "%d".sMessage: %ssDeleted changes with id "%d".N(RTRFRNRRRRRR;t
get_unshelverRReR?R7RRtmake_mergertchange_reporterRtdo_mergeRt
write_difftshow_changesRtreversed(Rtcleanupst	unshelverRtmergertcleanup((s3/usr/lib/python2.7/dist-packages/bzrlib/shelf_ui.pyRhs,
			
		!cC@s|j}|j}|j}|jdkrNtjjdd|_ntj	}t
j|j||jd||j
dS(s2Write this operation's diff to self.write_diff_to.t
encoding_typetexactRjN(Rtmake_preview_transformtget_preview_treeRR7RR|tmake_output_streamRtget_diff_header_encodingRtshow_diff_treest	this_treeRe(RRttree_mergertttRuRj((s3/usr/lib/python2.7/dist-packages/bzrlib/shelf_ui.pyRscC@s&|j}|j}|jdS(s/Show the changes that this operation specifies.N(RRRe(RRRR((s3/usr/lib/python2.7/dist-packages/bzrlib/shelf_ui.pyRsN(RRRRR7RVR2R/RRhRR(((s3/usr/lib/python2.7/dist-packages/bzrlib/shelf_ui.pyRus	0			(t
__future__Rt	cStringIORRcR8RXtbzrlibRRRRRRRR	R
RRR
tbzrlib.i18nRt	ExceptionRtobjectRR1R3R(((s3/usr/lib/python2.7/dist-packages/bzrlib/shelf_ui.pyt<module>sR4

Copyright © 2017 || Recoded By Mr.Bumblebee