3
  1. I have create a local directory, and made some sub-directories and file in it.
  2. registered by project on code.google.com/hosting
  3. install Mercurial and did hg init
  4. copied the auto-generated password from Google, still don't know for what.

Now how do i upload files my local to the repository on Google. Tired googling a lot, almost all the information is available for SVN users.

Do i have to create a branch on mercurial first. I am sorry if it is too silly, but how do I create one, the site does say anything create or upload or add.

Can anyone please share, how he started/uploaded his project?

Martin Geisler
  • 1,271
  • 9
  • 23
Vivek Sharma
  • 465
  • 2
  • 5
  • 14

3 Answers3

3

pgs is entirely correct. When you create a project at Google (or other hosting services), they will create a repository for you. You need to copy over your code, add it / commit (after tweaking .hgignore, of course!) and hg commit -Am "Inintial checkin of project"

If you try to push another repository that you create to Google, it will not work. This is because your newly created repository is not related to (derived from) the one that Google created for you. Since you don't have CLI access to Google, you can't do the usual work-around for unrelated pulls by cherry picking particular revisions.

This is frustrating when you already have a repository with history. In that case, you have to clone the empty Google repo, then hg pull (path / url to your repo) to get your revisions, then commit, then push. Good luck with that if you have extensive branches, be sure you have no unresolved heads before you push to Google.

This is why I host my own hg repos on my own site, much less hassle.

Martin Geisler
  • 1,271
  • 9
  • 23
Tim Post
  • 1,515
  • 13
  • 25
  • @tinkertim-- what is .hgignore for? Have you used wiki feature of googlecode locally for your any of your project, and pushed it to code.google. If yes then is there any wikiSyntax-toolbarAttached-editor available for working on wiki entries – Vivek Sharma Jul 10 '09 at 17:59
  • @Vivek Sharma-- .hgignore is a file that tells Mercurial to ignore certain types of files described by expressions or a simple glob. I.e., you would want *.o *.out *~ *.rej in that file, so you don't acciddentally commit rubbish files. – Tim Post Jul 11 '09 at 03:28
  • I can't answer about Google Code (because I don't use it), but I can upload my repositories quite easily to bitbucket. Whenever I create a new project/repository at bitbucket, it is created empty. Since it is empty, it "hasn't born" yet, and thus will accept my local repository. – Denilson Sá Maia Apr 08 '10 at 06:53
  • You can always push into an empty repository such as the one Google Code makes for you when you create a new repository on their site. Use `hg push URL` or edit the `.hg/hgrc` file first to update the `default` path there and use `hg push`. – Martin Geisler Dec 18 '11 at 10:54
2

Actually, you can push into a Google Code repository without having to clone from it first. Either just do hg push http://$projectname.googlecode.com/hg from the local repo, or edit your .hg/hgrc and add a section like this:

[paths]
default = http://$projectname.googlecode.com/hg

and then run hg push as usual.

durin42
  • 241
  • 1
  • 2
2

From reading the help pages, I think you need to go to your project's Source page and clone the repository (instead of hg init). Then I believe you can checkin code, and hg push it up to google.

pgs
  • 3,471
  • 18
  • 19
  • thanks pgs, for reading the pages and telling me. As i using any VCS/SCM for the first i could not related it. thanks indeed. – Vivek Sharma Jul 10 '09 at 16:46