You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2018/03/18 20:23:08 UTC
[maven-scm] branch SCM-875 updated (89e8661 -> 67058a9)
This is an automated email from the ASF dual-hosted git repository.
michaelo pushed a change to branch SCM-875
in repository https://gitbox.apache.org/repos/asf/maven-scm.git.
discard 89e8661 [SCM-875] GitUpdateCommand assumes master branch
new 67058a9 [SCM-875] GitUpdateCommand assumes master branch by default
This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version. This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:
* -- * -- B -- O -- O -- O (89e8661)
\
N -- N -- N refs/heads/SCM-875 (67058a9)
You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.
Any revisions marked "omit" are not gone; other references still
refer to them. Any revisions marked "discard" are gone forever.
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../maven/scm/provider/git/gitexe/command/update/GitUpdateCommand.java | 1 +
1 file changed, 1 insertion(+)
--
To stop receiving notification emails like this one, please contact
michaelo@apache.org.
[maven-scm] 01/01: [SCM-875] GitUpdateCommand assumes master branch
by default
Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
michaelo pushed a commit to branch SCM-875
in repository https://gitbox.apache.org/repos/asf/maven-scm.git
commit 67058a9975eede69e0d2d450993072baff232144
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Sun Mar 18 02:00:50 2018 +0100
[SCM-875] GitUpdateCommand assumes master branch by default
---
.../gitexe/command/update/GitUpdateCommand.java | 36 +++++++++-------------
.../command/update/GitUpdateCommandTest.java | 4 +--
2 files changed, 16 insertions(+), 24 deletions(-)
diff --git a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/update/GitUpdateCommand.java b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/update/GitUpdateCommand.java
index 42fa587..f5a8ddc 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/update/GitUpdateCommand.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/update/GitUpdateCommand.java
@@ -96,7 +96,7 @@ public class GitUpdateCommand
stderr.getOutput(), false );
}
-
+
// now let's get the latest version
consumerRev = new GitLatestRevisionCommandConsumer( getLogger() );
exitCode = GitCommandLineUtils.execute( clRev, consumerRev, stderr, getLogger() );
@@ -106,7 +106,7 @@ public class GitUpdateCommand
stderr.getOutput(), false );
}
String latestRevision = consumerRev.getLatestRevision();
-
+
return new UpdateScmResultWithRevision( cl.toString(), diffRawConsumer.getChangedFiles(), latestRevision );
}
@@ -115,18 +115,18 @@ public class GitUpdateCommand
{
GitChangeLogCommand changelogCmd = new GitChangeLogCommand();
changelogCmd.setLogger( getLogger() );
-
+
return changelogCmd;
}
-
+
/**
- * create the command line for updating the current branch with the info from the foreign repository.
+ * create the command line for updating the current branch with the info from the foreign repository.
*/
public static Commandline createCommandLine( GitScmProviderRepository repository, File workingDirectory,
ScmVersion scmVersion )
{
Commandline cl = GitCommandLineUtils.getBaseGitCommandLine( workingDirectory, "pull" );
-
+
cl.createArg().setLine( repository.getFetchUrl() );
// now set the branch where we would like to pull from
@@ -134,14 +134,10 @@ public class GitUpdateCommand
{
cl.createArg().setLine( scmVersion.getName() );
}
- else
- {
- cl.createArg().setLine( "master" );
- }
-
+
return cl;
}
-
+
/**
* @param scmVersion a valid branch or <code>null</code> if the master branch should be taken
* @return CommandLine for getting the latest commit on the given branch
@@ -150,25 +146,21 @@ public class GitUpdateCommand
File workingDirectory, ScmVersion scmVersion )
{
Commandline cl = GitCommandLineUtils.getBaseGitCommandLine( workingDirectory, "log" );
-
+
// only show exactly 1 commit
- cl.createArg().setValue( "-n1" );
-
+ cl.createArg().setValue( "-n1" );
+
// same as --topo-order, but ensure ordering of merges
cl.createArg().setValue( "--date-order" );
-
+
if ( scmVersion != null && scmVersion instanceof ScmBranch && scmVersion.getName() != null
&& scmVersion.getName().length() > 0 )
{
// if any branch is given, lets take em
cl.createArg().setValue( scmVersion.getName() );
}
- else
- {
- // otherwise we work on the master branch
- cl.createArg().setValue( "master" );
- }
-
+ // otherwise we work on HEAD/current branch
+
return cl;
}
}
diff --git a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/update/GitUpdateCommandTest.java b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/update/GitUpdateCommandTest.java
index c7de180..0e2f94f 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/update/GitUpdateCommandTest.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/update/GitUpdateCommandTest.java
@@ -38,7 +38,7 @@ public class GitUpdateCommandTest
public void testCommandLineNoBranch()
throws Exception
{
- testCommandLine( "scm:git:http://foo.com/git", null, "git pull http://foo.com/git master" );
+ testCommandLine( "scm:git:http://foo.com/git", null, "git pull http://foo.com/git" );
}
public void testCommandLineWithBranch()
@@ -51,7 +51,7 @@ public class GitUpdateCommandTest
public void testCommandLineLatestRevision()
throws Exception
{
- testLatestRevisionCommandLine( "scm:git:http://foo.com/git", null, "git log -n1 --date-order master" );
+ testLatestRevisionCommandLine( "scm:git:http://foo.com/git", null, "git log -n1 --date-order" );
}
// ----------------------------------------------------------------------
--
To stop receiving notification emails like this one, please contact
michaelo@apache.org.