Rev 4069: (robertc) fetch() now returns None. (Robert Collins) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Mon Mar 2 09:00:01 GMT 2009
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 4069
revision-id: pqm at pqm.ubuntu.com-20090302085957-qvafywhoynyrgxhb
parent: pqm at pqm.ubuntu.com-20090302075518-h40c3t24efos1k9e
parent: robertc at robertcollins.net-20090302081910-e68wmzs9m81k3iq0
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2009-03-02 08:59:57 +0000
message:
(robertc) fetch() now returns None. (Robert Collins)
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/fetch.py fetch.py-20050818234941-26fea6105696365d
bzrlib/repository.py rev_storage.py-20051111201905-119e9401e46257e3
bzrlib/tests/test_fetch.py testfetch.py-20050825090644-f73e07e7dfb1765a
------------------------------------------------------------
revno: 4065.1.3
revision-id: robertc at robertcollins.net-20090302081910-e68wmzs9m81k3iq0
parent: robertc at robertcollins.net-20090302072002-8e20qt9mv3asyy86
committer: Robert Collins <robertc at robertcollins.net>
branch nick: integration
timestamp: Mon 2009-03-02 19:19:10 +1100
message:
Missed instance of count_copied.
modified:
bzrlib/fetch.py fetch.py-20050818234941-26fea6105696365d
------------------------------------------------------------
revno: 4065.1.2
revision-id: robertc at robertcollins.net-20090302072002-8e20qt9mv3asyy86
parent: robertc at robertcollins.net-20090302044502-ev676ddgmzsvny8u
parent: pqm at pqm.ubuntu.com-20090302070021-dvcjdpf47t2aeari
committer: Robert Collins <robertc at robertcollins.net>
branch nick: fetch.returns-none
timestamp: Mon 2009-03-02 18:20:02 +1100
message:
Merge bzr.dev [fix conflicts with fetch refactoring].
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/fetch.py fetch.py-20050818234941-26fea6105696365d
bzrlib/pack.py container.py-20070607160755-tr8zc26q18rn0jnb-1
bzrlib/remote.py remote.py-20060720103555-yeeg2x51vn0rbtdp-1
bzrlib/repository.py rev_storage.py-20051111201905-119e9401e46257e3
bzrlib/smart/protocol.py protocol.py-20061108035435-ot0lstk2590yqhzr-1
bzrlib/smart/repository.py repository.py-20061128022038-vr5wy5bubyb8xttk-1
bzrlib/smart/request.py request.py-20061108095550-gunadhxmzkdjfeek-1
bzrlib/tests/blackbox/test_branch.py test_branch.py-20060524161337-noms9gmcwqqrfi8y-1
bzrlib/tests/bzrdir_implementations/test_bzrdir.py test_bzrdir.py-20060131065642-0ebeca5e30e30866
bzrlib/tests/interrepository_implementations/__init__.py __init__.py-20060220054744-baf49a1f88f17b1a
bzrlib/tests/per_repository/test_fetch.py test_fetch.py-20070814052151-5cxha9slx4c93uog-1
bzrlib/tests/test_smart.py test_smart.py-20061122024551-ol0l0o0oofsu9b3t-2
bzrlib/tests/test_smart_request.py test_smart_request.p-20090211070731-o38wayv3asm25d6a-1
bzrlib/tests/test_smart_transport.py test_ssh_transport.py-20060608202016-c25gvf1ob7ypbus6-2
bzrlib/versionedfile.py versionedfile.py-20060222045106-5039c71ee3b65490
------------------------------------------------------------
revno: 4065.1.1
revision-id: robertc at robertcollins.net-20090302044502-ev676ddgmzsvny8u
parent: pqm at pqm.ubuntu.com-20090301222412-o2s34646lnn958f3
committer: Robert Collins <robertc at robertcollins.net>
branch nick: fetch.returns-none
timestamp: Mon 2009-03-02 15:45:02 +1100
message:
Change the return value of fetch() to None.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/fetch.py fetch.py-20050818234941-26fea6105696365d
bzrlib/repository.py rev_storage.py-20051111201905-119e9401e46257e3
bzrlib/tests/branch_implementations/test_branch.py testbranch.py-20050711070244-121d632bc37d7253
bzrlib/tests/test_fetch.py testfetch.py-20050825090644-f73e07e7dfb1765a
=== modified file 'NEWS'
--- a/NEWS 2009-03-02 07:00:21 +0000
+++ b/NEWS 2009-03-02 07:20:02 +0000
@@ -108,6 +108,13 @@
updated to comply with this. The code already complied with the other
criteria, but now it is enforced. (Marius Kruger)
+ * ``Branch.fetch`` and ``Repository.fetch`` now return None rather
+ than a count of copied revisions and failed revisions. A while back
+ we stopped ever reporting failed revisions because we started
+ erroring instead, and the copied revisions count is not used in the
+ UI at all - indeed it only reflects the repository status not
+ changes to the branch itself. (Robert Collins)
+
* The ``_fetch_*`` attributes on ``Repository`` are now on
``RepositoryFormat``, more accurately reflecting their intent (they
describe a disk format capability, not state of a particular
=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py 2009-02-26 03:15:58 +0000
+++ b/bzrlib/branch.py 2009-03-02 04:45:02 +0000
@@ -464,9 +464,7 @@
:param last_revision: What revision to stop at (None for at the end
of the branch.
:param pb: An optional progress bar to use.
-
- Returns the copied revision count and the failed revisions in a tuple:
- (copied, failures).
+ :return: None
"""
if self.base == from_branch.base:
return (0, [])
=== modified file 'bzrlib/fetch.py'
--- a/bzrlib/fetch.py 2009-03-02 07:00:21 +0000
+++ b/bzrlib/fetch.py 2009-03-02 08:19:10 +0000
@@ -66,8 +66,6 @@
last_revision
if set, try to limit to the data this revision references.
- after running:
-
This should not be used directly, it's essential a object to encapsulate
the logic in InterRepository.fetch().
"""
@@ -81,9 +79,6 @@
exists to facilitate a hack done in InterPackRepo.fetch. We would
like to remove this parameter.
"""
- # result variables.
- self.count_copied = 0
- self.failed_revisions = []
if to_repository.has_same_location(from_repository):
# repository.fetch should be taking care of this case.
raise errors.BzrError('RepoFetcher run '
@@ -171,7 +166,6 @@
"second push failed to commit the fetch %r." % (
resume_tokens,))
self.sink.finished()
- self.count_copied = source.count_copied
finally:
if self.pb is not None:
self.pb.finished()
=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py 2009-03-02 03:38:07 +0000
+++ b/bzrlib/repository.py 2009-03-02 07:20:02 +0000
@@ -2588,8 +2588,7 @@
content is copied.
:param pb: optional progress bar to use for progress reports. If not
provided a default one will be created.
-
- :returns: (copied_revision_count, failures).
+ :return: None.
"""
from bzrlib.fetch import RepoFetcher
mutter("Using fetch logic to copy between %s(%s) and %s(%s)",
@@ -2599,7 +2598,6 @@
from_repository=self.source,
last_revision=revision_id,
pb=pb, find_ghosts=find_ghosts)
- return f.count_copied, f.failed_revisions
def _walk_to_common_revisions(self, revision_ids):
"""Walk out from revision_ids in source to revisions target has.
@@ -2823,7 +2821,6 @@
from_repository=self.source,
last_revision=revision_id,
pb=pb, find_ghosts=find_ghosts)
- return f.count_copied, f.failed_revisions
@needs_read_lock
def search_missing_revision_ids(self, revision_id=None, find_ghosts=True):
@@ -2904,7 +2901,6 @@
from_repository=self.source,
last_revision=revision_id,
pb=pb, find_ghosts=find_ghosts)
- return f.count_copied, f.failed_revisions
@needs_read_lock
def search_missing_revision_ids(self, revision_id=None, find_ghosts=True):
@@ -2976,7 +2972,6 @@
from bzrlib.fetch import RepoFetcher
fetcher = RepoFetcher(self.target, self.source, revision_id,
pb, find_ghosts)
- return fetcher.count_copied, fetcher.failed_revisions
mutter("Using fetch logic to copy between %s(%s) and %s(%s)",
self.source, self.source._format, self.target, self.target._format)
if revision_id is None:
@@ -3312,7 +3307,6 @@
from bzrlib.fetch import RepoFetcher
fetcher = RepoFetcher(self.target, self.source, revision_id,
pb, find_ghosts)
- return fetcher.count_copied, fetcher.failed_revisions
def copy_content(self, revision_id=None):
self._ensure_real_inter()
@@ -3357,7 +3351,6 @@
from bzrlib.fetch import RepoFetcher
fetcher = RepoFetcher(self.target, self.source, revision_id,
pb, find_ghosts)
- return fetcher.count_copied, fetcher.failed_revisions
def _get_target_pack_collection(self):
return self.target._real_repository._pack_collection
@@ -3648,16 +3641,12 @@
class StreamSource(object):
- """A source of a stream for fetching between repositories.
-
- :ivar count_copied: number of revisions streamed.
- """
+ """A source of a stream for fetching between repositories."""
def __init__(self, from_repository, to_format):
"""Create a StreamSource streaming from from_repository."""
self.from_repository = from_repository
self.to_format = to_format
- self.count_copied = 0
def delta_on_metadata(self):
"""Return True if delta's are permitted on metadata streams.
@@ -3752,7 +3741,6 @@
yield record
else:
raise AssertionError("Unknown knit kind %r" % knit_kind)
- self.count_copied += len(revs)
def get_stream_for_missing_keys(self, missing_keys):
# missing keys can only occur when we are byte copying and not
=== modified file 'bzrlib/tests/test_fetch.py'
--- a/bzrlib/tests/test_fetch.py 2009-02-27 01:02:40 +0000
+++ b/bzrlib/tests/test_fetch.py 2009-03-02 04:45:02 +0000
@@ -53,13 +53,13 @@
self.assertFalse(repo_b.has_revision(br_a.revision_history()[3]))
self.assertTrue(repo_b.has_revision(br_a.revision_history()[2]))
self.assertEquals(len(br_b.revision_history()), 7)
- self.assertEquals(br_b.fetch(br_a, br_a.revision_history()[2])[0], 0)
+ br_b.fetch(br_a, br_a.revision_history()[2])
# branch.fetch is not supposed to alter the revision history
self.assertEquals(len(br_b.revision_history()), 7)
self.assertFalse(repo_b.has_revision(br_a.revision_history()[3]))
# fetching the next revision up in sample data copies one revision
- self.assertEquals(br_b.fetch(br_a, br_a.revision_history()[3])[0], 1)
+ br_b.fetch(br_a, br_a.revision_history()[3])
self.assertTrue(repo_b.has_revision(br_a.revision_history()[3]))
self.assertFalse(has_revision(br_a, br_b.revision_history()[6]))
self.assertTrue(br_a.repository.has_revision(br_b.revision_history()[5]))
@@ -67,22 +67,20 @@
# When a non-branch ancestor is missing, it should be unlisted...
# as its not reference from the inventory weave.
br_b4 = self.make_branch('br_4')
- count, failures = br_b4.fetch(br_b)
- self.assertEqual(count, 7)
- self.assertEqual(failures, [])
+ br_b4.fetch(br_b)
- self.assertEqual(writable_a.fetch(br_b)[0], 1)
+ writable_a.fetch(br_b)
self.assertTrue(has_revision(br_a, br_b.revision_history()[3]))
self.assertTrue(has_revision(br_a, br_b.revision_history()[4]))
br_b2 = self.make_branch('br_b2')
- self.assertEquals(br_b2.fetch(br_b)[0], 7)
+ br_b2.fetch(br_b)
self.assertTrue(has_revision(br_b2, br_b.revision_history()[4]))
self.assertTrue(has_revision(br_b2, br_a.revision_history()[2]))
self.assertFalse(has_revision(br_b2, br_a.revision_history()[3]))
br_a2 = self.make_branch('br_a2')
- self.assertEquals(br_a2.fetch(br_a)[0], 9)
+ br_a2.fetch(br_a)
self.assertTrue(has_revision(br_a2, br_b.revision_history()[4]))
self.assertTrue(has_revision(br_a2, br_a.revision_history()[3]))
self.assertTrue(has_revision(br_a2, br_a.revision_history()[2]))
@@ -90,14 +88,13 @@
br_a3 = self.make_branch('br_a3')
# pulling a branch with no revisions grabs nothing, regardless of
# whats in the inventory.
- self.assertEquals(br_a3.fetch(br_a2)[0], 0)
+ br_a3.fetch(br_a2)
for revno in range(4):
self.assertFalse(
br_a3.repository.has_revision(br_a.revision_history()[revno]))
- self.assertEqual(br_a3.fetch(br_a2, br_a.revision_history()[2])[0], 3)
+ br_a3.fetch(br_a2, br_a.revision_history()[2])
# pull the 3 revisions introduced by a at u-0-3
- fetched = br_a3.fetch(br_a2, br_a.revision_history()[3])[0]
- self.assertEquals(fetched, 3, "fetched %d instead of 3" % fetched)
+ br_a3.fetch(br_a2, br_a.revision_history()[3])
# InstallFailed should be raised if the branch is missing the revision
# that was requested.
self.assertRaises(errors.InstallFailed, br_a3.fetch, br_a2, 'pizza')
@@ -122,7 +119,7 @@
def test_fetch_self(self):
wt = self.make_branch_and_tree('br')
- self.assertEqual(wt.branch.fetch(wt.branch), (0, []))
+ wt.branch.fetch(wt.branch)
def test_fetch_root_knit(self):
"""Ensure that knit2.fetch() updates the root knit
@@ -284,7 +281,7 @@
wt.commit("changed file")
target = BzrDir.create_branch_and_repo("target/")
source = Branch.open(self.get_readonly_url("source/"))
- self.assertEqual(target.fetch(source), (2, []))
+ target.fetch(source)
# this is the path to the literal file. As format changes
# occur it needs to be updated. FIXME: ask the store for the
# path.
@@ -315,7 +312,7 @@
source = Branch.open(
self.get_readonly_url("source/"),
possible_transports=[source.bzrdir.root_transport])
- self.assertEqual(target.fetch(source), (0, []))
+ target.fetch(source)
# should make just two requests
http_logs = self.get_readonly_server().logs
self.log("web server logs are:")
More information about the bazaar-commits
mailing list