~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/mutabletree.py

  • Committer: Robert Collins
  • Date: 2010-02-27 12:27:33 UTC
  • mto: This revision was merged to the branch mainline in revision 5061.
  • Revision ID: robertc@robertcollins.net-20100227122733-2o3me3fkk3pk36ns
``bzrlib.branchbuilder.BranchBuilder.build_snapshot`` now accepts a
``message_callback`` in the same way that commit does. (Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 Canonical Ltd
 
1
# Copyright (C) 2006, 2007 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
258
258
            return False
259
259
 
260
260
    @needs_read_lock
261
 
    def check_changed_or_out_of_date(self, strict, opt_name,
262
 
                                     more_error, more_warning):
263
 
        """Check the tree for uncommitted changes and branch synchronization.
264
 
 
265
 
        If strict is None and not set in the config files, a warning is issued.
266
 
        If strict is True, an error is raised.
267
 
        If strict is False, no checks are done and no warning is issued.
268
 
 
269
 
        :param strict: True, False or None, searched in branch config if None.
270
 
 
271
 
        :param opt_name: strict option name to search in config file.
272
 
 
273
 
        :param more_error: Details about how to avoid the check.
274
 
 
275
 
        :param more_warning: Details about what is happening.
276
 
        """
277
 
        if strict is None:
278
 
            strict = self.branch.get_config().get_user_option_as_bool(opt_name)
279
 
        if strict is not False:
280
 
            err_class = None
281
 
            if (self.has_changes()):
282
 
                err_class = errors.UncommittedChanges
283
 
            elif self.last_revision() != self.branch.last_revision():
284
 
                # The tree has lost sync with its branch, there is little
285
 
                # chance that the user is aware of it but he can still force
286
 
                # the action with --no-strict
287
 
                err_class = errors.OutOfDateTree
288
 
            if err_class is not None:
289
 
                if strict is None:
290
 
                    err = err_class(self, more=more_warning)
291
 
                    # We don't want to interrupt the user if he expressed no
292
 
                    # preference about strict.
293
 
                    trace.warning('%s', err._format())
294
 
                else:
295
 
                    err = err_class(self, more=more_error)
296
 
                    raise err
297
 
 
298
 
    @needs_read_lock
299
261
    def last_revision(self):
300
262
        """Return the revision id of the last commit performed in this tree.
301
263