o ]Lb@sdZddlmZddlmZddlmZmZmZm Z m Z dZ iZ e e Z e e ddge e dd e e d d iZe eZd d ZddZ dddZddZddZdddZddZddZdS)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-branchesFcKsv|jj}|r+||tdvrttd|t||s)tjtdtd|dd S|tddr9ttdd 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) _bookmarksactive configlistMY_NAMErAbortrcwd_at_bookmark configbool)uirepokwargsrr0/usr/lib/python3/dist-packages/hgext/bookflow.py commit_hook(s"   rcCst|dkr ||||SdS)NF)len)origrparentsnoderrrbookmarks_update;s  r!Nc Cs@|s|j}|D]}||vrttd|q|||||||S)Ns8bookmark %s already exists, to move use the --rev option)rrrr) rrtrnamesrevforceinactivemarksnamerrrbookmarks_addbookmarksDsr)cOs"t|||||g|Ri|SN)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_pullYsr0cKs>|r|ds|dstjtddd||||fi|S)Ncleanr$s@creating named branches is disabled and you should use bookmarksssee 'hg help bookflow'r )getrrr)rrrlabelr,rrrcommands_branchgsr4cCs|j|}|d}||kS)N.)rlookup)rmarkmark_idcur_idrrrrrs  rcCs`ttdtttdtttjdtttjdt | t ds.ttjdt dSdS)Nsupdates addbookmarksscommitspullr sbranch) r wrapfunctionrr!r) wrapcommandrtabler-r0rrr4)rrrruisetupxs r=)NFFr*)__doc__ __future__rmercurial.i18nr mercurialrrrrrr configtable configitemcmdtablecommandrr!r)r-r0r4rr=rrrrs*