1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
/***************************************************************************
* Copyright (C) 2004 by Alexander Dymo *
* adymo@tdevelop.org *
* Copyright (C) 2004 *
* Mickael Marchand <marchand@kde.org> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#include "svnintegratordlg.h"
#include "blockingkprocess.h"
#include <kurl.h>
#include <tdeio/jobclasses.h>
#include <tdeio/job.h>
#include <kurlrequester.h>
#include <kdebug.h>
#include <tqradiobutton.h>
#include <tdeio/scheduler.h>
#include <kprocess.h>
#include <tdeversion.h>
#include <tdemessagebox.h>
#include <tdelocale.h>
#include <kdebug.h>
#include <tdeio/netaccess.h>
using namespace TDEIO;
SvnIntegratorDlg::SvnIntegratorDlg( TQWidget *parent, const char *name )
: SvnIntegratorDlgBase( parent, name )
{
repos1->setMode( KFile::Directory );
}
void SvnIntegratorDlg::accept()
{
// to let ioslave know which protocol it should start.
KURL protocolUrl = KURL("kdevsvn+svn://blah/");
KURL servURL( repos1->url() );
if ( servURL.isEmpty() ) return;
kdDebug( 9036 ) << "servURL : " << servURL.prettyURL() << endl;
if ( createProject->isChecked() )
{
KURL::List list;
list << servURL; // project root directory
KURL miscURL = servURL.url();
miscURL.setPath( servURL.path() + "/tags/" );
list << miscURL;
miscURL.setPath( servURL.path() + "/branches/" );
list << miscURL;
miscURL.setPath( servURL.path() + "/trunk/" );
list << miscURL;
TQByteArray parms;
TQDataStream s( parms, IO_WriteOnly );
int cmd = 10; // MKDIR(list)
s << cmd << list;
TDEIO::SimpleJob* job = TDEIO::special( protocolUrl, parms, true );
if( !NetAccess::synchronousRun( job, 0 ) ){
KMessageBox::error( this, i18n("Unable to create project directories on repository") );
return;
}
TQByteArray parms2;
TQDataStream s2( parms2, IO_WriteOnly );
cmd = 5; //IMPORT
servURL.setPath( servURL.path() + "/trunk/" );
s2 << cmd << servURL << KURL::fromPathOrURL( m_projectLocation );
TDEIO::SimpleJob* importJob = TDEIO::special( protocolUrl, parms2, true );
if( !NetAccess::synchronousRun( importJob, 0 ) ){
KMessageBox::error( this, i18n("Unable to import into repository.") );
return;
}
}
//delete the template directory and checkout a fresh one from the server
BlockingTDEProcess *rmproc = new BlockingTDEProcess();
*rmproc << "rm";
*rmproc << "-f" << "-r" << m_projectLocation;
rmproc->start();
delete rmproc;
rmproc = NULL;
TQByteArray parms3;
TQDataStream s3( parms3, IO_WriteOnly );
int cmd2 = 1; //CHECKOUT
int rev = -1;
s3 << cmd2 << servURL << KURL::fromPathOrURL( m_projectLocation ) << rev << TQString( "HEAD" );
SimpleJob *job2 = TDEIO::special( protocolUrl, parms3, true );
if( ! NetAccess::synchronousRun( job2, 0 ) ){
// Checkout failed
KMessageBox::error(this, i18n("Unable to checkout from repository.") );
return;
}
}
void SvnIntegratorDlg::init( const TQString &projectName, const TQString &projectLocation )
{
m_name = projectName;
m_projectLocation = projectLocation;
}
TQWidget *SvnIntegratorDlg::self()
{
return const_cast<SvnIntegratorDlg*>( this );
}
#include "svnintegratordlg.moc"
|