@@ -9,7 +9,12 @@ class RTCInitializer:
99 @staticmethod
1010 def initialize (config ):
1111 RTCInitializer .loginandcollectstreams (config )
12- WorkspaceHandler (config ).createandload (config .earlieststreamname , config .initialcomponentbaselines )
12+ workspace = WorkspaceHandler (config )
13+ if config .useexistingworkspace :
14+ shouter .shout ("Use existing workspace to start migration" )
15+ workspace .load ()
16+ else :
17+ workspace .createandload (config .earlieststreamname , config .initialcomponentbaselines )
1318
1419 @staticmethod
1520 def loginandcollectstreams (config ):
@@ -39,7 +44,6 @@ def load(self):
3944 shouter .shout ("Load of workspace finished" )
4045
4146 def setcomponentstobaseline (self , componentbaselineentries , streamuuid ):
42- self .setnewflowtargets (streamuuid )
4347 for entry in componentbaselineentries :
4448 shouter .shout ("Set component '%s' to baseline '%s'" % (entry .componentname , entry .baselinename ))
4549
@@ -48,19 +52,23 @@ def setcomponentstobaseline(self, componentbaselineentries, streamuuid):
4852 shell .execute (replacecommand )
4953
5054 def setnewflowtargets (self , streamuuid ):
51- shouter .shout ("Replacing Flowtargets" )
52- self .removedefaultflowtarget ()
53- shell .execute ("lscm add flowtarget -r %s %s %s"
54- % (self .repo , self .workspace , streamuuid ))
55+ shouter .shout ("Set new Flowtargets" )
56+ if not self .hasflowtarget ( streamuuid ):
57+ shell .execute ("lscm add flowtarget -r %s %s %s"
58+ % (self .repo , self .workspace , streamuuid ))
5559 shell .execute ("lscm set flowtarget -r %s %s --default --current %s"
5660 % (self .repo , self .workspace , streamuuid ))
5761
58- def removedefaultflowtarget (self ):
59- flowtargetline = shell .getoutput ("lscm --show-alias n list flowtargets -r %s %s"
60- % (self .repo , self .workspace ))[0 ]
61- flowtargetnametoremove = flowtargetline .split ("\" " )[1 ]
62- shell .execute ("lscm remove flowtarget -r %s %s %s"
63- % (self .repo , self .workspace , flowtargetnametoremove ))
62+ def hasflowtarget (self , streamuuid ):
63+ flowtargetlines = shell .getoutput ("lscm --show-uuid y --show-alias n list flowtargets -r %s %s"
64+ % (self .repo , self .workspace ))
65+ for flowtargetline in flowtargetlines :
66+ splittedinformationline = flowtargetline .split ("\" " )
67+ uuidpart = splittedinformationline [0 ].split (" " )
68+ flowtargetuuid = uuidpart [0 ].strip ()[1 :- 1 ]
69+ if streamuuid in flowtargetuuid :
70+ return True
71+ return False
6472
6573 def recreateoldestworkspace (self ):
6674 self .createandload (self .config .earlieststreamname , self .config .initialcomponentbaselines , False )
@@ -121,12 +129,12 @@ def acceptchangesintoworkspace(self, changeentries):
121129 acceptcommand = "lscm accept --changes " + revision + " --overwrite-uncommitted"
122130 acceptedsuccesfully = shell .execute (acceptcommand , self .config .getlogpath ("accept.txt" ), "a" ) is 0
123131 if not acceptedsuccesfully :
132+ shouter .shout ("Last executed command: " + acceptcommand )
124133 sys .exit ("Change wasnt succesfully accepted into workspace, please check the output and "
125134 "rerun programm with resume" )
135+ shouter .shout ("Accepted change %s/%s into working directory" % (amountofacceptedchanges , amountofchanges ))
126136 git .addandcommit (changeEntry )
127137
128- shouter .shout ("Accepted change %s/%s" % (amountofacceptedchanges , amountofchanges ))
129-
130138 def getchangeentriesofstreamcomponents (self , componentbaselineentries ):
131139 shouter .shout ("Start collecting changeentries" )
132140 changeentries = []
@@ -168,6 +176,7 @@ def getchangeentriesbytypeandvalue(self, comparetype, value):
168176 shell .execute (comparecommand , outputfilename )
169177 return ImportHandler .getchangeentriesfromfile (outputfilename )
170178
179+
171180class ChangeEntry :
172181 def __init__ (self , revision , author , email , date , comment ):
173182 self .revision = revision
0 commit comments