[PATCH 14 of 19 STABLE] largefiles: show status for files added on another branch correctly
Greg Ward
greg at gerg.ca
Tue Feb 28 02:04:51 UTC 2012
On 27 February 2012, FUJIWARA Katsunori said:
> # HG changeset patch
> # User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
> # Date 1330335216 -32400
> # Branch stable
> # Node ID b728948758a3dd40ab955b314dbcc3a3f12f924c
> # Parent 80ad9da167d20345ccf59b8ff968c44f206d1e09
> largefiles: show status for files added on another branch correctly
>
> original implementation can't show status for largefiles added on
> another branch correctly, because:
>
> 1. no STANDIN file/directory corresponded to specified patterns
> exists 'local' side branch (this also causes unexpected
> 'performance boost' root choice), and
>
> 2. 'filefn()' for matcher creation only examines 2nd context, so
> files()' of created matcher is not updated expectedly (this
> causes unexpected behavior of 'dirstate.status()')
>
> this patch fixes this problem by examining both 1st/2nd context for
> files/directories not known to each other.
>
> in this patch, 1st context is examined only not in 'parentworking'
> case for performance efficiency, because 2nd context (= working
> context) should have enough information about removed files in
> 'parentworking' case.
>
> diff -r 80ad9da167d2 -r b728948758a3 hgext/largefiles/reposetup.py
> --- a/hgext/largefiles/reposetup.py Mon Feb 27 18:33:36 2012 +0900
> +++ b/hgext/largefiles/reposetup.py Mon Feb 27 18:33:36 2012 +0900
> @@ -128,12 +128,13 @@
> # largefiles, we should just bail here and let super
> # handle it -- thus gaining a big performance boost.
> if match.files() and not match.anypats():
> - wctx = repo[None]
> for f in match.files():
> if lfutil.isstandin(f):
> continue
> sf = lfutil.standin(f)
> - if inctx(sf, wctx) or inctxdirs(sf, wctx):
> + if (inctx(sf, ctx2) or inctxdirs(sf, ctx2) or
> + (not parentworking and
> + (inctx(sf, ctx1) or inctxdirs(sf, ctx1)))):
> break
> else:
> return super(lfiles_repo, self).status(node1, node2,
> @@ -156,7 +157,9 @@
> for f in files:
> if not lfutil.isstandin(f):
> sf = lfutil.standin(f)
> - if inctx(sf, ctx2) or inctxdirs(sf, ctx2):
> + if (inctx(sf, ctx2) or inctxdirs(sf, ctx2) or
> + (not parentworking and
> + (inctx(sf, ctx1) or inctxdirs(sf, ctx1)))):
> yield sf
> continue
> # not 'known largefile', or 'STANDIN direct' pattern
That looks like copy-and-paste coding to me. I still don't think "sf
in dirstate" deserves to be a function, but I *do* think that
(inctx(sf, ctx2) or inctxdirs(sf, ctx2) or
(not parentworking and
(inctx(sf, ctx1) or inctxdirs(sf, ctx1))))
does. Especially if you inline inctx() and inctxdirs().
Greg
--
Greg Ward http://www.gerg.ca/
Jesus Saves -- but Moses gets the rebound, he shoots, he SCORES!
More information about the Mercurial-devel
mailing list