maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject [1/5] maven-scm git commit: fix incorrect resolving of branch name from outgoing changes
Date Wed, 06 Apr 2016 00:29:56 GMT
Repository: maven-scm
Updated Branches:
  refs/heads/master e0afea497 -> 43d5eadc9


fix incorrect resolving of branch name from outgoing changes


Project: http://git-wip-us.apache.org/repos/asf/maven-scm/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-scm/commit/29ccf295
Tree: http://git-wip-us.apache.org/repos/asf/maven-scm/tree/29ccf295
Diff: http://git-wip-us.apache.org/repos/asf/maven-scm/diff/29ccf295

Branch: refs/heads/master
Commit: 29ccf295c1e259acbfe633c8e361b4b782620d1d
Parents: 98c53aa
Author: s13o <Agartsin!1>
Authored: Wed Mar 25 01:11:02 2015 +0200
Committer: s13o <Agartsin!1>
Committed: Wed Mar 25 01:11:02 2015 +0200

----------------------------------------------------------------------
 .../apache/maven/scm/provider/hg/HgUtils.java    | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-scm/blob/29ccf295/maven-scm-providers/maven-scm-provider-hg/src/main/java/org/apache/maven/scm/provider/hg/HgUtils.java
----------------------------------------------------------------------
diff --git a/maven-scm-providers/maven-scm-provider-hg/src/main/java/org/apache/maven/scm/provider/hg/HgUtils.java
b/maven-scm-providers/maven-scm-provider-hg/src/main/java/org/apache/maven/scm/provider/hg/HgUtils.java
index bfcf72c..36ef6c9 100644
--- a/maven-scm-providers/maven-scm-provider-hg/src/main/java/org/apache/maven/scm/provider/hg/HgUtils.java
+++ b/maven-scm-providers/maven-scm-provider-hg/src/main/java/org/apache/maven/scm/provider/hg/HgUtils.java
@@ -48,6 +48,8 @@ import java.util.Map;
 public final class HgUtils
 {
 
+    public static final String DEFAULT = "default";
+
     private HgUtils()
     {
         // no op
@@ -78,7 +80,7 @@ public final class HgUtils
         List<Integer> outgoingExitCodes = new ArrayList<Integer>( 2 );
         outgoingExitCodes.add( Integer.valueOf( 0 ) ); //There are changes
         outgoingExitCodes.add( Integer.valueOf( 1 ) ); //No changes
-        EXIT_CODE_MAP.put( HgCommandConstants.OUTGOING_CMD, outgoingExitCodes );        
+        EXIT_CODE_MAP.put( HgCommandConstants.OUTGOING_CMD, outgoingExitCodes );
     }
 
     public static ScmResult execute( HgConsumer consumer, ScmLogger logger, File workingDir,
String[] cmdAndArgs )
@@ -301,7 +303,7 @@ public final class HgUtils
      * @return true if a different outgoing branch was found
      * @throws ScmException on outgoing command error
      */
-    public static boolean differentOutgoingBranchFound( ScmLogger logger, File workingDir,
String workingbranchName )
+    public static boolean differentOutgoingBranchFound( ScmLogger logger, File workingDir,String
workingbranchName )
         throws ScmException
     {
         String[] outCmd = new String[]{ HgCommandConstants.OUTGOING_CMD };
@@ -312,11 +314,10 @@ public final class HgUtils
         {
             for ( HgChangeSet set : changes )
             {
-                if ( set.getBranch() != null )
-                {
-                    logger.warn( "A different branch than " + workingbranchName
-                        + " was found in outgoing changes, branch name was " + set.getBranch()
-                        + ". Only local branch named " + workingbranchName + " will be pushed."
);
+                if (!getBranchName(workingbranchName).equals(getBranchName(set.getBranch())))
{
+                    logger.warn( "A different branch than " + getBranchName(workingbranchName)
+                        + " was found in outgoing changes, branch name was " + getBranchName(set.getBranch())
+                        + ". Only local branch named " + getBranchName(workingbranchName)
+ " will be pushed." );
                     return true;
                 }
             }
@@ -324,6 +325,10 @@ public final class HgUtils
         return false;
     }
 
+    private static String getBranchName(String branch) {
+        return branch == null ? DEFAULT : branch;
+    }
+
     public static String maskPassword( Commandline cl )
     {
         String clString = cl.toString();


Mime
View raw message