Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.4rc1, 0.4rc2, and 0.4rc3

hggtk/changeset: handle filenames with spaces

Don't try parsing the names out of the diff header, that's a looser's gambit

Changeset 520486340ac5

Parent 67c86a6edbbb

by Steve Borho

Changes to one file · Browse files at 520486340ac5 Showing diff from parent 67c86a6edbbb Diff from another changeset...

 
177
178
179
180
 
181
182
183
 
189
190
191
192
 
193
194
195
 
350
351
352
353
 
354
355
356
 
366
367
368
369
370
 
371
372
373
374
375
376
377
 
378
379
380
 
177
178
179
 
180
181
182
183
 
189
190
191
 
192
193
194
195
 
350
351
352
 
353
354
355
356
 
366
367
368
 
 
369
370
371
372
373
374
375
 
376
377
378
379
@@ -177,7 +177,7 @@
  lines = unicode(txt, 'latin-1', 'replace').splitlines()   eob = buf.get_end_iter()   offset = eob.get_offset() - fileoffs, tags, lines, statmax = self.prepare_diff(lines, offset) + fileoffs, tags, lines, statmax = self.prepare_diff(lines, offset, file)   for l in lines:   buf.insert(eob, l)   @@ -189,7 +189,7 @@
  buf.apply_tag_by_name(name, i0, i1)     # inserts the marks - for f, mark, offset, stats in fileoffs: + for mark, offset, stats in fileoffs:   pos = buf.get_iter_at_offset(offset)   mark = 'mark_%d' % offset   buf.create_mark(mark, pos) @@ -350,7 +350,7 @@
  text = ''   if header or text: yield (s, f, ''.join(header) + text)   - def prepare_diff(self, difflines, offset): + def prepare_diff(self, difflines, offset, fname):   '''Borrowed from hgview; parses changeset diffs'''   DIFFHDR = "=== %s ===\n"   idx = 0 @@ -366,15 +366,14 @@
  statmax = 0   for i,l in enumerate(difflines):   if l.startswith("diff"): - f = l.split()[-1][2:] - txt = DIFFHDR % f + txt = DIFFHDR % fname   addtag( "greybg", offset, len(txt) )   outlines.append(txt)   markname = "file%d" % idx   idx += 1   statmax = max( statmax, stats[0]+stats[1] )   stats = [0,0] - filespos.append(( f, markname, offset, stats )) + filespos.append(( markname, offset, stats ))   offset += len(txt)   continue   elif l.startswith("+++"):