views:

53

answers:

1

I create a "server" clone from a project hosted at code.google.com. I create a clone from that repository in my machine and push some changes; everything goes well.

Now the master repository has some changes and I want to pull them. How do I get my "server" clone updated with those changes?

+4  A: 
hg pull -u google_code_url

The -u means automatically update your working copy. You can set (if it's not already there) a default URL in the .hg/hgrc file:

[paths]
default = pull_url
default-push = push_url

Then, you can just do:

hg push
hg pull -u

Of course, you can still specify a different location manually.

Matthew Flaschen
I also find 'hg summary --remote' extremely useful
Jay Bazuzi
Even if that repository is not where I did my local copy ? Regular projects are like: http://code.google.com/p/someproject and my "server" clone is http://code.google.com/r/othername So, if I understood correctly doing: `hg pull -u http://code.google.com/p/someproject` will update my local project right?
OscarRyz
@Oscar, yes, you can pull from any clone, and if necessary it will prompt you to merge.
Matthew Flaschen
@Matthew, great, I just did it, thank you. Does hg pull brings the changes, but doesn't put them in my local copy? It didn't "prompt" to merge, just subtly suggested it :) BTW, I couldn't perform `hg incoming -u google_code_url` ( didn't accept -u to see the changes without downloading them ) So I had to change my `dafault` and then `hg pull` and put the original default again.
OscarRyz
@Oscar, yes, `hg pull` alone will modify your local repository, but not the actual files in your working copy. `incoming` doesn't have a `-u`. In fact, it doesn't ever modify your repository or working directory. It just tells you what's available.
Matthew Flaschen
Pull by default does not merge. You may get merge prompt if you specified -u and you have uncommitted changes.
Geoffrey Zheng
@Geoff, yes, that comment was in reference to the command Oscar posted, which has `-u`.
Matthew Flaschen