comparison tests/test-histedit-fold.t @ 17137:0a48f3d54543

histedit: don't crash if the result of fixing up a fold is empty
author Augie Fackler <raf@durin42.com>
date Fri, 06 Jul 2012 11:39:02 -0500
parents a79776f427b4
children 336121088ef1
comparison
equal deleted inserted replaced
17136:ead4eb5b03c9 17137:0a48f3d54543
106 d 106 d
107 e 107 e
108 f 108 f
109 109
110 $ cd .. 110 $ cd ..
111
112 folding and creating no new change doesn't break:
113 $ mkdir fold-to-empty-test
114 $ cd fold-to-empty-test
115 $ hg init
116 $ printf "1\n2\n3\n" > file
117 $ hg add file
118 $ hg commit -m '1+2+3'
119 $ echo 4 >> file
120 $ hg commit -m '+4'
121 $ echo 5 >> file
122 $ hg commit -m '+5'
123 $ echo 6 >> file
124 $ hg commit -m '+6'
125 $ hg log --graph
126 @ changeset: 3:251d831eeec5
127 | tag: tip
128 | user: test
129 | date: Thu Jan 01 00:00:00 1970 +0000
130 | summary: +6
131 |
132 o changeset: 2:888f9082bf99
133 | user: test
134 | date: Thu Jan 01 00:00:00 1970 +0000
135 | summary: +5
136 |
137 o changeset: 1:617f94f13c0f
138 | user: test
139 | date: Thu Jan 01 00:00:00 1970 +0000
140 | summary: +4
141 |
142 o changeset: 0:0189ba417d34
143 user: test
144 date: Thu Jan 01 00:00:00 1970 +0000
145 summary: 1+2+3
146
147
148 $ cat > editor.py <<EOF
149 > import re, sys
150 > rules = sys.argv[1]
151 > data = open(rules).read()
152 > data = re.sub(r'pick ([0-9a-f]{12} 2 \+5)', r'drop \1', data)
153 > data = re.sub(r'pick ([0-9a-f]{12} 2 \+6)', r'fold \1', data)
154 > open(rules, 'w').write(data)
155 > EOF
156
157 $ HGEDITOR='python editor.py' hg histedit 1
158 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
159 patching file file
160 Hunk #1 FAILED at 2
161 1 out of 1 hunks FAILED -- saving rejects to file file.rej
162 abort: Fix up the change and run hg histedit --continue
163 [255]
164 There were conflicts, but we'll continue without resolving. This
165 should effectively drop the changes from +6.
166 $ hg status
167 ? editor.py
168 ? file.rej
169 $ hg histedit --continue
170 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
171 saved backup bundle to $TESTTMP/*-backup.hg (glob)
172 $ hg log --graph
173 @ changeset: 1:617f94f13c0f
174 | tag: tip
175 | user: test
176 | date: Thu Jan 01 00:00:00 1970 +0000
177 | summary: +4
178 |
179 o changeset: 0:0189ba417d34
180 user: test
181 date: Thu Jan 01 00:00:00 1970 +0000
182 summary: 1+2+3
183
184
185 $ cd ..