git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCHv2 0/3] New test cases for branch detection
@ 2012-05-26  9:56 Vitor Antunes
  2012-05-26  9:56 ` [PATCHv2 1/3] git-p4: Test changelists touching two branches Vitor Antunes
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Vitor Antunes @ 2012-05-26  9:56 UTC (permalink / raw
  To: git; +Cc: Pete Wyckoff, Luke Diamand, Vitor Antunes

Updates for previous patch according to feedback from Pete Wyckoff (and
some help from Junio). I also tried to find more improvement
opportunities and included an extra small patch with two small fixes.

Please review and provide feedback.

Kind regards.

Vitor Antunes (3):
  git-p4: Test changelists touching two branches
  git-p4: Verify detection of "empty" branch creation
  git-p4: Clean up branch test cases

 t/t9801-git-p4-branch.sh |  110 ++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 107 insertions(+), 3 deletions(-)

-- 
1.7.7.rc2.14.g5e044.dirty

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCHv2 1/3] git-p4: Test changelists touching two branches
  2012-05-26  9:56 [PATCHv2 0/3] New test cases for branch detection Vitor Antunes
@ 2012-05-26  9:56 ` Vitor Antunes
  2012-05-26  9:56 ` [PATCHv2 2/3] git-p4: Verify detection of "empty" branch creation Vitor Antunes
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Vitor Antunes @ 2012-05-26  9:56 UTC (permalink / raw
  To: git; +Cc: Pete Wyckoff, Luke Diamand, Vitor Antunes

It is possible to modify two different branches in P4 in a single
changelist. git-p4 correctly detects this and commits the relevant
changes to the different branches separately. This test proves that and
avoid future regressions in this behavior.

Signed-off-by: Vitor Antunes <vitor.hda@gmail.com>
---
 t/t9801-git-p4-branch.sh |   52 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 52 insertions(+), 0 deletions(-)

diff --git a/t/t9801-git-p4-branch.sh b/t/t9801-git-p4-branch.sh
index 2859256..0ae8607 100755
--- a/t/t9801-git-p4-branch.sh
+++ b/t/t9801-git-p4-branch.sh
@@ -306,6 +306,58 @@ test_expect_success 'git p4 clone complex branches' '
 	)
 '
 
+# Move branch3/file3 to branch4/file3 in a single changelist
+test_expect_success 'git p4 submit to two branches in a single changelist' '
+	(
+		cd "$cli" &&
+		p4 integrate //depot/branch3/file3 //depot/branch4/file3 &&
+		p4 delete //depot/branch3/file3 &&
+		p4 submit -d "Move branch3/file3 to branch4/file3"
+	)
+'
+
+# Confirm that changes to two branches done in a single changelist
+# are correctly imported by git p4
+test_expect_success 'git p4 sync changes to two branches in the same changelist' '
+	test_when_finished cleanup_git &&
+	test_create_repo "$git" &&
+	(
+		cd "$git" &&
+		git config git-p4.branchList branch1:branch2 &&
+		git config --add git-p4.branchList branch1:branch3 &&
+		git config --add git-p4.branchList branch1:branch4 &&
+		git config --add git-p4.branchList branch1:branch5 &&
+		git p4 clone --dest=. --detect-branches //depot@all &&
+		git log --all --graph --decorate --stat &&
+		git reset --hard p4/depot/branch1 &&
+		test_path_is_file file1 &&
+		test_path_is_file file2 &&
+		test_path_is_file file3 &&
+		grep update file2 &&
+		git reset --hard p4/depot/branch2 &&
+		test_path_is_file file1 &&
+		test_path_is_file file2 &&
+		test_path_is_missing file3 &&
+		! grep update file2 &&
+		git reset --hard p4/depot/branch3 &&
+		test_path_is_file file1 &&
+		test_path_is_file file2 &&
+		test_path_is_missing file3 &&
+		grep update file2 &&
+		git reset --hard p4/depot/branch4 &&
+		test_path_is_file file1 &&
+		test_path_is_file file2 &&
+		test_path_is_file file3 &&
+		! grep update file2 &&
+		git reset --hard p4/depot/branch5 &&
+		test_path_is_file file1 &&
+		test_path_is_file file2 &&
+		test_path_is_file file3 &&
+		! grep update file2 &&
+		test_path_is_missing .git/git-p4-tmp
+	)
+'
+
 test_expect_success 'kill p4d' '
 	kill_p4d
 '
-- 
1.7.7.rc2.14.g5e044.dirty

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCHv2 2/3] git-p4: Verify detection of "empty" branch creation
  2012-05-26  9:56 [PATCHv2 0/3] New test cases for branch detection Vitor Antunes
  2012-05-26  9:56 ` [PATCHv2 1/3] git-p4: Test changelists touching two branches Vitor Antunes
