+
+ elif id == SVNService.SVN_UPDATE_ALL_ID:
+ wx.GetApp().GetTopWindow().SetCursor(wx.StockCursor(wx.CURSOR_WAIT))
+
+ messageService = wx.GetApp().GetService(MessageService.MessageService)
+ messageService.ShowWindow()
+
+ view = messageService.GetView()
+ view.ClearLines()
+ view.AddLines(_("SVN Update:\n"))
+
+ projects = self.GetCurrentProjects()
+ for project in projects:
+ openDocs = wx.GetApp().GetDocumentManager().GetDocuments()
+ for doc in openDocs:
+ if doc.GetFilename() == project:
+ filenames = doc.GetFiles()[:] # make a copy and sort it.
+ filenames.sort(self.BasenameCaseInsensitiveCompare)
+
+ for filename in filenames:
+ view.AddLines("%s\n" % filename)
+ try:
+ status = self._client.update(filename)
+
+ if status.number > 0:
+ view.AddLines(_("Updated to revision %s\n") % status.number)
+
+ openDocs = wx.GetApp().GetDocumentManager().GetDocuments()
+ for doc in openDocs:
+ if doc.GetFilename() == filename:
+ yesNoMsg = wx.MessageDialog(wx.GetApp().GetTopWindow(),
+ _("Updated file '%s' is currently open. Close it?") % os.path.basename(filename),
+ _("Close File"),
+ wx.YES_NO|wx.CANCEL|wx.ICON_QUESTION)
+ status = yesNoMsg.ShowModal()
+ if status == wx.ID_YES:
+ doc.DeleteAllViews()
+ elif status == wx.ID_NO:
+ pass
+ else: # elif status == wx.CANCEL:
+ wx.GetApp().GetTopWindow().SetCursor(wx.StockCursor(wx.CURSOR_DEFAULT))
+ return True
+ break
+ else:
+ view.AddLines(_("Update failed.\n"))
+
+ except pysvn.ClientError, e:
+ view.AddLines("%s\n" % str(e))
+ wx.MessageBox(str(e), _("SVN Update"), wx.OK | wx.ICON_EXCLAMATION)
+ except:
+ extype, ex, tb = sys.exc_info()
+ view.AddLines("Update failed: (%s) %s\n" % (extype, str(ex)))
+ for line in traceback.format_tb(tb):
+ view.AddLines(line)
+
+ wx.MessageBox(_("Update failed."), _("SVN Update"), wx.OK | wx.ICON_EXCLAMATION)
+
+ wx.GetApp().GetTopWindow().SetCursor(wx.StockCursor(wx.CURSOR_DEFAULT))
+ return True
+
+ elif id == SVNService.SVN_CHECKIN_ALL_ID:
+ filenames = []
+ projects = self.GetCurrentProjects()
+ for project in projects:
+ openDocs = wx.GetApp().GetDocumentManager().GetDocuments()
+ for doc in openDocs:
+ if doc.GetFilename() == project:
+ for filename in doc.GetFiles():
+ if filename not in filenames:
+ filenames.append(filename)
+ filenames.sort(self.BasenameCaseInsensitiveCompare)
+
+ # ask user if dirty files should be saved first
+ openDocs = wx.GetApp().GetDocumentManager().GetDocuments()
+ for filename in filenames:
+ for doc in openDocs:
+ if doc.GetFilename() == filename and doc.IsModified():
+ yesNoMsg = wx.MessageDialog(wx.GetApp().GetTopWindow(),
+ _("'%s' has unsaved modifications. Save it before commit?") % os.path.basename(filename),
+ _("SVN Commit"),
+ wx.YES_NO|wx.CANCEL|wx.ICON_QUESTION)
+ status = yesNoMsg.ShowModal()
+ if status == wx.ID_YES:
+ doc.Save()
+ elif status == wx.ID_NO:
+ pass
+ else: # elif status == wx.CANCEL:
+ return True
+ break
+
+ shortFilenames = []
+ for i, filename in enumerate(filenames):
+ shortFilename = os.path.basename(filename)
+ shortFilenames.append(shortFilename)
+
+ dlg = wx.Dialog(wx.GetApp().GetTopWindow(), -1, _("SVN Commit"))
+
+ sizer = wx.BoxSizer(wx.VERTICAL)
+ sizer.Add(wx.StaticText(dlg, -1, _("Comment:")), 0, wx.ALIGN_CENTER_VERTICAL)
+ commentText = wx.TextCtrl(dlg, -1, size=(250,-1), style=wx.TE_MULTILINE)
+ sizer.Add(commentText, 1, wx.EXPAND|wx.TOP, HALF_SPACE)
+
+ sizer.Add(wx.StaticText(dlg, -1, _("Files:")), 0, wx.ALIGN_CENTER_VERTICAL|wx.TOP, SPACE)
+ fileList = wx.CheckListBox(dlg, -1, choices = shortFilenames)
+ for i in range(fileList.GetCount()):
+ fileList.Check(i, True)
+ sizer.Add(fileList, 0, wx.EXPAND|wx.TOP, HALF_SPACE)
+
+ buttonSizer = wx.BoxSizer(wx.HORIZONTAL)
+ okBtn = wx.Button(dlg, wx.ID_OK)
+ okBtn.SetDefault()
+ buttonSizer.Add(okBtn, 0, wx.RIGHT, HALF_SPACE)
+ buttonSizer.Add(wx.Button(dlg, wx.ID_CANCEL), 0)
+
+ contentSizer = wx.BoxSizer(wx.VERTICAL)
+ contentSizer.Add(sizer, 0, wx.ALL, SPACE)
+ contentSizer.Add(buttonSizer, 0, wx.ALL|wx.ALIGN_RIGHT, SPACE)
+
+ dlg.SetSizer(contentSizer)
+ dlg.Fit()
+ dlg.Layout()
+
+ if dlg.ShowModal() == wx.ID_OK:
+ wx.GetApp().GetTopWindow().SetCursor(wx.StockCursor(wx.CURSOR_WAIT))
+
+ messageService = wx.GetApp().GetService(MessageService.MessageService)
+ messageService.ShowWindow()
+
+ view = messageService.GetView()
+ view.ClearLines()
+ view.AddLines(_("SVN Commit:\n"))
+
+ try:
+ selFilenames = []
+ for i in range(fileList.GetCount()):
+ if fileList.IsChecked(i):
+ selFilenames.append(filenames[i])
+ view.AddLines("%s\n" % filenames[i])
+
+ if len(selFilenames):
+ comment = commentText.GetValue()
+ status = self._client.checkin(selFilenames, comment)
+
+ if status is None:
+ view.AddLines(_("Nothing to commit.\n"))
+ elif status.number > 0:
+ view.AddLines(_("Committed as revision %s.\n") % status.number)
+ else:
+ view.AddLines(_("Commit failed.\n"))
+
+ except pysvn.ClientError, e:
+ view.AddLines("%s\n" % str(e))
+ wx.MessageBox(str(e), _("SVN Commit"), wx.OK | wx.ICON_EXCLAMATION)
+ except:
+ extype, ex, tb = sys.exc_info()
+ view.AddLines("Commit failed: (%s) %s\n" % (extype, str(ex)))
+ for line in traceback.format_tb(tb):
+ view.AddLines(line)
+ wx.MessageBox(_("Commit failed."), _("SVN Commit"), wx.OK | wx.ICON_EXCLAMATION)
+
+ wx.GetApp().GetTopWindow().SetCursor(wx.StockCursor(wx.CURSOR_DEFAULT))
+ dlg.Destroy()
+ return True
+