Merge lp:~jameinel/bzr/2.5-verbosity-knob-812928 into lp:bzr
- 2.5-verbosity-knob-812928
- Merge into bzr.dev
Status: | Merged |
---|---|
Approved by: | Vincent Ladeuil |
Approved revision: | no longer in the source branch. |
Merged at revision: | 6038 |
Proposed branch: | lp:~jameinel/bzr/2.5-verbosity-knob-812928 |
Merge into: | lp:bzr |
Diff against target: |
450 lines (+320/-35) 4 files modified
bzrlib/plugins/launchpad/__init__.py (+11/-34) bzrlib/plugins/launchpad/lp_api_lite.py (+97/-0) bzrlib/plugins/launchpad/test_lp_api_lite.py (+193/-0) doc/en/release-notes/bzr-2.5.txt (+19/-1) |
To merge this branch: | bzr merge lp:~jameinel/bzr/2.5-verbosity-knob-812928 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Vincent Ladeuil | Needs Fixing | ||
Review via email: mp+68559@code.launchpad.net |
Commit message
Bug #812928, allow configuring how verbose the package freshness checks are.
Description of the change
This adds a verbosity knob for the new "Is this packaging branch up-to-date", and refactors the code a bit to make it more testable. The config entry is
bzr.plugins.
The possible values are:
off
Displays nothing, and skips all checks.
minimal
Only displays single-line messages when out-of-date, but never for
missing or up-to-date
1.0-1ubuntu1 is OUT-OF-DATE, Ubuntu Natty has 1.0-1ubuntu2
short
Displays single-line messages for out-of-date, missing, and up-to-date
1.0-1ubuntu1 is OUT-OF-DATE, Ubuntu Natty has 1.0-1ubuntu2
Ubuntu Natty is MISSING a version
1.0-1ubuntu2 is CURRENT in Ubuntu Natty
all (default)
Displays multi-line messages for all 3 states
Most recent Ubuntu Natty version: 1.0-1ubuntu2
Packaging branch version: 1.0-1ubuntu1
Packaging branch status: OUT-OF-DATE
Most recent Ubuntu Natty version: MISSING
Most recent Ubuntu Natty version: 1.0-1ubuntu2
Packaging branch status: CURRENT
John A Meinel (jameinel) wrote : | # |
sent to pqm by email
John A Meinel (jameinel) wrote : | # |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 7/21/2011 3:06 PM, Vincent Ladeuil wrote:
> Review: Needs Fixing
> On behalf of UDD users: Thank You !
>
> 27 + c = the_branch.
> 28 + verbosity = c.get_user_
>
> You're a bit out of fashion here ;)
>
> You can start using the the stck-based config here.
>
> This can take various forms:
>
> - the consensus about the option names would be more
> 'launchpad.
> slightly unclear, how about 'lp.package_
Except, this is about package_
ideas for what the values should be. "package_
could work, but that is much more verbose.
freshness_verbosity
freshness_check
up_to_date_check
And the _check form doesn't really lend itself to "short" vs "minimal",
just to on/off.
I'm ambivalent about "lp." vs "launchpad.". I like the shortness, but it
does seem best to have unique namespace, and someone might create a
plugin named 'lp'. Then again, launchpad already provides lp...
I'll go with "launchpad.
the docs for this.
>
> - use the stack-based implementation (even if you target 2.4)
>
> c = config.
> verbosity = c.get('
>
> Declare your option:
>
> option_
> help='xxx is so nice, use it.')
I'm actually thinking to target 2.3 in the middle-term, because that is
where the developers using package branches are going to be at right
now. We may decide not to do it, but I'd like to at least plan for
backporting this for now. The time it takes to clean up now is the same
as it will take in the future.
>
> 113 +def report_
>
> This function seem to mix 3 different things:
> - get the LatestPublication data
> - time them
> - report to the user
>
> I'm not sure we need to time them (mutter does that already no ?)
Mutter reports the time-since-started, and with a small amount of math
you can work out the delta. But, you still need to mutter *something*,
and it is easier to just mutter the info I wanted.
Long term, we can remove them. Short term, I think it is important to be
monitoring how much overhead adding this code is costing us, vs the
benefit to the users.
>
> I think the code will be clearer and easier to test if this was
> split.
>
Ultimately, there will always be a 'do what I want' function, and the
size of the 3 steps is pretty small. I did refactor it, but it didn't
change the number of tests I needed to do for the reporting function. It
made them a little bit smaller, I guess.
> 234 +class TestReportFresh
>
> This can then be split/parametrized so the display tests just
> don't need a branch at all.
>
> 252 + orig_log_len = len(self.get_log())
>
> In many discussions about self.get_log() we mentioned that only a
> few tests were requiring get_log() and I seem to remember that
> everybody agreed on ...
Preview Diff
1 | === modified file 'bzrlib/plugins/launchpad/__init__.py' |
2 | --- bzrlib/plugins/launchpad/__init__.py 2011-07-18 16:51:56 +0000 |
3 | +++ bzrlib/plugins/launchpad/__init__.py 2011-07-22 12:04:10 +0000 |
4 | @@ -40,10 +40,6 @@ |
5 | |
6 | # see http://wiki.bazaar.canonical.com/Specs/BranchRegistrationTool |
7 | |
8 | -import time |
9 | - |
10 | -# Since we are a built-in plugin we share the bzrlib version |
11 | - |
12 | from bzrlib.lazy_import import lazy_import |
13 | lazy_import(globals(), """ |
14 | from bzrlib import ( |
15 | @@ -56,6 +52,7 @@ |
16 | branch as _mod_branch, |
17 | bzrdir, |
18 | lazy_regex, |
19 | + # Since we are a built-in plugin we share the bzrlib version |
20 | version_info, |
21 | ) |
22 | from bzrlib.commands import ( |
23 | @@ -502,39 +499,19 @@ |
24 | info = _get_package_branch_info(the_branch.base) |
25 | if info is None: |
26 | return |
27 | + c = the_branch.get_config() |
28 | + verbosity = c.get_user_option('launchpad.packaging_verbosity') |
29 | + if verbosity is not None: |
30 | + verbosity = verbosity.lower() |
31 | + if verbosity == 'off': |
32 | + trace.mutter('not checking %s because verbosity is turned off' |
33 | + % (the_branch.base,)) |
34 | + return |
35 | archive, series, project = info |
36 | from bzrlib.plugins.launchpad import lp_api_lite |
37 | - t = time.time() |
38 | latest_pub = lp_api_lite.LatestPublication(archive, series, project) |
39 | - latest_ver = latest_pub.get_latest_version() |
40 | - t_latest_ver = time.time() - t |
41 | - trace.mutter('LatestPublication.get_latest_version took %.3fs' |
42 | - % (t_latest_ver,)) |
43 | - if latest_ver is None: |
44 | - trace.note('Could not find a published version for packaging branch:\n' |
45 | - ' %s' % (the_branch.base,)) |
46 | - return |
47 | - t = time.time() |
48 | - tags = the_branch.tags.get_tag_dict() |
49 | - t_tag_dict = time.time() - t |
50 | - trace.mutter('LatestPublication get_tag_dict took: %.3fs' % (t_tag_dict,)) |
51 | - if latest_ver in tags: |
52 | - trace.note('Found most recent published version: %s' |
53 | - ' in packaging branch:\n %s' |
54 | - % (latest_ver, the_branch.base)) |
55 | - else: |
56 | - place = archive.title() |
57 | - if series is not None: |
58 | - place = '%s/%s' % (place, series.title()) |
59 | - best_tag = lp_api_lite.get_most_recent_tag(tags, the_branch) |
60 | - if best_tag is None: |
61 | - best_message = '' |
62 | - else: |
63 | - best_message = '\nThe most recent tag found is %s' % (best_tag,) |
64 | - trace.warning( |
65 | - 'Packaging branch is not up-to-date. The most recent published\n' |
66 | - 'version in %s is %s, but it is not in the branch tags for:\n %s%s' |
67 | - % (place, latest_ver, the_branch.base, best_message)) |
68 | + lp_api_lite.report_freshness(the_branch, verbosity, latest_pub) |
69 | + |
70 | |
71 | def _register_hooks(): |
72 | _mod_branch.Branch.hooks.install_named_hook('open', |
73 | |
74 | === modified file 'bzrlib/plugins/launchpad/lp_api_lite.py' |
75 | --- bzrlib/plugins/launchpad/lp_api_lite.py 2011-07-18 16:51:56 +0000 |
76 | +++ bzrlib/plugins/launchpad/lp_api_lite.py 2011-07-22 12:04:10 +0000 |
77 | @@ -33,6 +33,7 @@ |
78 | except ImportError: |
79 | json = None |
80 | |
81 | +import time |
82 | import urllib |
83 | import urllib2 |
84 | |
85 | @@ -156,6 +157,21 @@ |
86 | trace.log_exception_quietly() |
87 | return None |
88 | |
89 | + def place(self): |
90 | + """Text-form for what location this represents. |
91 | + |
92 | + Example:: |
93 | + ubuntu, natty => Ubuntu Natty |
94 | + ubuntu, natty-proposed => Ubuntu Natty Proposed |
95 | + :return: A string representing the location we are checking. |
96 | + """ |
97 | + place = self._archive |
98 | + if self._series is not None: |
99 | + place = '%s %s' % (place, self._series) |
100 | + if self._pocket is not None and self._pocket != 'Release': |
101 | + place = '%s %s' % (place, self._pocket) |
102 | + return place.title() |
103 | + |
104 | |
105 | def get_latest_publication(archive, series, project): |
106 | """Get the most recent publication for a given project. |
107 | @@ -187,3 +203,84 @@ |
108 | return reverse_dict[rev_id] |
109 | finally: |
110 | the_branch.unlock() |
111 | + |
112 | + |
113 | +def _get_newest_versions(the_branch, latest_pub): |
114 | + """Get information about how 'fresh' this packaging branch is. |
115 | + |
116 | + :param the_branch: The Branch to check |
117 | + :param latest_pub: The LatestPublication used to check most recent |
118 | + published version. |
119 | + :return: (latest_ver, branch_latest_ver) |
120 | + """ |
121 | + t = time.time() |
122 | + latest_ver = latest_pub.get_latest_version() |
123 | + t_latest_ver = time.time() - t |
124 | + trace.mutter('LatestPublication.get_latest_version took: %.3fs' |
125 | + % (t_latest_ver,)) |
126 | + if latest_ver is None: |
127 | + return None, None |
128 | + t = time.time() |
129 | + tags = the_branch.tags.get_tag_dict() |
130 | + t_tag_dict = time.time() - t |
131 | + trace.mutter('LatestPublication.get_tag_dict took: %.3fs' % (t_tag_dict,)) |
132 | + if latest_ver in tags: |
133 | + # branch might have a newer tag, but we don't really care |
134 | + return latest_ver, latest_ver |
135 | + else: |
136 | + best_tag = get_most_recent_tag(tags, the_branch) |
137 | + return latest_ver, best_tag |
138 | + |
139 | + |
140 | +def _report_freshness(latest_ver, branch_latest_ver, place, verbosity, |
141 | + report_func): |
142 | + """Report if the branch is up-to-date.""" |
143 | + if latest_ver is None: |
144 | + if verbosity == 'all': |
145 | + report_func('Most recent %s version: MISSING' % (place,)) |
146 | + elif verbosity == 'short': |
147 | + report_func('%s is MISSING a version' % (place,)) |
148 | + return |
149 | + elif latest_ver == branch_latest_ver: |
150 | + if verbosity == 'minimal': |
151 | + return |
152 | + elif verbosity == 'short': |
153 | + report_func('%s is CURRENT in %s' % (latest_ver, place)) |
154 | + else: |
155 | + report_func('Most recent %s version: %s\n' |
156 | + 'Packaging branch status: CURRENT' |
157 | + % (place, latest_ver)) |
158 | + else: |
159 | + if verbosity in ('minimal', 'short'): |
160 | + if branch_latest_ver is None: |
161 | + branch_latest_ver = 'Branch' |
162 | + report_func('%s is OUT-OF-DATE, %s has %s' |
163 | + % (branch_latest_ver, place, latest_ver)) |
164 | + else: |
165 | + report_func('Most recent %s version: %s\n' |
166 | + 'Packaging branch version: %s\n' |
167 | + 'Packaging branch status: OUT-OF-DATE' |
168 | + % (place, latest_ver, branch_latest_ver)) |
169 | + |
170 | + |
171 | +def report_freshness(the_branch, verbosity, latest_pub): |
172 | + """Report to the user how up-to-date the packaging branch is. |
173 | + |
174 | + :param the_branch: A Branch object |
175 | + :param verbosity: Can be one of: |
176 | + off: Do not print anything, and skip all checks. |
177 | + all: Print all information that we have in a verbose manner, this |
178 | + includes misses, etc. |
179 | + short: Print information, but only one-line summaries |
180 | + minimal: Only print a one-line summary when the package branch is |
181 | + out-of-date |
182 | + :param latest_pub: A LatestPublication instance |
183 | + """ |
184 | + if verbosity == 'off': |
185 | + return |
186 | + if verbosity is None: |
187 | + verbosity = 'all' |
188 | + latest_ver, branch_ver = _get_newest_versions(the_branch, latest_pub) |
189 | + place = latest_pub.place() |
190 | + _report_freshness(latest_ver, branch_ver, place, verbosity, |
191 | + trace.note) |
192 | |
193 | === modified file 'bzrlib/plugins/launchpad/test_lp_api_lite.py' |
194 | --- bzrlib/plugins/launchpad/test_lp_api_lite.py 2011-07-18 16:51:56 +0000 |
195 | +++ bzrlib/plugins/launchpad/test_lp_api_lite.py 2011-07-22 12:04:10 +0000 |
196 | @@ -17,12 +17,16 @@ |
197 | """Tools for dealing with the Launchpad API without using launchpadlib. |
198 | """ |
199 | |
200 | +import doctest |
201 | import socket |
202 | |
203 | from bzrlib import tests |
204 | from bzrlib.plugins import launchpad |
205 | from bzrlib.plugins.launchpad import lp_api_lite |
206 | |
207 | +from testtools.matchers import DocTestMatches |
208 | + |
209 | + |
210 | class _JSONParserFeature(tests.Feature): |
211 | |
212 | def _probe(self): |
213 | @@ -76,6 +80,10 @@ |
214 | project='bzr'): |
215 | return lp_api_lite.LatestPublication(archive, series, project) |
216 | |
217 | + def assertPlace(self, place, archive, series, project): |
218 | + lp = lp_api_lite.LatestPublication(archive, series, project) |
219 | + self.assertEqual(place, lp.place()) |
220 | + |
221 | def test_init(self): |
222 | latest_pub = self.make_latest_publication() |
223 | self.assertEqual('ubuntu', latest_pub._archive) |
224 | @@ -262,6 +270,14 @@ |
225 | latest_pub = self.make_latest_publication() |
226 | self.assertIsNot(None, latest_pub.get_latest_version()) |
227 | |
228 | + def test_place(self): |
229 | + self.assertPlace('Ubuntu', 'ubuntu', None, 'bzr') |
230 | + self.assertPlace('Ubuntu Natty', 'ubuntu', 'natty', 'bzr') |
231 | + self.assertPlace('Ubuntu Natty Proposed', 'ubuntu', 'natty-proposed', |
232 | + 'bzr') |
233 | + self.assertPlace('Debian', 'debian', None, 'bzr') |
234 | + self.assertPlace('Debian Sid', 'debian', 'sid', 'bzr') |
235 | + |
236 | |
237 | class TestIsUpToDate(tests.TestCase): |
238 | |
239 | @@ -348,3 +364,180 @@ |
240 | self.assertEqual('B', b.last_revision()) |
241 | self.assertEqual('tip-1.0', |
242 | lp_api_lite.get_most_recent_tag(tag_dict, b)) |
243 | + |
244 | + |
245 | +class StubLatestPublication(object): |
246 | + |
247 | + def __init__(self, latest): |
248 | + self.called = False |
249 | + self.latest = latest |
250 | + |
251 | + def get_latest_version(self): |
252 | + self.called = True |
253 | + return self.latest |
254 | + |
255 | + def place(self): |
256 | + return 'Ubuntu Natty' |
257 | + |
258 | + |
259 | +class TestReportFreshness(tests.TestCaseWithMemoryTransport): |
260 | + |
261 | + def setUp(self): |
262 | + super(TestReportFreshness, self).setUp() |
263 | + builder = self.make_branch_builder('tip') |
264 | + builder.build_snapshot('A', [], [ |
265 | + ('add', ('', 'root-id', 'directory', None))]) |
266 | + self.branch = builder.get_branch() |
267 | + |
268 | + def assertFreshnessReports(self, verbosity, latest_version, content): |
269 | + """Assert that lp_api_lite.report_freshness reports the given content. |
270 | + |
271 | + :param verbosity: The reporting level |
272 | + :param latest_version: The version reported by StubLatestPublication |
273 | + :param content: The expected content. This should be in DocTest form. |
274 | + """ |
275 | + orig_log_len = len(self.get_log()) |
276 | + lp_api_lite.report_freshness(self.branch, verbosity, |
277 | + StubLatestPublication(latest_version)) |
278 | + new_content = self.get_log()[orig_log_len:] |
279 | + # Strip out lines that have LatestPublication.get_* because those are |
280 | + # timing related lines. While interesting to log for now, they aren't |
281 | + # something we want to be testing |
282 | + new_content = new_content.split('\n') |
283 | + for i in range(2): |
284 | + if (len(new_content) > 0 |
285 | + and 'LatestPublication.get_' in new_content[0]): |
286 | + new_content = new_content[1:] |
287 | + new_content = '\n'.join(new_content) |
288 | + self.assertThat(new_content, |
289 | + DocTestMatches(content, |
290 | + doctest.ELLIPSIS | doctest.REPORT_UDIFF)) |
291 | + |
292 | + def test_verbosity_off_skips_check(self): |
293 | + # We force _get_package_branch_info so that we know it would otherwise |
294 | + # try to connect to launcphad |
295 | + self.overrideAttr(launchpad, '_get_package_branch_info', |
296 | + lambda x: ('ubuntu', 'natty', 'bzr')) |
297 | + self.overrideAttr(lp_api_lite, 'LatestPublication', |
298 | + lambda *args: self.fail('Tried to query launchpad')) |
299 | + c = self.branch.get_config() |
300 | + c.set_user_option('launchpad.packaging_verbosity', 'off') |
301 | + orig_log_len = len(self.get_log()) |
302 | + launchpad._check_is_up_to_date(self.branch) |
303 | + new_content = self.get_log()[orig_log_len:] |
304 | + self.assertContainsRe(new_content, |
305 | + 'not checking memory.*/tip/ because verbosity is turned off') |
306 | + |
307 | + def test_verbosity_off(self): |
308 | + latest_pub = StubLatestPublication('1.0-1ubuntu2') |
309 | + lp_api_lite.report_freshness(self.branch, 'off', latest_pub) |
310 | + self.assertFalse(latest_pub.called) |
311 | + |
312 | + def test_verbosity_all_out_of_date_smoke(self): |
313 | + self.branch.tags.set_tag('1.0-1ubuntu1', 'A') |
314 | + self.assertFreshnessReports('all', '1.0-1ubuntu2', |
315 | + ' INFO Most recent Ubuntu Natty version: 1.0-1ubuntu2\n' |
316 | + 'Packaging branch version: 1.0-1ubuntu1\n' |
317 | + 'Packaging branch status: OUT-OF-DATE\n') |
318 | + |
319 | + |
320 | +class Test_GetNewestVersions(tests.TestCaseWithMemoryTransport): |
321 | + |
322 | + def setUp(self): |
323 | + super(Test_GetNewestVersions, self).setUp() |
324 | + builder = self.make_branch_builder('tip') |
325 | + builder.build_snapshot('A', [], [ |
326 | + ('add', ('', 'root-id', 'directory', None))]) |
327 | + self.branch = builder.get_branch() |
328 | + |
329 | + def assertLatestVersions(self, latest_branch_version, pub_version): |
330 | + if latest_branch_version is not None: |
331 | + self.branch.tags.set_tag(latest_branch_version, 'A') |
332 | + latest_pub = StubLatestPublication(pub_version) |
333 | + self.assertEqual((pub_version, latest_branch_version), |
334 | + lp_api_lite._get_newest_versions(self.branch, latest_pub)) |
335 | + |
336 | + def test_no_tags(self): |
337 | + self.assertLatestVersions(None, '1.0-1ubuntu2') |
338 | + |
339 | + def test_out_of_date(self): |
340 | + self.assertLatestVersions('1.0-1ubuntu1', '1.0-1ubuntu2') |
341 | + |
342 | + def test_up_to_date(self): |
343 | + self.assertLatestVersions('1.0-1ubuntu2', '1.0-1ubuntu2') |
344 | + |
345 | + def test_missing(self): |
346 | + self.assertLatestVersions(None, None) |
347 | + |
348 | + |
349 | +class Test_ReportFreshness(tests.TestCase): |
350 | + |
351 | + def assertReportedFreshness(self, verbosity, latest_ver, branch_latest_ver, |
352 | + content, place='Ubuntu Natty'): |
353 | + """Assert that lp_api_lite.report_freshness reports the given content. |
354 | + """ |
355 | + reported = [] |
356 | + def report_func(value): |
357 | + reported.append(value) |
358 | + lp_api_lite._report_freshness(latest_ver, branch_latest_ver, place, |
359 | + verbosity, report_func) |
360 | + new_content = '\n'.join(reported) |
361 | + self.assertThat(new_content, |
362 | + DocTestMatches(content, |
363 | + doctest.ELLIPSIS | doctest.REPORT_UDIFF)) |
364 | + |
365 | + def test_verbosity_minimal_no_tags(self): |
366 | + self.assertReportedFreshness('minimal', '1.0-1ubuntu2', None, |
367 | + 'Branch is OUT-OF-DATE, Ubuntu Natty has 1.0-1ubuntu2\n') |
368 | + |
369 | + def test_verbosity_minimal_out_of_date(self): |
370 | + self.assertReportedFreshness('minimal', '1.0-1ubuntu2', '1.0-1ubuntu1', |
371 | + '1.0-1ubuntu1 is OUT-OF-DATE,' |
372 | + ' Ubuntu Natty has 1.0-1ubuntu2\n') |
373 | + |
374 | + def test_verbosity_minimal_up_to_date(self): |
375 | + self.assertReportedFreshness('minimal', '1.0-1ubuntu2', '1.0-1ubuntu2', |
376 | + '') |
377 | + |
378 | + def test_verbosity_minimal_missing(self): |
379 | + self.assertReportedFreshness('minimal', None, None, |
380 | + '') |
381 | + |
382 | + def test_verbosity_short_out_of_date(self): |
383 | + self.assertReportedFreshness('short', '1.0-1ubuntu2', '1.0-1ubuntu1', |
384 | + '1.0-1ubuntu1 is OUT-OF-DATE,' |
385 | + ' Ubuntu Natty has 1.0-1ubuntu2\n') |
386 | + |
387 | + def test_verbosity_short_up_to_date(self): |
388 | + self.assertReportedFreshness('short', '1.0-1ubuntu2', '1.0-1ubuntu2', |
389 | + '1.0-1ubuntu2 is CURRENT in Ubuntu Natty') |
390 | + |
391 | + def test_verbosity_short_missing(self): |
392 | + self.assertReportedFreshness('short', None, None, |
393 | + 'Ubuntu Natty is MISSING a version') |
394 | + |
395 | + def test_verbosity_all_no_tags(self): |
396 | + self.assertReportedFreshness('all', '1.0-1ubuntu2', None, |
397 | + 'Most recent Ubuntu Natty version: 1.0-1ubuntu2\n' |
398 | + 'Packaging branch version: None\n' |
399 | + 'Packaging branch status: OUT-OF-DATE\n') |
400 | + |
401 | + def test_verbosity_all_out_of_date(self): |
402 | + self.assertReportedFreshness('all', '1.0-1ubuntu2', '1.0-1ubuntu1', |
403 | + 'Most recent Ubuntu Natty version: 1.0-1ubuntu2\n' |
404 | + 'Packaging branch version: 1.0-1ubuntu1\n' |
405 | + 'Packaging branch status: OUT-OF-DATE\n') |
406 | + |
407 | + def test_verbosity_all_up_to_date(self): |
408 | + self.assertReportedFreshness('all', '1.0-1ubuntu2', '1.0-1ubuntu2', |
409 | + 'Most recent Ubuntu Natty version: 1.0-1ubuntu2\n' |
410 | + 'Packaging branch status: CURRENT\n') |
411 | + |
412 | + def test_verbosity_all_missing(self): |
413 | + self.assertReportedFreshness('all', None, None, |
414 | + 'Most recent Ubuntu Natty version: MISSING\n') |
415 | + |
416 | + def test_verbosity_None_is_all(self): |
417 | + self.assertReportedFreshness(None, '1.0-1ubuntu2', '1.0-1ubuntu2', |
418 | + 'Most recent Ubuntu Natty version: 1.0-1ubuntu2\n' |
419 | + 'Packaging branch status: CURRENT\n') |
420 | |
421 | === modified file 'doc/en/release-notes/bzr-2.5.txt' |
422 | --- doc/en/release-notes/bzr-2.5.txt 2011-07-21 07:08:05 +0000 |
423 | +++ doc/en/release-notes/bzr-2.5.txt 2011-07-22 12:04:10 +0000 |
424 | @@ -24,7 +24,25 @@ |
425 | checks to see if the most recent published source package version for |
426 | that project is present in the branch tags. This should help developers |
427 | trust whether the packaging branch is up-to-date and can be used for new |
428 | - changes. (John Arbash Meinel, #609187) |
429 | + changes. The level of verbosity is controlled by the config item |
430 | + ``bzr.plugins.launchpad.packaging_verbosity``. It can be set to one of |
431 | + |
432 | + off |
433 | + disable all checks |
434 | + |
435 | + |
436 | + minimal |
437 | + only display if the branch is out-of-date |
438 | + |
439 | + short |
440 | + also display single-line up-to-date and missing, |
441 | + |
442 | + |
443 | + all |
444 | + (default) display multi-line content for all states |
445 | + |
446 | + |
447 | + (John Arbash Meinel, #609187, #812928) |
448 | |
449 | * Add a config option gpg_signature_key for setting which GPG key |
450 | should be used to sign commits. Also default to using the gpg user |
On behalf of UDD users: Thank You !
27 + c = the_branch. get_config( ) option( 'bzr.plugins. launchpad. packaging_ verbosity' )
28 + verbosity = c.get_user_
You're a bit out of fashion here ;)
You can start using the the stck-based config here.
This can take various forms:
- the consensus about the option names would be more packaging_ verbosity' which is still long and may be freshness' ?
'launchpad.
slightly unclear, how about 'lp.package_
- use the stack-based implementation (even if you target 2.4)
c = config. BranchStack( the_branch) bzr.plugins. launchpad. packaging_ verbosity' )
verbosity = c.get('
Declare your option:
option_ registry. register( 'xxx, Option('xxx', default='off'),
help= 'xxx is so nice, use it.')
113 +def report_ freshness( the_branch, verbosity, latest_pub):
This function seem to mix 3 different things:
- get the LatestPublication data
- time them
- report to the user
I'm not sure we need to time them (mutter does that already no ?)
I think the code will be clearer and easier to test if this was
split.
234 +class TestReportFresh ness(tests. TestCaseWithMem oryTransport) :
This can then be split/parametrized so the display tests just
don't need a branch at all.
252 + orig_log_len = len(self.get_log())
In many discussions about self.get_log() we mentioned that only a
few tests were requiring get_log() and I seem to remember that
everybody agreed on that.
Here, you have to filter almost everything, istm that split the
display out will make the filtering uneeded.
That will also probably reduce the duplication like:
270 + b = self.make_ trivial_ branch( )
which strongly want to be in a setUp() ;)
Now, how should I vote...
The above are not enough to block.
On the other hand, I would be *highly* surprised if nobody
bikeshed there or ask for some different details, so istm we
*will* modify these tests.
So BB:tweak as much as you can ;)