Question

I am a git user and a Mozilla volunteer. In Firefox development they use Mercurial instead of git and I have some problems to understand how it works.

Usually, when working on a Firefox bug, I have to upload previous versions of the final patch to get some feedback or reviews. Then, when I want to modify something and upload the new patch, I don't have an easy way to generate a patch including the changes from my previous patch and the news changes I made.

Any idea how to merge the changes from a previous patch with the changes I made after that patch?

Was it helpful?

Solution

It is hard to understand the state of your repo based on your question, and whether you use mq or simple commits, but assuming that you are always commiting your changes in your local repository, you can use the diff command on multiple changesets.

hg diff -r10:15

The result will be the concatenation of all your changes from revision 10 to revision 15.

Another option is to use the shelves to merge your changes. Changes in the shelves can be imported over uncommitted changes, allowing you to combine them.

OTHER TIPS

You already got some good advice from Vince. So let me add something about how you can incorporate changes into an existing commit with Mercurial. I'm thinking that will be helpful since it sounds like you submit your change as a single patch.

If so, then I suggest you simply use hg commit --amend to keep revising the commit based on feedback from the reviewers.

Alternatively you can use hg commit freely to create many commits and then later fold them into one (that is equivalent to using git commit and later squash the commits with git rebase -i). In Mercurial, history editing is done using the aptly named histedit extension. You enable it by adding

[extensions]
histedit =

to your ~/.hgrc file. Then run

$ hg histedit your-first-commit

to begin editing history starting with your-first-commit. You can use a revision number, a changeset ID, or any other identifier here. Using a revset like .^^ will look familiar to you since it selects the two last commits like in Git (except that revsets are much more powerful than what Git calls "treeish").

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top