Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

КонстрПЗ_ПI_ЛР2014_ч2

.pdf
Скачиваний:
4
Добавлен:
07.02.2016
Размер:
2.18 Mб
Скачать

21

2 P G G G P 2

G O n G o

G p. MERCURIAL

2.1 #

5 -

0 , 0 0 0

0 Mercurial.

2.2 "$ # # S$ %$. 1$

#1 "# % Z %#$Z1 ( . Version Control System, VCS Revision Control System) – - e 0 * K0. ?

K , -

, e , , -

e e.

2 0 -

. & e K e 0 '-

, 0 e -

e

*.

K e -

0 0 Mercurial.

2.2.1 O S "

@ 0 0 Mercurial K

0 hg. „ K Gui-

K, K i , i i

0K, - K K0 0 0 .

> K0 0 0 , e,

K 0 ' *-

. A , ,

~/repos/hgproject, :

> hg init

22

0 «hg init» Mercurial 0K -

. x i – ' -

«.hg», K .

@ , 0 ' ' ,

, K

0 0 , 0,

i

. A , e

, ~/projects.

< ' .

0 - e . A ~/projects K-

:

> hg clone ~/repos/hgproject

0 «hg clone» Mercurial «K» , - e 0 0 . &

«K» , i, i 0 - 0 0 . < , '

0 . @ K-

' - K,

,

~/repos/hgproject " ".

2.2.2 G ! / " /^ 1 # ! $q1

& K 0 0 .

0 - *

, readme.txt, e-

*. < , K * ,

. & ,

* , i Mercurial

, *

:

> hg status ? readme.txt

Mercurial , i * readme.txt,

* K 0 ( «?» -

*). 0 status Mercurial -

23

. A , i Mercurial, i 0 (

0) :

> hg add

adding readme.txt

2 i :

> hg status A readme.txt

x , * ' «4»,

K i * readme.txt 0

* ( ), K 0 -

0:

> hg commit

Mercurial

. x , -

' . &

:

> hg log

0:8fae369766e9

changeset:

tag:

tip

user:

mike@mike-notebook

date:

Fri Nov 27 08:58:01 2009 +0300

summary:

Œ+05 readme.txt S/S+*и0 Q .G3/Yи-/.‘0

>, i Mercurial . Changeset

K , K :

( «:») * (sha1-e). @-

e ' -

, - 0 0 . 4,

K - * ', ' -, i K . - * 4-5 e * *. ;-

«tag: tip», tip – ,

K -

. K .

2.2.3 %$ %$. 1$ #%$!$r % Mercurial

x e 0 0 ,

Mercurial K , K changeset. '

24

* 0 0 '

' ,

0 . 5 ' -

- K *, Mercurial 40-Š sha1-e, K . < -

, ' -

*.

2.2.4 1$ ! %$.. /# 1 # ! $Z1

x i, « »

, K K

. & ,

' . A , i

, e ~/repos/hgproject , -

:

> hg push

pushing to ~/repos/hgproject searching for changes adding changesets

adding manifests adding file changes

added 1 changesets with 1 changes to 1 files

& K , * -

, * 0 ' . A

' i , , - K Mercurial. A '

, , ~/projects/hgproj_clone, -

:

>hg clone ~/repos/hgproject ~/projects/hgproj_clone updating working directory

1 files updated, 0 files merged, 0 files removed, 0 files unresolved

' *,

, other.txt 0 - . 2

, i:

>hg status ? other.txt

>hg add

adding other.txt > hg commit

 

25

> hg log

1:270e49e72f4b

changeset:

tag:

tip

user:

mike@mike-notebook

date:

Fri Nov 27 10:39:35 2009 +0300

summary:

f+3и,+* N+05 other.txt X S.QP/2 .G3/Yи-/.ии

changeset:

0:8fae369766e9

user:

mike@mike-notebook

date:

Fri Nov 27 08:58:01 2009 +0300

summary:

Œ+05 readme.txt S/\+X5G* X .G3/Yи-/.и0

' , i ' ,

, , ,

e 0 push. < '

i K 0:

> hg outgoing

comparing with ~/repos/hgproject searching for changes

