D5278: narrow: detect if narrowspec was changed in a different share

Yuya Nishihara yuya at tcha.org
Sat Dec 22 20:55:14 EST 2018


Queued, thanks.

> +def copytoworkingcopy(repo, tr):
> +    if tr:
> +        def write(file):
> +            spec = repo.svfs.read(FILENAME)
> +            file.write(spec)
> +            file.close()
> +        tr.addfilegenerator('narrowspec', (DIRSTATE_FILENAME,), write,
> +                            location='plain')
> +    else:
> +        spec = repo.svfs.read(FILENAME)
> +        repo.vfs.write(DIRSTATE_FILENAME, spec)

Maybe `write(..., atomictemp=True)` is a safer option.

> +def _writeaddedfiles(repo, pctx, files):
> +    actions = merge.emptyactions()
> +    addgaction = actions['g'].append

Nit: `merge.ACTION_GET`.


More information about the Mercurial-devel mailing list