HEX
Server: Apache
System: Linux infong-uk86 4.4.400-icpu-106 #2 SMP Mon Sep 15 08:23:40 UTC 2025 x86_64
User: u44115835 (4976590)
PHP: 8.4.17
Disabled: NONE
Upload Files
File: //kunden/lib/python3/dist-packages/breezy/__pycache__/commit.cpython-39.pyc
a

�*�^��@sddlmZddlmZmZmZmZddlmZddl	m
Z
ddlZddlm
Z
mZmZddlmZmZmZmZdd	lmZmZmZdd
lmZddlmZddlmZGd
d�de
�ZGdd�de
�Zdd�Z Gdd�de!�Z"Gdd�de"�Z#Gdd�de!�Z$dS)�)�absolute_import�)�debug�errors�trace�ui)�Branch)�	ExitStackN)�BzrError�ConflictsInTree�StrictCommitFailed)�get_user_encoding�has_symlinks�
is_inside_any�minimum_path_selection)�mutter�note�is_quiet)�
TreeChange)�unescape_for_display)�gettextc@seZdZdZdS)�PointlessCommitzNo changes to commitN)�__name__�
__module__�__qualname__�_fmt�rr�//usr/lib/python3/dist-packages/breezy/commit.pyrMsrc@seZdZdZdd�ZdS)�CannotCommitSelectedFileMergezHSelected-file commit of merges is not supported yet: files %(files_str)scCsd�|�}tj|||d�dS)Nz, )�files�	files_str)�joinr
�__init__)�selfrr rrrr"Ws
z&CannotCommitSelectedFileMerge.__init__N)rrrrr"rrrrrRsrccsd|D]Z}|jdduo$t||jd�}|jdduoBt||jd�}|rN|rNq|s|rXq|VqdS)z�Filter exclude filenames.

    :param iter_changes: iter_changes function
    :param exclude: List of paths to exclude
    :return: iter_changes function
    rNr)�pathr)�iter_changes�exclude�changeZnew_excludedZold_excludedrrr�filter_excluded\s��r(c@sHeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dS)�NullCommitReporterz!I report on progress of a commit.cCsdS�Nr)r#�revnoZrevid�locationrrr�startedwszNullCommitReporter.startedcCsdSr*r�r#r'r$rrr�snapshot_changezsz"NullCommitReporter.snapshot_changecCsdSr*r�r#r+�rev_idrrr�	completed}szNullCommitReporter.completedcCsdSr*r�r#r$rrr�deleted�szNullCommitReporter.deletedcCsdSr*rr3rrr�missing�szNullCommitReporter.missingcCsdSr*r�r#r'�old_path�new_pathrrr�renamed�szNullCommitReporter.renamedcCsdS�NFr�r#rrr�
is_verbose�szNullCommitReporter.is_verboseN)rrr�__doc__r-r/r2r4r5r9r<rrrrr)tsr)c@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�ReportCommitToLogcGst|g|�R�dS)zROutput a message.

        Subclasses may choose to override this method.
        N)r)r#�format�argsrrr�_note�szReportCommitToLog._notecCs2|dkr |td�td�fvr dS|�d||�dS)N��added�modifiedz%s %s)rrAr.rrrr/�sz!ReportCommitToLog.snapshot_changecCs|�td�t|d��dS)NzCommitting to: %szutf-8)rArr)r#r+r1r,rrrr-�s�zReportCommitToLog.startedcCs:|dur&|�td�|�td||�n|�td�|�dS)NzCommitted revision %d.zCommitted revid %s as revno %d.zCommitted revid %s.)rArrr0rrrr2�szReportCommitToLog.completedcCs|�td�|�dS)Nz
deleted %s�rArr3rrrr4�szReportCommitToLog.deletedcCs|�td�|�dS)Nz
missing %srEr3rrrr5�szReportCommitToLog.missingcCs|�d|||�dS)Nz%s %s => %s)rAr6rrrr9�szReportCommitToLog.renamedcCsdS)NTrr;rrrr<�szReportCommitToLog.is_verboseN)rrrrAr/r-r2r4r5r9r<rrrrr>�sr>c@s�eZdZdZd*dd�Zed+dd��Zd,d
d�Zdd
�Zdd�Z	dd�Z
d-dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd.d$d%�Zd&d'�Zd(d)�ZdS)/�Commita�Task of committing a new revision.

    This is a MethodObject: it accumulates state as the commit is
    prepared, and then it is discarded.  It doesn't represent
    historical revisions, just the act of recording a new one.

            missing_ids
            Modified to hold a list of files that have been deleted from
            the working directory; these should be removed from the
            working inventory.
    NcCs||_||_dS)znCreate a Commit object.

        :param reporter: the default reporter to use or None to decide later
        N)�reporter�config_stack)r#rGrHrrrr"�szCommit.__init__FcCs�|duri}|durg}d|vr:|jjjr:|�||�|d<|dur�d|vsRd|vrZtd��|r�|D]}d|vrbtd��qbd�|�|d<|S)Nzbranch-nickZauthor�authorszauthor property given twice�
