Mercurial > public > mercurial-scm > hg-stable
diff mercurial/cmdutil.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 | 407ec7f3ff02 |
children | 7a58608281dd |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Tue Nov 21 04:37:51 2017 +0530 +++ b/mercurial/cmdutil.py Thu Nov 16 15:01:21 2017 -0800 @@ -1850,7 +1850,13 @@ self.ui.write("\n }") class changeset_templater(changeset_printer): - '''format changeset information.''' + '''format changeset information. + + Note: there are a variety of convenience functions to build a + changeset_templater for common cases. See functions such as: + makelogtemplater, show_changeset, buildcommittemplate, or other + functions that use changesest_templater. + ''' # Arguments before "buffered" used to be positional. Consider not # adding/removing arguments before "buffered" to not break callers. @@ -1972,7 +1978,8 @@ return formatter.lookuptemplate(ui, 'changeset', tmpl) def makelogtemplater(ui, repo, tmpl, buffered=False): - """Create a changeset_templater from a literal template 'tmpl'""" + """Create a changeset_templater from a literal template 'tmpl' + byte-string.""" spec = logtemplatespec(tmpl, None) return changeset_templater(ui, repo, spec, buffered=buffered) @@ -3860,6 +3867,7 @@ repo.dirstate.copy(copied[f], f) class command(registrar.command): + """deprecated: used registrar.command instead""" def _doregister(self, func, name, *args, **kwargs): func._deprecatedregistrar = True # flag for deprecwarn in extensions.py return super(command, self)._doregister(func, name, *args, **kwargs)