Main Content

refreshSourceControl

Update source control status of project files

Description

example

refreshSourceControl(proj) updates the source control status for all files in the specified project. Use refreshSourceControl to get the latest source control information before querying the SourceControlStatus property on individual files.

If you use listModifiedFiles to find all modified files in the project, you do not need to call refreshSourceControl first.

Examples

collapse all

Open the Times Table App project. Use currentProject to create a project object from the currently loaded project.

matlab.project.example.timesTable
proj = currentProject;

Refresh source control status before querying individual files.

refreshSourceControl(proj)

Get all the project files that are Unmodified. Use the ismember function to get an array of logicals stating which files in the Times Table App project are unmodified. Use the array to get the list of unmodified files.

unmodifiedStatus = ismember([mainProject.Files.SourceControlStatus], ...
    matlab.sourcecontrol.Status.Unmodified);
mainProject.Files(unmodifiedStatus)
ans = 
  1×9 ProjectFile array with properties:

    Path
    Labels
    Revision
    SourceControlStatus

Input Arguments

collapse all

Project, specified as a matlab.project.Project object. Use currentProject to create a project object from the currently loaded project.

Introduced in R2019a