MatrixBerryCore
getrepoparams.m
Go to the documentation of this file.
1 function [urlTypeMarkerStr,urlStr,branchName,revisionStr]=getrepoparams(repoDir)
2 import mxberry.core.throwerror;
3 if nargin==0
4  callerPath=mfilename('fullpath');
5  if isempty(callerPath)%command line
6  repoDir=cd();
7  else
8  repoDir=fileparts(callerPath);
9  end
10 end
11 urlTypeMarkerStr='';
12 try
13  isSvn=mxberry.dev.scm.subversion.issvn(repoDir);
14  if isSvn
15  isGit=false;
16  urlTypeMarkerStr='svnURL';
17  urlStr=mxberry.dev.scm.subversion.svngeturl(repoDir);
18  else
19  isGit=mxberry.dev.scm.git.isgit(repoDir);
20  if isGit
21  urlTypeMarkerStr='gitURL';
22  urlStr=mxberry.dev.scm.git.gitgeturl(repoDir);
23  else
24  throwerror('wrongObjState',...
25  'Files with code should be under either SVN or Git');
26  end
27  end
28 catch
29  isSvn=false;
30  isGit=false;
31  urlTypeMarkerStr='unknownURL';
32  urlStr='unknown';
33 end
34 if isSvn
35  revisionStr=mxberry.dev.scm.subversion.getrevision('ignoreErrors',...
36  true);
37  branchName='unknown';
38 elseif isGit
39  revisionStr=mxberry.dev.scm.git.gitgethash(repoDir);
40  branchName=mxberry.dev.scm.git.gitgetbranch(repoDir);
41 else
42  revisionStr='unversioned';
43  branchName='unknown';
44 end
45 end
function throwerror(in msgTag, in varargin)
THROWERROR works similarly to built-in ERROR function in case when there is no output arguments but s...
function getrepoparams(in repoDir)
GETREPOPARAMS returns generic parameters of SCM repository (currently only git and subversion reposit...