Ejemplo n.º 1
0
 def setUpConflictingSubmoduleMerge(self):
     os.chdir(self.defaultWorkingDirectory)
     self.createTestSubmodule()
     git.branch("testSubmoduleMerge2")
     subPath = os.path.join(self.repo, "submodule1")
     os.chdir(subPath)
     git.branch("testSubmoduleMerge2")
     git.checkout("master")
     testGrape.writeFile2("f1")
     git.add("f1")
     git.commit("-m \"added f2 as f1\"")
     os.chdir(self.repo)
     git.commit(
         "submodule1 -m \"updated submodule gitlink on master branch\"")
     git.checkout("testSubmoduleMerge2")
     git.submodule("update")
     os.chdir(subPath)
     git.checkout("testSubmoduleMerge2")
     testGrape.writeFile3("f1")
     git.add("f1")
     git.commit("-m \"added f3 as f1\"")
     os.chdir(self.repo)
     git.commit(
         "submodule1 -m \"updated submodule gitlink on testSubmoduleMerge branch\""
     )
     self.setUpConfig()
Ejemplo n.º 2
0
Archivo: testCO.py Proyecto: LLNL/GRAPE
    def setUpSubmoduleBranch(self):
        git.clone("%s %s" % (self.repo, self.repos[1]))
        os.chdir(self.repo)
        git.checkout("-b addSubmodule")
        git.submodule("add %s submodule" % self.repos[1])
        git.commit("-m \"added submodule\"")
        git.push("origin HEAD")

        # put the remote for the submodule into a HEAD-less state so it can accept pushes
        os.chdir(self.repos[1])
        git.checkout("--orphan HEAD")

        # go to the submodule and add a file to it.
        os.chdir(os.path.join(self.repo,"submodule"))
        f2 = os.path.join(self.repo,"submodule","f2")
        testGrape.writeFile2(f2)
        git.checkout("-b addSubmodule")
        git.add(f2)
        git.commit("-m \"added f2\"")

        # add another file on the master branch for the submodule
        git.branch("-f master HEAD")
        git.checkout("master")
        f3 = os.path.join(self.repo, "submodule", "f3")
        testGrape.writeFile3(f3)
        git.add(f3)
        git.commit("f3 -m \"f3\"")

        # update the submodule's remote
        git.push("origin --all")

        # git back to the master branch in the original repository
        os.chdir(self.repo)
        git.checkout("master")
Ejemplo n.º 3
0
    def setUpNonConflictingSubmoduleMerge(self):
        os.chdir(self.defaultWorkingDirectory)
        self.createTestSubmodule()
        git.branch("testSubmoduleMerge")
        # create a new commit in submodule1
        os.chdir(os.path.join(self.repo, "submodule1"))
        git.checkout("master")
        testGrape.writeFile2("f1")
        git.add("f1")
        git.commit("-m \"added f2 as f1\"")
        # update outer level with new commit
        os.chdir(self.repo)
        git.commit(
            "submodule1 -m \"updated submodule gitlink on master branch\"")

        # setup what should be a notionally-conflict free merge
        # (grape needs to deal with the gitlink conflicts automatically)
        git.checkout("testSubmoduleMerge")
        git.submodule("update")
        os.chdir(os.path.join(self.repo, "submodule1"))
        git.checkout("-b testSubmoduleMerge")
        testGrape.writeFile3("f2")
        git.add("f2")
        git.commit("-m \"added f3 as f2\"")
        os.chdir(self.repo)
        git.commit("-a -m \"updated gitlink on branch testSubmoduleMerge\"")
        self.setUpConfig()
Ejemplo n.º 4
0
Archivo: testCO.py Proyecto: LLNL/GRAPE
    def setUpSubmoduleBranch(self):
        git.clone("%s %s" % (self.repo, self.repos[1]))
        os.chdir(self.repo)
        git.checkout("-b addSubmodule")
        git.submodule("add %s submodule" % self.repos[1])
        git.commit("-m \"added submodule\"")
        git.push("origin HEAD")

        # put the remote for the submodule into a HEAD-less state so it can accept pushes
        os.chdir(self.repos[1])
        git.checkout("--orphan HEAD")

        # go to the submodule and add a file to it.
        os.chdir(os.path.join(self.repo, "submodule"))
        f2 = os.path.join(self.repo, "submodule", "f2")
        testGrape.writeFile2(f2)
        git.checkout("-b addSubmodule")
        git.add(f2)
        git.commit("-m \"added f2\"")

        # add another file on the master branch for the submodule
        git.branch("-f master HEAD")
        git.checkout("master")
        f3 = os.path.join(self.repo, "submodule", "f3")
        testGrape.writeFile3(f3)
        git.add(f3)
        git.commit("f3 -m \"f3\"")

        # update the submodule's remote
        git.push("origin --all")

        # git back to the master branch in the original repository
        os.chdir(self.repo)
        git.checkout("master")