z1\n is not a valid character in an author identity)�
repository�_formatZsupports_storing_branch_nickZ	_get_nick�AssertionErrorr!)�revprops�branchrI�local�possible_master_transportsZ
individualrrr�update_revprops�s(��
zCommit.update_revpropsT�downcs$t���}|
pi|_|p|j|_td�|dur:td��n8||_|jj|_t|jddd���rr|jj�	�srt
���|dur��dur�t�t
�r���t����fdd�}ntd	��d|_d
|_|dur�tt|��|_ng|_||_d|_||_d|_|du�r
tt|��|_nd|_||_||_||_||_||_||_|	|_ |�!|j�"��|j�#�|_$t%j&�'�|_(|�)|j(j*�|j�+�|_,|j�-�|_-|�!|j-�.��t/|j�0��dk�r�t1�|�2||�|jdu�r�|j�3�|_|�4�\}}}|
du�r�|
|_5n|j5du�r
|�6�|_5d|_7d|_8d
|_9|j�r2|j9d7_9d
|j(_:d
|j(_;d
|j(_<d|j(_=d|j(_>t/|j$�dk�r�|jdu�r�t?|j��t/|j$�dk�r�|j�r�t?|j��|j@ddd�||_A|jjB|j$|j||||j||d�|_C|jCjD�r�|j�r�|jC�E�tFd��zr|j�r|jjG}n|jjG}|j5�H||j|�|�I�|�J�|�@d�|jC�K�||���|_L|jC�M|jL�|_Wn0tN�y�td�tO�P�|jC�E��Yn0|�Q|||�|j�R|jS�|�@d�|j�T|j|jC�U��|j5�V||j�|�W||�|jWd�S1�s0YdS)a�Commit working copy as a new revision.

        :param message: the commit message (it or message_callback is required)
        :param message_callback: A callback: message =
            message_callback(cmt_obj)

        :param timestamp: if not None, seconds-since-epoch for a
            postdated/predated commit.

        :param specific_files: If not None, commit only those files. An empty
            list means 'commit no files'.

        :param rev_id: If set, use this as the new revision id.
            Useful for test or import commands that need to tightly
            control what revisions are assigned.  If you duplicate
            a revision id that exists elsewhere it is your own fault.
            If null (default), a time/random revision id is generated.

        :param allow_pointless: If true (default), commit even if nothing
            has changed and no merges are recorded.

        :param strict: If true, don't allow a commit if the working tree
            contains unknown files.

        :param revprops: Properties for new revision
        :param local: Perform a local only commit.
        :param reporter: the reporter to use or None for the default
        :param verbose: if True and the reporter is not None, report everything
        :param recursive: If set to 'down', commit in any subtrees that have
            pending changes of any sort during this commit.
        :param exclude: None or a list of relative paths to exclude from the
            commit. Pending changes to excluded files will be ignored by the
            commit.
        :param lossy: When committing to a foreign VCS, ignore any
            data that can not be natively represented.
        zpreparing to commitNz*working_tree must be passed into commit().Zrequires_rich_rootcSsdSr:rrrrr�<lambda>+�zCommit.commit.<locals>.<lambda>cs�Sr*r)�x��messagerr�message_callback3sz'Commit.commit.<locals>.message_callbackzKThe message or message_callback keyword parameter is required for commit().FrrB��TrzCollecting changes)�counter��lossyzGbound branches not supported for commit builders that update the branchzSaving data locallyz1aborting commit write group because of exception:zUpdating the working tree)Xr	rNrHrr
�	work_treerO�getattrrKZsupports_rich_rootrZRootNotRich�
isinstance�bytes�decoder
�bound_branchZany_entries_deleted�sortedrr&rP�
master_branch�	recursiver1�specific_files�allow_pointlessrY�	timestamp�timezone�	committer�strict�verbose�
enter_context�
lock_write�get_parent_ids�parentsrZ
ui_factoryZnested_progress_bar�pb�callbackZfinished�
last_revision�basis_revid�
basis_treeZ	lock_read�lenZ	conflictsr�_check_bound_branchZget_config_stack�_check_out_of_date_treerG�_select_reporter�
pb_stage_name�pb_stage_count�pb_stage_totalZshow_pctZshow_spinnerZshow_etaZ
show_countZshow_barr�_set_progress_stage�_lossyZget_commit_builder�builder�updates_branch�abortrM�baser-�_update_builder_with_changes�_check_pointlessZfinish_inventoryrX�commit�	ExceptionrZlog_exception_quietly�_update_branchesZ	unversion�
deleted_pathsZupdate_basis_by_deltaZget_basis_deltar2�_process_post_hooks)r#rXrjrkrlrhr1rirmrnrNZworking_treerPrGZconfigrYrgr&rQr^�stack�	old_revno�	old_revid�	new_revnoZmaster_locationrrWrr��s�8




