~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commands.py

  • Committer: Martin Pool
  • Date: 2008-04-24 07:22:53 UTC
  • mto: This revision was merged to the branch mainline in revision 3415.
  • Revision ID: mbp@sourcefrog.net-20080424072253-opmjij7xfy38w27f
Remove every assert statement from bzrlib!

Depending on the context they are:

 * turned into an explicit if/raise of either AssertionError 
   or something more specific -- particularly where they protect
   programming interfaces, complex invariants, or data file integrity
 * removed, if they're redundant with a later check, not protecting
   a meaningful invariant
 * turned into a selftest method on tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
95
95
 
96
96
 
97
97
def _unsquish_command_name(cmd):
98
 
    assert cmd.startswith("cmd_")
99
98
    return cmd[4:].replace('_','-')
100
99
 
101
100
 
283
282
            elif aname[-1] == '*':
284
283
                aname = '[' + aname[:-1] + '...]'
285
284
            s += aname + ' '
286
 
                
287
 
        assert s[-1] == ' '
288
 
        s = s[:-1]
 
285
        s = s[:-1]      # remove last space
289
286
        return s
290
287
 
291
288
    def get_help_text(self, additional_see_also=None, plain=True,
445
442
 
446
443
    def _setup_outf(self):
447
444
        """Return a file linked to stdout, which has proper encoding."""
448
 
        assert self.encoding_type in ['strict', 'exact', 'replace']
449
 
 
450
445
        # Originally I was using self.stdout, but that looks
451
446
        # *way* too much like sys.stdout
452
447
        if self.encoding_type == 'exact':