Mercurial > hg
annotate tests/test-update-reverse.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 | bd625cd4e5e7 |
children | 5c2a4f37eace |
rev | line source |
---|---|
12279 | 1 $ hg init |
2 | |
3 $ touch a | |
4 $ hg add a | |
5 $ hg commit -m "Added a" | |
1236
67a28636ea64
Fix bug with co -C across branches, update tests
mpm@selenic.com
parents:
diff
changeset
|
6 |
12279 | 7 $ touch main |
8 $ hg add main | |
9 $ hg commit -m "Added main" | |
10 $ hg checkout 0 | |
11 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
1236
67a28636ea64
Fix bug with co -C across branches, update tests
mpm@selenic.com
parents:
diff
changeset
|
12 |
12279 | 13 'main' should be gone: |
14 | |
15 $ ls | |
16 a | |
1236
67a28636ea64
Fix bug with co -C across branches, update tests
mpm@selenic.com
parents:
diff
changeset
|
17 |
12279 | 18 $ touch side1 |
19 $ hg add side1 | |
20 $ hg commit -m "Added side1" | |
21 created new head | |
22 $ touch side2 | |
23 $ hg add side2 | |
24 $ hg commit -m "Added side2" | |
1236
67a28636ea64
Fix bug with co -C across branches, update tests
mpm@selenic.com
parents:
diff
changeset
|
25 |
12279 | 26 $ hg log |
27 changeset: 3:91ebc10ed028 | |
28 tag: tip | |
29 user: test | |
30 date: Thu Jan 01 00:00:00 1970 +0000 | |
31 summary: Added side2 | |
32 | |
33 changeset: 2:b932d7dbb1e1 | |
34 parent: 0:c2eda428b523 | |
35 user: test | |
36 date: Thu Jan 01 00:00:00 1970 +0000 | |
37 summary: Added side1 | |
38 | |
39 changeset: 1:71a760306caf | |
40 user: test | |
41 date: Thu Jan 01 00:00:00 1970 +0000 | |
42 summary: Added main | |
43 | |
44 changeset: 0:c2eda428b523 | |
45 user: test | |
46 date: Thu Jan 01 00:00:00 1970 +0000 | |
47 summary: Added a | |
48 | |
1236
67a28636ea64
Fix bug with co -C across branches, update tests
mpm@selenic.com
parents:
diff
changeset
|
49 |
12279 | 50 $ hg heads |
51 changeset: 3:91ebc10ed028 | |
52 tag: tip | |
53 user: test | |
54 date: Thu Jan 01 00:00:00 1970 +0000 | |
55 summary: Added side2 | |
56 | |
57 changeset: 1:71a760306caf | |
58 user: test | |
59 date: Thu Jan 01 00:00:00 1970 +0000 | |
60 summary: Added main | |
61 | |
62 $ ls | |
63 a | |
64 side1 | |
65 side2 | |
1236
67a28636ea64
Fix bug with co -C across branches, update tests
mpm@selenic.com
parents:
diff
changeset
|
66 |
12279 | 67 $ hg update --debug -C 1 |
68 resolving manifests | |
18605
bcf29565d89f
manifestmerge: pass in branchmerge and force separately
Siddharth Agarwal <sid0@fb.com>
parents:
18360
diff
changeset
|
69 branchmerge: False, force: True, partial: False |
15625
efdcce3fd2d5
merge: make debug output easier to read
Martin Geisler <mg@aragost.com>
parents:
12279
diff
changeset
|
70 ancestor: 91ebc10ed028+, local: 91ebc10ed028+, remote: 71a760306caf |
18360
760c0d67ce5e
merge: process files in sorted order
Mads Kiilerich <mads@kiilerich.com>
parents:
15625
diff
changeset
|
71 side1: other deleted -> r |
21391
cb15835456cb
merge: change debug logging - test output changes but no real changes
Mads Kiilerich <madski@unity3d.com>
parents:
19095
diff
changeset
|
72 removing side1 |
12279 | 73 side2: other deleted -> r |
18631
e2dc5397bc82
tests: update test output (will be folded into parent)
Bryan O'Sullivan <bryano@fb.com>
parents:
18605
diff
changeset
|
74 removing side2 |
21391
cb15835456cb
merge: change debug logging - test output changes but no real changes
Mads Kiilerich <madski@unity3d.com>
parents:
19095
diff
changeset
|
75 main: remote created -> g |
18631
e2dc5397bc82
tests: update test output (will be folded into parent)
Bryan O'Sullivan <bryano@fb.com>
parents:
18605
diff
changeset
|
76 getting main |
12279 | 77 1 files updated, 0 files merged, 2 files removed, 0 files unresolved |
1236
67a28636ea64
Fix bug with co -C across branches, update tests
mpm@selenic.com
parents:
diff
changeset
|
78 |
12279 | 79 $ ls |
80 a | |
81 main | |
1236
67a28636ea64
Fix bug with co -C across branches, update tests
mpm@selenic.com
parents:
diff
changeset
|
82 |