�
�



�
�





�z
Commit.commitcCs|jjsz|�||�|jr\|�d�|jj|j||j|j	d�\}|_|j	r\|j�
|j|j�|durhd}|j�||j�n4z|�||�Wn"ty�|j�||��Yn0|jr�|�d�|jj
�|jj
�\}}|r�dd�|D�}ttd�d	�|����dS)
a~Update the master and local branch to the new revision.

        This will try to make sure that the master branch is updated
        before the local branch.

        :param old_revno: Revision number of master branch before the
            commit
        :param old_revid: Tip of master branch before the commit
        :param new_revno: Revision number of the new commit
        zUploading data to master branchr]NrzMerging tags to master branchcSsg|]\}}}d|�qS)z    r)�.0�name�_rrr�
<listcomp>�rUz+Commit._update_branches.<locals>.<listcomp>z%Conflicting tags in bound branch:
{0}rJ)r�r��_process_pre_hooksrdrrfZ"import_last_revision_info_and_tagsrOr1r�ZfetchZset_last_revision_info�
BaseExceptionZtagsZmerge_torrr?r!)r#r�r�r�Ztag_updatesZ
tag_conflictsZ
warning_linesrrrr��s6
�
��zCommit._update_branchescCst�rt�St�S)z!Select the CommitReporter to use.)rr)r>r;rrrr{�szCommit._select_reportercCs4|jr
dSt|j�dkrdS|j��r*dSt��dS)Nr)rirxrrr�Zany_changesrr;rrrr��s
zCommit._check_pointlesscCs�|jr|j��st���|js,|j�|�|_|js>|j|_dS|j��}|r^t�|j|j|��|j��}|j��}||kr�t�	|j|j��|j|_
|�|j���dS)z�Check to see if the local branch is bound.

        If it is bound, then most of the commit will actually be
        done using the remote branch as the target branch.
        Only at the end will the local branch be updated.
        N)
rPrOZget_bound_locationrZLocalRequiresBoundBranchZget_master_branchrfZCommitToDoubleBoundBranchruZBoundBranchOutOfDaterdrorp)r#r�rQZmaster_bound_locationZmaster_revidZlocal_revidrrrrys,�

�	

�zCommit._check_bound_branchcCs�z|j��d}Wnty,tjj}Yn0|jj��sF|j	�
d�r�z|j��\}}Wq�tj
y�|j��}|j�|�}Yq�0n|j��}d}||kr�|tjjkr�t�|j��|dur�|jj�|�r�|d}nd}|||fS)z�Check that the working tree is up to date.

        :return: old_revision_number, old_revision_id, new_revision_number
            tuple
        rZcalculate_revnosNr)r_rq�
IndexError�breezy�revision�
NULL_REVISIONrfrLZstores_revnorH�getZlast_revision_infor�UnsupportedOperationrurOZrevision_id_to_revnoZ
OutOfDateTreerKZhas_revision)r#Zfirst_tree_parentr�Zmaster_lastr�rrrrz,s.
�

�
zCommit._check_out_of_date_treecCs|�d�|�d||�dS)z(Process any registered pre commit hooks.zRunning pre_commit hooks�
pre_commitN)r�_process_hooks)r#r�r�rrrr�Os
zCommit._process_pre_hookscCs^|�d�|j�d�}|durL|�d�}|D]}t|d|jt|jd��}q,|�d||�dS)z)Process any registered post commit hooks.zRunning post_commit hooks�post_commitN� z(branch, rev_id))rOr�r1)	rrHr��split�evalrOr�r1r�)r#r�r�r��hooks�hook�resultrrrr�Ts

