check how many files are added or modified or deleted by git command and python
来源:互联网 发布:linux enca 编辑:程序博客网 时间:2024/06/05 03:38
1. search_all_effective_commit_include_reverted
def remember_commit(file_name, commit_id):
print "remember_commit:"
print commit_id;
read = file(file_name,'a+')
read.write(commit_id)
read.write("\n")
read.close()
def search_all_effective_commit_include_reverted():
commit_tag = "commit"
commit_len = 6
commit_begin = False
# not found
found = -1
read = open("git.log")
key_not_check = ("Revert", "Other")
record_commit = True;
commit_id = "start:";
line=read.readline()
while line:
equal = cmp(line[0:commit_len],commit_tag)
if equal == 0:
if record_commit == True:
remember_commit("commit_found", commit_id)
else:
print "find record_commit is false"
record_commit = True
commit_id = line[7:]
else:
for i in range(2):
found = line.find(key_not_check[i])
if found >= 0:
print "found integrate or revert"
record_commit = False
line=read.readline()
2. output name-status for each commit to file_list
def produce_file_list():
read = open("commit_found")
line=read.readline()
while line:
if len(line) > 1:
command = "git show "
line = line.strip('\n')
command += line
command += " --name-status --oneline >> ~/file_list.txt"
print command
commands.getoutput(command)
line=read.readline()
read.close()
3. thought file status, to put file name into different kind record.txt
def write_to_file(file_name,line):
read = file(file_name,'a+')
read.write(line)
read.write("\n")
read.close()
def format_file_list():
read = open("/home/demo/file_list.txt")
line=read.readline()
str_name = ""
while line:
if cmp(line[0], 'M') == 0:
str_name = line[1:].strip()
print str_name
write_to_file("/home/demo/m.txt",str_name)
if cmp(line[0], 'A') == 0:
str_name = line[1:].strip()
print str_name
write_to_file("/home/demo/a.txt",str_name)
if cmp(line[0], 'D') == 0:
str_name = line[1:].strip()
print str_name
write_to_file("/home/demo/d.txt",str_name)
line=read.readline()
read.close()
4. manualy remove reverted files from git.log, this can be programed in future.
it is complicated, for there is double revert.
def remember_commit(file_name, commit_id):
print "remember_commit:"
print commit_id;
read = file(file_name,'a+')
read.write(commit_id)
read.write("\n")
read.close()
def search_all_effective_commit_include_reverted():
commit_tag = "commit"
commit_len = 6
commit_begin = False
# not found
found = -1
read = open("git.log")
key_not_check = ("Revert", "Other")
record_commit = True;
commit_id = "start:";
line=read.readline()
while line:
equal = cmp(line[0:commit_len],commit_tag)
if equal == 0:
if record_commit == True:
remember_commit("commit_found", commit_id)
else:
print "find record_commit is false"
record_commit = True
commit_id = line[7:]
else:
for i in range(2):
found = line.find(key_not_check[i])
if found >= 0:
print "found integrate or revert"
record_commit = False
line=read.readline()
2. output name-status for each commit to file_list
def produce_file_list():
read = open("commit_found")
line=read.readline()
while line:
if len(line) > 1:
command = "git show "
line = line.strip('\n')
command += line
command += " --name-status --oneline >> ~/file_list.txt"
print command
commands.getoutput(command)
line=read.readline()
read.close()
3. thought file status, to put file name into different kind record.txt
def write_to_file(file_name,line):
read = file(file_name,'a+')
read.write(line)
read.write("\n")
read.close()
def format_file_list():
read = open("/home/demo/file_list.txt")
line=read.readline()
str_name = ""
while line:
if cmp(line[0], 'M') == 0:
str_name = line[1:].strip()
print str_name
write_to_file("/home/demo/m.txt",str_name)
if cmp(line[0], 'A') == 0:
str_name = line[1:].strip()
print str_name
write_to_file("/home/demo/a.txt",str_name)
if cmp(line[0], 'D') == 0:
str_name = line[1:].strip()
print str_name
write_to_file("/home/demo/d.txt",str_name)
line=read.readline()
read.close()
4. manualy remove reverted files from git.log, this can be programed in future.
it is complicated, for there is double revert.
0 0
- check how many files are added or modified or deleted by git command and python
- iOS 真机调试出现”A signed resource has been added modified or deleted“错误的解决办法
- A signed resource has been added, modified, or deleted” when trying to debug an App on iPhone
- Git how to restore deleted files
- How to diff and merge files or directories on Linux
- How draw a stem -and -leaf & box-plot display by R.or Python
- python and or and-or
- and,or,order by
- Row was updated or deleted by another transaction
- hibernate Row was updated or deleted by another transaction
- To check how many messages are in a MSMQ Queue
- How to unzip or zip files content
- git ignore modified files
- Python中的and、or、and-or
- 【转载】python 中的 and、or、and-or
- or,and,group by,having
- python and or技巧
- python and-or 用法
- 通俗易懂的小例子来演示如何使用NestedScroll
- rails 使用cancancan的一些心得
- iOS自定义相机截取图片旋转90°的问题
- Linux shell命令2
- javascript数组去重 - 效率测试
- check how many files are added or modified or deleted by git command and python
- Android开发UI布局必备基础知识
- 安装rebar时提示"Uncaught error in rebar_core"
- CocosCreator反射在Android中的使用
- linux内核学习的屠龙刀、倚天剑(需要搭配硬件调试环境)
- CheckBox复选框
- SlidingPaneLayout和DrawerLayout的区别
- 增量排序(未)
- IO密集型vs计算密集型