Show More
@@ -175,6 +175,26 b' editcomment = _("""# Edit history betwee' | |||
|
175 | 175 | # |
|
176 | 176 | """) |
|
177 | 177 | |
|
178 | def foldchanges(ui, repo, node1, node2, opts): | |
|
179 | """Produce a new changeset that represents the diff from node1 to node2.""" | |
|
180 | try: | |
|
181 | fd, patchfile = tempfile.mkstemp(prefix='hg-histedit-') | |
|
182 | fp = os.fdopen(fd, 'w') | |
|
183 | diffopts = patch.diffopts(ui, opts) | |
|
184 | diffopts.git = True | |
|
185 | diffopts.ignorews = False | |
|
186 | diffopts.ignorewsamount = False | |
|
187 | diffopts.ignoreblanklines = False | |
|
188 | gen = patch.diff(repo, node1, node2, opts=diffopts) | |
|
189 | for chunk in gen: | |
|
190 | fp.write(chunk) | |
|
191 | fp.close() | |
|
192 | files = set() | |
|
193 | patch.patch(ui, repo, patchfile, files=files, eolmode=None) | |
|
194 | finally: | |
|
195 | os.unlink(patchfile) | |
|
196 | return files | |
|
197 | ||
|
178 | 198 | def between(repo, old, new, keep): |
|
179 | 199 | revs = [old] |
|
180 | 200 | current = old |
@@ -200,27 +220,12 b' def pick(ui, repo, ctx, ha, opts):' | |||
|
200 | 220 | ui.debug('node %s unchanged\n' % ha) |
|
201 | 221 | return oldctx, [], [], [] |
|
202 | 222 | hg.update(repo, ctx.node()) |
|
203 | fd, patchfile = tempfile.mkstemp(prefix='hg-histedit-') | |
|
204 | fp = os.fdopen(fd, 'w') | |
|
205 | diffopts = patch.diffopts(ui, opts) | |
|
206 | diffopts.git = True | |
|
207 | diffopts.ignorews = False | |
|
208 | diffopts.ignorewsamount = False | |
|
209 | diffopts.ignoreblanklines = False | |
|
210 | gen = patch.diff(repo, oldctx.parents()[0].node(), ha, opts=diffopts) | |
|
211 | for chunk in gen: | |
|
212 | fp.write(chunk) | |
|
213 | fp.close() | |
|
214 | 223 | try: |
|
215 | files = set() | |
|
216 | try: | |
|
217 | patch.patch(ui, repo, patchfile, files=files, eolmode=None) | |
|
224 | files = foldchanges(ui, repo, oldctx.p1().node() , ha, opts) | |
|
218 | 225 |
|
|
219 | 226 |
|
|
220 | 227 |
|
|
221 | 228 |
|
|
222 | finally: | |
|
223 | os.unlink(patchfile) | |
|
224 | 229 | except Exception: |
|
225 | 230 | raise util.Abort(_('Fix up the change and run ' |
|
226 | 231 | 'hg histedit --continue')) |
@@ -232,23 +237,8 b' def pick(ui, repo, ctx, ha, opts):' | |||
|
232 | 237 | def edit(ui, repo, ctx, ha, opts): |
|
233 | 238 | oldctx = repo[ha] |
|
234 | 239 | hg.update(repo, ctx.node()) |
|
235 | fd, patchfile = tempfile.mkstemp(prefix='hg-histedit-') | |
|
236 | fp = os.fdopen(fd, 'w') | |
|
237 | diffopts = patch.diffopts(ui, opts) | |
|
238 | diffopts.git = True | |
|
239 | diffopts.ignorews = False | |
|
240 | diffopts.ignorewsamount = False | |
|
241 | diffopts.ignoreblanklines = False | |
|
242 | gen = patch.diff(repo, oldctx.parents()[0].node(), ha, opts=diffopts) | |
|
243 | for chunk in gen: | |
|
244 | fp.write(chunk) | |
|
245 | fp.close() | |
|
246 | 240 | try: |
|
247 | files = set() | |
|
248 | try: | |
|
249 | patch.patch(ui, repo, patchfile, files=files, eolmode=None) | |
|
250 | finally: | |
|
251 | os.unlink(patchfile) | |
|
241 | files = foldchanges(ui, repo, oldctx.p1().node() , ha, opts) | |
|
252 | 242 | except Exception: |
|
253 | 243 | pass |
|
254 | 244 | raise util.Abort(_('Make changes as needed, you may commit or record as ' |
@@ -258,27 +248,12 b' def edit(ui, repo, ctx, ha, opts):' | |||
|
258 | 248 | def fold(ui, repo, ctx, ha, opts): |
|
259 | 249 | oldctx = repo[ha] |
|
260 | 250 | hg.update(repo, ctx.node()) |
|
261 | fd, patchfile = tempfile.mkstemp(prefix='hg-histedit-') | |
|
262 | fp = os.fdopen(fd, 'w') | |
|
263 | diffopts = patch.diffopts(ui, opts) | |
|
264 | diffopts.git = True | |
|
265 | diffopts.ignorews = False | |
|
266 | diffopts.ignorewsamount = False | |
|
267 | diffopts.ignoreblanklines = False | |
|
268 | gen = patch.diff(repo, oldctx.parents()[0].node(), ha, opts=diffopts) | |
|
269 | for chunk in gen: | |
|
270 | fp.write(chunk) | |
|
271 | fp.close() | |
|
272 | 251 | try: |
|
273 | files = set() | |
|
274 | try: | |
|
275 | patch.patch(ui, repo, patchfile, files=files, eolmode=None) | |
|
252 | files = foldchanges(ui, repo, oldctx.p1().node() , ha, opts) | |
|
276 | 253 |
|
|
277 | 254 |
|
|
278 | 255 |
|
|
279 | 256 |
|
|
280 | finally: | |
|
281 | os.unlink(patchfile) | |
|
282 | 257 | except Exception: |
|
283 | 258 | raise util.Abort(_('Fix up the change and run ' |
|
284 | 259 | 'hg histedit --continue')) |
@@ -289,22 +264,7 b' def fold(ui, repo, ctx, ha, opts):' | |||
|
289 | 264 | def finishfold(ui, repo, ctx, oldctx, newnode, opts, internalchanges): |
|
290 | 265 | parent = ctx.parents()[0].node() |
|
291 | 266 | hg.update(repo, parent) |
|
292 | fd, patchfile = tempfile.mkstemp(prefix='hg-histedit-') | |
|
293 | fp = os.fdopen(fd, 'w') | |
|
294 | diffopts = patch.diffopts(ui, opts) | |
|
295 | diffopts.git = True | |
|
296 | diffopts.ignorews = False | |
|
297 | diffopts.ignorewsamount = False | |
|
298 | diffopts.ignoreblanklines = False | |
|
299 | gen = patch.diff(repo, parent, newnode, opts=diffopts) | |
|
300 | for chunk in gen: | |
|
301 | fp.write(chunk) | |
|
302 | fp.close() | |
|
303 | files = set() | |
|
304 | try: | |
|
305 | patch.patch(ui, repo, patchfile, files=files, eolmode=None) | |
|
306 | finally: | |
|
307 | os.unlink(patchfile) | |
|
267 | files = foldchanges(ui, repo, parent, newnode, opts) | |
|
308 | 268 | newmessage = '\n***\n'.join( |
|
309 | 269 | [ctx.description()] + |
|
310 | 270 | [repo[r].description() for r in internalchanges] + |
@@ -326,23 +286,8 b' def drop(ui, repo, ctx, ha, opts):' | |||
|
326 | 286 | def message(ui, repo, ctx, ha, opts): |
|
327 | 287 | oldctx = repo[ha] |
|
328 | 288 | hg.update(repo, ctx.node()) |
|
329 | fd, patchfile = tempfile.mkstemp(prefix='hg-histedit-') | |
|
330 | fp = os.fdopen(fd, 'w') | |
|
331 | diffopts = patch.diffopts(ui, opts) | |
|
332 | diffopts.git = True | |
|
333 | diffopts.ignorews = False | |
|
334 | diffopts.ignorewsamount = False | |
|
335 | diffopts.ignoreblanklines = False | |
|
336 | gen = patch.diff(repo, oldctx.parents()[0].node(), ha, opts=diffopts) | |
|
337 | for chunk in gen: | |
|
338 | fp.write(chunk) | |
|
339 | fp.close() | |
|
340 | 289 | try: |
|
341 | files = set() | |
|
342 | try: | |
|
343 | patch.patch(ui, repo, patchfile, files=files, eolmode=None) | |
|
344 | finally: | |
|
345 | os.unlink(patchfile) | |
|
290 | files = foldchanges(ui, repo, oldctx.p1().node() , ha, opts) | |
|
346 | 291 | except Exception: |
|
347 | 292 | raise util.Abort(_('Fix up the change and run ' |
|
348 | 293 | 'hg histedit --continue')) |
General Comments 0
You need to be logged in to leave comments.
Login now