-
Notifications
You must be signed in to change notification settings - Fork 0
VCS #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
VCS #7
Changes from all commits
5045bf9
f62eb4b
379c89b
17aa54a
1611240
261f287
04a6bdb
6acf56c
ebfa82f
66bf85e
e138327
cd83e6b
7bfe6ff
a1e6fab
c7092a7
6f911f6
c56abae
782d250
205ec7d
e12ea35
af71eea
8f9f983
97a9b60
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| build | ||
| .idea |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| language: java | ||
|
|
||
| jdk: | ||
| - oraclejdk8 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| group 'ru.spbau.shevchenko' | ||
| version '1.0-SNAPSHOT' | ||
|
|
||
| apply plugin: 'java' | ||
|
|
||
| sourceCompatibility = 1.8 | ||
|
|
||
| repositories { | ||
| mavenCentral() | ||
| } | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. сюда бы хорошо добавить что-то для сборки jar' а с зависимостями. например, такое |
||
| dependencies { | ||
| testCompile group: 'junit', name: 'junit', version: '4.11' | ||
| compile group: 'org.jetbrains', name: 'annotations', version: '13.0' | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| #Tue Mar 21 12:37:10 MSK 2017 | ||
| distributionBase=GRADLE_USER_HOME | ||
| distributionPath=wrapper/dists | ||
| zipStoreBase=GRADLE_USER_HOME | ||
| zipStorePath=wrapper/dists | ||
| distributionUrl=https\://services.gradle.org/distributions/gradle-2.13-bin.zip |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| rootProject.name = 'VCS' | ||
| rootProject.name = 'VCS' | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| package console; | ||
|
|
||
| import vcs.EmptyCommitMessageException; | ||
| import vcs.NothingToCommitException; | ||
| import vcs.VCS; | ||
| import vcs.VCSException; | ||
|
|
||
| import java.io.IOException; | ||
| import java.util.List; | ||
|
|
||
| public class Main { | ||
| public static void main(String[] args) { | ||
| for (String arg : args) { | ||
| System.out.println(arg); | ||
| } | ||
| VCS vcs; | ||
| try { | ||
| vcs = new VCS(); | ||
| } catch (Exception e) { | ||
| System.out.println(e.getMessage()); | ||
| return; | ||
| } | ||
| switch (args[0]) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. а ещё нелплохо бы выводить help по набору команд и аргументов к ним |
||
| case "add": { | ||
| try { | ||
| vcs.add(args[1]); | ||
| } catch (IOException e) { | ||
| printException(e); | ||
| } | ||
| break; | ||
| } | ||
| case "commit": { | ||
| try { | ||
| vcs.commit(args[1]); | ||
| } catch (Exception e) { | ||
| printException(e); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ну, это как-то жёстко. пользователю лучше всё же говорить что-то более определённое, чем просто что случилось что-то плохое |
||
| } | ||
| break; | ||
| } | ||
| case "branch": { | ||
| if (args[1].equals("-d")) { | ||
| try { | ||
| vcs.deleteBranch(args[2]); | ||
| } catch (VCSException | IOException e) { | ||
| printException(e); | ||
| } | ||
| } | ||
| else { | ||
| try { | ||
| vcs.createBranch(args[1]); | ||
| } catch (Exception e) { | ||
| printException(e); | ||
| } | ||
| } | ||
| break; | ||
| } | ||
| case "log": { | ||
| try { | ||
| List<String> log = vcs.log(); | ||
| for (String record : log) { | ||
| System.out.print(record); | ||
| System.out.println("\n---------------------\n"); | ||
| } | ||
| } catch (IOException | ClassNotFoundException e) { | ||
| printException(e); | ||
| } | ||
| break; | ||
| } | ||
| case "checkout": { | ||
| try { | ||
| vcs.checkout(args[1]); | ||
| } catch (Exception e) { | ||
| printException(e); | ||
| } | ||
| break; | ||
| } | ||
| case "merge": { | ||
| try { | ||
| List<String> conflicts = vcs.merge(args[1]); | ||
| if (conflicts.isEmpty()) { | ||
| System.out.println("Merged successfully"); | ||
| } | ||
| else { | ||
| System.out.println("Following files conflict:"); | ||
| conflicts.forEach(System.out::println); | ||
| } | ||
| } catch (Exception e) { | ||
| printException(e); | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| private static void printException(Exception e) { | ||
| System.out.println(e.getClass().toString() + " " + e.getMessage()); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| /** | ||
| * Provides Main class for console interface. | ||
| */ | ||
| package console; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
а ещё по условию требовалось, кстати, краткое техническое описание внутреннего устройства.
-0.5