How can I make "commit" abort if there are uncommitted subrepo changes in Mercurial?

Go To StackoverFlow.com

3

This seems to happen all the time to me: I work on the parent repo. I find and fix a bug in a subrepo. I carry on with parent repo work. I commit the parent repo with a message like "Added feature X". I push.

At this point I notice that the subrepo bugfix got committed and pushed too, with a commit message that has absolutely nothing to do with the subrepo.

What’s the easiest way to make myself a "commit" replacement which would refuse to do anything in this situation, pointing out that a subrepo has uncommitted changes? Alternatively, perhaps there’s a setting I can put in my .hgrc?

2012-04-04 22:16
by Roman Starkov


7

You have two options:

  1. Upgrade your Mercurial instalation to 2.0 or later
  2. Edit your ~/.hgrc file and add the following option to the [ui] section:

    commitsubrepos = false
    
2012-04-04 23:42
by C2H5OH
The ui.commitsubrepos config setting was introduced in Mercurial 1. - Tim Henigan 2012-04-05 12:13
Nice! I googled enough to have convinced myself that there’s no built-in way for this.. - Roman Starkov 2012-04-05 13:02
Ads