/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to diff.py

  • Committer: Toshio Kuratomi
  • Date: 2010-04-13 15:06:17 UTC
  • mto: This revision was merged to the branch mainline in revision 693.
  • Revision ID: toshio@fedoraproject.org-20100413150617-e37qx1qgdewh0n8o
Fix bzr-handle-patch to process patches with leading and trailing comments with
newer bzrlib.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
import os
18
18
import re
19
19
import sys
 
20
import inspect
20
21
try:
21
22
    from xml.etree.ElementTree import Element, SubElement, tostring
22
23
except ImportError:
524
525
 
525
526
class DiffController(object):
526
527
 
527
 
    def __init__(self, path, patch, window=None):
 
528
    def __init__(self, path, patch, window=None, allow_dirty=False):
528
529
        self.path = path
529
530
        self.patch = patch
 
531
        self.allow_dirty = allow_dirty
530
532
        if window is None:
531
533
            window = DiffWindow(operations=self._provide_operations())
532
534
            self.initialize_window(window)
538
540
 
539
541
    def get_diff_sections(self):
540
542
        yield "Complete Diff", None, ''.join(self.patch)
541
 
        for patch in parse_patches(self.patch):
 
543
        # allow_dirty was added to parse_patches in bzrlib 2.2b1
 
544
        if 'allow_dirty' in inspect.getargspec(parse_patches).args:
 
545
            patches = parse_patches(self.patch, allow_dirty=self.allow_dirty)
 
546
        else:
 
547
            patches = parse_patches(self.patch)
 
548
        for patch in patches:
542
549
            oldname = patch.oldname.split('\t')[0]
543
550
            newname = patch.newname.split('\t')[0]
544
551
            yield oldname, newname, str(patch)