source: aedes_update.m

Last change on this file was 147, checked in by tjniskan, 7 years ago
  • Added support for Windows network paths (
    server\share) to

aedes_juigetfiles.m (Windows only)

  • Added a link for suppressing the license information from printing to

workspace

  • Fixed some uicontrol colors in aedes_headerbrowser.m
  • Changed the buffer size for reading VNMR PROCPAR to 1MB. The

previous buffer size (10kB) was apparently too low for some SWIFT data

  • aedes_killfigs.m now has an option to force close only Aedes-related

figures

  • Updated figure tags for aedes_killfigs.m
  • Added a request for restarting Aedes to the "Update successful" dialog

M aedes_readprocpar.m
M aedes_killfigs.m
M aedes_data_read.m
M aedes_gui_defaults.m
M aedes_resviewer.m
M aedes.m
M aedes_update.m
M aedes_export_gui.m
M aedes_headerbrowser.m
M aedes_revision.m
M aedes_juigetfiles.m
M aedes_errordump.m

  • Property svn:executable set to *
File size: 8.0 KB
Line 
1function done=aedes_update(opt)
2% AEDES_UPDATE - Aedes update tool
3%
4% Synopsis:
5%       done=aedes_update(opt)
6%
7% Description:
8%       
9%
10% Examples:
11%       
12%
13% See also:
14%       AEDES_CHECK_UPDATES, AEDES_REVISION, AEDES
15
16% This function is a part of Aedes - A graphical tool for analyzing
17% medical images
18%
19% Copyright (C) 2006 Juha-Pekka Niskanen <Juha-Pekka.Niskanen@uku.fi>
20%
21% Department of Physics, Department of Neurobiology
22% University of Kuopio, FINLAND
23%
24% This program may be used under the terms of the GNU General Public
25% License version 2.0 as published by the Free Software Foundation
26% and appearing in the file LICENSE.TXT included in the packaging of
27% this program.
28%
29% This program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
30% WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
31
32
33done = false;
34ShowChangeLog = false;
35
36if nargin==0
37  opt = 'semiprompt';
38end
39
40% Check if updates are available
41[isUpdateAvailable,HeadRev,WorkingCopyRev,error_msg]=aedes_check_updates();
42
43if isUpdateAvailable
44  if strcmpi(opt,'noprompt')
45    fprintf(1,'Updating from revision %d to %d\n',...
46      WorkingCopyRev,HeadRev)
47  elseif any(strcmpi(opt,{'prompt','semiprompt'}))
48    % Prompt for updates
49    dialog_str = {'Updates for Aedes are available.',...
50      '',...
51      ['Your current revision: ',num2str(WorkingCopyRev)],...
52      ['The latest revision: ',num2str(HeadRev)],...
53      '',...
54      'Do you want to install updates now?'};
55    resp=questdlg(dialog_str,'Updates available. Install updates now?',...
56      'Yes','No','Yes');
57    if strcmpi(resp,'No')
58      done = [];
59      return
60    end
61    [cwh,txh]=aedes_calc_wait('Installing updates...');
62  end
63elseif isempty(HeadRev)
64  % Something wrong with SVN
65  if strcmpi(opt,'prompt')
66    h=warndlg({'Could not check updates. Do you have hetwork access and is SVN properly installed?','',...
67      'The following error was encountered:','',...
68      error_msg},...
69      'Could not check updates','modal');
70    uiwait(h);
71    return
72  elseif any(strcmpi(opt,{'noprompt','semiprompt'}))
73    fprintf(1,'Could not check updates.\n');
74    fprintf(1,'The following error was encountered:\n');
75    fprintf(1,error_msg);
76    return
77  end
78else
79  % No updates available, Aedes is up-to-date. Don't display anything if
80  % semiprompt mode is selected
81  if strcmpi(opt,'prompt')
82    h=helpdlg('No updates available. Aedes is up-to-date.',...
83      'Aedes up-to-date');
84    uiwait(h);
85  elseif strcmpi(opt,'noprompt')
86    fprintf(1,'No updates available. Aedes is up-to-date.\n');
87  end
88  return
89end
90
91
92% Update to the latest revision
93[fp,fn,fe]=fileparts(mfilename('fullpath'));
94if isunix
95  [s,w]=unix(['svn up "',fp,'"']);
96  C=textscan(w,'%s','delimiter','\n');
97  C=C{:};
98elseif ispc
99  [s,w]=dos(['svn up "',fp,'"']);
100  C=textscan(w,'%s','delimiter','\n');
101  C=C{:};
102else
103  % Mac OSX
104  [s,w]=unix(['svn up "',fp,'"']);
105  C=textscan(w,'%s','delimiter','\n');
106  C=C{:};
107end
108if s~=0
109  try
110    delete(cwh)
111  catch
112  end
113  if any(strcmpi(opt,{'prompt','semiprompt'}))
114    h=errordlg({'Update failed because of following error:',...
115      C{:}},...
116      'Update failed','modal');
117    uiwait(h);
118    return
119  elseif strcmpi(opt,'noprompt')
120    fprintf(1,'\n********************* ERROR ***********************\n')
121    fprintf(1,'Update failed because of following error:\n');
122    fprintf(1,'%s\n',C{:});
123    fprintf(1,'***************************************************\n')
124    return
125  end
126end
127
128try
129  set(txh,'String','Installing updates...done')
130  pause(0.5)
131  delete(cwh)
132catch
133end
134
135
136% Check for conflict or merge
137c_ind = [];
138g_ind = [];
139for ii=1:length(C)
140  if strncmpi(C{ii},'C  ',3)
141    % Conflict
142    c_ind(end+1)=ii;
143  elseif strncmpi(C{ii},'G  ',3)
144    % Merge
145    g_ind(end+1)=ii;
146  end
147end
148
149%%%%%%%%%%%%%%%%%%
150%c_ind = [];
151%g_ind = [];
152%%%%%%%%%%%%%%%%%%
153
154%% Everything went ok ------------------------
155if isempty(c_ind) && isempty(g_ind)
156  % Update successful
157  if any(strcmpi(opt,{'prompt','semiprompt'}))
158    resp=questdlg({['Updated successfully to revision ',num2str(HeadRev),'.'],...
159      'Please close all Aedes windows and restart Aedes.','',...
160      ['You can use "View Details..." the view the changelog.']},...
161      'Update successful','OK','View Details...','View Details...');
162    if strcmpi(resp,'View Details...')
163      ShowChangeLog = true;
164    else
165      ShowChangeLog = false;
166    end
167  elseif strcmpi(opt,'noprompt')
168    fprintf(1,'Updated successfully to revision %d\n',HeadRev);
169   
170    % Echo the update information to the command window
171    fprintf(1,'%s\n',C{:});
172    fprintf(1,'Update complete.\n');
173  end
174 
175  % Clear functions just in case...
176  clear functions
177 
178  done = true;
179 
180  % Show the Change log and information
181  if ShowChangeLog
182    if isunix
183      [s,w] = unix(sprintf('svn log "%s" -r%d:%d',...
184        fp,HeadRev,WorkingCopyRev+1));
185      if s~=0
186       
187      end
188    elseif ispc
189      [s,w] = dos(sprintf('svn log "%s" -r%d:%d',...
190        fp,HeadRev,WorkingCopyRev+1));
191      if s~=0
192       
193      end
194    else
195     
196    end
197    W = textscan(w,'%s','delimiter','\n');
198    W=W{:};
199    web(['text://',...
200      '<title>Update information and changelog</title>',...
201      sprintf('<h1>Updated Aedes successfully to revision %d</h1>',...
202      HeadRev),...
203      sprintf('<h2>Updated files from revision %d to %d</h2>',...
204      WorkingCopyRev,HeadRev),...
205      sprintf('%s<br>',C{:}),...
206      '<br>',...
207      sprintf('<h2>Changelog from revision %d to %d</h2>',...
208      WorkingCopyRev,HeadRev),...
209      sprintf('%s<br>',W{:})]);
210  end
211 
212  % Merges and/or conflicts detected ----------
213elseif ~isempty(c_ind) || ~isempty(g_ind)
214 
215  % Echo the update information to the command window
216  fprintf(1,'%s\n',C{:});
217  fprintf(1,'Update complete.\n');
218 
219  % List of files with conflicts
220  c_files = C(c_ind);
221 
222  % List of files with merges
223  g_files = C(g_ind);
224 
225  % Update successful but with conflicts and/or merges
226  if isempty(c_ind)
227    % Only merges
228    fprintf(1,'\n********************* WARNING *********************\n')
229    fprintf(1,['Updated to revision %d but with errors.\n',...
230      'The following files contain MERGES:\n'],HeadRev)
231    fprintf(1,'%s\n',g_files{:})
232    fprintf(1,'***************************************************\n')
233    if any(strcmpi(opt,{'prompt','semiprompt'}))
234      h = warndlg({['Updated to revision ',num2str(HeadRev),' but with errors.'],...
235        '',...
236        'The following files contain MERGES:',...
237        '',...
238        g_files{:},...
239        ''},...
240        'Updated with errors','modal');
241      uiwait(h);
242    end
243   
244  elseif isempty(g_ind)
245    % Only conflicts
246    fprintf(1,'\n********************* WARNING *********************\n')
247    fprintf(1,['Updated to revision %d but with errors.\n',...
248      'The following files contain CONFLICTS:\n'],HeadRev)
249    fprintf(1,'%s\n',g_files{:})
250    fprintf(1,'***************************************************\n')
251    if any(strcmpi(opt,{'prompt','semiprompt'}))
252      h = warndlg({['Updated to revision ',num2str(HeadRev),' but with errors.'],...
253        '',...
254        'The following files contain CONFLICTS:',...
255        '',...
256        c_files{:},...
257        ''},...
258        'Updated with errors','modal');
259      uiwait(h);
260    end
261   
262  else
263    % Both conflicts and merges
264    fprintf(1,'\n********************* WARNING *********************\n')
265    fprintf(1,['Updated to revision %d but with errors.\n',...
266      'The following files contain CONFLICTS:\n'],HeadRev)
267    fprintf(1,'%s\n',c_files{:})
268    fprintf(1,'\nThe following files contain MERGES:\n')
269    fprintf(1,'%s\n',g_files{:})
270    fprintf(1,'***************************************************\n')
271    if any(strcmpi(opt,{'prompt','semiprompt'}))
272      h = warndlg({['Updated to revision ',num2str(HeadRev),' but with errors.'],...
273        '',...
274        'The following files contain CONFLICTS:',...
275        '',...
276        c_files{:},...
277        '',...
278        'The following files contain MERGES:',...
279        '',...
280        g_files{:},...
281        ''},...
282        'Updated with errors','modal');
283      uiwait(h);
284    end
285  end
286 
287  % Clear functions just in case...
288  clear functions
289 
290  done = true;
291 
292end
Note: See TracBrowser for help on using the repository browser.

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