@@ -0,0 +1,3156 @@
+#!bin/env python%0A%0Aimport subprocess%0Aimport os.path%0Aimport unittest, re%0A%0A%0Aclass TestSafety(unittest.TestCase):%0A%0A    @classmethod%0A    def setUpClass(self):%0A%0A        # clean up, just in case%0A        subprocess.call('rm -rf remote local 2%3E%3E /dev/null', shell=True)%0A%0A        # Create %22local%22 and %22remote%22 repositories%0A        subprocess.call('mkdir remote; mkdir local', shell=True)%0A        subprocess.call('cd remote; mkdir parent; cd parent; git init --bare', shell=True)%0A        subprocess.call('cd remote; mkdir child; cd child; git init --bare', shell=True)%0A%0A        subprocess.call('cd local;  git clone ../remote/parent', shell=True)%0A        subprocess.call('cd local;  git clone ../remote/child', shell=True)%0A%0A        # initialize the git-project for local/parent%0A        subprocess.call('cd local/parent;  echo %22repos:%22 %3E%3E .gitproj', shell=True)%0A        subprocess.call('cd local/parent;  echo %22%5Ctchild ../../remote/child%22 %3E%3E .gitproj', shell=True)%0A        subprocess.call('cd local/parent;  git add .gitproj; git commit -m %22Initial Commit%22; git push -u origin master', shell=True)%0A%0A        # clone the child repo into the parent through git project init%0A        subprocess.call('cd local/parent;  git project init', shell=True)%0A        subprocess.call('cd local/parent;  git add .gitignore; git commit -m %22.gitignore%22; git push', shell=True)%0A%0A    def test_safety(self):%0A        # check to ensure the child repo was cloned%0A        output = subprocess.check_output('cd local/parent; ls %7C grep child %7C awk %5C'%7Bprint $1%7D%5C'', shell=True)%0A        self.assertEqual(output, 'child%5Cn')%0A%0A        # ensure the child's remote is correct%0A        output = subprocess.check_output('cd local/parent/child; git remote show origin %7C grep Fetch %7C grep remote/child %7C wc -l', shell=True)%0A        self.assertEqual(output.strip().replace('%5Cn',''), '1')%0A%0A        # add a commit and SAVE it into the git-project (simulate working inside the parent-repo's copy of child)%0A        subprocess.call('cd local/parent/child; echo %22Asdf%22 %3E test.txt; git add test.txt; git commit -m %22Initial Commit%22; git push', shell=True)%0A        subprocess.call('cd local/parent; git project save -f', shell=True)%0A%0A        # ensure git project load DID update the child repo%0A        output = subprocess.check_output('cd local/parent/child; git status %7C grep %22behind%22 %7C wc -l', shell=True)%0A        self.assertEqual(output.strip().replace('%5Cn',''), '0')%0A%0A        # create a commit we DO NOT WANT to include in the git-project%0A        subprocess.call('cd local/child; git pull', shell=True)%0A        subprocess.call('cd local/child; echo %22asdf2%22 %3E test2.txt; git add test2.txt; git commit -m %22Second Commit%22; git push', shell=True)%0A        subprocess.call('cd local/parent; git project load', shell=True)%0A%0A        # ensure git project load DID NOT update the child repo%0A        output = subprocess.check_output('cd local/parent/child; git status %7C grep %22behind%22 %7C wc -l', shell=True)%0A        self.assertEqual(output.strip().replace('%5Cn',''), '1')%0A%0A%0A    @classmethod%0A    def tearDownClass(self):%0A%0A        subprocess.call('rm -rf remote local', shell=True)%0A%0Aif __name__ == '__main__':%0A    unittest.main()%0A

Add test to test new load functionality