2013-03-08 1 views
1

하자 말하자면, 버그 2와 버그 2가 있습니다.Mercurial 대기열을 사용하여 동시에 여러 패치를 사용하는 방법은 무엇입니까?

나는 bug1로 시작하여 그것을 고치기 시작하면서 bug2로 가서 반쯤 고쳐 쓴다.

나는 bug1로 돌아가서 다시 부분적으로 고쳐서 다시 bug2로 간다.

많은 전환 후, 나는 두 버그를 모두 수정했다.

이 두 버그를 모두 검토해야하는 사람들은 다르며 관련이없는 버그와는 관계가 없습니다. 그래서, 나는 그들에게 다른 패치를 제공해야한다. 나는 의욕 큐와 같은 어떻게해야합니까 bug1에 대한

hg diff -U 7 -p file1 -r OLD_REVISION_NUMBER > patch1 및 bug2

에 대한

hg diff -U 7 -p file2 -r OLD_REVISION_NUMBER > patch2 :

나는 일반 hg diff을 사용한 경우는, 내가했을 것? 기본 워크 플로를 제안하십시오.

답변

1

두 개의 겹치지 않는 패치를 가정 할 때 매우 간단한 워크 플로입니다. 즉 두 패치가 동일한 파일을 수정하지 않습니다.

$ hg init myrepo 
$ cd myrepo 
$ echo "This is file1" >file1 
$ echo "This is file2" >file2 
$ hg add 
adding file1 
adding file2 
$ hg commit -m 'initial files' 

# Initialize and work on patch1 

$ hg qnew -m 'Fix for bug1' patch1 
$ echo "a second line" >>file1 
$ hg diff 
diff --git a/file1 b/file1 
--- a/file1 
+++ b/file1 
@@ -1,1 +1,1 @@ 
-This is file1 
+a second line 
$ hg qdiff 
diff --git a/file1 b/file1 
--- a/file1 
+++ b/file1 
@@ -1,1 +1,1 @@ 
-This is file1 
+a second line 

# Update the current patch (patch1) 

$ hg qrefresh 
$ hg diff 
$ hg qdiff 
diff --git a/file1 b/file1 
--- a/file1 
+++ b/file1 
@@ -1,1 +1,1 @@ 
-This is file1 
+a second line 

# Initialize and work on patch2 

$ hg qnew -m 'Fix for bug2' patch2 
$ hg qseries 
patch1 
patch2 
$ hg qtop 
patch2 
$ hg diff 
$ echo 'another line for file2' >>file2 
$ hg diff 
diff --git a/file2 b/file2 
--- a/file2 
+++ b/file2 
@@ -1,1 +1,2 @@ 
This is file2 
+another line for file2 
$ hg qrefresh 
$ hg diff 
$ hg qdiff 
diff --git a/file2 b/file2 
--- a/file2 
+++ b/file2 
@@ -1,1 +1,2 @@ 
This is file2 
+another line for file2 

# Export patch2 

$ hg export qtip 
# HG changeset patch 
# User My Name <myemail> 
# Date 1362771912 28800 
# Node ID 2baa2bf81b000d4d720f9c4151242458b90bcd80 
# Parent ccd75363c8f459bec4a8d6b94dfb4150fb9e3014 
Fix for bug2 

diff --git a/file2 b/file2 
--- a/file2 
+++ b/file2 
@@ -1,1 +1,2 @@ 
This is file2 
+another line for file2 

# Pop back to and export patch1 

$ hg qpop 
popping patch2 
now at: patch1 
$ hg export qtip 
# HG changeset patch 
# User My Name <myemail> 
# Date 1362771745 28800 
# Node ID ccd75363c8f459bec4a8d6b94dfb4150fb9e3014 
# Parent a227e9c42f2d17fb28082ad2451a03d4926505ba 
Fix for bug1 

diff --git a/file1 b/file1 
--- a/file1 
+++ b/file1 
@@ -1,1 +1,1 @@ 
-This is file1 
+a second line 

# Resume working on patch2 

$ hg qpush 
applying patch2 
now at: patch2 
... 

# Apply patch1 to repo 

$ hg qpop 
popping patch2 
now at: patch1 
$ hg qfinish -a 
$ hg qseries 
patch2 
$ hg summary 
parent: 1:ccd75363c8f4 tip 
Fix for bug1 
branch: default 
commit: (clean) 
update: (current) 
mq:  1 unapplied 
$ hg qpush 
applying patch2 
now at: patch2 

의욕 대기열이 시리즈의 최신 패치가 이전 패치로 변경 사항을 수정할 수 있습니다 패치의 정렬 된 목록을 관리하도록 설계되어 있음을 유의하십시오. 현재 작업중인 프로젝트가 동일한 파일 세트에서 병렬 개발을 수행하는 경우 MQ를 사용하는 것이 가장 좋은 도구가 아닐 수 있습니다. 이 경우 책갈피가 있거나없는 Mercurial 지점 또는 Mercurial 익명 헤드를 사용해보십시오.