~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to weave.py

  • Committer: Martin Pool
  • Date: 2005-06-28 13:55:37 UTC
  • mto: This revision was merged to the branch mainline in revision 852.
  • Revision ID: mbp@sourcefrog.net-20050628135537-c0c108af5964d508
Handle deletion of lines by marking the region with a deletion

Test deletions

Show diffs side-by-side

added added

removed removed

Lines of Context:
149
149
                assert 0 <= i1
150
150
                assert i1 <= i2
151
151
                assert i2 <= len(self._l)
152
 
                
 
152
 
 
153
                # the deletion and insertion are handled separately.
 
154
                # first delete the region.
153
155
                if i1 != i2:
154
 
                    raise NotImplementedError("can't handle replacing weave [%d:%d] yet"
155
 
                                              % (i1, i2))
 
156
                    self._l.insert(i1+offset, ('[', idx))
 
157
                    self._l.insert(i2+offset+1, (']', idx))
 
158
                    offset += 2
 
159
                    # is this OK???
156
160
 
157
 
                i = i1 + offset
158
 
                self._l[i:i] = [('{', idx)] \
159
 
                               + newlines \
160
 
                               + [('}', idx)]
161
 
                offset += 2 + len(newlines)
 
161
                if newlines:
 
162
                    i = i1 + offset
 
163
                    self._l[i:i] = [('{', idx)] \
 
164
                                   + newlines \
 
165
                                   + [('}', idx)]
 
166
                    offset += 2 + len(newlines)
162
167
 
163
168
            self._v.append(VerInfo(parents))
164
169
        else: