R`i~ d dl Z d dlZd dlZd dlmZmZmZ d dlmZm Z d dl mZmZ d dl mZ d dlmZ d dlmZmZmZmZ ej, e Z G d d e Z ej4 e y) N)ListOptionalTuple) BadCommandInstallationError) HiddenTextdisplay_path)make_command)path_to_url) RevOptionsVersionControl(find_path_to_project_root_from_repo_rootvcsc F e Zd ZdZdZdZdZedede e fd Z ded ed ede ddf d Zded ed eddfdZded ed eddfdZededefd Zededefd Zededefd Zededee defd Zededee fd Zededee f fd Z xZS ) Mercurialhgz.hgclone)zhg+filezhg+httpzhg+httpszhg+sshzhg+static-httprevreturnc d| gS )Nz-r= )r s /builddir/build/BUILDROOT/alt-python312-pip-23.3.1-3.el8.x86_64/opt/alt/python312/lib/python3.12/site-packages/pip/_internal/vcs/mercurial.pyget_base_rev_argszMercurial.get_base_rev_args s cU} desturlrev_options verbosityNc 4 |j }t j d||t | |dk rd}n|dk( rd}n |dk( rd}nd}| j t d d g||| | j t dg||j | y ) NzCloning hg %s%s to %sr )z--quiet r ) --verbose)r" z--debugr z --noupdateupdatecwd) to_displayloggerinfor run_commandr to_args)selfr r r r rev_displayflagss r fetch_newzMercurial.fetch_new$ s ",,.# >%1E !^E !^"E,Eg|OeOSO$OPAEA;+>+>+@A r c t j j || j d }t j } |j | |j dd|j t |d 5 }|j | d d d t dd|j }| j || y # 1 sw Y 8xY w# t t j f$ r!}t j# d|| Y d }~y d }~ww xY w) Nhgrcpathsdefaultwr# -qr$ z/Could not switch Mercurial repository to %s: %s)ospathjoindirnameconfigparserRawConfigParserreadsetsecretopenwriter r* r) OSErrorNoSectionErrorr' warning) r+ r r r repo_configconfigconfig_filecmd_argsexcs r switchzMercurial.switch<