add tag endpoints

This commit is contained in:
Mohamed Karray
2018-09-04 17:38:28 +02:00
parent dc35393c1c
commit 9b7e34b08b
17 changed files with 471 additions and 50 deletions

View File

@@ -32,9 +32,10 @@ package sonia.scm.repository.client.spi;
import com.aragost.javahg.Repository;
import com.aragost.javahg.commands.ExecutionException;
import java.io.IOException;
import sonia.scm.repository.client.api.RepositoryClientException;
import java.io.IOException;
/**
* Mercurial implementation of the {@link PushCommand}.
*
@@ -63,5 +64,10 @@ public class HgPushCommand implements PushCommand
throw new RepositoryClientException("push to repository failed", ex);
}
}
@Override
public void pushTags() throws IOException {
push();
}
}

View File

@@ -32,7 +32,6 @@ package sonia.scm.repository.client.spi;
import com.aragost.javahg.Repository;
import com.google.common.base.Strings;
import java.io.IOException;
import sonia.scm.repository.Tag;
/**
@@ -51,13 +50,16 @@ public class HgTagCommand implements TagCommand
}
@Override
public Tag tag(TagRequest request) throws IOException
public Tag tag(TagRequest request)
{
String rev = request.getRevision();
if ( Strings.isNullOrEmpty(rev) ){
rev = repository.tip().getNode();
}
com.aragost.javahg.commands.TagCommand.on(repository).rev(rev).execute(request.getName());
com.aragost.javahg.commands.TagCommand.on(repository)
.rev(rev)
.user(request.getUserName())
.execute(request.getName());
return new Tag(request.getName(), rev);
}