Skip to content

VCS#7

Open
Qwsafex wants to merge 23 commits into
masterfrom
VCS
Open

VCS#7
Qwsafex wants to merge 23 commits into
masterfrom
VCS

Conversation

@Qwsafex

@Qwsafex Qwsafex commented Mar 22, 2017

Copy link
Copy Markdown
Owner

No description provided.

@Qwsafex

Qwsafex commented Mar 29, 2017

Copy link
Copy Markdown
Owner Author

Не читайте пока мой код, пожалуйста, если можно. Там всё очень плохо архитектурно и я переписываю.

try {
vcs.commit(args[1]);
} catch (Exception e) {
printException(e);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ну, это как-то жёстко. пользователю лучше всё же говорить что-то более определённое, чем просто что случилось что-то плохое

System.out.println(e.getMessage());
return;
}
switch (args[0]) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

а ещё нелплохо бы выводить help по набору команд и аргументов к ним

@@ -0,0 +1,7 @@
package vcs;

public class WrongArgumentsException extends VCSException {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

хотелось бы разложить всё же классы по нескольким пакетам, всё в одну кучу не очень удобно в использовании

private RepoState index;
private RepoState staged;

// TODO: take String[] as args and check them

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

а это зачем?

* @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 {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

а что этот IOException скажет клиентскому коду? по-хорошему тут бы надо все внутренние исключения ловить и перебрасывать какие-то свои, задаче-ориентированные

import java.nio.file.Path;
import java.nio.file.Paths;

class Branches {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

назовите его лучше BranchManager, что ли

static boolean exists(String branchName) {
return VCSFiles.exists(getPath(branchName));
}
static Branch create(String branchName, CommitSHARef headCommit) throws IOException, BranchAlreadyExistsException {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

методы не забывайте пустыми строчками разделять

import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.*;
import java.util.stream.Collectors;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

пустые импорты лучше убирать

import static org.junit.Assert.assertTrue;

public class VCSTest {
private static final TestFile A = new TestFile("A.txt", "A text");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

используйте TemporaryFolder rule лучше


*/
@Test
public void branchesCheckout() throws Exception, NothingToCommitException, BranchAlreadyExistsException {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ну, предположим, какие-то сценарии вы проверили (хотя их всё равно тут очень мало). модульные тесты ещё хочется увидеть

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants