Mercurial > hg
annotate tests/test-record.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 | 9bc11716bc86 |
children | 58f8b29c37ff |
rev | line source |
---|---|
12328
b63f6422d2a7
tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12316
diff
changeset
|
1 Set up a repo |
5037
b2607267236d
Add record extension, giving darcs-like interactive hunk picking
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
2 |
23172
e955549cd045
tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents:
23054
diff
changeset
|
3 $ cat <<EOF >> $HGRCPATH |
e955549cd045
tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents:
23054
diff
changeset
|
4 > [ui] |
e955549cd045
tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents:
23054
diff
changeset
|
5 > interactive = true |
e955549cd045
tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents:
23054
diff
changeset
|
6 > [extensions] |
e955549cd045
tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents:
23054
diff
changeset
|
7 > record = |
e955549cd045
tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents:
23054
diff
changeset
|
8 > EOF |
5037
b2607267236d
Add record extension, giving darcs-like interactive hunk picking
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
9 |
12074
35c143e85b1b
tests: unify test-record
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
11238
diff
changeset
|
10 $ hg init a |
35c143e85b1b
tests: unify test-record
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
11238
diff
changeset
|
11 $ cd a |
5037
b2607267236d
Add record extension, giving darcs-like interactive hunk picking
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
12 |
24308
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
13 Record help |
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
14 |
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
15 $ hg record -h |
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
16 hg record [OPTION]... [FILE]... |
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
17 |
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
18 interactively select changes to commit |
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
19 |
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
20 If a list of files is omitted, all changes reported by "hg status" will be |
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
21 candidates for recording. |
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
22 |
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
23 See "hg help dates" for a list of formats valid for -d/--date. |
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
24 |
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
25 You will be prompted for whether to record changes to each modified file, |
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
26 and for files with multiple changes, for each change to use. For each |
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
27 query, the following responses are possible: |
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
28 |
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
29 y - record this change |
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
30 n - skip this change |
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
31 e - edit this change manually |
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
32 |
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
33 s - skip remaining changes to this file |
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
34 f - record remaining changes to this file |
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
35 |
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
36 d - done, skip remaining changes and files |
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
37 a - record all changes to all remaining files |
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
38 q - quit, recording no changes |
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
39 |
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
40 ? - display help |
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
41 |
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
42 This command is not available when committing a merge. |
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
43 |
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
44 options ([+] can be repeated): |
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
45 |
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
46 -A --addremove mark new/missing files as added/removed before |
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
47 committing |
25304
9bc11716bc86
commit: improve --close-branch documentation
Matt Mackall <mpm@selenic.com>
parents:
24365
diff
changeset
|
48 --close-branch mark a branch head as closed |
24365
f1eaf03dd608
commands: say "working directory" in full spelling
Yuya Nishihara <yuya@tcha.org>
parents:
24308
diff
changeset
|
49 --amend amend the parent of the working directory |
24308
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
50 -s --secret use the secret phase for committing |
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
51 -e --edit invoke editor on commit messages |
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
52 -I --include PATTERN [+] include names matching the given patterns |
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
53 -X --exclude PATTERN [+] exclude names matching the given patterns |
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
54 -m --message TEXT use text as commit message |
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
55 -l --logfile FILE read commit message from file |
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
56 -d --date DATE record the specified date as commit date |
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
57 -u --user USER record the specified user as committer |
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
58 -S --subrepos recurse into subrepositories |
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
59 -w --ignore-all-space ignore white space when comparing lines |
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
60 -b --ignore-space-change ignore changes in the amount of white space |
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
61 -B --ignore-blank-lines ignore changes whose lines are all blank |
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
62 |
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
63 (some details hidden, use --verbose to show complete help) |
1725843a7644
record: remove duplicated tests
Laurent Charignon <lcharignon@fb.com>
parents:
24235
diff
changeset
|
64 |
12074
35c143e85b1b
tests: unify test-record
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
11238
diff
changeset
|
65 Select no files |
5037
b2607267236d
Add record extension, giving darcs-like interactive hunk picking
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
66 |
12074
35c143e85b1b
tests: unify test-record
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
11238
diff
changeset
|
67 $ touch empty-rw |
35c143e85b1b
tests: unify test-record
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
11238
diff
changeset
|
68 $ hg add empty-rw |
5037
b2607267236d
Add record extension, giving darcs-like interactive hunk picking
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
69 |
12074
35c143e85b1b
tests: unify test-record
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
11238
diff
changeset
|
70 $ hg record empty-rw<<EOF |
35c143e85b1b
tests: unify test-record
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
11238
diff
changeset
|
71 > n |
35c143e85b1b
tests: unify test-record
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
11238
diff
changeset
|
72 > EOF |
35c143e85b1b
tests: unify test-record
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
11238
diff
changeset
|
73 diff --git a/empty-rw b/empty-rw |
35c143e85b1b
tests: unify test-record
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
11238
diff
changeset
|
74 new file mode 100644 |
22589
9ab18a912c44
ui: show prompt choice if input is not a tty but is forced to be interactive
Mads Kiilerich <madski@unity3d.com>
parents:
20580
diff
changeset
|
75 examine changes to 'empty-rw'? [Ynesfdaq?] n |
9ab18a912c44
ui: show prompt choice if input is not a tty but is forced to be interactive
Mads Kiilerich <madski@unity3d.com>
parents:
20580
diff
changeset
|
76 |
12074
35c143e85b1b
tests: unify test-record
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
11238
diff
changeset
|
77 no changes to record |
35c143e85b1b
tests: unify test-record
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
11238
diff
changeset
|
78 |
35c143e85b1b
tests: unify test-record
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
11238
diff
changeset
|
79 $ hg tip -p |
35c143e85b1b
tests: unify test-record
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
11238
diff
changeset
|
80 changeset: -1:000000000000 |
35c143e85b1b
tests: unify test-record
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
11238
diff
changeset
|
81 tag: tip |
35c143e85b1b
tests: unify test-record
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
11238
diff
changeset
|
82 user: |
35c143e85b1b
tests: unify test-record
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
11238
diff
changeset
|
83 date: Thu Jan 01 00:00:00 1970 +0000 |
35c143e85b1b
tests: unify test-record
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
11238
diff
changeset
|
84 |
35c143e85b1b
tests: unify test-record
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
11238
diff
changeset
|
85 |
35c143e85b1b
tests: unify test-record
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
11238
diff
changeset
|
86 |
5037
b2607267236d
Add record extension, giving darcs-like interactive hunk picking
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
87 |