a +b@sdZddlmZddlmZddlmZmZmZm Z m Z dZ iZ e e Z e e ddge e dd e e d d iZe eZd d ZddZdddZddZddZdddZddZddZdS)a?implements bookmark-based branching (EXPERIMENTAL) - Disables creation of new branches (config: enable_branches=False). - Requires an active bookmark on commit (config: require_bookmark=True). - Doesn't move the active bookmark on update, only on commit. - Requires '--rev' for moving an existing bookmark. - Protects special bookmarks (config: protect=@). flow related commands :hg book NAME: create a new bookmark :hg book NAME -r REV: move bookmark to revision (fast-forward) :hg up|co NAME: switch to bookmark :hg push -B .: push active bookmark )absolute_import)_) bookmarkscommandserror extensions registrarsbookflowprotect@require-bookmarkTenable-branchesFcKst|jj}|rT||tdvr.ttd|t||sptjtdtd|dn|tddrpttdd S) Nr s'cannot commit, bookmark %s is protectedsAcannot commit, working directory out of sync with active bookmarksrun 'hg up %s'hintr Ts(cannot commit without an active bookmarkr) _bookmarksactiveZ configlistMY_NAMErAbortrcwd_at_bookmark configbool)uirepokwargsrr4/usr/lib64/python3.9/site-packages/hgext/bookflow.py commit_hook(s    rcCs t|dkr||||SdSdS)NF)len)origrparentsZnoderrrbookmarks_update;s  rNc Cs@|s.|j}|D]}||vrttd|q|||||||S)Ns8bookmark %s already exists, to move use the --rev option)rrrr) rrtrnamesrevforceZinactiveZmarksnamerrrbookmarks_addbookmarksDsr%cOs"t|||||g|Ri|S)N)r)rrrargsoptsrrrcommands_commitTs r(cOsD|||g|Ri|}|jj}|r@t||s@|td||S)NsBworking directory out of sync with active bookmark, run 'hg up %s')rrrwarnr)rrrr&r'rcrrrr commands_pullYsr+cKs>|r*|ds*|ds*tjtddd||||fi|S)NZcleanr"s@creating named branches is disabled and you should use bookmarksssee 'hg help bookflow'r )getrrr)rrrZlabelr'rrrcommands_branchgsr-cCs|j|}|d}||kS)N.)rlookup)rZmarkZmark_idZcur_idrrrrrs  rcCs\ttdtttdtttjdtttjdt | t dsXttjdt dS)Nsupdates addbookmarksscommitspullr sbranch) rZ wrapfunctionrrr%Z wrapcommandrtabler(r+rrr-)rrrruisetupxs  r1)NFF)N)__doc__Z __future__rZmercurial.i18nrZ mercurialrrrrrrZ configtableZ configitemZcmdtableZcommandrrr%r(r+r-rr1rrrrs(