Skip to content

Commit

Permalink
Merge pull request #130 from veon82/scmVersion6.x.x
Browse files Browse the repository at this point in the history
Scm version6.x.x
  • Loading branch information
WtfJoke authored Apr 7, 2019
2 parents 979d022 + bd1aec0 commit dc0736c
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions rtcFunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

loginCredentialsCommand = "-u '%s' -P '%s'"


class RTCInitializer:
@staticmethod
def initialize():
Expand Down Expand Up @@ -55,6 +54,7 @@ def __init__(self):
self.workspace = self.config.workspace
self.repo = self.config.repo
self.scmcommand = self.config.scmcommand
self.rtcversion = self.config.rtcversion

def createandload(self, stream, componentbaselineentries=[]):
shell.execute("%s create workspace -r %s -s %s %s" % (self.scmcommand, self.repo, stream, self.workspace))
Expand Down Expand Up @@ -89,7 +89,14 @@ def setnewflowtargets(self, streamuuid):
if not self.hasflowtarget(streamuuid):
shell.execute("%s add flowtarget -r %s %s %s" % (self.scmcommand, self.repo, self.workspace, streamuuid))

command = "%s set flowtarget -r %s %s --default --current %s" % (self.scmcommand, self.repo, self.workspace, streamuuid)
flowarg = ""
if self.rtcversion >= 6:
# Need to specify an arg to default and current option or
# set flowtarget command will fail.
# Assume that this is mandatory for RTC version >= 6.0.0
flowarg = "b"
command = "%s set flowtarget -r %s %s --default %s --current %s %s" % (self.scmcommand, self.repo, self.workspace,
flowarg, flowarg, streamuuid)
shell.execute(command)

def hasflowtarget(self, streamuuid):
Expand Down Expand Up @@ -165,6 +172,7 @@ def getcomponentbaselineentriesfromstream(self, stream):
baseline = ""
componentname = ""
baselinename = ""

with open(filename, 'r', encoding=shell.encoding) as file:
for line in file:
cleanedline = line.strip()
Expand All @@ -178,7 +186,11 @@ def getcomponentbaselineentriesfromstream(self, stream):
component = uuidpart[3].strip()[1:-1]
componentname = splittedinformationline[1]
else:
baseline = uuidpart[5].strip()[1:-1]
if self.config.rtcversion >= 6:
# fix trim brackets for vers. 6.x.x
baseline = uuidpart[7].strip()[1:-1]
else:
baseline = uuidpart[5].strip()[1:-1]
baselinename = splittedinformationline[1]

if baseline and component:
Expand Down

0 comments on commit dc0736c

Please sign in to comment.