~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge_directive.py

  • Committer: Aaron Bentley
  • Date: 2007-02-28 22:58:45 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-20070228225845-01l214kd4xeb681q
Add timestamps to merge directives

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
 
10
10
class MergeDirective(object):
11
11
 
12
 
    def __init__(self, revision, testament_sha1, submit_location, patch=None,
13
 
                 patch_type=None, public_location=None):
 
12
    def __init__(self, revision, testament_sha1, time, timezone,
 
13
                 submit_location, patch=None, patch_type=None,
 
14
                 public_location=None):
14
15
        assert patch_type in (None, 'diff', 'bundle')
15
16
        if patch_type != 'bundle' and public_location is None:
16
17
            raise errors.NoMergeSource()
18
19
            raise errors.PatchMissing(patch_type)
19
20
        self.revision = revision
20
21
        self.testament_sha1 = testament_sha1
 
22
        self.time = time
 
23
        self.timezone = timezone
21
24
        self.submit_location = submit_location
22
25
        self.patch = patch
23
26
        self.patch_type = patch_type
38
41
            patch_type = 'diff'
39
42
        else:
40
43
            patch_type = 'bundle'
 
44
        time, timezone = bundle_serializer.unpack_highres_date(
 
45
            stanza.get('timestamp'))
41
46
        kwargs = {}
42
47
        for key in ('revision', 'testament_sha1', 'submit_location',
43
48
                    'public_location'):
45
50
                kwargs[key] = stanza.get(key)
46
51
            except KeyError:
47
52
                pass
48
 
        return MergeDirective(patch_type=patch_type, patch=patch, **kwargs)
 
53
        return MergeDirective(time=time, timezone=timezone,
 
54
                              patch_type=patch_type, patch=patch, **kwargs)
49
55
 
50
56
    def to_lines(self):
51
 
        stanza = rio.Stanza(revision=self.revision,
 
57
        timestamp = bundle_serializer.format_highres_date(self.time,
 
58
                                                          self.timezone)
 
59
        stanza = rio.Stanza(revision=self.revision, timestamp=timestamp,
52
60
                            submit_location=self.submit_location,
53
61
                            testament_sha1=self.testament_sha1)
54
62
        for key in ('public_location',):