/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/mutabletree.py

  • Committer: Gustav Hartvigsson
  • Date: 2021-01-09 21:36:27 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20210109213627-h1xwcutzy9m7a99b
Added 'Case Preserving Working Tree Use Cases' from Canonical Wiki

* Addod a page from the Canonical Bazaar wiki
  with information on the scmeatics of case
  perserving filesystems an a case insensitive
  filesystem works.
  
  * Needs re-work, but this will do as it is the
    same inforamoton as what was on the linked
    page in the currint documentation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
See MutableTree for more details.
20
20
"""
21
21
 
22
 
from __future__ import absolute_import
23
 
 
24
22
from . import (
25
23
    errors,
26
24
    hooks,
29
27
    tree,
30
28
    )
31
29
 
32
 
from .sixish import (
33
 
    text_type,
34
 
    )
35
30
 
36
31
 
37
32
class BadReferenceTarget(errors.InternalBzrError):
101
96
 
102
97
        TODO: Perhaps callback with the ids and paths as they're added.
103
98
        """
104
 
        if isinstance(files, (str, text_type)):
 
99
        if isinstance(files, str):
105
100
            # XXX: Passing a single string is inconsistent and should be
106
101
            # deprecated.
107
102
            if not (ids is None or isinstance(ids, bytes)):
108
103
                raise AssertionError()
109
 
            if not (kinds is None or isinstance(kinds, (str, text_type))):
 
104
            if not (kinds is None or isinstance(kinds, str)):
110
105
                raise AssertionError()
111
106
            files = [files]
112
107
            if ids is not None:
190
185
 
191
186
        :return: True if a change is found. False otherwise
192
187
        """
193
 
        with self.lock_read():
194
 
            # Check pending merges
195
 
            if len(self.get_parent_ids()) > 1:
196
 
                return True
197
 
            if _from_tree is None:
198
 
                _from_tree = self.basis_tree()
199
 
            changes = self.iter_changes(_from_tree)
200
 
            if self.supports_symlinks():
201
 
                # Fast path for has_changes.
202
 
                try:
203
 
                    change = next(changes)
204
 
                    # Exclude root (talk about black magic... --vila 20090629)
205
 
                    if change.parent_id == (None, None):
206
 
                        change = next(changes)
207
 
                    return True
208
 
                except StopIteration:
209
 
                    # No changes
210
 
                    return False
211
 
            else:
212
 
                # Slow path for has_changes.
213
 
                # Handle platforms that do not support symlinks in the
214
 
                # conditional below. This is slower than the try/except
215
 
                # approach below that but we don't have a choice as we
216
 
                # need to be sure that all symlinks are removed from the
217
 
                # entire changeset. This is because in platforms that
218
 
                # do not support symlinks, they show up as None in the
219
 
                # working copy as compared to the repository.
220
 
                # Also, exclude root as mention in the above fast path.
221
 
                changes = filter(
222
 
                    lambda c: c[6][0] != 'symlink' and c[4] != (None, None),
223
 
                    changes)
224
 
                try:
225
 
                    next(iter(changes))
226
 
                except StopIteration:
227
 
                    return False
228
 
                return True
 
188
        raise NotImplementedError(self.has_changes)
229
189
 
230
190
    def check_changed_or_out_of_date(self, strict, opt_name,
231
191
                                     more_error, more_warning):
248
208
                strict = self.branch.get_config_stack().get(opt_name)
249
209
            if strict is not False:
250
210
                err_class = None
251
 
                if (self.has_changes()):
 
211
                if self.has_changes():
252
212
                    err_class = errors.UncommittedChanges
253
213
                elif self.last_revision() != self.branch.last_revision():
254
214
                    # The tree has lost sync with its branch, there is little
406
366
        """
407
367
        raise NotImplementedError(self.copy_one)
408
368
 
409
 
    def get_transform(self, pb=None):
 
369
    def transform(self, pb=None):
410
370
        """Return a transform object for use with this tree."""
411
 
        raise NotImplementedError(self.get_transform)
 
371
        raise NotImplementedError(self.transform)
412
372
 
413
373
 
414
374
class MutableTreeHooks(hooks.Hooks):