Details
Details
- Reviewers
yuja - Group Reviewers
hg-reviewers - Commits
- rHG3e549546a6e9: py3: handle keyword arguments in hgext/amend.py
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
| yuja |
| hg-reviewers |
| Lint Skipped |
| Unit Tests Skipped |
| from __future__ import absolute_import | from __future__ import absolute_import | ||||
| from mercurial.i18n import _ | from mercurial.i18n import _ | ||||
| from mercurial import ( | from mercurial import ( | ||||
| cmdutil, | cmdutil, | ||||
| commands, | commands, | ||||
| error, | error, | ||||
| pycompat, | |||||
| registrar, | registrar, | ||||
| ) | ) | ||||
| # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for | ||||
| # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should | ||||
| # be specifying the version(s) of Mercurial they are tested with, or | # be specifying the version(s) of Mercurial they are tested with, or | ||||
| # leave the attribute unspecified. | # leave the attribute unspecified. | ||||
| testedwith = 'ships-with-hg-core' | testedwith = 'ships-with-hg-core' | ||||
| def amend(ui, repo, *pats, **opts): | def amend(ui, repo, *pats, **opts): | ||||
| """amend the working copy parent with all or specified outstanding changes | """amend the working copy parent with all or specified outstanding changes | ||||
| Similar to :hg:`commit --amend`, but reuse the commit message without | Similar to :hg:`commit --amend`, but reuse the commit message without | ||||
| invoking editor, unless ``--edit`` was set. | invoking editor, unless ``--edit`` was set. | ||||
| See :hg:`help commit` for more details. | See :hg:`help commit` for more details. | ||||
| """ | """ | ||||
| opts = pycompat.byteskwargs(opts) | |||||
| if len(opts['note']) > 255: | if len(opts['note']) > 255: | ||||
| raise error.Abort(_("cannot store a note of more than 255 bytes")) | raise error.Abort(_("cannot store a note of more than 255 bytes")) | ||||
| with repo.wlock(), repo.lock(): | with repo.wlock(), repo.lock(): | ||||
| if not opts.get('logfile'): | if not opts.get('logfile'): | ||||
| opts['message'] = opts.get('message') or repo['.'].description() | opts['message'] = opts.get('message') or repo['.'].description() | ||||
| opts['amend'] = True | opts['amend'] = True | ||||
| return commands._docommit(ui, repo, *pats, **opts) | return commands._docommit(ui, repo, *pats, **pycompat.strkwargs(opts)) | ||||