Show More
@@ -1582,10 +1582,14 b' def amend(ui, repo, commitfunc, old, ext' | |||||
1582 | lock = repo.lock() |
|
1582 | lock = repo.lock() | |
1583 | tr = repo.transaction('amend') |
|
1583 | tr = repo.transaction('amend') | |
1584 | try: |
|
1584 | try: | |
|
1585 | # See if we got a message from -m or -l, if not, open the editor | |||
|
1586 | # with the message of the changeset to amend | |||
|
1587 | message = logmessage(ui, opts) | |||
1585 | # First, do a regular commit to record all changes in the working |
|
1588 | # First, do a regular commit to record all changes in the working | |
1586 | # directory (if there are any) |
|
1589 | # directory (if there are any) | |
1587 | ui.callhooks = False |
|
1590 | ui.callhooks = False | |
1588 | try: |
|
1591 | try: | |
|
1592 | opts['message'] = 'temporary amend commit for %s' % old | |||
1589 | node = commit(ui, repo, commitfunc, pats, opts) |
|
1593 | node = commit(ui, repo, commitfunc, pats, opts) | |
1590 | finally: |
|
1594 | finally: | |
1591 | ui.callhooks = True |
|
1595 | ui.callhooks = True | |
@@ -1618,7 +1622,6 b' def amend(ui, repo, commitfunc, old, ext' | |||||
1618 |
|
1622 | |||
1619 | user = ctx.user() |
|
1623 | user = ctx.user() | |
1620 | date = ctx.date() |
|
1624 | date = ctx.date() | |
1621 | message = ctx.description() |
|
|||
1622 | # Recompute copies (avoid recording a -> b -> a) |
|
1625 | # Recompute copies (avoid recording a -> b -> a) | |
1623 | copied = copies.pathcopies(base, ctx) |
|
1626 | copied = copies.pathcopies(base, ctx) | |
1624 |
|
1627 | |||
@@ -1663,17 +1666,10 b' def amend(ui, repo, commitfunc, old, ext' | |||||
1663 | except KeyError: |
|
1666 | except KeyError: | |
1664 | raise IOError |
|
1667 | raise IOError | |
1665 |
|
1668 | |||
1666 | # See if we got a message from -m or -l, if not, open the editor |
|
|||
1667 | # with the message of the changeset to amend |
|
|||
1668 | user = opts.get('user') or old.user() |
|
1669 | user = opts.get('user') or old.user() | |
1669 | date = opts.get('date') or old.date() |
|
1670 | date = opts.get('date') or old.date() | |
1670 | message = logmessage(ui, opts) |
|
1671 | if not message: | |
1671 |
|
|
1672 | message = old.description() | |
1672 | cctx = context.workingctx(repo, old.description(), |
|
|||
1673 | user, date, extra, |
|
|||
1674 | repo.status(base.node(), |
|
|||
1675 | old.node())) |
|
|||
1676 | message = commitforceeditor(repo, cctx, []) |
|
|||
1677 |
|
1673 | |||
1678 | new = context.memctx(repo, |
|
1674 | new = context.memctx(repo, | |
1679 | parents=[base.node(), nullid], |
|
1675 | parents=[base.node(), nullid], | |
@@ -1683,6 +1679,7 b' def amend(ui, repo, commitfunc, old, ext' | |||||
1683 | user=user, |
|
1679 | user=user, | |
1684 | date=date, |
|
1680 | date=date, | |
1685 | extra=extra) |
|
1681 | extra=extra) | |
|
1682 | new._text = commitforceeditor(repo, new, []) | |||
1686 | ph = repo.ui.config('phases', 'new-commit', phases.draft) |
|
1683 | ph = repo.ui.config('phases', 'new-commit', phases.draft) | |
1687 | try: |
|
1684 | try: | |
1688 | repo.ui.setconfig('phases', 'new-commit', old.phase()) |
|
1685 | repo.ui.setconfig('phases', 'new-commit', old.phase()) |
@@ -167,6 +167,8 b' Same, but with changes in working dir (d' | |||||
167 | $ echo a >> a |
|
167 | $ echo a >> a | |
168 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v |
|
168 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v | |
169 | amending changeset ffb49186f961 |
|
169 | amending changeset ffb49186f961 | |
|
170 | a | |||
|
171 | copying changeset a4f8a65b7c6a to ad120869acf0 | |||
170 | another precious commit message |
|
172 | another precious commit message | |
171 |
|
173 | |||
172 |
|
174 | |||
@@ -177,9 +179,7 b' Same, but with changes in working dir (d' | |||||
177 | HG: branch 'default' |
|
179 | HG: branch 'default' | |
178 | HG: changed a |
|
180 | HG: changed a | |
179 | a |
|
181 | a | |
180 | copying changeset 27f3aacd3011 to ad120869acf0 |
|
182 | stripping intermediate changeset a4f8a65b7c6a | |
181 | a |
|
|||
182 | stripping intermediate changeset 27f3aacd3011 |
|
|||
183 | stripping amended changeset ffb49186f961 |
|
183 | stripping amended changeset ffb49186f961 | |
184 | 2 changesets found |
|
184 | 2 changesets found | |
185 | saved backup bundle to $TESTTMP/.hg/strip-backup/ffb49186f961-amend-backup.hg (glob) |
|
185 | saved backup bundle to $TESTTMP/.hg/strip-backup/ffb49186f961-amend-backup.hg (glob) |
General Comments 0
You need to be logged in to leave comments.
Login now