[BUG] bzr mkdir subdir fails... -> patch: test+fix

Matthieu Moy Matthieu.Moy at imag.fr
Fri Nov 11 22:35:42 GMT 2005


Alexander Belchenko <bialix at ukr.net> writes:

> Probably there is should be more complicated test for your variant
> because this mkdir implementation have two different ways of execution
> for first maked directory and next directories.

Actually, the following behavior is a bit surprising:

#
# Create two nested trees:
#

$ mkdir p1
$ cd p1
$ bzr init
$ mkdir p2
$ cd p2
$ bzr init
$ cd ../

#
# bzr mkdir in the current tree and in the subtree
#

$ bzr mkdir dir1 p2/dir2
added dir1
bzr: ERROR: [u'p2'] is not versioned
  command: '/home/moy/bin/bzr' 'mkdir' 'dir1' 'p2/dir2'
      pwd: u'/tmp/p1'
    error: bzrlib.errors.NotVersionedError
  at /net/ecrins/local/moy/usr/src/bzr.dev/bzrlib/inventory.py line
  891, in add_path()
  see ~/.bzr.log for debug information

I believe a better fix would be

    def run(self, dir_list):
        for d in dir_list:
            os.mkdir(d)
            b, dd = Branch.open_containing(d)
            b.add([dd])
            print 'added', dd

(I'm not sure the performance gain of not setting b several times is
significant)

but then:

$ bzr mkdir dir6 p2/dir6
added dir6
added dir6

Perhaps we actually want

$ bzr mkdir dir6 p2/dir6
added dir6
added dir6 in p2/

?

-- 
Matthieu




More information about the bazaar mailing list