|
@@ -3,30 +3,6 @@ from dulwich import repo
|
|
|
import os
|
|
|
|
|
|
|
|
|
-def is_file_locked(file_path):
|
|
|
- try:
|
|
|
- with open(file_path, 'r'):
|
|
|
- return False
|
|
|
- except IOError:
|
|
|
- return True
|
|
|
-
|
|
|
-
|
|
|
-def close_file(file_object):
|
|
|
- file_object.close()
|
|
|
-
|
|
|
-
|
|
|
-def release_file_resource(file_path):
|
|
|
- file_descriptor = os.open(file_path, os.O_RDONLY)
|
|
|
- os.close(file_descriptor)
|
|
|
-
|
|
|
-
|
|
|
-def unlock_file(file_path):
|
|
|
- if is_file_locked(file_path):
|
|
|
- with open(file_path, 'r') as file:
|
|
|
- close_file(file)
|
|
|
- release_file_resource(file_path)
|
|
|
-
|
|
|
-
|
|
|
def ro():
|
|
|
os.system("/etc/init.d/S01mount_ro start")
|
|
|
|
|
@@ -46,10 +22,9 @@ def checkout(rep, branch):
|
|
|
|
|
|
|
|
|
localrep = "/home/"
|
|
|
-unlockfile = localrep + "cclb_launch"
|
|
|
+
|
|
|
|
|
|
rw()
|
|
|
-unlock_file(unlockfile)
|
|
|
if porcelain.active_branch(localrep) != b'master':
|
|
|
checkout(localrep, 'master')
|
|
|
else:
|