Пример #1
0
def setup():
    master_path, master = init_master(test_name)

    # Prepare master repo
    master.git.checkout(b=test_name)

    # Clone to test repo
    path = join(basepath, test_name)

    master.clone(path, b=test_name)
    repo = Repo(path, odbt=GitCmdObjectDB)

    assert repo.working_dir == path

    # Modify file in master
    update_file(master, test_name)

    # Modify file in our repo
    contents = 'completely changed!'
    repo_file = join(path, testfile_name)

    write_file(repo_file, contents)
    repo.index.add([repo_file])
    repo.index.commit(test_name)

    # Modify file in master
    update_file(master, test_name)
Пример #2
0
def setup():
    master_path, master = init_master(test_name)

    # Prepare master repo
    master.git.checkout(b=test_name)

    # Crate test repo
    path = join(basepath, test_name)
    master.clone(path, b=test_name)
    repo = Repo(path, odbt=GitCmdObjectDB)
    # repo = Repo.init(path)
    # update_file(repo, 'Initial commit')

    os.chdir(path)
    assert repo.working_dir == path

    # Rename test repo branch
    repo.git.branch(test_name + '_renamed', m=True)

    # Add subrepo
    write_file(join(path, '.gitmodules'), '')
    repo.create_submodule('sub', 'sub', master_path)
    repo.git.add('.gitmodules', 'sub/')
    repo.git.commit(m='Added submodule')
    repo.git.submodule('init')

    # Modify file in master
    update_file(master, test_name)
Пример #3
0
def setup():
    master1_path, master1 = init_master(test_name + '.1')

    # Prepare master repo
    master1.git.checkout(b=test_name)

    # Clone to test repo
    path = join(basepath, test_name)

    master1.clone(path, b=test_name)
    repo = Repo(path, odbt=GitCmdObjectDB)

    assert repo.working_dir == path

    # Modify file in master
    update_file(master1, test_name)

    # Create second remote
    master2_path = join(basepath, 'master.' + test_name + '.2')
    master1.clone(master2_path, b=test_name)
    master2 = Repo(master2_path, odbt=GitCmdObjectDB)

    # Add second master as remote, too
    repo.git.checkout(b=test_name + '.2')
    repo.git.remote('add', 'upstream', master2_path)
    repo.git.fetch(all=True)
    repo.git.branch(set_upstream_to='upstream/' + test_name)

    update_file(master2, test_name)
Пример #4
0
def setup():
    master_path, master = init_master(test_name)

    # Prepare master repo
    master.git.checkout(b=test_name)

    # Clone to test repo
    path = join(basepath, test_name)
    master.clone(path, b=test_name)

    repo = Repo(path, odbt=GitCmdObjectDB)

    assert repo.working_dir == path

    # Create new local branch and set upstream
    repo.git.checkout(b=new_branch_name)
    repo.git.branch(u=origin_test_name)

    # Make non-conflicting change in new branch
    update_file(repo, new_branch_name, filename=another_file_name)

    # Modify file in master
    update_file(master, test_name)

    # Update first branch
    repo.git.checkout(test_name)
    repo.git.pull()
Пример #5
0
def setup():
    master_path, master = init_master(test_name)

    # Prepare master repo
    master.git.checkout(b=test_name)

    # Clone to test repo
    path = join(basepath, test_name)

    master.clone(path, b=test_name)
    repo = Repo(path, odbt=GitCmdObjectDB)

    assert repo.working_dir == path

    # Set git-up.rebase.log-hook
    if platform.system() == 'Windows':
        repo.git.config(
            'git-up.rebase.log-hook',
            'IF [%1]==[] exit 1; '  # Note: this whole string is one line
            'IF [%2]==[] exit 1; '  # and will be split by 'git up' to
            'git log -n 1 $1 > nul; '  # multiple lines.
            'git log -n 1 $2 > nul;')
    else:
        repo.git.config(
            'git-up.rebase.log-hook',
            'if [ -z "$1" -a -z "$2" ]; then exit 1; fi;'
            'git log -n 1 "$1" &> /dev/null; '
            'git log -n 1 "$2" &> /dev/null;')

    # Modify file in master
    update_file(master, test_name)
