remote-helpers: test: cleanup style
So it's more standardized between all the tests. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
		
				
					committed by
					
						
						Junio C Hamano
					
				
			
			
				
	
			
			
			
						parent
						
							4080ac81e5
						
					
				
				
					commit
					dde67d794c
				
			@ -18,18 +18,23 @@ if ! python -c 'import bzrlib'; then
 | 
				
			|||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
check () {
 | 
					check () {
 | 
				
			||||||
	(cd $1 &&
 | 
						(
 | 
				
			||||||
 | 
						cd $1 &&
 | 
				
			||||||
	git log --format='%s' -1 &&
 | 
						git log --format='%s' -1 &&
 | 
				
			||||||
	git symbolic-ref HEAD) > actual &&
 | 
						git symbolic-ref HEAD
 | 
				
			||||||
	(echo $2 &&
 | 
						) > actual &&
 | 
				
			||||||
	echo "refs/heads/$3") > expected &&
 | 
						(
 | 
				
			||||||
 | 
						echo $2 &&
 | 
				
			||||||
 | 
						echo "refs/heads/$3"
 | 
				
			||||||
 | 
						) > expected &&
 | 
				
			||||||
	test_cmp expected actual
 | 
						test_cmp expected actual
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bzr whoami "A U Thor <author@example.com>"
 | 
					bzr whoami "A U Thor <author@example.com>"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
test_expect_success 'cloning' '
 | 
					test_expect_success 'cloning' '
 | 
				
			||||||
	(bzr init bzrrepo &&
 | 
						(
 | 
				
			||||||
 | 
						bzr init bzrrepo &&
 | 
				
			||||||
	cd bzrrepo &&
 | 
						cd bzrrepo &&
 | 
				
			||||||
	echo one > content &&
 | 
						echo one > content &&
 | 
				
			||||||
	bzr add content &&
 | 
						bzr add content &&
 | 
				
			||||||
@ -41,7 +46,8 @@ test_expect_success 'cloning' '
 | 
				
			|||||||
'
 | 
					'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
test_expect_success 'pulling' '
 | 
					test_expect_success 'pulling' '
 | 
				
			||||||
	(cd bzrrepo &&
 | 
						(
 | 
				
			||||||
 | 
						cd bzrrepo &&
 | 
				
			||||||
	echo two > content &&
 | 
						echo two > content &&
 | 
				
			||||||
	bzr commit -m two
 | 
						bzr commit -m two
 | 
				
			||||||
	) &&
 | 
						) &&
 | 
				
			||||||
@ -52,7 +58,8 @@ test_expect_success 'pulling' '
 | 
				
			|||||||
'
 | 
					'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
test_expect_success 'pushing' '
 | 
					test_expect_success 'pushing' '
 | 
				
			||||||
	(cd gitrepo &&
 | 
						(
 | 
				
			||||||
 | 
						cd gitrepo &&
 | 
				
			||||||
	echo three > content &&
 | 
						echo three > content &&
 | 
				
			||||||
	git commit -a -m three &&
 | 
						git commit -a -m three &&
 | 
				
			||||||
	git push
 | 
						git push
 | 
				
			||||||
@ -64,15 +71,18 @@ test_expect_success 'pushing' '
 | 
				
			|||||||
'
 | 
					'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
test_expect_success 'roundtrip' '
 | 
					test_expect_success 'roundtrip' '
 | 
				
			||||||
	(cd gitrepo &&
 | 
						(
 | 
				
			||||||
 | 
						cd gitrepo &&
 | 
				
			||||||
	git pull &&
 | 
						git pull &&
 | 
				
			||||||
	git log --format="%s" -1 origin/master > actual) &&
 | 
						git log --format="%s" -1 origin/master > actual
 | 
				
			||||||
 | 
						) &&
 | 
				
			||||||
	echo three > expected &&
 | 
						echo three > expected &&
 | 
				
			||||||
	test_cmp expected actual &&
 | 
						test_cmp expected actual &&
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	(cd gitrepo && git push && git pull) &&
 | 
						(cd gitrepo && git push && git pull) &&
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	(cd bzrrepo &&
 | 
						(
 | 
				
			||||||
 | 
						cd bzrrepo &&
 | 
				
			||||||
	echo four > content &&
 | 
						echo four > content &&
 | 
				
			||||||
	bzr commit -m four
 | 
						bzr commit -m four
 | 
				
			||||||
	) &&
 | 
						) &&
 | 
				
			||||||
@ -81,7 +91,8 @@ test_expect_success 'roundtrip' '
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	check gitrepo four master &&
 | 
						check gitrepo four master &&
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	(cd gitrepo &&
 | 
						(
 | 
				
			||||||
 | 
						cd gitrepo &&
 | 
				
			||||||
	echo five > content &&
 | 
						echo five > content &&
 | 
				
			||||||
	git commit -a -m five &&
 | 
						git commit -a -m five &&
 | 
				
			||||||
	git push && git pull
 | 
						git push && git pull
 | 
				
			||||||
@ -101,7 +112,8 @@ cat > expected <<EOF
 | 
				
			|||||||
EOF
 | 
					EOF
 | 
				
			||||||
 | 
					
 | 
				
			||||||
test_expect_success 'special modes' '
 | 
					test_expect_success 'special modes' '
 | 
				
			||||||
	(cd bzrrepo &&
 | 
						(
 | 
				
			||||||
 | 
						cd bzrrepo &&
 | 
				
			||||||
	echo exec > executable
 | 
						echo exec > executable
 | 
				
			||||||
	chmod +x executable &&
 | 
						chmod +x executable &&
 | 
				
			||||||
	bzr add executable
 | 
						bzr add executable
 | 
				
			||||||
@ -111,16 +123,21 @@ test_expect_success 'special modes' '
 | 
				
			|||||||
	bzr commit -m link &&
 | 
						bzr commit -m link &&
 | 
				
			||||||
	mkdir dir &&
 | 
						mkdir dir &&
 | 
				
			||||||
	bzr add dir &&
 | 
						bzr add dir &&
 | 
				
			||||||
	bzr commit -m dir) &&
 | 
						bzr commit -m dir
 | 
				
			||||||
 | 
						) &&
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	(cd gitrepo &&
 | 
						(
 | 
				
			||||||
 | 
						cd gitrepo &&
 | 
				
			||||||
	git pull
 | 
						git pull
 | 
				
			||||||
	git ls-tree HEAD > ../actual) &&
 | 
						git ls-tree HEAD > ../actual
 | 
				
			||||||
 | 
						) &&
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	test_cmp expected actual &&
 | 
						test_cmp expected actual &&
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	(cd gitrepo &&
 | 
						(
 | 
				
			||||||
	git cat-file -p HEAD:link > ../actual) &&
 | 
						cd gitrepo &&
 | 
				
			||||||
 | 
						git cat-file -p HEAD:link > ../actual
 | 
				
			||||||
 | 
						) &&
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	printf content > expected &&
 | 
						printf content > expected &&
 | 
				
			||||||
	test_cmp expected actual
 | 
						test_cmp expected actual
 | 
				
			||||||
@ -134,32 +151,40 @@ cat > expected <<EOF
 | 
				
			|||||||
EOF
 | 
					EOF
 | 
				
			||||||
 | 
					
 | 
				
			||||||
test_expect_success 'moving directory' '
 | 
					test_expect_success 'moving directory' '
 | 
				
			||||||
	(cd bzrrepo &&
 | 
						(
 | 
				
			||||||
 | 
						cd bzrrepo &&
 | 
				
			||||||
	mkdir movedir &&
 | 
						mkdir movedir &&
 | 
				
			||||||
	echo one > movedir/one &&
 | 
						echo one > movedir/one &&
 | 
				
			||||||
	echo two > movedir/two &&
 | 
						echo two > movedir/two &&
 | 
				
			||||||
	bzr add movedir &&
 | 
						bzr add movedir &&
 | 
				
			||||||
	bzr commit -m movedir &&
 | 
						bzr commit -m movedir &&
 | 
				
			||||||
	bzr mv movedir movedir-new &&
 | 
						bzr mv movedir movedir-new &&
 | 
				
			||||||
	bzr commit -m movedir-new) &&
 | 
						bzr commit -m movedir-new
 | 
				
			||||||
 | 
						) &&
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	(cd gitrepo &&
 | 
						(
 | 
				
			||||||
 | 
						cd gitrepo &&
 | 
				
			||||||
	git pull &&
 | 
						git pull &&
 | 
				
			||||||
	git ls-tree HEAD > ../actual) &&
 | 
						git ls-tree HEAD > ../actual
 | 
				
			||||||
 | 
						) &&
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	test_cmp expected actual
 | 
						test_cmp expected actual
 | 
				
			||||||
'
 | 
					'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
test_expect_success 'different authors' '
 | 
					test_expect_success 'different authors' '
 | 
				
			||||||
	(cd bzrrepo &&
 | 
						(
 | 
				
			||||||
 | 
						cd bzrrepo &&
 | 
				
			||||||
	echo john >> content &&
 | 
						echo john >> content &&
 | 
				
			||||||
	bzr commit -m john \
 | 
						bzr commit -m john \
 | 
				
			||||||
	  --author "Jane Rey <jrey@example.com>" \
 | 
						  --author "Jane Rey <jrey@example.com>" \
 | 
				
			||||||
	  --author "John Doe <jdoe@example.com>") &&
 | 
						  --author "John Doe <jdoe@example.com>"
 | 
				
			||||||
 | 
						) &&
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	(cd gitrepo &&
 | 
						(
 | 
				
			||||||
 | 
						cd gitrepo &&
 | 
				
			||||||
	git pull &&
 | 
						git pull &&
 | 
				
			||||||
	git show --format="%an <%ae>, %cn <%ce>" --quiet > ../actual) &&
 | 
						git show --format="%an <%ae>, %cn <%ce>" --quiet > ../actual
 | 
				
			||||||
 | 
						) &&
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	echo "Jane Rey <jrey@example.com>, A U Thor <author@example.com>" > expected &&
 | 
						echo "Jane Rey <jrey@example.com>, A U Thor <author@example.com>" > expected &&
 | 
				
			||||||
	test_cmp expected actual
 | 
						test_cmp expected actual
 | 
				
			||||||
@ -171,6 +196,7 @@ test_expect_success 'fetch utf-8 filenames' '
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	LC_ALL=en_US.UTF-8
 | 
						LC_ALL=en_US.UTF-8
 | 
				
			||||||
	export LC_ALL
 | 
						export LC_ALL
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	(
 | 
						(
 | 
				
			||||||
	bzr init bzrrepo &&
 | 
						bzr init bzrrepo &&
 | 
				
			||||||
	cd bzrrepo &&
 | 
						cd bzrrepo &&
 | 
				
			||||||
@ -276,23 +302,23 @@ test_expect_success 'proper bzr repo' '
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	bzr init-repo bzrrepo &&
 | 
						bzr init-repo bzrrepo &&
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bzr init bzrrepo/trunk &&
 | 
					 | 
				
			||||||
	(
 | 
						(
 | 
				
			||||||
 | 
						bzr init bzrrepo/trunk &&
 | 
				
			||||||
	cd bzrrepo/trunk &&
 | 
						cd bzrrepo/trunk &&
 | 
				
			||||||
	echo one >> content &&
 | 
						echo one >> content &&
 | 
				
			||||||
	bzr add content &&
 | 
						bzr add content &&
 | 
				
			||||||
	bzr commit -m one
 | 
						bzr commit -m one
 | 
				
			||||||
	) &&
 | 
						) &&
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bzr branch bzrrepo/trunk bzrrepo/branch &&
 | 
					 | 
				
			||||||
	(
 | 
						(
 | 
				
			||||||
 | 
						bzr branch bzrrepo/trunk bzrrepo/branch &&
 | 
				
			||||||
	cd bzrrepo/branch &&
 | 
						cd bzrrepo/branch &&
 | 
				
			||||||
	echo two >> content &&
 | 
						echo two >> content &&
 | 
				
			||||||
	bzr commit -m one
 | 
						bzr commit -m one
 | 
				
			||||||
	) &&
 | 
						) &&
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	git clone "bzr::$PWD/bzrrepo" gitrepo &&
 | 
					 | 
				
			||||||
	(
 | 
						(
 | 
				
			||||||
 | 
						git clone "bzr::$PWD/bzrrepo" gitrepo &&
 | 
				
			||||||
	cd gitrepo &&
 | 
						cd gitrepo &&
 | 
				
			||||||
	git for-each-ref --format "%(refname:short)" refs/remotes/origin > ../actual
 | 
						git for-each-ref --format "%(refname:short)" refs/remotes/origin > ../actual
 | 
				
			||||||
	) &&
 | 
						) &&
 | 
				
			||||||
@ -331,9 +357,11 @@ test_expect_success 'strip' '
 | 
				
			|||||||
	bzr log --line | sed -e "s/^[0-9][0-9]*: //" > ../expected
 | 
						bzr log --line | sed -e "s/^[0-9][0-9]*: //" > ../expected
 | 
				
			||||||
	) &&
 | 
						) &&
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	(cd gitrepo &&
 | 
						(
 | 
				
			||||||
 | 
						cd gitrepo &&
 | 
				
			||||||
	git fetch &&
 | 
						git fetch &&
 | 
				
			||||||
	git log --format="%an %ad %s" --date=short origin/master > ../actual) &&
 | 
						git log --format="%an %ad %s" --date=short origin/master > ../actual
 | 
				
			||||||
 | 
						) &&
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	test_cmp expected actual
 | 
						test_cmp expected actual
 | 
				
			||||||
'
 | 
					'
 | 
				
			||||||
 | 
				
			|||||||
@ -21,11 +21,15 @@ if ! python -c 'import mercurial'; then
 | 
				
			|||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
check () {
 | 
					check () {
 | 
				
			||||||
	(cd $1 &&
 | 
						(
 | 
				
			||||||
 | 
						cd $1 &&
 | 
				
			||||||
	git log --format='%s' -1 &&
 | 
						git log --format='%s' -1 &&
 | 
				
			||||||
	git symbolic-ref HEAD) > actual &&
 | 
						git symbolic-ref HEAD
 | 
				
			||||||
	(echo $2 &&
 | 
						) > actual &&
 | 
				
			||||||
	echo "refs/heads/$3") > expected &&
 | 
						(
 | 
				
			||||||
 | 
						echo $2 &&
 | 
				
			||||||
 | 
						echo "refs/heads/$3"
 | 
				
			||||||
 | 
						) > expected &&
 | 
				
			||||||
	test_cmp expected actual
 | 
						test_cmp expected actual
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user