Merge lp:~hid-iwata/qbzr/fix-1020530 into lp:qbzr/0.22

Proposed by IWATA Hidetaka
Status: Merged
Merged at revision: 1482
Proposed branch: lp:~hid-iwata/qbzr/fix-1020530
Merge into: lp:qbzr/0.22
Diff against target: 138 lines (+47/-17)
3 files modified
NEWS.txt (+6/-0)
lib/log.py (+18/-7)
lib/logwidget.py (+23/-10)
To merge this branch: bzr merge lp:~hid-iwata/qbzr/fix-1020530
Reviewer Review Type Date Requested Status
QBzr Developers Pending
Review via email: mp+113229@code.launchpad.net

Description of the change

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NEWS.txt'
2--- NEWS.txt 2012-06-12 07:21:53 +0000
3+++ NEWS.txt 2012-07-03 14:54:25 +0000
4@@ -5,6 +5,12 @@
5 * qlog:
6 * Disable context menu items (view, annotate, save) for deleted files.
7 (Alexander Belchenko, Bug #1009876)
8+ * Fix - Some menus (show tree, view, annotate) don't work when Working
9+ tree revision selected.
10+ (IWATA Hidetaka, Bug #1020530)
11+ * Some menus (tag, update, revert, ...) are disabled when Working tree
12+ revision selected.
13+ (IWATA Hidetaka, Bug #1020530)
14
15
16 0.22.3 - 2012/05/23
17
18=== modified file 'lib/log.py'
19--- lib/log.py 2012-06-12 07:14:34 +0000
20+++ lib/log.py 2012-07-03 14:54:25 +0000
21@@ -752,20 +752,24 @@
22 # not a dir
23 paths, file_ids, alives = self._get_file_selection_paths_ids_and_alives()
24 is_single_file = len(paths) == 1
25+ wt_selected = top_revid.startswith(CURRENT_REVISION)
26 menu_enabled = is_single_file and alives[0]
27 self.file_list_context_menu_annotate.setEnabled(menu_enabled)
28 self.file_list_context_menu_cat.setEnabled(menu_enabled)
29+ menu_enabled = is_single_file and alives[0] and not wt_selected
30 self.file_list_context_menu_save_old_file.setEnabled(menu_enabled)
31+ self.file_list_context_menu_save_old_file.setVisible(menu_enabled)
32
33 gv = self.log_list.log_model.graph_viz
34 # It would be nice if there were more than one branch, that we
35 # show a menu so the user can chose which branch actions should take
36 # place in.
37- one_branch_with_tree = (len(gv.branches) == 1 and
38- gv.branches[0].tree is not None)
39+ menu_enabled = (len(gv.branches) == 1 and
40+ gv.branches[0].tree is not None and
41+ not wt_selected)
42
43- self.file_list_context_menu_revert_file.setEnabled(one_branch_with_tree)
44- self.file_list_context_menu_revert_file.setVisible(one_branch_with_tree)
45+ self.file_list_context_menu_revert_file.setEnabled(menu_enabled)
46+ self.file_list_context_menu_revert_file.setVisible(menu_enabled)
47
48 self.file_list_context_menu.popup(
49 self.file_list.viewport().mapToGlobal(pos))
50@@ -814,8 +818,12 @@
51 (top_revid, old_revid), count = \
52 self.log_list.get_selection_top_and_parent_revids_and_count()
53
54- branch = self.log_list.log_model.graph_viz.get_revid_branch(top_revid)
55- tree = branch.repository.revision_tree(top_revid)
56+ gv = self.log_list.log_model.graph_viz
57+ branch = gv.get_revid_branch(top_revid)
58+ if top_revid.startswith(CURRENT_REVISION):
59+ tree = gv.working_trees[top_revid]
60+ else:
61+ tree = branch.repository.revision_tree(top_revid)
62 encoding = get_set_encoding(None, branch)
63 window = QBzrCatWindow(filename = paths[0], tree = tree, parent=self,
64 encoding=encoding)
65@@ -881,7 +889,10 @@
66
67 branch_info = \
68 self.log_list.log_model.graph_viz.get_revid_branch_info(top_revid)
69- tree = branch_info.branch.repository.revision_tree(top_revid)
70+ if top_revid.startswith(CURRENT_REVISION):
71+ tree = branch_info.tree
72+ else:
73+ tree = branch_info.branch.repository.revision_tree(top_revid)
74 window = AnnotateWindow(branch_info.branch, branch_info.tree, tree,
75 paths[0], file_ids[0])
76 window.show()
77
78=== modified file 'lib/logwidget.py'
79--- lib/logwidget.py 2011-08-05 13:01:37 +0000
80+++ lib/logwidget.py 2012-07-03 14:54:25 +0000
81@@ -571,10 +571,15 @@
82 def show_revision_tree(self):
83 from bzrlib.plugins.qbzr.lib.browse import BrowseWindow
84 revid = str(self.currentIndex().data(logmodel.RevIdRole).toString())
85- revno = self.log_model.graph_viz.revid_rev[revid].revno_str
86- branch = self.log_model.graph_viz.get_revid_branch(revid)
87- window = BrowseWindow(branch, revision_id=revid,
88- revision_spec=revno, parent=self)
89+ gv = self.log_model.graph_viz
90+ if revid.startswith(CURRENT_REVISION):
91+ location = gv.working_trees[revid].abspath(u'')
92+ window = BrowseWindow(location=location, parent=self)
93+ else:
94+ revno = gv.revid_rev[revid].revno_str
95+ branch = gv.get_revid_branch(revid)
96+ window = BrowseWindow(branch=branch, revision_id=revid,
97+ revision_spec=revno, parent=self)
98 window.show()
99 self.window().windows.append(window)
100
101@@ -582,6 +587,8 @@
102 branch_count = len(self.log_model.graph_viz.branches)
103 (top_revid, old_revid), count = \
104 self.get_selection_top_and_parent_revids_and_count()
105+
106+ wt_selected = top_revid.startswith(CURRENT_REVISION)
107
108 def filter_rev_ancestor(action, is_ancestor=True):
109 branch_menu = action.menu()
110@@ -595,17 +602,23 @@
111 self.context_menu_show_tree.setVisible(count == 1)
112
113 if self.action_commands:
114- self.context_menu_tag.setVisible(count == 1)
115+ self.context_menu_tag.setVisible(count == 1 and not wt_selected)
116 if count == 1:
117 filter_rev_ancestor(self.context_menu_tag)
118- self.context_menu_revert.setVisible(count == 1)
119- self.context_menu_update.setVisible(count == 1)
120+ self.context_menu_revert.setVisible(count == 1 and not wt_selected)
121+ self.context_menu_update.setVisible(count == 1 and not wt_selected)
122
123 if branch_count>1:
124- filter_rev_ancestor(self.context_menu_cherry_pick,
125- is_ancestor=False)
126+ if wt_selected:
127+ self.context_menu_cherry_pick.setVisible(False)
128+ else:
129+ filter_rev_ancestor(self.context_menu_cherry_pick,
130+ is_ancestor=False)
131
132- filter_rev_ancestor(self.context_menu_reverse_cherry_pick)
133+ if wt_selected:
134+ self.context_menu_reverse_cherry_pick.setVisible(False)
135+ else:
136+ filter_rev_ancestor(self.context_menu_reverse_cherry_pick)
137
138 self.context_menu.popup(self.viewport().mapToGlobal(pos))
139

Subscribers

People subscribed via source and target branches