On Mon, Mar 27, 2017 at 10:53:48AM +0900, FUJIWARA Katsunori wrote: > # HG changeset patch > # User FUJIWARA Katsunori <fo...@lares.dti.ne.jp> > # Date 1490575476 -32400 > # Mon Mar 27 09:44:36 2017 +0900 > # Node ID 30343c565caf83ff165b05d2cd95f63ab50fe377 > # Parent b80768388eb2700a619159447461063983dd5806 > largefiles: add lfile argument to updatestandin() for efficiency (API)
These are queued, thanks. > > Before this patch, updatestandin() takes "standin" argument, and > applies splitstandin() on it to pick out a path to largefile (aka > "lfile" or so) from standin. > > But in fact, all callers already knows "lfile". In addition to it, > many callers knows both "standin" and "lfile". > > Therefore, making updatestandin() take only one of "standin" or > "lfile" is inefficient. > > diff --git a/hgext/largefiles/lfutil.py b/hgext/largefiles/lfutil.py > --- a/hgext/largefiles/lfutil.py > +++ b/hgext/largefiles/lfutil.py > @@ -342,8 +342,11 @@ def splitstandin(filename): > else: > return None > > -def updatestandin(repo, standin): > - lfile = splitstandin(standin) > +def updatestandin(repo, lfile, standin): > + """Re-calculate hash value of lfile and write it into standin > + > + This assumes that "lfutil.standin(lfile) == standin", for efficiency. > + """ > file = repo.wjoin(lfile) > if repo.wvfs.exists(lfile): > hash = hashfile(file) > @@ -560,7 +563,7 @@ def updatestandinsbymatch(repo, match): > # performed and the working copy is not updated > # yet. > if repo.wvfs.exists(lfile): > - updatestandin(repo, fstandin) > + updatestandin(repo, lfile, fstandin) > > return match > > @@ -586,7 +589,7 @@ def updatestandinsbymatch(repo, match): > for fstandin in standins: > lfile = splitstandin(fstandin) > if lfdirstate[lfile] != 'r': > - updatestandin(repo, fstandin) > + updatestandin(repo, lfile, fstandin) > > # Cook up a new matcher that only matches regular files or > # standins corresponding to the big files requested by the > diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py > --- a/hgext/largefiles/overrides.py > +++ b/hgext/largefiles/overrides.py > @@ -736,7 +736,7 @@ def overriderevert(orig, ui, repo, ctx, > s = lfutil.lfdirstatestatus(lfdirstate, repo) > lfdirstate.write() > for lfile in s.modified: > - lfutil.updatestandin(repo, lfutil.standin(lfile)) > + lfutil.updatestandin(repo, lfile, lfutil.standin(lfile)) > for lfile in s.deleted: > fstandin = lfutil.standin(lfile) > if (repo.wvfs.exists(fstandin)): > @@ -1417,7 +1417,7 @@ def mergeupdate(orig, repo, node, branch > # in this case, content of standin file is meaningless > # (in dctx, lfile is unknown, or normal file) > continue > - lfutil.updatestandin(repo, fstandin) > + lfutil.updatestandin(repo, lfile, fstandin) > # mark all clean largefiles as dirty, just in case the update gets > # interrupted before largefiles and lfdirstate are synchronized > for lfile in oldclean: > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel