~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/upgrade.py

  • Committer: Robert Collins
  • Date: 2005-09-23 09:25:16 UTC
  • mto: (1092.3.4)
  • mto: This revision was merged to the branch mainline in revision 1390.
  • Revision ID: robertc@robertcollins.net-20050923092516-e2c3c0f31288669d
Merge what applied of Alexander Belchenko's win32 patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
106
106
                tmpfd, tmp_path = tempfile.mkstemp(prefix=rev_id, suffix='.gz',
107
107
                    dir=branch.controlfilename('revision-store'))
108
108
                os.close(tmpfd)
109
 
                def special_rename(p1, p2):
110
 
                    if sys.platform == 'win32':
111
 
                        try:
112
 
                            os.remove(p2)
113
 
                        except OSError, e:
114
 
                            if e.errno != errno.ENOENT:
115
 
                                raise
116
 
                    os.rename(p1, p2)
117
109
 
118
110
                try:
119
111
                    # TODO: We may need to handle the case where the old revision
121
113
 
122
114
                    # Remove the old revision entry out of the way
123
115
                    rev_path = branch.controlfilename(['revision-store', rev_id+'.gz'])
124
 
                    special_rename(rev_path, tmp_path)
 
116
                    rename(rev_path, tmp_path)
125
117
                    branch.revision_store.add(rev_tmp, rev_id) # Add the new one
126
118
                    os.remove(tmp_path) # Remove the old name
127
119
                    mutter('    Updated revision entry {%s}' % rev_id)
128
120
                except:
129
121
                    # On any exception, restore the old entry
130
 
                    special_rename(tmp_path, rev_path)
 
122
                    rename(tmp_path, rev_path)
131
123
                    raise
132
124
                rev_tmp.close()
133
125
                updated_revisions.append(rev_id)