commands: graft uses a transaction (issue3628)

Pierre-Yves David pierre-yves.david at ens-lyon.org
Thu Aug 11 12:08:09 EDT 2016



On 08/10/2016 12:39 PM, Alexander Becher wrote:
> Dear all,
>
> I tried this change for issue3628:
>
>
> diff -r db0095c83344 -r 7aa594597cb3 mercurial/commands.py
> --- a/mercurial/commands.py     Mon Jul 18 22:22:38 2016 +0200
> +++ b/mercurial/commands.py     Fri Jul 29 11:02:45 2016 +0200
> @@ -4085,7 +4085,7 @@
>
>      Returns 0 on successful completion.
>      '''
> -    with repo.wlock():
> +    with repo.wlock(), repo.lock(), repo.transaction('graft'):
>          return _dograft(ui, repo, *revs, **opts)
>
>  def _dograft(ui, repo, *revs, **opts):
>
>
> Seemed simple enough. However, this change causes test-graft.t to fail,
> see below. I don't see why, it's not the first test for graft
> --continue. Can anyone see the reason?

This won't do. If you do this, the failure of one graft will rollback 
all the previous (successful one). We need much more advance transaction 
mechanisme to solve this issue. (sorry)

> Also, do I need both repo.wlock() and repo.lock()? Without repo.lock(),
> repo.transaction('graft') raises a RuntimeError('programming error:
> transaction requires locking').

Then you probably needs the repo.lock ;-)

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list