~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzr-man.py

Merge in format-5 work - release bzr 0.1rc1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
91
91
 
92
92
    def parse_line(self, line):
93
93
        m = self.usage_exp.match(line)
 
94
        if line == '':
 
95
                return
94
96
        if m:
95
97
            if self.state == 0:
96
98
                if self.usage:
97
99
                    self.command_usage.append((self.command,self.usage,self.descr))
98
100
                    self.all_commands.append(self.command)
99
 
                self.usage = line
 
101
                self.usage = " ".join(line.split(" ")[1:])
100
102
                self.command = m.groups()[0]
101
103
            else:
102
 
                raise Error, "matching usage line in state %d" % state
 
104
                raise RuntimeError, "matching usage line in state %d" % state
103
105
            self.state = 1
104
106
            return
105
107
        m = self.descr_exp.match(line)
107
109
            if self.state == 1:
108
110
                self.descr = m.groups()[0]
109
111
            else:
110
 
                raise Error, "matching descr line in state %d" % state
 
112
                raise RuntimeError, "matching descr line in state %d" % state
111
113
            self.state = 0
112
114
            return
113
 
        raise Error, "Cannot parse this line"
 
115
        raise RuntimeError, "Cannot parse this line ('%s')." % line
114
116
 
115
117
    def end_parse(self):
116
118
        if self.state == 0:
118
120
                self.command_usage.append((self.command,self.usage,self.descr))
119
121
                self.all_commands.append(self.command)
120
122
        else:
121
 
            raise Error, "ending parse in state %d" % state
 
123
            raise RuntimeError, "ending parse in state %d" % state
122
124
 
123
125
    def write_to_manpage(self, outfile):
124
126
        bzrcmd = self.params["bzrcmd"]