~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge_directive.py

  • Committer: Matthew Fuller
  • Date: 2009-08-18 08:10:44 UTC
  • mto: (4772.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 4773.
  • Revision ID: fullermd@over-yonder.net-20090818081044-2due6ius01c4pwjl
Fix up some doctests to handle things ending up as RevisionSpec_dwim's
instead of RS_revno, and ending up as _dwim's (which may error
eventually, but won't until we try to evaluate them) instead of
insta-errors.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007-2010 Canonical Ltd
 
1
# Copyright (C) 2007 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
371
371
        :return: a MergeRequest
372
372
        """
373
373
        line_iter = iter(lines)
374
 
        firstline = ""
375
374
        for line in line_iter:
376
375
            if line.startswith('# Bazaar merge directive format '):
377
 
                return _format_registry.get(line[2:].rstrip())._from_lines(
378
 
                    line_iter)
379
 
            firstline = firstline or line.strip()
380
 
        raise errors.NotAMergeDirective(firstline)
 
376
                break
 
377
        else:
 
378
            if len(lines) > 0:
 
379
                raise errors.NotAMergeDirective(lines[0])
 
380
            else:
 
381
                raise errors.NotAMergeDirective('')
 
382
        return _format_registry.get(line[2:].rstrip())._from_lines(line_iter)
381
383
 
382
384
    @classmethod
383
385
    def _from_lines(klass, line_iter):
580
582
                    revision_id):
581
583
                    raise errors.PublicBranchOutOfDate(public_branch,
582
584
                                                       revision_id)
583
 
            testament_sha1 = t.as_sha1()
584
585
        finally:
585
586
            for entry in reversed(locked):
586
587
                entry.unlock()
587
 
        return klass(revision_id, testament_sha1, time, timezone,
588
 
            target_branch, patch, public_branch, message, bundle,
589
 
            base_revision_id)
 
588
        return klass(revision_id, t.as_sha1(), time, timezone, target_branch,
 
589
            patch, public_branch, message, bundle, base_revision_id)
590
590
 
591
591
    def _verify_patch(self, repository):
592
592
        calculated_patch = self._generate_diff(repository, self.revision_id,