Mercurial > hg
comparison mercurial/cmdutil.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 | 2372284d9457 |
comparison
equal
deleted
inserted
replaced
42932:e4803231f538 | 42933:7e9997041781 |
---|---|
207 | 207 |
208 if opts.get(b'currentuser'): | 208 if opts.get(b'currentuser'): |
209 opts[b'user'] = ui.username() | 209 opts[b'user'] = ui.username() |
210 | 210 |
211 return datemaydiffer | 211 return datemaydiffer |
212 | |
213 def checknotesize(ui, opts): | |
214 """ make sure note is of valid format """ | |
215 | |
216 note = opts.get('note') | |
217 if not note: | |
218 return | |
219 | |
220 if len(note) > 255: | |
221 raise error.Abort(_(b"cannot store a note of more than 255 bytes")) | |
222 if b'\n' in note: | |
223 raise error.Abort(_(b"note cannot contain a newline")) | |
212 | 224 |
213 def ishunk(x): | 225 def ishunk(x): |
214 hunkclasses = (crecordmod.uihunk, patch.recordhunk) | 226 hunkclasses = (crecordmod.uihunk, patch.recordhunk) |
215 return isinstance(x, hunkclasses) | 227 return isinstance(x, hunkclasses) |
216 | 228 |