Merge lp:~nmb/bzr/script-test-mv into lp:bzr
| Status: | Merged |
|---|---|
| Merged at revision: | not available |
| Proposed branch: | lp:~nmb/bzr/script-test-mv |
| Merge into: | lp:bzr |
| Diff against target: |
99 lines (+63/-0) 3 files modified
NEWS (+4/-0) bzrlib/tests/script.py (+23/-0) bzrlib/tests/test_script.py (+36/-0) |
| To merge this branch: | bzr merge lp:~nmb/bzr/script-test-mv |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Vincent Ladeuil | Approve on 2010-01-13 | ||
| John A Meinel | 2010-01-13 | Approve on 2010-01-13 | |
|
Review via email:
|
|||
| Neil Martinsen-Burrell (nmb) wrote : | # |
| Martin Pool (mbp) wrote : | # |
That's nice.
It should be mentioned in TESTING in news.
I wonder if it should use a transport operation rather than shutil?
| John A Meinel (jameinel) wrote : | # |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Martin Pool wrote:
> That's nice.
>
> It should be mentioned in TESTING in news.
>
> I wonder if it should use a transport operation rather than shutil?
If you use shutil.move() it *does* support "path ... dir". It may not
support multiple paths, but 'move' will notice the target is a directory
an move things into it.
transport.rename() won't (being based on top of os.rename), etc.
If shutil is meant to be used on something like MemoryTransport, then we
obviously have to go there. If it is only meant to be used on disk, then
'shutil.move' is probably fine.
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://
iEYEARECAAYFAkt
R/IAnA2BuJ6SH0U
=eKG2
-----END PGP SIGNATURE-----
| John A Meinel (jameinel) wrote : | # |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Neil Martinsen-Burrell wrote:
> Neil Martinsen-Burrell has proposed merging lp:~nmb/bzr/script-test-mv into lp:bzr.
>
> Requested reviews:
> bzr-core (bzr-core)
>
>
> This branch adds an mv command to the shell-like tests in bzrlib/
>
I would probably add a test that "mv file dir" has the expected
"dir/file" result. Otherwise:
review: approve
Let me know if you need help finishing this.
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://
iEYEARECAAYFAkt
/4EAoIURyAfCvZB
=+uen
-----END PGP SIGNATURE-----
- 4955. By Neil Martinsen-Burrell on 2010-01-13
-
added a test for "mv file dir" and a NEWS entry
| Neil Martinsen-Burrell (nmb) wrote : | # |
shutil (actually os) was what I saw being used in the other commands so I went with it. If these are limited to disk-based transports, then perhaps we should just document this fact.
Added one more test and a NEWS entry in the branch.
| Vincent Ladeuil (vila) wrote : | # |
Using os.rename() instead of shutil.move() will make the limitations more obvious.
The long term plan is to move to a transport-based implementation where moving
across file systems will not be supported anyway.
A final test to check the behaviour when the file does not exist... reveals untested code
(error was called with a single path) :)
I'll tweak and merge.

This branch adds an mv command to the shell-like tests in bzrlib/ tests/script. py, along with three tests modeled on those of the rm command. It only implements the simplest ``mv name1 name2`` syntax, not the more compltete ``mv file1 file2 ... dir`` command. Scratch your own itch! :)