~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/osutils.py

  • Committer: Robert Collins
  • Date: 2007-04-23 02:29:35 UTC
  • mfrom: (2441 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2442.
  • Revision ID: robertc@robertcollins.net-20070423022935-9hhongamvk6bfdso
Resolve conflicts with bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
145
145
    return umask
146
146
 
147
147
 
 
148
_kind_marker_map = {
 
149
    "file": "",
 
150
    _directory_kind: "/",
 
151
    "symlink": "@",
 
152
    'tree-reference': '+',
 
153
}
 
154
 
 
155
 
148
156
def kind_marker(kind):
149
 
    if kind == 'file':
150
 
        return ''
151
 
    elif kind == _directory_kind:
152
 
        return '/'
153
 
    elif kind == 'symlink':
154
 
        return '@'
155
 
    else:
 
157
    try:
 
158
        return _kind_marker_map[kind]
 
159
    except KeyError:
156
160
        raise errors.BzrError('invalid file kind %r' % kind)
157
161
 
 
162
 
158
163
lexists = getattr(os.path, 'lexists', None)
159
164
if lexists is None:
160
165
    def lexists(f):
161
166
        try:
162
 
            if getattr(os, 'lstat') is not None:
163
 
                os.lstat(f)
164
 
            else:
165
 
                os.stat(f)
 
167
            stat = getattr(os, 'lstat', os.stat)
 
168
            stat(f)
166
169
            return True
167
 
        except OSError,e:
 
170
        except OSError, e:
168
171
            if e.errno == errno.ENOENT:
169
172
                return False;
170
173
            else:
518
521
    for dirname in dir_list:
519
522
        if is_inside(dirname, fname):
520
523
            return True
521
 
    else:
522
 
        return False
 
524
    return False
523
525
 
524
526
 
525
527
def is_inside_or_parent_of_any(dir_list, fname):
527
529
    for dirname in dir_list:
528
530
        if is_inside(dirname, fname) or is_inside(fname, dirname):
529
531
            return True
530
 
    else:
531
 
        return False
 
532
    return False
532
533
 
533
534
 
534
535
def pumpfile(fromfile, tofile):