hgext/largefiles/overrides.py
changeset 24474 61a99993f8a7
parent 24472 1bf71faf042e
child 24534 1925769b4ff8
equal deleted inserted replaced
24473:0142b59f5743 24474:61a99993f8a7
   406         class fakerepo(object):
   406         class fakerepo(object):
   407             dirstate = lfutil.openlfdirstate(ui, repo)
   407             dirstate = lfutil.openlfdirstate(ui, repo)
   408         orig(ui, fakerepo, *pats, **opts)
   408         orig(ui, fakerepo, *pats, **opts)
   409     else:
   409     else:
   410         orig(ui, repo, *pats, **opts)
   410         orig(ui, repo, *pats, **opts)
   411 
       
   412 # Override needs to refresh standins so that update's normal merge
       
   413 # will go through properly. Then the other update hook (overriding repo.update)
       
   414 # will get the new files. Filemerge is also overridden so that the merge
       
   415 # will merge standins correctly.
       
   416 def overrideupdate(orig, ui, repo, *pats, **opts):
       
   417     # Need to lock between the standins getting updated and their
       
   418     # largefiles getting updated
       
   419     wlock = repo.wlock()
       
   420     try:
       
   421         if opts['check']:
       
   422             lfdirstate = lfutil.openlfdirstate(ui, repo)
       
   423             unsure, s = lfdirstate.status(
       
   424                 match_.always(repo.root, repo.getcwd()),
       
   425                 [], False, False, False)
       
   426 
       
   427             mod = len(s.modified) > 0
       
   428             for lfile in unsure:
       
   429                 standin = lfutil.standin(lfile)
       
   430                 if repo['.'][standin].data().strip() != \
       
   431                         lfutil.hashfile(repo.wjoin(lfile)):
       
   432                     mod = True
       
   433                 else:
       
   434                     lfdirstate.normal(lfile)
       
   435             lfdirstate.write()
       
   436             if mod:
       
   437                 raise util.Abort(_('uncommitted changes'))
       
   438         return orig(ui, repo, *pats, **opts)
       
   439     finally:
       
   440         wlock.release()
       
   441 
   411 
   442 # Before starting the manifest merge, merge.updates will call
   412 # Before starting the manifest merge, merge.updates will call
   443 # _checkunknownfile to check if there are any files in the merged-in
   413 # _checkunknownfile to check if there are any files in the merged-in
   444 # changeset that collide with unknown files in the working copy.
   414 # changeset that collide with unknown files in the working copy.
   445 #
   415 #