Esempio n. 1
0
    def acceptchangesintoworkspace(self, changeentries):
        amountofchanges = len(changeentries)
        if amountofchanges == 0:
            shouter.shout("Found no changes to accept")
        else:
            shouter.shoutwithdate("Start accepting %s changesets" %
                                  amountofchanges)
        amountofacceptedchanges = 0

        for changeEntry in changeentries:
            amountofacceptedchanges += 1
            if not changeEntry.isAccepted(
            ):  # change could already be accepted from a retry
                if not Changes.accept(self.acceptlogpath, changeEntry):
                    shouter.shout(
                        "Change wasnt succesfully accepted into workspace, please load your workspace in eclipse and check whats wrong"
                    )
                    self.is_user_aborting(changeEntry)
                    # self.retryacceptincludingnextchangesets(changeEntry, changeentries)
                if not Differ.has_diff():
                    # no differences found - force reload of the workspace
                    shouter.shout(
                        "No changes for commiting in git detected, going to reload the workspace"
                    )
                    WorkspaceHandler().load()
                    if not Differ.has_diff():
                        shouter.shout(
                            "Still no changes... Please load your workspace in eclipse and check whats wrong"
                        )
                        # still no differences, something wrong
                        self.is_user_aborting(changeEntry)
                shouter.shout("Accepted change %d/%d into working directory" %
                              (amountofacceptedchanges, amountofchanges))
                Commiter.addandcommit(changeEntry)
        return amountofacceptedchanges
Esempio n. 2
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")
Esempio n. 3
0
    def acceptchangesintoworkspace(self, changeentries):
        amountofchanges = len(changeentries)
        shouter.shoutwithdate("Start accepting %s changesets" % amountofchanges)
        amountofacceptedchanges = 0

        for changeEntry in changeentries:
            amountofacceptedchanges += 1
            if not changeEntry.isAccepted(): # change could already be accepted from a retry
                if not Changes.accept(self.acceptlogpath, changeEntry):
                    shouter.shout("Change wasnt succesfully accepted into workspace")
                    # self.retryacceptincludingnextchangesets(changeEntry, changeentries)
                if not Differ.has_diff():
                    # no differences found - force reload of the workspace
                    WorkspaceHandler().load()
                shouter.shout("Accepted change %d/%d into working directory" % (amountofacceptedchanges, amountofchanges))
                Commiter.addandcommit(changeEntry)
        return amountofacceptedchanges
Esempio n. 4
0
 def test_handleignore_local_jazzignore_expect_delete_gitignore(self):
     with testhelper.mkchdir("aFolder") as folder:
         # create a repository with a .jazzignore and .gitignore file
         configuration.config = Builder().setworkdirectory(folder).setgitreponame("test.git").build()
         Initializer().createrepo()
         subfolder = "aSubFolder"
         os.mkdir(subfolder)
         jazzignore = subfolder + os.sep + ".jazzignore"
         with open(jazzignore, 'w') as testjazzignore:
             testjazzignore.write("# my ignores\n")
             testjazzignore.write("core.ignore = {*.pyc}")
         Commiter.addandcommit(testhelper.createchangeentry(comment="Initial .jazzignore"))
         gitignore = subfolder + os.sep + ".gitignore"
         self.assertTrue(os.path.exists(gitignore))
         # now remove .jazzignore
         os.remove(jazzignore)
         Commiter.handleignore()
         self.assertFalse(os.path.exists(gitignore))
Esempio n. 5
0
 def acceptchangesintoworkspace(self, changeentries):
     amountofchanges = len(changeentries)
     shouter.shoutwithdate("Start accepting %s changesets" % amountofchanges)
     amountofacceptedchanges = 0
     changestoskip = 0
     reloaded = False
     for changeEntry in changeentries:
         amountofacceptedchanges += 1
         if changestoskip > 0:
             shouter.shout("Skipping " + changeEntry.tostring())
             changestoskip -= 1
             continue
         acceptedsuccesfully = Changes.accept(self.config, self.acceptlogpath,
                                              changeEntry) is 0
         if not acceptedsuccesfully:
             shouter.shout("Change wasnt succesfully accepted into workspace")
             changestoskip = self.retryacceptincludingnextchangesets(changeEntry, changeentries)
         elif not reloaded:
             if self.is_reloading_necessary():
                 WorkspaceHandler(self.config).load()
             reloaded = True
         shouter.shout("Accepted change %s/%s into working directory" % (amountofacceptedchanges, amountofchanges))
         Commiter.addandcommit(changeEntry)
Esempio n. 6
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")
Esempio n. 7
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")