Mercurial > hgsubversion
changeset 125:c35f59aa200e
Move and complete execute bit conversion tests into test_fetch_exec.py
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Wed, 10 Dec 2008 11:03:18 -0600 |
parents | 291925677a9f |
children | 24a64fb0e74b |
files | tests/fixtures/executebit.sh tests/fixtures/executebit.svndump tests/run.py tests/test_fetch_command.py tests/test_fetch_exec.py |
diffstat | 5 files changed, 77 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
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
new file mode 100644 index 0000000000000000000000000000000000000000..10c744428064d395ec8e3cf73263123b30af2a14 GIT binary patch literal 3015 zc$~FXNspT_6z<u-f^#Kjykf(((?eA$jb=N{%{GsOPFO^oXr{lukX$ljh)|Xz&){!) z=6im8nd5wevu)YnylzY5@ebNeQCDfi5PE+8b)QB`P%EtBSaTX<!L7r_8j3kEBft`3 zbdJyi?27(FTy0AWZ5k1@XzK>My7EwYyoPG&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<t^FqB&Zk zCwTWkoqsNund}ZY;gaMrVaht-it;?RDi(?pEjUSRV2#$jGu`3omBKr?tv7bv>!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(NlQJ<nwqZmGI;|bOfH7g$Zpl@IQHetOL74NgNyi2z z9SbHML2hNLCG^H!oat)Dcp~}fIX5lS53EMREVw-+7e&yyd3%bb4m+yljYh_q`FV=| dgp0*l@pcN6hu6Xj!gfMpUE6>OS#mS|{{hmkw1WTu
--- 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(),
--- 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),
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)