��zCommit._process_post_hooksc

Cs�tj|sdS|js |j}d}n|j}|j}|jr>|jd}ntjj}|dkrh|j	�
�}|j|jdd�}tj|D]t}	d|tj�
|	�f|_|��dtjvr�td|	�|dkr�|	||||||j�qr|dkrr|	||||||j||�qrdS)	Nrr�T)Zinclude_rootzRunning %s hooks [%s]r�zInvoking commit hook: %rr�)rr�rdrOrfrrr�r�r�r�Z
revision_treeZchanges_fromrwZ
get_hook_namer|�_emit_progressrZdebug_flagsrr1)
r#Z	hook_namer�r�Zhook_masterZ
hook_localr�Zfuture_treeZ
tree_deltar�rrrr�fs>

��

�
�zCommit._process_hookscCsv|j}td|�|��|jj|j|d�}|jr<t||j�}|�|�}|j	�
|j|j|�D]\}}|j�||�qZdS)zHUpdate the commit builder with the data about what has changed.
        z)Selecting files for commit with filter %r)rhN)
rhr�
_check_strictr_r%rwr&r(�_filter_iter_changesr�Zrecord_iter_changesrvZ_observed_sha1)r#rhr%r$Zfs_hashrrrr��s
�

�z#Commit._update_builder_with_changesc
cs�|j}|��}g}|D�]n}|r>|jd}|jd}|jd}|jd}	|jd}|	dur�|r�|rl|�|�|jddkr�|j��s�t�	d|jdf�q|�
|jd�|��}|jd}d}n"|	dkr�|jdkr�|�
|jd�|jds�|jd�r~|V|�r~|du�r|�|�n`|du�r:|�td	�|�nD||k�rX|�td
�||�n&|�sn|jjjjj�r~|�td�|�|��q||_dS)aIProcess iter_changes.

        This method reports on the changes in iter_changes to the user, and
        converts 'missing' entries in the iter_changes iterator to 'deleted'
        entries. 'missing' entries have their

        :param iter_changes: An iter_changes to process.
        :return: A generator of changes.
        rrN�symlinkz?Ignoring "%s" as symlinks are not supported on this filesystem.Fztree-referencerSrCr9rD)rGr<r$�	versioned�kindr5r_Zsupports_symlinksrZwarning�appendZdiscard_newrg�_commit_nested_treer4r/rr9rOrKrLZrich_root_data�_next_progress_entryr�)
r#r%rGZreport_changesr�r'r7r8r�r�rrrr��sX








�





���
zCommit._filter_iter_changescCs |jr|j��D]
}t��qdSr*)rmr_Zunknownsr)r#�unknownrrrr��szCommit._check_strictcCs�|j�|�}|jj�|jjj�r.|jjj|j_z:|jd|j|j|j|j	|j
|j|j|j
|j|j|jd�WSty�|j�|�YS0dS)zCommit a nested tree.N)rXrNrgrYrjrkrlrirmrnrPrG)r_Zget_nested_treerOrKZhas_same_locationr�rNrgrYrjrkrlrirmrnrPrGrZget_reference_revision)r#r$Zsub_treerrrr��s&��
�	zCommit._commit_nested_treecCs2||_|jd7_|r d|_nd|_|��dS)z>Set the progress stage and emit an update to the progress bar.rrN)r|r}�pb_entries_countr�)r#r�r\rrrr�szCommit._set_progress_stagecCs|jd7_|��dS)zAEmit an update to the progress bar and increment the entry count.rN)r�r�r;rrrr�szCommit._next_progress_entrycCsH|jdur td��|j|j�}ntd�|jf}|j�||j|j�dS)Nz{0} [{1}] - Stagez
%s - Stage)r�rr?r|rs�updater}r~)r#�textrrrr�s
�zCommit._emit_progress)NN)NFN)NNNNNNTFFNNFNNNrSNNF)N)F)rrrr=r"�staticmethodrRr�r�r{r�ryrzr�r�r�r�r�r�r�rr�r�rrrrrF�sX
�

��
Z1

*#+9	

rF)%Z
__future__rrBrrrrrOrZcleanupr	Z
breezy.configr�r
rrZosutilsr
rrrrrrZtreerZurlutilsrZi18nrrrr(�objectr)r>rFrrrr�<module>s $
,