def assert_new_commit(self):
     from gitpy import LocalRepository
     from os import curdir
     repository = LocalRepository(curdir)
     head = repository.getHead().hash
     yield
     self.assertNotEquals(head, repository.getHead().hash)
 def assert_new_commit(self):
     from gitpy import LocalRepository
     from os import curdir
     repository = LocalRepository(curdir)
     head = repository.getHead().hash
     yield
     self.assertNotEquals(head, repository.getHead().hash)
예제 #3
0
파일: test_remotes.py 프로젝트: tepas/gitpy
 def testAddingRemotes(self):
     new_repo = LocalRepository(utils.get_temporary_location())
     new_repo.init()
     with open(os.path.join(new_repo.path, "some_file"), "wb") as f:
         print >> f, "new file"
     new_repo.addAll()
     new_repo.commit(message="initial change")
     REMOTE_NAME = 'remote'
     remote = new_repo.addRemote(REMOTE_NAME, self.repo.path)
     self.assertEquals(remote.name, REMOTE_NAME)
     self.assertEquals(remote.url, self.repo.path)
     self.assertFalse(new_repo.containsCommit(self.repo.getHead()))
     remote.fetch()
     remote.prune()
     self.assertTrue(new_repo.containsCommit(self.repo.getHead()))
     branches = list(remote.getBranches())
     self.assertTrue(len(branches) > 0)
     for branch in branches:
         self.assertTrue(type(branch in new_repo.getHead()) is bool)
예제 #4
0
 def extract_version_tag_from_git():
     from gitpy import LocalRepository
     from os import curdir, path
     repository = LocalRepository(curdir)
     branch = repository.getCurrentBranch()
     head = repository.getHead()
     if branch is None:
         return get_commit_describe(head)
     current_branch = branch.name
     stripped_branch = current_branch.split('/')[0]
     if stripped_branch in ('release', 'support', 'hotfix'):
         return get_commit_describe(head)
     if 'master' in stripped_branch:
         return get_commit_describe(head)
     else:
         try:
             return get_commit_describe(head, 'v*')
         except:
             pass
         return get_commit_describe(head)
     pass