如何在分支后编辑Mercurial提交消息?

Imr*_*mre 8 version-control mercurial commit-message

我在Mercurial存储库中有一些旧的提交消息应该更改(以调整一些新工具).我已经明白,必须在主存储库上完成此黑客操作,并且必须重新克隆所有本地存储库,因为所有后续更改集的校验和也将更改.

我已经尝试按照" 如何在Mercurial中编辑不正确的提交消息? "中的配方,但是使用MQ扩展我遇到了错误消息

X:\project>hg qimport -r 2:tip
abort: revision 2 is the root of more than one branch
Run Code Online (Sandbox Code Playgroud)

与Histedit非常相似

X:\project>hg histedit 2
abort: cannot edit history that would orphan nodes
Run Code Online (Sandbox Code Playgroud)

问题似乎是在变更集之后创建了分支.

如果我想改变补丁的内容,我可以看到它会变得如何变得混乱,但也许有一个我在编辑提交消息时错过的解决方法?

Mar*_*ler 4

我将使用转换扩展的破解版本来执行此操作。该扩展可以进行hg \xe2\x86\x92 hg转换,使您可以更改作者和分支名称。目前尚不支持更改提交消息,但您可以破解它。

\n\n

具体来说,您应该将getcommit方法更改为:

\n\n
def getcommit(self, rev):\n    ctx = self.changectx(rev)\n    parents = [p.hex() for p in self.parents(ctx)]\n    if self.saverev:\n        crev = rev\n    else:\n        crev = None\n    return commit(author=ctx.user(), date=util.datestr(ctx.date()),\n                  desc=ctx.description(), rev=crev, parents=parents,\n                  branch=ctx.branch(), extra=ctx.extra(),\n                  sortkey=ctx.rev())\n
Run Code Online (Sandbox Code Playgroud)\n\n

它负责读取旧的提交。改变

\n\n
desc=ctx.description()\n
Run Code Online (Sandbox Code Playgroud)\n\n

\n\n
desc=adjust(ctx.description())\n
Run Code Online (Sandbox Code Playgroud)\n\n

然后实现adjust文件顶部的函数:

\n\n
def adjust(text):\n    return text.upper()\n
Run Code Online (Sandbox Code Playgroud)\n