Skip to content
Snippets Groups Projects
Commit 997c2940 authored by Robert Goldmann's avatar Robert Goldmann
Browse files

removed question "is destination repo public" (because you have to authenticate to create labels)

parent 8080ca4c
No related branches found
No related tags found
No related merge requests found
No preview for this file type
No preview for this file type
......@@ -63,7 +63,7 @@ public class Main
GitHubClient sourceClient = new GitHubClient();
sourceClient.setCredentials(sourceUsername, password);
LabelService labelService = new LabelService();
LabelService labelService = new LabelService(sourceClient);
ArrayList<Label> labels = new ArrayList<>();
try
{
......@@ -75,28 +75,7 @@ public class Main
System.out.print("Enter the name of destination repo: ");
String destRepoName = scanner.nextLine();
System.out.print("Is this a public repo? [Y/N] ");
boolean destinationPublicCorrect = false;
boolean destinationPublic = false;
while(!destinationPublicCorrect)
{
String isSourcePublic = scanner.nextLine();
switch(isSourcePublic.toLowerCase())
{
case "y": destinationPublic = true;
destinationPublicCorrect = true;
break;
case "n": destinationPublic = false;
destinationPublicCorrect = true;
break;
default: System.out.print("Please answer Yes or No");
break;
}
}
String destinationPassword = "";
if(!destinationPublic)
{
try
{
Console console = System.console();
......@@ -107,7 +86,6 @@ public class Main
System.out.print("Please enter the password for the destination repo: ");
destinationPassword = scanner.nextLine();
}
}
GitHubClient destinationClient = new GitHubClient();
destinationClient.setCredentials(destinationUsername, destinationPassword);
......@@ -190,11 +168,12 @@ public class Main
{
try
{
System.out.println("Deleting " + i+1 + "/" + existingLabels.size() + ": " + existingLabels.get(i).getName());
System.out.println("Deleting " + (i+1) + "/" + existingLabels.size() + ": " + existingLabels.get(i).getName());
labelService.deleteLabel(client.getUser(), repoName, existingLabels.get(i).getName().replace(" ", "%20"));
}
catch(Exception e)
{
e.printStackTrace();
System.out.println("[ERROR] Label can't be deleted.");
}
}
......@@ -213,7 +192,7 @@ public class Main
{
try
{
System.out.println("Inserting " + i+1 + "/" + labels.size() + ": " + labels.get(i).getName());
System.out.println("Inserting " + (i+1) + "/" + labels.size() + ": " + labels.get(i).getName());
labelService.createLabel(client.getUser(), repoName, labels.get(i));
}
catch(RequestException e)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment