Show More
@@ -1,238 +1,238 b'' | |||
|
1 | 1 | $ . "$TESTDIR/histedit-helpers.sh" |
|
2 | 2 | |
|
3 | 3 | $ cat >> $HGRCPATH <<EOF |
|
4 | 4 | > [extensions] |
|
5 | 5 | > graphlog= |
|
6 | 6 | > histedit= |
|
7 | 7 | > EOF |
|
8 | 8 | |
|
9 | 9 | $ EDITED="$TESTTMP/editedhistory" |
|
10 | 10 | $ cat > $EDITED <<EOF |
|
11 | 11 | > pick e860deea161a e |
|
12 | 12 | > pick 652413bf663e f |
|
13 | 13 | > fold 177f92b77385 c |
|
14 | 14 | > pick 055a42cdd887 d |
|
15 | 15 | > EOF |
|
16 | 16 | $ initrepo () |
|
17 | 17 | > { |
|
18 | 18 | > hg init r |
|
19 | 19 | > cd r |
|
20 | 20 | > for x in a b c d e f ; do |
|
21 | 21 | > echo $x > $x |
|
22 | 22 | > hg add $x |
|
23 | 23 | > hg ci -m $x |
|
24 | 24 | > done |
|
25 | 25 | > } |
|
26 | 26 | |
|
27 | 27 | $ initrepo |
|
28 | 28 | |
|
29 | 29 | log before edit |
|
30 | 30 | $ hg log --graph |
|
31 | 31 | @ changeset: 5:652413bf663e |
|
32 | 32 | | tag: tip |
|
33 | 33 | | user: test |
|
34 | 34 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
35 | 35 | | summary: f |
|
36 | 36 | | |
|
37 | 37 | o changeset: 4:e860deea161a |
|
38 | 38 | | user: test |
|
39 | 39 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
40 | 40 | | summary: e |
|
41 | 41 | | |
|
42 | 42 | o changeset: 3:055a42cdd887 |
|
43 | 43 | | user: test |
|
44 | 44 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
45 | 45 | | summary: d |
|
46 | 46 | | |
|
47 | 47 | o changeset: 2:177f92b77385 |
|
48 | 48 | | user: test |
|
49 | 49 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
50 | 50 | | summary: c |
|
51 | 51 | | |
|
52 | 52 | o changeset: 1:d2ae7f538514 |
|
53 | 53 | | user: test |
|
54 | 54 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
55 | 55 | | summary: b |
|
56 | 56 | | |
|
57 | 57 | o changeset: 0:cb9a9f314b8b |
|
58 | 58 | user: test |
|
59 | 59 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
60 | 60 | summary: a |
|
61 | 61 | |
|
62 | 62 | |
|
63 | 63 | edit the history |
|
64 | 64 | $ HGEDITOR="cat \"$EDITED\" > " hg histedit 177f92b77385 2>&1 | fixbundle |
|
65 | 65 | 0 files updated, 0 files merged, 4 files removed, 0 files unresolved |
|
66 | 66 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
67 | 67 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
68 | 68 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
69 | 69 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
70 | 70 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
71 | 71 | |
|
72 | 72 | log after edit |
|
73 | 73 | $ hg log --graph |
|
74 | 74 | @ changeset: 4:82b0c1ff1777 |
|
75 | 75 | | tag: tip |
|
76 | 76 | | user: test |
|
77 | 77 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
78 | 78 | | summary: d |
|
79 | 79 | | |
|
80 | 80 | o changeset: 3:150aafb44a91 |
|
81 | 81 | | user: test |
|
82 | 82 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
83 | 83 | | summary: pick e860deea161a e |
|
84 | 84 | | |
|
85 | 85 | o changeset: 2:493dc0964412 |
|
86 | 86 | | user: test |
|
87 | 87 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
88 | 88 | | summary: e |
|
89 | 89 | | |
|
90 | 90 | o changeset: 1:d2ae7f538514 |
|
91 | 91 | | user: test |
|
92 | 92 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
93 | 93 | | summary: b |
|
94 | 94 | | |
|
95 | 95 | o changeset: 0:cb9a9f314b8b |
|
96 | 96 | user: test |
|
97 | 97 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
98 | 98 | summary: a |
|
99 | 99 | |
|
100 | 100 | |
|
101 | 101 | post-fold manifest |
|
102 | 102 | $ hg manifest |
|
103 | 103 | a |
|
104 | 104 | b |
|
105 | 105 | c |
|
106 | 106 | d |
|
107 | 107 | e |
|
108 | 108 | f |
|
109 | 109 | |
|
110 | 110 | $ cd .. |
|
111 | 111 | |
|
112 | 112 | folding and creating no new change doesn't break: |
|
113 | 113 | $ mkdir fold-to-empty-test |
|
114 | 114 | $ cd fold-to-empty-test |
|
115 | 115 | $ hg init |
|
116 | 116 | $ printf "1\n2\n3\n" > file |
|
117 | 117 | $ hg add file |
|
118 | 118 | $ hg commit -m '1+2+3' |
|
119 | 119 | $ echo 4 >> file |
|
120 | 120 | $ hg commit -m '+4' |
|
121 | 121 | $ echo 5 >> file |
|
122 | 122 | $ hg commit -m '+5' |
|
123 | 123 | $ echo 6 >> file |
|
124 | 124 | $ hg commit -m '+6' |
|
125 | 125 | $ hg log --graph |
|
126 | 126 | @ changeset: 3:251d831eeec5 |
|
127 | 127 | | tag: tip |
|
128 | 128 | | user: test |
|
129 | 129 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
130 | 130 | | summary: +6 |
|
131 | 131 | | |
|
132 | 132 | o changeset: 2:888f9082bf99 |
|
133 | 133 | | user: test |
|
134 | 134 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
135 | 135 | | summary: +5 |
|
136 | 136 | | |
|
137 | 137 | o changeset: 1:617f94f13c0f |
|
138 | 138 | | user: test |
|
139 | 139 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
140 | 140 | | summary: +4 |
|
141 | 141 | | |
|
142 | 142 | o changeset: 0:0189ba417d34 |
|
143 | 143 | user: test |
|
144 | 144 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
145 | 145 | summary: 1+2+3 |
|
146 | 146 | |
|
147 | 147 | |
|
148 | 148 | $ cat > editor.py <<EOF |
|
149 | 149 | > import re, sys |
|
150 | 150 | > rules = sys.argv[1] |
|
151 | 151 | > data = open(rules).read() |
|
152 | 152 | > data = re.sub(r'pick ([0-9a-f]{12} 2 \+5)', r'drop \1', data) |
|
153 | 153 | > data = re.sub(r'pick ([0-9a-f]{12} 2 \+6)', r'fold \1', data) |
|
154 | 154 | > open(rules, 'w').write(data) |
|
155 | 155 | > EOF |
|
156 | 156 | |
|
157 | 157 | $ HGEDITOR='python editor.py' hg histedit 1 |
|
158 | 158 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
159 | 159 | patching file file |
|
160 | 160 | Hunk #1 FAILED at 2 |
|
161 | 161 | 1 out of 1 hunks FAILED -- saving rejects to file file.rej |
|
162 | 162 | abort: Fix up the change and run hg histedit --continue |
|
163 | 163 | [255] |
|
164 | 164 | There were conflicts, but we'll continue without resolving. This |
|
165 | 165 | should effectively drop the changes from +6. |
|
166 | 166 | $ hg status |
|
167 | 167 | ? editor.py |
|
168 | 168 | ? file.rej |
|
169 | 169 | $ hg histedit --continue |
|
170 | 170 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
171 | 171 | saved backup bundle to $TESTTMP/*-backup.hg (glob) |
|
172 | 172 | $ hg log --graph |
|
173 | 173 | @ changeset: 1:617f94f13c0f |
|
174 | 174 | | tag: tip |
|
175 | 175 | | user: test |
|
176 | 176 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
177 | 177 | | summary: +4 |
|
178 | 178 | | |
|
179 | 179 | o changeset: 0:0189ba417d34 |
|
180 | 180 | user: test |
|
181 | 181 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
182 | 182 | summary: 1+2+3 |
|
183 | 183 | |
|
184 | 184 | |
|
185 | 185 | $ cd .. |
|
186 | 186 | |
|
187 | 187 | Test corner case where folded revision is separated from its parent by a |
|
188 | 188 | dropped revision. |
|
189 | 189 | |
|
190 | 190 | |
|
191 | 191 | $ hg init fold-with-dropped |
|
192 | 192 | $ cd fold-with-dropped |
|
193 | 193 | $ printf "1\n2\n3\n" > file |
|
194 | 194 | $ hg commit -Am '1+2+3' |
|
195 | 195 | adding file |
|
196 | 196 | $ echo 4 >> file |
|
197 | 197 | $ hg commit -m '+4' |
|
198 | 198 | $ echo 5 >> file |
|
199 | 199 | $ hg commit -m '+5' |
|
200 | 200 | $ echo 6 >> file |
|
201 | 201 | $ hg commit -m '+6' |
|
202 | 202 | $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' |
|
203 | 203 | @ 3:251d831eeec5 +6 |
|
204 | 204 | | |
|
205 | 205 | o 2:888f9082bf99 +5 |
|
206 | 206 | | |
|
207 | 207 | o 1:617f94f13c0f +4 |
|
208 | 208 | | |
|
209 | 209 | o 0:0189ba417d34 1+2+3 |
|
210 | 210 | |
|
211 |
$ EDITED= |
|
|
211 | $ EDITED="$TESTTMP/editcommands" | |
|
212 | 212 | $ cat > $EDITED <<EOF |
|
213 | 213 | > pick 617f94f13c0f 1 +4 |
|
214 | 214 | > drop 888f9082bf99 2 +5 |
|
215 | 215 | > fold 251d831eeec5 3 +6 |
|
216 | 216 | > EOF |
|
217 | 217 | $ HGEDITOR="cat $EDITED >" hg histedit 1 |
|
218 | 218 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
219 | 219 | patching file file |
|
220 | 220 | Hunk #1 FAILED at 2 |
|
221 | 221 | 1 out of 1 hunks FAILED -- saving rejects to file file.rej |
|
222 | 222 | abort: Fix up the change and run hg histedit --continue |
|
223 | 223 | [255] |
|
224 | 224 | $ echo 5 >> file |
|
225 | 225 | $ hg commit -m '+5.2' |
|
226 | 226 | created new head |
|
227 | 227 | $ echo 6 >> file |
|
228 | 228 | $ HGEDITOR=cat hg histedit --continue |
|
229 | 229 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
230 | 230 | +4 |
|
231 | 231 | *** |
|
232 | 232 | +5.2 |
|
233 | 233 | *** |
|
234 | 234 | +6 |
|
235 | 235 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
236 | 236 | saved backup bundle to $TESTTMP/fold-with-dropped/.hg/strip-backup/617f94f13c0f-backup.hg (glob) |
|
237 | 237 | $ cd .. |
|
238 | 238 |
General Comments 0
You need to be logged in to leave comments.
Login now