Esempio n. 1
0
    def test_is_up_to_date(self):
        """应该能探测是否是已经merge过的"""
        with setup2repos('prj_uptodate') as (path, repo, fork_path, fork_repo):

            with self.clone_clean(path) as work_path:
                with chdir(work_path):
                    gyt.call(['git', 'pull', fork_path])
                    gyt.call(['git', 'push', 'origin', 'master'])

            pullreq = PullRequest.open(fork_repo, 'master', repo, 'master')
            ok_(pullreq.is_up_to_date())
Esempio n. 2
0
    def test_is_up_to_date(self):
        """应该能探测是否是已经merge过的"""
        with setup2repos('prj_uptodate') as (path, repo, fork_path, fork_repo):

            with self.clone_clean(path) as work_path:
                with chdir(work_path):
                    gyt.call(['git', 'pull', fork_path])
                    gyt.call(['git', 'push', 'origin', 'master'])

            pullreq = PullRequest.open(fork_repo, 'master', repo, 'master')
            ok_(pullreq.is_up_to_date())
Esempio n. 3
0
    def test_git_check_version(self):
        _, _, ver = gyt.call(gyt.GIT_EXECUTABLE, 'version').split()

        def _ver_num(ver):
            return [int(n) for n in ver.split('.')]

        assert _ver_num(ver) >= _ver_num(gyt.GIT_MIN_VERSION)
Esempio n. 4
0
 def test_simple_commit_in_branch_in_subdir(self):
     repo = self._repo('test', bare=False)
     self._commit(repo, 'test/file1', 'content1', 'msg1')
     tmp_branch = repo.temp_branch_name()
     repo.commit_one_file('test/file1', 'content1 modified', 'change1',
                          self.u, orig_hash=hash('content1'),
                          branch=tmp_branch)
     with mkdtemp() as tmpdir:
         gyt.call(['git', 'clone', repo.path, tmpdir])
         repo_check = gyt.repo(tmpdir, bare=False)
         src = repo_check.call('show HEAD:test/file1')
         assert src == u'content1'
         repo_check.call('checkout master')
         src = repo_check.call('show HEAD:test/file1')
         assert src == u'content1'
         repo_check.call('checkout %s' % tmp_branch)
         src = repo_check.call('show HEAD:test/file1')
         assert src == u'content1 modified'
         repo_check.call('checkout master')
         src = repo_check.call('show HEAD:test/file1')
         assert src == u'content1'
 def test_simple_commit_in_branch_in_subdir(self):
     repo = self._repo("test", bare=False)
     self._commit(repo, "test/file1", "content1", "msg1")
     tmp_branch = repo.temp_branch_name()
     repo.commit_one_file(
         "test/file1", "content1 modified", "change1", self.u, orig_hash=hash("content1"), branch=tmp_branch
     )
     with mkdtemp() as tmpdir:
         gyt.call(["git", "clone", repo.path, tmpdir])
         repo_check = gyt.repo(tmpdir, bare=False)
         src = repo_check.call("show HEAD:test/file1")
         assert src == u"content1"
         repo_check.call("checkout master")
         src = repo_check.call("show HEAD:test/file1")
         assert src == u"content1"
         repo_check.call("checkout %s" % tmp_branch)
         src = repo_check.call("show HEAD:test/file1")
         assert src == u"content1 modified"
         repo_check.call("checkout master")
         src = repo_check.call("show HEAD:test/file1")
         assert src == u"content1"
 def test_simple_commit_in_branch_in_subdir(self):
     repo = self._repo('test', bare=False)
     self._commit(repo, 'test/file1', 'content1', 'msg1')
     tmp_branch = repo.temp_branch_name()
     repo.commit_one_file('test/file1',
                          'content1 modified',
                          'change1',
                          self.u,
                          orig_hash=hash('content1'),
                          branch=tmp_branch)
     with mkdtemp() as tmpdir:
         gyt.call(['git', 'clone', repo.path, tmpdir])
         repo_check = gyt.repo(tmpdir, bare=False)
         src = repo_check.call('show HEAD:test/file1')
         assert src == u'content1'
         repo_check.call('checkout master')
         src = repo_check.call('show HEAD:test/file1')
         assert src == u'content1'
         repo_check.call('checkout %s' % tmp_branch)
         src = repo_check.call('show HEAD:test/file1')
         assert src == u'content1 modified'
         repo_check.call('checkout master')
         src = repo_check.call('show HEAD:test/file1')
         assert src == u'content1'
Esempio n. 7
0
def new_git_bare_repo():
    with mkdtemp() as tmpdir:
        gyt.call(['git', 'init', '--bare', tmpdir])
        yield tmpdir