Ejemplo n.º 5
0
 def assertCanAddNewSubproject(testGrapeObject):
     git.clone("--mirror %s %s" % (testGrapeObject.repo, testGrapeObject.repos[1]))
     os.chdir(testGrapeObject.repo)
     grapeMenu.menu().applyMenuChoice("addSubproject", ["--name=subproject1", "--prefix=subs/subproject1",
                                                        "--branch=master", "--url=%s" % testGrapeObject.repos[1],
                                                        "--nested", "--noverify"])
     subproject1path = os.path.join(testGrapeObject.repo, "subs/subproject1")
     testGrapeObject.assertTrue(os.path.exists(subproject1path), "subproject1 does not exist")
     os.chdir(subproject1path)
     # check to see that subproject1 is a git repo
     basedir = os.path.split(git.baseDir())[-1]
     subdir = os.path.split(subproject1path)[-1]
     testGrapeObject.assertTrue(basedir == subdir, "subproject1's git repo is %s, not %s" % (basedir, subdir))
     # check to see that edits that occur in the new subproject are ignored by outer repo
     testGrape.writeFile3(os.path.join(subproject1path, "f3"))
     # make sure there is an edit
     testGrapeObject.assertFalse(git.isWorkingDirectoryClean(), "subproject1 clean after adding f3")
     os.chdir(testGrapeObject.repo)
     # check that grape left the repository in a clean state
     testGrapeObject.assertTrue(git.isWorkingDirectoryClean(), "repo not clean after added subproject1")
     # check in the edit
     os.chdir(subproject1path)
     git.add("f3")
     git.commit("-m \"added f3\"")
     testGrapeObject.assertTrue(git.isWorkingDirectoryClean(), "subproject1 not clean")
     os.chdir(testGrapeObject.repo)
     testGrapeObject.subproject = subproject1path
Ejemplo n.º 6
0
    def setUpNonConflictingSubmoduleMerge(self):
        os.chdir(self.defaultWorkingDirectory)
        self.createTestSubmodule()
        git.branch("testSubmoduleMerge")
        # create a new commit in submodule1
        os.chdir(os.path.join(self.repo, "submodule1"))
        git.checkout("master")
        testGrape.writeFile2("f1")
        git.add("f1")
        git.commit("-m \"added f2 as f1\"")
        # update outer level with new commit
        os.chdir(self.repo)
        git.commit("submodule1 -m \"updated submodule gitlink on master branch\"")

        # setup what should be a notionally-conflict free merge
        # (grape needs to deal with the gitlink conflicts automatically)
        git.checkout("testSubmoduleMerge")
        git.submodule("update")
        os.chdir(os.path.join(self.repo, "submodule1"))
        git.checkout("-b testSubmoduleMerge")
        testGrape.writeFile3("f2")
        git.add("f2")
        git.commit("-m \"added f3 as f2\"")
        os.chdir(self.repo)
        git.commit("-a -m \"updated gitlink on branch testSubmoduleMerge\"")
        self.setUpConfig()
Ejemplo n.º 7
0
 def setUpConflictingNestedSubprojectMerge(self):
     os.chdir(self.defaultWorkingDirectory)
     testNestedSubproject.TestNestedSubproject.assertCanAddNewSubproject(self)
     os.chdir(self.subproject)
     
     # set up f1 with conflicting content on master  and testNestedMerge branches. 
     git.checkout("master")
     git.branch("testNestedMerge")
     testGrape.writeFile2("f1")
     git.add("f1")
     git.commit("-m \"added f2 as f1\"")
     git.checkout("testNestedMerge")
     testGrape.writeFile3("f1")
     git.add("f1")
     git.commit("-m \"added f1 as f1\"")
     
     os.chdir(self.repo)
