def test_persist_project(self): p = Project(path='/tmp/test_place',url='svn://alvesjnr@localhost/tmp/svnrepo') p.add_new_copy('/tmp/blah') p.create_current_copy() p.add_new_copy('/tmp/blah2') p.avoid_files(['/tmp/test_place/nha.c']) p.create_current_copy() diff = compare_tree('/tmp/test_place','/tmp/blah') self.assertFalse(diff['left_only'] or diff['right_only']) diff = compare_tree('/tmp/test_place','/tmp/blah2') self.assertTrue(diff['left_only'] == ['/nha.c'] and diff['right_only'] == []) os.system('date > /tmp/workspace/svnrepo/nha.c') os.system('date +%N >> /tmp/workspace/svnrepo/nha.c') os.system('svn commit /tmp/workspace/svnrepo/nha.c -m "changing things in repo"') self.assertFalse(filecmp.cmp('/tmp/workspace/svnrepo/nha.c','/tmp/blah/nha.c')) dumped_project = p.dumps() del(p) p = Project(dumped_project=dumped_project) p.update_project() p.update_copies() self.assertTrue(filecmp.cmp('/tmp/workspace/svnrepo/nha.c','/tmp/blah/nha.c')) diff = compare_tree('/tmp/test_place','/tmp/blah2') self.assertTrue(diff['left_only'] == ['/nha.c'] and diff['right_only'] == [])
def test_two_copies_with_same_name(self): p = Project(path='/tmp/test_place',url='svn://alvesjnr@localhost/tmp/svnrepo') p.add_new_copy('/tmp/blah',name='copy') p.create_current_copy() self.assertRaises(DupllicatedCopyNameException,p.add_new_copy,*('/tmp/blah2','copy')) p.add_new_copy('/tmp/blah2','copy2') p.create_current_copy() diff = compare_tree('/tmp/test_place','/tmp/blah') self.assertFalse(diff['left_only'] or diff['right_only']) diff = compare_tree('/tmp/test_place','/tmp/blah2') self.assertFalse(diff['left_only'] or diff['right_only'])
def test_managing_two_copies(self): p = Project(path='/tmp/test_place',url='svn://alvesjnr@localhost/tmp/svnrepo') p.add_new_copy('/tmp/blah') p.create_current_copy() p.add_new_copy('/tmp/blah2') p.avoid_files(['/tmp/test_place/nha.c']) p.create_current_copy() diff = compare_tree('/tmp/test_place','/tmp/blah') self.assertFalse(diff['left_only'] or diff['right_only']) diff = compare_tree('/tmp/test_place','/tmp/blah2') self.assertTrue(diff['left_only'] == ['/nha.c'] and diff['right_only'] == [])
def test_update_copy(self): p = Project(path='/tmp/test_place',url='svn://alvesjnr@localhost/tmp/svnrepo') p.add_new_copy('/tmp/blah') p.create_current_copy() os.system('date > /tmp/workspace/svnrepo/nha.c') os.system('date +%N >> /tmp/workspace/svnrepo/nha.c') os.system('svn commit /tmp/workspace/svnrepo/nha.c -m "changing things in repo"') self.assertFalse(filecmp.cmp('/tmp/workspace/svnrepo/nha.c','/tmp/blah/nha.c')) p.update_project() p.update_copies() self.assertTrue(filecmp.cmp('/tmp/workspace/svnrepo/nha.c','/tmp/blah/nha.c'))
def test_removing_file_from_svn_repository(self): os.system('echo "blahblahblah" > /tmp/workspace/svnrepo/temp') os.system('svn add /tmp/workspace/svnrepo/temp') os.system('svn commit /tmp/workspace/svnrepo/temp -m "adding in repo"') p = Project(path='/tmp/test_place',url='svn://alvesjnr@localhost/tmp/svnrepo') p.add_new_copy('/tmp/blah') p.create_current_copy() p.update_project() p.update_copies() diff = compare_tree('/tmp/workspace/svnrepo','/tmp/blah') self.assertFalse(diff['left_only'] or diff['right_only']) os.system('rm /tmp/workspace/svnrepo/temp') os.system('svn rm /tmp/workspace/svnrepo/temp') os.system('svn commit /tmp/workspace/svnrepo -m "removing in repo"') p.update_project() diff = compare_tree('/tmp/workspace/svnrepo','/tmp/blah') self.assertFalse(diff['left_only'] or diff['right_only'])
def test_renaming_file_with_svn_move(self): p = Project(path='/tmp/test_place', url='svn://alvesjnr@localhost/tmp/svnrepo') p.add_new_copy('/tmp/blah') p.create_current_copy() diff = compare_tree('/tmp/test_place','/tmp/blah') self.assertFalse(diff['left_only'] or diff['right_only']) os.system('svn mv /tmp/workspace/svnrepo/nha.c /tmp/workspace/svnrepo/nha_2.c') os.system('svn commit /tmp/workspace/svnrepo -m "changing name"') p.update_project() p.update_copies() diff = compare_tree('/tmp/test_place','/tmp/blah') self.assertTrue(diff['left_only'] == ['/nha_2.c'] and diff['right_only'] == []) os.system('svn mv /tmp/workspace/svnrepo/nha_2.c /tmp/workspace/svnrepo/nha.c') os.system('svn commit /tmp/workspace/svnrepo -m "restoring old name"') p.update_project() p.update_copies() diff = compare_tree('/tmp/test_place','/tmp/blah') self.assertTrue(diff['left_only'] == ['/nha.c'] and diff['right_only'] == [])
def test_create_one_copy(self): p = Project(path='/tmp/test_place',url='svn://alvesjnr@localhost/tmp/svnrepo') p.add_new_copy('/tmp/blah') p.create_current_copy() diff = compare_tree('/tmp/test_place','/tmp/blah') self.assertFalse(diff['left_only'] or diff['right_only'])