Mercurial > hg
annotate tests/test-bad-extension.t @ 26750:9f9ec4abe700
cmdutil: make in-memory changes visible to external editor (issue4378)
Before this patch, external editor process for the commit log can't
view some in-memory changes (especially, of dirstate), because they
aren't written out until the end of transaction (or wlock).
This causes unexpected output of Mercurial commands spawned from that
editor process.
To make in-memory changes visible to external editor process, this
patch does:
- write (or schedule to write) in-memory dirstate changes, and
- set HG_PENDING environment variable, if:
- a transaction is running, and
- there are in-memory changes to be visible
"hg diff" spawned from external editor process for "hg qrefresh"
shows:
- "changes newly imported into the topmost" before 49148d7868df(*)
- "all changes recorded in the topmost by refreshing" after this patch
(*) 49148d7868df changed steps invoking editor process
Even though backward compatibility may be broken, the latter behavior
looks reasonable, because "hg diff" spawned from the editor process
consistently shows "what changes new revision records" regardless of
invocation context.
In fact, issue4378 itself should be resolved by 800e090e9c64, which
made 'repo.transaction()' write in-memory dirstate changes out
explicitly before starting transaction. It also made "hg qrefresh"
imply 'dirstate.write()' before external editor invocation in call
chain below.
- mq.queue.refresh
- strip.strip
- repair.strip
- localrepository.transaction
- dirstate.write
- localrepository.commit
- invoke external editor
Though, this patch has '(issue4378)' in own summary line to indicate
that issues like issue4378 should be fixed by this.
BTW, this patch adds '-m' option to a 'hg ci --amend' execution in
'test-commit-amend.t', to avoid invoking external editor process.
In this case, "unsure" states may be changed to "clean" according to
timestamp or so on. These changes should be written into pending file,
if external editor invocation is required,
Then, writing dirstate changes out breaks stability of test, because
it shows "transaction abort!/rollback completed" occasionally.
Aborting after editor process invocation while commands below may
cause similar instability of tests, too (AFAIK, there is no more such
one, at this revision)
- commit --amend
- without --message/--logfile
- import
- without --message/--logfile,
- without --no-commit,
- without --bypass,
- one of below, and
- patch has no description text, or
- with --edit
- aborting at the 1st patch, which adds or removes file(s)
- if it only changes existing files, status is checked only for
changed files by 'scmutil.matchfiles()', and transition from
"unsure" to "normal" in dirstate doesn't occur (= dirstate
isn't changed, and written out)
- aborting at the 2nd or later patch implies other pending
changes (e.g. changelog), and always causes showing
"transaction abort!/rollback completed"
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Sat, 17 Oct 2015 01:15:34 +0900 |
parents | f39953663cc9 |
children | 50ad3f25fb4c |
rev | line source |
---|---|
11858
934c7e91c126
tests: unify test-bad-extension
Martin Geisler <mg@lazybytes.net>
parents:
6204
diff
changeset
|
1 $ echo 'raise Exception("bit bucket overflow")' > badext.py |
934c7e91c126
tests: unify test-bad-extension
Martin Geisler <mg@lazybytes.net>
parents:
6204
diff
changeset
|
2 $ abspath=`pwd`/badext.py |
3014
01454af644b8
load extensions only after the ui object has been completely initialized
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
3 |
23172
e955549cd045
tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents:
14286
diff
changeset
|
4 $ cat <<EOF >> $HGRCPATH |
e955549cd045
tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents:
14286
diff
changeset
|
5 > [extensions] |
e955549cd045
tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents:
14286
diff
changeset
|
6 > gpg = |
e955549cd045
tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents:
14286
diff
changeset
|
7 > hgext.gpg = |
e955549cd045
tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents:
14286
diff
changeset
|
8 > badext = $abspath |
e955549cd045
tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents:
14286
diff
changeset
|
9 > badext2 = |
e955549cd045
tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents:
14286
diff
changeset
|
10 > EOF |
3014
01454af644b8
load extensions only after the ui object has been completely initialized
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
11 |
26239
f39953663cc9
test-bad-extension: reduce dependencies on other things
timeless@mozdev.org
parents:
25364
diff
changeset
|
12 $ hg -q help help 2>&1 |grep extension |
12640
6cc4b14fb76b
tests: remove redundant globs
Mads Kiilerich <mads@kiilerich.com>
parents:
12376
diff
changeset
|
13 *** failed to import extension badext from $TESTTMP/badext.py: bit bucket overflow |
12375
02990e22150b
tests: require regexes in unified tests to be marked with " (re)"
Brodie Rao <brodie@bitheap.org>
parents:
11858
diff
changeset
|
14 *** failed to import extension badext2: No module named badext2 |
25364
de23a552fc23
extensions: show traceback on load failure if --traceback flag is set
Yuya Nishihara <yuya@tcha.org>
parents:
23172
diff
changeset
|
15 |
de23a552fc23
extensions: show traceback on load failure if --traceback flag is set
Yuya Nishihara <yuya@tcha.org>
parents:
23172
diff
changeset
|
16 show traceback |
de23a552fc23
extensions: show traceback on load failure if --traceback flag is set
Yuya Nishihara <yuya@tcha.org>
parents:
23172
diff
changeset
|
17 |
26239
f39953663cc9
test-bad-extension: reduce dependencies on other things
timeless@mozdev.org
parents:
25364
diff
changeset
|
18 $ hg -q help help --traceback 2>&1 | egrep ' extension|^Exception|Traceback|ImportError' |
25364
de23a552fc23
extensions: show traceback on load failure if --traceback flag is set
Yuya Nishihara <yuya@tcha.org>
parents:
23172
diff
changeset
|
19 *** failed to import extension badext from $TESTTMP/badext.py: bit bucket overflow |
de23a552fc23
extensions: show traceback on load failure if --traceback flag is set
Yuya Nishihara <yuya@tcha.org>
parents:
23172
diff
changeset
|
20 Traceback (most recent call last): |
de23a552fc23
extensions: show traceback on load failure if --traceback flag is set
Yuya Nishihara <yuya@tcha.org>
parents:
23172
diff
changeset
|
21 Exception: bit bucket overflow |
de23a552fc23
extensions: show traceback on load failure if --traceback flag is set
Yuya Nishihara <yuya@tcha.org>
parents:
23172
diff
changeset
|
22 *** failed to import extension badext2: No module named badext2 |
de23a552fc23
extensions: show traceback on load failure if --traceback flag is set
Yuya Nishihara <yuya@tcha.org>
parents:
23172
diff
changeset
|
23 Traceback (most recent call last): |
de23a552fc23
extensions: show traceback on load failure if --traceback flag is set
Yuya Nishihara <yuya@tcha.org>
parents:
23172
diff
changeset
|
24 ImportError: No module named badext2 |
de23a552fc23
extensions: show traceback on load failure if --traceback flag is set
Yuya Nishihara <yuya@tcha.org>
parents:
23172
diff
changeset
|
25 |
de23a552fc23
extensions: show traceback on load failure if --traceback flag is set
Yuya Nishihara <yuya@tcha.org>
parents:
23172
diff
changeset
|
26 show traceback for ImportError of hgext.name if debug is set |
de23a552fc23
extensions: show traceback on load failure if --traceback flag is set
Yuya Nishihara <yuya@tcha.org>
parents:
23172
diff
changeset
|
27 (note that --debug option isn't applied yet when loading extensions) |
de23a552fc23
extensions: show traceback on load failure if --traceback flag is set
Yuya Nishihara <yuya@tcha.org>
parents:
23172
diff
changeset
|
28 |
26239
f39953663cc9
test-bad-extension: reduce dependencies on other things
timeless@mozdev.org
parents:
25364
diff
changeset
|
29 $ (hg -q help help --traceback --config ui.debug=True 2>&1) \ |
f39953663cc9
test-bad-extension: reduce dependencies on other things
timeless@mozdev.org
parents:
25364
diff
changeset
|
30 > | grep -v '^ ' \ |
f39953663cc9
test-bad-extension: reduce dependencies on other things
timeless@mozdev.org
parents:
25364
diff
changeset
|
31 > | egrep 'extension..[^p]|^Exception|Traceback|ImportError|not import' |
25364
de23a552fc23
extensions: show traceback on load failure if --traceback flag is set
Yuya Nishihara <yuya@tcha.org>
parents:
23172
diff
changeset
|
32 *** failed to import extension badext from $TESTTMP/badext.py: bit bucket overflow |
de23a552fc23
extensions: show traceback on load failure if --traceback flag is set
Yuya Nishihara <yuya@tcha.org>
parents:
23172
diff
changeset
|
33 Traceback (most recent call last): |
de23a552fc23
extensions: show traceback on load failure if --traceback flag is set
Yuya Nishihara <yuya@tcha.org>
parents:
23172
diff
changeset
|
34 Exception: bit bucket overflow |
de23a552fc23
extensions: show traceback on load failure if --traceback flag is set
Yuya Nishihara <yuya@tcha.org>
parents:
23172
diff
changeset
|
35 could not import hgext.badext2 (No module named badext2): trying badext2 |
de23a552fc23
extensions: show traceback on load failure if --traceback flag is set
Yuya Nishihara <yuya@tcha.org>
parents:
23172
diff
changeset
|
36 Traceback (most recent call last): |
de23a552fc23
extensions: show traceback on load failure if --traceback flag is set
Yuya Nishihara <yuya@tcha.org>
parents:
23172
diff
changeset
|
37 ImportError: No module named badext2 |
de23a552fc23
extensions: show traceback on load failure if --traceback flag is set
Yuya Nishihara <yuya@tcha.org>
parents:
23172
diff
changeset
|
38 *** failed to import extension badext2: No module named badext2 |
de23a552fc23
extensions: show traceback on load failure if --traceback flag is set
Yuya Nishihara <yuya@tcha.org>
parents:
23172
diff
changeset
|
39 Traceback (most recent call last): |
de23a552fc23
extensions: show traceback on load failure if --traceback flag is set
Yuya Nishihara <yuya@tcha.org>
parents:
23172
diff
changeset
|
40 ImportError: No module named badext2 |