Services/Sync/Getting Started

From MozillaWiki
Jump to navigation Jump to search

Using Bugzilla

Every code change starts out as a bug in bugzilla where the general approach can be discussed. The bug should eventually be assigned to somebody who will upload one or more patches for review. Code can only be reviewed by module owners and their peers, see code review policy for more information. If the review has been granted and all review comments have been addressed, the patches may be checked into fx-sync. Note that other repositories such as mozilla-central may have additional procedures (e.g. you need to request approval in addition to review.)

Using Mercurial

Mozilla's development process is very much patch driven. Mercurial Patch Queues, although a bit awkward to use at times, fit this process rather well. It is recommended you familiarize yourself with them and use them.

Configuration

Marco Bonardo has some general purpose tips for Mozilla developers on how to format patches before uploading them to Bugzilla.

Essentially it is recommended you put the following in your ~/.hgrc:

 [ui]
 username = Your Name <you@mozilla.com>
 
 [extensions]
 hgext.mq = 
 
 [diff]
 git = 1
 unified = 8
 
 [defaults]
 diff = -pU8
 qdiff = -pU8
 qnew = -U
 qseries = -sv

Repositories

fx-sync

Sync is primarily developed in the fx-sync repository. Things that live there:

  • The Services client libraries in services/crypto/ and services/sync.
  • The Firefox Sync add-on in addon/*
  • The Firefox 3.x and Fennec 1.x UIs for the Sync add-on in ui/*

mozilla-central

mozilla-central is the repository for Firefox and the base repository for other Mozilla-based applications. How mozilla-central is relevant to Sync:

  • The client library is periodically merged from fx-sync to mozilla-central.
  • The integrated UI for Firefox Sync lives in browser/base/*, along with the rest of the Firefox UI.

Merging fx-sync to mozilla-central

Often it's convenient to merge fx-sync to mozilla-central yourself so you can develop on an up-to-date version of Sync within mozilla-central (and of course if you actually want to push new Sync changes to mozilla-central. Just note that you almost certainly want a tracking bug for this.)

Steps to perform for the merge:

  1. You need a patched version of Mercurial, so get a checkout of Mercurial's source, apply Mardak's keep-rename patch, and build Mercurial.
  2. Check out a clean copy of fx-sync.
  3. Export the repository to something we can import into mozilla-central with
    cd fx-sync
    tools/convert.sh
    This creates a new repository next to the existing checkout called fx-sync.converted
  4. Check out or update a copy of mozilla-central and do
    cd mozilla-central
    hg pull -f --branch=default .../fx-sync.converted
  5. Merge the newly created head with
    hg merge
  6. Commit the merge with
    hg commit
    Don't forget to reference the tracking bug if you intend to push this to mozilla-central

If you want to update such a repository with new revisions from mozilla-central, you can of course just merge them in. But if you want to keep a straight history timeline (e.g. because you want to push later), you can do this:

  1. Remove the merge revision (assuming that's the current tip, so qpop all applied mq patches first):
    hg strip tip
  2. Pull updates from mozilla-central:
    hg pull -u
  3. Merge fx-sync revisions back in (<rev> is the tip revision of the fx-sync.converted repository):
    hg merge <rev>
    hg commit

Try server

TODO