예제 #1
0
 def test_commit_commit(self):
     with GitDir() as dir:
         dir.create_git_commit()
         commit_id = dir.create_git_commit()
         version_info = versioninforeader.from_git(dir.dir)
         self.assertEqual(VersionInfo("master", 2, commit_id, False, False),
                          version_info)
예제 #2
0
 def test_commit_tag_commit(self):
     with GitDir() as dir:
         dir.create_git_commit()
         dir.create_git_tag("tagname")
         commit_id = dir.create_git_commit()
         version_info = versioninforeader.from_git(dir.dir)
         self.assertEqual(VersionInfo("tagname", 1, commit_id, True, False), version_info)
예제 #3
0
 def test_commit_with_tracked_file(self):
     with GitDir() as dir:
         commit_id = dir.create_git_commit()
         dir.add_tracked_file()
         version_info = versioninforeader.from_git(dir.dir)
         self.assertEqual(VersionInfo("master", 1, commit_id, False, True),
                          version_info)
예제 #4
0
 def test_commit_with_modified_file(self):
     with GitDir() as dir:
         filename = dir.add_tracked_file()
         commit_id = dir.create_git_commit()
         dir.modify_file(filename)
         version_info = versioninforeader.from_git(dir.dir)
         self.assertEqual(VersionInfo("master", 1, commit_id, False, True), version_info)
예제 #5
0
 def test_tag_with_tracked_file(self):
     with GitDir() as dir:
         commit_id = dir.create_git_commit()
         dir.create_git_tag("mytag")
         dir.add_tracked_file()
         version_info = versioninforeader.from_git(dir.dir)
         self.assertEqual(VersionInfo("mytag", 0, commit_id, True, True), version_info)
예제 #6
0
 def test_commit_branch_commit(self):
     with GitDir() as dir:
         dir.create_git_commit()
         dir.create_git_branch("newbranch")
         commit_id = dir.create_git_commit()
         version_info = versioninforeader.from_git(dir.dir)
         self.assertEqual(VersionInfo("newbranch", 2, commit_id, False, False), version_info)
예제 #7
0
 def test_commit_tag(self):
     with GitDir() as dir:
         commit_id = dir.create_git_commit()
         dir.create_git_tag("tagname")
         version_info = versioninforeader.from_git(dir.dir)
         self.assertEqual(VersionInfo("tagname", 0, commit_id, True, False),
                          version_info)
예제 #8
0
 def test_tag_with_untracked_file(self):
     with GitDir() as dir:
         commit_id = dir.create_git_commit()
         dir.create_git_tag("mytag")
         dir.add_untracked_file()
         version_info = versioninforeader.from_git(dir.dir)
         self.assertEqual(VersionInfo("mytag", 0, commit_id, True, True),
                          version_info)
예제 #9
0
 def test_commit_branch(self):
     with GitDir() as dir:
         commit_id = dir.create_git_commit()
         dir.create_git_branch("newbranch")
         version_info = versioninforeader.from_git(dir.dir)
         self.assertEqual(
             VersionInfo("newbranch", 1, commit_id, False, False),
             version_info)
예제 #10
0
 def test_commit_branchedcommit(self):
     with GitDir() as dir:
         commit_id = dir.create_git_commit()
         dir.create_git_branch("newbranch")
         dir.create_git_commit()
         dir.switch_git_branch("master")
         version_info = versioninforeader.from_git(dir.dir)
         self.assertEqual(VersionInfo("master", 1, commit_id, False, False), version_info)
예제 #11
0
 def test_commit_commit_tag_rewind(self):
     with GitDir() as dir:
         dir.create_git_commit()
         commit_id = dir.create_git_commit()
         dir.create_git_commit()
         dir.create_git_tag("tagname")
         dir.checkout_git_commit(commit_id)
         version_info = versioninforeader.from_git(dir.dir)
         self.assertEqual(VersionInfo("HEAD", 2, commit_id, False, False), version_info)
예제 #12
0
 def test_commit_branchedtaggedcommit(self):
     with GitDir() as dir:
         commit_id = dir.create_git_commit()
         dir.create_git_branch("newbranch")
         dir.create_git_commit()
         dir.create_git_tag("mytag")
         dir.switch_git_branch("master")
         version_info = versioninforeader.from_git(dir.dir)
         self.assertEqual(VersionInfo("master", 1, commit_id, False, False),
                          version_info)
예제 #13
0
 def test_commit_tag_branchedtaggedcommit(self):
     with GitDir() as dir:
         commit_id = dir.create_git_commit()
         dir.create_git_tag("originaltag")
         dir.create_git_branch("newbranch")
         dir.create_git_commit()
         dir.create_git_tag("newtag")
         dir.switch_git_branch("master")
         version_info = versioninforeader.from_git(dir.dir)
         self.assertEqual(VersionInfo("originaltag", 0, commit_id, True, False), version_info)
예제 #14
0
 def test_tag_commit_with_modified_file(self):
     with GitDir() as dir:
         filename = dir.add_tracked_file()
         dir.create_git_commit()
         dir.create_git_tag("mytag")
         commit_id = dir.create_git_commit()
         dir.modify_file(filename)
         version_info = versioninforeader.from_git(dir.dir)
         self.assertEqual(VersionInfo("mytag", 1, commit_id, True, True),
                          version_info)
예제 #15
0
 def test_commit_tag_commit_branch_commit(self):
     with GitDir() as dir:
         dir.create_git_commit()
         dir.create_git_tag("mytag")
         dir.create_git_commit()
         dir.create_git_branch("newbranch")
         commit_id = dir.create_git_commit()
         version_info = versioninforeader.from_git(dir.dir)
         self.assertEqual(VersionInfo("mytag", 2, commit_id, True, False),
                          version_info)
예제 #16
0
 def test_commit_commit_tag_rewind(self):
     with GitDir() as dir:
         dir.create_git_commit()
         commit_id = dir.create_git_commit()
         dir.create_git_commit()
         dir.create_git_tag("tagname")
         dir.checkout_git_commit(commit_id)
         version_info = versioninforeader.from_git(dir.dir)
         self.assertEqual(VersionInfo("HEAD", 2, commit_id, False, False),
                          version_info)
예제 #17
0
def get_version(git_directory):
    return versioninforeader.from_git(git_directory)
예제 #18
0
 def test_empty(self):
     with GitDir() as dir:
         version_info = versioninforeader.from_git(dir.dir)
         self.assertEqual(VersionInfo("HEAD", 0, "0", False, False), version_info)
예제 #19
0
 def test_empty_with_tracked_file(self):
     with GitDir() as dir:
         dir.add_tracked_file()
         version_info = versioninforeader.from_git(dir.dir)
         self.assertEqual(VersionInfo("HEAD", 0, "0", False, True),
                          version_info)
예제 #20
0
 def test_empty_with_tracked_file(self):
     with GitDir() as dir:
         dir.add_tracked_file()
         version_info = versioninforeader.from_git(dir.dir)
         self.assertEqual(VersionInfo("HEAD", 0, "0", False, True), version_info)
예제 #21
0
 def test_empty(self):
     with GitDir() as dir:
         version_info = versioninforeader.from_git(dir.dir)
         self.assertEqual(VersionInfo("HEAD", 0, "0", False, False),
                          version_info)