Show More
@@ -189,25 +189,32 b' def shrink(ui, repo, **opts):' | |||
|
189 | 189 | if os.path.exists(tmpdatafn): |
|
190 | 190 | os.unlink(tmpdatafn) |
|
191 | 191 | raise |
|
192 | # Racy since both files cannot be renamed atomically | |
|
193 | util.os_link(indexfn, oldindexfn) | |
|
194 |
util.os_link( |
|
|
195 | util.rename(tmpindexfn, indexfn) | |
|
196 |
util.rename(tmp |
|
|
192 | if not opts.get('dry_run'): | |
|
193 | # Racy since both files cannot be renamed atomically | |
|
194 | util.os_link(indexfn, oldindexfn) | |
|
195 | util.os_link(datafn, olddatafn) | |
|
196 | util.rename(tmpindexfn, indexfn) | |
|
197 | util.rename(tmpdatafn, datafn) | |
|
198 | else: | |
|
199 | os.unlink(tmpindexfn) | |
|
200 | os.unlink(tmpdatafn) | |
|
197 | 201 | finally: |
|
198 | 202 | lock.release() |
|
199 | 203 | |
|
200 | ui.write('note: old revlog saved in:\n' | |
|
201 | ' %s\n' | |
|
202 | ' %s\n' | |
|
203 | '(You can delete those files when you are satisfied that your\n' | |
|
204 | 'repository is still sane. ' | |
|
205 | 'Running \'hg verify\' is strongly recommended.)\n' | |
|
206 | % (oldindexfn, olddatafn)) | |
|
204 | if not opts.get('dry_run'): | |
|
205 | ui.write('note: old revlog saved in:\n' | |
|
206 | ' %s\n' | |
|
207 | ' %s\n' | |
|
208 | '(You can delete those files when you are satisfied that your\n' | |
|
209 | 'repository is still sane. ' | |
|
210 | 'Running \'hg verify\' is strongly recommended.)\n' | |
|
211 | % (oldindexfn, olddatafn)) | |
|
207 | 212 | |
|
208 | 213 | cmdtable = { |
|
209 | 214 | 'shrink': (shrink, |
|
210 |
[('', 'revlog', '', 'index (.i) file of the revlog to shrink') |
|
|
215 | [('', 'revlog', '', 'index (.i) file of the revlog to shrink'), | |
|
216 | ('n', 'dry-run', None, 'do not shrink, simulate only'), | |
|
217 | ], | |
|
211 | 218 | 'hg shrink [--revlog PATH]') |
|
212 | 219 | } |
|
213 | 220 |
General Comments 0
You need to be logged in to leave comments.
Login now