Mercurial > hg
annotate tests/test-mq-symlinks.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 | 4d2b9b304ad0 |
children | c2380b448265 |
rev | line source |
---|---|
22046
7a9cbb315d84
tests: replace exit 80 with #require
Matt Mackall <mpm@selenic.com>
parents:
18395
diff
changeset
|
1 #require symlink |
11908
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
2 |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
3 $ echo "[extensions]" >> $HGRCPATH |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
4 $ echo "mq=" >> $HGRCPATH |
5157
f6c520fd70cf
mq: teach qpop about symlinks
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
5 |
11908
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
6 $ hg init |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
7 $ hg qinit |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
8 $ hg qnew base.patch |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
9 $ echo aaa > a |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
10 $ echo bbb > b |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
11 $ echo ccc > c |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
12 $ hg add a b c |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
13 $ hg qrefresh |
25472
4d2b9b304ad0
tests: drop explicit $TESTDIR from executables
Matt Mackall <mpm@selenic.com>
parents:
23749
diff
changeset
|
14 $ readlink.py a |
11908
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
15 a -> a not a symlink |
6360
95413879bac9
test-mq-symlinks: skip if symlinks are not supported
Patrick Mezard <pmezard@gmail.com>
parents:
5683
diff
changeset
|
16 |
11908
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
17 |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
18 test replacing a file with a symlink |
5157
f6c520fd70cf
mq: teach qpop about symlinks
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
19 |
11908
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
20 $ hg qnew symlink.patch |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
21 $ rm a |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
22 $ ln -s b a |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
23 $ hg qrefresh --git |
25472
4d2b9b304ad0
tests: drop explicit $TESTDIR from executables
Matt Mackall <mpm@selenic.com>
parents:
23749
diff
changeset
|
24 $ readlink.py a |
11908
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
25 a -> b |
5157
f6c520fd70cf
mq: teach qpop about symlinks
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
26 |
11908
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
27 $ hg qpop |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
28 popping symlink.patch |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
29 now at: base.patch |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
30 $ hg qpush |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
31 applying symlink.patch |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
32 now at: symlink.patch |
25472
4d2b9b304ad0
tests: drop explicit $TESTDIR from executables
Matt Mackall <mpm@selenic.com>
parents:
23749
diff
changeset
|
33 $ readlink.py a |
11908
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
34 a -> b |
5157
f6c520fd70cf
mq: teach qpop about symlinks
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
35 |
11908
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
36 |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
37 test updating a symlink |
7517
49f34b43cf90
patch: handle git patches that remove symlinks (issue1438)
Brendan Cully <brendan@kublai.com>
parents:
6360
diff
changeset
|
38 |
11908
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
39 $ rm a |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
40 $ ln -s c a |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
41 $ hg qnew --git -f updatelink |
25472
4d2b9b304ad0
tests: drop explicit $TESTDIR from executables
Matt Mackall <mpm@selenic.com>
parents:
23749
diff
changeset
|
42 $ readlink.py a |
11908
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
43 a -> c |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
44 $ hg qpop |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
45 popping updatelink |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
46 now at: symlink.patch |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
47 $ hg qpush --debug |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
48 applying updatelink |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
49 patching file a |
23749
a387b0390082
localrepo: show headline notes in commitctx before showing filenames
Mads Kiilerich <madski@unity3d.com>
parents:
22046
diff
changeset
|
50 committing files: |
11908
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
51 a |
23749
a387b0390082
localrepo: show headline notes in commitctx before showing filenames
Mads Kiilerich <madski@unity3d.com>
parents:
22046
diff
changeset
|
52 committing manifest |
a387b0390082
localrepo: show headline notes in commitctx before showing filenames
Mads Kiilerich <madski@unity3d.com>
parents:
22046
diff
changeset
|
53 committing changelog |
11908
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
54 now at: updatelink |
25472
4d2b9b304ad0
tests: drop explicit $TESTDIR from executables
Matt Mackall <mpm@selenic.com>
parents:
23749
diff
changeset
|
55 $ readlink.py a |
11908
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
56 a -> c |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
57 $ hg st |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
58 |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
59 |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
60 test replacing a symlink with a file |
9586
d08099e74b81
patch: handle symlink updates/replacements (issue1785)
Patrick Mezard <pmezard@gmail.com>
parents:
9585
diff
changeset
|
61 |
11908
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
62 $ ln -s c s |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
63 $ hg add s |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
64 $ hg qnew --git -f addlink |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
65 $ rm s |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
66 $ echo sss > s |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
67 $ hg qnew --git -f replacelinkwithfile |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
68 $ hg qpop |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
69 popping replacelinkwithfile |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
70 now at: addlink |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
71 $ hg qpush |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
72 applying replacelinkwithfile |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
73 now at: replacelinkwithfile |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
74 $ cat s |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
75 sss |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
76 $ hg st |
9586
d08099e74b81
patch: handle symlink updates/replacements (issue1785)
Patrick Mezard <pmezard@gmail.com>
parents:
9585
diff
changeset
|
77 |
11908
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
78 |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
79 test symlink removal |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
80 |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
81 $ hg qnew removesl.patch |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
82 $ hg rm a |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
83 $ hg qrefresh --git |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
84 $ hg qpop |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
85 popping removesl.patch |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
86 now at: replacelinkwithfile |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
87 $ hg qpush |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
88 applying removesl.patch |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
89 now at: removesl.patch |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
90 $ hg st -c |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
91 C b |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
92 C c |
7f48f0b188c6
tests: unify test-mq-symlinks
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
10397
diff
changeset
|
93 C s |
12345 | 94 |
95 replace broken symlink with another broken symlink | |
12340
b0bb72460c44
patch: fix target when patching broken symlinks (issue2368)
Patrick Mezard <pmezard@gmail.com>
parents:
10397
diff
changeset
|
96 |
12345 | 97 $ ln -s linka linka |
98 $ hg add linka | |
99 $ hg qnew link | |
100 $ hg mv linka linkb | |
12398 | 101 $ rm linkb |
102 $ ln -s linkb linkb | |
12345 | 103 $ hg qnew movelink |
104 $ hg qpop | |
105 popping movelink | |
106 now at: link | |
107 $ hg qpush | |
108 applying movelink | |
109 now at: movelink | |
25472
4d2b9b304ad0
tests: drop explicit $TESTDIR from executables
Matt Mackall <mpm@selenic.com>
parents:
23749
diff
changeset
|
110 $ readlink.py linkb |
12345 | 111 linkb -> linkb |