68
70
from .inventorytree import InventoryRevisionTree, MutableInventoryTree
69
71
from ..sixish import (
72
75
from ..trace import mutter
76
from ..tree import FileTimestampUnavailable
73
77
from ..workingtree import (
400
def get_ignore_list(self):
401
"""Return list of ignore patterns.
403
Cached in the Tree object after the first call.
405
ignoreset = getattr(self, '_ignoreset', None)
406
if ignoreset is not None:
410
ignore_globs.update(ignores.get_runtime_ignores())
411
ignore_globs.update(ignores.get_user_ignores())
412
if self.has_filename(breezy.IGNORE_FILENAME):
413
f = self.get_file_byname(breezy.IGNORE_FILENAME)
415
ignore_globs.update(ignores.parse_ignore_file(f))
418
self._ignoreset = ignore_globs
422
self._flush_ignore_list_cache()
424
def _flush_ignore_list_cache(self):
425
"""Resets the cached ignore list to force a cache rebuild."""
426
self._ignoreset = None
427
self._ignoreglobster = None
429
def is_ignored(self, filename):
430
r"""Check whether the filename matches an ignore pattern.
432
Patterns containing '/' or '\' need to match the whole path;
433
others match against only the last component. Patterns starting
434
with '!' are ignore exceptions. Exceptions take precedence
435
over regular patterns and cause the filename to not be ignored.
437
If the file is ignored, returns the pattern which caused it to
438
be ignored, otherwise None. So this can simply be used as a
439
boolean if desired."""
440
if getattr(self, '_ignoreglobster', None) is None:
441
self._ignoreglobster = globbing.ExceptionGlobster(self.get_ignore_list())
442
return self._ignoreglobster.match(filename)
396
444
def read_basis_inventory(self):
397
445
"""Read the cached basis inventory."""
398
446
path = self._basis_inventory_name()
532
580
return os.lstat(self.abspath(path)).st_mtime
533
581
except OSError as e:
534
582
if e.errno == errno.ENOENT:
535
raise errors.FileTimestampUnavailable(path)
583
raise FileTimestampUnavailable(path)
538
586
def _is_executable_from_path_and_stat_from_basis(self, path, stat_result):
959
1007
if to_dir is None:
960
1008
raise TypeError('You must supply a target directory')
961
1009
# check destination directory
962
if isinstance(from_paths, basestring):
1010
if isinstance(from_paths, (str, text_type)):
963
1011
raise ValueError()
964
1012
to_abs = self.abspath(to_dir)
965
1013
if not osutils.isdir(to_abs):