Merge lp:~jr/qbzr/785967-ghost-revisions-in-qlog into lp:qbzr

Proposed by Jonathan Riddell
Status: Merged
Approved by: Alexander Belchenko
Approved revision: 1418
Merged at revision: 1417
Proposed branch: lp:~jr/qbzr/785967-ghost-revisions-in-qlog
Merge into: lp:qbzr
Diff against target: 111 lines (+50/-42)
1 file modified
lib/log.py (+50/-42)
To merge this branch: bzr merge lp:~jr/qbzr/785967-ghost-revisions-in-qlog
Reviewer Review Type Date Requested Status
John A Meinel Approve
Alexander Belchenko Approve
Review via email: mp+69798@code.launchpad.net

Description of the change

Catch ghost revisions in qlog's FileListContainer

To post a comment you must log in.
1418. By Jonathan Riddell

remove debugging

Revision history for this message
Alexander Belchenko (bialix) :
review: Approve
Revision history for this message
John A Meinel (jameinel) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 7/29/2011 4:16 PM, Jonathan Riddell wrote:
> Jonathan Riddell has proposed merging
> lp:~jr/qbzr/785967-ghost-revisions-in-qlog into lp:qbzr.
>
> Requested reviews: QBzr Developers (qbzr-dev) Related bugs: Bug
> #785967 in QBzr: "qlog does not handle ghost revisions"
> https://bugs.launchpad.net/qbzr/+bug/785967
>
> For more details, see:
> https://code.launchpad.net/~jr/qbzr/785967-ghost-revisions-in-qlog/+merge/69798
>
> Catch ghost revisions in qlog's FileListContainer

The 'print' commands seem a bit unnecessary, was it just for debugging?
(and why does the timer exist in the first place, rather than just being
triggered by whatever was being loaded.)

I guess you leave it in a lot of other places as well. Can you just use
"trace.mutter()" instead? I realize most of the time qbzr statements
will go to a hidden terminal/ignored, but it feels a bit unclean to
leave print statements everywhere.

This also looks long and clumsy enough that it could be reasonably
refactored into more focused functions.

The change itself seems ok, as it mostly is just adding a try/except and
changing the indent.

So it would be nice to be cleaner, but I think it could land as is.

John
=:->
 review: approve
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk4761oACgkQJdeBCYSNAANi6gCcC2w1/f2MhhD1/G8wwFNbZP27
oOkAoIUGAGNhPAvdrwKZ8CxtG02ua+CJ
=9wMO
-----END PGP SIGNATURE-----

review: Approve
Revision history for this message
Alexander Belchenko (bialix) wrote :

John, as I can see those print statements are already removed.

Revision history for this message
John A Meinel (jameinel) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 8/5/2011 3:17 PM, Alexander Belchenko wrote:
> John, as I can see those print statements are already removed.

Ah, I was just reviewing by email, he probably pushed an update since
the original proposal.

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk47704ACgkQJdeBCYSNAANEJgCfalX51r/x4UPOcLHVw0L8YaYp
Q/UAn21yDvlH23qeQSPCJzHvBfKhK127
=qD+N
-----END PGP SIGNATURE-----

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/log.py'
2--- lib/log.py 2011-06-25 12:28:18 +0000
3+++ lib/log.py 2011-07-29 14:18:30 +0000
4@@ -33,6 +33,7 @@
5 )
6 from bzrlib.plugins.qbzr.lib.trace import reports_exception, SUB_LOAD_METHOD
7 from bzrlib.plugins.qbzr.lib.uifactory import ui_current_widget
8+from bzrlib.plugins.qbzr.lib.loggraphviz import GhostRevisionError
9
10 from bzrlib.lazy_import import lazy_import
11 lazy_import(globals(), '''
12@@ -630,51 +631,58 @@
13
14 if revids not in self.delta_cache:
15 self.throbber.show()
16- repos = [gv.get_revid_branch(revid).repository for revid in revids]
17- if (repos[0].__class__.__name__ == 'SvnRepository' or
18- repos[1].__class__.__name__ == 'SvnRepository'):
19- # Loading trees from a remote svn repo is unusably slow.
20- # See https://bugs.launchpad.net/qbzr/+bug/450225
21- # If only 1 revision is selected, use a optimized svn method
22- # which actualy gets the server to do the delta,
23- # else, don't do any delta.
24- if count == 1:
25- delta = repos[0].get_revision_delta(revids[0])
26- else:
27- delta = None
28+ try:
29+ repos = [gv.get_revid_branch(revid).repository for revid in
30+ revids]
31+ except GhostRevisionError:
32+ delta = None
33 else:
34- if (len(repos)==2 and
35- repos[0].base == repos[1].base):
36- # Both revids are from the same repository. Load together.
37- repos_revids = [(repos[0], revids)]
38+ if (repos[0].__class__.__name__ == 'SvnRepository' or
39+ repos[1].__class__.__name__ == 'SvnRepository'):
40+ # Loading trees from a remote svn repo is unusably slow.
41+ # See https://bugs.launchpad.net/qbzr/+bug/450225
42+ # If only 1 revision is selected, use a optimized svn method
43+ # which actualy gets the server to do the delta,
44+ # else, don't do any delta.
45+ if count == 1:
46+ delta = repos[0].get_revision_delta(revids[0])
47+ else:
48+ delta = None
49 else:
50- repos_revids = [(repo, [revid])
51- for revid, repo in zip(revids, repos)]
52-
53- for repo, repo_revids in repos_revids:
54- repo_revids = [revid for revid in repo_revids
55- if revid not in self.tree_cache]
56- if repo_revids:
57- repo.lock_read()
58+ if (len(repos)==2 and
59+ repos[0].base == repos[1].base):
60+ # Both revids are from the same repository. Load
61+ #together.
62+ repos_revids = [(repos[0], revids)]
63+ else:
64+ repos_revids = [(repo, [revid])
65+ for revid, repo in zip(revids, repos)]
66+
67+ for repo, repo_revids in repos_revids:
68+ repo_revids = [revid for revid in repo_revids
69+ if revid not in self.tree_cache]
70+ if repo_revids:
71+ repo.lock_read()
72+ self.processEvents()
73+ try:
74+ for revid in repo_revids:
75+ if (revid.startswith(CURRENT_REVISION) and
76+ gv_is_wtgv):
77+ tree = gv.working_trees[revid]
78+ else:
79+ tree = repo.revision_tree(revid)
80+ self.tree_cache[revid] = tree
81+ self.processEvents()
82+ finally:
83+ repo.unlock()
84 self.processEvents()
85- try:
86- for revid in repo_revids:
87- if (revid.startswith(CURRENT_REVISION) and
88- gv_is_wtgv):
89- tree = gv.working_trees[revid]
90- else:
91- tree = repo.revision_tree(revid)
92- self.tree_cache[revid] = tree
93- self.processEvents()
94- finally:
95- repo.unlock()
96- self.processEvents()
97-
98- delta = self.tree_cache[revids[0]].changes_from(
99- self.tree_cache[revids[1]])
100- self.delta_cache[revids] = delta
101- self.throbber.hide()
102- self.processEvents()
103+
104+ delta = self.tree_cache[revids[0]].changes_from(
105+ self.tree_cache[revids[1]])
106+ self.delta_cache[revids] = delta
107+ finally:
108+ self.throbber.hide()
109+ self.processEvents()
110 else:
111 delta = self.delta_cache[revids]
112

Subscribers

People subscribed via source and target branches