Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
Transcription Save Script
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Christophe Bradley Smith
Transcription Save Script
Commits
db86113f
Commit
db86113f
authored
2 months ago
by
Christophe Bradley Smith
Browse files
Options
Downloads
Patches
Plain Diff
Added Git version check
parent
6c676125
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
SaveTranscriptions.m
+46
-7
46 additions, 7 deletions
SaveTranscriptions.m
with
46 additions
and
7 deletions
SaveTranscriptions.m
+
46
−
7
View file @
db86113f
...
@@ -2,6 +2,8 @@
...
@@ -2,6 +2,8 @@
% Prepare work space
% Prepare work space
clc
clc
checkVersion
()
% Check for miscelaneous transcriptions in the work space
% Check for miscelaneous transcriptions in the work space
miscLS
=
who
(
'-regexp'
,
'^ls.*[0-9]'
);
miscLS
=
who
(
'-regexp'
,
'^ls.*[0-9]'
);
newLS
=
CheckmiscLS
(
miscLS
);
newLS
=
CheckmiscLS
(
miscLS
);
...
@@ -108,11 +110,48 @@ end
...
@@ -108,11 +110,48 @@ end
end
end
%% For testing
%% Git managment
% load('C:\Users\chris\Box\Nelson Lab Data\Other Data\NTAud Transcription\Transcript_OrigAudio_AudSentStim.mat', 'lss');
function
checkVersion
()
% test = load('C:\Users\chris\Box\Nelson Lab Data\Other Data\NTAud Transcription\Transcript_Version2_AudSent.mat');
% Check if the current directory is a Git repository
% ls = test.lss;
if
~
isGitRepository
()
error
(
'This is not a Git repository.'
);
end
% Fetch the latest changes from the remote repository
system
(
'git fetch origin'
);
% Get the current branch name
[
~
,
currentBranch
]
=
system
(
'git rev-parse --abbrev-ref HEAD'
);
currentBranch
=
strtrim
(
currentBranch
);
% Get the local and remote commit hashes
localCommit
=
getGitCommitHash
();
remoteCommit
=
getRemoteCommit_hash
(
currentBranch
);
% Compare the local and remote commits
if
strcmp
(
localCommit
,
remoteCommit
)
disp
(
'Your local branch is up-to-date with the remote branch.'
);
else
disp
(
'WARNING: Your local branch is out of date with the remote.'
);
disp
([
'Local commit: '
localCommit
]);
disp
([
'Remote commit: '
remoteCommit
]);
disp
(
'Please run "git pull" to update your local code.'
);
end
end
function
isGit
=
isGitRepository
()
% Check if the current directory is a Git repository by checking for the existence of a .git directory
isGit
=
exist
(
'.git'
,
'dir'
)
==
7
;
end
function
commitHash
=
getGitCommitHash
()
% Get the commit hash of the current branch locally
[
~
,
commitHash
]
=
system
(
'git rev-parse HEAD'
);
commitHash
=
strtrim
(
commitHash
);
% Remove any trailing newline or space
end
% testpos = 6;
function
remoteCommit
=
getRemoteCommit_hash
(
branch
)
% resetLabelValues(lss, testpos)
% Get the commit hash of the remote branch
% setLabelValue(lss, testpos, 'Words', ls.Labels.Words{testpos}.ROILimits, ls.Labels.Words{testpos}.Value)
[
~
,
remoteCommit
]
=
system
([
'git rev-parse origin/'
branch
]);
remoteCommit
=
strtrim
(
remoteCommit
);
% Remove any trailing newline or space
end
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment