~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/changeset/read_changeset.py

  • Committer: Aaron Bentley
  • Date: 2006-05-19 20:37:09 UTC
  • mto: This revision was merged to the branch mainline in revision 1738.
  • Revision ID: abentley@panoramicfeedback.com-20060519203709-04f80427ff5c00f5
Got first binary test passing

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
Read in a changeset output, and process it into a Changeset object.
4
4
"""
5
5
 
 
6
import base64
6
7
from cStringIO import StringIO
7
8
import os
8
9
import pprint
482
483
        #mutter('_read_one_patch: %r' % self._next_line)
483
484
        # Peek and see if there are no patches
484
485
        if self._next_line is None or self._next_line.startswith('#'):
 
486
            print "ret1"
485
487
            return None, [], False
486
488
 
487
489
        first = True
546
548
 
547
549
        def extra_info(info, new_path):
548
550
            last_changed = None
 
551
            encoding = None
549
552
            for info_item in info:
550
553
                name, value = info_item.split(':', 1)
551
554
                if name == 'last-changed':
556
559
                    cset_tree.note_executable(new_path, val)
557
560
                elif name == 'target':
558
561
                    cset_tree.note_target(new_path, value)
559
 
            return last_changed
 
562
                elif name == 'encoding':
 
563
                    encoding = value
 
564
            return last_changed, encoding
560
565
 
561
566
        def renamed(kind, extra, lines):
562
567
            info = extra.split(' // ')
570
575
                new_path = info[1]
571
576
 
572
577
            cset_tree.note_rename(old_path, new_path)
573
 
            last_modified = extra_info(info[2:], new_path)
 
578
            last_modified, encoding = extra_info(info[2:], new_path)
574
579
            revision = get_rev_id(last_modified, new_path, kind)
575
580
            if lines:
576
581
                cset_tree.note_patch(new_path, ''.join(lines))
600
605
            file_id = info[1][8:]
601
606
 
602
607
            cset_tree.note_id(file_id, path, kind)
603
 
            last_changed = extra_info(info[2:], path)
 
608
            last_changed, encoding = extra_info(info[2:], path)
604
609
            revision = get_rev_id(last_changed, path, kind)
605
610
            if kind == 'directory':
606
611
                return
607
 
            cset_tree.note_patch(path, ''.join(lines))
 
612
            if encoding is not None:
 
613
                assert encoding == 'base64'
 
614
                patch = base64.decodestring(''.join(lines))
 
615
            else:
 
616
                patch =  ''.join(lines)
 
617
 
 
618
            cset_tree.note_patch(path, patch)
608
619
 
609
620
        def modified(kind, extra, lines):
610
621
            info = extra.split(' // ')
613
624
                        'the path in them: %r' % extra)
614
625
            path = info[0]
615
626
 
616
 
            last_modified = extra_info(info[1:], path)
 
627
            last_modified, encoding = extra_info(info[1:], path)
617
628
            revision = get_rev_id(last_modified, path, kind)
618
629
            if lines:
619
630
                cset_tree.note_patch(path, ''.join(lines))