2 * This file is part of the vng project
3 * Copyright (C) 2008 Thomas Zander <tzander@trolltech.com>
4 * Copyright (C) 2003-2005 David Roundy
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #include "Initialize.h"
22 #include "GitRunner.h"
27 Initialize::Initialize()
28 :AbstractCommand("initialize")
32 QString
Initialize::argumentDescription() const
37 QString
Initialize::commandDescription() const
39 return "Generally you will only call initialize once for each project you work on,\n"
40 "and calling it is just about the first thing you do. Just make sure\n"
41 "you are in the main directory of the project, and initialize will set up all\n"
42 "the directories and files darcs needs in order to start keeping track of\n"
43 "revisions for your project.\n";
46 AbstractCommand::ReturnCodes
Initialize::run()
49 QStringList arguments
;
50 arguments
<< "init" << "--quiet";
51 GitRunner
runner(git
, arguments
);
52 runner
.start(GitRunner::WaitForStandardError
);
55 qint64 lineSize
= Vng::readLine(&git
, buf
, sizeof(buf
));
56 git
.waitForFinished();
57 if (git
.exitCode() != 0) {
58 Logger::error() << "Failed to initialize the repo. Do you have writing rights in the current directory?\n";
59 Logger::info() << "initialize tries to create a directory '.git` in the current directory\n";
61 Logger::debug() << "Git said; " << buf
;