~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge_directive.py

  • Committer: Aaron Bentley
  • Date: 2007-03-06 16:02:59 UTC
  • mto: (2323.6.9 0.15-integration)
  • mto: This revision was merged to the branch mainline in revision 2330.
  • Revision ID: abentley@panoramicfeedback.com-20070306160259-dunx5d9kztvjdl3q
Use patch-style dates for timestamps in merge directives

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
    revision as _mod_revision,
10
10
    rio,
11
11
    testament,
 
12
    timestamp,
12
13
    )
13
14
from bzrlib.bundle import serializer as bundle_serializer
14
15
 
20
21
    def __init__(self, revision_id, testament_sha1, time, timezone,
21
22
                 target_branch, patch=None, patch_type=None,
22
23
                 source_branch=None, message=None):
23
 
        assert isinstance(time, float)
24
24
        assert patch_type in (None, 'diff', 'bundle')
25
25
        if patch_type != 'bundle' and source_branch is None:
26
26
            raise errors.NoMergeSource()
52
52
            patch_type = 'diff'
53
53
        else:
54
54
            patch_type = 'bundle'
55
 
        time, timezone = bundle_serializer.unpack_highres_date(
56
 
            stanza.get('timestamp'))
 
55
        time, timezone = timestamp.parse_patch_date(stanza.get('timestamp'))
57
56
        kwargs = {}
58
57
        for key in ('revision_id', 'testament_sha1', 'target_branch',
59
58
                    'source_branch', 'message'):
65
64
                              patch_type=patch_type, patch=patch, **kwargs)
66
65
 
67
66
    def to_lines(self):
68
 
        timestamp = bundle_serializer.format_highres_date(self.time,
69
 
                                                          self.timezone)
70
 
        stanza = rio.Stanza(revision_id=self.revision_id, timestamp=timestamp,
 
67
        time_str = timestamp.format_patch_date(self.time, self.timezone)
 
68
        stanza = rio.Stanza(revision_id=self.revision_id, timestamp=time_str,
71
69
                            target_branch=self.target_branch,
72
70
                            testament_sha1=self.testament_sha1)
73
71
        for key in ('source_branch', 'message'):