@@ -408,20 +408,25 @@
def stop(ui, repo, ctx, ha, opts):
oldctx = repo[ha]
- hg.update(repo, ctx.node())
- stats = applychanges(ui, repo, oldctx, opts)
- if stats and stats[3] > 0:
- raise error.InterventionRequired(
- _('Fix up the change and run hg histedit --continue'))
+ if obsolete._enabled and oldctx.parents()[0] == ctx:
+ hg.update(repo, oldctx.node())
+ newctx = oldctx
+ else:
+ hg.update(repo, ctx.node())
+ stats = applychanges(ui, repo, oldctx, opts)
+ if stats and stats[3] > 0:
+ raise error.InterventionRequired(
+ _('Fix up the change and run hg histedit --continue'))
- commit = commitfuncfor(repo, oldctx)
- new = commit(text=oldctx.description(), user=oldctx.user(),
- date=oldctx.date(), extra=oldctx.extra())
+ commit = commitfuncfor(repo, oldctx)
+ new = commit(text=oldctx.description(), user=oldctx.user(),
+ date=oldctx.date(), extra=oldctx.extra())
+ newctx = repo[new]
raise error.InterventionRequired(
_('Changes commited as %s. You may amend the commit now.\n'
'When you are finished, run hg histedit --continue to resume.') %
- repo[new])
+ newctx)
def message(ui, repo, ctx, ha, opts):
oldctx = repo[ha]
@@ -161,4 +161,77 @@
e
+Enable obsolete
+ $ cat > ${TESTTMP}/obs.py << EOF
+ > import mercurial.obsolete
+ > mercurial.obsolete._enabled = True
+ > EOF
+
+ $ cat >> $HGRCPATH << EOF
+ > [extensions]
+ > histedit=
+ > rebase=
+ >
+ > obs=${TESTTMP}/obs.py
+ > EOF
+
+ With obsolete enabled a stop should retain the hashes
+
+ $ hg histedit 177f92b77385 --commands - 2>&1 << EOF| fixbundle
+ > pick 177f92b77385 c
+ > pick 055a42cdd887 d
+ > stop d51720eb7a13 e
+ > pick 099559071076 f
+ > EOF
+ 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+ Changes commited as d51720eb7a13. You may amend the commit now.
+ When you are finished, run hg histedit --continue to resume.
+
+ $ hg histedit --continue
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+ $ hg log --graph --template '{node|short} {desc} {files}\n'
+ @ 099559071076 f f
+ |
+ o d51720eb7a13 e added e
+ |
+ o 055a42cdd887 d d
+ |
+ o 177f92b77385 c c
+ |
+ o d2ae7f538514 b b
+ |
+ o cb9a9f314b8b a a
+
+ $ hg histedit 177f92b77385 --commands - 2>&1 << EOF| fixbundle
+ > pick 177f92b77385 c
+ > pick 055a42cdd887 d
+ > stop d51720eb7a13 e
+ > pick 099559071076 f
+ > EOF
+ 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+ Changes commited as d51720eb7a13. You may amend the commit now.
+ When you are finished, run hg histedit --continue to resume.
+
+ $ echo other > other
+ $ hg add other
+ $ hg commit --amend
+ $ hg histedit --continue
+ 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+ $ hg log --graph --template '{node|short} {desc} {files}\n'
+ @ c5e71295d8f1 f f
+ |
+ o 37537b78d2b6 e added e other
+ |
+ o 055a42cdd887 d d
+ |
+ o 177f92b77385 c c
+ |
+ o d2ae7f538514 b b
+ |
+ o cb9a9f314b8b a a
+
+