~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge_directive.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-03-14 15:50:44 UTC
  • mfrom: (1551.12.58 mergedirective-fixes)
  • Revision ID: pqm@pqm.ubuntu.com-20070314155044-47c0c6257a6c6717
Fixes for merge directives

Show diffs side-by-side

added added

removed removed

Lines of Context:
98
98
        patch_lines = list(line_iter)
99
99
        if len(patch_lines) == 0:
100
100
            patch = None
 
101
            patch_type = None
101
102
        else:
102
103
            patch = ''.join(patch_lines)
103
 
        try:
104
 
            bundle_serializer.read_bundle(StringIO(patch))
105
 
        except errors.NotABundle:
106
 
            patch_type = 'diff'
107
 
        else:
108
 
            patch_type = 'bundle'
 
104
            try:
 
105
                bundle_serializer.read_bundle(StringIO(patch))
 
106
            except errors.NotABundle:
 
107
                patch_type = 'diff'
 
108
            else:
 
109
                patch_type = 'bundle'
109
110
        time, timezone = timestamp.parse_patch_date(stanza.get('timestamp'))
110
111
        kwargs = {}
111
112
        for key in ('revision_id', 'testament_sha1', 'target_branch',
114
115
                kwargs[key] = stanza.get(key)
115
116
            except KeyError:
116
117
                pass
 
118
        kwargs['revision_id'] = kwargs['revision_id'].encode('utf-8')
117
119
        return MergeDirective(time=time, timezone=timezone,
118
120
                              patch_type=patch_type, patch=patch, **kwargs)
119
121