Pushing Mercurial changesets from my local clone to "the real" clone?
I created a project at Google code, and am using Mercurial for it.
I made a clone of the project: farm-myclone
up on Google code.
I pull out a copy of farm-myclone
, and start adding files, modifying files, etc.
I use hg commit
, then hg push
to get changes back into my clone's repository.
Now I want to move these changes into the real repository, just named farm
.
Do I just do something like:
hg push [farm-myclone] to [farm]
so that whatever the state of my clone is gets pushed to the real clone?
Is that right? I'm an SVN user so this is a bit confusing to m开发者_C百科e.
Thanks
I think you've got one more clone than you actually need: You probably don't need "farm-myclone" to exist at all on Google Code.
If that main project is just called "farm", then when you run hg clone
to make a clone of it, you get a clone on your local machine. This clone is a full Mercurial repository in all respects. When you're ready to publish your changes for the rest of the world to see, use hg push
to push them up to the "farm" repository.
I think the presence of the additional "farm-myclone" repository is confusing the issue.
There is no syntax like the one you suggest -- may I ask where you got it from? I would love to improve the documentation, so please let us know (preferably on the Mercurial mailinglist) how we can improve the output of hg help push
.
As for your question, then I agree with Greg -- you seem to have an unneeded clone. Often, you'll only have a single other clone to push/pull from. When you do
hg clone http://example.org/foo foo-clone
then foo-clone
will have http://example.org/foo
as its default push/pull path. This means that a simple
hg pull
inside of foo-clone
is enough to pull the latest changes from http://example.org/foo
.
The default path is stored in foo-clone/.hg/hgrc
and you are welcome to add other paths and/or change the default. So the hgrc
file may look like this:
[paths] default = http://example.org/foo alice = http://other-domain.org/foo experiement = /home/me/foo-experiment
You can then use hg pull alice
to get her changes or hg push experiment
to push to your own local experimental clone.
These are just shortcuts, you can always push/pull using an explicit URL:
hg pull http://bobs-world.org/foo
works as well, if Bob has configured his webserver to serve a clone of the foo
repository.
I hope this helps a bit :-)
精彩评论