1 | function [rev,repo,workingcopy] = aedes_revision() |
---|
2 | % AEDES_REVISION - Returns the current revision of Aedes |
---|
3 | % |
---|
4 | % |
---|
5 | % Synopsis: |
---|
6 | % [rev,repo,workingcopy] = aedes_revision; |
---|
7 | % |
---|
8 | % Description: |
---|
9 | % |
---|
10 | % Examples: |
---|
11 | % |
---|
12 | % See also: |
---|
13 | % |
---|
14 | |
---|
15 | % This function is a part of Aedes - A graphical tool for analyzing |
---|
16 | % medical images |
---|
17 | % |
---|
18 | % Copyright (C) 2006 Juha-Pekka Niskanen <Juha-Pekka.Niskanen@uku.fi> |
---|
19 | % |
---|
20 | % Department of Physics, Department of Neurobiology |
---|
21 | % University of Kuopio, FINLAND |
---|
22 | % |
---|
23 | % This program may be used under the terms of the GNU General Public |
---|
24 | % License version 2.0 as published by the Free Software Foundation |
---|
25 | % and appearing in the file LICENSE.TXT included in the packaging of |
---|
26 | % this program. |
---|
27 | % |
---|
28 | % This program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
---|
29 | % WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
---|
30 | |
---|
31 | |
---|
32 | rev = []; |
---|
33 | repo = ''; |
---|
34 | |
---|
35 | % Get path to the svn working copy |
---|
36 | fname= mfilename('fullpath'); |
---|
37 | [fp,fn,fe] = fileparts(fname); |
---|
38 | workingcopy = [fp,filesep]; |
---|
39 | |
---|
40 | % Check if working copy is under version control. |
---|
41 | if ~(exist([workingcopy,'.svn'])==7) |
---|
42 | rev = '$Revision: 214 $'; |
---|
43 | rev = str2num(rev(12:end-2)); |
---|
44 | return |
---|
45 | end |
---|
46 | |
---|
47 | % Check the current repository and revision |
---|
48 | if isunix |
---|
49 | s = []; |
---|
50 | w = []; |
---|
51 | [s,w] = unix(['svn info "',fp,'"']); |
---|
52 | if isempty(w) |
---|
53 | return |
---|
54 | end |
---|
55 | elseif ispc |
---|
56 | s = []; |
---|
57 | w = []; |
---|
58 | [s,w] = dos(['svn info "',fp,'"']); |
---|
59 | if isempty(w) |
---|
60 | return |
---|
61 | end |
---|
62 | else |
---|
63 | |
---|
64 | end |
---|
65 | |
---|
66 | % Scan the lines from the output |
---|
67 | C=textscan(w,'%s','delimiter','\n'); |
---|
68 | if ~isempty(C) |
---|
69 | C=C{:}; |
---|
70 | else |
---|
71 | return |
---|
72 | end |
---|
73 | |
---|
74 | % Get URL line |
---|
75 | url_ind = find(strncmpi(C,'URL:',4)); |
---|
76 | if ~isempty(url_ind) |
---|
77 | url_str = C{url_ind}(6:end); |
---|
78 | else |
---|
79 | return |
---|
80 | end |
---|
81 | repo = url_str; |
---|
82 | |
---|
83 | % Get revision line |
---|
84 | rev_ind = find(strncmpi(C,'Revision:',4)); |
---|
85 | if ~isempty(rev_ind) |
---|
86 | rev_str = C{rev_ind}; |
---|
87 | else |
---|
88 | return |
---|
89 | end |
---|
90 | rev=str2num(rev_str(11:end)); |
---|
91 | |
---|
92 | % The next comment line is changed in every commit by the svncommit |
---|
93 | % bash-script every time it is called so that this file "aedes_revision.m" is |
---|
94 | % always in the list of committed files. DO NOT EDIT THE NEXT LINE!!! |
---|
95 | % - Svn Hook - |
---|