9 from i18n import _ |
9 from i18n import _ |
10 import os, sys, errno, re, tempfile |
10 import os, sys, errno, re, tempfile |
11 import util, scmutil, templater, patch, error, templatekw, revlog, copies |
11 import util, scmutil, templater, patch, error, templatekw, revlog, copies |
12 import match as matchmod |
12 import match as matchmod |
13 import subrepo, context, repair, bookmarks, graphmod, revset, phases, obsolete |
13 import subrepo, context, repair, bookmarks, graphmod, revset, phases, obsolete |
|
14 import changelog |
14 import lock as lockmod |
15 import lock as lockmod |
15 |
16 |
16 def parsealiases(cmd): |
17 def parsealiases(cmd): |
17 return cmd.lstrip("^").split("|") |
18 return cmd.lstrip("^").split("|") |
18 |
19 |
1694 user = opts.get('user') or old.user() |
1695 user = opts.get('user') or old.user() |
1695 date = opts.get('date') or old.date() |
1696 date = opts.get('date') or old.date() |
1696 if not message: |
1697 if not message: |
1697 message = old.description() |
1698 message = old.description() |
1698 |
1699 |
|
1700 pureextra = extra.copy() |
|
1701 extra['amend_source'] = old.hex() |
|
1702 |
1699 new = context.memctx(repo, |
1703 new = context.memctx(repo, |
1700 parents=[base.node(), nullid], |
1704 parents=[base.node(), nullid], |
1701 text=message, |
1705 text=message, |
1702 files=files, |
1706 files=files, |
1703 filectxfn=filectxfn, |
1707 filectxfn=filectxfn, |
1704 user=user, |
1708 user=user, |
1705 date=date, |
1709 date=date, |
1706 extra=extra) |
1710 extra=extra) |
1707 new._text = commitforceeditor(repo, new, []) |
1711 new._text = commitforceeditor(repo, new, []) |
|
1712 |
|
1713 newdesc = changelog.stripdesc(new.description()) |
|
1714 if ((not node) |
|
1715 and newdesc == old.description() |
|
1716 and user == old.user() |
|
1717 and date == old.date() |
|
1718 and pureextra == old.extra()): |
|
1719 # nothing changed. continuing here would create a new node |
|
1720 # anyway because of the amend_source noise. |
|
1721 # |
|
1722 # This not what we expect from amend. |
|
1723 return old.node() |
|
1724 |
1708 ph = repo.ui.config('phases', 'new-commit', phases.draft) |
1725 ph = repo.ui.config('phases', 'new-commit', phases.draft) |
1709 try: |
1726 try: |
1710 repo.ui.setconfig('phases', 'new-commit', old.phase()) |
1727 repo.ui.setconfig('phases', 'new-commit', old.phase()) |
1711 newid = repo.commitctx(new) |
1728 newid = repo.commitctx(new) |
1712 finally: |
1729 finally: |