Mercurial > hg
annotate tests/test-bookmarks-rebase.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 | ef1eb6df7071 |
children | 3b7cb3d17137 |
rev | line source |
---|---|
11863
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
1 $ echo "[extensions]" >> $HGRCPATH |
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
2 $ echo "rebase=" >> $HGRCPATH |
11198
b345b1cc124f
rebase: use helpers.sh in tests
Matt Mackall <mpm@selenic.com>
parents:
8168
diff
changeset
|
3 |
11863
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
4 initialize repository |
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
5 |
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
6 $ hg init |
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
7 |
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
8 $ echo 'a' > a |
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
9 $ hg ci -A -m "0" |
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
10 adding a |
7317
98408cb74137
bookmarks: Test if rebase works with bookmarks
Alexander Solovyov <piranha@piranha.org.ua>
parents:
diff
changeset
|
11 |
11863
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
12 $ echo 'b' > b |
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
13 $ hg ci -A -m "1" |
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
14 adding b |
7317
98408cb74137
bookmarks: Test if rebase works with bookmarks
Alexander Solovyov <piranha@piranha.org.ua>
parents:
diff
changeset
|
15 |
11863
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
16 $ hg up 0 |
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
17 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
18 $ echo 'c' > c |
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
19 $ hg ci -A -m "2" |
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
20 adding c |
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
21 created new head |
7317
98408cb74137
bookmarks: Test if rebase works with bookmarks
Alexander Solovyov <piranha@piranha.org.ua>
parents:
diff
changeset
|
22 |
11863
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
23 $ echo 'd' > d |
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
24 $ hg ci -A -m "3" |
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
25 adding d |
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
26 |
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
27 $ hg bookmark -r 1 one |
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
28 $ hg bookmark -r 3 two |
19112
23f785b38af3
bookmarks: fix bug that activated a bookmark even with -r passed
Sean Farley <sean.michael.farley@gmail.com>
parents:
17005
diff
changeset
|
29 $ hg up -q two |
11863
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
30 |
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
31 bookmark list |
7317
98408cb74137
bookmarks: Test if rebase works with bookmarks
Alexander Solovyov <piranha@piranha.org.ua>
parents:
diff
changeset
|
32 |
11863
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
33 $ hg bookmark |
13388
a184dbd9b2c5
localrepo: sort hg bookmark output
David Soria Parra <dsp@php.net>
parents:
13386
diff
changeset
|
34 one 1:925d80f479bb |
11863
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
35 * two 3:2ae46b1d99a7 |
7317
98408cb74137
bookmarks: Test if rebase works with bookmarks
Alexander Solovyov <piranha@piranha.org.ua>
parents:
diff
changeset
|
36 |
11863
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
37 rebase |
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
38 |
11907
863567a1364f
tests: use regular expressions instead of helpers
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11863
diff
changeset
|
39 $ hg rebase -s two -d one |
23517
4f18e80d9c30
rebase: show more useful status information while rebasing
Mads Kiilerich <madski@unity3d.com>
parents:
23516
diff
changeset
|
40 rebasing 3:2ae46b1d99a7 "3" (tip two) |
23835
aa4a1672583e
bundles: do not overwrite existing backup bundles (BC)
Durham Goode <durham@fb.com>
parents:
23517
diff
changeset
|
41 saved backup bundle to $TESTTMP/.hg/strip-backup/2ae46b1d99a7-e6b057bc-backup.hg (glob) |
7317
98408cb74137
bookmarks: Test if rebase works with bookmarks
Alexander Solovyov <piranha@piranha.org.ua>
parents:
diff
changeset
|
42 |
11863
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
43 $ hg log |
17005
50f434510da6
rebase: do not add second parent to rebased changeset (drop detach option) (BC)
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
13469
diff
changeset
|
44 changeset: 3:42e5ed2cdcf4 |
13386
f78bc5ddbe4f
templater: add bookmarks to templates and default output
David Soria Parra <dsp@php.net>
parents:
13385
diff
changeset
|
45 bookmark: two |
11863
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
46 tag: tip |
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
47 parent: 1:925d80f479bb |
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
48 user: test |
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
49 date: Thu Jan 01 00:00:00 1970 +0000 |
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
50 summary: 3 |
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
51 |
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
52 changeset: 2:db815d6d32e6 |
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
53 parent: 0:f7b1eb17ad24 |
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
54 user: test |
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
55 date: Thu Jan 01 00:00:00 1970 +0000 |
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
56 summary: 2 |
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
57 |
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
58 changeset: 1:925d80f479bb |
13416
5431b3f3e52e
bookmarks: make track.current=True default behaviour and remove option (BC)
David Soria Parra <dsp@php.net>
parents:
13388
diff
changeset
|
59 bookmark: one |
11863
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
60 user: test |
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
61 date: Thu Jan 01 00:00:00 1970 +0000 |
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
62 summary: 1 |
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
63 |
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
64 changeset: 0:f7b1eb17ad24 |
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
65 user: test |
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
66 date: Thu Jan 01 00:00:00 1970 +0000 |
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
67 summary: 0 |
86ec95b1d37b
tests: unify test-bookmarks-rebase
Martin Geisler <mg@lazybytes.net>
parents:
11208
diff
changeset
|
68 |
24758
d7451adc72f6
rebase: restore bookmark state on abort
Tony Tung <tonytung@fb.com>
parents:
23835
diff
changeset
|
69 aborted rebase should restore active bookmark. |
d7451adc72f6
rebase: restore bookmark state on abort
Tony Tung <tonytung@fb.com>
parents:
23835
diff
changeset
|
70 |
d7451adc72f6
rebase: restore bookmark state on abort
Tony Tung <tonytung@fb.com>
parents:
23835
diff
changeset
|
71 $ hg up 1 |
d7451adc72f6
rebase: restore bookmark state on abort
Tony Tung <tonytung@fb.com>
parents:
23835
diff
changeset
|
72 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
d7451adc72f6
rebase: restore bookmark state on abort
Tony Tung <tonytung@fb.com>
parents:
23835
diff
changeset
|
73 (leaving bookmark two) |
d7451adc72f6
rebase: restore bookmark state on abort
Tony Tung <tonytung@fb.com>
parents:
23835
diff
changeset
|
74 $ echo 'e' > d |
d7451adc72f6
rebase: restore bookmark state on abort
Tony Tung <tonytung@fb.com>
parents:
23835
diff
changeset
|
75 $ hg ci -A -m "4" |
d7451adc72f6
rebase: restore bookmark state on abort
Tony Tung <tonytung@fb.com>
parents:
23835
diff
changeset
|
76 adding d |
d7451adc72f6
rebase: restore bookmark state on abort
Tony Tung <tonytung@fb.com>
parents:
23835
diff
changeset
|
77 created new head |
d7451adc72f6
rebase: restore bookmark state on abort
Tony Tung <tonytung@fb.com>
parents:
23835
diff
changeset
|
78 $ hg bookmark three |
d7451adc72f6
rebase: restore bookmark state on abort
Tony Tung <tonytung@fb.com>
parents:
23835
diff
changeset
|
79 $ hg rebase -s three -d two |
d7451adc72f6
rebase: restore bookmark state on abort
Tony Tung <tonytung@fb.com>
parents:
23835
diff
changeset
|
80 rebasing 4:dd7c838e8362 "4" (tip three) |
d7451adc72f6
rebase: restore bookmark state on abort
Tony Tung <tonytung@fb.com>
parents:
23835
diff
changeset
|
81 merging d |
26614
ef1eb6df7071
simplemerge: move conflict warning message to filemerge
Siddharth Agarwal <sid0@fb.com>
parents:
25101
diff
changeset
|
82 warning: conflicts while merging d! (edit, then use 'hg resolve --mark') |
24758
d7451adc72f6
rebase: restore bookmark state on abort
Tony Tung <tonytung@fb.com>
parents:
23835
diff
changeset
|
83 unresolved conflicts (see hg resolve, then hg rebase --continue) |
d7451adc72f6
rebase: restore bookmark state on abort
Tony Tung <tonytung@fb.com>
parents:
23835
diff
changeset
|
84 [1] |
d7451adc72f6
rebase: restore bookmark state on abort
Tony Tung <tonytung@fb.com>
parents:
23835
diff
changeset
|
85 $ hg rebase --abort |
d7451adc72f6
rebase: restore bookmark state on abort
Tony Tung <tonytung@fb.com>
parents:
23835
diff
changeset
|
86 rebase aborted |
d7451adc72f6
rebase: restore bookmark state on abort
Tony Tung <tonytung@fb.com>
parents:
23835
diff
changeset
|
87 $ hg bookmark |
d7451adc72f6
rebase: restore bookmark state on abort
Tony Tung <tonytung@fb.com>
parents:
23835
diff
changeset
|
88 one 1:925d80f479bb |
d7451adc72f6
rebase: restore bookmark state on abort
Tony Tung <tonytung@fb.com>
parents:
23835
diff
changeset
|
89 * three 4:dd7c838e8362 |
d7451adc72f6
rebase: restore bookmark state on abort
Tony Tung <tonytung@fb.com>
parents:
23835
diff
changeset
|
90 two 3:42e5ed2cdcf4 |
d7451adc72f6
rebase: restore bookmark state on abort
Tony Tung <tonytung@fb.com>
parents:
23835
diff
changeset
|
91 |
25101
91c2278c68a3
rebase: check that the bookmark is still valid when restoring (issue4669)
Tony Tung <tonytung@fb.com>
parents:
24758
diff
changeset
|
92 after aborted rebase, restoring a bookmark that has been removed should not fail |
91c2278c68a3
rebase: check that the bookmark is still valid when restoring (issue4669)
Tony Tung <tonytung@fb.com>
parents:
24758
diff
changeset
|
93 |
91c2278c68a3
rebase: check that the bookmark is still valid when restoring (issue4669)
Tony Tung <tonytung@fb.com>
parents:
24758
diff
changeset
|
94 $ hg rebase -s three -d two |
91c2278c68a3
rebase: check that the bookmark is still valid when restoring (issue4669)
Tony Tung <tonytung@fb.com>
parents:
24758
diff
changeset
|
95 rebasing 4:dd7c838e8362 "4" (tip three) |
91c2278c68a3
rebase: check that the bookmark is still valid when restoring (issue4669)
Tony Tung <tonytung@fb.com>
parents:
24758
diff
changeset
|
96 merging d |
26614
ef1eb6df7071
simplemerge: move conflict warning message to filemerge
Siddharth Agarwal <sid0@fb.com>
parents:
25101
diff
changeset
|
97 warning: conflicts while merging d! (edit, then use 'hg resolve --mark') |
25101
91c2278c68a3
rebase: check that the bookmark is still valid when restoring (issue4669)
Tony Tung <tonytung@fb.com>
parents:
24758
diff
changeset
|
98 unresolved conflicts (see hg resolve, then hg rebase --continue) |
91c2278c68a3
rebase: check that the bookmark is still valid when restoring (issue4669)
Tony Tung <tonytung@fb.com>
parents:
24758
diff
changeset
|
99 [1] |
91c2278c68a3
rebase: check that the bookmark is still valid when restoring (issue4669)
Tony Tung <tonytung@fb.com>
parents:
24758
diff
changeset
|
100 $ hg bookmark -d three |
91c2278c68a3
rebase: check that the bookmark is still valid when restoring (issue4669)
Tony Tung <tonytung@fb.com>
parents:
24758
diff
changeset
|
101 $ hg rebase --abort |
91c2278c68a3
rebase: check that the bookmark is still valid when restoring (issue4669)
Tony Tung <tonytung@fb.com>
parents:
24758
diff
changeset
|
102 rebase aborted |
91c2278c68a3
rebase: check that the bookmark is still valid when restoring (issue4669)
Tony Tung <tonytung@fb.com>
parents:
24758
diff
changeset
|
103 $ hg bookmark |
91c2278c68a3
rebase: check that the bookmark is still valid when restoring (issue4669)
Tony Tung <tonytung@fb.com>
parents:
24758
diff
changeset
|
104 one 1:925d80f479bb |
91c2278c68a3
rebase: check that the bookmark is still valid when restoring (issue4669)
Tony Tung <tonytung@fb.com>
parents:
24758
diff
changeset
|
105 two 3:42e5ed2cdcf4 |