Merge branch 'develop' into debian
This commit is contained in:
commit
c0ed8e6935
3 changed files with 19 additions and 9 deletions
|
@ -237,7 +237,9 @@ int main(string[] args)
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
writeln(
|
writeln(
|
||||||
"AN UNEXPECTED ERROR HAS OCCURRED! PLEASE REPORT IT TO THE AUTHOR OF THE SNAG!\n\n",
|
"AN UNEXPECTED ERROR HAS OCCURRED!\n",
|
||||||
|
"PLEASE REPORT IT TO THE AUTHOR OF THE SNAG: ",
|
||||||
|
"alexander@zhirov.kz (Alexander Zhirov)\n\n",
|
||||||
e
|
e
|
||||||
);
|
);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
|
@ -131,7 +131,7 @@ class Snag {
|
||||||
}
|
}
|
||||||
writeln("The following list of files requires backup:");
|
writeln("The following list of files requires backup:");
|
||||||
result.output.split('\n')[0..$-1].map!(e =>
|
result.output.split('\n')[0..$-1].map!(e =>
|
||||||
e.strip.split
|
e.strip.splitByFirstSpace
|
||||||
).each!(e =>
|
).each!(e =>
|
||||||
writefln("\t%s\t/%s", gitStatus(e[0], true), e[1])
|
writefln("\t%s\t/%s", gitStatus(e[0], true), e[1])
|
||||||
);
|
);
|
||||||
|
@ -158,7 +158,7 @@ class Snag {
|
||||||
result = execute(_baseCommand ~ ["rev-parse", "--short", "HEAD"]);
|
result = execute(_baseCommand ~ ["rev-parse", "--short", "HEAD"]);
|
||||||
if (result.status == 128) {
|
if (result.status == 128) {
|
||||||
// Если это самый первый коммит после инициализации репозитория
|
// Если это самый первый коммит после инициализации репозитория
|
||||||
git(["add", "."], "Failed to prepare files for archiving");
|
git(["add", _config.project], "Failed to prepare files for archiving");
|
||||||
git(["commit", "-m"] ~ message, "Failed to create a snapshot");
|
git(["commit", "-m"] ~ message, "Failed to create a snapshot");
|
||||||
newSnapshot = git(
|
newSnapshot = git(
|
||||||
["rev-parse", "--short", "HEAD"],
|
["rev-parse", "--short", "HEAD"],
|
||||||
|
@ -197,7 +197,7 @@ class Snag {
|
||||||
"Failed to create a branch from the current state"
|
"Failed to create a branch from the current state"
|
||||||
);
|
);
|
||||||
git(
|
git(
|
||||||
["add", "."],
|
["add", _config.project],
|
||||||
"Failed to prepare files for archiving"
|
"Failed to prepare files for archiving"
|
||||||
);
|
);
|
||||||
git(
|
git(
|
||||||
|
@ -211,7 +211,7 @@ class Snag {
|
||||||
} else {
|
} else {
|
||||||
// Если коммит является посленим в ветке
|
// Если коммит является посленим в ветке
|
||||||
git(
|
git(
|
||||||
["add", "."],
|
["add", _config.project],
|
||||||
"Failed to prepare files for archiving"
|
"Failed to prepare files for archiving"
|
||||||
);
|
);
|
||||||
git(
|
git(
|
||||||
|
@ -250,7 +250,7 @@ class Snag {
|
||||||
[
|
[
|
||||||
"log",
|
"log",
|
||||||
"--all",
|
"--all",
|
||||||
"--date=format:%Y.%m.%d %H:%M",
|
"--date=format:%Y.%m.%d %H:%M:%S",
|
||||||
"--pretty=" ~ format
|
"--pretty=" ~ format
|
||||||
],
|
],
|
||||||
"Failed to retrieve the list of snapshots"
|
"Failed to retrieve the list of snapshots"
|
||||||
|
@ -273,7 +273,7 @@ class Snag {
|
||||||
);
|
);
|
||||||
if (result.output.length) {
|
if (result.output.length) {
|
||||||
git(
|
git(
|
||||||
["restore", "."],
|
["restore", _config.project],
|
||||||
"Failed to reset file changes state"
|
"Failed to reset file changes state"
|
||||||
);
|
);
|
||||||
git(
|
git(
|
||||||
|
@ -406,7 +406,7 @@ class Snag {
|
||||||
);
|
);
|
||||||
|
|
||||||
// Создание нового снимка на основе состояния файлов из распакованного архива
|
// Создание нового снимка на основе состояния файлов из распакованного архива
|
||||||
result = execute(customCommand ~ ["add", "."]);
|
result = execute(customCommand ~ ["add", tempDirectory]);
|
||||||
result.status &&
|
result.status &&
|
||||||
throw new SnagException(
|
throw new SnagException(
|
||||||
"Failed to prepare files for archiving:\n"
|
"Failed to prepare files for archiving:\n"
|
||||||
|
@ -427,7 +427,7 @@ class Snag {
|
||||||
|
|
||||||
// Сброс состояния файлов
|
// Сброс состояния файлов
|
||||||
git(
|
git(
|
||||||
["restore", "."],
|
["restore", _config.project],
|
||||||
"Failed to reset file changes state"
|
"Failed to reset file changes state"
|
||||||
);
|
);
|
||||||
git(
|
git(
|
||||||
|
|
|
@ -2,6 +2,8 @@ module snag.lib.lib;
|
||||||
|
|
||||||
import std.regex;
|
import std.regex;
|
||||||
import std.process;
|
import std.process;
|
||||||
|
import std.algorithm;
|
||||||
|
import std.string;
|
||||||
|
|
||||||
bool isValidHash(string hash) {
|
bool isValidHash(string hash) {
|
||||||
auto hashPattern = ctRegex!r"^[a-fA-F0-9]{7}$";
|
auto hashPattern = ctRegex!r"^[a-fA-F0-9]{7}$";
|
||||||
|
@ -17,3 +19,9 @@ bool checkGit() {
|
||||||
auto result = execute(["which", "git"]);
|
auto result = execute(["which", "git"]);
|
||||||
return !result.status;
|
return !result.status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string[] splitByFirstSpace(string line) {
|
||||||
|
auto spaceIndex = line.indexOf(' ');
|
||||||
|
return spaceIndex == -1 ?
|
||||||
|
[line] : [line[0 .. spaceIndex], line[spaceIndex + 1..$]];
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue