mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-15 09:46:16 +01:00
fix handling of pending changesets during pre receive repository hooks
This commit is contained in:
@@ -310,6 +310,24 @@ public class HgRepositoryHandler
|
||||
return diffViewer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public HgContext getHgContext()
|
||||
{
|
||||
HgContext context = hgContextProvider.get();
|
||||
|
||||
if (context == null)
|
||||
{
|
||||
context = new HgContext();
|
||||
}
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
|
||||
@@ -76,7 +76,8 @@ public class HgCommandContext implements Closeable
|
||||
HgRepositoryHandler handler, sonia.scm.repository.Repository repository,
|
||||
File directory)
|
||||
{
|
||||
this(hookManager, handler, repository, directory, false);
|
||||
this(hookManager, handler, repository, directory,
|
||||
handler.getHgContext().isPending());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.repository.spi;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
@@ -52,6 +53,7 @@ import org.junit.rules.TemporaryFolder;
|
||||
import sonia.scm.AbstractTestBase;
|
||||
import sonia.scm.repository.ChangesetPagingResult;
|
||||
import sonia.scm.repository.HgConfig;
|
||||
import sonia.scm.repository.HgContext;
|
||||
import sonia.scm.repository.HgRepositoryHandler;
|
||||
import sonia.scm.repository.HgTestUtil;
|
||||
import sonia.scm.user.User;
|
||||
@@ -104,6 +106,7 @@ public abstract class IncomingOutgoingTestBase extends AbstractTestBase
|
||||
when(handler.getDirectory(outgoingRepository)).thenReturn(
|
||||
outgoingDirectory);
|
||||
when(handler.getConfig()).thenReturn(temp.getConfig());
|
||||
when(handler.getHgContext()).thenReturn(new HgContext());
|
||||
}
|
||||
|
||||
//~--- set methods ----------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user