Contaminação mercurial em siris e caranguejos da baía de ...
Mercurial for Kittens
-
Upload
nya3jp -
Category
Technology
-
view
823 -
download
1
description
Transcript of Mercurial for Kittens
Mercurial for KittensShuhei Takahashi<[email protected]>
Mercurial
Features
Simple design Decentralized system High performance Extensible framework
Outline
History model Basic operations
History model
Checking out Mercurial repo
$ hg clone http://example.com/hg exampleupdating to branch default3 files updated, 0 files merged, 0 files removed,0 files unresolved$ ls -lA example/drwxr-xr-x 3 nya nya 4096 2011-05-22 20:59 .hg-rw-r--r-- 1 nya nya 14 2011-05-22 20:59 READMEdrwxr-xr-x 2 nya nya 4096 2011-05-22 20:59 src
Standard Mercurial repo
example/ .hg/ README src/ a.cc a.h
Working copy
Repository
Standard Mercurial repo
example/ .hg/ hgrc dirstate store/ ...
repo-local configworking copy statehistory
History.hg/
First commit
Implementing X Bugfix
Merge X
Implemented X
diff -r 000000... -r 39fca2... README--- /dev/null Thu Jan 01 00:00:00 1970 +0000+++ b/README Sun May 22 20:59:40 2011 +0900@@ -0,0 +1,1 @@+Hello, world!
Improve X
Commit
nodeid: 9e66e5ae2b...rev: 42branch: featureXauthor: "Shuhei Takahashi <[email protected]>"timestamp: 2011-06-02 11:59:28 +0900
implement feature X.
(patch...)
p1: 48334cb9e1... p2: 0000000000...
nodeid.hg/
4fcf85...
a87493... 048293...
384fca...
bcd055...8a9310...
SHA-1 hash Made from whole
commit information
parents (p1,p2).hg/
p1
p2
p1
p1
p1 p1
1 or 2 parents null = 000000...
rev.hg/
0
1 3
2
45
topological order no consistency
between repos just for
convenience!
branch.hg/
default
featureX default
featureX
defaultfeatureX
default is "default" all commits have
their branch name(c.f. git)
Notes for Git users
Different concept of branchesAll commits have their branch name
No reachability checkhg log shows all commits
Commits cannot be amended or erased (usually)
Commit
nodeid: 9e66e5ae2b...rev: 42branch: defaultauthor: "Shuhei Takahashi <[email protected]>"timestamp: 2011-06-02 11:59:28 +0900
implement feature X.
(patch...)
p1: 48334cb9e1... p2: 0000000000...
Referring commits
rev nodeid branch name
... commit in the branch with the largest rev "tip"
... commit in any branch with the largest rev "null" ... root commit tag
Referring commits
3 tip default featureX
.hg/
default
featureX
0
1 3
2
45
Basic operations
Check out a revision
$ hg update 3
.hg/
0
1 3
2
45
Working Copy
Making commit.hg/
Working Copy
$ hg add hoge.txt... edit working copy ...
Making commit .hg/Working Copy
$ hg commit
Making branch.hg/
default
featureX default
featureX
featureX
Working Copy
default
default
$ hg update default
Making branch.hg/
default
featureX default
featureX
featureX
Working Copy
default
release
$ hg branch release
Making branch.hg/
default
featureX default
featureX
featureX
Working Copy
default $ hg commit
release
Pulllocal remote
hg pull
Pushlocal remote
hg push
Pull / Push
Just makes union of two history graphs Merge operation is never performed
(c.f. Git) Can specify subgraph by a list of heads
Merge - "healthy" branch
One head per branches
default
featureX
Merge - "unhealthy" branch
"default" branch has two heads - multiple heads
Branch tip varies by rev order!
Push that will end up with multiple heads is rejected
default
?
?
Merge
default0
12
3
Checked out rev. 1 Pulled rev. 2, 3,
resulting multiple heads (1, 3)
Merge
default0
12
3
hg merge 3 Working copy now has
two parents (1, 3) Not yet committed!
hg merge is forbidden if WC has pending changes
p1
p2
Merge
default0
12
3
hg commit
p1
p2
4
More fun stuff
hgweb.cgi Extensions
Mercurial queue (MQ)Rebase...
Hooks Mercurial as a Python module
References
Mercurial: The Definitive GuideChapter 4. Behind the scenes
google:///hgbook or available from O'reilly