Esempio n. 1
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. 2
0
 def test_BranchRenaming_TargetBranchExist_ShouldBeSuccessful(self):
     with testhelper.createrepo(folderprefix="gitfunctionstestcase_"):
         branchname = "hello"
         Commiter.branch(branchname)
         self.assertEqual(0, Commiter.promotebranchtomaster(branchname))
         time.sleep(1)
         self.assertEqual(0, Commiter.promotebranchtomaster(branchname))
Esempio n. 3
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. 4
0
 def test_handleignore_global_extensions(self):
     with testhelper.mkchdir("aFolder") as folder:
         # create test repo
         configuration.config = Builder().setworkdirectory(
             folder).setgitreponame("test.git").setignorefileextensions(
                 ".zip; .jar").build()
         ignore = ".gitignore"
         Initializer().createrepo()
         # simulate addition of .zip and .jar files
         zip = "test.zip"
         with open(zip, 'w') as testzip:
             testzip.write("test zip content")
         jar = "test.jar"
         with open(jar, 'w') as testjar:
             testjar.write("test jar content")
         # do the filtering
         Commiter.handleignore()
         # check output of .gitignore
         with open(ignore, 'r') as gitIgnore:
             lines = gitIgnore.readlines()
             self.assertEqual(2, len(lines))
             lines.sort()
             # the ignore should not be recursive:
             self.assertEqual('/' + jar, lines[0].strip())
             self.assertEqual('/' + zip, lines[1].strip())
Esempio n. 5
0
 def simulateCreationAndRenameInGitRepo(self, originalfilename, newfilename):
     open(originalfilename, 'a').close()  # create file
     Initializer.initialcommit()
     Commiter.pushmaster()
     os.rename(originalfilename, newfilename)  # change capitalization
     shell.execute("git add -A")
     Commiter.handle_captitalization_filename_changes()
Esempio n. 6
0
 def load(self):
     command = "%s load -r %s %s --force" % (self.scmcommand, self.repo, self.workspace)
     if self.config.includecomponentroots:
         command += " --include-root"
     shouter.shout("Start (re)loading current workspace: " + command)
     shell.execute(command)
     shouter.shout("Load of workspace finished")
     Commiter.restore_shed_gitignore(Commiter.get_untracked_statuszlines())
Esempio n. 7
0
 def test_BranchRenaming_TwoCallsAtTheSameTime_ShouldFail(self, datetimemock):
     with testhelper.createrepo(folderprefix="gitfunctionstestcase_"):
         branchname = "hello"
         Commiter.branch(branchname)
         faketime = datetime.datetime(2015, 11, 11, 11, 11, 11)
         datetimemock.now.return_value = faketime
         self.assertEqual(0, Commiter.promotebranchtomaster(branchname))
         self.assertEqual(1, Commiter.promotebranchtomaster(branchname))
Esempio n. 8
0
 def test_restore_shed_gitignore_without_sibling_jazzignore(
         self, shellmock):
     with open(
             testhelper.getrelativefilename(
                 './resources/test_ignore_git_status_z.txt'), 'r') as file:
         with patch('os.path.exists', return_value=True
                    ):  # answer inquries for sibling .jazzignore with False
             Commiter.restore_shed_gitignore(file.readlines())
             calls = [
             ]  # if there are no siblings, we are not allowed to checkout
             shellmock.assert_has_calls(calls)
Esempio n. 9
0
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()
Esempio n. 10
0
 def test_restore_shed_gitignore_with_sibling_jazzignore(self, shellmock):
     with open(
             testhelper.getrelativefilename(
                 './resources/test_ignore_git_status_z.txt'), 'r') as file:
         with patch('os.path.exists', return_value=True
                    ):  # answer inquries for sibling .jazzignore with True
             Commiter.restore_shed_gitignore(file.readlines())
             calls = [
                 call.execute('git checkout -- project1/src/.gitignore'),
                 call.execute('git checkout -- project1/src/sub/.gitignore')
             ]
             shellmock.assert_has_calls(calls)
Esempio n. 11
0
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:
        Commiter.branch(config.streamname)
