~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge.py

  • Committer: Andrew Bennetts
  • Date: 2010-01-15 05:30:30 UTC
  • mto: (4973.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 4975.
  • Revision ID: andrew.bennetts@canonical.com-20100115053030-1d6qd89pnj8hmb55
Pass kinds (not pairs) to MergeHookParams.

Show diffs side-by-side

added added

removed removed

Lines of Context:
76
76
    :ivar merger: the Merger object
77
77
    :ivar file_id: the file ID of the file being merged
78
78
    :ivar trans_id: the transform ID for the merge of this file.
79
 
 
80
 
    The lines of versions of the file being merged can be retrieved from the
81
 
    merger, e.g.::
82
 
 
83
 
        params.merger.get_lines(params.merger.this_tree, params.file_id)
 
79
    :ivar this_kind: kind of file_id in 'this' tree
 
80
    :ivar other_kind: kind of file_id in 'other' tree
84
81
    """
85
82
 
86
 
    def __init__(self, merger, file_id, trans_id, this_pair, other_pair,
 
83
    def __init__(self, merger, file_id, trans_id, this_kind, other_kind,
87
84
            winner):
88
85
        self.merger = merger
89
86
        self.file_id = file_id
90
87
        self.trans_id = trans_id
91
 
        self.this_pair = this_pair
92
 
        self.other_pair = other_pair
 
88
        self.this_kind = this_kind
 
89
        self.other_kind = other_kind
93
90
        self.winner = winner
94
91
        
95
92
    def is_file_merge(self):
96
 
        return self.this_pair[0] == 'file' and self.other_pair[0] == 'file'
 
93
        """True if this_kind and other_kind are both 'file'."""
 
94
        return self.this_kind == 'file' and self.other_kind == 'file'
97
95
    
98
96
    @decorators.cachedproperty
99
97
    def base_lines(self):
1195
1193
        # We have a hypothetical conflict, but if we have files, then we
1196
1194
        # can try to merge the content
1197
1195
        trans_id = self.tt.trans_id_file_id(file_id)
1198
 
        params = MergeHookParams(self, file_id, trans_id, this_pair,
1199
 
            other_pair, winner)
 
1196
        params = MergeHookParams(self, file_id, trans_id, this_pair[0],
 
1197
            other_pair[0], winner)
1200
1198
        hooks = Merger.hooks['merge_file_content']
1201
1199
        hooks = list(hooks) + [self.default_text_merge]
1202
1200
        hook_status = 'not_applicable'