-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathrepo
executable file
·52 lines (47 loc) · 1.31 KB
/
repo
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/python
import os
import time
import shutil
import stat
import sys
import re
import subprocess
import repo_utils
repo_manifest = [
['.', 'repo_test1.git'],
['.', 'repo_test2.git'],
]
repo_url_dic = {
'test' : "[email protected]:imagec/"
}
command_dic = {
"status" : repo_utils.repo_status,
"branch" : repo_utils.repo_branch,
"init" : repo_utils.repo_init,
"push" : repo_utils.repo_push,
"sync" : repo_utils.repo_sync,
"checkout" : repo_utils.repo_checkout,
"forall" : repo_utils.repo_forall,
"remote" : repo_utils.repo_remote
}
try:
command_handler = command_dic[sys.argv[1]]
except KeyError:
print repo_utils.inred("wrong command :" + sys.argv[1])
exit()
if (sys.argv[1] == 'status' or sys.argv[1] == 'branch'):
command_handler(repo_manifest)
elif (sys.argv[1] == 'push'):
command_handler(sys.argv[2], repo_manifest)
elif (sys.argv[1] == 'init'):
command_handler(repo_url_dic[sys.argv[2]], repo_manifest)
elif (sys.argv[1] == 'sync'):
command_handler(sys.argv[2], repo_manifest)
elif (sys.argv[1] == 'checkout'):
command_handler(sys.argv[2], repo_manifest)
elif (sys.argv[1] == 'forall'):
command_handler(sys.argv[2], repo_manifest)
elif (sys.argv[1] == 'remote'):
command_handler(sys.argv[2], sys.argv[3], repo_manifest)
else:
print "Command not supported"