Mercurial > hg
changeset 10234:c8d6f339bbd7
shrink-revlog: make it work on windows (issue1976)
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Mon, 11 Jan 2010 21:15:53 +0100 |
parents | 69e07d234cc6 |
children | 318d58fe4ceb |
files | contrib/shrink-revlog.py |
diffstat | 1 files changed, 6 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/shrink-revlog.py Mon Jan 11 22:41:49 2010 +0100 +++ b/contrib/shrink-revlog.py Mon Jan 11 21:15:53 2010 +0100 @@ -169,7 +169,7 @@ # absolute. Doing it this way keeps things simple: everything is an # absolute path. lock = repo.lock(wait=False) - tr = transaction.transaction(sys.stderr.write, + tr = transaction.transaction(ui.warn, open, repo.sjoin('journal')) @@ -188,13 +188,14 @@ if os.path.exists(tmpdatafn): os.unlink(tmpdatafn) raise + # Racy since both files cannot be renamed atomically + util.os_link(indexfn, oldindexfn) + util.os_link(datafn, olddatafn) + util.rename(tmpindexfn, indexfn) + util.rename(tmpdatafn, datafn) finally: lock.release() - os.link(indexfn, oldindexfn) - os.link(datafn, olddatafn) - os.rename(tmpindexfn, indexfn) - os.rename(tmpdatafn, datafn) ui.write('note: old revlog saved in:\n' ' %s\n' ' %s\n'