Merge lp:~frankban/lpsetup/bug-1023895-init-repo-no-checkout into lp:lpsetup
| Status: | Merged |
|---|---|
| Approved by: | Francesco Banconi on 2012-07-17 |
| Approved revision: | 80 |
| Merged at revision: | 55 |
| Proposed branch: | lp:~frankban/lpsetup/bug-1023895-init-repo-no-checkout |
| Merge into: | lp:lpsetup |
| Diff against target: |
652 lines (+385/-38) 7 files modified
lpsetup/handlers.py (+41/-2) lpsetup/settings.py (+5/-5) lpsetup/subcommands/initrepo.py (+50/-19) lpsetup/tests/subcommands/test_initrepo.py (+135/-4) lpsetup/tests/test_handlers.py (+80/-4) lpsetup/tests/utils.py (+69/-0) setup.cfg (+5/-4) |
| To merge this branch: | bzr merge lp:~frankban/lpsetup/bug-1023895-init-repo-no-checkout |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Benji York (community) | code | 2012-07-16 | Approve on 2012-07-16 |
|
Review via email:
|
|||
Commit Message
Add --no-checkout option to init-repo and other fixes.
Description of the Change
== Changes ==
*handle_
Added the *handle_
s/CHECKOUT_
Added `--no-checkout` option to *init-repo*: it creates a "normal" non-lightweight checkout.
The runtime errors that can be generated by `bzr` calls in *init-repo* are now handled and raise an *ExecutionError*. To avoid race conditions this error handling is done by the step itself and not by the handlers.
The *fetch()* step now tries a lot: it contains 3 similar try/except blocks that could be abstracted, for instance, with a code like this::
def bzrcall(args, error=''):
"""Execute bzr passing *args*.
If the bzr command fails, raise an ExecutionError containing the given
*error* + the original bzr failure message.
"""
cmd = ['bzr'] + list(args)
try:
except subprocess.
raise exceptions.
I decided to leave the explicit calls in *fetch()*: please feel free to suggest another approach.
Fixed *setup_
Implemented an integration TestCase for *init-repo*. The tests create a fake test branch and use it as source bzr repository. The template directory used to create the fake branch is placed in `lpsetup/
Created a *BackupFile* context manager, useful to backup and restore a single file: in this branch it is used to preserve bazaar's `locations.conf`.
Added tests for the *capture* context manager.
Added the helper function *create_
`setup.cfg` excludes *create_
| Francesco Banconi (frankban) wrote : | # |
Thanks Benji, I updated the branch following your suggestions.
| Launchpad QA Bot (lpqabot) wrote : | # |
The attempt to merge lp:~frankban/lpsetup/bug-1023895-init-repo-no-checkout into lp:lpsetup failed. Below is the output from the failed tests.
nose.plugins.cover: ERROR: Coverage not available: unable to import coverage module
.......
=======
ERROR: disabled_
-------
Traceback (most recent call last):
File "/home/
self.source = create_
File "/home/
call('bzr', 'commit', branch_path, '-m', 'Initial commit.')
File "/usr/lib/
raise exception
CalledProcessError: Command '['bzr', 'commit', '/mnt/tarmac-
=======
ERROR: test_no_trees (lpsetup.
-------
Traceback (most recent call last):
File "/home/
self.source = create_
File "/home/
call('bzr', 'commit', branch_path, '-m', 'Initial commit.')
File "/usr/lib/
raise exception
CalledProcessError: Command '['bzr', 'commit', '/mnt/tarmac-
=======
ERROR: test_with_trees (lpsetup.
-------
Traceback (most recent call last):
File "/home/
self.source = create_
File "/home/
call('bzr', 'commit', branch_path, '-m', 'Initial commit.')
File "/usr/lib/
raise exception
CalledProcessError: Command '['bzr', 'commit', '/mnt/tarmac-
=======
ERROR: test_revno (lpsetup.
-------
Traceback (most recent call last):
File "/home/
self.
File "/home/
| Launchpad QA Bot (lpqabot) wrote : | # |
The attempt to merge lp:~frankban/lpsetup/bug-1023895-init-repo-no-checkout into lp:lpsetup failed. Below is the output from the failed tests.
nose.plugins.cover: ERROR: Coverage not available: unable to import coverage module
.......
=======
ERROR: test_bazaar_
-------
Traceback (most recent call last):
File "/home/
self.source = create_
File "/home/
call('bzr', 'commit', branch_path, '-m', 'Initial commit.')
File "/usr/lib/
raise exception
CalledProcessError: Command '['bzr', 'commit', '/mnt/tarmac-
=======
ERROR: test_no_trees (lpsetup.
-------
Traceback (most recent call last):
File "/home/
self.source = create_
File "/home/
call('bzr', 'commit', branch_path, '-m', 'Initial commit.')
File "/usr/lib/
raise exception
CalledProcessError: Command '['bzr', 'commit', '/mnt/tarmac-
=======
ERROR: test_with_trees (lpsetup.
-------
Traceback (most recent call last):
File "/home/
self.source = create_
File "/home/
call('bzr', 'commit', branch_path, '-m', 'Initial commit.')
File "/usr/lib/
raise exception
CalledProcessError: Command '['bzr', 'commit', '/mnt/tarmac-
=======
ERROR: test_revno (lpsetup.
-------
Traceback (most recent call last):
File "/home/
self.
File "/home/
| Launchpad QA Bot (lpqabot) wrote : | # |
The attempt to merge lp:~frankban/lpsetup/bug-1023895-init-repo-no-checkout into lp:lpsetup failed. Below is the output from the failed tests.
nose.plugins.cover: ERROR: Coverage not available: unable to import coverage module
.......
=======
ERROR: test_revno (lpsetup.
-------
Traceback (most recent call last):
File "/home/
self.
File "/home/
call('bzr', 'commit', branch_path, '-m', 'Initial commit.')
File "/usr/lib/
raise exception
CalledProcessError: Command '['bzr', 'commit', '/mnt/tarmac-
=======
ERROR: test_working_tree (lpsetup.
-------
Traceback (most recent call last):
File "/home/
self.
File "/home/
call('bzr', 'commit', branch_path, '-m', 'Initial commit.')
File "/usr/lib/
raise exception
CalledProcessError: Command '['bzr', 'commit', '/mnt/tarmac-
=======
FAIL: test_bazaar_
-------
Traceback (most recent call last):
File "/home/
self.
AssertionError: Element counts were not equal:
First has 1, Second has 0: ('push_location', 'lp:~lpqabot/launchpad')
First has 1, Second has 0: ('public_branch', 'bzr+ssh:
First has 0, Second has 1: ('push_location', 'lp:~tarmac/launchpad')
First has 0, Second has 1: ('public_branch', 'bzr+ssh:
"""Fail immediately, with the given message."""
>> raise self.failureExc
-------...
- 77. By Francesco Banconi on 2012-07-17
-
Fixed CreateTestBranc
hTest: set the bzr user id. - 78. By Francesco Banconi on 2012-07-17
-
Fixed IntegrationTest
.test_bazaar_ locations: use the real lpuser. - 79. By Francesco Banconi on 2012-07-17
-
Fixed handle_directories relative path test to actually change the current dir.
- 80. By Francesco Banconi on 2012-07-17
-
Skipping tests if lpuser is not set up.

This branch looks good. There is one thing that needs to be fixed (see
below) and one thing for future consideration (farther below).
The (pre-existing) code that replaces "~" with namespace.home_dir should expanduser( ) instead. The reason is that just replacing all
use os.path.
tilde characters with the current user's home directory can generate
incorrect results. For example, these strings would not be handled
correctly:
"~user/foo" --> "/home/ useruser/ foo" user/foouserbar "
"~/foo~bar" --> "/home/
Using the users actual bzr config (locations.conf) for tests feels a bit
brittle. Perhaps in the future we can override $HOME instead and
provide our own (fully controlled and non-precious) file hierarchy for
the tests to run against.