# HG changeset patch # User Mads Kiilerich # Date 1476801939 -7200 # Node ID d71db0e3b7b9067790a80c5f98d93f209eaa3ea6 # Parent dc7c4dbc1af9a521f1038beb145e8bc2c796f205 largefiles: clarify variable name holding file mode A follow-up to c01acee367ec. 'st' sounds like the whole stat result while 'mode' is a better name for the actual file mode. diff -r dc7c4dbc1af9 -r d71db0e3b7b9 hgext/largefiles/lfcommands.py --- a/hgext/largefiles/lfcommands.py Tue Nov 01 18:29:09 2016 -0700 +++ b/hgext/largefiles/lfcommands.py Tue Oct 18 16:45:39 2016 +0200 @@ -510,18 +510,21 @@ lfdirstate.normal(lfile) update1 = 1 - # copy the state of largefile standin from the repository's + # copy the exec mode of largefile standin from the repository's # dirstate to its state in the lfdirstate. rellfile = lfile relstandin = lfutil.standin(lfile) if wvfs.exists(relstandin): + # exec is decided by the users permissions using mask 0o100 standinexec = wvfs.stat(relstandin).st_mode & 0o100 - st = wvfs.stat(rellfile).st_mode - if standinexec != st & 0o100: - st &= ~0o111 + st = wvfs.stat(rellfile) + mode = st.st_mode + if standinexec != mode & 0o100: + # first remove all X bits, then shift all R bits to X + mode &= ~0o111 if standinexec: - st |= (st >> 2) & 0o111 & ~util.umask - wvfs.chmod(rellfile, st) + mode |= (mode >> 2) & 0o111 & ~util.umask + wvfs.chmod(rellfile, mode) update1 = 1 updated += update1