annotate tests/test-histedit-fold.t @ 17644:9ae073f10572

histedit: fold in memory Update the folding code to works in memory instead of applying patches on the working directory. This is cleaner, faster and prepare the removal of the whole patching logic. This new collapse function will probably move into core sooner or later. A lot of other rewriting operation may benefit from it.
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Fri, 21 Sep 2012 19:24:31 +0200
parents d9626b91623a
children d34ba4991188
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17085
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
1 $ . "$TESTDIR/histedit-helpers.sh"
17064
168cc52ad7c2 histedit: new extension for interactive history editing
Augie Fackler <raf@durin42.com>
parents:
diff changeset
2
17085
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
3 $ cat >> $HGRCPATH <<EOF
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
4 > [extensions]
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
5 > graphlog=
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
6 > histedit=
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
7 > EOF
17064
168cc52ad7c2 histedit: new extension for interactive history editing
Augie Fackler <raf@durin42.com>
parents:
diff changeset
8
17087
a79776f427b4 tests: make histedit pass on Windows MSYS
Mads Kiilerich <mads@kiilerich.com>
parents: 17086
diff changeset
9 $ EDITED="$TESTTMP/editedhistory"
17085
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
10 $ cat > $EDITED <<EOF
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
11 > pick e860deea161a e
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
12 > pick 652413bf663e f
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
13 > fold 177f92b77385 c
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
14 > pick 055a42cdd887 d
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
15 > EOF
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
16 $ initrepo ()
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
17 > {
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
18 > hg init r
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
19 > cd r
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
20 > for x in a b c d e f ; do
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
21 > echo $x > $x
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
22 > hg add $x
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
23 > hg ci -m $x
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
24 > done
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
25 > }
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
26
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
27 $ initrepo
17064
168cc52ad7c2 histedit: new extension for interactive history editing
Augie Fackler <raf@durin42.com>
parents:
diff changeset
28
17085
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
29 log before edit
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
30 $ hg log --graph
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
31 @ changeset: 5:652413bf663e
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
32 | tag: tip
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
33 | user: test
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
34 | date: Thu Jan 01 00:00:00 1970 +0000
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
35 | summary: f
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
36 |
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
37 o changeset: 4:e860deea161a
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
38 | user: test
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
39 | date: Thu Jan 01 00:00:00 1970 +0000
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
40 | summary: e
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
41 |
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
42 o changeset: 3:055a42cdd887
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
43 | user: test
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
44 | date: Thu Jan 01 00:00:00 1970 +0000
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
45 | summary: d
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
46 |
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
47 o changeset: 2:177f92b77385
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
48 | user: test
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
49 | date: Thu Jan 01 00:00:00 1970 +0000
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
50 | summary: c
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
51 |
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
52 o changeset: 1:d2ae7f538514
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
53 | user: test
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
54 | date: Thu Jan 01 00:00:00 1970 +0000
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
55 | summary: b
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
56 |
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
57 o changeset: 0:cb9a9f314b8b
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
58 user: test
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
59 date: Thu Jan 01 00:00:00 1970 +0000
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
60 summary: a
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
61
17064
168cc52ad7c2 histedit: new extension for interactive history editing
Augie Fackler <raf@durin42.com>
parents:
diff changeset
62
17085
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
63 edit the history
17086
5f2cacb715dc tests: make histedit tests more resilient to filesystem variation
Mads Kiilerich <mads@kiilerich.com>
parents: 17085
diff changeset
64 $ HGEDITOR="cat \"$EDITED\" > " hg histedit 177f92b77385 2>&1 | fixbundle
17085
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
65 0 files updated, 0 files merged, 4 files removed, 0 files unresolved
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
66 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
67 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
68 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
17644
9ae073f10572 histedit: fold in memory
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 17257
diff changeset
69 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
17085
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
70 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
71 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
17064
168cc52ad7c2 histedit: new extension for interactive history editing
Augie Fackler <raf@durin42.com>
parents:
diff changeset
72
17085
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
73 log after edit
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
74 $ hg log --graph
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
75 @ changeset: 4:82b0c1ff1777
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
76 | tag: tip
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
77 | user: test
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
78 | date: Thu Jan 01 00:00:00 1970 +0000
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
79 | summary: d
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
80 |
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
81 o changeset: 3:150aafb44a91
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
82 | user: test
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
83 | date: Thu Jan 01 00:00:00 1970 +0000
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
84 | summary: pick e860deea161a e
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
85 |
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
86 o changeset: 2:493dc0964412
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
87 | user: test
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
88 | date: Thu Jan 01 00:00:00 1970 +0000
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
89 | summary: e
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
90 |
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
91 o changeset: 1:d2ae7f538514
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
92 | user: test
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
93 | date: Thu Jan 01 00:00:00 1970 +0000
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
94 | summary: b
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
95 |
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
96 o changeset: 0:cb9a9f314b8b
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
97 user: test
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
98 date: Thu Jan 01 00:00:00 1970 +0000
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
99 summary: a
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
100
17064
168cc52ad7c2 histedit: new extension for interactive history editing
Augie Fackler <raf@durin42.com>
parents:
diff changeset
101
17085
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
102 post-fold manifest
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
103 $ hg manifest
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
104 a
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
105 b
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
106 c
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
107 d
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
108 e
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
109 f
17064
168cc52ad7c2 histedit: new extension for interactive history editing
Augie Fackler <raf@durin42.com>
parents:
diff changeset
110
17085
35729bdd59b6 tests: convert histedit tests to .t
Mads Kiilerich <mads@kiilerich.com>
parents: 17064
diff changeset
111 $ cd ..
17130
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
112
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
113 folding and creating no new change doesn't break:
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
114 $ mkdir fold-to-empty-test
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
115 $ cd fold-to-empty-test
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
116 $ hg init
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
117 $ printf "1\n2\n3\n" > file
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
118 $ hg add file
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
119 $ hg commit -m '1+2+3'
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
120 $ echo 4 >> file
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
121 $ hg commit -m '+4'
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
122 $ echo 5 >> file
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
123 $ hg commit -m '+5'
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
124 $ echo 6 >> file
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
125 $ hg commit -m '+6'
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
126 $ hg log --graph
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
127 @ changeset: 3:251d831eeec5
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
128 | tag: tip
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
129 | user: test
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
130 | date: Thu Jan 01 00:00:00 1970 +0000
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
131 | summary: +6
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
132 |
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
133 o changeset: 2:888f9082bf99
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
134 | user: test
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
135 | date: Thu Jan 01 00:00:00 1970 +0000
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
136 | summary: +5
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
137 |
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
138 o changeset: 1:617f94f13c0f
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
139 | user: test
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
140 | date: Thu Jan 01 00:00:00 1970 +0000
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
141 | summary: +4
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
142 |
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
143 o changeset: 0:0189ba417d34
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
144 user: test
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
145 date: Thu Jan 01 00:00:00 1970 +0000
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
146 summary: 1+2+3
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
147
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
148
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
149 $ cat > editor.py <<EOF
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
150 > import re, sys
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
151 > rules = sys.argv[1]
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
152 > data = open(rules).read()
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
153 > data = re.sub(r'pick ([0-9a-f]{12} 2 \+5)', r'drop \1', data)
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
154 > data = re.sub(r'pick ([0-9a-f]{12} 2 \+6)', r'fold \1', data)
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
155 > open(rules, 'w').write(data)
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
156 > EOF
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
157
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
158 $ HGEDITOR='python editor.py' hg histedit 1
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
159 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
160 patching file file
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
161 Hunk #1 FAILED at 2
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
162 1 out of 1 hunks FAILED -- saving rejects to file file.rej
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
163 abort: Fix up the change and run hg histedit --continue
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
164 [255]
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
165 There were conflicts, but we'll continue without resolving. This
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
166 should effectively drop the changes from +6.
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
167 $ hg status
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
168 ? editor.py
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
169 ? file.rej
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
170 $ hg histedit --continue
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
171 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
172 saved backup bundle to $TESTTMP/*-backup.hg (glob)
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
173 $ hg log --graph
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
174 @ changeset: 1:617f94f13c0f
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
175 | tag: tip
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
176 | user: test
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
177 | date: Thu Jan 01 00:00:00 1970 +0000
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
178 | summary: +4
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
179 |
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
180 o changeset: 0:0189ba417d34
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
181 user: test
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
182 date: Thu Jan 01 00:00:00 1970 +0000
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
183 summary: 1+2+3
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
184
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
185
0a48f3d54543 histedit: don't crash if the result of fixing up a fold is empty
Augie Fackler <raf@durin42.com>
parents: 17087
diff changeset
186 $ cd ..
17242
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
187
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
188 Test corner case where folded revision is separated from its parent by a
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
189 dropped revision.
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
190
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
191
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
192 $ hg init fold-with-dropped
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
193 $ cd fold-with-dropped
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
194 $ printf "1\n2\n3\n" > file
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
195 $ hg commit -Am '1+2+3'
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
196 adding file
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
197 $ echo 4 >> file
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
198 $ hg commit -m '+4'
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
199 $ echo 5 >> file
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
200 $ hg commit -m '+5'
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
201 $ echo 6 >> file
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
202 $ hg commit -m '+6'
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
203 $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n'
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
204 @ 3:251d831eeec5 +6
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
205 |
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
206 o 2:888f9082bf99 +5
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
207 |
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
208 o 1:617f94f13c0f +4
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
209 |
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
210 o 0:0189ba417d34 1+2+3
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
211
17257
d9626b91623a test-histedit-fold: fix for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 17242
diff changeset
212 $ EDITED="$TESTTMP/editcommands"
17242
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
213 $ cat > $EDITED <<EOF
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
214 > pick 617f94f13c0f 1 +4
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
215 > drop 888f9082bf99 2 +5
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
216 > fold 251d831eeec5 3 +6
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
217 > EOF
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
218 $ HGEDITOR="cat $EDITED >" hg histedit 1
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
219 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
220 patching file file
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
221 Hunk #1 FAILED at 2
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
222 1 out of 1 hunks FAILED -- saving rejects to file file.rej
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
223 abort: Fix up the change and run hg histedit --continue
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
224 [255]
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
225 $ echo 5 >> file
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
226 $ hg commit -m '+5.2'
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
227 created new head
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
228 $ echo 6 >> file
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
229 $ HGEDITOR=cat hg histedit --continue
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
230 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
231 +4
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
232 ***
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
233 +5.2
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
234 ***
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
235 +6
17644
9ae073f10572 histedit: fold in memory
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 17257
diff changeset
236
9ae073f10572 histedit: fold in memory
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 17257
diff changeset
237
9ae073f10572 histedit: fold in memory
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 17257
diff changeset
238
9ae073f10572 histedit: fold in memory
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 17257
diff changeset
239 HG: Enter commit message. Lines beginning with 'HG:' are removed.
9ae073f10572 histedit: fold in memory
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 17257
diff changeset
240 HG: Leave message empty to abort commit.
9ae073f10572 histedit: fold in memory
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 17257
diff changeset
241 HG: --
9ae073f10572 histedit: fold in memory
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 17257
diff changeset
242 HG: user: test
9ae073f10572 histedit: fold in memory
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 17257
diff changeset
243 HG: branch 'default'
9ae073f10572 histedit: fold in memory
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 17257
diff changeset
244 HG: changed file
9ae073f10572 histedit: fold in memory
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 17257
diff changeset
245 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
17242
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
246 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
247 saved backup bundle to $TESTTMP/fold-with-dropped/.hg/strip-backup/617f94f13c0f-backup.hg (glob)
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
248 $ cd ..
336121088ef1 histedit: fix new nodes computation with --continue (issue3534)
Patrick Mezard <patrick@mezard.eu>
parents: 17130
diff changeset
249