~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/export/dir_exporter.py

  • Committer: Alexander Belchenko
  • Date: 2009-07-29 13:46:55 UTC
  • mto: This revision was merged to the branch mainline in revision 4578.
  • Revision ID: bialix@ukr.net-20090729134655-cje82wzo7rex9pbt
Fixed export to existing empty directory.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
"""Export a Tree to a non-versioned directory.
18
18
"""
19
19
 
20
 
 
 
20
import errno
21
21
import os
22
22
import StringIO
23
23
 
43
43
           left in a half-assed state.
44
44
    """
45
45
    mutter('export version %r', tree)
46
 
    os.mkdir(dest)
 
46
    try:
 
47
        os.mkdir(dest)
 
48
    except OSError, e:
 
49
        if e.errno == errno.EEXIST:
 
50
            # check if directory empty
 
51
            if os.listdir(dest) != []:
 
52
                raise errors.BzrError("Can't export tree to non-empty directory.")
 
53
        else:
 
54
            raise
47
55
    for dp, ie in _export_iter_entries(tree, subdir):
48
56
        fullpath = osutils.pathjoin(dest, dp)
49
57
        if ie.kind == "file":