새 파일을 추가하고 이전 파일의 복사본으로 표시합니다. 파일이 사본이기 때문에 원본 파일의 변경 사항이 사본으로 병합됩니다. 시간은 왼쪽에서 오른쪽으로 흐름 :
(init) --- (edit a.txt) ---- (a.txt edit is copied to b.txt)
\ /
(hg copy a.txt b.txt)
- 은 우리의 경우에 대한 '잘못된 일이 (TM)을'어떻게 밝혀지면, 어떻게 다른 파일의 복사본을 beeing는 같은 파일 지움 I에게 을 ?
이 메커니즘은 병합 할 때만 시작됩니다. 위의 그래프에서 공통 조상 수정 기호에 b.txt
이 없으면 Mercurial은 을 검색하여 b.txt
이 다른 곳에서 복사되었는지 확인합니다.
은 우리가 축약 된 형태로 위의 그래프를 계속하자 :
(i) -- (edit a) -- (a edit copied to b) -- (edit a) -- (merge)
\ / /
(copy a b) --/------- (edit b) ------------------/
문제는 최종 병합을 수행하는 방법이다. 공통 조상 지점 은 이제 copy a b
노드이고 여기에서 a
과 b
이 모두 있습니다. 즉, 사본을 검색하지 않아도되는 을 의미합니다! 따라서 두번째 편집은 a
이 아니며 은 b
으로 병합됩니다. 이중 확인하려면
, 나는 그것을 밖으로 시도 :
$ hg init
$ echo a > a
$ hg add a
$ hg commit -m init
$ hg copy a b
$ hg commit -m "copy a b"
이
은 사본이었다
b
는 이제
a
이 포함되어 있습니다.
$ hg update 0
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
$ echo aa >> a
$ hg commit -m "edit a"
created a new head
$ hg merge
merging a and b to b
0 files updated, 1 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ hg commit -m "a edit copied to b"
이
첫 번째 병합했고
a
에 편집
b
에 복사되었습니다
는
$ cat b
a
aa
우리는 지금 병렬로 변경합니다
$ echo aaa >> a
$ hg commit -m "edit a again"
$ hg update 3
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ echo bbb >> b
$ hg commit -m "edit b"
created new head
$ hg merge
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
짓을 더 이상 복사가 없습니다 :
$ cat a
a
aa
aaa
$ cat b
a
aa
bbb
이것을 사용 중지하는 경우 ... 실제로 복사를 명시 적으로 사용 중지 할 수 없습니다. 그러나 위의 그림을 보여주기를 희망하기 때문에 첫 번째 병합 후에 다시 을 "괴롭히지"않을 것입니다.
첫 번째 병합에 문제가있는 경우 병합을 시작하기 전에 hg resolve --tool internal:local
을 사용하여 파일을 해당 상태로 다시 설정할 수 있습니다.
$ hg resolve --tool internal:local b
으로 우리는 단지 a
하나 개의 라인을 포함하는 다시 b
을 가져왔다 수 있도록.
[Mercurial : The Definitive Guide]의 [파일 복사] (http://tortoisehg.bitbucket.org/hgbook/1.7/mercurial-in-daily-use.html#chap:daily.copy)도 읽을 수 있습니다. ] (http://tortoisehg.bitbucket.org/hgbook/1.7/) 책. – Matus