/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
 
            try:
201
 
                change = next(changes)
202
 
                # Exclude root (talk about black magic... --vila 20090629)
203
 
                if change[4] == (None, None):
204
 
                    change = next(changes)
205
 
                return True
206
 
            except StopIteration:
207
 
                # No changes
208
 
                return False
 
188
        raise NotImplementedError(self.has_changes)
209
189
 
210
190
    def check_changed_or_out_of_date(self, strict, opt_name,
211
191
                                     more_error, more_warning):
228
208
                strict = self.branch.get_config_stack().get(opt_name)
229
209
            if strict is not False:
230
210
                err_class = None
231
 
                if (self.has_changes()):
 
211
                if self.has_changes():
232
212
                    err_class = errors.UncommittedChanges
233
213
                elif self.last_revision() != self.branch.last_revision():
234
214
                    # The tree has lost sync with its branch, there is little
304
284
        :return: None
305
285
        """
306
286
 
307
 
    def put_file_bytes_non_atomic(self, path, bytes, file_id=None):
 
287
    def put_file_bytes_non_atomic(self, path, bytes):
308
288
        """Update the content of a file in the tree.
309
289
 
310
290
        Note that the file is written in-place rather than being
386
366
        """
387
367
        raise NotImplementedError(self.copy_one)
388
368
 
 
369
    def transform(self, pb=None):
 
370
        """Return a transform object for use with this tree."""
 
371
        raise NotImplementedError(self.transform)
 
372
 
389
373
 
390
374
class MutableTreeHooks(hooks.Hooks):
391
375
    """A dictionary mapping a hook name to a list of callables for mutabletree