/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to git_repository.py

GitRepository._parse_rev sets Revision.timezone to a float instead of a string.

Show diffs side-by-side

added added

removed removed

Lines of Context:
140
140
                if not committer_was_set:
141
141
                    rev.committer = author
142
142
                    rev.timestamp = float(timestamp)
143
 
                    rev.timezone = timezone
 
143
                    rev.timezone = klass._parse_tz(timezone)
144
144
                continue
145
145
            if name == 'committer':
146
146
                committer_was_set = True
147
147
                committer, timestamp, timezone = value.rsplit(' ', 2)
148
148
                rev.committer = committer
149
149
                rev.timestamp = float(timestamp)
150
 
                rev.timezone = timezone
 
150
                rev.timezone = klass._parse_tz(timezone)
151
151
                continue
152
152
            if name == 'tree':
153
153
                rev.properties['git-tree-id'] = value
156
156
        rev.message = ''.join(message_lines)
157
157
        return rev
158
158
 
 
159
    @classmethod
 
160
    def _parse_tz(klass, tz):
 
161
        """Parse a timezone specification in the [+|-]HHMM format.
 
162
 
 
163
        :return: the timezone offset in seconds.
 
164
        """
 
165
        assert len(tz) == 5
 
166
        sign = {'+': +1, '-': -1}[tz[0]]
 
167
        hours = int(tz[1:3])
 
168
        minutes = int(tz[3:])
 
169
        return float(sign * 60 * (60 * hours + minutes))
 
170
 
159
171
    def revision_trees(self, revids):
160
172
        for revid in revids:
161
173
            yield self.revision_tree(revid)