Pergunta

I am using Mercurial Queues on a repository, and have placed those patches in a patch repository. Another contributor has cloned my patch queue and made changes of their own. I would now like to merge their changes in my local patch repository.

I am trying to find a good workflow for performing this merge that

  • reflects the contributor's changesets in the history of the patch repository
  • invokes the user's merge tool in case of conflicts

Initially, I just tried to merge the patches directly. This is okay in very simple cases, but does not work well when many things have changed, since the patches depend on line number context which doesn't seem like something I should have to worry about adjusting myself. Overall, I find examining a 3 way diff of patches to be too complex.

Is there a better way?

Foi útil?

Solução

There's no great way to handle this. What I'd probably end up doing is creating two clones, and qfinishing your patch in one and the contributers patch in the other. That that point you'll have repos with each separate patch's net effect applied. Then you hg pull one of those clones into the other, and hg merge will let you use your graphical tools to merge the results of the patches -- and the only differences should be the differences in your patches. At this point, ideally, you'll be able to qimport the merge changeset, but you can't do that, so you have to 'hg diff -r tip-1 -r tip' to get a new diff that is the difference between before-everything-started and after-merging-the-two-results. You then 'qimport` that diff and commit it to your patch queue repo with a note saying where it came from.

Decidedly sub-optimal, but the best I can come up with. I'd love to hear a better solution.

Outras dicas

I'm afraid that there is no automated way to merge patches.

However, one "trick" you can use is to create new patches instead of editing/refreshing existing patches when you need to amend them. When you all agree on the right way to do things, then hg qfold the patches.

That way you wont be stepping on each others toes as much since you create new patches.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top