
    .Ph]                     h    d Z ddlZddlmZmZmZ  ej        dg d          Zd Zd Z	d	 Z
dddZdS )z-Utilities for reading and generating reflogs.    N   )ZERO_SHAformat_timezoneparse_timezoneEntryold_shanew_sha	committer	timestamptimezonemessagec                     | t           } | dz   |z   dz   |z   dz   t          t          |                                        d          z   dz   t	          |          z   dz   |z   S )zGenerate a single reflog line.

    Args:
      old_sha: Old Commit SHA
      new_sha: New Commit SHA
      committer: Committer name and e-mail
      timestamp: Timestamp
      timezone: Timezone
      message: Message
    N    ascii   	)r   strintencoder   r   s         N/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/dulwich/reflog.pyformat_reflog_liner   "   s     
	
	 	 		
 	 c)nn


$
$W
-
-	. 	 (
#
#	$ 		 
	    c           	         |                      dd          \  }}|                     dd          \  }}}|                    dd          \  }}}t          |||t          |          t	          |          d         |          S )zParse a reflog line.

    Args:
      line: Line to parse
    Returns: Tuple of (old_sha, new_sha, committer, timestamp, timezone,
        message)
    r   r   r      r   )splitrsplitr   r   r   )	linebeginr   r	   r
   restr   timestamp_strtimezone_strs	            r   parse_reflog_liner"   >   s     zz%++UG${{433Wgt/3{{4/C/C,Y|M|$$Q'  r   c              #   6   K   | D ]}t          |          V  dS )z_Read reflog.

    Args:
      f: File-like object
    Returns: Iterator over Entry objects
    N)r"   )fr   s     r   read_reflogr%   S   s8        & &%%%%%%& &r   Freturnc                 2   |dk     rt          d|           g }|                                 }| D ]:}|                    |t          |          f           |                                 };t	          |          |z
  dz
  }||         d         }|                     |           |dk    r|                                  dS ||= |ri|dk    rc|ra|dk    rt          }n||dz
           d         j        }||         \  }}	|t          ||	j        |	j
        |	j        |	j        |	j                  f||<   ||d         D ]J\  }
}	|                     t          |	j        |	j        |	j
        |	j        |	j        |	j                             K|                                  dS )a   Drop the specified reflog entry.

    Args:
        f: File-like object
        index: Reflog entry index (in Git reflog reverse 0-indexed order)
        rewrite: If a reflog entry's predecessor is removed, set its
            old SHA to the new SHA of the entry that now precedes it
    r   zInvalid reflog index r   N)
ValueErrortellappendr"   lenseektruncater   r
   r   r   r   r   r   writer   r	   )r$   indexrewritelogoffsetr   inverse_indexwrite_offsetprevious_newentry_s              r   drop_reflog_entryr8   ^   s    qyy888999
CVVXXF  

F-d334555HHu$q(M}%a(LFF<zz	

M 
51999A#LL}q01!4<LM* 

M ' 

 

5	 		
 		
 		
 		
 JJLLLLLr   )F)r&   N)__doc__collectionsobjectsr   r   r   
namedtupler   r   r"   r%   r8    r   r   <module>r>      s   , 4 3     > > > > > > > > > >KKK	 	  8  *& & &8 8 8 8 8 8 8r   