annotate tests/test-issue522.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 2fc86d92c4a9
children 009d0283de5f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26420
2fc86d92c4a9 urls: bulk-change BTS urls to new location
Matt Mackall <mpm@selenic.com>
parents: 25125
diff changeset
1 https://bz.mercurial-scm.org/522
5210
90d9ec0dc69d merge: forcefully mark files that we get from the second parent as dirty
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
2
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12195
diff changeset
3 In the merge below, the file "foo" has the same contents in both
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12195
diff changeset
4 parents, but if we look at the file-level history, we'll notice that
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12195
diff changeset
5 the version in p1 is an ancestor of the version in p2. This test makes
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12195
diff changeset
6 sure that we'll use the version from p2 in the manifest of the merge
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12195
diff changeset
7 revision.
5210
90d9ec0dc69d merge: forcefully mark files that we get from the second parent as dirty
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
8
12195
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
9 $ hg init
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
10
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
11 $ echo foo > foo
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
12 $ hg ci -qAm 'add foo'
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
13
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
14 $ echo bar >> foo
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
15 $ hg ci -m 'change foo'
5210
90d9ec0dc69d merge: forcefully mark files that we get from the second parent as dirty
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
16
12195
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
17 $ hg backout -r tip -m 'backout changed foo'
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
18 reverting foo
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
19 changeset 2:4d9e78aaceee backs out changeset 1:b515023e500e
5210
90d9ec0dc69d merge: forcefully mark files that we get from the second parent as dirty
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
20
12195
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
21 $ hg up -C 0
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
22 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
5210
90d9ec0dc69d merge: forcefully mark files that we get from the second parent as dirty
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
23
12195
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
24 $ touch bar
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
25 $ hg ci -qAm 'add bar'
5210
90d9ec0dc69d merge: forcefully mark files that we get from the second parent as dirty
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
26
12195
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
27 $ hg merge --debug
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
28 searching for copies back to rev 1
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
29 unmatched files in local:
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
30 bar
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
31 resolving manifests
18605
bcf29565d89f manifestmerge: pass in branchmerge and force separately
Siddharth Agarwal <sid0@fb.com>
parents: 17132
diff changeset
32 branchmerge: True, force: False, partial: False
15625
efdcce3fd2d5 merge: make debug output easier to read
Martin Geisler <mg@aragost.com>
parents: 14182
diff changeset
33 ancestor: bbd179dfa0a7, local: 71766447bdbb+, remote: 4d9e78aaceee
12195
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
34 foo: remote is newer -> g
18631
e2dc5397bc82 tests: update test output (will be folded into parent)
Bryan O'Sullivan <bryano@fb.com>
parents: 18605
diff changeset
35 getting foo
12195
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
36 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
37 (branch merge, don't forget to commit)
5210
90d9ec0dc69d merge: forcefully mark files that we get from the second parent as dirty
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
38
12195
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
39 $ hg debugstate | grep foo
22896
7e9cbb9c6053 dirstate: use 'm' state in otherparent to reduce ambiguity
Matt Mackall <mpm@selenic.com>
parents: 18631
diff changeset
40 m 0 -2 unset foo
12195
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
41
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
42 $ hg st -A foo
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
43 M foo
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
44
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
45 $ hg ci -m 'merge'
5210
90d9ec0dc69d merge: forcefully mark files that we get from the second parent as dirty
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
46
12195
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
47 $ hg manifest --debug | grep foo
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
48 c6fc755d7e68f49f880599da29f15add41f42f5a 644 foo
5210
90d9ec0dc69d merge: forcefully mark files that we get from the second parent as dirty
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
49
14182
ec5886db9dc6 tests: fix deprecated use of hg debugdata/debugindex
Sune Foldager <cryo@cyanite.org>
parents: 12328
diff changeset
50 $ hg debugindex foo
17132
b87acfda5268 tests: reduce spurious failures when run with generaldelta
Bryan O'Sullivan <bryano@fb.com>
parents: 15625
diff changeset
51 rev offset length ..... linkrev nodeid p1 p2 (re)
b87acfda5268 tests: reduce spurious failures when run with generaldelta
Bryan O'Sullivan <bryano@fb.com>
parents: 15625
diff changeset
52 0 0 5 ..... 0 2ed2a3912a0b 000000000000 000000000000 (re)
b87acfda5268 tests: reduce spurious failures when run with generaldelta
Bryan O'Sullivan <bryano@fb.com>
parents: 15625
diff changeset
53 1 5 9 ..... 1 6f4310b00b9a 2ed2a3912a0b 000000000000 (re)
b87acfda5268 tests: reduce spurious failures when run with generaldelta
Bryan O'Sullivan <bryano@fb.com>
parents: 15625
diff changeset
54 2 14 5 ..... 2 c6fc755d7e68 6f4310b00b9a 000000000000 (re)
12195
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 8167
diff changeset
55