def migrate(): config = configuration.read() rtc = ImportHandler(config) rtcworkspace = WorkspaceHandler(config) git = Commiter initialize(config) streamuuids = config.streamuuids for streamuuid in streamuuids: componentbaselineentries = rtc.getcomponentbaselineentriesfromstream(streamuuid) streamname = config.streamnames[streamuuids.index(streamuuid)] rtcworkspace.setnewflowtargets(streamuuid) git.branch(streamname) history = rtc.readhistory(componentbaselineentries, streamname) changeentries = rtc.getchangeentriesofstreamcomponents(componentbaselineentries) rtc.acceptchangesintoworkspace(rtc.getchangeentriestoaccept(changeentries, history)) shouter.shout("All changes of components of stream '%s' accepted" % streamname) git.pushbranch(streamname) rtcworkspace.setcomponentstobaseline(componentbaselineentries, streamuuid) rtcworkspace.load() changeentries = rtc.getchangeentriesofstream(streamuuid) rtc.acceptchangesintoworkspace(rtc.getchangeentriestoaccept(changeentries, history)) git.pushbranch(streamname) shouter.shout("All changes of stream '%s' accepted - Migration of stream completed" % streamname) morestreamstomigrate = streamuuids.index(streamuuid) + 1 is not len(streamuuids) if morestreamstomigrate: git.checkout("master") rtcworkspace.recreateoldestworkspace()
def migrate(): config = configuration.read() rtc = ImportHandler(config) rtcworkspace = WorkspaceHandler(config) git = Commiter initialize(config) streamuuid = config.streamuuid streamname = config.streamname branchname = streamname + "_branchpoint" componentbaselineentries = rtc.getcomponentbaselineentriesfromstream(streamuuid) rtcworkspace.setnewflowtargets(streamuuid) git.branch(branchname) history = rtc.readhistory(componentbaselineentries, streamname) changeentries = rtc.getchangeentriesofstreamcomponents(componentbaselineentries) rtc.acceptchangesintoworkspace(rtc.getchangeentriestoaccept(changeentries, history)) shouter.shout("All changes until creation of stream '%s' accepted" % streamname) git.pushbranch(branchname) git.branch(streamname) rtcworkspace.setcomponentstobaseline(componentbaselineentries, streamuuid) rtcworkspace.load() changeentries = rtc.getchangeentriesofstream(streamuuid) rtc.acceptchangesintoworkspace(rtc.getchangeentriestoaccept(changeentries, history)) git.pushbranch(streamname) shouter.shout("All changes of stream '%s' accepted - Migration of stream completed" % streamname)
def migrate(): config = configuration.read() rtc = ImportHandler(config) rtcworkspace = WorkspaceHandler(config) git = Commiter initialize(config) streamuuids = config.streamuuids for streamuuid in streamuuids: componentbaselineentries = rtc.getcomponentbaselineentriesfromstream( streamuuid) streamname = config.streamnames[streamuuids.index(streamuuid)] rtcworkspace.setnewflowtargets(streamuuid) git.branch(streamname) history = rtc.readhistory(componentbaselineentries, streamname) changeentries = rtc.getchangeentriesofstreamcomponents( componentbaselineentries) rtc.acceptchangesintoworkspace( rtc.getchangeentriestoaccept(changeentries, history)) shouter.shout("All changes of components of stream '%s' accepted" % streamname) git.pushbranch(streamname) rtcworkspace.setcomponentstobaseline(componentbaselineentries, streamuuid) rtcworkspace.load() changeentries = rtc.getchangeentriesofstream(streamuuid) rtc.acceptchangesintoworkspace( rtc.getchangeentriestoaccept(changeentries, history)) git.pushbranch(streamname) shouter.shout( "All changes of stream '%s' accepted - Migration of stream completed" % streamname) morestreamstomigrate = streamuuids.index(streamuuid) + 1 is not len( streamuuids) if morestreamstomigrate: git.checkout("master") rtcworkspace.recreateoldestworkspace()
def resume(): shouter.shout("Found existing git repo in work directory, resuming migration...") config = configuration.get() os.chdir(config.workDirectory) os.chdir(config.clonedGitRepoName) if Differ.has_diff(): sys.exit("Your git repo has some uncommited changes, please add/remove them manually") RTCLogin.loginandcollectstreamuuid() Initializer.preparerepo() if config.previousstreamname: prepare() else: WorkspaceHandler().load()
def test_load(self, commitermock, shellmock): anyurl = "anyUrl" config = self.configBuilder.setrepourl(anyurl).setworkspace( self.workspace).build() configuration.config = config WorkspaceHandler().load() expected_load_command = "lscm load -r %s %s --force" % (anyurl, self.workspace) shellmock.execute.assert_called_once_with(expected_load_command) calls = [ call.get_untracked_statuszlines(), call.restore_shed_gitignore( commitermock.get_untracked_statuszlines()) ] commitermock.assert_has_calls(calls)
def prepare(): config = configuration.get() rtc = ImportHandler() rtcworkspace = WorkspaceHandler() # git checkout branchpoint Commiter.checkout(config.previousstreamname + "_branchpoint") # list baselines of current workspace componentbaselineentries = rtc.getcomponentbaselineentriesfromstream(config.previousstreamuuid) # set components to that baselines rtcworkspace.setcomponentstobaseline(componentbaselineentries, config.previousstreamuuid) rtcworkspace.load()
def migrate(): rtc = ImportHandler() rtcworkspace = WorkspaceHandler() git = Commiter if existsrepo(): resume() else: initialize() config = configuration.get() streamuuid = config.streamuuid streamname = config.streamname branchname = streamname + "_branchpoint" componentbaselineentries = rtc.getcomponentbaselineentriesfromstream(streamuuid) rtcworkspace.setnewflowtargets(streamuuid) history = rtc.readhistory(componentbaselineentries, streamname) changeentries = rtc.getchangeentriesofstreamcomponents(componentbaselineentries) if len(changeentries) > 0: git.branch(branchname) rtc.acceptchangesintoworkspace(rtc.getchangeentriestoaccept(changeentries, history)) shouter.shout("All changes until creation of stream '%s' accepted" % streamname) git.pushbranch(branchname) rtcworkspace.setcomponentstobaseline(componentbaselineentries, streamuuid) rtcworkspace.load() git.branch(streamname) changeentries = rtc.getchangeentriesofstream(streamuuid) amountofacceptedchanges = rtc.acceptchangesintoworkspace(rtc.getchangeentriestoaccept(changeentries, history)) if amountofacceptedchanges > 0: git.pushbranch(streamname) git.promotebranchtomaster(streamname) RTCLogin.logout() summary(streamname)
def migrate(): config = configuration.read() rtc = ImportHandler(config) rtcworkspace = WorkspaceHandler(config) git = Commiter initialize(config) streamuuid = config.streamuuid streamname = config.streamname branchname = streamname + "_branchpoint" componentbaselineentries = rtc.getcomponentbaselineentriesfromstream( streamuuid) rtcworkspace.setnewflowtargets(streamuuid) git.branch(branchname) history = rtc.readhistory(componentbaselineentries, streamname) changeentries = rtc.getchangeentriesofstreamcomponents( componentbaselineentries) rtc.acceptchangesintoworkspace( rtc.getchangeentriestoaccept(changeentries, history)) shouter.shout("All changes until creation of stream '%s' accepted" % streamname) git.pushbranch(branchname) git.branch(streamname) rtcworkspace.setcomponentstobaseline(componentbaselineentries, streamuuid) rtcworkspace.load() changeentries = rtc.getchangeentriesofstream(streamuuid) rtc.acceptchangesintoworkspace( rtc.getchangeentriestoaccept(changeentries, history)) git.pushbranch(streamname) shouter.shout( "All changes of stream '%s' accepted - Migration of stream completed" % streamname)
def resume(config): os.chdir(config.workDirectory) os.chdir(config.clonedGitRepoName) RTCInitializer.loginandcollectstreamuuid(config) WorkspaceHandler(config).load()