projects
/
invirt/scripts/git-migration.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add back sipb-xen-chrony-config and sipb-xen-clvm-config for the sake
[invirt/scripts/git-migration.git]
/
git-migrate
diff --git
a/git-migrate
b/git-migrate
index
f03884f
..
c116db5
100755
(executable)
--- a/
git-migrate
+++ b/
git-migrate
@@
-1,5
+1,6
@@
#!/usr/bin/python
#!/usr/bin/python
+import glob
import os
import sys
import subprocess
import os
import sys
import subprocess
@@
-29,6
+30,9
@@
def tagBase(pkg):
cwd='%s.git' % pkg)
def clonePackage(base, pkg):
cwd='%s.git' % pkg)
def clonePackage(base, pkg):
+ path = '%s/%s' % (base, pkg)
+ pkg = os.path.basename(pkg)
+
if not os.path.isdir('%s.git' % pkg):
if os.path.isdir(pkg):
shutil.rmtree(pkg)
if not os.path.isdir('%s.git' % pkg):
if os.path.isdir(pkg):
shutil.rmtree(pkg)
@@
-39,7
+43,7
@@
def clonePackage(base, pkg):
'-Aauthors',
'-q',
'--no-metadata',
'-Aauthors',
'-q',
'--no-metadata',
- '%s/packages/%s' % (base, pkg)],
+ '%s' % path],
stdout=subprocess.PIPE)
# Then make the repository bare, because git-svn can't do this
stdout=subprocess.PIPE)
# Then make the repository bare, because git-svn can't do this
@@
-118,6
+122,12
@@
def mergeHistory(old_pkg, new_pkg, n):
'--',
'--all'],
cwd='%s.git' % new_pkg)
'--',
'--all'],
cwd='%s.git' % new_pkg)
+
+ subprocess.call(['git', 'branch',
+ '-D',
+ old_pkg],
+ cwd='%s.git' % new_pkg)
+ shutil.rmtree('%s.git/refs/original' % new_pkg, True)
def mergeHistories():
merges = []
def mergeHistories():
merges = []
@@
-130,6
+140,17
@@
def mergeHistories():
for merge in merges:
mergeHistory(*merge)
for merge in merges:
mergeHistory(*merge)
+
+ for merge in merges:
+ shutil.rmtree('%s.git' % merge[0])
+
+def cleanupRepos():
+ for pkg in glob.glob('*.git'):
+ subprocess.check_call(['git', 'tag', '-d', 'base'],
+ cwd='%s' % pkg)
+
+ subprocess.check_call(['git', 'gc'],
+ cwd='%s' % pkg)
if __name__ == '__main__':
try:
if __name__ == '__main__':
try:
@@
-139,3
+160,4
@@
if __name__ == '__main__':
cloneAllPackages(base)
mergeHistories()
cloneAllPackages(base)
mergeHistories()
+ cleanupRepos()