Beispiel #1
0
    def test_get_files_changed_single_files(self):
        # create a repo
        git_access.create_repo(self.basedir + "/" + self.reponame)

        # apply a change to a file
        filesChanged = [self.test_files[0]]
        os.system("echo \"updated\" > " + filesChanged[0])
        
        self.assertEqual(git_access.get_files_changed(), filesChanged)
Beispiel #2
0
    def test_commit_get_file_version_single_file(self):
        # create a repo
        git_access.create_repo(self.basedir + "/" + self.reponame)

        # apply a change to a file
        fileChanged = self.test_files[0]
        os.system("echo \"updated\" > " + fileChanged)

        commitId = git_access.commit([fileChanged], "update file")
        
        self.assertEqual(git_access.get_file_version(commitId, fileChanged), "updated\n")
Beispiel #3
0
    def test_get_committed_files_multi_file(self):
        # create a repo
        git_access.create_repo(self.basedir + "/" + self.reponame)

        # apply a change to a file
        filesChanged = [self.test_files[0],self.test_files[1]]
        os.system("echo \"updated\" > " + filesChanged[0])
        os.system("echo \"updated\" > " + filesChanged[1])
        
        commitId = git_access.commit(filesChanged, "update file")

        self.assertEqual(git_access.get_committed_files(commitId), filesChanged)
Beispiel #4
0
    def test_commit_get_file_version_multi_files_single_commit(self):
        # create a repo
        git_access.create_repo(self.basedir + "/" + self.reponame)

        # apply a change to a file
        filesChanged = [self.test_files[0],self.test_files[1]]
        os.system("echo \"updated1\" > " + filesChanged[0])
        os.system("echo \"updated2\" > " + filesChanged[1])

        commitId = git_access.commit(filesChanged, "update file")
        
        self.assertEqual(git_access.get_file_version(commitId, filesChanged[0]), "updated1\n")
        self.assertEqual(git_access.get_file_version(commitId, filesChanged[1]), "updated2\n")
Beispiel #5
0
    def test_get_file_version_history(self):
        # create a repo
        git_access.create_repo(self.basedir + "/" + self.reponame)

        # apply a change to a file
        file_changed = self.test_files[0]
        os.system("echo \"updated\" > " + file_changed)
        
        # commit the change
        git_access.commit([file_changed], "update file")

        # TODO: figure out how to create the timestamp to test using assertEquals
        print(git_access.get_file_version_history(file_changed))
Beispiel #6
0
 def create_new_project(self):
     # opens a file dialog which allows only selection of directories
     res = cmds.fileDialog2(fileMode=3, dialogStyle=2, okCaption='Select', caption='Select Folder for Project')
     if res is None:
         # they cancelled the file picker
         return
     # get the last thing after a / or a \, which is the name of the directory
     project_name = re.split(r'[/\\]', res[0])[-1]
     # check to make sure a project with the same name doesn't already exist (this is not allowed)
     for item in self.project_list:
         if (item[0] == project_name):
            cmds.warning("A project with name '" + item[0] + "' already exisits")
            return
     
     # add the new project to the list and re-populate    
     self.project_list.append((project_name, res[0]))
     config_access.add_config(project_name, res[0])
     self.populate_project_menu()
     self.set_file_model_path(project_name, res[0])
     git_access.create_repo(self.project_path)
     self.populate_commits_tab()
Beispiel #7
0
 def test_create_repo_reg_folder_is_repo(self):
     git_access.create_repo(self.basedir + "/" + self.reponame)
     self.assertEqual(git_access.create_repo(self.basedir + "/" + self.reponame), 0)
Beispiel #8
0
 def test_create_repo_empty_folder_not_repo(self):
     self.assertEqual(git_access.create_repo(self.basedir + "/" + self.empty_reponame), 0)
Beispiel #9
0
 def test_get_files_changed_no_changes(self):
     # create a repo
     git_access.create_repo(self.basedir + "/" + self.reponame)
     
     self.assertEqual(git_access.get_files_changed(), [])
Beispiel #10
0
 def project_menu_item_clicked(self, item):           
     self.set_file_model_path(item[0], item[1])    
     git_access.create_repo(item[1])
     self.populate_commits_tab()