Rev 338: Simplify fetch code, avoid extra roundtrip when possible. in http://people.samba.org/bzr/jelmer/bzr-svn/bzr.dev
Jelmer Vernooij
jelmer at samba.org
Sat Dec 30 19:30:42 GMT 2006
------------------------------------------------------------
revno: 338
revision-id: jelmer at samba.org-20061230192957-nyzdptkm4iu91jm0
parent: jelmer at samba.org-20061230174926-kprsbiva815mc835
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: main
timestamp: Sat 2006-12-30 20:29:57 +0100
message:
Simplify fetch code, avoid extra roundtrip when possible.
modified:
fetch.py fetch.py-20060625004942-x2lfaib8ra707a8p-1
=== modified file 'fetch.py'
--- a/fetch.py 2006-12-30 17:49:26 +0000
+++ b/fetch.py 2006-12-30 19:29:57 +0000
@@ -288,21 +288,15 @@
# (or youngest_revnum) and call self.target.add_revision()
# or self.target.add_inventory() each time
if revision_id is None:
- path = None
- until_revnum = self.source._latest_revnum
+ history_iterator = self.source.follow_history(self.source._latest_revnum)
else:
(path, until_revnum) = self.source.parse_revision_id(revision_id)
+ history_iterator = self.source.follow_branch(path, until_revnum)
- repos_root = self.source.transport.get_repos_root()
-
needed = []
parents = {}
prev_revid = None
- if path is None:
- it = self.source.follow_history(until_revnum)
- else:
- it = self.source.follow_branch(path, until_revnum)
- for (branch, revnum) in it:
+ for (branch, revnum) in history_iterator:
revid = self.source.generate_revision_id(revnum, branch)
if prev_revid is not None:
@@ -313,8 +307,14 @@
if not self.target.has_revision(revid):
needed.append((branch, revnum, revid))
+ if len(needed) == 0:
+ # Nothing to fetch
+ return
+
parents[prev_revid] = None
+ repos_root = self.source.transport.get_repos_root()
+
needed.reverse()
prev_revid = None
transport = self.source.transport
More information about the bazaar-commits
mailing list