本文整理汇总了Python中PyGitUp.gitup.GitUp类的典型用法代码示例。如果您正苦于以下问题:Python GitUp类的具体用法?Python GitUp怎么用?Python GitUp使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GitUp类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_submodules
def test_submodules():
""" Run 'git up' with submodules """
repo = Repo(repo_path)
repo_head = repo.head.commit.hexsha
submod_head = repo.submodules[0].hexsha
os.chdir(join(repo_path, 'sub'))
from PyGitUp.gitup import GitUp
gitup = GitUp(testing=True)
# PyGitUp uses the submodule instead of the toplevel git repo
assert_equal(submod_head, gitup.git.repo.head.commit.hexsha)
gitup.run()
repo = Repo(repo_path)
assert_equal(len(gitup.states), 1)
assert_equal(gitup.states[0], 'fast-forwarding')
# Repo itself is unchanged:
assert_equal(repo.head.commit.hexsha, repo_head)
# Submodule is changed:
assert_not_equal(gitup.git.repo.head.commit.hexsha, submod_head)
示例2: test_rebase_error
def test_rebase_error():
""" Run 'git up' with a failing rebase """
os.chdir(repo_path)
from PyGitUp.gitup import GitUp
gitup = GitUp(testing=True)
gitup.run()
示例3: test_detached
def test_detached():
""" Run 'git up' with detached head """
os.chdir(repo_path)
from PyGitUp.gitup import GitUp
gitup = GitUp(testing=True)
gitup.run()
示例4: test_fetch_fail
def test_fetch_fail():
""" Run 'git up' with a non-existent remote """
os.chdir(repo_path)
from PyGitUp.gitup import GitUp
gitup = GitUp(testing=True)
gitup.run()
示例5: test_stash_error
def test_stash_error():
""" Run 'git up' with an error while stashing """
os.chdir(repo_path)
from PyGitUp.gitup import GitUp
gitup = GitUp(testing=True)
gitup.run()
示例6: test_unstash_error
def test_unstash_error():
""" Run 'git up' with an unclean unstash """
os.chdir(repo_path)
from PyGitUp.gitup import GitUp
gitup = GitUp(testing=True)
gitup.run()
示例7: test_checkout_error
def test_checkout_error():
""" Run 'git up' with checkout errors """
os.chdir(repo_path)
from PyGitUp.gitup import GitUp
gitup = GitUp(testing=True)
gitup.run()
示例8: test_bundler
def test_bundler():
""" Run bundler integration """
shell = True if platform.system() == 'Windows' else False
if os.environ.get('TRAVIS', False):
raise SkipTest('Skip this test on Travis CI :(')
# Helper methods
def is_installed(prog):
dev_null = open(os.devnull, 'wb')
try:
return_value = subprocess.call([prog, '--version'], shell=shell,
stdout=dev_null, stderr=dev_null)
return return_value == 0
except OSError:
return False
def get_output(cmd):
return str(subprocess.check_output(cmd, shell=shell))
# Check for ruby and bundler
if not (is_installed('ruby') and is_installed('gem')
and 'bundler' in get_output(['gem', 'list'])):
# Ruby not installed, skip test
raise SkipTest('Ruby not installed, skipped Bundler integration test')
os.chdir(repo_path)
from PyGitUp.gitup import GitUp
gitup = GitUp(testing=True)
gitup.run()
示例9: test_fast_forwarded
def test_fast_forwarded():
""" Fail correctly when a rebase would overwrite untracked files """
os.chdir(repo_path)
from PyGitUp.gitup import GitUp
gitup = GitUp(testing=True)
gitup.run()
示例10: test_out_of_tree
def test_out_of_tree():
""" Run 'git up' with an out-of-tree source """
os.chdir(work_tree)
from PyGitUp.gitup import GitUp
gitup = GitUp(testing=True)
gitup.run()
assert_equal(gitup.states, ['fast-forwarding'])
示例11: test_fast_forwarded
def test_fast_forwarded():
""" Run 'git up' with result: fast-forwarding """
os.chdir(repo_path)
from PyGitUp.gitup import GitUp
gitup = GitUp(testing=True)
gitup.run()
assert_equal(len(gitup.states), 1)
assert_equal(gitup.states[0], 'fast-forwarding')
示例12: test_remote_branch_deleted
def test_remote_branch_deleted():
""" Run 'git up' with remotely deleted branch """
os.chdir(repo_path)
from PyGitUp.gitup import GitUp
gitup = GitUp(testing=True)
gitup.run()
assert_equal(len(gitup.states), 2)
assert_equal(gitup.states[1], 'remote branch doesn\'t exist')
示例13: test_ahead_of_upstream
def test_ahead_of_upstream():
""" Run 'git up' with result: ahead of upstream """
os.chdir(repo_path)
from PyGitUp.gitup import GitUp
gitup = GitUp(testing=True)
gitup.run()
assert_equal(len(gitup.states), 1)
assert_equal(gitup.states[0], 'ahead')
示例14: test_issue_55
def test_issue_55():
""" Regression test for #55 """
os.chdir(repo_path)
from PyGitUp.gitup import GitUp
gitup = GitUp(testing=True)
gitup.run()
assert_equal(len(gitup.states), 1)
assert_equal(gitup.states[0], 'fast-forwarding')
示例15: test_rebase_arguments
def test_rebase_arguments():
""" Run 'git up' with rebasing.arguments """
os.chdir(repo_path)
from PyGitUp.gitup import GitUp
gitup = GitUp(testing=True)
gitup.run()
assert_equal(len(gitup.states), 1)
assert_equal(gitup.states[0], 'rebasing')