-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgitBackUp.py
More file actions
36 lines (33 loc) · 907 Bytes
/
gitBackUp.py
File metadata and controls
36 lines (33 loc) · 907 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import selfCommon
import os
from datetime import datetime
import sys
modified_str = 'modified:'
newfile_str = 'new file:'
paths = []
outs, errs = selfCommon.exec_cmd("git status")
rootdir = "C:\\Users\\telu\\Desktop\\powerflowaddin-fortest3\\"
stash_name = raw_input("stash name:")
rootdir+=stash_name.strip()
if not os.path.exists(rootdir):
# curdate = datetime.now()
# rootdir+='_'+str(curdate.hour)+'_'+str(curdate.minute)
os.makedirs(rootdir)
else:
print rootdir+' exist!'
sys.exit(0)
if(outs):
lines = outs.split('\n')
for line in lines:
modify_idx = line.find(modified_str)
path = ''
if(modify_idx!=-1):
path = line[modify_idx+len(modified_str):].strip()
else:
newfile_idx = line.find(newfile_str)
if(newfile_idx!=-1):
path = line[newfile_idx+len(newfile_str):].strip()
if(len(path)>0):
selfCommon.copy_file_with_dir(path,rootdir)
paths.append(path)
print paths