2

Quite often in Mercurial, I happen to need local changes to a local repository, which should never ever enter the main repository. This could be (not complete list)

  • config files which need to differ on my PC
  • I want to mark my compilations so that I can distinguish versions compiled by me from official compilations
  • hgsub needs to differ on a PC without network access

Using TortoiseHG, my work scheme looks like this at the moment:

  • Commit all relevant changes, leaving the changes to kept local uncommited
  • Shelve changes to be kept local
  • Push or Pull
  • Deshelve

This works until I forget to exclude the changes to kept local, which will happen sooner or later... Then I have to waste time to restore the state before.

Is there any way to do this, e.g. by certain extensions?

Thanks for you help

R Risack
  • 69
  • 8
  • Maybe some elements of the answer there? : https://stackoverflow.com/questions/3240421/mercurial-user-specific-ignore-file/3639390#3639390 – aflp91 May 24 '22 at 05:47
  • As far as I understood, this ignores files in total, which are not checked in. I want to ignore certain changes in files that are checked in. – R Risack May 24 '22 at 12:31
  • In fact, I'm wondering if the 'modern' way to manage this is not to use [hg phase](https://www.mercurial-scm.org/doc/hg.1.html#phase). – aflp91 May 25 '22 at 13:17

1 Answers1

1

You can use the secret hg phase for this.

  • commit your local changes
  • run hg phase -sf .

This will mark the current change secret. Secret changesets will not push.

A caveat with secret phases:

All secret changesets must always be on top of the stack. When you pull changes, you will need to rebase secret changes back to the top. This is typically as easy as hg rebase.

Craig
  • 756
  • 3
  • 8