Show More
@@ -169,7 +169,7 b' def shrink(ui, repo, **opts):' | |||||
169 | # absolute. Doing it this way keeps things simple: everything is an |
|
169 | # absolute. Doing it this way keeps things simple: everything is an | |
170 | # absolute path. |
|
170 | # absolute path. | |
171 | lock = repo.lock(wait=False) |
|
171 | lock = repo.lock(wait=False) | |
172 |
tr = transaction.transaction( |
|
172 | tr = transaction.transaction(ui.warn, | |
173 | open, |
|
173 | open, | |
174 | repo.sjoin('journal')) |
|
174 | repo.sjoin('journal')) | |
175 |
|
175 | |||
@@ -188,13 +188,14 b' def shrink(ui, repo, **opts):' | |||||
188 | if os.path.exists(tmpdatafn): |
|
188 | if os.path.exists(tmpdatafn): | |
189 | os.unlink(tmpdatafn) |
|
189 | os.unlink(tmpdatafn) | |
190 | raise |
|
190 | raise | |
|
191 | # Racy since both files cannot be renamed atomically | |||
|
192 | util.os_link(indexfn, oldindexfn) | |||
|
193 | util.os_link(datafn, olddatafn) | |||
|
194 | util.rename(tmpindexfn, indexfn) | |||
|
195 | util.rename(tmpdatafn, datafn) | |||
191 | finally: |
|
196 | finally: | |
192 | lock.release() |
|
197 | lock.release() | |
193 |
|
198 | |||
194 | os.link(indexfn, oldindexfn) |
|
|||
195 | os.link(datafn, olddatafn) |
|
|||
196 | os.rename(tmpindexfn, indexfn) |
|
|||
197 | os.rename(tmpdatafn, datafn) |
|
|||
198 | ui.write('note: old revlog saved in:\n' |
|
199 | ui.write('note: old revlog saved in:\n' | |
199 | ' %s\n' |
|
200 | ' %s\n' | |
200 | ' %s\n' |
|
201 | ' %s\n' |
General Comments 0
You need to be logged in to leave comments.
Login now