-
Notifications
You must be signed in to change notification settings - Fork 7
/
from-review-to-repo
executable file
·50 lines (42 loc) · 1.45 KB
/
from-review-to-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
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import sys
PREFIX = "https://svn.pardus.org.tr/pardus"
REVIEW = "playground/review"
def run(cmd):
print "DEBUG: %s" % cmd
os.system(cmd)
def usage():
print "%s <package> repo1 repo2 repo3 .. repoN" % sys.argv[0]
if __name__ == "__main__":
package = ""
repos = []
try:
package = sys.argv[1]
repos = sys.argv[2:]
except IndexError:
usage()
exit(1)
if package.startswith(PREFIX):
# Full path given
target = os.path.dirname(package.replace(REVIEW, "%s/devel" % repos[0]))
cmd = "svn move %s %s" % (package, target)
run(cmd)
for repo in repos[1:]:
# Copy to other repositories
cmd = "svn copy %s %s" % (os.path.join(target, os.path.basename(package)), target.replace(repos[0], repo))
run(cmd)
else:
# Relative path from review is given e.g. util/admin/cgroup
if package.startswith("review"):
package = package.replace("review/", "")
src = os.path.join(PREFIX, REVIEW, package)
target = os.path.dirname(src.replace(REVIEW, "%s/devel" % repos[0]))
cmd = "svn move %s %s" % (src, target)
run(cmd)
#os.system(cmd)
for repo in repos[1:]:
# Copy to other repositories
cmd = "svn copy %s %s" % (os.path.join(target, os.path.basename(package)), target.replace(repos[0], repo))
run(cmd)