Comments
Patch
@@ -1617,11 +1617,11 @@ def commit(ui, repo, commitfunc, pats, o
def amend(ui, repo, commitfunc, old, extra, pats, opts):
ui.note(_('amending changeset %s\n') % old)
base = old.p1()
- wlock = lock = None
+ wlock = lock = newid = None
try:
wlock = repo.wlock()
lock = repo.lock()
tr = repo.transaction('amend')
try:
@@ -1780,10 +1780,12 @@ def amend(ui, repo, commitfunc, old, ext
if node:
ui.note(_('stripping intermediate changeset %s\n') % ctx)
ui.note(_('stripping amended changeset %s\n') % old)
repair.strip(ui, repo, old.node(), topic='amend-backup')
finally:
+ if newid is None:
+ repo.dirstate.invalidate()
lockmod.release(wlock, lock)
return newid
def commiteditor(repo, ctx, subs):
if ctx.description():
@@ -56,15 +56,38 @@ Amending changeset with changes in worki
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: base
+Check proper abort for empty message
+
+ $ cat > editor.sh << '__EOF__'
+ > #!/bin/sh
+ > echo "" > "$1"
+ > __EOF__
+ $ echo b > b
+ $ hg add b
+ $ hg summary
+ parent: 1:43f1ba15f28a tip
+ amend base1
+ branch: default
+ commit: 1 added, 1 unknown
+ update: (current)
+ $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend
+ transaction abort!
+ rollback completed
+ abort: empty commit message
+ [255]
+ $ hg summary
+ parent: 1:43f1ba15f28a tip
+ amend base1
+ branch: default
+ commit: 1 added, 1 unknown
+ update: (current)
+
Add new file:
-
- $ echo b > b
- $ hg ci --amend -Am 'amend base1 new file'
- adding b
+ $ hg ci --amend -m 'amend base1 new file'
saved backup bundle to $TESTTMP/.hg/strip-backup/43f1ba15f28a-amend-backup.hg (glob)
Remove file that was added in amended commit:
(and test logfile option)
(and test that logfile option do not trigger an editor)