필터 지우기
필터 지우기

Is it possible to ''SVN update'' command that can be used by m-files?

조회 수: 6 (최근 30일)
Arpeet Sojitra
Arpeet Sojitra 2020년 5월 11일
답변: Sai Ravi Tej Y 2022년 1월 12일
Is there any possibility "SVN-update from repository" command that can be used from m-file?

답변 (1개)

Sai Ravi Tej Y
Sai Ravi Tej Y 2022년 1월 12일
You can use the 'system' function of MatLab along with SVN commands, in an m-file.
Below piece of code can be used to check if there is really any updates on the svn folders, from your previuos update and updates the svn folder accordingly.
svnPath.localFolder = 'path to your svn local folder';
svnPath.repoFolder = 'URL to your svn repo folder';
%check the current HEAD revision of the repo folder
[~, url_rev] = system(['svn info ', svnPath.repoFolder, ' -r HEAD --show-item revision']);
%check the current revision of your local svn folder
[~, local_rev] = system(['svn info ', svnPath.localFolder, ' --show-item revision']);
if str2double(url_rev) ~= str2double(local_rev) % If revisions are not same
% Update the svn for the new change
[updt_sts,updt_msg] = system(['svn update ', svnPath.localFolder);
% Return a zero if the command run successfully and svn get updated
if updt_sts == 0
% Display what's actually updated
disp(updt_msg);
end
else % If revisions are same
fprintf('No change in SVN since last update\n');
end

카테고리

Help CenterFile Exchange에서 Source Control Integration에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by