Mercurial > hg
annotate tests/test-username-newline.t @ 45882:8cc9e7f762d6
errors: move similarity_hint() to error module
I want to be able to reuse it from `UnknownIdentifier`'s constructor.
Moving it results in a new import of `difflib` in the `error`
module. There was a comment at the top of `error.py` saying "Do not
import anything but pycompat here, please", which was added (except
for the "pycompat" bit) in 08cabecfa8a8 (errors: move revlog errors,
2009-01-11). I don't know the reason for the comment. I'm guessing the
point was to not make the module depend on other Mercurial modules. If
that was it, then importing `difflib` should be fine.
Sorry about the churn (I moved this code from the `dispatch` module to
the `scmutil` module very recently).
Differential Revision: https://phab.mercurial-scm.org/D9345
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 19 Nov 2020 12:20:26 -0800 |
parents | 5ac845ca059a |
children | 95c4cca641f6 |
rev | line source |
---|---|
12301
3a082866422a
tests: unify test-username-newline
Adrian Buehlmann <adrian@cadifra.com>
parents:
7035
diff
changeset
|
1 $ hg init |
3a082866422a
tests: unify test-username-newline
Adrian Buehlmann <adrian@cadifra.com>
parents:
7035
diff
changeset
|
2 $ touch a |
7035
9d023ef7b467
forbid username with '\n' at the changelog level
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
3 |
12301
3a082866422a
tests: unify test-username-newline
Adrian Buehlmann <adrian@cadifra.com>
parents:
7035
diff
changeset
|
4 $ unset HGUSER |
3a082866422a
tests: unify test-username-newline
Adrian Buehlmann <adrian@cadifra.com>
parents:
7035
diff
changeset
|
5 $ echo "[ui]" >> .hg/hgrc |
3a082866422a
tests: unify test-username-newline
Adrian Buehlmann <adrian@cadifra.com>
parents:
7035
diff
changeset
|
6 $ echo "username= foo" >> .hg/hgrc |
3a082866422a
tests: unify test-username-newline
Adrian Buehlmann <adrian@cadifra.com>
parents:
7035
diff
changeset
|
7 $ echo " bar1" >> .hg/hgrc |
7035
9d023ef7b467
forbid username with '\n' at the changelog level
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
8 |
12301
3a082866422a
tests: unify test-username-newline
Adrian Buehlmann <adrian@cadifra.com>
parents:
7035
diff
changeset
|
9 $ hg ci -Am m |
3a082866422a
tests: unify test-username-newline
Adrian Buehlmann <adrian@cadifra.com>
parents:
7035
diff
changeset
|
10 adding a |
3a082866422a
tests: unify test-username-newline
Adrian Buehlmann <adrian@cadifra.com>
parents:
7035
diff
changeset
|
11 abort: username 'foo\nbar1' contains a newline |
3a082866422a
tests: unify test-username-newline
Adrian Buehlmann <adrian@cadifra.com>
parents:
7035
diff
changeset
|
12 |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
12301
diff
changeset
|
13 [255] |
12301
3a082866422a
tests: unify test-username-newline
Adrian Buehlmann <adrian@cadifra.com>
parents:
7035
diff
changeset
|
14 $ rm .hg/hgrc |
7035
9d023ef7b467
forbid username with '\n' at the changelog level
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
15 |
12301
3a082866422a
tests: unify test-username-newline
Adrian Buehlmann <adrian@cadifra.com>
parents:
7035
diff
changeset
|
16 $ HGUSER=`(echo foo; echo bar2)` hg ci -Am m |
33617
5ac845ca059a
commit: don't let failed commit with --addremove update dirstate (issue5645)
Martin von Zweigbergk <martinvonz@google.com>
parents:
12346
diff
changeset
|
17 adding a |
12301
3a082866422a
tests: unify test-username-newline
Adrian Buehlmann <adrian@cadifra.com>
parents:
7035
diff
changeset
|
18 abort: username 'foo\nbar2' contains a newline |
3a082866422a
tests: unify test-username-newline
Adrian Buehlmann <adrian@cadifra.com>
parents:
7035
diff
changeset
|
19 |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
12301
diff
changeset
|
20 [255] |
12301
3a082866422a
tests: unify test-username-newline
Adrian Buehlmann <adrian@cadifra.com>
parents:
7035
diff
changeset
|
21 $ hg ci -Am m -u "`(echo foo; echo bar3)`" |
33617
5ac845ca059a
commit: don't let failed commit with --addremove update dirstate (issue5645)
Martin von Zweigbergk <martinvonz@google.com>
parents:
12346
diff
changeset
|
22 adding a |
12301
3a082866422a
tests: unify test-username-newline
Adrian Buehlmann <adrian@cadifra.com>
parents:
7035
diff
changeset
|
23 transaction abort! |
3a082866422a
tests: unify test-username-newline
Adrian Buehlmann <adrian@cadifra.com>
parents:
7035
diff
changeset
|
24 rollback completed |
3a082866422a
tests: unify test-username-newline
Adrian Buehlmann <adrian@cadifra.com>
parents:
7035
diff
changeset
|
25 abort: username 'foo\nbar3' contains a newline! |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
12301
diff
changeset
|
26 [255] |
7035
9d023ef7b467
forbid username with '\n' at the changelog level
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
27 |