Respuesta

2

Aquí hay una traducción rápida y sucia. No lo he probado ya que no tengo Mercurio a mi alrededor. El guión inicial parece ser lo suficientemente fácil de traducir a Powershell.

# Project and relative paths as script parameters 
param([string]$project, [string]$relPath) 

# Let's see if there is an item .hg. If not, report error and quit 
if((test-path ".hg") -eq $false) { 
    "You MUST run this at the top of your directory structure and use relative paths" 
    return 
} 

# Call Mercury 
& hg clone $project $relPath 

# Add data to .hgsub using composite formatting string 
add-content -path ".hgsub" -value $("{0} = {1}" -f $relPath, $project) 

# Check that .hgsub exists and issue Mercury commands if it does 
if(test-path ".hgsub") { 
    hg add .hgsub 
    hg commit 
} else { 
    "failure, see error messages above" 
} 
+0

¡Gracias por el código! Me sale un error sin embargo. Necesito reemplazar 'if (test-path" .hg "-eq $ false)' a 'if ((test-path" .hg ") -eq $ false)'. –

+0

Gracias, corregido ahora en el código. – vonPryz

Cuestiones relacionadas