4 from child
import Child
6 MTN
= ["mtn", "--db=~/oe/OE.mtn"]
9 def handle_parents(revision
):
10 parents
= Child(*MTN
+["au", "parents", revision
]).stdout
.strip().split('\n')
13 print "revision: %s (parents: %s)" % (revision
, parents
)
14 for parent
in parents
:
15 filename
= os
.path
.join("mtn2cache", "patch", parent
+"-"+revision
)
16 curfilename
= os
.path
.join("mtn2cache", "manifest", revision
)
17 parfilename
= os
.path
.join("mtn2cache", "manifest", parent
)
18 if not os
.path
.exists(filename
):
19 diff
= Child(*DIFF
+[parfilename
, curfilename
]).stdout
21 file(filename
, "w").write(diff
)
26 def handle_revision(revision
):
27 print "revision: %s" % revision
28 filename
= os
.path
.join("mtn2cache", "revision", revision
)
29 if not os
.path
.exists(filename
):
30 data
= Child(*MTN
+["au", "get_revision", revision
]).stdout
32 file(filename
, "w").write(data
)
37 filename
= os
.path
.join("mtn2cache", "manifest", revision
)
38 if not os
.path
.exists(filename
):
39 data
= Child(*MTN
+["au", "get_manifest_of", revision
]).stdout
41 file(filename
, "w").write(data
)
46 filename
= os
.path
.join("mtn2cache", "certs", revision
)
47 if not os
.path
.exists(filename
):
48 data
= Child(*MTN
+["au", "certs", revision
]).stdout
50 file(filename
, "w").write(data
)
55 def handle_head(head
):
56 print "head: %s" % head
57 ancestors
= Child(*MTN
+["au", "ancestors", head
]).stdout
.strip().split('\n')
58 pool
.map(handle_revision
, ancestors
)
59 pool
.map(handle_parents
, ancestors
)
61 def handle_branch(branch
):
62 print "branch: %s" % branch
63 heads
= Child(*MTN
+["au", "heads", branch
]).stdout
.strip().split('\n')
68 branches
= Child(*MTN
+["au", "branches"]).stdout
.strip().split('\n')
69 for branch
in branches
:
72 pool
= processing
.Pool(12)