Пример #1
0
    def determineinitialbaseline(self, stream):
        regex = "\(_[\w-]+\)"
        pattern = re.compile(regex)
        config = self.config
        componentbaselinesentries = self.getcomponentbaselineentriesfromstream(
            stream)
        logincredentials = ""
        if not config.stored:
            logincredentials = loginCredentialsCommand % (config.user,
                                                          config.password)
        for entry in componentbaselinesentries:
            shouter.shout("Determine initial baseline of " +
                          entry.componentname)
            # use always scm, lscm fails when specifying maximum over 10k
            command = "scm --show-alias n --show-uuid y list baselines --components %s -r %s %s -m 20000" % \
                      (entry.component, config.repo, logincredentials)
            baselineslines = shell.getoutput(command)
            baselineslines.reverse(
            )  # reverse to have earliest baseline on top

            for baselineline in baselineslines:
                matcher = pattern.search(baselineline)
                if matcher:
                    matchedstring = matcher.group()
                    uuid = matchedstring[1:-1]
                    entry.baseline = uuid
                    entry.baselinename = "Automatically detected initial baseline"
                    shouter.shout("Initial baseline is: %s" % baselineline)
                    break
        return componentbaselinesentries
Пример #2
0
    def handle_captitalization_filename_changes():
        sandbox = os.path.join(configuration.get().workDirectory, configuration.get().clonedGitRepoName)
        lines = shell.getoutput("git status -z", stripped=False)
        for newfilerelativepath in Commiter.splitoutputofgitstatusz(lines, "A  "):
            directoryofnewfile = os.path.dirname(os.path.join(sandbox, newfilerelativepath))
            newfilename = os.path.basename(newfilerelativepath)
            cwd = os.getcwd()
            os.chdir(directoryofnewfile)
            files = shell.getoutput("git ls-files")
            for previousFileName in files:
                was_same_file_name = newfilename.lower() == previousFileName.lower()
                file_was_renamed = newfilename != previousFileName

                if was_same_file_name and file_was_renamed:
                    shell.execute("git rm --cached %s" % previousFileName)
            os.chdir(cwd)
Пример #3
0
 def collectstreamuuid(self):
     shouter.shout("Get UUID of configured stream")
     showuuidcommand = "%s --show-alias n --show-uuid y show attributes -r %s -w %s" % (
         self.scmcommand, self.repo, self.streamname)
     output = shell.getoutput(showuuidcommand)
     splittedfirstline = output[0].split(" ")
     self.streamuuid = splittedfirstline[0].strip()[1:-1]
Пример #4
0
 def test_IllegalGitCharsShouldntCreateFile_SpecialCaseAlreadyQuoted(self):
     with testhelper.createrepo(folderprefix="gitfunctionstestcase_"):
         Commiter.addandcommit(
             testhelper.createchangeentry(comment="Check out \"" + ">" +
                                          "\"US3333\""))
         self.assertEqual(0, len(shell.getoutput("git status -z")),
                          "No file should be created by commit message")
Пример #5
0
 def collectstreamuuid(self):
     shouter.shout("Get UUID of configured stream")
     showuuidcommand = "%s --show-alias n --show-uuid y show attributes -r %s -w %s" % (
         self.scmcommand, self.repo, self.streamname)
     output = shell.getoutput(showuuidcommand)
     splittedfirstline = output[0].split(" ")
     self.streamuuid = splittedfirstline[0].strip()[1:-1]
Пример #6
0
 def hasflowtarget(self, streamuuid):
     command = "%s --show-uuid y --show-alias n list flowtargets -r %s %s" % (self.scmcommand, self.repo, self.workspace)
     flowtargetlines = shell.getoutput(command)
     for flowtargetline in flowtargetlines:
         splittedinformationline = flowtargetline.split("\"")
         uuidpart = splittedinformationline[0].split(" ")
         flowtargetuuid = uuidpart[0].strip()[1:-1]
         if streamuuid in flowtargetuuid:
             return True
     return False
Пример #7
0
 def collectstreamuuids(self):
     shouter.shout("Get UUID's of configured streamnames")
     for streamname in self.streamnames:
         streamname = streamname.strip()
         showuuidcommand = "lscm --show-alias n --show-uuid y show attributes -r %s -w %s" % (
             self.repo, streamname)
         output = shell.getoutput(showuuidcommand)
         splittedfirstline = output[0].split(" ")
         streamuuid = splittedfirstline[0].strip()[1:-1]
         self.streamuuids.append(streamuuid)
Пример #8
0
    def handle_captitalization_filename_changes():
        sandbox = os.path.join(configuration.get().workDirectory,
                               configuration.get().clonedGitRepoName)
        lines = shell.getoutput("git status -z", stripped=False)
        for newfilerelativepath in Commiter.splitoutputofgitstatusz(
                lines, "A  "):
            directoryofnewfile = os.path.dirname(
                os.path.join(sandbox, newfilerelativepath))
            newfilename = os.path.basename(newfilerelativepath)
            cwd = os.getcwd()
            os.chdir(directoryofnewfile)
            files = shell.getoutput("git ls-files")
            for previousFileName in files:
                was_same_file_name = newfilename.lower(
                ) == previousFileName.lower()
                file_was_renamed = newfilename != previousFileName

                if was_same_file_name and file_was_renamed:
                    shell.execute("git rm --cached %s" % previousFileName)
            os.chdir(cwd)
Пример #9
0
    def determineinitialbaseline(self, stream):
        regex = "\(_\w+\)"
        pattern = re.compile(regex)
        config = self.config
        componentbaselinesentries = self.getcomponentbaselineentriesfromstream(stream)
        for entry in componentbaselinesentries:
            shouter.shout("Determine initial baseline of " + entry.componentname)
            # use always scm, lscm fails when specifying maximum over 10k
            command = "scm --show-alias n --show-uuid y list baselines --components %s -r %s -u %s -p %s -m 20000" % \
                      (entry.component, config.user, config.password, config.repo)
            baselineslines = shell.getoutput(command)
            baselineslines.reverse()  # reverse to have earliest baseline on top

            for baselineline in baselineslines:
                matcher = pattern.search(baselineline)
                if matcher:
                    matchedstring = matcher.group()
                    uuid = matchedstring[1:-1]
                    entry.baseline = uuid
                    entry.baselinename = "Automatically detected initial baseline"
                    break
        return componentbaselinesentries
Пример #10
0
 def get_untracked_statuszlines():
     return shell.getoutput("git status --untracked-files=all -z", stripped=False)
Пример #11
0
 def test_IllegalGitCharsShouldntCreateFile_SpecialCaseAlreadyQuoted(self):
     with testhelper.createrepo(folderprefix="gitfunctionstestcase_"):
         Commiter.addandcommit(testhelper.createchangeentry(comment="Check out \"" + ">" + "\"US3333\""))
         self.assertEqual(0, len(shell.getoutput("git status -z")), "No file should be created by commit message")
Пример #12
0
 def test_IllegalGitCharsShouldntCreateFile_NoCommentCase(self):
     with testhelper.createrepo(folderprefix="gitfunctionstestcase_"):
         Commiter.addandcommit(testhelper.createchangeentry(comment="<No Comment>"))
         self.assertEqual(0, len(shell.getoutput("git status -z")), "No file should be created by commit message")
Пример #13
0
 def assertGitStatusShowsIsRenamed(self):
     statusoutput = shell.getoutput("git status -z")
     modifier = statusoutput[0][0]
     self.assertEqual("R", modifier)
Пример #14
0
 def get_untracked_statuszlines():
     return shell.getoutput("git status --untracked-files=all -z",
                            stripped=False)