@@ -397,9 +397,11 @@
if n is None:
ui.warn(_('%s: empty changeset') % ha[:12])
return ctx, []
- return finishfold(ui, repo, ctx, oldctx, n, opts, [])
+ return finishfold(ui, repo, ctx, oldctx.node(), oldctx.description(),
+ n, opts, [])
-def finishfold(ui, repo, ctx, oldctx, newnode, opts, internalchanges):
+def finishfold(ui, repo, ctx, oldctxnode, oldctxdescription, newnode,
+ opts, internalchanges):
parent = ctx.parents()[0].node()
hg.update(repo, parent)
### prepare new commit data
@@ -412,19 +414,19 @@
newmessage = '\n***\n'.join(
[ctx.description()] +
[repo[r].description() for r in internalchanges] +
- [oldctx.description()]) + '\n'
+ [oldctxdescription]) + '\n'
commitopts['message'] = newmessage
# date
- commitopts['date'] = max(ctx.date(), oldctx.date())
+ commitopts['date'] = ctx.date()
extra = ctx.extra().copy()
# histedit_source
# note: ctx is likely a temporary commit but that the best we can do here
# This is sufficient to solve issue3681 anyway
- extra['histedit_source'] = '%s,%s' % (ctx.hex(), oldctx.hex())
+ extra['histedit_source'] = '%s,%s' % (ctx.hex(), node.hex(oldctxnode))
commitopts['extra'] = extra
phasebackup = repo.ui.backupconfig('phases', 'new-commit')
try:
- phasemin = max(ctx.phase(), oldctx.phase())
+ phasemin = ctx.phase()
repo.ui.setconfig('phases', 'new-commit', phasemin, 'histedit')
n = collapse(repo, ctx, repo[newnode], commitopts)
finally:
@@ -432,7 +434,7 @@
if n is None:
return ctx, []
hg.update(repo, n)
- replacements = [(oldctx.node(), (newnode,)),
+ replacements = [(oldctxnode, (newnode,)),
(ctx.node(), (n,)),
(newnode, (n,)),
]
@@ -775,8 +777,9 @@
if action in ('r', 'roll'):
foldopts = foldopts.copy()
foldopts['rollup'] = True
- parentctx, repl = finishfold(ui, repo, parentctx, ctx, new,
- foldopts, newchildren)
+ parentctx, repl = finishfold(ui, repo, parentctx, ctx.node(),
+ ctx.description(), new, foldopts,
+ newchildren)
replacements.extend(repl)
else:
# newchildren is empty if the fold did not result in any commit
@@ -433,7 +433,7 @@
$ hg log -G
@ 19:f9daec13fb98 (secret) i
|
- o 18:49807617f46a (secret) g
+ o 18:49807617f46a (draft) g
|
o 17:050280826e04 (draft) h
|