Mercurial > hg
comparison hgext/releasenotes.py @ 34340:741a511492d3
releasenotes: raise error on simultaneous usage of flags
The releasenotes command is supposed to raise an error when --list and
--rev/--check flags are used together. This patch adds the above functionality.
Differential Revision: https://phab.mercurial-scm.org/D831
author | Rishabh Madan <rishabhmadan96@gmail.com> |
---|---|
date | Thu, 28 Sep 2017 13:22:58 +0530 |
parents | 2a37459aedf2 |
children | 01e8ab4b6573 |
comparison
equal
deleted
inserted
replaced
34339:ec769bba34d3 | 34340:741a511492d3 |
---|---|
550 this command and changes should not be lost when running this command on | 550 this command and changes should not be lost when running this command on |
551 that file. A particular use case for this is to tweak the wording of a | 551 that file. A particular use case for this is to tweak the wording of a |
552 release note after it has been added to the release notes file. | 552 release note after it has been added to the release notes file. |
553 """ | 553 """ |
554 sections = releasenotessections(ui, repo) | 554 sections = releasenotessections(ui, repo) |
555 if opts.get('list'): | 555 |
556 listflag = opts.get('list') | |
557 | |
558 if listflag and opts.get('rev'): | |
559 raise error.Abort(_('cannot use both \'--list\' and \'--rev\'')) | |
560 if listflag and opts.get('check'): | |
561 raise error.Abort(_('cannot use both \'--list\' and \'--check\'')) | |
562 | |
563 if listflag: | |
556 return _getadmonitionlist(ui, sections) | 564 return _getadmonitionlist(ui, sections) |
557 | 565 |
558 rev = opts.get('rev') | 566 rev = opts.get('rev') |
559 revs = scmutil.revrange(repo, [rev or 'not public()']) | 567 revs = scmutil.revrange(repo, [rev or 'not public()']) |
560 if opts.get('check'): | 568 if opts.get('check'): |