Mercurial #264

Closed
wants to merge 4 commits into
from

Projects

None yet

3 participants

@pranavkm
Contributor

First iteration for adding Mercurial support to Kudu

@amitapl amitapl commented on the diff Dec 19, 2012
Kudu.Core/Deployment/DeploymentManager.cs
}
if (clean)
{
- tracer.Trace("Cleaning git repository");
+ tracer.Trace("Cleaning repository");
logger.Log(Resources.Log_CleaningGitRepository);
@amitapl
amitapl Dec 19, 2012 Member

Git here should be removed

@pranavkm
pranavkm Jan 3, 2013 Contributor

Fixed

@amitapl amitapl commented on an outdated diff Dec 19, 2012
Kudu.Core/Deployment/DeploymentManager.cs
using (tracer.Step("Creating temporary deployment"))
{
- DeploymentStatusFile statusFile = CreateStatusFile(id);
- statusFile.Message = "N/A";
- statusFile.Author = "N/A";
- statusFile.Deployer = "N/A";
- statusFile.AuthorEmail = "N/A";
- statusFile.Status = DeployStatus.Pending;
- statusFile.StatusText = statusText;
- statusFile.Save(_fileSystem);
+ var changeset = new ChangeSet(TemporaryDeploymentId, "N/A", "N/A", "N/A", DateTimeOffset.MinValue);
@amitapl
amitapl Dec 19, 2012 Member

Probably not related to this change but N/A should be in resources.

@amitapl amitapl commented on an outdated diff Dec 19, 2012
Kudu.Core/Deployment/DeploymentManager.cs
@@ -757,5 +721,21 @@ private bool IsActive(string id)
{
return id.Equals(ActiveDeploymentId, StringComparison.OrdinalIgnoreCase);
}
+
+ private IDeploymentRepository GetDeploymentRepository()
+ {
+ var trace = _traceFactory.GetTracer();
+ IRepository repository = new HgRepository(_environment.RepositoryPath, _traceFactory);
@amitapl
amitapl Dec 19, 2012 Member

This can probably be done only once.

@amitapl amitapl commented on the diff Dec 19, 2012
Kudu.Core/Infrastructure/FileSystemHelpers.cs
@@ -175,7 +175,9 @@ internal static void Copy(string sourcePath, string destinationPath, bool skipSc
internal static bool IsSourceControlFolder(string path)
{
- return path.StartsWith(".git", StringComparison.OrdinalIgnoreCase);
+ // TODO: Update kudu sync
+ return path.StartsWith(".git", StringComparison.OrdinalIgnoreCase) ||
+ path.StartsWith(".hg", StringComparison.OrdinalIgnoreCase);
@amitapl
amitapl Dec 19, 2012 Member

Will also require a change in the script generator to ignore .hg dir
opened issue Azure/azure-xplat-cli#149

@amitapl amitapl commented on an outdated diff Dec 19, 2012
Kudu.Core/SourceControl/DeploymentRepository.cs
@@ -0,0 +1,50 @@
+using System;
+using Kudu.Core.Tracing;
+
+namespace Kudu.Core.SourceControl
+{
+ public class DeploymentRepository : IDeploymentRepository
+ {
+ private readonly ITraceFactory _traceFactory;
@amitapl
amitapl Dec 19, 2012 Member

where is tracerfactory being used?

@amitapl amitapl commented on an outdated diff Dec 19, 2012
Kudu.Core/Deployment/DeploymentManager.cs
@@ -757,5 +721,21 @@ private bool IsActive(string id)
{
return id.Equals(ActiveDeploymentId, StringComparison.OrdinalIgnoreCase);
}
+
+ private IDeploymentRepository GetDeploymentRepository()
+ {
+ var trace = _traceFactory.GetTracer();
+ IRepository repository = new HgRepository(_environment.RepositoryPath, _traceFactory);
+ if (repository.Exists)
+ {
+ trace.Trace("Found mercurial repository at {0}", _environment.RepositoryPath);
+ }
+ else
+ {
+ trace.Trace("Assuming git repository at {0}", _environment.RepositoryPath);
+ repository = new GitExeRepository(_environment.RepositoryPath, _environment.SiteRootPath, _traceFactory);
@amitapl
amitapl Dec 19, 2012 Member

What if no repository exists?

@amitapl amitapl commented on the diff Dec 19, 2012
Kudu.Services.Web/Services/ServerConfiguration.cs
@@ -13,6 +13,18 @@ public string ApplicationName
}
}
+ public string HgServerRoot
@amitapl
amitapl Dec 19, 2012 Member

Can we make this not repository specific?

@pranavkm
pranavkm Jan 3, 2013 Contributor

Got rid of this. This was for a mercurial server that came back as a result of the revert

@amitapl amitapl commented on an outdated diff Dec 19, 2012
Kudu.Services/FetchHelpers/HgFetchHelper.cs
@@ -0,0 +1,27 @@
+using Kudu.Core;
+using Kudu.Core.SourceControl;
+using Kudu.Core.Tracing;
+using Kudu.Services.ServiceHookHandlers;
+
+namespace Kudu.Services
+{
+ public class HgFetchHelper
+ {
+ private readonly IEnvironment _environment;
+ private readonly ITraceFactory _traceFactory;
@amitapl
amitapl Dec 19, 2012 Member

not used

@amitapl amitapl commented on an outdated diff Dec 19, 2012
Kudu.Services/FetchHelpers/HgFetchHelper.cs
@@ -0,0 +1,27 @@
+using Kudu.Core;
+using Kudu.Core.SourceControl;
+using Kudu.Core.Tracing;
+using Kudu.Services.ServiceHookHandlers;
+
+namespace Kudu.Services
+{
+ public class HgFetchHelper
@amitapl
amitapl Dec 19, 2012 Member

can share code with GitFetchHelper

@davidebbo davidebbo commented on the diff Jan 2, 2013
Kudu.Web/Kudu.Web.csproj
@@ -384,7 +384,7 @@
<WebProjectProperties>
<UseIIS>False</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
- <DevelopmentServerPort>14905</DevelopmentServerPort>
+ <DevelopmentServerPort>4862</DevelopmentServerPort>
@davidebbo
davidebbo Jan 2, 2013 Member

This is probably accidental and should be reverted

@pranavkm
pranavkm Jan 3, 2013 Contributor

Fixed

@davidebbo davidebbo commented on the diff Jan 2, 2013
Kudu.Core/Infrastructure/PathUtility.cs
@@ -19,6 +19,25 @@ internal static string ResolveGitPath()
return path;
}
+ internal static string ResolveHgPath()
+ {
+ string programFiles32 = SystemEnvironment.GetFolderPath(SystemEnvironment.SpecialFolder.ProgramFilesX86);
+ string path = Path.Combine(programFiles32, "Mercurial", "hg.exe");
+
+ if (!File.Exists(path))
+ {
+ string programFiles = SystemEnvironment.GetFolderPath(SystemEnvironment.SpecialFolder.ProgramFiles);
+ path = Path.Combine(programFiles, "Mercurial", "hg.exe");
+
+ if (!File.Exists(path))
+ {
+ throw new InvalidOperationException(Resources.Error_FailedToLocateGit);
@davidebbo
davidebbo Jan 2, 2013 Member

Should be FailedToLocateHg, not git.

@pranavkm
pranavkm Jan 3, 2013 Contributor

Fixed

@pranavkm pranavkm closed this Jan 3, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment