Mercurial > hg
comparison hgext/amend.py @ 42933:7e9997041781
amend: prevent '\n' in the note string
This comes from the evolve function. I'm not sure why this check was missing in
core, since it was present when the length check was added to evolve.
I didn't flag this as BC because 530b7361e3a9 mentioned this argument wasn't
added to the release notes due to no display capability, and that hasn't changed
AFAIK.
Differential Revision: https://phab.mercurial-scm.org/D6854
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Sat, 14 Sep 2019 18:44:18 -0400 |
parents | e4803231f538 |
children | 09d46b90f6f9 |
comparison
equal
deleted
inserted
replaced
42932:e4803231f538 | 42933:7e9997041781 |
---|---|
14 | 14 |
15 from mercurial.i18n import _ | 15 from mercurial.i18n import _ |
16 from mercurial import ( | 16 from mercurial import ( |
17 cmdutil, | 17 cmdutil, |
18 commands, | 18 commands, |
19 error, | |
20 pycompat, | 19 pycompat, |
21 registrar, | 20 registrar, |
22 ) | 21 ) |
23 | 22 |
24 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for | 23 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for |
48 invoking editor, unless ``--edit`` was set. | 47 invoking editor, unless ``--edit`` was set. |
49 | 48 |
50 See :hg:`help commit` for more details. | 49 See :hg:`help commit` for more details. |
51 """ | 50 """ |
52 opts = pycompat.byteskwargs(opts) | 51 opts = pycompat.byteskwargs(opts) |
53 if len(opts['note']) > 255: | 52 cmdutil.checknotesize(ui, opts) |
54 raise error.Abort(_("cannot store a note of more than 255 bytes")) | 53 |
55 with repo.wlock(), repo.lock(): | 54 with repo.wlock(), repo.lock(): |
56 if not opts.get('logfile'): | 55 if not opts.get('logfile'): |
57 opts['message'] = opts.get('message') or repo['.'].description() | 56 opts['message'] = opts.get('message') or repo['.'].description() |
58 opts['amend'] = True | 57 opts['amend'] = True |
59 return commands._docommit(ui, repo, *pats, **pycompat.strkwargs(opts)) | 58 return commands._docommit(ui, repo, *pats, **pycompat.strkwargs(opts)) |