How do I prevent Mercurial patches from being pulled?

215 views Asked by At

So far I haven't been able to find a clear answer, though it's possible that the answer is "change your workflow".

I've just started playing around with Mercurial's patch queue and I can see some serious power in it. It seems pretty awesome. In my tests, I've discovered that if you have a patch queue in repo1, and you pull from repo2, you can do some bad things. For example:

  1. Create repos 1, and clone it.
  2. Enable the queue on repo1
  3. Make some commits and some patches on repo1
  4. Pull changes to repo2
  5. On repo1 un-apply(pop?) all your patches
  6. Pull changes to repo2

Now you'll see two different branches - which makes sense from a certain viewpoint. However, since my patches aren't a part of repo1's history (at least until they're applied), it seems like there should be a way to tell mercurial that my patches are off-limits, and only provide what's in the "official history".

Is there a way to do this?

1

There are 1 answers

1
Tim Henigan On BEST ANSWER

Mercurial phases may be the answer to this.

Starting with Mercurial v2.1, you can configure mq changesets to automatically be marked secret. secret changesets are ignored by incoming/pull and outgoing/push commands.

To enable this behavior, you need to add the following to your config:

[mq]
secret = True

Once enabled, it behaves as follows:

$ hg qpush --all
applying my-patch
now at: my-patch

$ hg phase -r .
16873: secret

$hg outgoing
comparing with https://www.mercurial-scm.org/repo/hg
searching for changes
no changes found (ignored 1 secret changesets)