� ��^iQ����ddlZddlZddlZddlmZmZddlmZmZddl m Z m Z ddl m Z ddlmZddlmZmZmZmZeje��ZGd�d e��Zeje��dS) �N)�List�Optional)� BadCommand�InstallationError)� HiddenText� display_path)� make_command)� path_to_url)� RevOptions�VersionControl�(find_path_to_project_root_from_repo_root�vcsc���eZdZdZdZdZdZedede efd���Z ded e d e dd fd �Z ded e d e dd fd �Zded e d e dd fd�Zededefd���Zededefd���Zededefd���Zededeedefd���Zededeefd���Zededeef�fd� ��Z�xZS)� Mercurial�hgz.hg�clone)zhg+filezhg+httpzhg+httpszhg+sshzhg+static-http�rev�returnc��|gS)N�)rs ��/builddir/build/BUILDROOT/alt-python311-pip-21.3.1-4.el8.x86_64/opt/alt/python311/lib/python3.11/site-packages/pip/_internal/vcs/mercurial.py�get_base_rev_argszMercurial.get_base_rev_args s ���u� ��dest�url� rev_optionsNc �>�|���}t�d||t|����|�t ddd||����|�t dd|�����|���dS)NzCloning hg %s%s to %srz --noupdate�-q�update��cwd)� to_display�logger�infor� run_commandr �to_args)�selfrrr� rev_displays r� fetch_newzMercurial.fetch_new$s���!�,�,�.�.� �� � � #� � � �� � �  � � � ����g�|�T�3��M�M�N�N�N� ��� ��4��)<�)<�)>�)>� ?� ?�� � � � � � rc�J�tj�||jd��}t j��} |�|��|�dd|j��t|d��5}|� |��ddd��n #1swxYwYtdd|� ����}|� ||���dS#ttjf$r'}t �d||��Yd}~dSd}~wwxYw) N�hgrc�paths�default�wrrr z/Could not switch Mercurial repository to %s: %s)�os�path�join�dirname� configparser�RawConfigParser�read�set�secret�open�writer r&r%�OSError�NoSectionErrorr#�warning) r'rrr� repo_config�config� config_file�cmd_args�excs r�switchzMercurial.switch2sa���g�l�l�4���v�>�>� ��-�/�/�� 1� �K�K� � $� $� $� �J�J�w� �3�:� 6� 6� 6��k�3�'�'� *�;�� � �[�)�)�)� *� *� *� *� *� *� *� *� *� *� *���� *� *� *� *� $�H�d�K�4G�4G�4I�4I�J�J�H� � � �X�4� � 0� 0� 0� 0� 0�� ��4�5� X� X� X� �N�N�L�c�SV� W� W� W� W� W� W� W� W� W����� X���s<�AC%�<B� C%�B"�"C%�%B"�&C%�%D"�;D�D"c��|�ddg|���tdd|�����}|�||���dS)N�pullrr r)r%r r&)r'rrrr@s rrzMercurial.update@s[�� ���&�$��T��2�2�2���$� �0C�0C�0E�0E�F�F�� ����t��,�,�,�,�,r�locationc���|�ddgdd|������}|�|��rt|��}|���S)N� showconfigz paths.defaultFT�� show_stdout� stdout_onlyr!)r%�strip�_is_local_repositoryr )�clsrErs r�get_remote_urlzMercurial.get_remote_urlEsl���o�o� �?� +���� � � � �%�'�'� � � #� #�C� (� (� #��c�"�"�C��y�y�{�{�rc�`�|�ddgdd|������}|S)zW Return the repository-local changeset revision number, as an integer. �parentsz--template={rev}FTrH�r%rK)rMrE�current_revisions r� get_revisionzMercurial.get_revisionQsD�� �?�?� �*� +���� +� � � �%�'�'� �  �rc�`�|�ddgdd|������}|S)zh Return the changeset identification hash, as a 40-character hexadecimal string rPz--template={node}FTrHrQ)rMrE�current_rev_hashs r�get_requirement_revisionz"Mercurial.get_requirement_revision^sD�� �?�?� �+� ,���� +� � � �%�'�'� �  �r�namec��dS)z&Always assume the versions don't matchFr)rMrrWs r�is_commit_id_equalzMercurial.is_commit_id_equalls ���urc�2�|�dgdd|������}tj�|��s=tj�tj�||����}t||��S)z� Return the path to Python project root, relative to the repo root. Return None if the project root is in the repo root. �rootFTrH)r%rKr/r0�isabs�abspathr1r )rMrE� repo_roots r�get_subdirectoryzMercurial.get_subdirectoryqs���O�O� �H�%�T�x�$� � � �%�'�'� ��w�}�}�Y�'�'� K������� � �X�y�(I�(I�J�J�I�7��)�L�L�Lrc�^��t���|��}|r|S |�dg|dddd���}n8#t$rt�d|��YdSt $rYdSwxYwtj� |� d����S)Nr[FT�raise)r!rIrJ� on_returncode�log_failed_cmdzIcould not determine if %s is under hg control because hg is not availablez ) �super�get_repository_rootr%rr#�debugrr/r0�normpath�rstrip)rMrE�loc�r� __class__s �rrezMercurial.get_repository_roots�����g�g�)�)�(�3�3�� � ��J� �������!� �%�$�  ���A�A��� � � � �L�L�.�� � � � �4�4� � � � ��4�4� �����w������� 0� 0�1�1�1s�A�%A:�- A:�9A:)�__name__� __module__� __qualname__rWr2� repo_name�schemes� staticmethod�strrrrr r)rBr� classmethodrNrSrVr�boolrYr_re� __classcell__)rks@rrrs/������� �D��G��I��G���s��t�C�y�����\��  �c�  � �  ��  �PT�  �  �  �  � 1�3� 1�Z� 1�j� 1�T� 1� 1� 1� 1�-�3�-�Z�-�j�-�T�-�-�-�-� � �c� �c� � � ��[� ��  �C�  �C�  �  �  ��[�  ��  ��  ��  �  �  ��[�  ���c���#���4�����[��� M�� M��� � M� M� M��[� M��2�3�2�8�C�=�2�2�2�2�2��[�2�2�2�2�2rr)r3�loggingr/�typingrr�pip._internal.exceptionsrr�pip._internal.utils.miscrr�pip._internal.utils.subprocessr �pip._internal.utils.urlsr � pip._internal.vcs.versioncontrolr r r r� getLoggerrlr#r�registerrrr�rs,���������� � � � �!�!�!�!�!�!�!�!�B�B�B�B�B�B�B�B�=�=�=�=�=�=�=�=�7�7�7�7�7�7�0�0�0�0�0�0������������� �� �8� $� $��B2�B2�B2�B2�B2��B2�B2�B2�J �� �Y�����r