Esempio n. 12
0
def validate():
    config = configuration.get()
    streamname = config.streamname
    branchname = streamname + "_branchpoint"
    previousstreamname = config.previousstreamname
    offendingbranchname = None
    if not Commiter.checkbranchname(streamname):
        offendingbranchname = streamname
    elif not Commiter.checkbranchname(branchname):
        offendingbranchname = branchname
    elif not Commiter.checkbranchname(previousstreamname):
        offendingbranchname = previousstreamname
    if offendingbranchname:
        sys.exit(offendingbranchname + " is not a valid git branch name - consider renaming the stream")
Esempio n. 13
0
def initialize():
    config = configuration.get()
    directory = config.workDirectory
    if os.path.exists(directory):
        sys.exit("Configured directory already exists, please make sure to use a non-existing directory")
    shouter.shout("Migration will take place in " + directory)
    os.makedirs(directory)
    os.chdir(directory)
    config.deletelogfolder()
    git = Initializer()
    git.initalize()
    RTCInitializer.initialize()
    if Differ.has_diff():
        git.initialcommit()
    Commiter.pushmaster()
Esempio n. 14
0
    def retryacceptincludingnextchangeset(self, change, changes):
        successfull = False
        nextchangeentry = self.getnextchangeset(change, changes)
        if nextchangeentry and (change.author == nextchangeentry.author
                                or "merge" in nextchangeentry.comment.lower()):
            shouter.shout("Next changeset: " + nextchangeentry.tostring())
            if input(
                    "Press Enter to try to accept it with next changeset together, press any other key to skip this"
                    " changeset and continue"):
                return False
            Changes.discard(change)
            successfull = Changes.accept(
                change, nextchangeentry, logpath=self.acceptlogpath) is 0
            if not successfull:
                Changes.discard(change, nextchangeentry)

        if not successfull:
            shouter.shout("Last executed command: \n" +
                          Changes.latest_accept_command)
            shouter.shout("Apropriate git commit command \n" +
                          Commiter.getcommitcommand(change))
            if not input(
                    "Press Enter to continue or any other key to exit the program and rerun it with resume"
            ):
                sys.exit(
                    "Please check the output and rerun programm with resume")
        return successfull
Esempio n. 15
0
 def test_splitoutputofgitstatusz_filterprefix_D(self):
     with open(testhelper.getrelativefilename('./resources/test_ignore_git_status_z.txt'), 'r') as file:
         repositoryfiles = Commiter.splitoutputofgitstatusz(file.readlines(), ' D ')
         self.assertEqual(3, len(repositoryfiles))
         self.assertEqual('project1/src/sub/.jazzignore', repositoryfiles[0])
         self.assertEqual('project1/src/.gitignore', repositoryfiles[1])
         self.assertEqual('project1/src/sub/.gitignore', repositoryfiles[2])
Esempio n. 16
0
 def test_splitoutputofgitstatusz(self):
     with open(
             testhelper.getrelativefilename(
                 './resources/test_ignore_git_status_z.txt'), 'r') as file:
         repositoryfiles = Commiter.splitoutputofgitstatusz(
             file.readlines())
         self.assertEqual(15, len(repositoryfiles))
         self.assertEqual('project1/src/tobedeleted.txt',
                          repositoryfiles[0])
         self.assertEqual('project2/src/taka.txt', repositoryfiles[1])
         self.assertEqual(
             'project1/src/taka.txt',
             repositoryfiles[2])  # rename continuation would bite here
         self.assertEqual('project2/src/takatuka.txt', repositoryfiles[3])
         self.assertEqual('project2/src/tuka.txt', repositoryfiles[4])
         self.assertEqual('project1/src/sub/kling -- klong.zip',
                          repositoryfiles[5])
         self.assertEqual('project1/src/sub/kling :and: klong.zip',
                          repositoryfiles[6])
         self.assertEqual('project1/src/sub/kling ;and; klong.zip',
                          repositoryfiles[7])
         self.assertEqual('project1/src/sub/kling >and< klong.zip',
                          repositoryfiles[8])
         self.assertEqual('project1/src/sub/kling \\and\\ klong.zip',
                          repositoryfiles[9])
         self.assertEqual('project1/src/sub/kling |and| klong.zip',
                          repositoryfiles[10])
         self.assertEqual('project1/src/sub/klingklong.zip',
                          repositoryfiles[11])
         self.assertEqual('project1/src/sub/.jazzignore',
                          repositoryfiles[12])
         self.assertEqual('project1/src/.gitignore', repositoryfiles[13])
         self.assertEqual('project1/src/sub/.gitignore',
                          repositoryfiles[14])
