Mercurial 版本管理系統與 Google Code 網路服務

Mercurial

簡介

安裝

使用

log 紀錄

指令

網路服務

訊息

相關網站

參考文獻

最新修改

簡體版

English

簡介

在 Google Code 上提供了兩種版本管理軟體,第一種是集中式的 SVN (SubVersion),第二種是分散式的 Mercurial (Hg),本文使用 Mercurial 進行示範。

向 Google 申請專案

首先您必須先向 Google 申請一個專案,以下是筆者的申請過程,請參考。

1. 進入 Google Code

GoogleCode1.jpg

2. 點選專案託管

GoogleCode2.jpg

3. 點選貢獻開放原始碼

GoogleCode3.jpg

4. 建立專案並填入基本資料

GoogleCode4.jpg

5. 專案建立完成

GoogleCode5.jpg

6. 點選 source,看看專案網址與下載指令

GoogleCode6.jpg

7. 點選 GoogleCode.com password 看看專案密碼

GoogleCode7.jpg

將 Mercurial 的專案上傳到 Google Code

D:\hg\ss0>hg push https://ss0.googlecode.com/hg/
pushing to https://ss0.googlecode.com/hg/
searching for changes
http authorization required
realm: Google Code Mercurial Repository
user: ccckmit
password:
remote: Success.

上傳成功後您可以用瀏覽器在 Google Code 的專案網址上,看看上傳的檔案,確認是否已經全部都上完畢了,以下是筆者上傳後的檔案清單畫面。

GoogleCodeAfterPush.jpg

從 Google Code 下載 Mercurial 專案

一但您成功的將 Mercurial 專案上傳 (push) 到 Google Code 上,當然就可以透過 Mercurial 的 clone 指令將該專案下載到另一個專案中,以下是筆者將 ss0 專案下載到 ss0clone 的過程。

D:\hg>hg clone https://ss0.googlecode.com/hg/ ss0clone
requesting all changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 73 changes to 73 files
updating to branch default
73 files updated, 0 files merged, 0 files removed, 0 files unresolved

D:\hg>dir
 磁碟區 D 中的磁碟沒有標籤。
 磁碟區序號:  AC7E-23A4

 D:\hg 的目錄

2010/08/19  上午 08:58    <DIR>          .
2010/08/19  上午 08:58    <DIR>          ..
2010/08/18  上午 11:39                91 Mercurial.ini
2010/08/18  上午 11:42    <DIR>          my-hello
2010/08/18  上午 11:29    <DIR>          ss0
2010/08/19  上午 08:58    <DIR>          ss0clone
               1 個檔案              91 位元組
               5 個目錄   6,606,843,904 位元組可用

D:\hg>dir ss0clone
 磁碟區 D 中的磁碟沒有標籤。
 磁碟區序號:  AC7E-23A4

 D:\hg\ss0clone 的目錄

