Mercurial > hg-stable
changeset 15250:f172292cd416
largefiles: speed up commit by only rewriting standins for modified largefiles
author | Na'Tosha Bard <natosha@unity3d.com> |
---|---|
date | Thu, 13 Oct 2011 12:11:25 +0200 |
parents | f30c0a7b8346 |
children | 173b00827279 |
files | hgext/largefiles/reposetup.py |
diffstat | 1 files changed, 26 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/largefiles/reposetup.py Thu Oct 13 17:54:38 2011 +0200 +++ b/hgext/largefiles/reposetup.py Thu Oct 13 12:11:25 2011 +0200 @@ -248,26 +248,39 @@ # after the rebase. lfcommands.updatelfiles(repo.ui, repo) # Case 1: user calls commit with no specific files or - # include/exclude patterns: refresh and commit everything. + # include/exclude patterns: refresh and commit all files that + # are "dirty". if (match is None) or (not match.anypats() and not \ match.files()): + # Spend a bit of time here to get a list of files we know + # are modified so we can compare only against those. + # It can cost a lot of time (several seconds) + # otherwise to update all standins if the largefiles are + # large. + lfdirstate = lfutil.openlfdirstate(ui, self) + dirtymatch = match_.always(repo.root, repo.getcwd()) + s = lfdirstate.status(dirtymatch, [], False, False, False) + modifiedfiles = [] + for i in s: + modifiedfiles.extend(i) lfiles = lfutil.listlfiles(self) - lfdirstate = lfutil.openlfdirstate(ui, self) # this only loops through lfiles that exist (not # removed/renamed) for lfile in lfiles: - if os.path.exists(self.wjoin(lfutil.standin(lfile))): - # this handles the case where a rebase is being - # performed and the working copy is not updated - # yet. - if os.path.exists(self.wjoin(lfile)): - lfutil.updatestandin(self, - lfutil.standin(lfile)) - lfdirstate.normal(lfile) + if lfile in modifiedfiles: + if os.path.exists(self.wjoin(lfutil.standin(lfile))): + # this handles the case where a rebase is being + # performed and the working copy is not updated + # yet. + if os.path.exists(self.wjoin(lfile)): + lfutil.updatestandin(self, + lfutil.standin(lfile)) + lfdirstate.normal(lfile) for lfile in lfdirstate: - if not os.path.exists( - repo.wjoin(lfutil.standin(lfile))): - lfdirstate.drop(lfile) + if lfile in modifiedfiles: + if not os.path.exists( + repo.wjoin(lfutil.standin(lfile))): + lfdirstate.drop(lfile) lfdirstate.write() return orig(text=text, user=user, date=date, match=match,