Proposed Namespace Changes

Sean Farley sean.michael.farley at gmail.com
Thu Dec 18 22:59:42 UTC 2014


Following discussion on IRC with marmoute, it seems that having an
individual namespace as an object would look better. Here is a
hypothetical example:

repo.names = {}

repo.names["bookmarks"] = namespace.create(repo, "bookmarks", "bookmark", ...)

repo.names["bookmarks"].listnames() (should we rename 'allnames'?)

repo.names["bookmarks"].templatename

repo.names["bookmarks"].namesof(nodeid)

Let's look at all the method names we have so far,

- singlenode(name) -> returns first node found, errors out otherwise

- names(namespace, node) -> returns list of names

- namesof(node) -> return dictionary of {namespace: name}

- allnames(namespace) -> returns list of names in a namespace

- namespaces() -> return list of namespaces

Here's how it would look as an object:

- singlenode(name) -> returns first node found, errors out otherwise

- names(node) -> returns list of names

- repo.names.namesof(node) -> return dictionary of {namespace: name}

- allnames() -> returns list of names in a namespace

- repo.names.keys() -> return list of namespaces

So, the only kink here is the 'namesof' method since we'd be operating
on each namespace independently. Thoughts?


More information about the Mercurial-devel mailing list