^ce `ddlmZddlmZmZmZdZGddZGddZdS) )_) registrar templatekwutilc|gS|gS)zF a convenience method to return an empty list instead of None )vals 6/usr/lib/python3/dist-packages/mercurial/namespaces.pytolistr s { u cHeZdZdZdZdZdZdZd dZdZ e Z d d Z d Z dS) namespaceszprovides an interface to register and operate on multiple namespaces. See the namespace class below for details on the namespace object. c tj|_tj}d}d}d}t dd|d|||d}||d}d }d }t d d |d |||d hd}||d} d} d} t dd|d| | | d}||dS)Nc4|jSN) _bookmarkskeysrepos r z%namespaces.__init__..!s 4 4 6 6r cPt|j|Sr)r rgetrnames r rz%namespaces.__init__.."st/B/B4/H/H(I(Ir c,||Sr) nodebookmarksrnodes r rz%namespaces.__init__..#s(:(:4(@(@r s bookmarkssbookmarkT) templatenamelogfmt listnamesnamemapnodemapbuiltinc>d|DS)Ncg|]\}}|Srr).0tns r z9namespaces.__init__..../s ? ? ?tq! ? ? ?r )tagslistrs r rz%namespaces.__init__../s ? ?t}} ? ? ?r cZt|jj|Sr)r _tagscachetagsrrs r rz%namespaces.__init__..0s!t/C/G/G/M/M(N(Nr c,||Sr)nodetagsrs r rz%namespaces.__init__..1s d(;(;r stagsstagstip)r r!r"r#r$ deprecatedr%cN|Sr) branchmaprrs r rz%namespaces.__init__..>sdnn..3355r cHt||dS)NT)r branchtiprs r rz%namespaces.__init__..?sfT^^D$-G-G&H&Hr c8||gSr)branchrs r rz%namespaces.__init__..@stDz'8'8':':&;r sbranchessbranch)rsortdict_namesr getlogcolumns namespace addnamespace) selfcolumnsbmknames bmknamemap bmknodemapr*tagnames tagnamemap tagnodemapbnamesbnamemapbnodemaps r __init__znamespaces.__init__s=moo *,,76II @@  $;'    !??NN ;;  6?x  !55HH;;  "9%    !r c|j|S)zreturns the namespace object)r:)r>r<s r __getitem__znamespaces.__getitem__Ls{9%%r c4|jSr)r:__iter__r>s r rMznamespaces.__iter__Ps{##%%%r Nc8|j||Sr)r:r)r>r<defaults r rznamespaces.getSs{y'222r c4|jSr)r:itemsrNs r rRznamespaces.itemsVs{  """r c|"|j|jn|jj<jtjvr?t jtj}|jddhfd}dSdS)zregister a namespace namespace: the name to be registered (in plural form) order: optional argument to specify the order of namespaces (e.g. 'branches' should be listed before 'bookmarks') Nsreposctx)requiresc:tj||jSr)r shownamesr)contextmappingr<s r generatekwz+namespaces.addnamespace..generatekwls!+GWinMMMr )r:insertrrkeywordsrtemplatekeyword)r>r<orderr\rYs ` r r=znamespaces.addnamespace[s   K  uini @ @ @ @*3DK  ' >!4 4 4'7 8KLLO _Y^w6G H H H N N N NI H N N N 5 4r c|jD]!\}}|||}|r|cS"tt d|z)a Return the 'best' node for the given name. What's best is defined by the namespace's singlenode() function. The first match returned by a namespace in the defined precedence order is used. Raises a KeyError if there is no such node. sno such name: %s)r:rR singlenodeKeyErrorr)r>rrnsvr*s r r_znamespaces.singlenodepsj[&&((  EB T4((A  q,--4555r r) __name__ __module__ __qualname____doc___names_versionrIrKrMrrR iteritemsr=r_rr r rrs N///b&&&&&&3333###INNNN* 6 6 6 6 6r rc@eZdZdZ ddZdZdZdZdS) r<aprovides an interface to a namespace Namespaces are basically generic many-to-many mapping between some (namespaced) names and nodes. The goal here is to control the pollution of jamming things into tags or bookmarks (in extension-land) and to simplify internal bits of mercurial: log output, tab completion, etc. More precisely, we define a mapping of names to nodes, and a mapping from nodes to names. Each mapping returns a list. Furthermore, each name mapping will be passed a name to lookup which might not be in its domain. In this case, each method should return an empty list and not raise an error. This namespace object will define the properties we need: 'name': the namespace (plural form) 'templatename': name to use for templating (usually the singular form of the plural namespace name) 'listnames': list of all names in the namespace (usually the keys of a dictionary) 'namemap': function that takes a name and returns a list of nodes 'nodemap': function that takes a node and returns a list of names 'deprecated': set of names to be masked for ordinary use 'builtin': bool indicating if this namespace is supported by core Mercurial. NFc t||_||_||_||_||_||_||_||_| r| |_|j |j|_|j |j|_|j%d|jz ddz|_| t|_ n| |_ | |_ dS)aVcreate a namespace name: the namespace to be registered (in plural form) templatename: the name to use for templating logname: the name to use for log output; if not specified templatename is used colorname: the name to use for colored log output; if not specified logname is used logfmt: the format to use for (i18n-ed) log output; if not specified it is composed from logname listnames: function to list all names namemap: function that inputs a name, output node(s) nodemap: function that inputs a node, output name(s) deprecated: set of names to be masked for ordinary use builtin: whether namespace is implemented by core Mercurial singlenode: function that inputs a name, output best node (or None) Ns%s: s%s ) rr logname colornamer!r"r#r$r_ljustsetr2r%) r>rr rlrmr!r"r#r$r2r%r_s r rIznamespace.__init__s> ( " "   )(DO < ,DL > !!\DN ; !DL077;;gEDK  !eeDOO(DO r cHt|||S)z[method that returns a (sorted) list of names in a namespace that match a given node)sortedr$)r>rrs r namesznamespace.namess dll4..///r cHt|||S)z]method that returns a list of nodes in a namespace that match a given name. )rqr#)r>rrs r nodesznamespace.nodess dll4..///r c|||}|rRt|dkr7|jtfd|D}|S|dSdS)zreturns the best node for the given name By default, the best node is the node from nodes() with the highest revision number. It can be overriden by the namespace.rc3BK|]}|VdSr)rev)r(rcls r z'namespace.singlenode..s-88dRVVD\\888888r rN)r#len changelogmaxr)r>rrr*maxrevrxs @r r_znamespace.singlenodesv LLt $ $  1vvzz^8888a88888wwv&Q4Ktr ) NNNNNNNNFN)rcrdrerfrIrrrtr_rr r r<r<s<<<<<|000 000     r r<N) i18nrrrrr rr<rr r rsi6i6i6i6i6i6i6i6Xssssssssssr