SlideShare uma empresa Scribd logo
1 de 75
Baixar para ler offline
Mercurial

A Distributed Source Management
              System
資工人:
寫程式,
改程式...
改錯了?!
本來會動,現在不會動。
備份!
COPY…
改之前 copy 一份起來
COPY…
 改錯了 copy 回來
COPY?!
 錯的蓋掉對的!
更慘的..
專案
大家
一起寫
共用
程式碼
一起寫?
Pair Programming
不可能
COPY
 ZIP / RAR
網芳 / E-mail
網芳 / E-mail
UnZIP / UnRAR
    COPY
噩夢
你改,
他也改…
改了
哪裡?
沒人知道…:P
還是
噩夢
救星:
版本
控制
誤刪?
歷史
紀錄
程式碼
整合?
自動
合併
標示
衝突
</噩夢>
有名的:
CVS
有人用過嗎?
Subversion
  (SVN)
   應該有用過吧?
美好世界?
Client-Server
    Centralized
Client:
專用Client
 (GUI)
  WinCVS
開發環境
  整合
Eclipse, NetBeans, Vim, …
作業系統
 整合
 TotoriseSVN
Server:
http://
  svn://
svn+ssh://
   眼花撩亂…
權限
控管
麻煩
又是
噩夢
沒網路…
死
一人
專案
Server?
  多此一舉…
Local
Repository
   獨立的目錄
仍然是
 噩夢
救星:
似曾相識…
分散式
版本控制
後 subversion 時代
自掃
門前雪
熱門的
• SVK
   – Based on Subversion

• Mercurial (Hg)
   – Python
   – Mozilla, NetBeans, OpenJDK

• Git
   – C
   – Linux kernel, Ruby / Rails

• Bazzar (bzr)
   – Python
Mercurial
   回歸主題
汞 Hg
執行檔就叫 “hg”
第一步
• 建立新專案
 – cd project/
 – hg init
 – [hg add]

• 目錄
 – 工作目錄: project/
 – 檔案庫位置: project/.hg
基本指令
       檔案管理                  檢視修改狀況
• 加入新的檔案                • 顯示更動狀態
 – hg add [FILE …]       – hg status [FILE …]

• 移除檔案                  • 查看檔案內容變更
 – hg remove [FILE …]    – hg diff [-r REV] [FILE …]

• 改名                    • 檢視更新紀錄
 – hg rename OLD NEW     – hg log
                         – hg glog (樹狀圖)
送交修改
• 送交修改
 – hg commit [FILE …]

• 放棄修改 (工作目錄)
 – hg revert [FILE …]

• 還原最近一次修改 (檔案庫)
 – hg rollback
分支 (Branch)
• 建立新的分支
 – hg branch BRANCH_NAME

• 在分支中切換
 – hg update -r BRANCH_NAME
 – 預設分支: “default”

• 列出所有分支
 – hg branches
標記、標籤 (Tag)
• 建立新的標記
 – hg tag TAG_NAME

• 在分支中切換
 – hg update -r TAG_NAME

• 列出分支
 – hg tags
版本概念
多人合作
• 公開檔案庫 (HTTP)
  – hg serve

• 抓取已經存在的檔案庫內容
  – hg clone EXIST_REP project/

