source: aedes_check_updates.m

Last change on this file was 80, checked in by tjniskan, 9 years ago
  • Changed the historical "an2_" prefix to "aedes_" in all files. NOTE:

Any script or function relying to Aedes functions will be broken
because of this. Just do a search/replace from "an2_" to "aedes_" in
your files and all should be well...

  • Changed the name of an2_readtab.m to a more informative

aedes_readphasetable.m

  • Property svn:executable set to *
File size: 2.6 KB
Line 
1function [isUpdateAvailable,HeadRev,WorkingCopyRev,error_msg]=aedes_check_updates()
2% AEDES_CHECK_UPDATES - Check if Aedes updates are available
3%
4% Synopsis:
5%       [isUpdateAvailable,HeadRev,WorkingCopyRev] = aedes_check_updates()
6%
7% Description:
8%       Checks if there are updates available for Aedes. The
9%       "isUpdateAvailable" output argument is true if the head revision number
10%   in SVN repository is larger than working copy revision. If the
11%   "HeadRev" output argument is -1, there is a problem with the network.
12%   If "HeadRev" is empty, there is a problem running SVN commands.
13%
14% Examples:
15%       
16%
17% See also:
18%       AEDES, AEDES_UPDATE
19
20% This function is a part of Aedes - A graphical tool for analyzing
21% medical images
22%
23% Copyright (C) 2006 Juha-Pekka Niskanen <Juha-Pekka.Niskanen@uku.fi>
24%
25% Department of Physics, Department of Neurobiology
26% University of Kuopio, FINLAND
27%
28% This program may be used under the terms of the GNU General Public
29% License version 2.0 as published by the Free Software Foundation
30% and appearing in the file LICENSE.TXT included in the packaging of
31% this program.
32%
33% This program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
34% WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
35
36
37
38isUpdateAvailable = false;
39HeadRev = [];
40error_msg = '';
41
42% Get current revision and repository URL
43[rev,repo,workingcopy] = aedes_revision;
44if isempty(repo)
45  WorkingCopyRev = rev;
46  return
47end
48WorkingCopyRev = rev;
49
50% Get head repository revision
51[HeadRev,msg]=l_GetHeadRevision(repo);
52if isempty(HeadRev)
53  % Something wrong with running SVN commands. Perhaps SVN is not
54  % installed? Network problems?
55  error_msg = msg;
56else
57  if rev<HeadRev
58    isUpdateAvailable = true;
59  end
60end
61 
62 
63  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
64  % Get Head Repository Revision
65  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
66  function [HeadRev,msg]=l_GetHeadRevision(repo_url)
67 
68  HeadRev = [];
69  msg = '';
70 
71  % Try to determine the head revision in svn
72  if isunix
73    % Unix/Linux
74    [s,w] = unix(['svn info ',repo_url]);
75    if s~=0
76      msg=w;
77      return
78    end
79  elseif ispc
80    % Windows
81    [s,w] = dos(['svn info ',repo_url]);
82    if s~=0
83      msg=w;
84      return
85    end
86  else
87    % Mac OS X
88    [s,w] = unix(['svn info ',repo_url]);
89    if s~=0
90      msg=w;
91      return
92    end
93  end
94 
95  % Scan the lines from the output
96  C=textscan(w,'%s','delimiter','\n');
97  if ~isempty(C)
98    C=C{:};
99  else
100    return
101  end
102 
103  % Get revision line
104  rev_ind = find(strncmpi(C,'Revision:',4));
105  if ~isempty(rev_ind)
106    rev_str = C{rev_ind};
107  else
108    return
109  end
110  HeadRev=str2num(rev_str(11:end));
111 
112 
Note: See TracBrowser for help on using the repository browser.

Powered by Trac 1.0.9.Copyright © Juha-Pekka Niskanen 2008