Merge lp:~parthm/bzr/138600 into lp:bzr
| Status: | Merged |
|---|---|
| Merged at revision: | not available |
| Proposed branch: | lp:~parthm/bzr/138600 |
| Merge into: | lp:bzr |
| Diff against target: |
137 lines (+67/-8) (has conflicts) 3 files modified
NEWS (+6/-0) bzrlib/builtins.py (+8/-3) bzrlib/tests/blackbox/test_versioning.py (+53/-5) Text conflict in NEWS |
| To merge this branch: | bzr merge lp:~parthm/bzr/138600 |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Vincent Ladeuil | 2010-02-26 | Approve on 2010-03-02 | |
| Andrew Bennetts | 2010-02-17 | Approve on 2010-02-26 | |
|
Review via email:
|
|||
| Parth Malwankar (parthm) wrote : | # |
| Andrew Bennetts (spiv) wrote : | # |
The NEWS entry is a bit unclear. Perhaps:
* ``bzr mkdir DIR`` will not create DIR unless DIR's parent is a versioned directory. (Parth Malwankar, #138600)
(with appropriate word-wrapping, of course).
The tests look like they cover all the interesting cases, thanks! They are a bit oddly inconsistent cosmetically (e.g. calling run_bzr with 'mkdir abc' vs. ['mkdir', 'abc']), but that's not a big deal.
| Andrew Bennetts (spiv) wrote : | # |
Oh, and this would be reasonable to backport to 2.1 for the 2.1.1 release, I think.
- 5044. By Parth Malwankar on 2010-02-26
-
updated based on review comments.
NEWS entry to be clearer. run_bzr now uses list for args.
| Parth Malwankar (parthm) wrote : | # |
> The NEWS entry is a bit unclear. Perhaps:
>
> * ``bzr mkdir DIR`` will not create DIR unless DIR's parent is a versioned
> directory. (Parth Malwankar, #138600)
>
> (with appropriate word-wrapping, of course).
>
> The tests look like they cover all the interesting cases, thanks! They are a
> bit oddly inconsistent cosmetically (e.g. calling run_bzr with 'mkdir abc' vs.
> ['mkdir', 'abc']), but that's not a big deal.
Thanks for reviewing this Andrew. I have done the updates suggested.
Will create a branch and send a merge request against 2.1.
| Parth Malwankar (parthm) wrote : | # |
It seems I (unintentionally, %s/// :-)) ended up mkdir run_bzr take a list argument across test_versioning.py (I have added only TestMkdir). I suppose thats a desired change. The tests are certainly passing.
| Vincent Ladeuil (vila) wrote : | # |
51 +class TestMkdir(
52 +
use a safety bzr repo to guard against leaking tests (that may try
to write in a bzr containing repo, outside of their environment,
see bzrlib.
So:
59 + def test_mkdir_
60 + """'mkdir' should fail with unversioned directory in path. Bug #138600"""
67 + def test_mkdir_
68 + """'mkdir' should fail cleanly from within an unversioned directory. Bug #138600"""
and
75 + def test_mkdir_
76 + """'mkdir' should fail with unversioned directory inside branch. Bug #138600"""
don't test what you think they test, since they are all inside a valid branch.
86 + def test_mkdir_
87 + """'mkdir' should fail cleanly from within an unversioned directory
is valid, but don't need to create a branch since you're working outside of this created branch
anyway.
Since we requires a working tree,
53 + def test_mkdir_
54 + """'mkdir' should fail cleanly withing a repo. Bug #138600"""
is enough to test your change since we indeed raise NotVersionedError here.
I'll delete these tests and merge.
I'll delete them and merge.
| Vincent Ladeuil (vila) wrote : | # |
Bah, it's neither a safety repo nor branch it's a full safety working tree, sorry for the imprecise comments.

This patch fixes bug #138600
Basically bzr was creating the directory before adding it to the tree. If adding failed
the directory still remains. This change takes care of the following scenarios i.e. ensures no directory is created in case of the following failures:
1. mkdir fails in a repository because there is no working tree.
2. 'bzr mkdir foo' fails because '.' is not versioned.
3. 'bzr mkdir bar/foo' fails because 'bar' is not versioned (but '../bar' is versioned).
4. 'cd bar; bzr mkdir foo' fails because 'bar' is not versioned (but '../bar' is versioned).