@@ -662,89 +662,90 @@ public void handle(Event event) {
662
662
orgCommits .setOnShowing (null );
663
663
gistFlag = false ;
664
664
});
665
- Repository repo = null ;
666
- Git git = null ;
667
665
try {
668
666
ScriptingEngine .checkout (url , branchName );
669
667
670
- git = ScriptingEngine .openGit (url );
671
- repo = git .getRepository ();
672
- // com.neuronrobotics.sdk.common.Log.error("Commits of branch: " + branchName);
673
- // com.neuronrobotics.sdk.common.Log.error("-------------------------------------");
668
+ ScriptingEngine .openGit (url , git ->{
669
+ Repository repo = git .getRepository ();
670
+ // com.neuronrobotics.sdk.common.Log.error("Commits of branch: " + branchName);
671
+ // com.neuronrobotics.sdk.common.Log.error("-------------------------------------");
674
672
675
- ObjectId resolve = repo .resolve (branchName );
676
- if (resolve != null ) {
677
- Iterable <RevCommit > commits = git .log ().add (resolve ).call ();
673
+ ObjectId resolve = repo .resolve (branchName );
674
+ if (resolve != null ) {
675
+ Iterable <RevCommit > commits = git .log ().add (resolve ).call ();
678
676
679
- List <RevCommit > commitsList = Lists .newArrayList (commits .iterator ());
680
- BowlerStudio .runLater (() -> {
681
- try {
682
- orgCommits .getItems ()
683
- .add (new MenuItem ("On Branch " + ScriptingEngine .getBranch (url )));
684
- } catch (Exception e ) {
685
- exp .uncaughtException (Thread .currentThread (), e );
686
- }
687
- orgCommits .getItems ().add (new SeparatorMenuItem ());
688
- });
689
- // RevCommit previous = null;
690
- for (RevCommit commit : commitsList ) {
691
- String date = format .format (new Date (commit .getCommitTime () * 1000L ));
692
- String fullData = commit .getName () + "\r \n " + commit .getAuthorIdent ().getName () + "\r \n "
693
- + date + "\r \n " + commit .getFullMessage () + "\r \n "
694
- + "---------------------------------------------------\r \n " ;// +
695
- // previous==null?"":getDiffOfCommit(previous,commit, repo, git);
696
-
697
- // previous = commit;
698
- String string = date + " " + commit .getAuthorIdent ().getName () + " "
699
- + commit .getShortMessage ();
700
- if (string .length () > 80 )
701
- string = string .substring (0 , 80 );
702
- // MenuItem tmp = new MenuItem(string);
703
- CustomMenuItem tmp = new CustomMenuItem (new Label (string ));
704
- Tooltip tooltip = new Tooltip (fullData );
705
- Tooltip .install (tmp .getContent (), tooltip );
706
- tmp .setOnAction (ev -> {
707
- new Thread () {
708
- public void run () {
709
- com .neuronrobotics .sdk .common .Log .error ("Selecting \r \n \r \n " + fullData );
710
-
711
- String branch ;
712
- try {
713
- branch = ScriptingEngine .getBranch (url );
714
- } catch (Exception e1 ) {
715
- branch = "newBranch" ;
716
- }
717
-
718
- String dateString = formatSimple
719
- .format (new Date (commit .getCommitTime () * 1000L ));
720
- promptForNewBranch (branch + "-" + dateString ,
721
- "Creating Branch From Commit:\n \n " + fullData , newBranch -> {
722
- new Thread () {
723
- public void run () {
724
- try {
725
- String slugify = slugify (newBranch );
726
- com .neuronrobotics .sdk .common .Log
727
- .error ("Creating " + slugify );
728
- ScriptingEngine .setCommitContentsAsCurrent (url ,
729
- slugify , commit );
730
- } catch (IOException e ) {
731
- exp .uncaughtException (Thread .currentThread (), e );
732
- } catch (GitAPIException e ) {
733
- exp .uncaughtException (Thread .currentThread (), e );
677
+ List <RevCommit > commitsList = Lists .newArrayList (commits .iterator ());
678
+ BowlerStudio .runLater (() -> {
679
+ try {
680
+ orgCommits .getItems ()
681
+ .add (new MenuItem ("On Branch " + ScriptingEngine .getBranch (url )));
682
+ } catch (Exception e ) {
683
+ exp .uncaughtException (Thread .currentThread (), e );
684
+ }
685
+ orgCommits .getItems ().add (new SeparatorMenuItem ());
686
+ });
687
+ // RevCommit previous = null;
688
+ for (RevCommit commit : commitsList ) {
689
+ String date = format .format (new Date (commit .getCommitTime () * 1000L ));
690
+ String fullData = commit .getName () + "\r \n " + commit .getAuthorIdent ().getName () + "\r \n "
691
+ + date + "\r \n " + commit .getFullMessage () + "\r \n "
692
+ + "---------------------------------------------------\r \n " ;// +
693
+ // previous==null?"":getDiffOfCommit(previous,commit, repo, git);
694
+
695
+ // previous = commit;
696
+ String string = date + " " + commit .getAuthorIdent ().getName () + " "
697
+ + commit .getShortMessage ();
698
+ if (string .length () > 80 )
699
+ string = string .substring (0 , 80 );
700
+ // MenuItem tmp = new MenuItem(string);
701
+ CustomMenuItem tmp = new CustomMenuItem (new Label (string ));
702
+ Tooltip tooltip = new Tooltip (fullData );
703
+ Tooltip .install (tmp .getContent (), tooltip );
704
+ tmp .setOnAction (ev -> {
705
+ new Thread () {
706
+ public void run () {
707
+ com .neuronrobotics .sdk .common .Log .error ("Selecting \r \n \r \n " + fullData );
708
+
709
+ String branch ;
710
+ try {
711
+ branch = ScriptingEngine .getBranch (url );
712
+ } catch (Exception e1 ) {
713
+ branch = "newBranch" ;
714
+ }
715
+
716
+ String dateString = formatSimple
717
+ .format (new Date (commit .getCommitTime () * 1000L ));
718
+ promptForNewBranch (branch + "-" + dateString ,
719
+ "Creating Branch From Commit:\n \n " + fullData , newBranch -> {
720
+ new Thread () {
721
+ public void run () {
722
+ try {
723
+ String slugify = slugify (newBranch );
724
+ com .neuronrobotics .sdk .common .Log
725
+ .error ("Creating " + slugify );
726
+ ScriptingEngine .setCommitContentsAsCurrent (url ,
727
+ slugify , commit );
728
+ } catch (IOException e ) {
729
+ exp .uncaughtException (Thread .currentThread (), e );
730
+ } catch (GitAPIException e ) {
731
+ exp .uncaughtException (Thread .currentThread (), e );
732
+ }
734
733
}
735
- }
736
- }.start ();
737
- });
734
+ }.start ();
735
+ });
738
736
739
- }
740
- }.start ();
737
+ }
738
+ }.start ();
741
739
742
- });
743
- BowlerStudio .runLater (() -> {
744
- orgCommits .getItems ().add (tmp );
745
- });
740
+ });
741
+ BowlerStudio .runLater (() -> {
742
+ orgCommits .getItems ().add (tmp );
743
+ });
744
+ }
746
745
}
747
- }
746
+ });
747
+
748
+
748
749
749
750
BowlerStudio .runLater (() -> {
750
751
orgCommits .hide ();
@@ -763,7 +764,6 @@ public void run() {
763
764
} catch (Throwable e ) {
764
765
exp .uncaughtException (Thread .currentThread (), e );
765
766
}
766
- ScriptingEngine .closeGit (git );
767
767
}).start ();
768
768
}
769
769
};
0 commit comments