~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge_directive.py

  • Committer: Aaron Bentley
  • Date: 2008-03-03 16:52:41 UTC
  • mfrom: (3144.3.11 fix-conflict-handling)
  • mto: This revision was merged to the branch mainline in revision 3250.
  • Revision ID: aaron@aaronbentley.com-20080303165241-0k2c7ggs6kr9q6hf
Merge with fix-conflict-handling

Show diffs side-by-side

added added

removed removed

Lines of Context:
136
136
        return klass(revision_id, t.as_sha1(), time, timezone, target_branch,
137
137
            patch, patch_type, public_branch, message)
138
138
 
139
 
    def get_disk_name(self, branch):
140
 
        """Generate a suitable basename for storing this directive on disk
141
 
 
142
 
        :param branch: The Branch this merge directive was generated fro
143
 
        :return: A string
144
 
        """
145
 
        revno, revision_id = branch.last_revision_info()
146
 
        if self.revision_id == revision_id:
147
 
            revno = [revno]
148
 
        else:
149
 
            revno = branch.get_revision_id_to_revno_map().get(self.revision_id,
150
 
                ['merge'])
151
 
        nick = re.sub('(\W+)', '-', branch.nick).strip('-')
152
 
        return '%s-%s' % (nick, '.'.join(str(n) for n in revno))
153
 
 
154
139
    @staticmethod
155
140
    def _generate_diff(repository, revision_id, ancestor_id):
156
141
        tree_1 = repository.revision_tree(ancestor_id)
210
195
                except errors.RevisionNotPresent:
211
196
                    # At least one dependency isn't present.  Try installing
212
197
                    # missing revisions from the submit branch
213
 
                    try:
214
 
                        submit_branch = \
215
 
                            _mod_branch.Branch.open(self.target_branch)
216
 
                    except errors.NotBranchError:
217
 
                        raise errors.TargetNotBranch(self.target_branch)
 
198
                    submit_branch = _mod_branch.Branch.open(self.target_branch)
218
199
                    missing_revisions = []
219
200
                    bundle_revisions = set(r.revision_id for r in
220
201
                                           info.real_revisions)
278
259
        """
279
260
        _BaseMergeDirective.__init__(self, revision_id, testament_sha1, time,
280
261
            timezone, target_branch, patch, source_branch, message)
281
 
        if patch_type not in (None, 'diff', 'bundle'):
282
 
            raise ValueError(patch_type)
 
262
        assert patch_type in (None, 'diff', 'bundle'), patch_type
283
263
        if patch_type != 'bundle' and source_branch is None:
284
264
            raise errors.NoMergeSource()
285
265
        if patch_type is not None and patch is None: