I'm separating this into its own commit so people can bikeshed over the actual
categorization (vs the support for categories). These categories are based on
the help implementation we've been using internally at Google, and have had
zero complaints.
Details
- Reviewers
durin42 martinvonz - Group Reviewers
hg-reviewers - Commits
- rHGc303d65d2e34: help: assigning categories to existing commands
Diff Detail
- Repository
- rHG Mercurial
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Event Timeline
- Command categories.
+CATEGORY_REPO_CREATION = _('Repository creation')
+CATEGORY_REMOTE_REPO_MANAGEMENT = _('Remote repository management')
+CATEGORY_COMMITTING = _('Change creation')
+CATEGORY_CHANGE_NAVIGATION = _('Change navigation')
+CATEGORY_CHANGE_MANAGEMENT = _('Change manipulation')
+CATEGORY_CHANGE_ORGANIZATION = _('Change organization')
+CATEGORY_WORKING_DIRECTORY = _('Working directory management')
+CATEGORY_FILE_CONTENTS = _('File content management')
+CATEGORY_IMPORT_EXPORT = _('Change import/export')
+CATEGORY_MAINTENANCE = _('Repository maintenance')
+CATEGORY_HELP = _('Help')
+CATEGORY_MISC = _('Miscellaneous commands')
CATEGORY_NONE = _('Uncategorized commands')
Can you make these constants untranslated (e.g. 'help' instead of _('Help'))
and map them to corresponding translation later?
And, perhaps they can be moved to registrar.command so we can avoid
importing help.py everywhere.
See if this is what you had in mind. Also updated all parent changesets accordingly.
Yeah, that's it, thanks. I'll review the new series.
+# Add our category before "Repository maintenance".
+help.CATEGORY_ORDER.insert(
+ help.CATEGORY_ORDER.index(command.CATEGORY_MAINTENANCE),
+ _HELP_CATEGORY)
+help.CATEGORY_NAMES[_HELP_CATEGORY] = 'GPG signing'
Moved this to extsetup(), since otherwise it could leave phantom None
on import failure.
Queued the first 5 patches, thanks.
- Human-readable category names. These are translated.
- Extensions with custom categories should add their names here.
To make these being collected to i18n catalog, we have to wrap them with _().
But that can be fixed later.
CATEGORY_NAMES = {
+ registrar.command.CATEGORY_REPO_CREATION: 'Repository creation',
+ registrar.command.CATEGORY_REMOTE_REPO_MANAGEMENT:
+ 'Remote repository management',
+ registrar.command.CATEGORY_COMMITTING: 'Change creation',
+ registrar.command.CATEGORY_CHANGE_NAVIGATION: 'Change navigation',
+ registrar.command.CATEGORY_CHANGE_MANAGEMENT: 'Change manipulation',
+ registrar.command.CATEGORY_CHANGE_ORGANIZATION: 'Change organization',
+ registrar.command.CATEGORY_WORKING_DIRECTORY:
+ 'Working directory management',
+ registrar.command.CATEGORY_FILE_CONTENTS: 'File content management',
+ registrar.command.CATEGORY_IMPORT_EXPORT: 'Change import/export',
+ registrar.command.CATEGORY_MAINTENANCE: 'Repository maintenance',
+ registrar.command.CATEGORY_HELP: 'Help',
+ registrar.command.CATEGORY_MISC: 'Miscellaneous commands',registrar.command.CATEGORY_NONE: 'Uncategorized commands',
Perhaps, using all-lowercase names is our convention.