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

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

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

 ##########
 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:
   @valtoni , yes, you are right, I can see that all methods are using this 
style for logging.
   Another suggestion, do you think about use one method for doPush and 
doPushTag to prevent copy/paste a large peace of common code?

----------------------------------------------------------------
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