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
1=== modified file 'logwalker.py'
2--- logwalker.py 2010-07-30 20:07:38 +0000
3+++ logwalker.py 2010-07-30 22:52:43 +0000
4@@ -280,9 +280,16 @@
5 else:
6 todo_revprops = ["svn:author", "svn:log", "svn:date"]
7
8+ # Define this variable in this scope, it will be filled in below
9+ total_revs_to_fetch = None
10+
11+ # Container list allows mutability from the inner scope
12+ number_of_fetched_revs = [0]
13+
14 def rcvr(orig_paths, revision, revprops, has_children=None):
15+ number_of_fetched_revs[0] += 1
16 nested_pb.update('fetching svn revision info',
17- to_revnum - revision, to_revnum)
18+ number_of_fetched_revs[0], total_revs_to_fetch)
19 self.cache.insert_paths(revision, orig_paths)
20 self.cache.insert_revprops(revision, revprops,
21 todo_revprops is None)
22@@ -297,18 +304,25 @@
23 else:
24 nested_pb = pb
25
26+ if self.saved_minrevnum is None:
27+ self.saved_minrevnum = 0
28+
29 try:
30- nested_pb.update('fetching svn revision info', 0, to_revnum)
31 try:
32+ # The get_log bounds are inclusive at both ends, so the total
33+ # number of revisions requested is A - B + 1:
34+ total_revs_to_fetch = to_revnum - self.saved_revnum + 1
35 # Try to keep the cache consistent by closing any holes early
36 # in the history
37- if self.saved_minrevnum is None:
38- self.saved_minrevnum = 0
39- elif self.saved_minrevnum != 0:
40+ if self.saved_minrevnum != 0:
41+ total_revs_to_fetch += self.saved_minrevnum + 1
42+ nested_pb.update('fetching svn revision info', 0, total_revs_to_fetch)
43 self.mutter("get_log %d->%d", self.saved_minrevnum, 0)
44 self.actual._transport.get_log(rcvr, [""],
45 self.saved_minrevnum, 0, 0, True, True, False,
46 todo_revprops)
47+ else:
48+ nested_pb.update('fetching svn revision info', 0, total_revs_to_fetch)
49 self.mutter("get_log %d->%d", to_revnum, self.saved_revnum)
50 self.actual._transport.get_log(rcvr, [""], to_revnum,
51 self.saved_revnum, 0, True, True, False, todo_revprops)

Subscribers

People subscribed via source and target branches