aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2011-10-22 13:54:16 +0200
committerGuido Günther <agx@sigxcpu.org>2011-10-23 16:18:53 +0200
commit83fd2c679fb4eb0aad0a05f95968603d04b3fab6 (patch)
tree15ebe72e6450d9d84c6716052b61d45c6fd3d047 /tests
parenta65c430b9414e166d9b6d9731fab636f710565b5 (diff)
GitRepository: add commit and commit_all
to commit the current state of the index and all changes.
Diffstat (limited to 'tests')
-rw-r--r--tests/03_test_gbp_branch.py2
-rw-r--r--tests/04_test_gbp_submodules.py18
2 files changed, 9 insertions, 11 deletions
diff --git a/tests/03_test_gbp_branch.py b/tests/03_test_gbp_branch.py
index a99391d0..49ba9b76 100644
--- a/tests/03_test_gbp_branch.py
+++ b/tests/03_test_gbp_branch.py
@@ -40,7 +40,7 @@ def test_add_files():
"""Add some dummy data"""
shutil.copy(".git/HEAD", "testfile")
repo.add_files('.', force=True)
- gbp.command_wrappers.GitCommand("commit", ["-mfoo", "-a"])()
+ repo.commit_all(msg="foo")
assert True
def test_branch_master():
diff --git a/tests/04_test_gbp_submodules.py b/tests/04_test_gbp_submodules.py
index a6b66bb6..aaa1582d 100644
--- a/tests/04_test_gbp_submodules.py
+++ b/tests/04_test_gbp_submodules.py
@@ -5,6 +5,7 @@ import shutil
import tarfile
import tempfile
+import gbp.log
import gbp.git
import gbp.command_wrappers
@@ -29,6 +30,7 @@ class Submodule(object):
def setup():
global repo, repodir, submodules, top, tmpdir
+ gbp.log.setup(False, True)
top = os.path.abspath(os.curdir)
tmpdir =os.path.join(top,'gbp_%s_repo' % __name__)
os.mkdir(tmpdir)
@@ -53,15 +55,15 @@ def test_empty_has_submodules():
assert not repo.has_submodules()
-def _add_dummy_data(msg):
+def _add_dummy_data(repo, msg):
shutil.copy(".git/HEAD", testfile_name)
repo.add_files('.', force=True)
- gbp.command_wrappers.GitCommand("commit", ["-m%s" % msg, "-a"])()
+ repo.commit_all(msg)
def test_add_files():
"""Add some dummy data"""
- _add_dummy_data("initial commit")
+ _add_dummy_data(repo, "initial commit")
assert True
@@ -69,7 +71,7 @@ def test_add_submodule_files():
"""Add some dummy data"""
for submodule in submodules:
os.chdir(submodule.dir)
- _add_dummy_data("initial commit in submodule")
+ _add_dummy_data(submodule.repo, "initial commit in submodule")
os.chdir(repodir)
assert True
@@ -77,9 +79,7 @@ def test_add_submodule_files():
def test_add_submodule():
"""Add a submodule"""
repo.add_submodule(submodules[0].dir)
- gbp.command_wrappers.GitCommand("commit",
- ["-m 'Added submodule %s'" % submodules[0].dir,
- "-a"])()
+ repo.commit_all(msg='Added submodule %s' % submodules[0].dir)
def test_has_submodules():
"""Check for submodules"""
@@ -123,9 +123,7 @@ def test_check_tarfile():
def test_add_whitespace_submodule():
"""Add a second submodule with name containing whitespace"""
repo.add_submodule(submodules[1].dir)
- gbp.command_wrappers.GitCommand("commit",
- ["-m 'Added submodule %s'" % submodules[0].dir,
- "-a"])()
+ repo.commit_all(msg='Added submodule %s' % submodules[0].dir)
def test_get_more_submodules():
"""Check for submodules list of (name, hash)"""