Download presentation
Presentation is loading. Please wait.
1
Chimera (08.09.09)
2
Системы Контроля Версий
3
Revision Control Контроль версий – процесс управления множественными версиями некоторого документа или документов. Множество имен: – Revision Control (RCS) – Software Configuration Management (SCM) – Source Code Management – Source Code Control or Source Control – Version Control (VCS)
4
Так или иначе, это используют все Но у многих это вызывает головную боль: – MyProject1 – MyProject.backup – MyProject.old – MyProject.oldest – … Используйте адекватные задаче инструменты!
5
Плюсы Отслеживает все изменения в проекте. Для каждого изменения известно: – Кто его сделал? – Зачем? – Когда? – Что именно было изменено? Упрощает совместную разработку.
6
Плюсы (продолжение) Помогает справиться с ошибками: – Всегда можно вернуться назад во времени – Поможет эффективно идентифицировать момент, когда была внесена ошибка Помогает одновременно работать над несколькими версиями проекта.
7
Базовые понятия Repository Working copy Revision (changeset) Tag Trunk (default branch) Branch Check in (commit) Check out (update)
8
Что такое репозиторий?
9
VCS vs. DVCS VCS – CVS – Subversion – Perforce DVCS – Git – Mercurial – Bazaar
10
Mercurial
11
Quick start! Cloning existing project $ hg clone http://selenic.com/hg mercurial-repo … $ cd mercurial-repo $ hg parents changeset: 6907:6dcbe191a9b5 tag: tip user: Matt Mackall date: Mon Aug 18 16:50:36 2008 -0500 summary: Fix up tests
12
Quick start! Setting up new project $ cd project/ $ hg init# creates.hg … # edit.hgignore $ hg status # show all non-ignored files $ hg add # add those 'unknown' files $ hg commit # commit all changes $ hg parents # see the current revision
13
Quick start! Sharing the changes $ hg pull # update an existing repo $ hg serve -n “My repo”# export your current repo via # HTTP with browsable # interface on port 8000 $ hg push# push changes to a remote repo
14
Quick start! Getting help and info $ hg version $ hg help # list subcommands $ hg help init # get help on init subcommand $ hg help -v init # get even more info $ hg log # view revision history $ hg parents # view working dir parents $ hg status # view working dir file status
15
Репозиторий, номера ревизий
16
Что почитать дальше? http://mercurial.selenic.com/wiki/ – http://mercurial.selenic.com/wiki/QuickStart – http://mercurial.selenic.com/wiki/Tutorial http://hgbook.red-bean.com/read/
17
Mercurial Tutorial
18
Step 1. Installation Install mercurial – $ apt-get install mercurial – $ emerge mercurial And confirm the installation – $ hg version – version should be above 1.1
19
Step 2. Generating auth keys Run: – $ ssh-keygen – this will generate two files: ~/.ssh/id_rsa - your private key ~/.ssh/id_rsa.pub - your public key Share generated public keys with me – for example, place the key into /tmp/ / on parallels.nsu.ru server
20
Step 3. Customize Mercurial I will add your public keys as trusted ones on server with repository – this will take several moments… Meanwhile please setup your ~/.hgrc # This is a Mercurial configuration file. [ui] username = Firstname Lastname
21
Step 4. Clone the repo It’s easy: – $ hg clone ssh://hg@10.3.61.99/chimera work Let’s see what’s inside: – $ cd work/ – $ ls -al – $ hg log – $ hg log -v -r 3 # -r 1 -r 4 # -r 2:3 # -r 82e5 # – $ hg parents
22
Step 5. Fix the bug Try to compile the project – $ make Fix the bug by editing hello.c Commit changes – $ hg status # review your changes – $ hg commit # don’t forget sensible comment! – $ hg tip# here’s our commit
23
Step 6. Put changes back to server First, receive possible changes from server! – $ hg incoming # see what will be pulled – $ hg pull Update / resolve conflicts / do nothing – $ hg update # if working copy has no uncommited # changes – $ hg heads# otherwise you end up with 2+ heads – $ hg merge# merge them, then commit! Push merged changes back to server – $ hg push
24
Hm…
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.