# HG changeset patch # User Patrick Mezard # Date 1228928598 21600 # Node ID c35f59aa200e94dce25d8a70a795a2bc8f70e572 # Parent 291925677a9fe46e941481ccef6f07f700552a5d Move and complete execute bit conversion tests into test_fetch_exec.py diff --git a/tests/fixtures/executebit.sh b/tests/fixtures/executebit.sh new file mode 100755 --- /dev/null +++ b/tests/fixtures/executebit.sh @@ -0,0 +1,36 @@ +#!/bin/sh +# +# Generate executebit.svndump +# + +mkdir temp +cd temp + +mkdir project-orig +cd project-orig +mkdir trunk +cd .. + +svnadmin create testrepo +svnurl=file://`pwd`/testrepo +svn import project-orig $svnurl -m "init project" + +svn co $svnurl project +cd project/trunk +echo text > text1 +echo text > text2 +touch empty1 +touch empty2 +python -c "file('binary1', 'wb').write('a\x00b')" +python -c "file('binary2', 'wb').write('a\x00b')" +svn add text1 text2 binary1 binary2 empty1 empty2 +svn propset svn:mime-type application/octet-stream binary1 binary2 +svn propset svn:executable yes binary1 text1 empty1 +svn ci -m init +# switch exec properties +svn propdel svn:executable binary1 text1 empty1 +svn propset svn:executable yes binary2 text2 empty2 +svn ci -m changeexec +cd ../.. + +svnadmin dump testrepo > ../executebit.svndump diff --git a/tests/fixtures/executebit.svndump b/tests/fixtures/executebit.svndump new file mode 100644 index 0000000000000000000000000000000000000000..10c744428064d395ec8e3cf73263123b30af2a14 GIT binary patch literal 3015 zc$~FXNspT_6zMy7EwYyoPG&S7{_;^dl^x-;qX}U6p3W1A2*=LW~fN zDZ@lOF_u!65;02>L6vw#i-$jpNBnbsKY&YzaVZr6a9`_?)gF0WFFRn$P*D{=YTEiQ zINz;OvR^h^zpC5r4TYK#{+TwL#97WLWlZr;oac20xG_Bi-)^h7L*cEcvNXzy_V8$& z-}k{}*@z+%3L@wjCp3qRZ6ycxl3&dcdv7lGB%TQ^q-G~QxwA!O+7Ei{O!s*> zzryz`Wl;k5AI;tfflSk^3uk)bceV52@y54c$|D!dH#_PCJJSi7+|Y@bq3i2~vhim( zp2x#-$$;EU&`i55(K#WO5dn!NBuO;5TnnZkkjvv!jX(bLhDDv*LrQKa>T75O)P09> z?RLlk=0Kgb#Br?>lWQ&%6LC(NlQJOS#mS|{{hmkw1WTu diff --git a/tests/run.py b/tests/run.py --- a/tests/run.py +++ b/tests/run.py @@ -7,6 +7,7 @@ sys.path.append(os.path.dirname(os.path. import test_fetch_branches import test_fetch_command import test_fetch_command_regexes +import test_fetch_exec import test_fetch_renames import test_fetch_truncated import test_push_command @@ -19,6 +20,7 @@ def suite(): return unittest.TestSuite([test_fetch_branches.suite(), test_fetch_command.suite(), test_fetch_command_regexes.suite(), + test_fetch_exec.suite(), test_fetch_renames.suite(), test_fetch_truncated.suite(), test_push_command.suite(), diff --git a/tests/test_fetch_command.py b/tests/test_fetch_command.py --- a/tests/test_fetch_command.py +++ b/tests/test_fetch_command.py @@ -115,12 +115,6 @@ class TestBasicRepoLayout(test_util.Test self.assertEqual(node.hex(repo['tip'].node()), '9cf09e6ff7fa938188c3bcc9dd87abd7842c080c') - def test_empty_prop_val_executable(self): - repo = self._load_fixture_and_fetch('executable_file_empty_prop.svndump') - self.assertEqual(node.hex(repo['tip'].node()), - 'b19e2bdd93da30b09c2396cfdb987cc85271249a') - self.assertEqual(repo['tip']['foo'].flags(), 'x') - class TestStupidPull(test_util.TestBase): def test_stupid(self): @@ -154,17 +148,6 @@ class TestStupidPull(test_util.TestBase) repo['oldest']) self.assertEqual(node.hex(repo['tip'].node()), '9cf09e6ff7fa938188c3bcc9dd87abd7842c080c') - - def test_empty_prop_val_executable(self): - repo = test_util.load_fixture_and_fetch( - 'executable_file_empty_prop.svndump', - self.repo_path, - self.wc_path, - True) - self.assertEqual(repo['tip']['foo'].flags(), 'x') - self.assertEqual(node.hex(repo['tip'].node()), - 'b19e2bdd93da30b09c2396cfdb987cc85271249a') - def suite(): all = [unittest.TestLoader().loadTestsFromTestCase(TestBasicRepoLayout), diff --git a/tests/test_fetch_exec.py b/tests/test_fetch_exec.py new file mode 100644 --- /dev/null +++ b/tests/test_fetch_exec.py @@ -0,0 +1,39 @@ +import sys +import unittest + +from mercurial import node + +import test_util + +class TestFetchExec(test_util.TestBase): + def _load_fixture_and_fetch(self, fixture_name, stupid): + return test_util.load_fixture_and_fetch(fixture_name, self.repo_path, + self.wc_path, stupid=stupid) + + def assertexec(self, ctx, files, isexec=True): + for f in files: + self.assertEqual(isexec, 'x' in ctx[f].flags()) + + def test_exec(self, stupid=False): + repo = self._load_fixture_and_fetch('executebit.svndump', stupid) + self.assertexec(repo[0], ['text1', 'binary1', 'empty1'], True) + self.assertexec(repo[0], ['text2', 'binary2', 'empty2'], False) + self.assertexec(repo[1], ['text1', 'binary1', 'empty1'], False) + self.assertexec(repo[1], ['text2', 'binary2', 'empty2'], True) + + def test_exec_stupid(self): + self.test_exec(True) + + def test_empty_prop_val_executable(self, stupid=False): + repo = self._load_fixture_and_fetch('executable_file_empty_prop.svndump', stupid) + self.assertEqual(node.hex(repo['tip'].node()), + 'b19e2bdd93da30b09c2396cfdb987cc85271249a') + self.assertEqual(repo['tip']['foo'].flags(), 'x') + + def test_empty_prop_val_executable_stupid(self): + self.test_empty_prop_val_executable(True) + +def suite(): + all = [unittest.TestLoader().loadTestsFromTestCase(TestFetchExec), + ] + return unittest.TestSuite(all)