# HG changeset patch # User Patrick Mezard # Date 2008-02-27 23:07:38 # Node ID d98ef03893e6f6b6b719888f545a065ae6221825 # Parent 36ab165abbe2856ac0893cece1c3a78dcada3325 commands: lock() the repo while unbundling (issue1004) diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2649,13 +2649,19 @@ def unbundle(ui, repo, fname1, *fnames, 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)