changeset:

1:270e49e72f4b

 

tag:

tip

 

user:

mike@mike-notebook

+0300

date:

Fri Nov 27 10:39:35 2009

summary:

f+3и,+* N+05 other.txt X

S.QP/2 .G3/Yи-/.ии

0 hg outgoing Mercurial , K

, K « ». < ' , i ' , « »

' :

> hg push

pushing to ~/repos/hgproject searching for changes adding changesets

adding manifests adding file changes

added 1 changesets with 1 changes to 1 files

< , « . <

, . A

e ,

~/projects/hgproject, :

> hg incoming

comparing with ~/repos/hgproject searching for changes changeset: 1:270e49e72f4b

tag: tip

user: mike@mike-notebook

26

date:

Fri Nov

27 10:39:35 2009

+0300

summary:

f+3и,+*

N+05 other.txt X

S.QP/2 .G3/Yи-/.ии

/ «hg incoming» K , K

, . 4 ' '

, :

> hg pull

pulling from ~/repos/hgproject searching for changes

adding changesets adding manifests adding file changes

added 1 changesets with 1 changes to 1 files (run 'hg update' to get a working copy)

/ «hg pull» ' K ,

K , , « » -

i . 4 e

, e 0. A

, i 0,

:

> hg update

1 files updated, 0 files merged, 0 files removed, 0 files unresolved

x i , K

~/projects/hgproj_clone, i

K .

< , 0 0 -

0 , i ’ , -

0 K 0

' , i K-

i (commit-push/pull-update). < -

K , -, , , .

2.2.5 G !] / s# Z #1$ " /2 %#$3 Mercurial

e

, – ' . > e * 2 . & e -

', e , i 0K Mercurial –

' ' . ? K, -

27

K *, , (

) * " " -

. 0K 0 -

, ‹> B3. ' , i

' , -

" ". ? K -

, i .

A * first.txt e , -

:

$ echo "new text to first.txt" > first.txt $ hg status

? first.txt

$ hg add first.txt $ hg commit

$ hg outgoing

comparing with /home/mike/Repositories/newProject searching for changes

changeset:

2:66c5686e355e

tag:

tip

user:

mike@mike-vbox

date:

Thu Jan 07 22:28:39 2010 +0300

summary:

^/22и- N+05+ first.txt X 3G.X/2 .G3/Yи-/.ии

$ hg push

 

pushing to /home/mike/Repositories/newProject searching for changes

adding changesets adding manifests adding file changes

added 1 changesets with 1 changes to 1 files

4 0K 0, ' , i

0 , e K-

Mercurial,

0. A

*. ; '

, K Mercurial.

$ echo "file created in second repository" > second.txt $ hg status

? second.txt $ hg add

adding second.txt $ hg commit

$ hg log

changeset: 2:6872fa960507

 

28

tag:

tip

user:

mike@mike-vbox

date:

Sun Jan 10 19:40:45 2010 +0300

summary:

Œ+05 second.txt ,/YS+* X/ X-/./2 .G3/Yи-/-

.ии

 

changeset:

1:270e49e72f4b

user:

mike@mike-notebook

date:

Fri Nov 27 10:39:35 2009 +0300

summary:

f+3и,+* N+05 other.txt X S.QP/2 .G3/Yи-/.ии

changeset:

0:8fae369766e9

user:

mike@mike-notebook

date:

Fri Nov 27 08:58:01 2009 +0300

summary:

Œ+05 readme.txt S/\+X5G* X .G3/Yи-/.и0

< , ' K ,

0 " " , 0 -

, K. - 0

', , K

. A e

" " .

$ hg outgoing

comparing with /home/mike/Repositories/newProject searching for changes

changeset:

2:6872fa960507

tag:

tip

user:

mike@mike-vbox

date:

Sun Jan 10 19:40:45 2010 +0300

summary:

Œ+05 second.txt ,/YS+* X/ X-/./2 .G3/Yи-/-

.ии

 

$ hg push

pushing to /home/mike/Repositories/newProject searching for changes

abort: push creates new remote heads!

(did you forget to merge? use push -f to force)

