[PATCH STABLE] status: don't crash if a lookup file disappears
Yuya Nishihara
yuya at tcha.org
Sat Jun 3 10:26:24 EDT 2017
On Fri, 2 Jun 2017 22:28:07 -0700, Siddharth Agarwal wrote:
> # HG changeset patch
> # User Siddharth Agarwal <sid0 at fb.com>
> # Date 1496467672 25200
> # Fri Jun 02 22:27:52 2017 -0700
> # Branch stable
> # Node ID d39f934da0c80a568486cd8645eb6bbe513f1f03
> # Parent 62e42e2897502bcbaa3a57d3301c789309596391
> status: don't crash if a lookup file disappears
Looks good to me. A few nits.
> diff --git a/mercurial/context.py b/mercurial/context.py
> --- a/mercurial/context.py
> +++ b/mercurial/context.py
> @@ -1613,18 +1613,30 @@ class workingctx(committablectx):
> def _checklookup(self, files):
> # check for any possibly clean files
> if not files:
> - return [], []
> + return [], [], []
>
> modified = []
> + deleted = []
> fixup = []
> pctx = self._parents[0]
> # do a full compare of any files that might have changed
> for f in sorted(files):
> - if (f not in pctx or self.flags(f) != pctx.flags(f)
> - or pctx[f].cmp(self[f])):
> - modified.append(f)
> - else:
> - fixup.append(f)
> + try:
> + # This will return True for a file that got replaced by a
> + # directory in the interim, but fixing that is pretty hard.
> + if (f not in pctx or self.flags(f) != pctx.flags(f)
> + or pctx[f].cmp(self[f])):
If cmp() falls back to fctx.data() path, maybe IOError could be raised.
> + modified.append(f)
> + else:
> + fixup.append(f)
> + except OSError:
Can we check errno strictly? Perhaps ENOENT and EISDIR should be caught.
More information about the Mercurial-devel
mailing list