Show More
@@ -1797,7 +1797,11 def amend(ui, repo, commitfunc, old, ext | |||||
1797 |
|
1797 | |||
1798 | ph = repo.ui.config('phases', 'new-commit', phases.draft) |
|
1798 | ph = repo.ui.config('phases', 'new-commit', phases.draft) | |
1799 | try: |
|
1799 | try: | |
1800 | repo.ui.setconfig('phases', 'new-commit', old.phase()) |
|
1800 | if opts.get('secret'): | |
|
1801 | commitphase = 'secret' | |||
|
1802 | else: | |||
|
1803 | commitphase = old.phase() | |||
|
1804 | repo.ui.setconfig('phases', 'new-commit', commitphase) | |||
1801 | newid = repo.commitctx(new) |
|
1805 | newid = repo.commitctx(new) | |
1802 | finally: |
|
1806 | finally: | |
1803 | repo.ui.setconfig('phases', 'new-commit', ph) |
|
1807 | repo.ui.setconfig('phases', 'new-commit', ph) |
@@ -1397,6 +1397,7 def commit(ui, repo, *pats, **opts): | |||||
1397 | if opts.get('force_editor'): |
|
1397 | if opts.get('force_editor'): | |
1398 | e = cmdutil.commitforceeditor |
|
1398 | e = cmdutil.commitforceeditor | |
1399 |
|
1399 | |||
|
1400 | # commitfunc is used only for temporary amend commit by cmdutil.amend | |||
1400 | def commitfunc(ui, repo, message, match, opts): |
|
1401 | def commitfunc(ui, repo, message, match, opts): | |
1401 | editor = e |
|
1402 | editor = e | |
1402 | # message contains text from -m or -l, if it's empty, |
|
1403 | # message contains text from -m or -l, if it's empty, | |
@@ -1404,18 +1405,12 def commit(ui, repo, *pats, **opts): | |||||
1404 | if not message: |
|
1405 | if not message: | |
1405 | message = old.description() |
|
1406 | message = old.description() | |
1406 | editor = cmdutil.commitforceeditor |
|
1407 | editor = cmdutil.commitforceeditor | |
1407 | try: |
|
1408 | return repo.commit(message, | |
1408 |
|
|
1409 | opts.get('user') or old.user(), | |
1409 | ui.setconfig('phases', 'new-commit', 'secret') |
|
1410 | opts.get('date') or old.date(), | |
1410 |
|
1411 | match, | ||
1411 | return repo.commit(message, |
|
1412 | editor=editor, | |
1412 |
|
|
1413 | extra=extra) | |
1413 | opts.get('date') or old.date(), |
|
|||
1414 | match, |
|
|||
1415 | editor=editor, |
|
|||
1416 | extra=extra) |
|
|||
1417 | finally: |
|
|||
1418 | ui.setconfig('phases', 'new-commit', oldcommitphase) |
|
|||
1419 |
|
1414 | |||
1420 | current = repo._bookmarkcurrent |
|
1415 | current = repo._bookmarkcurrent | |
1421 | marks = old.bookmarks() |
|
1416 | marks = old.bookmarks() |
@@ -765,3 +765,14 This silliness fails: | |||||
765 | $ hg ci --close-branch -m'open and close' |
|
765 | $ hg ci --close-branch -m'open and close' | |
766 | abort: can only close branch heads |
|
766 | abort: can only close branch heads | |
767 | [255] |
|
767 | [255] | |
|
768 | ||||
|
769 | Test that amend with --secret creates new secret changeset forcibly | |||
|
770 | --------------------------------------------------------------------- | |||
|
771 | ||||
|
772 | $ hg phase '.^::.' | |||
|
773 | 35: draft | |||
|
774 | 36: draft | |||
|
775 | $ hg commit --amend --secret -m 'amend as secret' -q | |||
|
776 | $ hg phase '.^::.' | |||
|
777 | 35: draft | |||
|
778 | 38: secret |
General Comments 0
You need to be logged in to leave comments.
Login now