Mercurial > public > mercurial-scm > hg
comparison mercurial/cmdutil.py @ 17475:63e45aee46d4
amend: add obsolete support
If the obsolete feature is enabled, `hg commit --amend` marks a
changeset as obsolete instead of stripping it.
author | Pierre-Yves David <pierre-yves.david@logilab.fr> |
---|---|
date | Tue, 11 Sep 2012 00:12:07 +0200 |
parents | 9732473aa24b |
children | 8575f4a2126e |
comparison
equal
deleted
inserted
replaced
17474:f85816af6294 | 17475:63e45aee46d4 |
---|---|
8 from node import hex, nullid, nullrev, short | 8 from node import hex, nullid, nullrev, short |
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 | 13 import subrepo, context, repair, bookmarks, graphmod, revset, phases, obsolete |
14 import lock as lockmod | 14 import lock as lockmod |
15 | 15 |
16 def parsealiases(cmd): | 16 def parsealiases(cmd): |
17 return cmd.lstrip("^").split("|") | 17 return cmd.lstrip("^").split("|") |
18 | 18 |
1695 if bms: | 1695 if bms: |
1696 for bm in bms: | 1696 for bm in bms: |
1697 repo._bookmarks[bm] = newid | 1697 repo._bookmarks[bm] = newid |
1698 bookmarks.write(repo) | 1698 bookmarks.write(repo) |
1699 #commit the whole amend process | 1699 #commit the whole amend process |
1700 if obsolete._enabled and newid != old.node(): | |
1701 # mark the new changeset as successor of the rewritten one | |
1702 new = repo[newid] | |
1703 obs = [(old, (new,))] | |
1704 if node: | |
1705 obs.append((ctx, (new,))) | |
1706 | |
1707 obsolete.createmarkers(repo, obs) | |
1700 tr.close() | 1708 tr.close() |
1701 finally: | 1709 finally: |
1702 tr.release() | 1710 tr.release() |
1703 # Strip the intermediate commit (if there was one) and the amended | 1711 if (not obsolete._enabled) and newid != old.node(): |
1704 # commit | 1712 # Strip the intermediate commit (if there was one) and the amended |
1705 if newid != old.node(): | 1713 # commit |
1706 if node: | 1714 if node: |
1707 ui.note(_('stripping intermediate changeset %s\n') % ctx) | 1715 ui.note(_('stripping intermediate changeset %s\n') % ctx) |
1708 ui.note(_('stripping amended changeset %s\n') % old) | 1716 ui.note(_('stripping amended changeset %s\n') % old) |
1709 repair.strip(ui, repo, old.node(), topic='amend-backup') | 1717 repair.strip(ui, repo, old.node(), topic='amend-backup') |
1710 finally: | 1718 finally: |