summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2009-11-03 14:28:22 +0100
committerSebastian Thiel <byronimo@gmail.com>2009-11-03 14:48:18 +0100
commitec3d91644561ef59ecdde59ddced38660923e916 (patch)
tree4e18b08cf9fcda3be762522113151dbd1063885e
parente70f3218e910d2b3dcb8a5ab40c65b6bd7a8e9a8 (diff)
downloadgitpython-ec3d91644561ef59ecdde59ddced38660923e916.tar.gz
Finished all push tests I could think of so far. More error cases should be studied, but they would be hard to 'produce'
-rw-r--r--TODO3
-rw-r--r--lib/git/remote.py5
-rw-r--r--test/git/test_remote.py23
3 files changed, 24 insertions, 7 deletions
diff --git a/TODO b/TODO
index 49d6728c..147eb02d 100644
--- a/TODO
+++ b/TODO
@@ -106,9 +106,6 @@ Remote
------
* iter_items should parse the configuration file manually - currently a command
is issued which is much slower than it has to be ( compared to manual parsing )
-* 'push' method needs a test, a true test repository is required though, a fork
- of a fork would do :)!
-* Fetch should return heads that where updated, pull as well.
* Creation and deletion methods for references should be part of the interface, allowing
repo.create_head(...) instaed of Head.create(repo, ...). Its a convenience thing, clearly
* When parsing fetch-info, the regex will not allow spaces in the target remote ref as
diff --git a/lib/git/remote.py b/lib/git/remote.py
index 482df233..1b9c5360 100644
--- a/lib/git/remote.py
+++ b/lib/git/remote.py
@@ -197,7 +197,6 @@ class PushInfo(object):
Create a new PushInfo instance as parsed from line which is expected to be like
c refs/heads/master:refs/heads/master 05d2687..1d0568e
"""
- print line
control_character, from_to, summary = line.split('\t', 3)
flags = 0
@@ -619,6 +618,10 @@ class Remote(LazyMixin, Iterable):
Returns
IterableList(FetchInfo, ...) list of FetchInfo instances providing detailed
information about the fetch results
+
+ Note
+ As fetch does not provide progress information to non-ttys, we cannot make
+ it available here unfortunately as in the 'push' method.
"""
status, stdout, stderr = self.repo.git.fetch(self, refspec, with_extended_output=True, v=True, **kwargs)
return self._get_fetch_info_from_stderr(stderr)
diff --git a/test/git/test_remote.py b/test/git/test_remote.py
index 306d0da3..156e7764 100644
--- a/test/git/test_remote.py
+++ b/test/git/test_remote.py
@@ -299,17 +299,34 @@ class TestRemote(TestBase):
self._test_push_result(res, remote)
assert res[0].flags & PushInfo.DELETED
- self.fail("test --all")
-
# push new branch
+ new_head = Head.create(rw_repo, "my_new_branch")
+ progress = TestPushProgress()
+ res = remote.push(new_head, progress)
+ assert res[0].flags & PushInfo.NEW_HEAD
+ progress.make_assertion()
+ self._test_push_result(res, remote)
- # delete new branch
+ # delete new branch on the remote end and locally
+ res = remote.push(":%s" % new_head.path)
+ self._test_push_result(res, remote)
+ Head.delete(rw_repo, new_head)
+ assert res[-1].flags & PushInfo.DELETED
+
+ # --all
+ res = remote.push(all=True)
+ self._test_push_result(res, remote)
# pull is essentially a fetch + merge, hence we just do a light
# test here, leave the reset to the actual merge testing
# fails as we did not specify a branch and there is no configuration for it
self.failUnlessRaises(GitCommandError, remote.pull)
remote.pull('master')
+
+ # cleanup - delete created tags and branches as we are in an innerloop on
+ # the same repository
+ TagReference.delete(rw_repo, new_tag, other_tag)
+ remote.push(":%s" % other_tag.path)
@with_rw_and_rw_remote_repo('0.1.6')
def test_base(self, rw_repo, remote_repo):