--- a/include/svncpp/client.hpp +++ b/include/svncpp/client.hpp @@ -514,7 +514,8 @@ const Revision & revisionStart, const Revision & revisionEnd, bool discoverChangedPaths = false, - bool strictNodeHistory = true) throw(ClientException); + bool strictNodeHistory = true, + int limit = 0) throw(ClientException); /** * Produce diff output which describes the delta between --- a/src/log_action.hpp +++ b/src/log_action.hpp @@ -39,6 +39,9 @@ public: LogAction(wxWindow * parent); + virtual bool + Prepare(); + /** * @see Action */ @@ -47,6 +50,9 @@ static bool CheckStatusSel(const svn::StatusSel & statusSel); + +private: + long m_limit; }; #endif --- a/src/log_action.cpp +++ b/src/log_action.cpp @@ -37,20 +37,115 @@ #include "log_action.hpp" #include "log_data.hpp" +class SelectLogDlg:public wxDialog +{ +public: + SelectLogDlg(wxWindow *parent):wxDialog(parent, -1, _("Select log"), wxDefaultPosition, + wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER) + { + InitControls(this); + } + + virtual ~SelectLogDlg() + { + } + + void InitControls (wxWindow * wnd) + { + wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL); + wxFlexGridSizer *grid = new wxFlexGridSizer(2, 2, 5, 0); + + wxTextValidator textValidator(wxFILTER_NUMERIC); + m_limitTextCtrl = new wxTextCtrl(wnd, -1, wxT("20")); + m_limitTextCtrl->SetValidator(textValidator); + m_radioLimit = new wxRadioButton(wnd, -1, _("Limited")); + m_radioAll = new wxRadioButton(wnd, -1, _("All")); + m_radioLimit->SetValue(true); + + grid->Add(m_radioLimit, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, 5); + grid->Add(m_limitTextCtrl, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, 5); + grid->Add(m_radioAll, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, 5); + + mainSizer->Add(grid, 0, wxALL | wxEXPAND, 5); + + wxBoxSizer *buttonSizer = new wxBoxSizer(wxHORIZONTAL); + wxButton *buttonOk = new wxButton(wnd, wxID_OK, _("OK" )); + buttonOk->SetDefault(); + buttonSizer->Add(buttonOk, 0, wxALL, 10); + buttonSizer->Add(new wxButton(wnd, wxID_CANCEL, _("Cancel")), 0, wxALL, 10); + mainSizer->Add(buttonSizer, 0, wxALL | wxCENTER, 5); + + wnd->SetAutoLayout(true); + wnd->SetSizer(mainSizer); + + mainSizer->SetSizeHints(wnd); + mainSizer->Fit(wnd); + } + + void OnOK(wxCommandEvent & event) + { + if (m_radioLimit->GetValue()) + { + wxString str = m_limitTextCtrl->GetValue(); + str.ToLong(&m_limit); + } + else + { + m_limit = 0; + } + wxDialog::EndModal(wxID_OK); + } + + long GetLimit() const + { + return m_limit; + } + +private: + wxTextCtrl *m_limitTextCtrl; + wxRadioButton *m_radioLimit; + wxRadioButton *m_radioAll; + long m_limit; + + DECLARE_EVENT_TABLE() +}; + +BEGIN_EVENT_TABLE(SelectLogDlg, wxDialog) + EVT_BUTTON(wxID_OK, SelectLogDlg::OnOK) +END_EVENT_TABLE() + LogAction::LogAction(wxWindow * parent) - : Action(parent, _("Log"), DONT_UPDATE) + : Action(parent, _("Log"), DONT_UPDATE), m_limit(0) { } bool +LogAction::Prepare() +{ + if (!Action::Prepare ()) + { + return false; + } + + SelectLogDlg dlg(GetParent ()); + if (dlg.ShowModal() != wxID_OK) + { + return false; + } + + m_limit = dlg.GetLimit(); + return true; +} + +bool LogAction::Perform() { svn::Client client(GetContext()); svn::Path target = GetTarget(); const svn::LogEntries * entries = - client.log(target.c_str(), svn::Revision::START, - svn::Revision::HEAD, true, false); + client.log(target.c_str(), svn::Revision::HEAD, + svn::Revision::START, true, false, (int)m_limit); LogData * data = new LogData(entries, target); ActionEvent::Post(GetParent(), TOKEN_LOG, data); --- a/src/svncpp/client_status.cpp +++ b/src/svncpp/client_status.cpp @@ -55,11 +55,11 @@ apr_pool_t * pool) { LogEntries * entries = (LogEntries *) baton; - entries->insert(entries->begin(), LogEntry(rev, author, date, msg)); + entries->push_back(LogEntry(rev, author, date, msg)); if (changedPaths != NULL) { - LogEntry &entry = entries->front(); + LogEntry &entry = entries->back(); for (apr_hash_index_t *hi = apr_hash_first(pool, changedPaths); hi != NULL; @@ -336,13 +336,13 @@ const LogEntries * Client::log(const char * path, const Revision & revisionStart, const Revision & revisionEnd, bool discoverChangedPaths, - bool strictNodeHistory) throw(ClientException) + bool strictNodeHistory, int limit) throw(ClientException) { Pool pool; Targets target(path); LogEntries * entries = new LogEntries(); svn_error_t *error; - int limit = 0; + //int limit = 0; error = svn_client_log2( target.array(pool),