Пример #6
0
def setup():
    master_path, master = init_master(test_name)

    # Prepare master repo
    master.git.checkout(b=test_name)

    # Clone to test repo
    path = join(basepath, test_name)

    master.clone(path, b=test_name)
    repo = Repo(path, odbt=GitCmdObjectDB)

    assert repo.working_dir == path

    # Set git-up.rebase.log-hook
    if platform.system() == 'Windows':
        repo.git.config(
            'git-up.rebase.log-hook',
            'IF [%1]==[] exit 1; '  # Note: this whole string is one line
            'IF [%2]==[] exit 1; '  # and will be split by 'git up' to
            'git log -n 1 $1 > nul; '   # multiple lines.
            'git log -n 1 $2 > nul;'
        )
    else:
        repo.git.config(
            'git-up.rebase.log-hook',
            'if [ -z "$1" -a -z "$2" ]; then exit 1; fi;'
            'git log -n 1 "$1" &> /dev/null; '
            'git log -n 1 "$2" &> /dev/null;'
        )

    # Modify file in master
    update_file(master, test_name)
Пример #7
0
def setup():
    master_path, master = init_master(test_name)

    # Prepare master repo
    master.git.checkout(b=test_name)

    # Clone to test repo
    path = join(basepath, test_name)

    master.clone(path, b=test_name)
    repo = Repo(path, odbt=GitCmdObjectDB)

    assert repo.working_dir == path

    # Modify file in master
    update_file(master, test_name)

    # Modify file in our repo
    contents = 'completely changed!'
    repo_file = join(path, testfile_name)

    write_file(repo_file, contents)
    repo.index.add([repo_file])
    repo.index.commit(test_name)

    # Modify file in master
    update_file(master, test_name)
Пример #8
0
def setup():
    global repo_path
    master_path, master = init_master(test_name)

    # Prepare master repo
    master.git.checkout(b=test_name)

    # Create branch with local tracking
    master.git.checkout(b=test_name + '_b', t=True)
    repo_path = master_path

    # Modify tracking branch
    master.git.checkout(test_name)
    update_file(master)
Пример #9
0
def setup():
    master_path, master = init_master(test_name)

    # Prepare master repo
    master.git.checkout(b=test_name)

    # Clone to test repo
    path = join(basepath, test_name)

    master.clone(path, b=test_name)
    repo = Repo(path, odbt=GitCmdObjectDB)

    assert repo.working_dir == path

    # Modify file in master
    update_file(master, test_name)
Пример #10
0
def setup():
    master_path, master = init_master(test_name)

    # Prepare master repo
    master.git.checkout(b=test_name)

    # Clone to test repo
    path = join(basepath, test_name)

    master.clone(path, b=test_name)
    repo = Repo(path, odbt=GitCmdObjectDB)

    assert repo.working_dir == path

    # Modify file in master
    master_file = update_file(master, test_name)

    # Modify file in our repo
    contents = _read_file(master_file)
    contents = contents.replace('line 1', 'line x')
    repo_file = join(path, testfile_name)

    write_file(repo_file, contents)
    repo.index.add([repo_file])
    repo.index.commit(test_name)

    # Set git-up.rebase.arguments to '--abort', what results in an
    # invalid cmd and thus git returning an error, that we look for.
    repo.git.config('git-up.rebase.arguments', '--abort')
Пример #11
0
def setup():
    master_path, master = init_master(test_name)

    # Prepare master repo
    master.git.checkout(b=test_name)

    # Clone to test repo
    path = join(basepath, test_name)

    master.clone(path, b=test_name)
    repo = Repo(path, odbt=GitCmdObjectDB)

    assert repo.working_dir == path

    # Set remote
    repo.git.remote('set-url', 'origin', 'does-not-exist')

    # Modify file in master
    update_file(master, test_name)
def setup():
    master_path, master = init_master(test_name)

    # Prepare master repo
    master.git.checkout(b=test_name)

    # Clone to test repo
    path = join(basepath, test_name)

    master.clone(path, b=test_name)
    repo = Repo(path, odbt=GitCmdObjectDB)

    assert repo.working_dir == path

    # Modify file in master
    update_file(master, test_name, filename='test1.txt')

    # Modify file in working directory
    write_file(join(path, 'test1.txt'), 'Hello world!')
Пример #13
0
def setup():
    master_path, master = init_master(test_name)

    # Prepare master repo
    master.git.checkout(b=test_name)

    # Clone to test repo
    path = join(basepath, test_name)

    master.clone(path, b=test_name)
    repo = Repo(path, odbt=GitCmdObjectDB)

    assert repo.working_dir == path

    # Set git-up.rebase.auto to false
    repo.git.config('git-up.rebase.auto', 'false')

    # Modify file in master
    update_file(master, test_name)

    # Modify file in our repo
    update_file(repo, test_name)