WormBase Source Code

From WormBaseWiki

Jump to: navigation, search

The WormBase source code is maintained using the distributed SCM system Mercurial. We use BitBucket.org as a convenient place to host the code and track issues:

http://bitbucket.org/tharris/wormbase/

Contents

Available Repositories

http://bitbucket.org/tharris/wormbase - The WormBase web application (public)

http://bitbucket.org/tharris/wormbase-admin - Administration code (private)

Get Mercurial

http://www.selenic.com/mercurial/wiki/

Set up your environment

Minimally, create a file at ~/.hgrc containing:

[ui]
username=First Last <email@example.net>

Checking out the code

The following examples all use Mercurial over http. You can also use mercurial over ssh.

cd ~/projects
$ hg clone http://bitbucket.org/tharris/wormbase/

Or via https:

$ hg clone https://username@bitbucket.org/tharris/wormbase

If checked out through http/https, you will be required to provide username/password when you do 'hg push'

Working With Mercurial

Be sure to see the excellent Mercurial reference text.

Joel Spolsky has written an excellent tutorial at hginit.com.

Here's a great tutorial on managing complex commits and merges using a triple-repository strategy. What follows is a distillation of this strategy.

Pulling in Changes and Updating in one step

$ hg pull -u 

Pushing Changes to the Repository

$ hg push

Suggested Work Strategy

As derived from:

http://blogs.sun.com/tor/entry/mercurial_tip_checking_in_regularly

Create two parallel repositories

remember to register ssh key in your bitbucket account first in order to use hg clone ssh. website-main and website-sync

% hg clone ssh://hg@bitbucket.org/tharris/wormbase/ website-main
% hg clone ssh://hg@bitbucket.org/tharris/wormbase/ website-sync
# (If you cloned your local repository, make sure that
#  website-sync points back to master)
% cp website-main/.hg/hgrc website-sync/.hg/hgrc
1. Work in website-main. Edit files at will,
   and check in logical changesets as needed(hg commit ...)

2. When you want to push a changeset, go to
   your sync clone, and pull your new changesets
   from your working clone:

        % cd ../website-sync
        % hg pull ../website-main && hg update

3. At this point, it's best to try a build/test
   as well, to make sure changeset is complete.
   If you're working on many things in parallel,
   it's possible that your changeset is depending
   on a change in a file you haven't checked in yet.


4. Now pull in the new changes from the master, and merge these:

        % hg fetch

   If don't have the fetch extension installed, do it manually

	% hg pull && hg merge && hg ci -m "Merge"

5. If something went wrong with the merge - no problem.
   You can just go and nuke the entire sync clone and try again!
   Your modified files, and your new changesets, are still
   sitting completely unaffected in the main clone. Just clone
   main again and try more carefully :)

6. Now you can push your merged changesets to the master repository:

         % hg push

7. ...and now you can pull these changes back into your main repository:

	% hg pull ../sync && hg update

= Reference: Migrating to Mercurial =

After creating the repository on BitBucket, I cloned it and populated with a exported version of source from SVN.

 $ hg clone http://bitbucket.org/harris/wormbase
 $ mv ~/wormbase.svn/* wormbase/.
 
 # Add and commit the files
 $ hg add
 $ hg commit -m 'Initial import of my old svn repository'
 
 # Push the changes back to BitBucket
 $ hg push


=Reference: Migrating to git=

Global setup:

  Download and install Git: http://git-scm.com/download
  git config --global user.name "Your Name"
  git config --global user.email info@tharris.org
        

Next steps:

  mkdir wormbase-app
  cd wormbase-app
  git init
  touch README
  git add README
  git commit -m 'first commit'
  git remote add origin git@github.com:tharris/wormbase-app.git
  git push origin master
      

Existing Git Repo?

  cd existing_git_repo
  git remote add origin git@github.com:tharris/wormbase-app.git
  git push origin master
      

Importing a SVN Repo?

  Click here
      

When you're done:

  Continue
Personal tools