In my repository I've added several sub-repositories for modules that I'm using. I'm always going to treat these subrepos as "pull only". I don't plan to make any changes to them but want to retain the ability to easily pull new changes if a new version is released.
When I push the main repository, Mercurial tries to push the sub-repositories. Is there any setting to prevent this?
There are a few things you can do, depending on which behavior you're looking for.
Are you actually editing and committing inside the subrepo? If so, you should create a separate vendor-branch-like repo where you merge your changes with the upstream ("their") changes, and have your subrepo point to that. Something like this perhaps:
repos
main
subrepo
.hgsub # contains: "subrepo=../theirproject"
theirproject # clone of remote, upstream repo
The idea being that the subrepo entry not point directly to the pull-only upstream repo, but to one of your own where you merge your changes with "theirs"
Another option is to stop making changes in the subrepo. If there are no changes, and no commits, then push will pass that repo right by. If you switch to that work mode you can set the commitsubrepos = false
in the [ui]
section in a hgrc file to avoid accidentally committing in that repo.
The bottom line is that if you're changing things in there then you need to commit them (for safety!) and if you're commit them then they'll be pushed if the parent is pushed, so just control to where they're pushed and you're good to go.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With