o ]Lb@srddlmZddlmZddlmZmZmZddl m Z dZ ddZ d d Z d d ZdddZddZddZd S))absolute_import)hex)pycompatutilvfs)urlutils logexchangec cst|jt}||sdS||}d}|D]*}|}|s"q|dkr*|d7}z|d\}}}|||fVWqtyCYqw|dS)z reads a file from .hg/logexchange/ directory and yields it's content filename: the file to be read yield a tuple (node, remotepath, name) Nrr) vfsmodrjoin remotenamedirexistsstripsplit ValueErrorclose) repofilenamerflinenolinenoderemoternamer7/usr/lib/python3/dist-packages/mercurial/logexchange.pyreadremotenamefiles&   rccs2t|dD]}|Vqt|dD]}|VqdS)a read the details about the remotenames stored in .hg/logexchange/ and yields a tuple (node, remotepath, name). It does not yields information about whether an entry yielded is branch or bookmark. To get that information, call the respective functions. bookmarksbranchesN)r)rbmentry branchentryrrrreadremotenames6s r!c Cst|jt}||ddd}|dtt||}t|D]\}}} ||kr3|d||| fq tt |D](\} }|dkrS|D] } |d| || fqEq;|dkrc|rc|d||| fq;| dS)NwT) atomictemps0 s %s%s%s rr) r rr r writesetrsortedr iteritemsr) r remotepathnamesnametyperrolddataroldpathrnamenrrrwriteremotenamefileDs$  r/NcCsT|}z |rt|||d|rt|||dW|dSW|dS|w)z save remotenames i.e. remotebookmarks and remotebranches in their respective files under ".hg/logexchange/" directory. rrN)wlockr/release)rr(branches bookmarksr0rrrsaveremotenames\s r4cCs|}|}|rt|jj}nt|ts|j}|j dD]"\}}t |}tt|}t|}||ks;||kr@|}|Sq|S)zreturns remote pathspaths) localrpconvert_reporoot isinstancebytes_urlui configitemsr removeauth)rrr5rpathpathurl noauthurlrrr activepathks    rCc Cst||}|}|dddi}Wdn1swYi}|}|}|di}Wdn1s@wYt|D] \}} g||<| D]} | |vri|| si||t | qTqJt ||||dS)z pulls bookmarks and branches information of the remote repo during a pull or clone operation. localrepo is our local repository remoterepo is the peer instance slistkeyss namespacerNs branchmap) rCcommandexecutor callcommandresult unfilteredrr'obsoleteappendrr4) localrepo remoterepor(er3bmapr branchmapbranchnodesrrrrpullremotenamess.    rQ)NN) __future__rrrrrrr utilsrr rr!r/r4rCrQrrrrs