contrib/editmergeps.ps1
changeset 32345 a438f5a3bc09
parent 32344 864fc285d10a
child 32568 4daf5c18055a
equal deleted inserted replaced
32344:864fc285d10a 32345:a438f5a3bc09
    33 {
    33 {
    34   Write-Error "merge failed - unable to find editor"
    34   Write-Error "merge failed - unable to find editor"
    35   exit 1
    35   exit 1
    36 }
    36 }
    37 
    37 
    38 if (($ed -eq "vim") -or ($ed -eq "emacs") -or ($ed -eq "nano"))
    38 if (($ed -eq "vim") -or ($ed -eq "emacs") -or `
       
    39     ($ed -eq "nano") -or ($ed -eq "notepad++"))
    39 {
    40 {
    40   $lines = Get-Lines
    41   $lines = Get-Lines
    41   $firstline = if ($lines.Length -gt 0) { $lines[0] } else { $nil }
    42   $firstline = if ($lines.Length -gt 0) { $lines[0] } else { $nil }
    42   $previousline = $nil;
    43   $previousline = $nil;
    43 
    44 
    44 
    45 
    45   # open the editor to the first conflict until there are no more
    46   # open the editor to the first conflict until there are no more
    46   # or the user stops editing the file
    47   # or the user stops editing the file
    47   while (($firstline -ne $nil) -and ($firstline -ne $previousline))
    48   while (($firstline -ne $nil) -and ($firstline -ne $previousline))
    48   {
    49   {
       
    50     if ($ed -eq "notepad++")
       
    51     {
       
    52         $linearg = "-n$firstline"
       
    53     }
       
    54     else
       
    55     {
       
    56         $linearg = "+$firstline"
       
    57     }
       
    58 
    49     Start-Process -Wait $ed $linearg,$file
    59     Start-Process -Wait $ed $linearg,$file
    50     $previousline = $firstline
    60     $previousline = $firstline
    51     $lines = Get-Lines
    61     $lines = Get-Lines
    52     $firstline = if ($lines.Length -gt 0) { $lines[0] } else { $nil }
    62     $firstline = if ($lines.Length -gt 0) { $lines[0] } else { $nil }
    53     Write-Output "firstline is: $firstline, previousline is: $previousline"
    63     Write-Output "firstline is: $firstline, previousline is: $previousline"