[PATCH 2 of 2 contrib] contrib: make editmergeps able to work with notepad++
Kostia Balytskyi
ikostia at fb.com
Fri May 19 18:38:21 EDT 2017
> -----Original Message-----
> From: Augie Fackler [mailto:raf at durin42.com]
> Sent: Friday, 19 May, 2017 14:43
> To: Kostia Balytskyi <ikostia at fb.com>
> Cc: mercurial-devel at mercurial-scm.org
> Subject: Re: [PATCH 2 of 2 contrib] contrib: make editmergeps able to work
> with notepad++
>
> On Thu, May 18, 2017 at 04:06:08PM -0700, Kostia Balytskyi wrote:
> > # HG changeset patch
> > # User Kostia Balytskyi <ikostia at fb.com> # Date 1495148281 25200
> > # Thu May 18 15:58:01 2017 -0700
> > # Node ID f715f6839ba2b93193334145e677d13a0f99cf89
> > # Parent 2412345e35cc0b17c98e050a480cb4b4f03bd5bb
> > contrib: make editmergeps able to work with notepad++
>
> Huh. Don't you need the -Wait for any $EDITOR? (Forgive me, I don't know a
> darn thing about powershell.)
Me neither :P
But this patch makes it so every editor will be invoked with -Wait. It seems not needed for non-Windows-UI apps (like cmd vim), but it also does not seem to hurt.
>
> I've taken patch 1 since it seems totally reasonable.
>
> >
> > This patch teaches editmergeps to work with Notepad++ editor. Tricky
> > part is to use Start-Process -Wait to make hg to wait for editor UI to close.
> >
> > 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,7 +47,16 @@ 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"
> > + if ($ed -eq "notepad++")
> > + {
> > + $linearg = "-n$firstline"
> > + }
> > + else
> > + {
> > + $linearg = "+$firstline"
> > + }
> > +
> > + 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
> > Mercurial-devel at mercurial-scm.org
> > https://urldefense.proofpoint.com/v2/url?u=https-3A__www.mercurial-
> 2Dscm.org_mailman_listinfo_mercurial-
> 2Ddevel&d=DwIBAg&c=5VD0RTtNlTh3ycd41b3MUw&r=Pp-
> gQYFgs4tKlSFPF5kfCw&m=1ucFRbTnUDTCrF1Tgq0PGnPiICsGO-
> GS0om9POdCP7U&s=_qFYXF81hHuuc3goCvrtHMakJ191DgZrVEkFFcOK9oM&
> e=
More information about the Mercurial-devel
mailing list