Ejemplo n.º 8
0
    def setUpConflictingNestedSubprojectMerge(self):
        os.chdir(self.defaultWorkingDirectory)
        testNestedSubproject.TestNestedSubproject.assertCanAddNewSubproject(
            self)
        os.chdir(self.subproject)

        # set up f1 with conflicting content on master  and testNestedMerge branches.
        git.checkout("master")
        git.branch("testNestedMerge")
        testGrape.writeFile2("f1")
        git.add("f1")
        git.commit("-m \"added f2 as f1\"")
        git.checkout("testNestedMerge")
        testGrape.writeFile3("f1")
        git.add("f1")
        git.commit("-m \"added f1 as f1\"")

        os.chdir(self.repo)
Ejemplo n.º 9
0
 def setUpConflictingSubmoduleMerge(self):
     os.chdir(self.defaultWorkingDirectory)
     self.createTestSubmodule()
     git.branch("testSubmoduleMerge2")
     subPath = os.path.join(self.repo, "submodule1")
     os.chdir(subPath)
     git.branch("testSubmoduleMerge2")
     git.checkout("master")
     testGrape.writeFile2("f1")
     git.add("f1")
     git.commit("-m \"added f2 as f1\"")
     os.chdir(self.repo)
     git.commit("submodule1 -m \"updated submodule gitlink on master branch\"")
     git.checkout("testSubmoduleMerge2")
     git.submodule("update")
     os.chdir(subPath)
     git.checkout("testSubmoduleMerge2")
     testGrape.writeFile3("f1")
     git.add("f1")
     git.commit("-m \"added f3 as f1\"")
     os.chdir(self.repo)
     git.commit("submodule1 -m \"updated submodule gitlink on testSubmoduleMerge branch\"")
     self.setUpConfig()
Ejemplo n.º 10
0
 def assertCanAddNewSubproject(testGrapeObject):
     git.clone("--mirror %s %s" %
               (testGrapeObject.repo, testGrapeObject.repos[1]))
     os.chdir(testGrapeObject.repo)
     grapeMenu.menu().applyMenuChoice("addSubproject", [
         "--name=subproject1", "--prefix=subs/subproject1",
         "--branch=master",
         "--url=%s" % testGrapeObject.repos[1], "--nested", "--noverify"
     ])
     subproject1path = os.path.join(testGrapeObject.repo,
                                    "subs/subproject1")
     testGrapeObject.assertTrue(os.path.exists(subproject1path),
                                "subproject1 does not exist")
     os.chdir(subproject1path)
     # check to see that subproject1 is a git repo
     basedir = os.path.split(git.baseDir())[-1]
     subdir = os.path.split(subproject1path)[-1]
     testGrapeObject.assertTrue(
         basedir == subdir,
         "subproject1's git repo is %s, not %s" % (basedir, subdir))
     # check to see that edits that occur in the new subproject are ignored by outer repo
     testGrape.writeFile3(os.path.join(subproject1path, "f3"))
     # make sure there is an edit
     testGrapeObject.assertFalse(git.isWorkingDirectoryClean(),
                                 "subproject1 clean after adding f3")
     os.chdir(testGrapeObject.repo)
     # check that grape left the repository in a clean state
     testGrapeObject.assertTrue(git.isWorkingDirectoryClean(),
                                "repo not clean after added subproject1")
     # check in the edit
     os.chdir(subproject1path)
     git.add("f3")
     git.commit("-m \"added f3\"")
     testGrapeObject.assertTrue(git.isWorkingDirectoryClean(),
                                "subproject1 not clean")
     os.chdir(testGrapeObject.repo)
     testGrapeObject.subproject = subproject1path
Ejemplo n.º 11
0
 def setUpConflictingMerge(self):
     self.setUpMerge()
     # add a conflicting commit
     testGrape.writeFile3("f2")
     git.add("f2")
     git.commit("-m \"f2\"")
Ejemplo n.º 12
0
 def setUpConflictingMerge(self):
     self.setUpMerge()
     # add a conflicting commit
     testGrape.writeFile3("f2")
     git.add("f2")
     git.commit("-m \"f2\"")