~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/upgrade.py

  • Committer: aaron.bentley at utoronto
  • Date: 2005-08-27 04:42:41 UTC
  • mfrom: (1092.1.43)
  • mto: (1185.3.4)
  • mto: This revision was merged to the branch mainline in revision 1178.
  • Revision ID: aaron.bentley@utoronto.ca-20050827044241-23d676133b9fc981
Merge of robertc@robertcollins.net-20050826013321-52eee1f1da679ee9

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
import bzrlib.progress
19
20
 
20
21
 
21
22
def upgrade(branch):
34
35
 
35
36
    from bzrlib.trace import mutter
36
37
    from bzrlib.errors import BzrCheckError
37
 
    from bzrlib.progress import ProgressBar
 
38
    import bzrlib.ui
38
39
 
39
40
    branch.lock_write()
40
41
 
 
42
    pb = bzrlib.ui.progress_bar()
 
43
 
41
44
    try:
42
 
        pb = ProgressBar(show_spinner=True)
43
45
        last_rev_id = None
44
46
 
45
47
        history = branch.revision_history()
71
73
                mutter("  set inventory_sha1 on {%s}" % rev_id)
72
74
 
73
75
            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))
 
76
                try:
 
77
                    actual_sha1 = branch.get_revision_sha1(prr.revision_id)
 
78
                except bzrlib.errors.NoSuchRevision:
 
79
                    mutter("parent {%s} of {%s} not present in branch; skipped"
 
80
                           % (prr.revision_id, rev_id))
 
81
                    continue
 
82
                    
 
83
                if actual_sha1 != prr.revision_sha1:
 
84
                    mutter("parent {%s} of {%s} sha1 mismatch: "
 
85
                           "%s vs %s; fixed"
 
86
                           % (prr.revision_id, rev_id,
 
87
                              actual_sha1, prr.revision_sha1))
 
88
                    prr.revision_sha1 = actual_sha1
 
89
                    updated = True
85
90
 
86
91
            if updated:
87
92
                updated_previous_revision = True