##// END OF EJS Templates
amend: prevent loss of bookmark on failed amend...
Pierre-Yves David -
r18198:9b4adaef stable
parent child Browse files
Show More
@@ -1635,10 +1635,13 b' def amend(ui, repo, commitfunc, old, ext'
1635 # First, do a regular commit to record all changes in the working
1635 # First, do a regular commit to record all changes in the working
1636 # directory (if there are any)
1636 # directory (if there are any)
1637 ui.callhooks = False
1637 ui.callhooks = False
1638 currentbookmark = repo._bookmarkcurrent
1638 try:
1639 try:
1640 repo._bookmarkcurrent = None
1639 opts['message'] = 'temporary amend commit for %s' % old
1641 opts['message'] = 'temporary amend commit for %s' % old
1640 node = commit(ui, repo, commitfunc, pats, opts)
1642 node = commit(ui, repo, commitfunc, pats, opts)
1641 finally:
1643 finally:
1644 repo._bookmarkcurrent = currentbookmark
1642 ui.callhooks = True
1645 ui.callhooks = True
1643 ctx = repo[node]
1646 ctx = repo[node]
1644
1647
@@ -243,6 +243,24 b' Moving bookmarks, preserve active bookma'
243 book1 1:48bb6e53a15f
243 book1 1:48bb6e53a15f
244 * book2 1:48bb6e53a15f
244 * book2 1:48bb6e53a15f
245
245
246 abort does not loose bookmarks
247
248 $ cat > editor.sh << '__EOF__'
249 > #!/bin/sh
250 > echo "" > "$1"
251 > __EOF__
252 $ echo a >> a
253 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend
254 transaction abort!
255 rollback completed
256 abort: empty commit message
257 [255]
258 $ hg book
259 book1 1:48bb6e53a15f
260 * book2 1:48bb6e53a15f
261 $ hg revert -Caq
262 $ rm editor.sh
263
246 $ echo '[defaults]' >> $HGRCPATH
264 $ echo '[defaults]' >> $HGRCPATH
247 $ echo "commit=-d '0 0'" >> $HGRCPATH
265 $ echo "commit=-d '0 0'" >> $HGRCPATH
248
266
General Comments 0
You need to be logged in to leave comments. Login now