Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I prevent mercurial from pushing subrepos?

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?

like image 691
Soviut Avatar asked May 31 '11 00:05

Soviut


1 Answers

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.

like image 73
Ry4an Brase Avatar answered Oct 17 '22 03:10

Ry4an Brase