hgext/largefiles/lfcommands.py
changeset 50019 eed104af7401
parent 50018 ef1540c57730
child 50051 9409f2946f16
equal deleted inserted replaced
50018:ef1540c57730 50019:eed104af7401
   577                 lfdirstate._map.reset_state(f)
   577                 lfdirstate._map.reset_state(f)
   578 
   578 
   579             statuswriter(_(b'getting changed largefiles\n'))
   579             statuswriter(_(b'getting changed largefiles\n'))
   580             cachelfiles(ui, repo, None, lfiles)
   580             cachelfiles(ui, repo, None, lfiles)
   581 
   581 
   582         with lfdirstate.changing_parents(repo):
   582         for lfile in lfiles:
   583             for lfile in lfiles:
   583             update1 = 0
   584                 update1 = 0
   584 
   585 
   585             expecthash = update.get(lfile)
   586                 expecthash = update.get(lfile)
   586             if expecthash:
   587                 if expecthash:
   587                 if not lfutil.copyfromcache(repo, expecthash, lfile):
   588                     if not lfutil.copyfromcache(repo, expecthash, lfile):
   588                     # failed ... but already removed and set to normallookup
   589                         # failed ... but already removed and set to normallookup
   589                     continue
   590                         continue
   590                 # Synchronize largefile dirstate to the last modified
   591                     # Synchronize largefile dirstate to the last modified
   591                 # time of the file
   592                     # time of the file
   592                 lfdirstate.hacky_extension_update_file(
   593                     lfdirstate.hacky_extension_update_file(
   593                     lfile,
   594                         lfile,
   594                     p1_tracked=True,
   595                         p1_tracked=True,
   595                     wc_tracked=True,
   596                         wc_tracked=True,
   596                 )
   597                     )
   597                 update1 = 1
       
   598 
       
   599             # copy the exec mode of largefile standin from the repository's
       
   600             # dirstate to its state in the lfdirstate.
       
   601             standin = lfutil.standin(lfile)
       
   602             if wvfs.exists(standin):
       
   603                 # exec is decided by the users permissions using mask 0o100
       
   604                 standinexec = wvfs.stat(standin).st_mode & 0o100
       
   605                 st = wvfs.stat(lfile)
       
   606                 mode = st.st_mode
       
   607                 if standinexec != mode & 0o100:
       
   608                     # first remove all X bits, then shift all R bits to X
       
   609                     mode &= ~0o111
       
   610                     if standinexec:
       
   611                         mode |= (mode >> 2) & 0o111 & ~util.umask
       
   612                     wvfs.chmod(lfile, mode)
   598                     update1 = 1
   613                     update1 = 1
   599 
   614 
   600                 # copy the exec mode of largefile standin from the repository's
   615             updated += update1
   601                 # dirstate to its state in the lfdirstate.
   616 
   602                 standin = lfutil.standin(lfile)
   617             lfutil.synclfdirstate(repo, lfdirstate, lfile, normallookup)
   603                 if wvfs.exists(standin):
       
   604                     # exec is decided by the users permissions using mask 0o100
       
   605                     standinexec = wvfs.stat(standin).st_mode & 0o100
       
   606                     st = wvfs.stat(lfile)
       
   607                     mode = st.st_mode
       
   608                     if standinexec != mode & 0o100:
       
   609                         # first remove all X bits, then shift all R bits to X
       
   610                         mode &= ~0o111
       
   611                         if standinexec:
       
   612                             mode |= (mode >> 2) & 0o111 & ~util.umask
       
   613                         wvfs.chmod(lfile, mode)
       
   614                         update1 = 1
       
   615 
       
   616                 updated += update1
       
   617 
       
   618                 lfutil.synclfdirstate(repo, lfdirstate, lfile, normallookup)
       
   619 
   618 
   620         lfdirstate.write(repo.currenttransaction())
   619         lfdirstate.write(repo.currenttransaction())
   621         if lfiles:
   620         if lfiles:
   622             statuswriter(
   621             statuswriter(
   623                 _(b'%d largefiles updated, %d removed\n') % (updated, removed)
   622                 _(b'%d largefiles updated, %d removed\n') % (updated, removed)