Esempio n. 8
0
def clone(git_dir):
    with mkdtemp() as work_path:
        gyt.call(['git', 'clone', git_dir, work_path])
        assert os.path.exists(work_path + '/.git')
        yield work_path

        with chdir(work_path):
            gyt.call(['git', 'config', 'user.name', 'test author'])
            gyt.call(['git', 'config', 'user.email', '*****@*****.**'])
            gyt.call(['git', 'add', "."])
            gyt.call(['git', 'commit', '-m', 'test'], _raise=True)
            gyt.call(['git', 'push', 'origin', 'master'], _raise=True)
Esempio n. 9
0
 def test_call_with_unicode(self):
     assert 'aaaaa' == gyt.call(u"echo aaaaa")
     test_str = u"aaaaa太牛了!"
     assert test_str == gyt.call("echo '%s'" % test_str)
Esempio n. 10
0
 def xxxxxx_git_call_with_int_in_list(self):
     # BROKEN, maybe no need to fix? TODO
     ok = gyt.call(gyt.GIT_EXECUTABLE, ['rev-parse', 123], _raise=False)
     assert ok == False
Esempio n. 11
0
 def clone_clean(self, git_dir):
     with mkdtemp() as work_path:
         gyt.call(['git', 'clone', git_dir, work_path])
         assert os.path.exists(join(work_path, '.git'))
         yield work_path
Esempio n. 12
0
    def test_git_check_version(self):
        _, _, ver = gyt.call(gyt.GIT_EXECUTABLE, 'version').split()

        def _ver_num(ver):
            return [int(n) for n in ver.split('.')]
        assert _ver_num(ver) >= _ver_num(gyt.GIT_MIN_VERSION)
Esempio n. 13
0
 def test_git_call_error_raise(self):
     gyt.call(gyt.GIT_EXECUTABLE, 'unexisting___command__')
Esempio n. 14
0
 def clone_clean(self, git_dir):
     with mkdtemp() as work_path:
         gyt.call(['git', 'clone', git_dir, work_path])
         assert os.path.exists(join(work_path, '.git'))
         yield work_path
Esempio n. 15
0
 def xxxxxx_git_call_with_int_in_list(self):
     # BROKEN, maybe no need to fix? TODO
     ok = gyt.call(gyt.GIT_EXECUTABLE, ['rev-parse', 123], _raise=False)
     assert ok == False
Esempio n. 16
0
 def test_call_with_unicode(self):
     assert 'aaaaa' == gyt.call(u"echo aaaaa")
     test_str = u"aaaaa太牛了!"
     assert test_str == gyt.call("echo '%s'" % test_str)
Esempio n. 17
0
 def test_git_call_with_int_in_list(self):
     ok = gyt.call([gyt.GIT_EXECUTABLE, 'rev-parse', 123], _raise=False)
     assert ok == False
Esempio n. 18
0
 def test_git_call_error_raise(self):
     gyt.call(gyt.GIT_EXECUTABLE, 'unexisting___command__')
Esempio n. 19
0
 def test_git_call_error(self):
     out = gyt.call(
         gyt.GIT_EXECUTABLE, 'unexisting___command__', _raise=False)
     assert out is False
Esempio n. 20
0
def new_git_bare_repo():
    with mkdtemp() as tmpdir:
        gyt.call(['git', 'init', '--bare', tmpdir])
        yield tmpdir
Esempio n. 21
0
 def test_gyt_call_command_as_string(self):
     out = gyt.call(gyt.GIT_EXECUTABLE, ['help', 'init'])
     assert 'git init' in out
Esempio n. 22
0
def clone(git_dir):
    with mkdtemp() as work_path:
        gyt.call(['git', 'clone', git_dir, work_path])
        assert os.path.exists(work_path + '/.git')
        yield work_path

        with chdir(work_path):
            gyt.call(['git', 'config', 'user.name', 'test author'])
            gyt.call(['git', 'config', 'user.email', '*****@*****.**'])
            gyt.call(['git', 'add', "."])
            gyt.call(['git', 'commit', '-m', 'test'], _raise=True)
            gyt.call(['git', 'push', 'origin', 'master'], _raise=True)
Esempio n. 23
0
 def test_git_call_version(self):
     out = gyt.call(gyt.GIT_EXECUTABLE, 'version')
     assert 'git' in out
Esempio n. 24
0
 def test_git_call_with_int_in_list(self):
     ok = gyt.call([gyt.GIT_EXECUTABLE, 'rev-parse', 123], _raise=False)
     assert ok == False
Esempio n. 25
0
 def test_git_call_error(self):
     out = gyt.call(gyt.GIT_EXECUTABLE,
                    'unexisting___command__',
                    _raise=False)
     assert out is False
Esempio n. 26
0
 def test_git_call_version(self):
     out = gyt.call(gyt.GIT_EXECUTABLE, 'version')
     assert 'git' in out
Esempio n. 27
0
 def test_gyt_call_command_as_string(self):
     out = gyt.call(gyt.GIT_EXECUTABLE, ['help', 'init'])
     assert 'git init' in out