POC for hg merge support

This commit is contained in:
René Pfeuffer
2020-03-25 11:40:30 +01:00
parent e38245e5bf
commit 1d5b7ab8d9
3 changed files with 26 additions and 13 deletions

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
@@ -74,7 +74,11 @@ public class HgDiffCommand extends AbstractCommand implements DiffCommand
cmd.git();
}
cmd.change(HgUtil.getRevision(request.getRevision()));
if (request.getAncestorChangeset() != null) {
cmd.ancestor(request.getRevision(), request.getAncestorChangeset());
} else {
cmd.change(HgUtil.getRevision(request.getRevision()));
}
InputStream inputStream = null;

View File

@@ -44,13 +44,11 @@ import java.util.Set;
public class HgRepositoryServiceProvider extends RepositoryServiceProvider
{
/** Field description */
//J-
public static final Set<Command> COMMANDS = EnumSet.of(
Command.BLAME,
Command.BROWSE,
Command.BROWSE,
Command.CAT,
Command.DIFF,
Command.DIFF,
Command.LOG,
Command.TAGS,
Command.BRANCH,
@@ -59,13 +57,12 @@ public class HgRepositoryServiceProvider extends RepositoryServiceProvider
Command.OUTGOING,
Command.PUSH,
Command.PULL,
Command.MODIFY
Command.MODIFY,
Command.MERGE
);
//J+
/** Field description */
public static final Set<Feature> FEATURES =
EnumSet.of(Feature.COMBINED_DEFAULT_BRANCH);
EnumSet.of(Feature.COMBINED_DEFAULT_BRANCH, Feature.INCOMING_REVISION);
//~--- constructors ---------------------------------------------------------
@@ -272,6 +269,11 @@ public class HgRepositoryServiceProvider extends RepositoryServiceProvider
return new HgTagsCommand(context, repository);
}
@Override
public MergeCommand getMergeCommand() {
return new HgMergeCommand(context, handler.getWorkdirFactory());
}
//~--- fields ---------------------------------------------------------------
/** Field description */

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.repository.spi.javahg;
//~--- non-JDK imports --------------------------------------------------------
@@ -45,8 +45,8 @@ public final class HgDiffInternalCommand extends AbstractCommand
/** Field description */
private static final String NAME = "diff";
//~--- constructors ---------------------------------------------------------
//~--- constructors ---------------------------------------------------------
/**
* Constructs ...
*
@@ -58,8 +58,8 @@ public final class HgDiffInternalCommand extends AbstractCommand
super(repository, NAME);
}
//~--- methods --------------------------------------------------------------
//~--- methods --------------------------------------------------------------
/**
* Method description
*
@@ -88,6 +88,13 @@ public final class HgDiffInternalCommand extends AbstractCommand
return this;
}
public HgDiffInternalCommand ancestor(String revision, String ancestorChangeset) {
cmdAppend("--rev", "ancestor(" + ancestorChangeset + ", " + revision + ")");
cmdAppend("--rev", revision);
return this;
}
/**
* Method description
*