~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/upgrade.py

  • Committer: Robert Collins
  • Date: 2005-08-23 06:52:09 UTC
  • mto: (974.1.50) (1185.1.10) (1092.3.1)
  • mto: This revision was merged to the branch mainline in revision 1139.
  • Revision ID: robertc@robertcollins.net-20050823065209-81cd5962c401751b
move io redirection into each test case from the global runner

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
 
 
 
18
import bzrlib.errors
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
 
                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))
 
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
85
88
 
86
89
            if updated:
87
90
                updated_previous_revision = True