2010/08/19  上午 08:58    <DIR>          .
2010/08/19  上午 08:58    <DIR>          ..
2010/08/19  上午 08:58    <DIR>          .hg
2010/08/19  上午 08:58             2,874 Array.c
2010/08/19  上午 08:58               977 Array.h
2010/08/19  上午 08:58             9,583 Array.o
2010/08/19  上午 08:58               414 ArraySum.asm0
2010/08/19  上午 08:58                76 ArraySum.obj0
2010/08/19  上午 08:58            93,515 as0.exe
2010/08/19  上午 08:58            11,154 Assembler.c
2010/08/19  上午 08:58             2,539 Assembler.h
2010/08/19  上午 08:58            16,885 Assembler.o
2010/08/19  上午 08:58            93,515 c0c.exe
2010/08/19  上午 08:58               578 Compiler.c
2010/08/19  上午 08:58               122 Compiler.h
2010/08/19  上午 08:58             5,657 Compiler.o
2010/08/19  上午 08:58             9,770 Cpu0.c
2010/08/19  上午 08:58             2,536 Cpu0.h
2010/08/19  上午 08:58            12,053 Cpu0.o
2010/08/19  上午 08:58                75 Exp.asm0
2010/08/19  上午 08:58             1,442 for2.asm0
2010/08/19  上午 08:58               121 for2.c0
2010/08/19  上午 08:58               176 for2.obj0
2010/08/19  上午 08:58            18,124 Generator.c
2010/08/19  上午 08:58             2,412 Generator.h
2010/08/19  上午 08:58            17,260 Generator.o
2010/08/19  上午 08:58             2,892 HashTable.c
2010/08/19  上午 08:58               559 HashTable.h
2010/08/19  上午 08:58             9,765 HashTable.o
2010/08/19  上午 08:58                49 LD.asm0
2010/08/19  上午 08:58             3,325 Lib.c
2010/08/19  上午 08:58             1,629 Lib.h
2010/08/19  上午 08:58            11,624 Lib.o
2010/08/19  上午 08:58            93,515 m0.exe
2010/08/19  上午 08:58             1,410 Machine0.c
2010/08/19  上午 08:58               319 Machine0.h
2010/08/19  上午 08:58             6,723 Machine0.o
2010/08/19  上午 08:58             4,309 main.c
2010/08/19  上午 08:58             7,228 main.o
2010/08/19  上午 08:58             1,500 Makefile
2010/08/19  上午 08:58             1,735 Makefile.win
2010/08/19  上午 08:58             1,459 OpTable.c
2010/08/19  上午 08:58             1,250 OpTable.h
2010/08/19  上午 08:58             7,636 OpTable.o
2010/08/19  上午 08:58             1,777 os0.asm0
2010/08/19  上午 08:58             1,838 os0.asm0.bak.txt
2010/08/19  上午 08:58               338 os0.obj0
2010/08/19  上午 08:58             1,873 os0v1.asm0
2010/08/19  上午 08:58             1,777 os0v2.asm0
2010/08/19  上午 08:58            12,033 Parser.c
2010/08/19  上午 08:58               922 Parser.h
2010/08/19  上午 08:58            17,793 Parser.o
2010/08/19  上午 08:58             4,450 Scanner.c
2010/08/19  上午 08:58               752 Scanner.h
2010/08/19  上午 08:58             8,943 Scanner.o
2010/08/19  上午 08:58             1,021 square_sum.asm0
2010/08/19  上午 08:58                84 square_sum.c0
2010/08/19  上午 08:58               128 square_sum.obj0
2010/08/19  上午 08:58             3,914 SS0.dev
2010/08/19  上午 08:58             1,993 SS0.layout
2010/08/19  上午 08:58               135 ss0.txt
2010/08/19  上午 08:58               164 sum.asm0
2010/08/19  上午 08:58                70 sum.c0
2010/08/19  上午 08:58                48 sum.obj0
2010/08/19  上午 08:58                48 sumi.obj0
2010/08/19  上午 08:58               186 sum_old.asm0
2010/08/19  上午 08:58               781 test.asm0
2010/08/19  上午 08:58               445 test.c0
2010/08/19  上午 08:58            93,515 test.exe
2010/08/19  上午 08:58             1,736 Test.layout
2010/08/19  上午 08:58                96 test.obj0
2010/08/19  上午 08:58               751 test1.asm0
2010/08/19  上午 08:58             1,489 Tree.c
2010/08/19  上午 08:58               289 Tree.h
2010/08/19  上午 08:58             6,830 Tree.o
2010/08/19  上午 08:58            93,515 vm0.exe
              73 個檔案         718,519 位元組
               3 個目錄   6,606,843,904 位元組可用

結語

只要您會使用 Mercurial,那麼上傳到 Google Code 是非常簡單的,只要使用 hg push https://<project>.googlecode.com/hg/ 的動作,然後輸入 google 的帳號與該專案的專屬密碼,即可完成將專案上傳到 google code 的動作。

然後,您可以使用 hg clone https://<project>.googlecode.com/hg/ <toProject> 的指令,將該專案下載到 <toProject> 專案中,繼續進行程式開發的動作。

Facebook

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License