D3718: narrow: mark the critical chunks of narrowing/widening as unsafe

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Wed Jun 13 13:03:20 EDT 2018


martinvonz added inline comments.

INLINE COMMENTS

> narrowcommands.py:248
> +                    repo.wvfs.unlinkpath(f)
> +            repo.setnarrowpats(newincludes, newexcludes)
>  

Perhaps for another patch, but we could probably move this to before the transaction that starts on line 238 and then move the transaction outside of the unsafeoperation(). The repo won't be more broken if the user interrupts while we delete or add files from the working copy or dirstate here than it could be if they interrupt while doing the same things because of an `hg update` (right?).

I guess it depends on what we consider unsafe. Is it just things that would result in lost commits or errors from `hg verify` that we consider unsafe? That seems like a reasonable definition to me.

> narrowcommands.py:250
>  
> -    repo.destroyed()
> +        repo.destroyed()
>  

nit: the previous patch left this line outside of the block. make consistent? doesn't really matter, though...

> narrowcommands.py:284-295
> +        actions = {k: [] for k in 'a am f g cd dc r dm dg m e k p pr'.split()}
> +        addgaction = actions['g'].append
>  
> -    mf = repo['.'].manifest().matches(newmatch)
> -    for f, fn in mf.iteritems():
> -        if f not in repo.dirstate:
> -            addgaction((f, (mf.flags(f), False),
> -                        "add from widened narrow clone"))
> +        mf = repo['.'].manifest().matches(newmatch)
> +        for f, fn in mf.iteritems():
> +            if f not in repo.dirstate:
> +                addgaction((f, (mf.flags(f), False),

similar here: i think this could be left outside the unsafeoperation()

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3718

To: durin42, #hg-reviewers
Cc: martinvonz, mercurial-devel


More information about the Mercurial-devel mailing list