Here are the constraints that govern what you can push:
- you can only push whole changesets -- if you commit some changes together it's all or none on the pushing front, you can't break up a changeset after you commit it
- you can't push a changeset without pushing all of it ancestor changesets to
So once you've committed a linear history like this:
[0]---[1]----[2]-----[3]
you can push changesets zero and one without pushing two and three, but if you want to push two you also have to push zero and one.
And if changeset one contains changes to both /MyProject/OtherStuff and /MyProject/MySharedLib/ you have to push those together.
Your only flexibility comes before you commit where you can control:
- what goes into a changeset
- what the parents of a changeset are (which also have to be pushed with it)
So if your history currently looks like this:
[0]---[1]
and hg status
is showing something like this:
M MyProject/OtherStuff/file1
M MyProject/OtherStuff/file2
M MyProject/MySharedLib/file3
M MyProject/MySharedLib/file4
Then you want to make a new changeset that has only the changes for MySharedLib that you want to push:
hg commit --include MyProject/MySharedLib
making your history look like:
[0]----[1]-----[2]
and then, before you commit the changes in OtherStuff you don't want to push you do a hg update
to change the current parent
revision so that your new changeset will have a parent of one instead of two:
hg update 1
Now when you do:
hg commit
your new changeset, three, will have only the non-MySharedLib changes and a parent of one, so you history will look like this:
[0]-----[1]--------[2]
\
--------[3]
Since two and three aren't one another's ancestors you can push either one without pushing the other.
That said, omnifarious is right: your usage isn't just weird, it's out and out wrong. You should look at a subrepo setup. It almost certainly achieves your goals better than what you or I have just described.