Esempio n. 17
0
 def test_getcommentwithprefix_enabled_commitisattached_shouldreturnwithprefix(
         self):
     prefix = "APREFIX-"
     configuration.config = Builder().setcommitmessageprefix(prefix)
     comment = "1337: Upgrade to Wildfly - A comment"
     expectedcomment = prefix + comment
     self.assertEqual(expectedcomment,
                      Commiter.getcommentwithprefix(comment))
Esempio n. 18
0
 def is_user_aborting(change):
     shouter.shout("Last executed command: \n" + Changes.latest_accept_command)
     shouter.shout("Apropriate git commit command \n" + Commiter.getcommitcommand(change))
     reallycontinue = "Do you want to continue? Y for continue, any key for abort"
     if input(reallycontinue).lower() == "y":
         return True
     else:
         sys.exit("Please check the output/log and rerun program with resume")
Esempio n. 19
0
 def test_getcommentwithprefix_enabled_commitisattached_containsspecialchars_shouldreturnwithprefix(
         self):
     prefix = "PR-"
     configuration.config = Builder().setcommitmessageprefix(prefix)
     comment = "1338: VAT: VAT-Conditions defined with 0 % and 0 amount - reverse"
     expectedcomment = prefix + comment
     self.assertEqual(expectedcomment,
                      Commiter.getcommentwithprefix(comment))
Esempio n. 20
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. 21
0
 def test_splitoutputofgitstatusz_filterprefix_A(self):
     with open(
             testhelper.getrelativefilename(
                 './resources/test_ignore_git_status_z.txt'), 'r') as file:
         repositoryfiles = Commiter.splitoutputofgitstatusz(
             file.readlines(), 'A  ')
         self.assertEqual(1, len(repositoryfiles))
         self.assertEqual('project1/src/tobedeleted.txt',
                          repositoryfiles[0])
Esempio n. 22
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. 23
0
 def test_handleignore_local_jazzignore_expect_new_gitignore(self):
     with testhelper.mkchdir("aFolder") as folder:
         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}")
         expectedlines = ["\n","/*.pyc\n"]
         gitignore = subfolder + os.sep + ".gitignore"
         self.assertFalse(os.path.exists(gitignore))
         Commiter.handleignore()
         self.assertTrue(os.path.exists(gitignore))
         gitignorelines = []
         with open(gitignore, 'r') as localgitignore:
             gitignorelines = localgitignore.readlines()
         self.assertEqual(expectedlines, gitignorelines)
Esempio n. 24
0
 def test_handleignore_local_jazzignore_expect_empty_gitignore(self):
     with testhelper.mkchdir("aFolder") as folder:
         configuration.config = Builder().setworkdirectory(folder).setgitreponame("test.git").build()
         Initializer().createrepo()
         subfolder = "aSubFolder"
         os.mkdir(subfolder)
         gitignore = subfolder + os.sep + ".gitignore"
         with open(gitignore, 'w') as localgitignore:
             localgitignore.write('\n')
             localgitignore.write("/*.pyc")
         jazzignore = subfolder + os.sep + ".jazzignore"
         with open(jazzignore, 'w') as testjazzignore:
             testjazzignore.write("# my ignores are empty\n")
         Commiter.handleignore()
         self.assertTrue(os.path.exists(gitignore))
         gitignorelines = []
         with open(gitignore, 'r') as localgitignore:
             gitignorelines = localgitignore.readlines()
         self.assertEqual(0, len(gitignorelines))
