~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/mutabletree.py

  • Committer: Aaron Bentley
  • Date: 2010-05-10 11:34:20 UTC
  • mfrom: (5218 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5221.
  • Revision ID: aaron@aaronbentley.com-20100510113420-toh2d5yioobb5uq1
Merged bzr.dev into transform-commit-full.

Show diffs side-by-side

added added

removed removed

Lines of Context:
233
233
            return False
234
234
 
235
235
    @needs_read_lock
236
 
    def warn_if_changed_or_out_of_date(self, strict, opt_name, more_msg):
 
236
    def check_changed_or_out_of_date(self, strict, opt_name,
 
237
                                     more_error, more_warning):
237
238
        """Check the tree for uncommitted changes and branch synchronization.
238
239
 
239
240
        If strict is None and not set in the config files, a warning is issued.
244
245
 
245
246
        :param opt_name: strict option name to search in config file.
246
247
 
247
 
        :param more_msg: Details about how to avoid the warnings.
 
248
        :param more_error: Details about how to avoid the check.
 
249
 
 
250
        :param more_warning: Details about what is happening.
248
251
        """
249
252
        if strict is None:
250
253
            strict = self.branch.get_config().get_user_option_as_bool(opt_name)
251
254
        if strict is not False:
252
 
            err = None
 
255
            err_class = None
253
256
            if (self.has_changes()):
254
 
                err = errors.UncommittedChanges(self, more=more_msg)
 
257
                err_class = errors.UncommittedChanges
255
258
            elif self.last_revision() != self.branch.last_revision():
256
259
                # The tree has lost sync with its branch, there is little
257
260
                # chance that the user is aware of it but he can still force
258
261
                # the action with --no-strict
259
 
                err = errors.OutOfDateTree(self, more=more_msg)
260
 
            if err is not None:
 
262
                err_class = errors.OutOfDateTree
 
263
            if err_class is not None:
261
264
                if strict is None:
 
265
                    err = err_class(self, more=more_warning)
262
266
                    # We don't want to interrupt the user if he expressed no
263
267
                    # preference about strict.
264
268
                    trace.warning('%s', err._format())
265
269
                else:
 
270
                    err = err_class(self, more=more_error)
266
271
                    raise err
267
272
 
268
273
    @needs_read_lock