Пример #1
0
    def test_contribute_on_wrong_branch_by_commit(self, git, engine):
        hotfix_mock = mock.MagicMock()
        hotfix_mock.name.startswith.return_value = True

        git().branches = [hotfix_mock]

        # ensure that the "commit" isn't in the iter_parents
        hotfix_mock.commit = False
        git().head.reference.object.iter_parents.return_value = [True]

        assert not engine.contribute_hotfix()
Пример #2
0
def git_sync_temp(proj_id, dest_path):
    '''
    change path to project repository

    configure dest_path as other remote repository

    execute pull from the other remote repository

    change back to the original path

    ref: http://stackoverflow.com/questions/1683531/how-to-import-existing-git-repository-into-another
    '''

    # change directory to project repository
    original_path = repo_path.cd_proj_repo(proj_id)

    dest_path_list = os.listdir(dest_path)
    other_repo_path = os.path.join(dest_path, dest_path_list[0])

    # configure other remote repository
    remote_string = "remote add other %s" % (other_repo_path)
    print(("download_n_sync() :", remote_string))
    git(remote_string)

    # execute pull
    git("fetch other")
    git("checkout master")
    git("merge other/master")

    # change back to original path
    os.chdir(original_path)
Пример #3
0
    def test_contribute(self, git, engine, release_manager):
        hotfix_mock = mock.MagicMock()
        hotfix_mock.name.startswith.return_value = True
        hotfix_mock.commit = True

        git().branches = [hotfix_mock]

        git().head.reference.object.iter_parents.return_value = [True]

        assert engine.contribute_hotfix()

        release_manager.assert_has_calls([
            mock.call().contribute(git().head.reference, mock.ANY),
        ])
Пример #4
0
    def test_publish_on_hotfix_branch(self, engine, git, id_generator, repository_structure):
        return_branch = engine.develop
        git().head.reference.name = repository_structure['hotfix'] + id_generator()

        assert engine.publish_hotfix()

        return_branch.assert_has_calls([
            mock.call.checkout(),
        ])
Пример #5
0
    def test_start_with_existing_release(self, id_generator, git, engine, release_manager):
        name = id_generator()

        release_mock = mock.MagicMock()
        release_mock.name.startswith.return_value = True
        git().branches = [release_mock]

        assert not engine.start_release(name)

        assert release_manager.return_value.call_count == 0
Пример #6
0
    def test_start_with_existing_hotfix(self, id_generator, git, engine, hotfix_manager):
        name = id_generator()

        hotfix_mock = mock.MagicMock()
        hotfix_mock.name.startswith.return_value = True
        git().branches = [hotfix_mock]

        assert not engine.start_hotfix(name)

        assert hotfix_manager.return_value.call_count == 0
Пример #7
0
def git_ci():
    git_up()

    initial_branch = current_branch()

    commit_description = prompt_multiple_lines("Enter a commit description. The frist line will be the summary.")
    commit_description_by_line = commit_description.split("\n")
    summary = commit_description_by_line[0]

#    git("checkout", "master")
#    git("merge --squash", initial_branch)

    git_subtree_push("scripts", "scripts")
    git_subtree_push("primary", "app/assets/stylesheets/primary")

    # Git up will merge in master and any subtree changes
    # We then want to push your branch to origin HEAD
    # Open a pull request with your summary and close any issues.
    # Dump you back on master with all the updated changes.
    git("push -u origin HEAD")
    pull_request(commit_description)
    git("checkout master")
Пример #8
0
    def test_abandon(self, id_generator, engine, feature_manager, git):
        name = id_generator()
        return_branch = mock.MagicMock()
        git().head.reference = return_branch

        assert engine.abandon_feature(name)

        return_branch.assert_has_calls([
            mock.call.checkout(),
        ])

        feature_manager.assert_has_calls([
            mock.call().abandon(name, summary=mock.ANY),
        ])
Пример #9
0
    def test_abandon_while_on_branch(self, id_generator, engine, feature_manager, git, repository_structure):
        name = id_generator()
        git().head.reference.name = repository_structure['feature'] + name
        return_branch = engine.develop

        assert engine.abandon_feature()

        return_branch.assert_has_calls([
            mock.call.checkout(),
        ])

        feature_manager.assert_has_calls([
            mock.call().abandon(name, summary=mock.ANY),
        ])
Пример #10
0
    def test_publish_not_on_hotfix_branch(self, id_generator, git, engine, hotfix_manager):
        name = id_generator()

        return_branch = mock.MagicMock()
        git().head.reference = return_branch

        assert engine.publish_hotfix(name)

        hotfix_manager.assert_has_calls([
            mock.call().publish(name, None, True, mock.ANY),
        ])

        return_branch.assert_has_calls([
            mock.call.checkout(),
        ])
Пример #11
0
    def test_accept(self, id_generator, engine, feature_manager, git):
        name = id_generator()
        return_branch = mock.MagicMock()
        git().head.reference = return_branch

        assert engine.accept_feature(name)

        feature_manager.assert_has_calls([
            mock.call().accept(
                name,
                summary=mock.ANY,
                with_delete=True,
            ),
        ])

        return_branch.assert_has_calls([
            mock.call.checkout(),
        ])
Пример #12
0
def status():
	git("status")
Пример #13
0
def push(remote=None, branch=None):
	remote, branch = get_remote_and_branch(remote, branch)
	git(("push", remote, branch))
Пример #14
0
def pull(remote=None, branch=None):
    remote, branch = get_remote_and_branch(remote, branch)
    git(("pull", remote, branch))
Пример #15
0
def checkout(branch):
    git(("checkout", branch))
Пример #16
0
def commit(message):
    git("""commit -a -m "%s" """ % message.replace('"', '\"'))
Пример #17
0
def status():
    git("status")
Пример #18
0
    allurls=repofiledata.readlines()
    filecount=len(allurls)
    failedfilecount=0
    processedfilecunt=0
    print("Total Files to process "+ str(filecount))
    logfile.write("Total Files to process "+ str(filecount)+"\n")


    for repo in allurls:
        repourl=repo.strip()
        repofolder=repo.split('/')[-1].strip()
        print(repofolder)
        print("Processing "+ repourl)
        try:
            print
            git('clone',repourl,folder_to_clonein+repofolder)
            logfile.write("Successfully processed " + repourl)
            processedfilecunt+=1
        except:
            print(" Failed to Clone " + repourl)
            logfile.write("Processein failed for  " + repourl+"\n")
            failedfilecount+=1


    print("Files Suceessfuly procesed "+ str(processedfilecunt))
    logfile.write("Files Suceessfuly procesed "+ str(filecount-failedfilecount)+"\n")
    print("Files Failed "+ str(failedfilecount))
    logfile.write("Files Failed "+ str(failedfilecount)+"\n")


    logfile.close()
Пример #19
0
def commit(message):
	git("""commit -a -m "%s" """ % message.replace('"', '\"'))
Пример #20
0
def checkout(branch):
	git(("checkout", branch))
Пример #21
0
 def test_contribute_on_wrong_branch_by_existance(self, git, engine):
     git().branches = []
     assert not engine.contribute_hotfix()