hgext/largefiles/reposetup.py
changeset 15250 f172292cd416
parent 15224 7c604d8c7e83
child 15252 6e809bb4f969
equal deleted inserted replaced
15249:f30c0a7b8346 15250:f172292cd416
   246                     # modified in the changesets we are rebasing on top of get
   246                     # modified in the changesets we are rebasing on top of get
   247                     # overwritten either by the rebase or in the first commit
   247                     # overwritten either by the rebase or in the first commit
   248                     # after the rebase.
   248                     # after the rebase.
   249                     lfcommands.updatelfiles(repo.ui, repo)
   249                     lfcommands.updatelfiles(repo.ui, repo)
   250                 # Case 1: user calls commit with no specific files or
   250                 # Case 1: user calls commit with no specific files or
   251                 # include/exclude patterns: refresh and commit everything.
   251                 # include/exclude patterns: refresh and commit all files that
       
   252                 # are "dirty".
   252                 if (match is None) or (not match.anypats() and not \
   253                 if (match is None) or (not match.anypats() and not \
   253                         match.files()):
   254                         match.files()):
       
   255                     # Spend a bit of time here to get a list of files we know
       
   256                     # are modified so we can compare only against those.
       
   257                     # It can cost a lot of time (several seconds)
       
   258                     # otherwise to update all standins if the largefiles are
       
   259                     # large.
       
   260                     lfdirstate = lfutil.openlfdirstate(ui, self)
       
   261                     dirtymatch = match_.always(repo.root, repo.getcwd())
       
   262                     s = lfdirstate.status(dirtymatch, [], False, False, False)
       
   263                     modifiedfiles = []
       
   264                     for i in s:
       
   265                         modifiedfiles.extend(i)
   254                     lfiles = lfutil.listlfiles(self)
   266                     lfiles = lfutil.listlfiles(self)
   255                     lfdirstate = lfutil.openlfdirstate(ui, self)
       
   256                     # this only loops through lfiles that exist (not
   267                     # this only loops through lfiles that exist (not
   257                     # removed/renamed)
   268                     # removed/renamed)
   258                     for lfile in lfiles:
   269                     for lfile in lfiles:
   259                         if os.path.exists(self.wjoin(lfutil.standin(lfile))):
   270                         if lfile in modifiedfiles:
   260                             # this handles the case where a rebase is being
   271                             if os.path.exists(self.wjoin(lfutil.standin(lfile))):
   261                             # performed and the working copy is not updated
   272                                 # this handles the case where a rebase is being
   262                             # yet.
   273                                 # performed and the working copy is not updated
   263                             if os.path.exists(self.wjoin(lfile)):
   274                                 # yet.
   264                                 lfutil.updatestandin(self,
   275                                 if os.path.exists(self.wjoin(lfile)):
   265                                     lfutil.standin(lfile))
   276                                     lfutil.updatestandin(self,
   266                                 lfdirstate.normal(lfile)
   277                                         lfutil.standin(lfile))
       
   278                                     lfdirstate.normal(lfile)
   267                     for lfile in lfdirstate:
   279                     for lfile in lfdirstate:
   268                         if not os.path.exists(
   280                         if lfile in modifiedfiles:
   269                                 repo.wjoin(lfutil.standin(lfile))):
   281                             if not os.path.exists(
   270                             lfdirstate.drop(lfile)
   282                                     repo.wjoin(lfutil.standin(lfile))):
       
   283                                 lfdirstate.drop(lfile)
   271                     lfdirstate.write()
   284                     lfdirstate.write()
   272 
   285 
   273                     return orig(text=text, user=user, date=date, match=match,
   286                     return orig(text=text, user=user, date=date, match=match,
   274                                     force=force, editor=editor, extra=extra)
   287                                     force=force, editor=editor, extra=extra)
   275 
   288