[PATCH 2 of 2 contrib v2] contrib: make editmergeps able to work with notepad++

Kostia Balytskyi ikostia at fb.com
Fri May 19 20:03:01 EDT 2017


# HG changeset patch
# User Kostia Balytskyi <ikostia at fb.com>
# Date 1495238494 25200
#      Fri May 19 17:01:34 2017 -0700
# Node ID a13cabeef7fd58cde988b70b5911f78202c9eeb7
# Parent  a3098a10073eab5f0930e6bd6ddce6ba1de5349b
contrib: make editmergeps able to work with notepad++

Notepad++ has a different FIRSTLINE argument, so needs special handling.

diff --git a/contrib/editmergeps.ps1 b/contrib/editmergeps.ps1
--- a/contrib/editmergeps.ps1
+++ b/contrib/editmergeps.ps1
@@ -35,7 +35,8 @@ if ($ed -eq $nil)
   exit 1
 }
 
-if (($ed -eq "vim") -or ($ed -eq "emacs") -or ($ed -eq "nano"))
+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 }
@@ -46,6 +47,15 @@ if (($ed -eq "vim") -or ($ed -eq "emacs"
   # 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 $ed $linearg,$file
     $previousline = $firstline
     $lines = Get-Lines


More information about the Mercurial-devel mailing list