Merge lp:~savoirfairelinux-openerp/lp-community-utils/fix-pep8-and-add-new-projects into lp:lp-community-utils
- fix-pep8-and-add-new-projects
- Merge into openerp-reviewers-nag
Status: | Merged |
---|---|
Merged at revision: | 19 |
Proposed branch: | lp:~savoirfairelinux-openerp/lp-community-utils/fix-pep8-and-add-new-projects |
Merge into: | lp:lp-community-utils |
Diff against target: |
447 lines (+80/-66) 6 files modified
README.rst (+1/-1) clone_mp_to_community.py (+43/-38) merge_mp.py (+9/-9) openerp-nag (+3/-3) projects (+9/-3) replay_missing.py (+15/-12) |
To merge this branch: | bzr merge lp:~savoirfairelinux-openerp/lp-community-utils/fix-pep8-and-add-new-projects |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Stefan Rijnhart (Opener) | code review | Approve | |
Pedro Manuel Baeza | code review, no test | Approve | |
Review via email: mp+186938@code.launchpad.net |
Commit message
Description of the change
[FIX] PEP8
[ADD] HR, ISP and Edition projects
To post a comment you must log in.
- 20. By Maxime Chambreuil (http://www.savoirfairelinux.com)
-
[ADD] Bazaar-extractor project
- 21. By Maxime Chambreuil (http://www.savoirfairelinux.com)
-
[IMP] Add openerp-sage-50 project
- 22. By Maxime Chambreuil (http://www.savoirfairelinux.com)
-
[IMP] Add openerp-pos project
Revision history for this message
Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903) wrote : | # |
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote : | # |
Hi, Maxime, can you please add the new openerp-
The rest seems OK.
Thank you.
review:
Approve
(code review, no test)
Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) : | # |
review:
Approve
(code review)
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'README.rst' |
2 | --- README.rst 2013-01-03 08:17:37 +0000 |
3 | +++ README.rst 2013-10-22 12:05:54 +0000 |
4 | @@ -43,7 +43,7 @@ |
5 | Community Reviewers pool, it has to be added there. |
6 | |
7 | If someone can contribute to automatize the build of |
8 | -the projects list (if that where possible), |
9 | +the projects list (if that were possible), |
10 | that would be great. |
11 | |
12 | |
13 | |
14 | === modified file 'clone_mp_to_community.py' |
15 | --- clone_mp_to_community.py 2013-04-24 08:13:56 +0000 |
16 | +++ clone_mp_to_community.py 2013-10-22 12:05:54 +0000 |
17 | @@ -1,6 +1,6 @@ |
18 | #!/usr/bin/python |
19 | # -*- coding: utf-8 -*- |
20 | -############################################################################## |
21 | +# |
22 | # |
23 | # OpenERP, Open Source Management Solution |
24 | # This module copyright (C) 2013 Therp BV (<http://therp.nl>). |
25 | @@ -20,7 +20,7 @@ |
26 | # You should have received a copy of the GNU Affero General Public License |
27 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
28 | # |
29 | -############################################################################## |
30 | +# |
31 | import os |
32 | import os.path |
33 | import shutil |
34 | @@ -41,7 +41,7 @@ |
35 | |
36 | load_plugins() |
37 | |
38 | -#mapping from official projects/series to community series |
39 | +# mapping from official projects/series to community series |
40 | project_mappings = { |
41 | 'openerp-web': { |
42 | '6.1': 'lp:ocb-web/6.1', |
43 | @@ -61,6 +61,8 @@ |
44 | } |
45 | |
46 | api_base_url = 'https://api.launchpad.net/1.0/' |
47 | + |
48 | + |
49 | def get_lp_json(url): |
50 | """ |
51 | Load a launchpad API request in JSON format. |
52 | @@ -90,6 +92,7 @@ |
53 | request = urllib2.urlopen(api_url) |
54 | return simplejson.load(request) |
55 | |
56 | + |
57 | def get_project_series(lp_url): |
58 | """ |
59 | Split off the lp: part (or harmlessly 'htt' in the case of http |
60 | @@ -98,6 +101,7 @@ |
61 | parts = lp_url[3:].split('/') |
62 | return (parts[-2], parts[-1]) |
63 | |
64 | + |
65 | def clone_merge_proposals(lp, source_branch_address, |
66 | target_branch_address=None, |
67 | reference_branch_address=None, |
68 | @@ -126,8 +130,8 @@ |
69 | logging.debug('Looking at possible target %s', |
70 | mp.target_branch.web_link) |
71 | project, series = get_project_series(mp.target_branch.web_link) |
72 | - if (project in project_mappings and |
73 | - series in project_mappings[project]): |
74 | + if (project in project_mappings and |
75 | + series in project_mappings[project]): |
76 | target_branch_address = project_mappings[project][series] |
77 | original_target_branch_address = mp.target_branch.bzr_identity |
78 | break |
79 | @@ -135,7 +139,7 @@ |
80 | logging.warning('Found a proposal on an unknown project ' |
81 | '\'%s\' or series \'%s\'', project, series) |
82 | |
83 | - if not mp: # i.e. there were no landing targets |
84 | + if not mp: # i.e. there were no landing targets |
85 | logging.error('No merge proposal found for %s', |
86 | source_branch_address) |
87 | return 1 |
88 | @@ -153,11 +157,11 @@ |
89 | logging.debug('getting %s to create merge proposal to %s', |
90 | target_branch_address, target_branch_dir) |
91 | cmd_branch().run(target_branch_address, |
92 | - to_location=target_branch_dir, stacked=True, |
93 | + to_location=target_branch_dir, stacked=True, |
94 | use_existing_dir=True) |
95 | |
96 | target_branch = lp_api.LaunchpadBranch.from_bzr(lp, |
97 | - Branch.open(target_branch_dir)) |
98 | + Branch.open(target_branch_dir)) |
99 | |
100 | replay_args = [target_branch_dir, source_branch_address] |
101 | if reference_branch_address: |
102 | @@ -165,7 +169,7 @@ |
103 | elif original_target_branch_address: |
104 | replay_args += ['-r', original_target_branch_address] |
105 | logging.debug('start replay %s', replay_args) |
106 | - |
107 | + |
108 | try: |
109 | replay_missing.main(replay_args) |
110 | except ConflictsInTree: |
111 | @@ -188,7 +192,7 @@ |
112 | |
113 | logging.debug('pushing to %s', push_location) |
114 | push = cmd_push() |
115 | - #TODO: because of this, bzr's output doesn't end up in our logger |
116 | + # TODO: because of this, bzr's output doesn't end up in our logger |
117 | push._setup_outf() |
118 | push.run( |
119 | location=push_location, directory=target_branch_dir, stacked=True) |
120 | @@ -199,10 +203,10 @@ |
121 | initial_comment += (' Below is a copy of the original ' |
122 | 'description.\n\n%s' % mp.description) |
123 | lp.branches.getByUrl(url=push_location).createMergeProposal( |
124 | - commit_message=mp.commit_message, |
125 | - initial_comment=initial_comment, |
126 | - needs_review=True, |
127 | - target_branch=target_branch.lp) |
128 | + commit_message=mp.commit_message, |
129 | + initial_comment=initial_comment, |
130 | + needs_review=True, |
131 | + target_branch=target_branch.lp) |
132 | |
133 | shutil.rmtree(target_branch_dir) |
134 | else: |
135 | @@ -210,28 +214,28 @@ |
136 | 'No target branch specified and no proposal found for %s ' |
137 | 'on any mapped project and series', source_branch_address) |
138 | |
139 | - |
140 | + |
141 | def main(argv=None): |
142 | parser = argparse.ArgumentParser() |
143 | - parser.add_argument('--mp-branch-dir', dest='mp_branch_dir', |
144 | - help="the local directory of the merge proposal\'s branch") |
145 | - parser.add_argument('--mp-url', dest='mp_url', |
146 | - help="the merge proposal's web address on launchpad") |
147 | - parser.add_argument('--reference-branch', '-r', dest='reference_branch', |
148 | - help=("Only replay commits that are not present in this branch. This " |
149 | - "would usually be a local copy of the original target branch " |
150 | - "of the merge proposal")) |
151 | - parser.add_argument('--target-branch', dest='target_branch', |
152 | - help="override automagicly chosen target branch") |
153 | + parser.add_argument('--mp-branch-dir', dest='mp_branch_dir', |
154 | + help="the local directory of the merge proposal\'s branch") |
155 | + parser.add_argument('--mp-url', dest='mp_url', |
156 | + help="the merge proposal's web address on launchpad") |
157 | + parser.add_argument('--reference-branch', '-r', dest='reference_branch', |
158 | + help=("Only replay commits that are not present in this branch. This " |
159 | + "would usually be a local copy of the original target branch " |
160 | + "of the merge proposal")) |
161 | + parser.add_argument('--target-branch', dest='target_branch', |
162 | + help="override automagicly chosen target branch") |
163 | parser.add_argument('--target-copy', '-c', |
164 | - help="Directory to use as a local copy of the target branch. This " |
165 | - "prevents downloading the branch from Launchpad.") |
166 | + help="Directory to use as a local copy of the target branch. This " |
167 | + "prevents downloading the branch from Launchpad.") |
168 | parser.add_argument('-d', '--debug', dest='loglevel', action='store_const', |
169 | - const='DEBUG', help='debug output') |
170 | + const='DEBUG', help='debug output') |
171 | parser.add_argument('-q', '--quiet', dest='loglevel', action='store_const', |
172 | - const='ERROR', help='be quiet') |
173 | + const='ERROR', help='be quiet') |
174 | arguments = parser.parse_args(argv) |
175 | - |
176 | + |
177 | if arguments.loglevel: |
178 | logging.getLogger().setLevel(getattr(logging, arguments.loglevel)) |
179 | |
180 | @@ -266,15 +270,15 @@ |
181 | except bzrlib.errors.NotBranchError: |
182 | if not source_branch_location: |
183 | logging.error('current directory is not a branch and I got no ' |
184 | - 'merge proposal - giving up') |
185 | + 'merge proposal - giving up') |
186 | return 1 |
187 | - |
188 | + |
189 | try: |
190 | - clone_merge_proposals(lp, source_branch_location, |
191 | - target_branch_address=arguments.target_branch, |
192 | - reference_branch_address=(arguments.reference_branch |
193 | - or original_target_branch_location), |
194 | - target_copy=arguments.target_copy) |
195 | + clone_merge_proposals(lp, source_branch_location, |
196 | + target_branch_address=arguments.target_branch, |
197 | + reference_branch_address=(arguments.reference_branch |
198 | + or original_target_branch_location), |
199 | + target_copy=arguments.target_copy) |
200 | |
201 | except bzrlib.errors.NotBranchError as e: |
202 | logging.error('found no branch to work on - branch dir is %s', |
203 | @@ -283,5 +287,6 @@ |
204 | |
205 | if __name__ == "__main__": |
206 | import sys |
207 | - logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.INFO) |
208 | + logging.basicConfig( |
209 | + format='%(levelname)s: %(message)s', level=logging.INFO) |
210 | sys.exit(main(sys.argv[1:])) |
211 | |
212 | === modified file 'merge_mp.py' |
213 | --- merge_mp.py 2013-04-24 08:19:34 +0000 |
214 | +++ merge_mp.py 2013-10-22 12:05:54 +0000 |
215 | @@ -1,6 +1,6 @@ |
216 | #!/usr/bin/python |
217 | # -*- coding: utf-8 -*- |
218 | -############################################################################## |
219 | +# |
220 | # |
221 | # OpenERP, Open Source Management Solution |
222 | # This module copyright (C) 2013 Therp BV (<http://therp.nl>). |
223 | @@ -20,24 +20,24 @@ |
224 | # You should have received a copy of the GNU Affero General Public License |
225 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
226 | # |
227 | -############################################################################## |
228 | +# |
229 | import sys |
230 | import argparse |
231 | import tempfile |
232 | import shutil |
233 | import logging |
234 | from bzrlib.builtins import (cmd_branch, cmd_push, cmd_merge, cmd_commit, |
235 | - cmd_pull) |
236 | + cmd_pull) |
237 | import clone_mp_to_community |
238 | |
239 | logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.INFO) |
240 | |
241 | parser = argparse.ArgumentParser() |
242 | parser.add_argument('mp_url', |
243 | - help='The URL of the merge proposal on Launchpad') |
244 | + help='The URL of the merge proposal on Launchpad') |
245 | parser.add_argument('--target-copy', '-c', |
246 | - help='Directory to use as a local copy of the target branch.\n' |
247 | - 'This prevents downloading the branch from Launchpad.') |
248 | + help='Directory to use as a local copy of the target branch.\n' |
249 | + 'This prevents downloading the branch from Launchpad.') |
250 | parser.add_argument('--commit-message', '-m', help='Override commit message') |
251 | arguments = parser.parse_args() |
252 | |
253 | @@ -47,7 +47,7 @@ |
254 | |
255 | if not mp['commit_message'] and not arguments.commit_message: |
256 | print 'The merge proposal contains no commit message. '\ |
257 | - 'Give one as parameter!' |
258 | + 'Give one as parameter!' |
259 | sys.exit() |
260 | |
261 | branch_dir = tempfile.mkdtemp() |
262 | @@ -60,14 +60,14 @@ |
263 | pull_command.run(directory=branch_dir) |
264 | else: |
265 | cmd_branch().run(lp_target['bzr_identity'], to_location=branch_dir, |
266 | - stacked=True, use_existing_dir=True) |
267 | + stacked=True, use_existing_dir=True) |
268 | |
269 | merge_command = cmd_merge() |
270 | merge_command._setup_outf() |
271 | merge_command.run(lp_source['bzr_identity'], directory=branch_dir) |
272 | |
273 | cmd_commit().run(message=arguments.commit_message or mp['commit_message'], |
274 | - selected_list=[branch_dir]) |
275 | + selected_list=[branch_dir]) |
276 | |
277 | push_command = cmd_push() |
278 | push_command._setup_outf() |
279 | |
280 | === modified file 'openerp-nag' |
281 | --- openerp-nag 2013-06-13 08:00:49 +0000 |
282 | +++ openerp-nag 2013-10-22 12:05:54 +0000 |
283 | @@ -231,15 +231,15 @@ |
284 | logging.info("Looking for things to nag about under %s", project_name) |
285 | nags.extend(gen_project_nags(lp, policy, project_name)) |
286 | nags.sort(key=lambda nag: (nag.sort_class, nag.sort_priority, |
287 | - nag.sort_age)) |
288 | + nag.sort_age)) |
289 | print("=" * 80) |
290 | print("Done thinking, here's the nag list".center(80)) |
291 | print("=" * 80) |
292 | for index1, nag in enumerate(nags, 1): |
293 | print("{index1:-2}: [age {age}] {person} should {action} {subject} " |
294 | "on the project {project}".format( |
295 | - index1=index1, age=(nag.sort_age and -nag.sort_age), person=nag.person, |
296 | - action=nag.action, subject=nag.subject, project=nag.project_name)) |
297 | + index1=index1, age=(nag.sort_age and -nag.sort_age), person=nag.person, |
298 | + action=nag.action, subject=nag.subject, project=nag.project_name)) |
299 | |
300 | |
301 | if __name__ == "__main__": |
302 | |
303 | === modified file 'projects' |
304 | --- projects 2013-04-29 06:19:10 +0000 |
305 | +++ projects 2013-10-22 12:05:54 +0000 |
306 | @@ -8,6 +8,7 @@ |
307 | account-invoicing |
308 | account-payment |
309 | banking-addons |
310 | +bazaar-extractor |
311 | carriers-deliveries |
312 | contract-management |
313 | department-mgmt |
314 | @@ -18,17 +19,25 @@ |
315 | knowledge-addons |
316 | lp-community-utils |
317 | margin-analysis |
318 | +ocb-addons |
319 | +ocb-server |
320 | +ocb-web |
321 | oemedical |
322 | openerp-accountedge |
323 | openerp-construction |
324 | +openerp-edition |
325 | openerp-fiscal-rules |
326 | +openerp-hr |
327 | openerp-icm |
328 | +openerp-isp |
329 | openerp-library |
330 | openerp-lims-connect |
331 | openerp-manufacturing |
332 | openerp-mgmtsystem |
333 | +openerp-pos |
334 | openerp-product-attributes |
335 | openerp-product-variant |
336 | +openerp-sage-50 |
337 | partner-contact-management |
338 | product-kitting |
339 | project-reporting |
340 | @@ -51,6 +60,3 @@ |
341 | sugarcrm-openerp |
342 | web-addons |
343 | webkit-utils |
344 | -ocb-addons |
345 | -ocb-server |
346 | -ocb-web |
347 | |
348 | === modified file 'replay_missing.py' |
349 | --- replay_missing.py 2013-04-24 08:18:30 +0000 |
350 | +++ replay_missing.py 2013-10-22 12:05:54 +0000 |
351 | @@ -1,6 +1,6 @@ |
352 | #!/usr/bin/python |
353 | # -*- coding: utf-8 -*- |
354 | -############################################################################## |
355 | +# |
356 | # |
357 | # OpenERP, Open Source Management Solution |
358 | # This module copyright (C) 2013 Therp BV (<http://therp.nl>). |
359 | @@ -23,7 +23,7 @@ |
360 | # You should have received a copy of the GNU Affero General Public License |
361 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
362 | # |
363 | -############################################################################## |
364 | +# |
365 | import sys |
366 | import argparse |
367 | from os.path import isdir |
368 | @@ -33,7 +33,7 @@ |
369 | from bzrlib.errors import ( |
370 | NoSuchRevision, |
371 | UnknownErrorFromSmartServer, |
372 | - ) |
373 | +) |
374 | from bzrlib.generate_ids import gen_revision_id |
375 | from bzrlib.option import _parse_revision_str |
376 | from bzrlib.plugins.launchpad.lp_directory import LaunchpadDirectory |
377 | @@ -41,6 +41,7 @@ |
378 | from bzrlib.workingtree import WorkingTree |
379 | import logging |
380 | |
381 | + |
382 | def replay_missing( |
383 | wt, upstream_location, alternative_reference=False, do_nothing=False): |
384 | """ |
385 | @@ -101,12 +102,12 @@ |
386 | finally: |
387 | source.unlock() |
388 | return result |
389 | - |
390 | + |
391 | upstream = Branch.open_containing(upstream_location)[0] |
392 | logging.debug('finding differences') |
393 | _, todo_set = find_difference(wt.branch, upstream) |
394 | logging.debug("%s revisions not in the reference branch", len(todo_set)) |
395 | - |
396 | + |
397 | if alternative_reference: |
398 | _, wt_todo_set = find_difference(wt.branch, alternative_reference) |
399 | todo_set = todo_set.difference(wt_todo_set) |
400 | @@ -136,14 +137,15 @@ |
401 | revno, upstream_location, revid) |
402 | if not do_nothing: |
403 | revisionspec = _parse_revision_str( |
404 | - "%s..%s" % (int(revno) -1, int(revno))) |
405 | + "%s..%s" % (int(revno) - 1, int(revno))) |
406 | cmd_merge().run(location=upstream.base, |
407 | - revision=revisionspec, |
408 | - directory=wt.branch.base) |
409 | + revision=revisionspec, |
410 | + directory=wt.branch.base) |
411 | oldrev = wt.branch.repository.get_revision(revid) |
412 | revid = gen_revision_id(oldrev.committer, oldrev.timestamp) |
413 | commit_missing(wt, oldrev, revid) |
414 | |
415 | + |
416 | def main(argv): |
417 | parser = argparse.ArgumentParser() |
418 | parser.add_argument( |
419 | @@ -158,7 +160,7 @@ |
420 | help='Log level (default is \'INFO\')') |
421 | parser.add_argument('wt_directory', help='local branch or checkout') |
422 | parser.add_argument('upstream_branches', nargs='+', |
423 | - help='upstream branch', metavar='upstream_branch') |
424 | + help='upstream branch', metavar='upstream_branch') |
425 | |
426 | arguments = parser.parse_args(argv) |
427 | |
428 | @@ -173,9 +175,9 @@ |
429 | reference = Branch.open(arguments.reference) |
430 | if reference.get_master_branch(): |
431 | sys.exit("%s is a bound branch. Please unbind\n" % |
432 | - arguments.reference) |
433 | + arguments.reference) |
434 | if isinstance(transport.get_transport(arguments.reference), |
435 | - transport.local.LocalTransport): |
436 | + transport.local.LocalTransport): |
437 | logging.debug('pulling %s to %s', |
438 | reference.get_parent(), |
439 | reference.base) |
440 | @@ -195,5 +197,6 @@ |
441 | do_nothing=arguments.do_nothing) |
442 | |
443 | if __name__ == "__main__": |
444 | - logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.INFO) |
445 | + logging.basicConfig( |
446 | + format='%(levelname)s: %(message)s', level=logging.INFO) |
447 | sys.exit(main(sys.argv[1:])) |
Can someone review this MP please ?
Thanks.