~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/mutabletree.py

  • Committer: Vincent Ladeuil
  • Date: 2010-04-28 10:33:44 UTC
  • mfrom: (5171.2.3 401599-strict-warnings)
  • mto: This revision was merged to the branch mainline in revision 5191.
  • Revision ID: v.ladeuil+lp@free.fr-20100428103344-e32qf3cn1avdd2cb
Don't mention --no-strict when we just issue the warning about unclean trees

Show diffs side-by-side

added added

removed removed

Lines of Context:
258
258
            return False
259
259
 
260
260
    @needs_read_lock
261
 
    def warn_if_changed_or_out_of_date(self, strict, opt_name, more_msg):
 
261
    def check_changed_or_out_of_date(self, strict, opt_name,
 
262
                                     more_error, more_warning):
262
263
        """Check the tree for uncommitted changes and branch synchronization.
263
264
 
264
265
        If strict is None and not set in the config files, a warning is issued.
269
270
 
270
271
        :param opt_name: strict option name to search in config file.
271
272
 
272
 
        :param more_msg: Details about how to avoid the warnings.
 
273
        :param more_error: Details about how to avoid the check.
 
274
 
 
275
        :param more_warning: Details about what is happening.
273
276
        """
274
277
        if strict is None:
275
278
            strict = self.branch.get_config().get_user_option_as_bool(opt_name)
276
279
        if strict is not False:
277
 
            err = None
 
280
            err_class = None
278
281
            if (self.has_changes()):
279
 
                err = errors.UncommittedChanges(self, more=more_msg)
 
282
                err_class = errors.UncommittedChanges
280
283
            elif self.last_revision() != self.branch.last_revision():
281
284
                # The tree has lost sync with its branch, there is little
282
285
                # chance that the user is aware of it but he can still force
283
286
                # the action with --no-strict
284
 
                err = errors.OutOfDateTree(self, more=more_msg)
285
 
            if err is not None:
 
287
                err_class = errors.OutOfDateTree
 
288
            if err_class is not None:
286
289
                if strict is None:
 
290
                    err = err_class(self, more=more_warning)
287
291
                    # We don't want to interrupt the user if he expressed no
288
292
                    # preference about strict.
289
293
                    trace.warning('%s', err._format())
290
294
                else:
 
295
                    err = err_class(self, more=more_error)
291
296
                    raise err
292
297
 
293
298
    @needs_read_lock