~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge_directive.py

  • Committer: John Arbash Meinel
  • Date: 2010-02-17 17:11:16 UTC
  • mfrom: (4797.2.17 2.1)
  • mto: (4797.2.18 2.1)
  • mto: This revision was merged to the branch mainline in revision 5055.
  • Revision ID: john@arbash-meinel.com-20100217171116-h7t9223ystbnx5h8
merge bzr.2.1 in preparation for NEWS entry.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007 Canonical Ltd
 
1
# Copyright (C) 2007-2010 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 = ""
374
375
        for line in line_iter:
375
376
            if line.startswith('# Bazaar merge directive format '):
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)
 
377
                return _format_registry.get(line[2:].rstrip())._from_lines(
 
378
                    line_iter)
 
379
            firstline = firstline or line.strip()
 
380
        raise errors.NotAMergeDirective(firstline)
383
381
 
384
382
    @classmethod
385
383
    def _from_lines(klass, line_iter):
582
580
                    revision_id):
583
581
                    raise errors.PublicBranchOutOfDate(public_branch,
584
582
                                                       revision_id)
 
583
            testament_sha1 = t.as_sha1()
585
584
        finally:
586
585
            for entry in reversed(locked):
587
586
                entry.unlock()
588
 
        return klass(revision_id, t.as_sha1(), time, timezone, target_branch,
589
 
            patch, public_branch, message, bundle, base_revision_id)
 
587
        return klass(revision_id, testament_sha1, time, timezone,
 
588
            target_branch, patch, public_branch, message, bundle,
 
589
            base_revision_id)
590
590
 
591
591
    def _verify_patch(self, repository):
592
592
        calculated_patch = self._generate_diff(repository, self.revision_id,