comparison hgext/largefiles/lfcommands.py @ 30141:c01acee367ec

largefiles: when setting/clearing x bit on largefiles, don't change other bits It is only the X bit that it matters to copy from the standin to the largefile in the working directory. While it generally doesn't do any harm to copy the whole mode, it is also "wrong" to copy more than the X bit we care about. It can make a difference if someone should try to handle largefiles differently, such as marking them read-only. Thus, do similar to what utils.setflags does and set the X bit where there are R bits and obey umask.
author Mads Kiilerich <madski@unity3d.com>
date Sat, 08 Oct 2016 00:59:40 +0200
parents 85868ecf2c0d
children d71db0e3b7b9
comparison
equal deleted inserted replaced
30140:747e546c561f 30141:c01acee367ec
513 # copy the state of largefile standin from the repository's 513 # copy the state of largefile standin from the repository's
514 # dirstate to its state in the lfdirstate. 514 # dirstate to its state in the lfdirstate.
515 rellfile = lfile 515 rellfile = lfile
516 relstandin = lfutil.standin(lfile) 516 relstandin = lfutil.standin(lfile)
517 if wvfs.exists(relstandin): 517 if wvfs.exists(relstandin):
518 mode = wvfs.stat(relstandin).st_mode 518 standinexec = wvfs.stat(relstandin).st_mode & 0o100
519 if mode != wvfs.stat(rellfile).st_mode: 519 st = wvfs.stat(rellfile).st_mode
520 wvfs.chmod(rellfile, mode) 520 if standinexec != st & 0o100:
521 st &= ~0o111
522 if standinexec:
523 st |= (st >> 2) & 0o111 & ~util.umask
524 wvfs.chmod(rellfile, st)
521 update1 = 1 525 update1 = 1
522 526
523 updated += update1 527 updated += update1
524 528
525 lfutil.synclfdirstate(repo, lfdirstate, lfile, normallookup) 529 lfutil.synclfdirstate(repo, lfdirstate, lfile, normallookup)