Chris2011 commented on code in PR #8653:
URL: https://github.com/apache/netbeans/pull/8653#discussion_r2214252775


##########
ide/git/src/org/netbeans/modules/git/ui/branch/RenameBranchAction.java:
##########
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.git.ui.branch;
+
+import java.io.File;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.libs.git.GitBranch;
+import org.netbeans.libs.git.GitException;
+import org.netbeans.modules.git.Git;
+import org.netbeans.modules.git.client.GitClient;
+import org.netbeans.modules.git.client.GitClientExceptionHandler;
+import org.netbeans.modules.git.client.GitProgressSupport;
+import org.netbeans.modules.git.ui.actions.SingleRepositoryAction;
+import org.netbeans.modules.git.ui.repository.RepositoryInfo;
+import org.netbeans.modules.versioning.spi.VCSContext;
+import org.openide.DialogDisplayer;
+import org.openide.NotifyDescriptor;
+import org.openide.awt.ActionID;
+import org.openide.awt.ActionRegistration;
+import org.openide.util.NbBundle;
+
+/**
+ *
+ * @author christian lenz
+ */
+/**
+ * Action to rename an existing branch.
+ */
+@ActionID(id = "org.netbeans.modules.git.ui.branch.RenameBranchAction", 
category = "Git")
+@ActionRegistration(displayName = "#LBL_RenameBranchAction_Name")
+public class RenameBranchAction extends SingleRepositoryAction {
+
+    private static final Logger LOG = 
Logger.getLogger(RenameBranchAction.class.getName());
+
+    @Override
+    protected void performAction(File repository, File[] roots, VCSContext 
context) {
+        RepositoryInfo info = RepositoryInfo.getInstance(repository);
+        GitBranch activeBranch = info.getActiveBranch();
+        if (activeBranch != null && 
!GitBranch.NO_BRANCH.equals(activeBranch.getName())) {

Review Comment:
   Yeah, I also thought about but more or less copy & paste it.



##########
ide/libs.git/src/org/netbeans/libs/git/GitClient.java:
##########
@@ -1141,6 +1142,20 @@ public void rename (File source, File target, boolean 
after, ProgressMonitor mon
         cmd.execute();
     }
     
+    /**
+     * Renames a branch in the repository
+     * @param oldName current branch name
+     * @param newName desired branch name
+     * @param monitor progress monitor
+     * @return renamed branch information
+     * @throws GitException an unexpected error occurs
+     */
+    public GitBranch renameBranch (String oldName, String newName, 
ProgressMonitor monitor) throws GitException {

Review Comment:
   No needed at all. I will remove it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to