Mercurial > public > mercurial-scm > hg-stable
diff mercurial/context.py @ 35130:b22a0d9e0a83
docs: add args/returns docs for some cmdutil, context, and registrar functions
When writing my first extension, I found it hard to figure out these functions.
I figured documenting their inputs/outputs would help future authors who
are new to the codebase.
Differential Revision: https://phab.mercurial-scm.org/D1440
author | rlevasseur@google.com |
---|---|
date | Thu, 16 Nov 2017 15:01:21 -0800 |
parents | bd2743936b56 |
children | d90c534099b1 |
line wrap: on
line diff
--- a/mercurial/context.py Tue Nov 21 04:37:51 2017 +0530 +++ b/mercurial/context.py Thu Nov 16 15:01:21 2017 -0800 @@ -615,10 +615,13 @@ def closesbranch(self): return 'close' in self._changeset.extra def extra(self): + """Return a dict of extra information.""" return self._changeset.extra def tags(self): + """Return a list of byte tag names""" return self._repo.nodetags(self._node) def bookmarks(self): + """Return a list of byte bookmark names.""" return self._repo.nodebookmarks(self._node) def phase(self): return self._repo._phasecache.phase(self._repo, self._rev) @@ -629,7 +632,11 @@ return False def children(self): - """return contexts for each child changeset""" + """return list of changectx contexts for each child changeset. + + This returns only the immediate child changesets. Use descendants() to + recursively walk children. + """ c = self._repo.changelog.children(self._node) return [changectx(self._repo, x) for x in c] @@ -638,6 +645,10 @@ yield changectx(self._repo, a) def descendants(self): + """Recursively yield all children of the changeset. + + For just the immediate children, use children() + """ for d in self._repo.changelog.descendants([self._rev]): yield changectx(self._repo, d)