开发者

Task control with Mercurial harder since incorrect commit messages cannot be changed

开发者 https://www.devze.com 2023-02-09 01:40 出处:网络
I used to use SVN, and I could track the task by adding the task number in the commit message, for example:

I used to use SVN, and I could track the task by adding the task number in the commit message, for example:

开发者_运维问答
-m "Task34: done something"

This is used to track all the changes relating to a certain task. Any errors (which do happen) in the commit summary can be modified.

However, in Mercurial the commit summary cannot be changed, and hence I cannot follow my approach of task control. Is there a better approach for task management? or is there a way to change the commit summary?


Mercurial is built around the idea of a immutable history. Every change is strictly the addition of a new changeset. For example, removing something is done by adding the inverse (using the backout command) so you have a record of both the bad code and its removal in history (as opposed to no record of it in history).

The model is that of a scientist writing in his or her logbook in pen on numbered pages, recording both successes and failures.

That said, the base mercurial functionality isn't going to make revising commit messages, even if they've never been been pushed, because that goes against the model. There are, however, other ways to keep revising code until you're happy with it. You can use Mercurial Queues, which are mutable overlays, which can themselves be immutably versioned.

However, were I you I'd just adopt a workmode that embraces the immutability. Your putting the issue id in the commit is great -- just keep doing that and do any updates or corrections in subsequent changesets with the same id in the description.

Then you'll be able to do something like:

hg log --keyword Task34

Which will instantly show you all the changes related to that Task ID, and if some of them are "backed out previous attempt, taking another stab at it using foobaz module" that's good practice not a flaw.

0

精彩评论

暂无评论...
验证码 换一张
取 消