[ 
https://issues.apache.org/jira/browse/CAMEL-12666?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16548249#comment-16548249
 ] 

ASF GitHub Bot commented on CAMEL-12666:
----------------------------------------

valtoni commented on a change in pull request #2431: CAMEL-12666: Create push 
tag operation
URL: https://github.com/apache/camel/pull/2431#discussion_r203487744
 
 

 ##########
 File path: 
components/camel-git/src/main/java/org/apache/camel/component/git/producer/GitProducer.java
 ##########
 @@ -407,6 +413,28 @@ protected void doPush(Exchange exchange, String 
operation) throws Exception {
         updateExchange(exchange, result);
     }
 
+    protected void doPushTag(Exchange exchange, String operation) throws 
Exception {
+        Iterable<PushResult> result = null;
+        try {
+            if (ObjectHelper.isEmpty(endpoint.getRemoteName())) {
+                throw new IllegalArgumentException("Remote name must be 
specified to execute " + operation);
+            }
+            if (ObjectHelper.isEmpty(endpoint.getTagName())) {
+                throw new IllegalArgumentException("Tag Name must be specified 
to execute " + operation);
+            }
+            if (ObjectHelper.isNotEmpty(endpoint.getUsername()) && 
ObjectHelper.isNotEmpty(endpoint.getPassword())) {
+                UsernamePasswordCredentialsProvider credentials = new 
UsernamePasswordCredentialsProvider(endpoint.getUsername(), 
endpoint.getPassword());
+                result = 
git.push().setCredentialsProvider(credentials).setRemote(endpoint.getRemoteName()).add(Constants.R_TAGS
 + endpoint.getTagName()).call();
+            } else {
+                result = 
git.push().setRemote(endpoint.getRemoteName()).add(Constants.R_TAGS + 
endpoint.getTagName()).call();
+            }
+        } catch (Exception e) {
+            LOG.error("There was an error in Git " + operation + " operation");
 
 Review comment:
   If you permit me, all methods must be refactored to create a more easy and 
fluent way to create new methods to add operations like this. I propose that we 
do that in another issue to make the action more coherent. I can create it if 
you want.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Create push tag operation
> -------------------------
>
>                 Key: CAMEL-12666
>                 URL: https://issues.apache.org/jira/browse/CAMEL-12666
>             Project: Camel
>          Issue Type: New Feature
>          Components: camel-git
>            Reporter: Valtoni Boaventura
>            Assignee: Andrea Cosentino
>            Priority: Major
>
> The git component already has a "createTag" operation, adding a tag in local 
> repo. Actually is not possible to push this modification. Adding a "pushTag" 
> operation we must be able to do that.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to