File: //usr/lib/python3/dist-packages/hgext/convert/__pycache__/filemap.cpython-310.pyc
o
�]Lb�F � @ s| d dl mZmZ d dlZd dlmZ d dlmZmZ ddl m
Z
e
jZdd� Zd d
� Z
G dd� de�ZG d
d� de
j�ZdS )� )�absolute_import�print_functionN)�_)�error�pycompat� )�commonc c sT � t | �}|dkr#| d|� | |d d� fV | �dd|�}|dks d| fV dS )a Yield tuples with path split at '/', starting with the full path.
No leading, trailing or double '/', please.
>>> for x in rpairs(b'foo/bar/baz'): print(x)
('foo/bar/baz', '')
('foo/bar', 'baz')
('foo', 'bar/baz')
('.', 'foo/bar/baz')
���Nr � /r � .)�len�rfind)�path�i� r �7/usr/lib/python3/dist-packages/hgext/convert/filemap.py�rpairs s � �r c C s | du rdS t �| �S )z}We use posixpath.normpath to support cross-platform path format.
However, it doesn't handle None input. So we wrap it up.N)� posixpath�normpath)r r r r � normalize% s
r c @ sB e Zd ZdZddd�Zdd� Zdd� Zd d
� Zdd� Zd
d� Z dS )�
filemapperz�Map and filter filenames when importing.
A name can be mapped to itself, a new name, or None (omit from new
repository).Nc C sB || _ i | _i | _i | _d | _|r| �|�rt�td���d S d S )Ns errors in filemap) �ui�include�exclude�rename�targetprefixes�parser �Abortr )�selfr r r r r �__init__2 s
�zfilemapper.__init__c s< d}� �fdd�}t j|dd�� � �� }|r�|dkr/t� �� �}|||�jd�7 }|�j|<