def test_git_diffbranch(self):
        git = GitCmd()
        git.do_branch('trial')
        G.change_location_file("Git Crystal")
        git.do_stage('location.json')
        git.do_commit('Player in Git Crystal')
        git.do_diffbranch('')

        expected = "only " + "data,trial are legal branch names\n"
        expected += "usage: diffbranch branch1 branch2\n"
        self.assertEqual(git.output, expected)

        git.do_diffbranch('trial data')
        expected = """diff --git a/location.json b/location.json
index 86b52b7..64e45dc 100644
--- a/location.json
+++ b/location.json
@@ -1,4 +1,4 @@
 {
-    "location":"Mountain Gate"
+    "location":"Git Crystal"
 }
 
"""
        self.assertEqual(git.output, expected)
        command = [G.GIT, '-C', G.repodir, 'branch', '-D', 'trial']
        process = cw.run_process(command)
    def test_no_conflict_recursive_merge(self):
        git = GitCmd()
        git.do_merge('')
        expected = "No branch names provided"
        self.assertEqual(git.output, expected)

        git.do_merge('octupus merge')
        expected = "Git Crystals does not support merging mulitple branches"
        self.assertEqual(git.output, expected)

        git.do_branch('trial')
        git.do_checkout('trial')
        G.change_location_file("Git Crystal")
        git.do_stage('location.json')
        git.do_commit('Player in Git Crystal')
        git.do_checkout('data')
        git.do_merge('trial')

        command = [G.GIT, '-C', G.repodir, 'branch', '-D', 'trial']
        process = cw.run_process(command)

        expected = """Merge made by the 'recursive' strategy.
 location.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
"""
        self.assertEqual(git.output, expected)
    def test_commit(self):
        git = GitCmd()
        G.change_location_file("Git Crystal")
        git.do_stage('location.json')
        git.do_commit('Player in Git Crystal')

        command = [G.GIT, '-C', G.repodir, 'show-ref', '--heads']
        process = cw.run_process(command)
        self.assertNotEqual(
            process.stdout,
            G.current_commit_sha + " refs/heads/" + G.current_branch + '\n')
    def test_merge_with_conflicts(self):
        git = GitCmd()

        git.do_branch('trial')
        G.change_location_file("Git Crystal")
        git.do_stage('location.json')
        git.do_commit('Player in Git Crystal')
        git.do_checkout('data')
        G.change_location_file("Stalagmite Central")
        git.do_stage('location.json')
        git.do_merge('trial')
        git.do_resolveleft('location.json')
        git.do_resolveright('location.json')
        git.do_stage('location.json')
        git.do_commit('Merge Branch Trial')
        git.do_status(
            '')  # Get status message after successful merge resolution.

        command = [G.GIT, '-C', G.repodir, 'branch', '-D', 'trial']
        process = cw.run_process(command)

        expected = 'No changes since last commit\n'
        self.assertEqual(git.output, expected)