3

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?

mfloryan
  • 7,667
  • 4
  • 31
  • 44
OscarRyz
  • 196,001
  • 113
  • 385
  • 569

1 Answers1

6
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
  • 278,309
  • 50
  • 514
  • 539
  • 3
    I also find 'hg summary --remote' extremely useful – Jay Bazuzi Jul 08 '10 at 02:11
  • 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 Jul 08 '10 at 03:20
  • @Oscar, yes, you can pull from any clone, and if necessary it will prompt you to merge. – Matthew Flaschen Jul 08 '10 at 03:27
  • @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 Jul 08 '10 at 04:13
  • Pull by default does not merge. You may get merge prompt if you specified -u and you have uncommitted changes. – Geoffrey Zheng Oct 01 '10 at 12:40
  • @Geoff, yes, that comment was in reference to the command Oscar posted, which has `-u`. – Matthew Flaschen Oct 01 '10 at 14:59
  • I have just reviewed this answer, and I wish I could upvote it again :) – OscarRyz Dec 11 '10 at 05:49