diff --git a/@Datamaster/Datamaster.m b/@Datamaster/Datamaster.m index 66f7fca..8049371 100644 --- a/@Datamaster/Datamaster.m +++ b/@Datamaster/Datamaster.m @@ -31,6 +31,33 @@ % Get a list of Details and Channels that have been logged dm.updateDetails; dm.updateChannels; + + %% Check for Updates - But Only once per session + persistent flagChecked + if isempty(flagChecked) + %Move to the Datamaster folder + savedCd = cd; cd(Datamaster.getPath); + + %Fetch updates from remote + [success, ~] = system('git fetch'); + assert(success==0, 'Error fetching updates from remote'); + + %Check Current Status + [success, str] = system('git status'); + assert(success==0, 'Error reading git repo status'); + + %Get status + status = regexpi(str, 'Your branch is behind ''(.+)'' by (\d+)', 'tokens'); + + %Report to user + if ~isempty(status) + warning(['Updates are avaliable. ',... + 'Run Datamaster Setup to Update']); + end + + %Return to original directory + cd(savedCd); flagChecked = true; + end end %% Small Public Methods -> Move externally if it grows