Merge lp:~maxb/bzr-svn/fetch-svn-rev-info-progress-bar into lp:bzr-svn/1.0

Proposed by Max Bowsher
Status: Merged
Merged at revision: 3372
Proposed branch: lp:~maxb/bzr-svn/fetch-svn-rev-info-progress-bar
Merge into: lp:bzr-svn/1.0
Diff against target: 51 lines (+19/-5)
1 file modified
logwalker.py (+19/-5)
To merge this branch: bzr merge lp:~maxb/bzr-svn/fetch-svn-rev-info-progress-bar
Reviewer Review Type Date Requested Status
bzr-svn developers Pending
Review via email: mp+28960@code.launchpad.net

Description of the change

Fix the 'fetching svn revision info' progress display to give the accurate count of revisions that bzr-svn has planned to fetch, instead of just displaying the number of revisions in the remote svn repository, some of which bzr-svn may have already fetched info for previously.

To post a comment you must log in.
3326. By Max Bowsher

Fix off-by-one in progress bar calculation, and explain why.

3327. By Max Bowsher

Merge trunk.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'logwalker.py'
--- logwalker.py 2010-07-30 20:07:38 +0000
+++ logwalker.py 2010-07-30 22:52:43 +0000
@@ -280,9 +280,16 @@
280 else:280 else:
281 todo_revprops = ["svn:author", "svn:log", "svn:date"]281 todo_revprops = ["svn:author", "svn:log", "svn:date"]
282282
283 # Define this variable in this scope, it will be filled in below
284 total_revs_to_fetch = None
285
286 # Container list allows mutability from the inner scope
287 number_of_fetched_revs = [0]
288
283 def rcvr(orig_paths, revision, revprops, has_children=None):289 def rcvr(orig_paths, revision, revprops, has_children=None):
290 number_of_fetched_revs[0] += 1
284 nested_pb.update('fetching svn revision info',291 nested_pb.update('fetching svn revision info',
285 to_revnum - revision, to_revnum)292 number_of_fetched_revs[0], total_revs_to_fetch)
286 self.cache.insert_paths(revision, orig_paths)293 self.cache.insert_paths(revision, orig_paths)
287 self.cache.insert_revprops(revision, revprops,294 self.cache.insert_revprops(revision, revprops,
288 todo_revprops is None)295 todo_revprops is None)
@@ -297,18 +304,25 @@
297 else:304 else:
298 nested_pb = pb305 nested_pb = pb
299306
307 if self.saved_minrevnum is None:
308 self.saved_minrevnum = 0
309
300 try:310 try:
301 nested_pb.update('fetching svn revision info', 0, to_revnum)
302 try:311 try:
312 # The get_log bounds are inclusive at both ends, so the total
313 # number of revisions requested is A - B + 1:
314 total_revs_to_fetch = to_revnum - self.saved_revnum + 1
303 # Try to keep the cache consistent by closing any holes early315 # Try to keep the cache consistent by closing any holes early
304 # in the history316 # in the history
305 if self.saved_minrevnum is None:317 if self.saved_minrevnum != 0:
306 self.saved_minrevnum = 0318 total_revs_to_fetch += self.saved_minrevnum + 1
307 elif self.saved_minrevnum != 0:319 nested_pb.update('fetching svn revision info', 0, total_revs_to_fetch)
308 self.mutter("get_log %d->%d", self.saved_minrevnum, 0)320 self.mutter("get_log %d->%d", self.saved_minrevnum, 0)
309 self.actual._transport.get_log(rcvr, [""],321 self.actual._transport.get_log(rcvr, [""],
310 self.saved_minrevnum, 0, 0, True, True, False,322 self.saved_minrevnum, 0, 0, True, True, False,
311 todo_revprops)323 todo_revprops)
324 else:
325 nested_pb.update('fetching svn revision info', 0, total_revs_to_fetch)
312 self.mutter("get_log %d->%d", to_revnum, self.saved_revnum)326 self.mutter("get_log %d->%d", to_revnum, self.saved_revnum)
313 self.actual._transport.get_log(rcvr, [""], to_revnum,327 self.actual._transport.get_log(rcvr, [""], to_revnum,
314 self.saved_revnum, 0, True, True, False, todo_revprops)328 self.saved_revnum, 0, True, True, False, todo_revprops)

Subscribers

People subscribed via source and target branches