CloudServices/Sync/FxSync/WarOnSpinningEventLoop: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
Line 66: Line 66:
The first time you do this, <tt>hg-git</tt> needs to create a bunch of files in <tt>.hg</tt>. This takes a long time. You might want to leave this up to the Merge Viking (rnewman), and simply do all of your work in Git. Or leave this running for a week!
The first time you do this, <tt>hg-git</tt> needs to create a bunch of files in <tt>.hg</tt>. This takes a long time. You might want to leave this up to the Merge Viking (rnewman), and simply do all of your work in Git. Or leave this running for a week!


A much better solution is to grab <tt>.hg/git-mapfile</tt> from an existing repository (e.g., ask rnewman), and clone a bare git repo next to it. This gives you
A much better solution is to grab <tt>.hg/git-mapfile</tt> from an existing repository (e.g., [http://people.mozilla.com/~rnewman/alder/ rnewman's]), and clone a bare git repo next to it. This gives you


   alder              # Hg repo
   alder              # Hg repo

Revision as of 02:51, 22 April 2011

Project branch

Mercurial

We have the project branch Alder until 2011-07-30:

https://wiki.mozilla.org/ReleaseEngineering/DisposableProjectBranches#BOOKING_SCHEDULE

This will give us tbpl and such. Hooray!

Cloning from your local s-c (much faster this way!):

 hg clone services-central alder
 # You'll need >| if you're using zsh.
 echo "[paths]\ndefault = ssh://hg.mozilla.org/projects/alder" > alder/.hg/hgrc
 echo "sc = ssh://hg.mozilla.org/services/services-central" >> alder/.hg/hgrc
 cd alder
 hg pull -u

Now you have an hg repo from which you can

 hg pull -u

to update from alder, and

 hg pull -u sc

to update from mainline s-c.

Git

We do our work in Git because it sucks less.

I assume you have parallel directories like ~/moz/hg and ~/moz/git.

Cloning:

 # Ask me (rnewman) to add you as a collaborator on GitHub, or 
 # fork my repo and clone your fork.
 cd ~/moz/git
 git clone git@github.com:rnewman/alder.git
 cd alder

Now you have a Git mirror of my alder repo, which I keep up to date from Mercurial as needed.

If you wish, you may link to your Mercurial alder repo. This is a two-step process:

  • Install hg-git.
  • Simply hg push and pull to the git repository directory.

You'll need these lines in your ~/.hgrc:

 [extensions]
 hgext.bookmarks =
 hggit =

Assuming that your Git version is ahead, because that's where you're working:

 # In Mercurial version.
 cd ~/moz/hg/alder
 hg bookmark -r default master        # Once.
 hg pull ../../git/alder

(Note that you can't push to your git repo, because it's not bare. Try it and read the warning. You can push to GitHub and pull, though.)

The first time you do this, hg-git needs to create a bunch of files in .hg. This takes a long time. You might want to leave this up to the Merge Viking (rnewman), and simply do all of your work in Git. Or leave this running for a week!

A much better solution is to grab .hg/git-mapfile from an existing repository (e.g., rnewman's), and clone a bare git repo next to it. This gives you

 alder              # Hg repo
   .hg
     git            # Git clone of alder git repo
     git-mappings   # Bookkeeping info

You can use an older set of mappings; just run hg gexport -v in the top-level Mercurial repo to update.

The quickest way to push to Git is to descend into .hg/git and use git push. Continue to use hg pull from either a Git repo or a Mercurial repo to bring changesets in.

Merging new work from Git back to Mercurial

So you have a Git feature branch, and you want to get it back into alder for TBPL and eventual merge into services-central. How?

We assume that alder itself plays the role of develop in the git-flow model. That means we're merging feature branches.

 git checkout master
 git merge --no-ff bug-123456-frobnicate           # Merge feature branch.
 git push origin master                            # Put master on GitHub.
 cd ../../hg/alder                                 # Switch to hg.
 hg pull git+ssh://git@github.com/rnewman/alder    # Treat like a pull from hg.
 # Merge etc. as necessary.
 hg push default                                   # Push to hg.m.o.

Merging upstream changes from Mercurial into Git

 hg pull -u default                                # Get our branch in order.
 hg pull -u sc                                     # Fetch new stuff from services-central.
 hg merge                                          # Execute a normal merge.
 hg commit -m "Merge services-central into alder."
 hg gexport                                        # Update the private git mirror.
 pushd .hg/git                                     # Push to GitHub.
 git push git+ssh://git@github.com/rnewman/alder
 popd
 cd ../../git/alder                                # Switch to git.
 git checkout master
 git pull origin master                            # Pull new changes from GitHub.
 # Rebase or merge branches as necessary.