Mercurial > hg-stable
changeset 6180:d98ef03893e6
commands: lock() the repo while unbundling (issue1004)
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Thu, 28 Feb 2008 00:07:38 +0100 |
parents | 36ab165abbe2 |
children | d500aeb8092e |
files | mercurial/commands.py |
diffstat | 1 files changed, 13 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Thu Feb 28 00:07:37 2008 +0100 +++ b/mercurial/commands.py Thu Feb 28 00:07:38 2008 +0100 @@ -2649,13 +2649,19 @@ bundle command. """ fnames = (fname1,) + fnames - for fname in fnames: - if os.path.exists(fname): - f = open(fname, "rb") - else: - f = urllib.urlopen(fname) - gen = changegroup.readbundle(f, fname) - modheads = repo.addchangegroup(gen, 'unbundle', 'bundle:' + fname) + + lock = None + try: + lock = repo.lock() + for fname in fnames: + if os.path.exists(fname): + f = open(fname, "rb") + else: + f = urllib.urlopen(fname) + gen = changegroup.readbundle(f, fname) + modheads = repo.addchangegroup(gen, 'unbundle', 'bundle:' + fname) + finally: + del lock return postincoming(ui, repo, modheads, opts['update'], None)