commands: lock() the repo while unbundling (
issue1004)
--- 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)