Merge lp:~bialix/bzr-colo/hidden into lp:bzr-colo

Proposed by Alexander Belchenko
Status: Merged
Merged at revision: 106
Proposed branch: lp:~bialix/bzr-colo/hidden
Merge into: lp:bzr-colo
Diff against target: 137 lines (+48/-13)
4 files modified
colocated.py (+12/-2)
commands.py (+1/-4)
qcommands.py (+23/-7)
tests/test_colo.py (+12/-0)
To merge this branch: bzr merge lp:~bialix/bzr-colo/hidden
Reviewer Review Type Date Requested Status
Neil Martinsen-Burrell Pending
Review via email: mp+59748@code.launchpad.net

Description of the change

This branch add support for .dotnames as hidden in any subdirectory.

Also this branch add "Show all" checkbox to q-windows.

Please, consider to merge either both revisions or only 2nd if you don't want to provide support for subdir/.hidden case.

To post a comment you must log in.
lp:~bialix/bzr-colo/hidden updated
107. By Alexander Belchenko

added "Show all" checkbox to q-windows

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'colocated.py'
2--- colocated.py 2011-04-18 17:25:30 +0000
3+++ colocated.py 2011-05-03 10:32:38 +0000
4@@ -91,10 +91,20 @@
5 """The shared repository object."""
6 return repository.Repository.open(self.repo_location)
7
8- def branch_names(self):
9+ def branch_names(self, all=True):
10 """A generator of the names of the branches."""
11+ current_name = self.current_branch_name()
12 for b in self.branches():
13- yield self._name_from_branch(b)
14+ name = self._name_from_branch(b)
15+ if not all and name != current_name:
16+ for p in name.split('/'):
17+ if p.startswith('.'):
18+ break
19+ else:
20+ yield name
21+ continue
22+ else:
23+ yield name
24
25 def branch_with_name(self, name):
26 return _mod_branch.Branch.open(self.url_for_name(name))
27
28=== modified file 'commands.py'
29--- commands.py 2011-04-29 03:36:42 +0000
30+++ commands.py 2011-05-03 10:32:38 +0000
31@@ -234,10 +234,7 @@
32 def run(self, location=u'.', all=False):
33 workspace = ColocatedWorkspace(location)
34 current_name = workspace.current_branch_name()
35- for name in workspace.branch_names():
36- if name.startswith('.') and name != current_name:
37- if not all:
38- continue
39+ for name in workspace.branch_names(all):
40 leader = ' '
41 if name == current_name:
42 leader = '* '
43
44=== modified file 'qcommands.py'
45--- qcommands.py 2011-04-29 03:55:46 +0000
46+++ qcommands.py 2011-05-03 10:32:38 +0000
47@@ -42,14 +42,10 @@
48 self.branch_icon = QtGui.QIcon(
49 os.path.join(os.path.dirname(__file__), 'folder.png'))
50
51-
52 def refresh_branches(self):
53 self.clear()
54 current_name = self.workspace.current_branch_name()
55- for name in reversed(sorted(list(self.workspace.branch_names()))):
56- if name.startswith('.') and name != current_name:
57- if not self.show_all:
58- continue
59+ for name in reversed(sorted(list(self.workspace.branch_names(self.show_all)))):
60 item = QtGui.QListWidgetItem(name)
61 item.setIcon(self.branch_icon)
62 item.setToolTip(self.workspace.branch_with_name(name).base)
63@@ -69,6 +65,14 @@
64 self.workspace = ColocatedWorkspace()
65 self.branches_list = ColocatedBranchesList(self.workspace,
66 show_all=show_all)
67+ self.show_all_knob = QtGui.QCheckBox("Show all")
68+ state = QtCore.Qt.Unchecked
69+ if show_all:
70+ state = QtCore.Qt.Checked
71+ self.show_all_knob.setCheckState(state)
72+ QtCore.QObject.connect(self.show_all_knob,
73+ QtCore.SIGNAL("stateChanged(int)"),
74+ self.show_all_clicked)
75
76 def show(self):
77 QBzrWindow.show(self)
78@@ -80,6 +84,11 @@
79 def initial_load(self):
80 self.branches_list.refresh_branches()
81
82+ def show_all_clicked(self, newstate):
83+ show_all = bool(newstate)
84+ self.branches_list.show_all = show_all
85+ QtCore.QTimer.singleShot(1, self.initial_load)
86+
87
88 class PruneWindow(ColocatedBranchesWindow):
89
90@@ -103,7 +112,11 @@
91 refresh_button = QtGui.QPushButton('Refresh')
92 actions_box.addWidget(refresh_button, 1, QtCore.Qt.AlignTop)
93
94- self.layout.addWidget(self.create_button_box(BTN_CLOSE))
95+ buttonbox = self.create_button_box(BTN_CLOSE)
96+ hbox = QtGui.QHBoxLayout()
97+ hbox.addWidget(self.show_all_knob, 1)
98+ hbox.addWidget(buttonbox)
99+ self.layout.addLayout(hbox)
100
101 QtCore.QObject.connect(refresh_button,
102 QtCore.SIGNAL("clicked(bool)"),
103@@ -166,7 +179,10 @@
104 buttonbox = self.create_button_box(BTN_CLOSE)
105 refresh_button = buttonbox.addButton('Refresh',
106 QtGui.QDialogButtonBox.ActionRole)
107- self.layout.addWidget(buttonbox)
108+ hbox = QtGui.QHBoxLayout()
109+ hbox.addWidget(self.show_all_knob, 1)
110+ hbox.addWidget(buttonbox)
111+ self.layout.addLayout(hbox)
112
113 QtCore.QObject.connect(refresh_button,
114 QtCore.SIGNAL('clicked(bool)'),
115
116=== modified file 'tests/test_colo.py'
117--- tests/test_colo.py 2011-04-29 03:40:54 +0000
118+++ tests/test_colo.py 2011-05-03 10:32:38 +0000
119@@ -499,6 +499,18 @@
120 * trunk
121 """)
122
123+ def test_colo_branches_hidden_in_subdirectory(self):
124+ self.run_script("""
125+$ bzr colo-init
126+$ bzr colo-branch --no-switch subdir/.this
127+$ bzr colo-branch --no-switch foo/.bar/spam
128+$ bzr colo-branches
129+* trunk
130+$ bzr colo-branches --all
131+ foo/.bar/spam
132+ subdir/.this
133+* trunk
134+""")
135
136
137 class TestColoFetch(ScriptTestCase):

Subscribers

People subscribed via source and target branches