From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 10063 invoked from network); 20 Jun 2020 10:44:08 -0000 Received: from ns1.primenet.com.au (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with ESMTPUTF8; 20 Jun 2020 10:44:08 -0000 Received: (qmail 14479 invoked by alias); 20 Jun 2020 10:43:58 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: Sender: zsh-workers@zsh.org X-Seq: 46084 Received: (qmail 16024 invoked by uid 1010); 20 Jun 2020 10:43:58 -0000 X-Qmail-Scanner-Diagnostics: from out4-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.3/25842. spamassassin: 3.4.4. Clear:RC:0(66.111.4.28):SA:0(-2.6/5.0):. Processed in 3.643755 secs); 20 Jun 2020 10:43:58 -0000 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at daniel.shahaf.name does not designate permitted sender hosts) X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudejkedgfeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvuffkjghfofggtgfgsehtqh dttdertdejnecuhfhrohhmpeffrghnihgvlhcuufhhrghhrghfuceougdrshesuggrnhhi vghlrdhshhgrhhgrfhdrnhgrmhgvqeenucggtffrrghtthgvrhhnpeektdefleegvefhue efteeifeevudekgfehgeevfeduffetledvtedvffdvueekudenucffohhmrghinhepmhgv rhgtuhhrihgrlhdqshgtmhdrohhrghenucfkphepjeelrddujeeirdefledrieelnecuve hluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepugdrshesuggr nhhivghlrdhshhgrhhgrfhdrnhgrmhgv X-ME-Proxy: Date: Sat, 20 Jun 2020 10:43:17 +0000 From: Daniel Shahaf To: Manuel Jacob Cc: zsh-workers@zsh.org Subject: Re: [PATCH v3] Add code to Mercurial VCS backend to show topic if there is any. Message-ID: <20200620104317.51bac64a@tarpaulin.shahaf.local2> In-Reply-To: <20200619233112.191102-1-me@manueljacob.de> References: <20200619233112.191102-1-me@manueljacob.de> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Manuel Jacob wrote on Sat, 20 Jun 2020 01:31 +0200: > "Topics" is an experimental concept in Mercurial that augments the > current branching concept (called "named branches"). >=20 > For more information, see the not always up-to-date Mercurial Wiki page > https://www.mercurial-scm.org/wiki/TopicPlan. > --- > Functions/VCS_Info/Backends/VCS_INFO_get_data_hg | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) >=20 > diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg b/Functions= /VCS_Info/Backends/VCS_INFO_get_data_hg > index cd5ef321d..deeb331a0 100644 > --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg > +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg > @@ -5,7 +5,7 @@ > =20 > setopt localoptions extendedglob NO_shwordsplit > =20 > -local hgbase bmfile branchfile rebasefile dirstatefile mqseriesfile \ > +local hgbase bmfile branchfile topicfile rebasefile dirstatefile mqserie= sfile \ > curbmfile curbm \ > mqstatusfile mqguardsfile patchdir mergedir \ > r_csetid r_lrev r_branch i_bmhash i_bmname \ > @@ -27,6 +27,7 @@ mergedir=3D"${hgbase}/.hg/merge/" > bmfile=3D"${hgbase}/.hg/bookmarks" > curbmfile=3D"${hgbase}/.hg/bookmarks.current" > branchfile=3D"${hgbase}/.hg/branch" > +topicfile=3D"${hgbase}/.hg/topic" > rebasefile=3D"${hgbase}/.hg/rebasestate" > dirstatefile=3D"${hgbase}/.hg/dirstate" > mqstatusfile=3D"${patchdir}/status" # currently applied patches > @@ -69,6 +70,13 @@ fi > # If we still don't know the branch it's safe to assume default > [[ -n ${r_branch} ]] || r_branch=3D"default" > =20 > +# Show topic if there is any (the UI for this experimental concept is no= t yet > +# final, but for a long time the convention has been to join the branch = name > +# and the topic name by a colon) > +if [[ -f ${topicfile} && -r ${topicfile} && -s ${topicfile} ]] ; then > + r_branch=3D${r_branch}:$(head -n 1 ${topicfile}) > +fi I'm happy to read the file directly, despite experimentality, given the discussion elsethread that you'll propose a corresponding unit test to the upstream maintainers. Using $(head) forks, and we try to avoid forks because they're expensive on some platforms. In this case, you could use =C2=ABIFS=3D read -r REPLY <$topicfile=C2=BB instead. (The construct =C2=AB$( # The working dir has uncommitted-changes if the revision ends with a + > if [[ $r_lrev[-1] =3D=3D + ]] ; then > hgchanges=3D1 Cheers, Daniel