Mercurial > hg
comparison mercurial/commands.py @ 27195:84de71ec5c61
commands: execute checkunfinished and bailifchanged inside wlock scope
Before this patch, "hg import" executes below before acquisition of
wlock:
- cmdutil.checkunfinished()
- cmdutil.bailifchanged()
It may cause unintentional result, if another command runs parallelly
(see also issue4368).
To avoid this issue, this patch executes 'cmdutil.checkunfinished()'
and 'cmdutil.bailifchanged()' inside wlock scope of "hg import".
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Wed, 02 Dec 2015 03:12:08 +0900 |
parents | 77995317b374 |
children | ccae1588117f |
comparison
equal
deleted
inserted
replaced
27194:77995317b374 | 27195:84de71ec5c61 |
---|---|
4555 if opts.get('exact') and opts.get('edit'): | 4555 if opts.get('exact') and opts.get('edit'): |
4556 raise error.Abort(_('cannot use --exact with --edit')) | 4556 raise error.Abort(_('cannot use --exact with --edit')) |
4557 if opts.get('exact') and opts.get('prefix'): | 4557 if opts.get('exact') and opts.get('prefix'): |
4558 raise error.Abort(_('cannot use --exact with --prefix')) | 4558 raise error.Abort(_('cannot use --exact with --prefix')) |
4559 | 4559 |
4560 if update: | |
4561 cmdutil.checkunfinished(repo) | |
4562 if (opts.get('exact') or not opts.get('force')) and update: | |
4563 cmdutil.bailifchanged(repo) | |
4564 | |
4565 base = opts["base"] | 4560 base = opts["base"] |
4566 wlock = dsguard = lock = tr = None | 4561 wlock = dsguard = lock = tr = None |
4567 msgs = [] | 4562 msgs = [] |
4568 ret = 0 | 4563 ret = 0 |
4569 | 4564 |
4570 | 4565 |
4571 try: | 4566 try: |
4572 try: | 4567 try: |
4573 wlock = repo.wlock() | 4568 wlock = repo.wlock() |
4569 | |
4570 if update: | |
4571 cmdutil.checkunfinished(repo) | |
4572 if (opts.get('exact') or not opts.get('force')) and update: | |
4573 cmdutil.bailifchanged(repo) | |
4574 | |
4574 if not opts.get('no_commit'): | 4575 if not opts.get('no_commit'): |
4575 lock = repo.lock() | 4576 lock = repo.lock() |
4576 tr = repo.transaction('import') | 4577 tr = repo.transaction('import') |
4577 else: | 4578 else: |
4578 dsguard = cmdutil.dirstateguard(repo, 'import') | 4579 dsguard = cmdutil.dirstateguard(repo, 'import') |