Show More
@@ -189,14 +189,19 b' def shrink(ui, repo, **opts):' | |||||
189 | if os.path.exists(tmpdatafn): |
|
189 | if os.path.exists(tmpdatafn): | |
190 | os.unlink(tmpdatafn) |
|
190 | os.unlink(tmpdatafn) | |
191 | raise |
|
191 | raise | |
|
192 | if not opts.get('dry_run'): | |||
192 | # Racy since both files cannot be renamed atomically |
|
193 | # Racy since both files cannot be renamed atomically | |
193 | util.os_link(indexfn, oldindexfn) |
|
194 | util.os_link(indexfn, oldindexfn) | |
194 | util.os_link(datafn, olddatafn) |
|
195 | util.os_link(datafn, olddatafn) | |
195 | util.rename(tmpindexfn, indexfn) |
|
196 | util.rename(tmpindexfn, indexfn) | |
196 | util.rename(tmpdatafn, datafn) |
|
197 | util.rename(tmpdatafn, datafn) | |
|
198 | else: | |||
|
199 | os.unlink(tmpindexfn) | |||
|
200 | os.unlink(tmpdatafn) | |||
197 | finally: |
|
201 | finally: | |
198 | lock.release() |
|
202 | lock.release() | |
199 |
|
203 | |||
|
204 | if not opts.get('dry_run'): | |||
200 | ui.write('note: old revlog saved in:\n' |
|
205 | ui.write('note: old revlog saved in:\n' | |
201 | ' %s\n' |
|
206 | ' %s\n' | |
202 | ' %s\n' |
|
207 | ' %s\n' | |
@@ -207,7 +212,9 b' def shrink(ui, repo, **opts):' | |||||
207 |
|
212 | |||
208 | cmdtable = { |
|
213 | cmdtable = { | |
209 | 'shrink': (shrink, |
|
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 | 'hg shrink [--revlog PATH]') |
|
218 | 'hg shrink [--revlog PATH]') | |
212 | } |
|
219 | } | |
213 |
|
220 |
General Comments 0
You need to be logged in to leave comments.
Login now