##// END OF EJS Templates
amend: preserve extra dict (issue3430)
Idan Kamara -
r16630:f30226b1 stable
parent child Browse files
Show More
@@ -1311,6 +1311,12 b' def amend(ui, repo, commitfunc, old, ext'
1311 # |
1311 # |
1312 # base o - parent of amending changeset
1312 # base o - parent of amending changeset
1313
1313
1314 # Update extra dict from amended commit (e.g. to preserve graft source)
1315 extra.update(old.extra())
1316
1317 # Also update it from the intermediate commit or from the wctx
1318 extra.update(ctx.extra())
1319
1314 files = set(old.files())
1320 files = set(old.files())
1315
1321
1316 # Second, we use either the commit we just did, or if there were no
1322 # Second, we use either the commit we just did, or if there were no
@@ -1322,7 +1328,6 b' def amend(ui, repo, commitfunc, old, ext'
1322 user = ctx.user()
1328 user = ctx.user()
1323 date = ctx.date()
1329 date = ctx.date()
1324 message = ctx.description()
1330 message = ctx.description()
1325 extra = ctx.extra()
1326 # Recompute copies (avoid recording a -> b -> a)
1331 # Recompute copies (avoid recording a -> b -> a)
1327 copied = copies.pathcopies(base, ctx)
1332 copied = copies.pathcopies(base, ctx)
1328
1333
@@ -316,3 +316,37 b" Can't rollback an amend:"
316 $ hg rollback
316 $ hg rollback
317 no rollback information available
317 no rollback information available
318 [1]
318 [1]
319
320 Preserve extra dict (issue3430):
321
322 $ hg branch a
323 marked working directory as branch a
324 (branches are permanent and global, did you want a bookmark?)
325 $ echo a >> a
326 $ hg ci -ma
327 $ hg ci --amend -m "a'"
328 saved backup bundle to $TESTTMP/.hg/strip-backup/167f8e3031df-amend-backup.hg
329 $ hg log -r . --template "{branch}\n"
330 a
331 $ hg ci --amend -m "a''"
332 saved backup bundle to $TESTTMP/.hg/strip-backup/ceac1a44c806-amend-backup.hg
333 $ hg log -r . --template "{branch}\n"
334 a
335
336 Also preserve other entries in the dict that are in the old commit,
337 first graft something so there's an additional entry:
338
339 $ hg up 0 -q
340 $ echo z > z
341 $ hg ci -Am 'fork'
342 adding z
343 created new head
344 $ hg up 11
345 5 files updated, 0 files merged, 1 files removed, 0 files unresolved
346 $ hg graft 12
347 grafting revision 12
348 $ hg ci --amend -m 'graft amend'
349 saved backup bundle to $TESTTMP/.hg/strip-backup/18a5124daf7a-amend-backup.hg
350 $ hg log -r . --debug | grep extra
351 extra: branch=a
352 extra: source=2647734878ef0236dda712fae9c1651cf694ea8a
General Comments 0
You need to be logged in to leave comments. Login now