#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import sys
import shutil
import subprocess
"""
递归强制解锁(break lock)指定目录下的文件
用法:python svn-unlock.py [targetDir]
作者:koqiui@163.com
"""
# 当前脚本所在目录
__dir__ = os.path.abspath(os.path.dirname(__file__))
# 要解锁的目标目录(默认为本脚本所在目录)
targetDir = __dir__
# 忽略的目录
ignoredDirNames = ['.svn', 'target']
def unlockDirFiles(theDir):
baseName = os.path.basename(theDir)
if baseName not in ignoredDirNames:
print('正在解锁目录 {0}'.format(theDir))
subprocess.call([
'svn', 'unlock', '--force', os.path.join(theDir, '*.*')
])
# ------------------------------------
fileItems = os.listdir(theDir)
for fileItem in fileItems:
filePath = os.path.join(theDir, fileItem)
if os.path.isdir(filePath
快速递归解锁svn锁定的目录下的文件
最新推荐文章于 2024-05-15 15:41:40 发布