• EXIST_REP 格式:
  – http[s]://server/project
  – svn://server/path/to/project
  – [file://]path/to/project
多人合作
• 送出你的 (檔案庫) 修改
 – hg push REMOTE

• 抓取後續的 (檔案庫) 變更
 – hg pull REMOTE

• 更新工作目錄 (與檔案庫同步)
 – hg update [-r REV]

• 合併更動 (到工作目錄)
 – hg merge [-r REV]
分散式架構
檔案庫合併 (前)
檔案庫合併 (中)
檔案庫合併 (後)
工具
• Mercurial Windows Installer
  – http://mercurial.berkwood.com/

• Mercurial Eclipse
  – http://www.vectrace.com/mercurialeclipse/

• TotoriseHg
  – http://www.selenic.com/mercurial/wiki/index.c
    gi/Mercurial
TotoriseHg (1)
TotoriseHg (2)
更多資料
• 官方網站
  – http://www.selenic.com/mercurial/

• Cheat Sheet (小抄)
  – http://www.ivy.fr/mercurial/ref/v1.0/
The End

Any Question?

Mais conteúdo relacionado

Mais procurados

DS-041-產品研究與發展
DS-041-產品研究與發展DS-041-產品研究與發展
DS-041-產品研究與發展handbook
 
تمرينات مقدمة في البرمجة
تمرينات مقدمة في البرمجةتمرينات مقدمة في البرمجة
تمرينات مقدمة في البرمجةنوافذ حاسوبية
 
블로그기반 출판(중국어)
블로그기반 출판(중국어)블로그기반 출판(중국어)
블로그기반 출판(중국어)JIAQI NIE
 
Programming言語Lua紹介(Internet版)
Programming言語Lua紹介(Internet版)Programming言語Lua紹介(Internet版)
Programming言語Lua紹介(Internet版)zetamatta
 
جمعية الروضة
جمعية الروضةجمعية الروضة
جمعية الروضةsameh sameh
 
Mercurial&OnenoteServer
Mercurial&OnenoteServerMercurial&OnenoteServer
Mercurial&OnenoteServerKeisuke Hata
 
Pums perumanadu,pudukkottai
Pums perumanadu,pudukkottaiPums perumanadu,pudukkottai
Pums perumanadu,pudukkottaidesigntn
 
Web Accessibility
Web  AccessibilityWeb  Accessibility
Web Accessibilitychihchia
 
Drupal - 教育網路中心課程
Drupal - 教育網路中心課程Drupal - 教育網路中心課程
Drupal - 教育網路中心課程Charles Chuang
 
331 Ch
331 Ch331 Ch
331 Chanjaan
 
胸腔胃-气道瘘:经鼻空肠营养管和胃减压管置入治疗--申
胸腔胃-气道瘘:经鼻空肠营养管和胃减压管置入治疗--申胸腔胃-气道瘘:经鼻空肠营养管和胃减压管置入治疗--申
胸腔胃-气道瘘:经鼻空肠营养管和胃减压管置入治疗--申baiyunguofeng
 

Mais procurados (20)

DS-041-產品研究與發展
DS-041-產品研究與發展DS-041-產品研究與發展
DS-041-產品研究與發展
 
Oblove200712 Lt
Oblove200712 LtOblove200712 Lt
Oblove200712 Lt
 
تمرينات مقدمة في البرمجة
تمرينات مقدمة في البرمجةتمرينات مقدمة في البرمجة
تمرينات مقدمة في البرمجة
 
블로그기반 출판(중국어)
블로그기반 출판(중국어)블로그기반 출판(중국어)
블로그기반 출판(중국어)
 
Sputter
SputterSputter
Sputter
 
Programming言語Lua紹介(Internet版)
Programming言語Lua紹介(Internet版)Programming言語Lua紹介(Internet版)
Programming言語Lua紹介(Internet版)
 
جمعية الروضة
جمعية الروضةجمعية الروضة
جمعية الروضة
 
Mercurial&OnenoteServer
Mercurial&OnenoteServerMercurial&OnenoteServer
Mercurial&OnenoteServer
 
中国网络审查
中国网络审查中国网络审查
中国网络审查
 
Mini Proposal Km2.0 200905
Mini Proposal Km2.0 200905Mini Proposal Km2.0 200905
Mini Proposal Km2.0 200905
 
Pums perumanadu,pudukkottai
Pums perumanadu,pudukkottaiPums perumanadu,pudukkottai
Pums perumanadu,pudukkottai
 
Web Accessibility
Web  AccessibilityWeb  Accessibility
Web Accessibility
 
EndNote 與碩士論文寫作
EndNote 與碩士論文寫作EndNote 與碩士論文寫作
EndNote 與碩士論文寫作
 
A la nanita pdf
A la nanita pdfA la nanita pdf
A la nanita pdf
 
Personal knowledge management
Personal knowledge managementPersonal knowledge management
Personal knowledge management
 
Drupal - 教育網路中心課程
Drupal - 教育網路中心課程Drupal - 教育網路中心課程
Drupal - 教育網路中心課程
 
331 Ch
331 Ch331 Ch
331 Ch
 
kirthana
kirthanakirthana
kirthana
 
Mazay Week
Mazay WeekMazay Week
Mazay Week
 
胸腔胃-气道瘘:经鼻空肠营养管和胃减压管置入治疗--申
胸腔胃-气道瘘:经鼻空肠营养管和胃减压管置入治疗--申胸腔胃-气道瘘:经鼻空肠营养管和胃减压管置入治疗--申
胸腔胃-气道瘘:经鼻空肠营养管和胃减压管置入治疗--申
 

Destaque

How to Use Tortoisehg
How to Use TortoisehgHow to Use Tortoisehg
How to Use TortoisehgVeronica Lin
 
Mercurial簡介與教學
Mercurial簡介與教學Mercurial簡介與教學
Mercurial簡介與教學芳本 林
 
Introduction to git
Introduction to gitIntroduction to git
Introduction to gitBo-Yi Wu
 
工程師必備第一工具 - Git
工程師必備第一工具 - Git工程師必備第一工具 - Git
工程師必備第一工具 - GitAlan Tsai
 
Mercurial training
 Mercurial training Mercurial training
Mercurial trainingTrung Huynh
 
Mercurial DVCS presentation to DevJam 11/4/2009
Mercurial DVCS presentation to DevJam 11/4/2009Mercurial DVCS presentation to DevJam 11/4/2009
Mercurial DVCS presentation to DevJam 11/4/2009Ted Naleid
 
Git與source tree 基礎教學
Git與source tree 基礎教學Git與source tree 基礎教學
Git與source tree 基礎教學Duncan Chen
 
git merge 與 rebase 的觀念與實務應用
git merge 與 rebase 的觀念與實務應用git merge 與 rebase 的觀念與實務應用
git merge 與 rebase 的觀念與實務應用Will Huang
 
Svn vs mercurial vs github
Svn  vs  mercurial vs  githubSvn  vs  mercurial vs  github
Svn vs mercurial vs githubVinoth Kannan
 
Visual Studio 2015 與 Git 開發實戰
Visual Studio 2015 與 Git 開發實戰Visual Studio 2015 與 Git 開發實戰
Visual Studio 2015 與 Git 開發實戰Will Huang
 
Types Of Join In Sql Server - Join With Example In Sql Server
Types Of Join In Sql Server - Join With Example In Sql ServerTypes Of Join In Sql Server - Join With Example In Sql Server
Types Of Join In Sql Server - Join With Example In Sql Serverprogrammings guru
 
SQL Joins and Query Optimization
SQL Joins and Query OptimizationSQL Joins and Query Optimization
SQL Joins and Query OptimizationBrian Gallagher
 

Destaque (20)

How to Use Tortoisehg
How to Use TortoisehgHow to Use Tortoisehg
How to Use Tortoisehg
 
Mercurial簡介與教學
Mercurial簡介與教學Mercurial簡介與教學
Mercurial簡介與教學
 
Introduction to git
Introduction to gitIntroduction to git
Introduction to git
 
工程師必備第一工具 - Git
工程師必備第一工具 - Git工程師必備第一工具 - Git
工程師必備第一工具 - Git
 
Mercurial training
 Mercurial training Mercurial training
Mercurial training
 
Virt monitoring
Virt monitoringVirt monitoring
Virt monitoring
 
Mercurial DVCS presentation to DevJam 11/4/2009
Mercurial DVCS presentation to DevJam 11/4/2009Mercurial DVCS presentation to DevJam 11/4/2009
Mercurial DVCS presentation to DevJam 11/4/2009
 
Mercurial
MercurialMercurial
Mercurial
 
Git與source tree 基礎教學
Git與source tree 基礎教學Git與source tree 基礎教學
Git與source tree 基礎教學
 
git merge 與 rebase 的觀念與實務應用
git merge 與 rebase 的觀念與實務應用git merge 與 rebase 的觀念與實務應用
git merge 與 rebase 的觀念與實務應用
 
Puppet_training
Puppet_trainingPuppet_training
Puppet_training
 
Svn vs mercurial vs github
Svn  vs  mercurial vs  githubSvn  vs  mercurial vs  github
Svn vs mercurial vs github
 
Visual Studio 2015 與 Git 開發實戰
Visual Studio 2015 與 Git 開發實戰Visual Studio 2015 與 Git 開發實戰
Visual Studio 2015 與 Git 開發實戰
 
Git Tutorial 教學
Git Tutorial 教學Git Tutorial 教學
Git Tutorial 教學
 
Sql joins
Sql joinsSql joins
Sql joins
 
Types Of Join In Sql Server - Join With Example In Sql Server
Types Of Join In Sql Server - Join With Example In Sql ServerTypes Of Join In Sql Server - Join With Example In Sql Server
Types Of Join In Sql Server - Join With Example In Sql Server
 
SQL Joins
SQL JoinsSQL Joins
SQL Joins
 
SQL Joins and Query Optimization
SQL Joins and Query OptimizationSQL Joins and Query Optimization
SQL Joins and Query Optimization
 
Sql joins
Sql joinsSql joins
Sql joins
 
SQL JOIN
SQL JOINSQL JOIN
SQL JOIN
 

Mercurial 簡介