Mercurial > hg
changeset 38949:b0c591950e51
fix: pull out flag definitions to make them re-usable from extensions
This makes it cleaner to implement fix-related commands with additional
functionality while sharing some flags with the core implementation.
Differential Revision: https://phab.mercurial-scm.org/D4145
author | Danny Hooper <hooper@google.com> |
---|---|
date | Mon, 06 Aug 2018 14:30:27 -0700 |
parents | 390287321b4b |
children | 35bc4b6e132d |
files | hgext/fix.py |
diffstat | 1 files changed, 10 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/fix.py Tue Jul 24 22:13:21 2018 +0900 +++ b/hgext/fix.py Mon Aug 06 14:30:27 2018 -0700 @@ -96,15 +96,16 @@ # user. configitem('fix', 'maxfilesize', default='2MB') -@command('fix', - [('', 'all', False, _('fix all non-public non-obsolete revisions')), - ('', 'base', [], _('revisions to diff against (overrides automatic ' - 'selection, and applies to every revision being ' - 'fixed)'), _('REV')), - ('r', 'rev', [], _('revisions to fix'), _('REV')), - ('w', 'working-dir', False, _('fix the working directory')), - ('', 'whole', False, _('always fix every line of a file'))], - _('[OPTION]... [FILE]...')) +allopt = ('', 'all', False, _('fix all non-public non-obsolete revisions')) +baseopt = ('', 'base', [], _('revisions to diff against (overrides automatic ' + 'selection, and applies to every revision being ' + 'fixed)'), _('REV')) +revopt = ('r', 'rev', [], _('revisions to fix'), _('REV')) +wdiropt = ('w', 'working-dir', False, _('fix the working directory')) +wholeopt = ('', 'whole', False, _('always fix every line of a file')) +usage = _('[OPTION]... [FILE]...') + +@command('fix', [allopt, baseopt, revopt, wdiropt, wholeopt], usage) def fix(ui, repo, *pats, **opts): """rewrite file content in changesets or working directory