Quantcast

[PATCH 1 of 2 contrib v2] contrib: make editmergeps able to work with Windows GUI editors

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH 1 of 2 contrib v2] contrib: make editmergeps able to work with Windows GUI editors

Kostia Balytskyi-2
# HG changeset patch
# User Kostia Balytskyi <[hidden email]>
# Date 1495238455 25200
#      Fri May 19 17:00:55 2017 -0700
# Node ID a3098a10073eab5f0930e6bd6ddce6ba1de5349b
# Parent  2412345e35cc0b17c98e050a480cb4b4f03bd5bb
contrib: make editmergeps able to work with Windows GUI editors

Using Start-Process -Wait makes it wait until the process finishes,
which is necesssary for Windows GUI applications. My short testing
also demonstrated that it does not hurt with command line vim.

diff --git a/contrib/editmergeps.ps1 b/contrib/editmergeps.ps1
--- a/contrib/editmergeps.ps1
+++ b/contrib/editmergeps.ps1
@@ -46,7 +46,7 @@ if (($ed -eq "vim") -or ($ed -eq "emacs"
   # or the user stops editing the file
   while (($firstline -ne $nil) -and ($firstline -ne $previousline))
   {
-    & "$ed" "+$firstline" "$file"
+    Start-Process -Wait $ed $linearg,$file
     $previousline = $firstline
     $lines = Get-Lines
     $firstline = if ($lines.Length -gt 0) { $lines[0] } else { $nil }
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

Kostia Balytskyi-2
# HG changeset patch
# User Kostia Balytskyi <[hidden email]>
# 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
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Loading...