~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/upgrade.py

  • Committer: Martin Pool
  • Date: 2005-07-16 00:07:40 UTC
  • mfrom: (909.1.5)
  • Revision ID: mbp@sourcefrog.net-20050716000740-f2dcb8894a23fd2d
- merge aaron's bugfix branch
  up to abentley@panoramicfeedback.com-20050715134354-78f2bca607acb415

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# along with this program; if not, write to the Free Software
16
16
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
17
 
18
 
import bzrlib.errors
 
18
 
19
19
 
20
20
 
21
21
def upgrade(branch):
71
71
                mutter("  set inventory_sha1 on {%s}" % rev_id)
72
72
 
73
73
            for prr in rev.parents:
74
 
                try:
75
 
                    actual_sha1 = branch.get_revision_sha1(prr.revision_id)
76
 
                except bzrlib.errors.NoSuchRevision:
77
 
                    mutter("parent {%s} of {%s} not present in branch; skipped"
78
 
                           % (prr.revision_id, rev_id))
79
 
                    continue
80
 
                    
81
 
                if actual_sha1 != prr.revision_sha1:
82
 
                    mutter("parent {%s} of {%s} sha1 mismatch: "
83
 
                           "%s vs %s; fixed"
84
 
                           % (prr.revision_id, rev_id,
85
 
                              actual_sha1, prr.revision_sha1))
86
 
                    prr.revision_sha1 = actual_sha1
87
 
                    updated = True
 
74
                actual_sha1 = branch.get_revision_sha1(prr.revision_id)
 
75
                if (updated_previous_revision
 
76
                    or prr.revision_sha1 is None):
 
77
                    if prr.revision_sha1 != actual_sha1:
 
78
                        prr.revision_sha1 = actual_sha1
 
79
                        updated = True
 
80
                elif actual_sha1 != prr.revision_sha1:
 
81
                    raise BzrCheckError("parent {%s} of {%s} sha1 mismatch: "
 
82
                                        "%s vs %s"
 
83
                                        % (prr.revision_id, rev_id,
 
84
                                           actual_sha1, prr.revision_sha1))
88
85
 
89
86
            if updated:
90
87
                updated_previous_revision = True