def checkin(self, arg, comment):
"Check in a commit, with comment."
comment = "'" + comment.replace("'", r"'\''") + "'"
+ # If the user changed the executable bit while modifying the
+ # workfile, propagate this change to the master. Without this
+ # hack, the sequence (1) Commit workfile (2) Make workfile
+ # executable, (3) checkin workfile fails to work as expected
+ # because RCS doesn't propagate the changed executable bit to
+ # the master, leading to misbehavior on the next checkout.
+ if os.path.exists(arg + ",v"):
+ oldmastermode = newmastermode = os.stat(arg + ",v").st_mode
+ userworkmode = os.stat(arg).st_mode
+ for bitmask in (stat.S_IXUSR, stat.S_IXGRP, stat.S_IXOTH):
+ if bitmask & userworkmode:
+ newmastermode |= bitmask
+ else:
+ newmastermode &=~ bitmask
+ if newmastermode != oldmastermode:
+ os.chmod(self.history(arg), newmastermode)
# By unlocking the file before checkin we invoke the following
# property described on the rcs(1) manual page: "If rev is
# omitted and the caller has no lock, but owns the file and
diff -u randomcontent tryit
check "cat of file with numeric name"
+echo "Should not be executable" >exectest
+src $TESTOPTS commit -m "First comment on exectest" exectest >/dev/null
+check "first commit of exectest"
+chmod a+x exectest
+echo "Should be executable" >exectest
+src $TESTOPTS commit -m "Second comment on exectest" exectest >/dev/null
+check "second commit of exectest"
+ls -l exectest | grep 'x' >/dev/null
+check "propagation of exec bit"
+
echo "srctest: all tests succeeded"
rm -fr $SANDBOX