/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: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2020-06-01 21:57:00 UTC
  • mfrom: (7490.39.3 move-launchpad)
  • Revision ID: breezy.the.bot@gmail.com-20200601215700-joxuzo6w172gq74v
Move launchpad hoster support to the launchpad plugin.

Merged from https://code.launchpad.net/~jelmer/brz/move-launchpad/+merge/384931

Show diffs side-by-side

added added

removed removed

Lines of Context:
185
185
 
186
186
        :return: True if a change is found. False otherwise
187
187
        """
188
 
        raise NotImplementedError(self.has_changes)
 
188
        with self.lock_read():
 
189
            # Check pending merges
 
190
            if len(self.get_parent_ids()) > 1:
 
191
                return True
 
192
            if _from_tree is None:
 
193
                _from_tree = self.basis_tree()
 
194
            changes = self.iter_changes(_from_tree)
 
195
            if self.supports_symlinks():
 
196
                # Fast path for has_changes.
 
197
                try:
 
198
                    change = next(changes)
 
199
                    # Exclude root (talk about black magic... --vila 20090629)
 
200
                    if change.parent_id == (None, None):
 
201
                        change = next(changes)
 
202
                    return True
 
203
                except StopIteration:
 
204
                    # No changes
 
205
                    return False
 
206
            else:
 
207
                # Slow path for has_changes.
 
208
                # Handle platforms that do not support symlinks in the
 
209
                # conditional below. This is slower than the try/except
 
210
                # approach below that but we don't have a choice as we
 
211
                # need to be sure that all symlinks are removed from the
 
212
                # entire changeset. This is because in platforms that
 
213
                # do not support symlinks, they show up as None in the
 
214
                # working copy as compared to the repository.
 
215
                # Also, exclude root as mention in the above fast path.
 
216
                changes = filter(
 
217
                    lambda c: c[6][0] != 'symlink' and c[4] != (None, None),
 
218
                    changes)
 
219
                try:
 
220
                    next(iter(changes))
 
221
                except StopIteration:
 
222
                    return False
 
223
                return True
189
224
 
190
225
    def check_changed_or_out_of_date(self, strict, opt_name,
191
226
                                     more_error, more_warning):
208
243
                strict = self.branch.get_config_stack().get(opt_name)
209
244
            if strict is not False:
210
245
                err_class = None
211
 
                if self.has_changes():
 
246
                if (self.has_changes()):
212
247
                    err_class = errors.UncommittedChanges
213
248
                elif self.last_revision() != self.branch.last_revision():
214
249
                    # The tree has lost sync with its branch, there is little
366
401
        """
367
402
        raise NotImplementedError(self.copy_one)
368
403
 
369
 
    def transform(self, pb=None):
 
404
    def get_transform(self, pb=None):
370
405
        """Return a transform object for use with this tree."""
371
 
        raise NotImplementedError(self.transform)
 
406
        raise NotImplementedError(self.get_transform)
372
407
 
373
408
 
374
409
class MutableTreeHooks(hooks.Hooks):