一个SVN自动merge的小工具

本文介绍了如何使用一个SVN小工具进行自动合并操作。工具能够根据ProjectPath指定的源URL地址进行合并,并且由于 Tapd 单号的加入,使得Log提交筛选更加便捷。同时,TargetProjectPath指定了本地目标目录,确保合并后的文件位置正确。完成合并后,LogPath则保存了详细的合并日志文件。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

# -*-coding:utf-8-*-

import sys
import os
import os.path
import time
import datetime
import shutil
import math

ProjectPath = sys.argv[1]
Tapd = sys.argv[2]
TargetProjectPath = sys.argv[3]
LogPath = sys.argv[4]

UrlPath = "YourURLPath"

#获取年月日时分
def Get_Time():
    return time.strftime('%Y%m%d%H%M',time.localtime(time.time()))
#获取年月日时分秒
def Get_Time2():
    return time.strftime('%Y%m%d%H%M%S',time.localtime(time.time()))
#获取年月日时分秒
def Get_Time3():
    return time.strftime('%Y%m%d',time.localtime(time.time()))
#获取年-月-日
def Get_Time4(lastTime):
    return time.strftime('%Y-%m-%d',time.localtime(time.time()-lastTime))

def Print_Func(Str):
    print(Str)
    sys.stdout.flush()

def Print_Func2(Str1,Str2):
    print('{0}:{1}'.format(Str1,Str2))
    sys.stdout.flush()

def Svn_Clean(Path):
    cmd_str = "svn cleanup %s --non-interactive" % (Path)
    output_file = os.popen(cmd_str)
    for outline in output_file.readlines():
        print(outline)
    sys.stdout.flush()

def Svn_Revert(Path):
    cmd_str = "svn revert %s -R --non-interactive" % (Path)
    output_file = os.popen(cmd_str)
    for outline in output_file.readlines():
        print(outline)
    sys.stdout.flush()

def Svn_Update(Path,Version):
    cmd_str = "svn up -r %s %s --non-interactive" % (Version,Path)
    output_file = os.popen(cmd_str)
    for outline in output_file.readlines():
        print(outline)
    sys.stdout.flush()

def Svn_UpdateExternals(Path,Version):
    externalSvnCmd = "svn pg svn:externals %s" % Path
    targetList = os.popen(externalSvnCmd)
    for line in targetList.readlines():
        print(line)
        line.strip()
        if not line.startswith("http"):
            cmd_str = "svn up -r %s %s\%s --non-interactive" % (Version,Path,line)
            output_file = os.popen(cmd_str)
            for outline in output_file.readlines():
                print(outline)
    sys.stdout.flush()

def Svn_Add(Path):
    cmd_str = "svn add %s" % (Path)
    output_file = os.popen(cmd_str)
    for outline in output_file.readlines():
        print(outline)
    sys.stdout.flush()

def Svn_Commit(Path,Desc):
    cmd_str = "svn commit -m %s %s" % (Desc,Path)
    output_file = os.popen(cmd_str)
    for outline in output_file.readlines():
        print(outline)
    sys.stdout.flush()

def Svn_Version(Path):
    cmd_str = "
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值