def testTopicConfigOption(self): self.setUpBranchToFFMerge() git.checkout("-b someOtherBranch") testGrape.writeFile1("someOtherfile") git.add("someOtherfile") git.commit("-a -m \"someOtherfile\"") self.assertGrapePublishFailed(["--topic=testPublish"])
def testMergeAbort(self): try: os.chdir(self.repo) git.branch("testMergeAbort/tmp1 HEAD") #add a file on the master branch. f1name = os.path.join(self.repo, "f1") writeFile1(f1name) git.add("f1") commitStr = "testMergeAbort: added f1" git.commit(" -m \"%s\"" % commitStr) # also add it on the tmp branch git.checkout("testMergeAbort/tmp1") writeFile2(f1name) git.add("f1") git.commit(" -m \"testMergeAbort/tmp1 : added f1\"") # a merge should generate a conflict git.merge("master -m \"merging from master\"") self.assertTrue(False, "conflict did not throw exception") except: status = git.status() self.assertTrue("conflict" in status, "'conflict' not in status message %s " % status) git.mergeAbort() status = git.status() self.assertFalse("conflict" in status, "conflict not removed by aborting merge")
def testPush(self): try: os.chdir(self.repo) f2name = os.path.join(self.repo, "f2") writeFile2(f2name) git.add(f2name) git.commit(" -m \"initial commit for testPush\"") git.clone("%s %s" % (self.repo, self.repos[1])) git.checkout("-b testPush/tmpBranchToAllowPushesToMaster") os.chdir(self.repos[1]) f1name = os.path.join(self.repos[1], "f1") writeFile1(f1name) git.add("f1") commitStr = "testPush: added f1" git.commit(" -m \"%s\"" % commitStr) os.chdir(self.repo) log = git.log("--all") self.assertFalse(commitStr in log, "commit message in log before it should be") os.chdir(self.repos[1]) pushOutput = git.push("origin master") os.chdir(self.repo) git.checkout("master") log = git.log() self.assertTrue(commitStr in log, "commit message not in log after push") except git.GrapeGitError as error: self.handleGitError(error)
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
def createTestSubmodule(self): # make a repo to turn into a submodule git.clone("--mirror %s %s " % (self.repo, self.repos[1])) # add repo2 as a submodule to repo1 os.chdir(self.repo) git.submodule("add %s %s" % (os.path.join(self.repos[1]), "submodule1")) git.commit("-m \"added submodule1\"")
def testPush(self): try: os.chdir(self.repo) f2name = os.path.join(self.repo, "f2") writeFile2(f2name) git.add(f2name) git.commit(" -m \"initial commit for testPush\"") git.clone("%s %s" %(self.repo,self.repos[1])) git.checkout("-b testPush/tmpBranchToAllowPushesToMaster") os.chdir(self.repos[1]) f1name = os.path.join(self.repos[1],"f1") writeFile1(f1name) git.add("f1") commitStr = "testPush: added f1" git.commit(" -m \"%s\"" % commitStr) os.chdir(self.repo) log = git.log("--all") self.assertFalse(commitStr in log,"commit message in log before it should be") os.chdir(self.repos[1]) pushOutput = git.push("origin master") os.chdir(self.repo) git.checkout("master") log = git.log() self.assertTrue(commitStr in log, "commit message not in log after push") except git.GrapeGitError as error: self.handleGitError(error)
def setUpBranchToFFMerge(self): os.chdir(self.repo) self.branch = "testPublish" git.checkout("-b %s" % self.branch) testGrape.writeFile2("f2") git.add("f2") git.commit("-m \"added f2\"") self.setUpConfig()
def setUpMerge(self): os.chdir(self.repo) # create a new branch git.branch("testMerge") # add f2 to master testGrape.writeFile2("f2") git.add("f2") git.commit("-m \"f2\"") git.checkout("testMerge") self.setUpConfig()
def testConflictingSubmoduleMerge(self): try: self.setUpConflictingSubmoduleMerge() subPath = os.path.join(self.repo, "submodule1") ret = grapeMenu.menu().applyMenuChoice("m", ["master", "--am"]) self.assertFalse( ret, "grape m did not return False for conflicting merge.") # should only have modifications in submodule1, not conflicts status = git.status("--porcelain") self.assertTrue("UU" not in status and "AA" in status, "unexpected status %s at toplevel" % status) os.chdir(subPath) status = git.status("--porcelain") self.assertTrue("AA" in status, "unexpected status %s in submodule1" % status) # resolve the conflict and continue from the submodule's directory git.checkout("--ours f1") git.add("f1") git.commit("-m \"resolved conflict with our f1\"") self.setUpConfig() ret = grapeMenu.menu().applyMenuChoice("m", ["--continue"]) # test that we returned successfully self.assertTrue( ret, "grape m --continue did not complete successfully after resolving submodule conflict" "\n %s" % self.output.getvalue()) # test that the submodule master was merged in self.assertTrue( git.branchUpToDateWith("testSubmoduleMerge2", "master"), "grape m --continue did not merge in submodule1`s master branch" ) # test that the outer level master was merged in os.chdir(self.repo) self.assertTrue( git.branchUpToDateWith("testSubmoduleMerge2", "master"), "grape m --continue did not merge in the outer level master branch" ) # ensure the gitlink is at the right commit git.submodule("update") os.chdir(subPath) diff = git.diff("testSubmoduleMerge2") self.assertFalse( diff, "checked in gitlink is not at tip of testSubmoduleMerge2") except git.GrapeGitError as e: self.fail("Uncaught git error executing %s: \n%s" % (e.gitCommand, e.gitOutput)) except SystemExit: self.fail("Uncaught exit\n%s" % self.output.getvalue())
def testCommit(self): try: os.chdir(self.repo) f1name = os.path.join(self.repo,"f1") writeFile1(f1name) commitStr = "testCommit: added f1" git.add("f1") git.commit("f1 -m \"%s\"" % commitStr) log = git.log() self.assertTrue(commitStr in log) except git.GrapeGitError as error: self.handleGitError(error)
def testCommit(self): try: os.chdir(self.repo) f1name = os.path.join(self.repo, "f1") writeFile1(f1name) commitStr = "testCommit: added f1" git.add("f1") git.commit("f1 -m \"%s\"" % commitStr) log = git.log() self.assertTrue(commitStr in log) except git.GrapeGitError as error: self.handleGitError(error)
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()
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()
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()
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)
def testMerge(self): # First, test to see if a merge that should work does. try: os.chdir(self.repo) #add a file on the master branch. f1name = os.path.join(self.repo, "f1") writeFile1(f1name) git.add("f1") commitStr = "testMerge: added f1" git.commit(" -m \"%s\"" % commitStr) # edit it on branch testMerge/tmp1 git.checkout("-b testMerge/tmp1") writeFile2(f1name) git.commit("-a -m \"edited f1\"") # perform same editon master git.checkout("master") writeFile2(f1name) git.commit("-a -m \"edited f1 on master\"") # switch back to tmp, merge changes from master down git.checkout("testMerge/tmp1") output = git.merge( "master -m \"merged identical change from master\"") log = git.log() self.assertTrue("identical change from master" in log) except git.GrapeGitError as error: self.handleGitError(error) # Second, test that a merge that should result in a conflict throws an appropriate GrapeGitError exception. try: git.checkout("master") f2name = os.path.join(self.repo, "f2") writeFile3(f2name) git.add(f2name) git.commit("-m \"added f2\"") git.checkout("testMerge/tmp1") writeFile2(f2name) git.add(f2name) git.commit("-m \"added f2 in tmp branch\"") git.merge("master -m \"merged master branch into testmerge/tmp1\"") self.assertTrue(False, "Merge did not throw grapeGitError for conflict") except git.GrapeGitError as error: status = git.status() self.assertTrue("conflict" in status, "'conflict' not in status message %s" % status)
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)
def testPull(self): try: git.clone("%s %s" %(self.repo,self.repos[1])) os.chdir(self.repo) f1name = os.path.join(self.repo,"f1") writeFile1(f1name) git.add("f1") commitStr = "testPull: added f1" git.commit(" -m \"%s\"" % commitStr) os.chdir(self.repos[1]) log = git.log("--all") self.assertFalse(commitStr in log,"commit message in log before it should be") git.pull("origin master") log = git.log() self.assertTrue(commitStr in log, "commit message not in log after pull") except git.GrapeGitError as error: self.handleGitError(error)
def testConflictingSubmoduleMerge(self): try: self.setUpConflictingSubmoduleMerge() subPath = os.path.join(self.repo, "submodule1") ret = grapeMenu.menu().applyMenuChoice("m", ["master", "--am"]) self.assertFalse(ret, "grape m did not return False for conflicting merge.") # should only have modifications in submodule1, not conflicts status = git.status("--porcelain") self.assertTrue("UU" not in status and "AA" in status, "unexpected status %s at toplevel" % status) os.chdir(subPath) status = git.status("--porcelain") self.assertTrue("AA" in status, "unexpected status %s in submodule1" % status) # resolve the conflict and continue from the submodule's directory git.checkout("--ours f1") git.add("f1") git.commit("-m \"resolved conflict with our f1\"") self.setUpConfig() ret = grapeMenu.menu().applyMenuChoice("m", ["--continue"]) # test that we returned successfully self.assertTrue(ret, "grape m --continue did not complete successfully after resolving submodule conflict" "\n %s" % self.output.getvalue()) # test that the submodule master was merged in self.assertTrue(git.branchUpToDateWith("testSubmoduleMerge2", "master"), "grape m --continue did not merge in submodule1`s master branch") # test that the outer level master was merged in os.chdir(self.repo) self.assertTrue(git.branchUpToDateWith("testSubmoduleMerge2", "master"), "grape m --continue did not merge in the outer level master branch") # ensure the gitlink is at the right commit git.submodule("update") os.chdir(subPath) diff = git.diff("testSubmoduleMerge2") self.assertFalse(diff, "checked in gitlink is not at tip of testSubmoduleMerge2") except git.GrapeGitError as e: self.fail("Uncaught git error executing %s: \n%s" % (e.gitCommand, e.gitOutput)) except SystemExit: self.fail("Uncaught exit\n%s" % self.output.getvalue())
def testMerge(self): # First, test to see if a merge that should work does. try: os.chdir(self.repo) #add a file on the master branch. f1name = os.path.join(self.repo, "f1") writeFile1(f1name) git.add("f1") commitStr = "testMerge: added f1" git.commit(" -m \"%s\"" % commitStr) # edit it on branch testMerge/tmp1 git.checkout("-b testMerge/tmp1") writeFile2(f1name) git.commit("-a -m \"edited f1\"") # perform same editon master git.checkout("master") writeFile2(f1name) git.commit("-a -m \"edited f1 on master\"") # switch back to tmp, merge changes from master down git.checkout("testMerge/tmp1") output = git.merge("master -m \"merged identical change from master\"") log = git.log() self.assertTrue("identical change from master" in log) except git.GrapeGitError as error: self.handleGitError(error) # Second, test that a merge that should result in a conflict throws an appropriate GrapeGitError exception. try: git.checkout("master") f2name = os.path.join(self.repo,"f2") writeFile3(f2name) git.add(f2name) git.commit("-m \"added f2\"") git.checkout("testMerge/tmp1") writeFile2(f2name) git.add(f2name) git.commit("-m \"added f2 in tmp branch\"") git.merge("master -m \"merged master branch into testmerge/tmp1\"") self.assertTrue(False,"Merge did not throw grapeGitError for conflict") except git.GrapeGitError as error: status = git.status() self.assertTrue("conflict" in status, "'conflict' not in status message %s" % status)
def testRecursiveCloneWithSubmodule(self): # make a repo to turn into a submodule git.clone("--mirror %s %s " % (self.repo, self.repos[1])) # add repo2 as a submodule to repo1 os.chdir(self.repo) git.submodule("add %s %s" % (os.path.join(self.repos[1]), "submodule1")) git.commit("-m \"added submodule1\"") #Now clone the repo into a temp dir and make sure the submodule is in the clone try: tempDir = tempfile.mkdtemp() args = [self.repo, tempDir, "--recursive"] self.queueUserInput(["\n", "\n", "\n", "\n","\n","\n"]) ret = grapeMenu.menu().applyMenuChoice("clone", args) self.assertTrue(ret, "vine.clone returned failure") submodulepath = os.path.join(tempDir, "submodule1") self.assertTrue(os.path.exists(submodulepath), "submodule1 does not exist in clone") finally: shutil.rmtree(tempDir)
def testPull(self): try: git.clone("%s %s" % (self.repo, self.repos[1])) os.chdir(self.repo) f1name = os.path.join(self.repo, "f1") writeFile1(f1name) git.add("f1") commitStr = "testPull: added f1" git.commit(" -m \"%s\"" % commitStr) os.chdir(self.repos[1]) log = git.log("--all") self.assertFalse(commitStr in log, "commit message in log before it should be") git.pull("origin master") log = git.log() self.assertTrue(commitStr in log, "commit message not in log after pull") except git.GrapeGitError as error: self.handleGitError(error)
def testRebase(self): try: os.chdir(self.repo) f1name = os.path.join(self.repo,"f1") writeFile1(f1name) git.add(f1name) git.commit("-m \"initial commit\"") git.branch("testRebase/branchToRebase HEAD") # while still on master add another commit. writeFile2(f1name) git.add(f1name) git.commit("-m \"edited f1\"") # switch to new branch, add a new file, commit, rebase onto master. git.checkout("testRebase/branchToRebase") f2name = os.path.join(self.repo,"f2") writeFile2(f2name) git.add(f2name) git.commit("-m \"added f2\" ") self.assertFalse(git.branchUpToDateWith("testRebase/branchToRebase","master"),"attempting rebase in situation where rebase will not do anything.") try: git.rebase("master") self.assertTrue(git.branchUpToDateWith("testRebase/branchToRebase","master"),"rebase did not bring current branch up to date with master") except git.GrapeGitError as error: self.assertTrue(False,"rebase that should not have generated a conflict failed") except git.GrapeGitError as error: self.handleGitError(error)
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")
def testRebase(self): try: os.chdir(self.repo) f1name = os.path.join(self.repo, "f1") writeFile1(f1name) git.add(f1name) git.commit("-m \"initial commit\"") git.branch("testRebase/branchToRebase HEAD") # while still on master add another commit. writeFile2(f1name) git.add(f1name) git.commit("-m \"edited f1\"") # switch to new branch, add a new file, commit, rebase onto master. git.checkout("testRebase/branchToRebase") f2name = os.path.join(self.repo, "f2") writeFile2(f2name) git.add(f2name) git.commit("-m \"added f2\" ") self.assertFalse( git.branchUpToDateWith("testRebase/branchToRebase", "master"), "attempting rebase in situation where rebase will not do anything." ) try: git.rebase("master") self.assertTrue( git.branchUpToDateWith("testRebase/branchToRebase", "master"), "rebase did not bring current branch up to date with master" ) except git.GrapeGitError as error: self.assertTrue( False, "rebase that should not have generated a conflict failed") except git.GrapeGitError as error: self.handleGitError(error)
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")
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
def testMergeAbort(self): try: os.chdir(self.repo) git.branch("testMergeAbort/tmp1 HEAD") #add a file on the master branch. f1name = os.path.join(self.repo, "f1") writeFile1(f1name) git.add("f1") commitStr = "testMergeAbort: added f1" git.commit(" -m \"%s\"" % commitStr) # also add it on the tmp branch git.checkout("testMergeAbort/tmp1") writeFile2(f1name) git.add("f1") git.commit(" -m \"testMergeAbort/tmp1 : added f1\"") # a merge should generate a conflict git.merge("master -m \"merging from master\"") self.assertTrue(False,"conflict did not throw exception") except: status = git.status() self.assertTrue("conflict" in status, "'conflict' not in status message %s " % status) git.mergeAbort() status = git.status() self.assertFalse("conflict" in status, "conflict not removed by aborting merge")
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()
def setUpConflictingMerge(self): self.setUpMerge() # add a conflicting commit testGrape.writeFile3("f2") git.add("f2") git.commit("-m \"f2\"")