3

I can't understand why Mercurial won't let me push when patches are applied. From my point of view, applied patches affect only the current workspace and pushing isn't influenced by the state of the current workspace.

In other words, I would expect that if I made some commits, then started a patch queue, then pushing would push those commits, and ignore anything going on with patches.

I realize that there probably is a good reason for this and it's my understanding of how mq works that is wrong. So what am I missing? Why can't Hg push just the current outgoing commits?

George Mauer
  • 117,483
  • 131
  • 382
  • 612

1 Answers1

2

You can resolve this issue by making MQ changesets secret. The easiest way to do this is by adding the appropriate setting to your .hgrc, i.e.:

[mq]
secret = true

This will automatically make all mq patches secret. With them secret, you should be able to push the remaining commits normally and without receiving an error message.

Existing mq patches can be made secret with hg phase -f -s <rev>.

Reimer Behrends
  • 8,600
  • 15
  • 19
  • oh wow, that's cool. So what's going on under the hood that this is necessary? – George Mauer May 10 '15 at 22:02
  • By default, `hg push` tries to push all the changesets that exist in the local, but not the remote repository, and tells you everything that might go wrong (mq changesets that can't be pushed, new heads being created, etc.). To avoid the error, you have to only push the revisions that you can. You can either do this manually with `hg push -r ` for the last non-mq revision or automate it by making mq patches secret (secret changesets won't get pushed). – Reimer Behrends May 10 '15 at 23:05
  • hmm...so applied mq patches *do* count as revisions? Like their a part of the hg history? I had thought they were another thing altogether. – George Mauer May 10 '15 at 23:28
  • They are implemented differently, but Mercurial tries pretty hard to treat them like any other part of the history where possible; which is why they show up in a log, you can diff against them, etc. Even if you clone a repository with mq patches or pull from one, they're transferred (and turned into normal commits with an identical hash in the copy). – Reimer Behrends May 10 '15 at 23:49