From 32c06824fbd47b4880d5e70fe93ffd2c9450d4ea Mon Sep 17 00:00:00 2001 From: Vladimir Panteleev Date: Mon, 13 Sep 2010 01:27:35 +0300 Subject: [PATCH] Add --no-import option --- wp2git.d | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/wp2git.d b/wp2git.d index 805f312..458c44b 100644 --- a/wp2git.d +++ b/wp2git.d @@ -12,7 +12,7 @@ import litexml; int main(string[] args) { string name; - bool usage; + bool usage, noImport; foreach (arg; args[1..$]) switch (arg) { @@ -20,6 +20,9 @@ int main(string[] args) case "--help": usage = true; break; + case "--no-import": + noImport = true; + break; default: if (name) throw new Exception("Multiple article name arguments"); @@ -33,6 +36,7 @@ int main(string[] args) fwritefln(stderr, "Create a git repository with the history of the specified Wikipedia article."); fwritefln(stderr, "Supported options:"); fwritefln(stderr, " -h --help Display this help"); + fwritefln(stderr, " --no-import Don't invoke ``git fast-import'' and only generate the fast-import data"); return 2; } @@ -76,12 +80,15 @@ int main(string[] args) } write("fast-import-data", data); + if (noImport) + return 0; + if (exists(".git")) throw new Exception("A git repository already exists here!"); system("git init"); system("git fast-import --date-format=rfc2822 < fast-import-data"); -// std.file.remove("fast-import-data"); + std.file.remove("fast-import-data"); system("git reset --hard"); return 0;