##// END OF EJS Templates
resourceutil: account for the non-resource-like file hierarchy under py2exe...
resourceutil: account for the non-resource-like file hierarchy under py2exe After 9e367157a990, config files for py2exe were expected to be in C:\Program Files\Mercurial\mercurial\defaultrc because of the implied resource structure of 'mercurial.defaultrc.*.rc', relative to the executable. Accomodating this would require changes to the WIX and Inno scripts (and perhaps the script that generates the WIX script), as well as 3rd party bundlers like TortoiseHg. But these files aren't read as resources anyway- they fall back to the filesystem APIs. (If we really wanted to carry on the charade, the installer would have to also sprinkle various empty __init__.py files around.) Instead, this simply prunes the 'mercurial.' portion of the resource name when run with py2exe. (PyOxidizer uses the resources API, not the filesystem fallback, so it is unaffected.) Since this hack only affects the py2 Windows installers and is less risky, I think it's reasonable. We haven't needed to load any 3rd party resource up to this point, and would have to make packaging changes anyway to handle that. Differential Revision: https://phab.mercurial-scm.org/D8058

File last commit:

r32571:92bcaef3 default
r44706:aab70b54 stable
Show More
editmergeps.ps1
78 lines | 1.6 KiB | text/x-powershell | PowerShellLexer
# A simple script for opening merge conflicts in editor
# A loose translation of contrib/editmerge to powershell
# Please make sure that both editmergeps.bat and editmerge.ps1 are available
# via %PATH% and use the following Mercurial settings to enable it
#
# [ui]
# editmergeps
# editmergeps.args=$output
# editmergeps.check=changed
# editmergeps.premerge=keep
$file=$args[0]
function Get-Lines
{
Select-String "^<<<<<<" $file | % {"$($_.LineNumber)"}
}
$ed = $Env:HGEDITOR;
if ($ed -eq $nil)
{
$ed = $Env:VISUAL;
}
if ($ed -eq $nil)
{
$ed = $Env:EDITOR;
}
if ($ed -eq $nil)
{
$ed = $(hg showconfig ui.editor);
}
if ($ed -eq $nil)
{
Write-Error "merge failed - unable to find editor"
exit 1
}
if (($ed -eq "vim") -or ($ed -eq "emacs") -or `
($ed -eq "nano") -or ($ed -eq "notepad++"))
{
$lines = Get-Lines
$firstline = if ($lines.Length -gt 0) { $lines[0] } else { $nil }
$previousline = $nil;
# open the editor to the first conflict until there are no more
# or the user stops editing the file
while (($firstline -ne $nil) -and ($firstline -ne $previousline))
{
if ($ed -eq "notepad++")
{
$linearg = "-n$firstline"
}
else
{
$linearg = "+$firstline"
}
Start-Process -Wait -NoNewWindow $ed $linearg,$file
$previousline = $firstline
$lines = Get-Lines
$firstline = if ($lines.Length -gt 0) { $lines[0] } else { $nil }
}
}
else
{
& "$ed" $file
}
$conflicts=Get-Lines
if ($conflicts.Length -ne 0)
{
Write-Output "merge failed - resolve the conflicts (line $conflicts) then use 'hg resolve --mark'"
exit 1
}
exit 0