使用CVS獲取Mozilla源代碼

Tips: This document descibes how to get source code for older versions of the code, Gecko 1.9.0, Firefox 3 or earlier, and older versions of NSS and NSPR. Development for Gecko 1.9.1/Firefox 3.5 and beyond, and recent versions of NSS and NSPR, uses the Mercurial source code control system.

到 七月 2015, 在Mozilla 上CVS 服務不會有長時間的操作.為訪問CVS 存檔, 請看 the blog post 宣告改變.

那些正在進行積極開發的人可以使用 CVS 查看最新的源代碼。如果您計劃提供補丁並修復錯誤,這是最好的方法,因為它可以讓您獲得最新的更新並將它們與您自己的更改合併。

如果要編譯產品以供發布,通常下載 Mozilla 源代碼 tarball

開始

CVS 表示 “並發版本控制系統”。要了解有關 CVS 的更多信息,請訪問

支持文檔

所有人可以檢查 (也被認爲是 "拉" 或是 "下載") 通過 CVS, 但只有一個確定的人擁有能力記錄 (創建改變, 也被認爲是 "提交"). 那些人是模塊所有人以及他們的代表. 閲讀我們的檔案在 hacking mozilla 去找到怎樣獲得能力記錄. 你也許也想閲讀關於 通過SSH連接CVS.

必選

檢查原始碼需要運行 CVS 1.11 及其更新版本. CVS伺服器不適用于1.12.13 以及懸挂的替代結果, 雖然 1.12.9 知道如何工作. 而且, 你必須利用 GNU make 檢查以及構建 Mozilla. 沒有其他的 “make” 程式是可接受的. 在 Windows, mac 以及合格的 GNU 系統 (比如 GNU/Linux), 使用 "make" 運行 GNU make; 在許多的 非 GNU unixes (比如 Solaris, etc.), 使用 "gmake".

CVS 用戶端設置

"cvsroot" (倉庫驗証字符串) 用於匿名訪問 Mozilla CVS 是

:pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot

如果你使用圖形化 CVS 用戶界面, 使用後面的服務器數據:

  • host: "cvs-mirror.mozilla.org"
  • repository path: "/cvsroot"
  • user: "anonymous"
  • connection type: pserver
  • port: default (2401)

選擇一個項目 Pull

由於幾個不同的應用程式是從一個相同的基礎源代碼構建而成, 你必須選擇哪一個程式在命令行上使用 MOZ_CO_PROJECT 變量來檢查. 當他將要檢查實際源代碼時, 信息需要支持。 (見適當的checkout section 之下, 你應該根據分支進行檢查). 可能性選項包括以下内容:

     检查以上所有项目的源代码,以及一些附加的实用程序代码

browser 
獨立的 ”Firefox" 瀏覽器
mail 
獨立的 “Thunderbird” 郵件/新聞 客戶端
suite 
傳統的 ”Mozilla“ SeaMonkey 瀏覽器套裝, 郵件/新聞, composer, 與其他應用程式.
minimo 
獨立的小設備瀏覽器.
composer 
獨立的 HTML composer.
calendar 
獨立的 "Sunbird" 日曆 應用.
xulrunner 
下一代 XUL 應用啓動器.
camino 
“Camino” Macintosh 本地瀏覽器
all 

Multiple projects can be specified with commas: MOZ_CO_PROJECT=suite,browser,xulrunner.

Note that if you are using a custom .mozconfig file, you can also specify MOZ_CO_PROJECT there, instead of including it on the command line.

Checking Out a New Source Tree

Check Tinderbox

Before pulling a tree, you should always check the appropriate Tinderbox to make sure that the codebase is not broken. If there are red tinderboxes, it is usually advisable to wait until they are green before pulling a tree.

Branch HEAD

To check out a new source tree from scratch, get the client.mk file which contains makefile instructions which are used to pull the rest of the tree:

$ cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot co mozilla/client.mk

Note: if you have already set up a .mozconfig file, you may also need to check out the following files:

Firefox 
cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot co mozilla/browser/config/mozconfig
Thunderbird 
cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot co mozilla/mail/config/mozconfig

註: The last version of Thunderbird on the HEAD was a post-3.0a2 nightly build. The last version of SeaMonkey on the HEAD was a 2.0a1pre nightly build. No further development of Thunderbird or SeaMonkey is taking place on the HEAD of CVS

Specific Branch

If you want to check out the source code of a specific CVS branch, use

$ cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot co -r BRANCH mozilla/client.mk

instead. To, for example, pull the Firefox 2.0/Thunderbird 2.0/SeaMonkey 1.1 development branch, replace BRANCH above with MOZILLA_1_8_BRANCH. For available branch tags in Mozilla, see CVS Tags.

The information on pulling project specific .mozconfig files as listed in the previous section apply to other branches than HEAD as well of course.

Checkout

After having chosen the correct branch, run:

$ cd mozilla
$ make -f client.mk checkout MOZ_CO_PROJECT=option,option

As mentioned above, if you are using a custom .mozconfig file where you have already specified the MOZ_CO_PROJECT variable, you do not need to repeat it here on command line.

Always use client.mk to checkout the Mozilla sources: do not check out the mozilla/ module directly. Various subprojects such as NSS, NSPR, and LDAP C SDK are pulled from stable release tags, even when regular mozilla development occurs on the trunk.

Specific Time

If you want to check out the source code as it was at a specific time you can use the MOZ_CO_DATE variable. For example MOZ_CO_DATE="20 Oct 2006 17:00 PDT".

This can either be added to your .mozconfig file, or specified on the command line, such as

$ cd mozilla
$ make -f client.mk checkout MOZ_CO_DATE="20 Oct 2006 17:00 PDT" MOZ_CO_PROJECT=option,option

Changing the Source Tree to a Different Branch

Branch HEAD

In order to update a source tree (be it branch HEAD or a specific branch) to latest branch HEAD, first run:

$ cd mozilla
$ cvs up -A client.mk

The -A option removes any "sticky branch" information, which leads to the effect that the tree is updated to HEAD.

Specific Branch

To update a source tree which was pulled from a specific branch, start with

$ cd mozilla
$ cvs up -r BRANCH client.mk

instead. Replace BRANCH by the tag of the branch you want to update.

Updating a Source Tree

To update your source tree simply do the following:

$ make -f client.mk checkout MOZ_CO_PROJECT=option,option

As always, if you use a custom .mozconfig file where MOZ_CO_PROJECT is already defined, you do not need to repeat it on command line.

Creating a Diff File

In order to create a diff of a single local file against the current file in the repository, use:

$ cvs diff -u8p FILENAME

See Creating a patch for more information.

Converting a Downloaded Source Tree

Downloaded source trees from mozilla.org (source tarballs) are already set up with CVS information, like a normal checkout. You can update these trees like normal trees to the latest code, without special action. See previous section on how to update a source tree.

interwiki link