Esempio n. 25
0
 def test_splitoutputofgitstatusz_filterprefix_double_question(self):
     with open(testhelper.getrelativefilename('./resources/test_ignore_git_status_z.txt'), 'r') as file:
         repositoryfiles = Commiter.splitoutputofgitstatusz(file.readlines(), '?? ')
         self.assertEqual(7, len(repositoryfiles))
         self.assertEqual('project1/src/sub/kling -- klong.zip', repositoryfiles[0])
         self.assertEqual('project1/src/sub/kling :and: klong.zip', repositoryfiles[1])
         self.assertEqual('project1/src/sub/kling ;and; klong.zip', repositoryfiles[2])
         self.assertEqual('project1/src/sub/kling >and< klong.zip', repositoryfiles[3])
         self.assertEqual('project1/src/sub/kling \\and\\ klong.zip', repositoryfiles[4])
         self.assertEqual('project1/src/sub/kling |and| klong.zip', repositoryfiles[5])
         self.assertEqual('project1/src/sub/klingklong.zip', repositoryfiles[6])
Esempio n. 26
0
 def test_translatejazzignore(self):
     with open(
             testhelper.getrelativefilename('./resources/test_.jazzignore'),
             'r') as jazzignore:
         inputlines = jazzignore.readlines()
     with open(
             testhelper.getrelativefilename('./resources/test_.gitignore'),
             'r') as gitignore:
         expectedlines = gitignore.readlines()
     self.assertEqual(expectedlines,
                      Commiter.translatejazzignore(inputlines))
Esempio n. 27
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. 28
0
 def test_handleignore_global_extensions(self):
     with testhelper.mkchdir("aFolder") as folder:
         # create test repo
         configuration.config = Builder().setworkdirectory(folder).setgitreponame("test.git").setignorefileextensions(".zip; .jar").build()
         ignore = ".gitignore"
         Initializer().createrepo()
         # simulate addition of .zip and .jar files
         zip = "test.zip"
         with open(zip, 'w') as testzip:
             testzip.write("test zip content")
         jar = "test.jar"
         with open(jar, 'w') as testjar:
             testjar.write("test jar content")
         # do the filtering
         Commiter.handleignore()
         # check output of .gitignore
         with open(ignore, 'r') as gitIgnore:
             lines = gitIgnore.readlines()
             self.assertEqual(2, len(lines))
             lines.sort()
             # the ignore should not be recursive:
             self.assertEqual('/' + jar, lines[0].strip())
             self.assertEqual('/' + zip, lines[1].strip())
Esempio n. 29
0
 def test_splitoutputofgitstatusz(self):
     with open(testhelper.getrelativefilename('./resources/test_ignore_git_status_z.txt'), 'r') as file:
         repositoryfiles = Commiter.splitoutputofgitstatusz(file.readlines())
         self.assertEqual(15, len(repositoryfiles))
         self.assertEqual('project1/src/tobedeleted.txt', repositoryfiles[0])
         self.assertEqual('project2/src/taka.txt', repositoryfiles[1])
         self.assertEqual('project1/src/taka.txt', repositoryfiles[2]) # rename continuation would bite here
         self.assertEqual('project2/src/takatuka.txt', repositoryfiles[3])
         self.assertEqual('project2/src/tuka.txt', repositoryfiles[4])
         self.assertEqual('project1/src/sub/kling -- klong.zip', repositoryfiles[5])
         self.assertEqual('project1/src/sub/kling :and: klong.zip', repositoryfiles[6])
         self.assertEqual('project1/src/sub/kling ;and; klong.zip', repositoryfiles[7])
         self.assertEqual('project1/src/sub/kling >and< klong.zip', repositoryfiles[8])
         self.assertEqual('project1/src/sub/kling \\and\\ klong.zip', repositoryfiles[9])
         self.assertEqual('project1/src/sub/kling |and| klong.zip', repositoryfiles[10])
         self.assertEqual('project1/src/sub/klingklong.zip', repositoryfiles[11])
         self.assertEqual('project1/src/sub/.jazzignore', repositoryfiles[12])
         self.assertEqual('project1/src/.gitignore', repositoryfiles[13])
         self.assertEqual('project1/src/sub/.gitignore', repositoryfiles[14])
Esempio n. 30
0
 def test_CopyBranch_TargetAlreadyExist_ShouldFail(self):
     with testhelper.createrepo(folderprefix="gitfunctionstestcase_"):
         branchname = "hello"
         Commiter.branch(branchname)
         self.assertFalse(Commiter.copybranch("master", branchname) is 0)