< , Mercurial K e, K, i push

. 2 -

K 'K . A -

.

$ hg incoming

comparing with /home/mike/Repositories/newProject searching for changes

changeset: 2:66c5686e355e

29

tag:

tip

 

user:

mike@mike-vbox

+0300

date:

Thu Jan 07 22:28:39 2010

summary:

^/22и- N+05+ first.txt X

3G.X/2 .G3/Yи-/.ии

$ hg pull

pulling from /home/mike/Repositories/newProject searching for changes

adding changesets adding manifests adding file changes

added 1 changesets with 1 changes to 1 files (+1 heads) (run 'hg heads' to see heads, 'hg merge' to merge)

" " , Mercuial K, i " ",

0 (' to merge). '

, i Mercurial ( - K graphlog), i K e -

.

$ hg glog

3:66c5686e355e

 

 

 

o

changeset:

 

 

 

|

tag:

tip

 

 

 

|

parent:

1:270e49e72f4b

 

 

 

|

user:

mike@mike-vbox

 

 

 

|

date:

Thu Jan 07 22:28:39 2010 +0300

.G3/Yи-

|

summary:

^/22и- N+05+ first.txt

X

3G.X/2

-/.ии

 

 

 

 

 

|

changeset:

2:6872fa960507

 

 

 

| @

 

 

 

|/

user:

mike@mike-vbox

 

 

 

|

date:

Sun Jan 10 19:40:45 2010 +0300

 

|

summary:

Œ+05 second.txt ,/YS+* X/ X-/./2 .G3/-

Yи-/.ии

 

 

 

 

 

|

changeset:

1:270e49e72f4b

 

 

 

o

 

 

 

|

user:

mike@mike-notebook

 

 

 

|

date:

Fri Nov 27 10:39:35 2009 +0300

.G3/Yи-

|

summary:

f+3и,+* N+05 other.txt

X

S.QP/2

-/.ии

 

 

 

 

 

|

changeset:

0:8fae369766e9

 

 

 

o

 

 

 

 

user:

mike@mike-notebook

 

 

 

 

date:

Fri Nov 27 08:58:01 2009 +0300

 

 

summary:

Œ+05 readme.txt S/\+X5G* X .G3/Yи-/.и0

30

; " " K 0, i . 5 0

. '

.

$ hg merge

files merged, 0 files removed, 0

1 files

updated, 0

files unresolved

 

(branch merge, don't forget to commit)

$ ls

other.txt

readme.txt second.txt

first.txt

< , Mercurial, "hg merge" 'K -

0 , K, i -.

$ hg commit $ hg glog

@changeset: 4:6d6c634e2e20

|\

tag:

tip

| |

parent:

2:6872fa960507

| |

parent:

3:66c5686e355e

| |

user:

mike@mike-vbox

| |

date:

Sun Jan 10 20:34:21 2010 +0300

| |

summary:

dR3/5*G* 2G.T SXQn XG-/1

| |

changeset:

3:66c5686e355e

| o

| |

parent:

1:270e49e72f4b

| |

user:

mike@mike-vbox

| |

date:

Thu Jan 07 22:28:39 2010 +0300

| |

summary:

^/22и- N+05+ first.txt X 3G.X/2 .G3/Yи-/.ии

| |

changeset:

2:6872fa960507

o |

|/

user:

mike@mike-vbox

|

date:

Sun Jan 10 19:40:45 2010 +0300

|

summary:

Œ+05 second.txt ,/YS+* X/ X-/./2 .G3/Yи-/.ии

|

changeset:

1:270e49e72f4b

o

|

user:

mike@mike-notebook

|

date:

Fri Nov 27 10:39:35 2009 +0300

|

summary:

f+3и,+* N+05 other.txt X S.QP/2 .G3/Yи-/.ии

|

changeset:

0:8fae369766e9

o

 

user:

mike@mike-notebook

 

date:

Fri Nov 27 08:58:01 2009 +0300

 

summary:

Œ+05 readme.txt S/\+X5G* X .G3/Yи-/.и0

; , K Mercurial , i '

K. < ' , i -

" ", e. @ Mercrurial

' e , i . < '