Conversation
|
Не читайте пока мой код, пожалуйста, если можно. Там всё очень плохо архитектурно и я переписываю. |
| try { | ||
| vcs.commit(args[1]); | ||
| } catch (Exception e) { | ||
| printException(e); |
There was a problem hiding this comment.
ну, это как-то жёстко. пользователю лучше всё же говорить что-то более определённое, чем просто что случилось что-то плохое
| System.out.println(e.getMessage()); | ||
| return; | ||
| } | ||
| switch (args[0]) { |
There was a problem hiding this comment.
а ещё нелплохо бы выводить help по набору команд и аргументов к ним
| @@ -0,0 +1,7 @@ | |||
| package vcs; | |||
|
|
|||
| public class WrongArgumentsException extends VCSException { | |||
There was a problem hiding this comment.
хотелось бы разложить всё же классы по нескольким пакетам, всё в одну кучу не очень удобно в использовании
| private RepoState index; | ||
| private RepoState staged; | ||
|
|
||
| // TODO: take String[] as args and check them |
| * @throws VCSFilesCorruptedException if VCS files are absent or corrupted | ||
| * @throws IOException if for some reason VCS files cannot be read or written | ||
| */ | ||
| public VCS() throws IOException, VCSFilesCorruptedException { |
There was a problem hiding this comment.
а что этот IOException скажет клиентскому коду? по-хорошему тут бы надо все внутренние исключения ловить и перебрасывать какие-то свои, задаче-ориентированные
| import java.nio.file.Path; | ||
| import java.nio.file.Paths; | ||
|
|
||
| class Branches { |
There was a problem hiding this comment.
назовите его лучше BranchManager, что ли
| static boolean exists(String branchName) { | ||
| return VCSFiles.exists(getPath(branchName)); | ||
| } | ||
| static Branch create(String branchName, CommitSHARef headCommit) throws IOException, BranchAlreadyExistsException { |
There was a problem hiding this comment.
методы не забывайте пустыми строчками разделять
| import java.nio.file.Path; | ||
| import java.nio.file.Paths; | ||
| import java.util.*; | ||
| import java.util.stream.Collectors; |
| import static org.junit.Assert.assertTrue; | ||
|
|
||
| public class VCSTest { | ||
| private static final TestFile A = new TestFile("A.txt", "A text"); |
|
|
||
| */ | ||
| @Test | ||
| public void branchesCheckout() throws Exception, NothingToCommitException, BranchAlreadyExistsException { |
There was a problem hiding this comment.
ну, предположим, какие-то сценарии вы проверили (хотя их всё равно тут очень мало). модульные тесты ещё хочется увидеть
No description provided.