@ 2012-05-26  9:56 ` Vitor Antunes
  2012-05-26  9:56 ` [PATCHv2 3/3] git-p4: Clean up branch test cases Vitor Antunes
  2012-05-26 14:00 ` [PATCHv2 0/3] New test cases for branch detection Pete Wyckoff
  3 siblings, 0 replies; 5+ messages in thread
From: Vitor Antunes @ 2012-05-26  9:56 UTC (permalink / raw
  To: git; +Cc: Pete Wyckoff, Luke Diamand, Vitor Antunes

Current implementation of new branch parent detection works on the
principle that the new branch is a complete integration, with no
changes, of the original files.
This test shows this deficiency in the particular case when the new
branch is created from a subset of the original files.

Signed-off-by: Vitor Antunes <vitor.hda@gmail.com>
---
 t/t9801-git-p4-branch.sh |   54 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 54 insertions(+), 0 deletions(-)

diff --git a/t/t9801-git-p4-branch.sh b/t/t9801-git-p4-branch.sh
index 0ae8607..308b123 100755
--- a/t/t9801-git-p4-branch.sh
+++ b/t/t9801-git-p4-branch.sh
@@ -358,6 +358,60 @@ test_expect_success 'git p4 sync changes to two branches in the same changelist'
 	)
 '
 
+# Create a branch by integrating a single file
+test_expect_success 'git p4 file subset branch' '
+	(
+		cd "$cli" &&
+		p4 integrate //depot/branch1/file1 //depot/branch6/file1 &&
+		p4 submit -d "Integrate file1 alone from branch1 to branch6"
+	)
+'
+
+# Check if git p4 creates a new branch containing a single file,
+# instead of keeping the old files from the original branch
+test_expect_failure 'git p4 clone file subset branch' '
+	test_when_finished cleanup_git &&
+	test_create_repo "$git" &&
+	(
+		cd "$git" &&
+		git config git-p4.branchList branch1:branch2 &&
+		git config --add git-p4.branchList branch1:branch3 &&
+		git config --add git-p4.branchList branch1:branch4 &&
+		git config --add git-p4.branchList branch1:branch5 &&
+		git config --add git-p4.branchList branch1:branch6 &&
+		git p4 clone --dest=. --detect-branches //depot@all &&
+		git log --all --graph --decorate --stat &&
+		git reset --hard p4/depot/branch1 &&
+		test_path_is_file file1 &&
+		test_path_is_file file2 &&
+		test_path_is_file file3 &&
+		grep update file2 &&
+		git reset --hard p4/depot/branch2 &&
+		test_path_is_file file1 &&
+		test_path_is_file file2 &&
+		test_path_is_missing file3 &&
+		! grep update file2 &&
+		git reset --hard p4/depot/branch3 &&
+		test_path_is_file file1 &&
+		test_path_is_file file2 &&
+		test_path_is_missing file3 &&
+		grep update file2 &&
+		git reset --hard p4/depot/branch4 &&
+		test_path_is_file file1 &&
+		test_path_is_file file2 &&
+		test_path_is_file file3 &&
+		! grep update file2 &&
+		git reset --hard p4/depot/branch5 &&
+		test_path_is_file file1 &&
+		test_path_is_file file2 &&
+		test_path_is_file file3 &&
+		! grep update file2 &&
+		git reset --hard p4/depot/branch6 &&
+		test_path_is_file file1 &&
+		test_path_is_missing file2 &&
+		test_path_is_missing file3
+	)
+'
 test_expect_success 'kill p4d' '
 	kill_p4d
 '
-- 
1.7.7.rc2.14.g5e044.dirty

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCHv2 3/3] git-p4: Clean up branch test cases
  2012-05-26  9:56 [PATCHv2 0/3] New test cases for branch detection Vitor Antunes
  2012-05-26  9:56 ` [PATCHv2 1/3] git-p4: Test changelists touching two branches Vitor Antunes
  2012-05-26  9:56 ` [PATCHv2 2/3] git-p4: Verify detection of "empty" branch creation Vitor Antunes
@ 2012-05-26  9:56 ` Vitor Antunes
  2012-05-26 14:00 ` [PATCHv2 0/3] New test cases for branch detection Pete Wyckoff
  3 siblings, 0 replies; 5+ messages in thread
From: Vitor Antunes @ 2012-05-26  9:56 UTC (permalink / raw
  To: git; +Cc: Pete Wyckoff, Luke Diamand, Vitor Antunes

Correct submit description in one test and remove not required commands
from another.

Signed-off-by: Vitor Antunes <vitor.hda@gmail.com>
---
 t/t9801-git-p4-branch.sh |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/t/t9801-git-p4-branch.sh b/t/t9801-git-p4-branch.sh
index 308b123..99fe16b 100755
--- a/t/t9801-git-p4-branch.sh
+++ b/t/t9801-git-p4-branch.sh
@@ -218,7 +218,7 @@ test_expect_success 'git p4 clone simple branches' '
 		cd branch1 &&
 		p4 edit file2 &&
 		echo file2_ >>file2 &&
-		p4 submit -d "update file2 in branch3" &&
+		p4 submit -d "update file2 in branch1" &&
 		cd "$git" &&
 		git reset --hard p4/depot/branch1 &&
 		git p4 rebase &&
@@ -249,8 +249,6 @@ test_expect_success 'git p4 clone simple branches' '
 #   `- file2
 #   `- file3
 test_expect_success 'git p4 add complex branches' '
-	test_when_finished cleanup_git &&
-	test_create_repo "$git" &&
 	(
 		cd "$cli" &&
 		changelist=$(p4 changes -m1 //depot/... | cut -d" " -f2) &&
-- 
1.7.7.rc2.14.g5e044.dirty

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCHv2 0/3] New test cases for branch detection
  2012-05-26  9:56 [PATCHv2 0/3] New test cases for branch detection Vitor Antunes
                   ` (2 preceding siblings ...)
  2012-05-26  9:56 ` [PATCHv2 3/3] git-p4: Clean up branch test cases Vitor Antunes
@ 2012-05-26 14:00 ` Pete Wyckoff
  3 siblings, 0 replies; 5+ messages in thread
From: Pete Wyckoff @ 2012-05-26 14:00 UTC (permalink / raw
  To: Vitor Antunes; +Cc: git, Luke Diamand

vitor.hda@gmail.com wrote on Sat, 26 May 2012 10:56 +0100:
> Updates for previous patch according to feedback from Pete Wyckoff (and
> some help from Junio). I also tried to find more improvement
> opportunities and included an extra small patch with two small fixes.
> 
> Please review and provide feedback.

These all look great to me, including the new fixes.

Acked-by: Pete Wyckoff <pw@padd.com>

		-- Pete

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-05-26 14:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-26  9:56 [PATCHv2 0/3] New test cases for branch detection Vitor Antunes
2012-05-26  9:56 ` [PATCHv2 1/3] git-p4: Test changelists touching two branches Vitor Antunes
2012-05-26  9:56 ` [PATCHv2 2/3] git-p4: Verify detection of "empty" branch creation Vitor Antunes
2012-05-26  9:56 ` [PATCHv2 3/3] git-p4: Clean up branch test cases Vitor Antunes
2012-05-26 14:00 ` [PATCHv2 0/3] New test cases for branch detection Pete Wyckoff

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).