Esempio n. 31
0
 def test_translatejazzignore(self):
     with open(testhelper.getrelativefilename('./resources/test_.jazzignore'), 'r') as jazzignore:
         inputlines = jazzignore.readlines()
     with open(testhelper.getrelativefilename('./resources/test_.gitignore'), 'r') as gitignore:
         expectedlines = gitignore.readlines()
     self.assertEqual(expectedlines, Commiter.translatejazzignore(inputlines))
Esempio n. 32
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. 33
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")
Esempio n. 34
0
 def test_getcommentwithprefix_enabled_commitisnotattachedtoanworkitem_shouldreturncommentwithoutprefix(self):
     configuration.config = Builder().setcommitmessageprefix("PR-")
     comment = "US1337: Fix some problems"
     self.assertEqual(comment, Commiter.getcommentwithprefix(comment))
Esempio n. 35
0
 def test_getcommentwithprefix_disabled_commitisattached_shouldreturncommentwithoutprefix(self):
     configuration.config = Builder().setcommitmessageprefix("")
     comment = "1337: Upgrade to Wildfly - A comment"
     self.assertEqual(comment, Commiter.getcommentwithprefix(comment))
Esempio n. 36
0
 def test_getcommentwithprefix_enabled_commitisattached_containsspecialchars_shouldreturnwithprefix(self):
     prefix = "PR-"
     configuration.config = Builder().setcommitmessageprefix(prefix)
     comment = "1338: VAT: VAT-Conditions defined with 0 % and 0 amount - reverse"
     expectedcomment = prefix + comment
     self.assertEqual(expectedcomment, Commiter.getcommentwithprefix(comment))
Esempio n. 37
0
 def test_getcommentwithprefix_enabled_commitisattached_shouldreturnwithprefix(self):
     prefix = "APREFIX-"
     configuration.config = Builder().setcommitmessageprefix(prefix)
     comment = "1337: Upgrade to Wildfly - A comment"
     expectedcomment = prefix + comment
     self.assertEqual(expectedcomment, Commiter.getcommentwithprefix(comment))
Esempio n. 38
0
 def test_checkbranchname_unquoted_expect_invalid(self):
     with testhelper.createrepo(folderprefix="gitfunctionstestcase_"):
         self.assertEqual(False, Commiter.checkbranchname("master pflaster"),
                          "master pflaster should not be a valid branch name")
Esempio n. 39
0
 def test_checkbranchname_expect_valid(self):
     with testhelper.createrepo(folderprefix="gitfunctionstestcase_"):
         self.assertEqual(True, Commiter.checkbranchname("master"), "master should be a valid branch name")
Esempio n. 40
0
 def test_splitoutputofgitstatusz_filterprefix_A(self):
     with open(testhelper.getrelativefilename('./resources/test_ignore_git_status_z.txt'), 'r') as file:
         repositoryfiles = Commiter.splitoutputofgitstatusz(file.readlines(), 'A  ')
         self.assertEqual(1, len(repositoryfiles))
         self.assertEqual('project1/src/tobedeleted.txt', repositoryfiles[0])
Esempio n. 41
0
 def test_restore_shed_gitignore_without_sibling_jazzignore(self, shellmock):
     with open(testhelper.getrelativefilename('./resources/test_ignore_git_status_z.txt'), 'r') as file:
         with patch('os.path.exists', return_value=True): # answer inquries for sibling .jazzignore with False
             Commiter.restore_shed_gitignore(file.readlines())
             calls = [] # if there are no siblings, we are not allowed to checkout
             shellmock.assert_has_calls(calls)
Esempio n. 42
0
 def test_restore_shed_gitignore_with_sibling_jazzignore(self, shellmock):
     with open(testhelper.getrelativefilename('./resources/test_ignore_git_status_z.txt'), 'r') as file:
         with patch('os.path.exists', return_value=True): # answer inquries for sibling .jazzignore with True
             Commiter.restore_shed_gitignore(file.readlines())
             calls = [call.execute('git checkout -- project1/src/.gitignore'), call.execute('git checkout -- project1/src/sub/.gitignore')]
             shellmock.assert_has_calls(calls)