From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#38387: 27.0.50; [PATCH] vc-hg: use 'hg summary' to populate vc-dir headers Date: Mon, 2 Dec 2019 02:31:06 +0200 Message-ID: <4b1cce9f-b6b7-4d03-00e2-118cb7f8dbb5@yandex.ru> References: <7505dd70-86c1-9576-5dc9-42b1abca519e@yandex.ru> <0366bc0bf7f7c65bdc5e869397d4c945.squirrel@dancol.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="120274"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 Cc: 38387@debbugs.gnu.org To: Andrii Kolomoiets , Daniel Colascione Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Dec 02 01:32:12 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1ibZdL-000VAB-OJ for geb-bug-gnu-emacs@m.gmane.org; Mon, 02 Dec 2019 01:32:11 +0100 Original-Received: from localhost ([::1]:57148 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ibZdK-0001ER-0b for geb-bug-gnu-emacs@m.gmane.org; Sun, 01 Dec 2019 19:32:10 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45458) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ibZdD-0001E2-6j for bug-gnu-emacs@gnu.org; Sun, 01 Dec 2019 19:32:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ibZdB-0006uZ-Vd for bug-gnu-emacs@gnu.org; Sun, 01 Dec 2019 19:32:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:59142) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ibZdB-0006uU-Re for bug-gnu-emacs@gnu.org; Sun, 01 Dec 2019 19:32:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ibZdB-0004os-On for bug-gnu-emacs@gnu.org; Sun, 01 Dec 2019 19:32:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 02 Dec 2019 00:32:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38387 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 38387-submit@debbugs.gnu.org id=B38387.157524667818471 (code B ref 38387); Mon, 02 Dec 2019 00:32:01 +0000 Original-Received: (at 38387) by debbugs.gnu.org; 2 Dec 2019 00:31:18 +0000 Original-Received: from localhost ([127.0.0.1]:36882 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ibZcT-0004nq-5g for submit@debbugs.gnu.org; Sun, 01 Dec 2019 19:31:18 -0500 Original-Received: from mail-wm1-f53.google.com ([209.85.128.53]:51536) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ibZcQ-0004nc-Rt for 38387@debbugs.gnu.org; Sun, 01 Dec 2019 19:31:15 -0500 Original-Received: by mail-wm1-f53.google.com with SMTP id g206so19912386wme.1 for <38387@debbugs.gnu.org>; Sun, 01 Dec 2019 16:31:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=6g8HRLEE6P9r+zijchGeL5yjylgPcj14WzzzjYtfivU=; b=CPfSMJekG6Ujplp/hICubDjGnccZ2bCyu1I/CG929dtbKy7w8F77DRbm8Up60qt4x8 RFw+lg66fSfp3q9yyr6xKXC/5iTcZXFESb+5YLC0qRkleII1SJAE+kvxSu5yvgmDIDBW ks77+dmVvuo7B+pEBVm4G0oyedB8+BHI7cKhkQqvVGKoYuHpM0n/WzizwNdi1VymLfbj XFq6+44Y7e+EUlLpr6x2wTdWIosfTMzpJ5Lj1tmxjXg2GxqwdbMnxKkiHwan9tuNxOvl 0vuBZ0rR/icy1m5r3NXEyPD4pcfWjD7dCTO7zVV+sz7JKjCOptgnxThQQMue9bCCM43H +Heg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=6g8HRLEE6P9r+zijchGeL5yjylgPcj14WzzzjYtfivU=; b=p/YPN/hNwL9D66aRdtQWomD0PqQIHBj+0GtpjfBo3PZOVS3mIT1NDCkCeg3LpLYS4c gpcId+ZfE+bDC1TGcrSml0lP9qMIWa5VTONqmy+tbQiegNY9gzjInSTEND+9wzaM5oH7 qBd7zPXCgL6F9rh0g1uHuKRa3HwVwVzmlnMVDRcffxGUkXWOBAcelUmg9OH98GSjpqn4 /KWyY94CFZmEhw83EmHVra9BT94N8+aTNU+d5S0aGhjUPDRnVPwUdqk6FQF0R9c0Rgxc hxlC1w04zZP1ZkJNpMgaNdDBVio4XDnVRhfrOITDLALZpbr3aArkQaRxfDLHgY/3b+sD 4YlA== X-Gm-Message-State: APjAAAXLgAemA3S2QKvakcqlSAZRfkO25NfPvbqg9DSOFtdDX1DIc1fD t/+1dinaPJTmvW3UgnHRRKAZ0YfR X-Google-Smtp-Source: APXvYqzOjPnx9Ub5NzVMbIdSNhQ2Zz3812hB3qHrZMWaarenR+0yuLY8q+OvQSXq2NgxEQBd720mKA== X-Received: by 2002:a05:600c:2144:: with SMTP id v4mr18610136wml.31.1575246668542; Sun, 01 Dec 2019 16:31:08 -0800 (PST) Original-Received: from [192.168.0.5] ([212.50.117.215]) by smtp.googlemail.com with ESMTPSA id z189sm6870424wmc.2.2019.12.01.16.31.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 01 Dec 2019 16:31:07 -0800 (PST) In-Reply-To: Content-Language: en-US X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:172743 Archived-At: On 28.11.2019 10:07, Andrii Kolomoiets wrote: > Current output displays current branch and tag. There are also root dir, > but vc displays working dir itself, so root is not needed. > BTW root can be replaced with bookmark because bookmark is what > vc-hg-create-tag create when branchp. From user's POV the branch > creation is not working: > 1. Open vc-dir for hg repository > 2. C-u B c > 3. Enter branch name to create > and nothing changed in vc-dir - branch and tag are remains the same. Should it actually created branches instead? Or do Mercurial branches differ sufficiently from the same concept in other VCS? Could anybody say why vc-hg-create-tag has been using bookmarks from the outset? > Info that 'summary' shows but missed in the current output: > > - Parent revision and first line of commit message. > During merge both parents are shown. Very handy. > This info can be obtained by parsing 'hg log' command output. > > - Bookmarks, if any. > Can be obtained by 'hg id -B'. > > - Commit state. > Shows the count of modified, added, removed, renamed, copied, deleted, > unknown and unresolved files. Alright, all affected files are listed > in the same vc-dir buffer and one can count them so those numbers may > be not very interesting. > But commit state also can show if graft, update or merge is in > progress; if head are closed; if it is a new branch; if there are > changes in subrepositories. I don't know how to obtain this info. > > - Update state. > Shows the available updates count and/or branch heads count. > I don't know how obtain this info, maybe some log command. > > - Number of incoming and outgoing changes (with '--remote' switch). > It is slow, but we can allow user to decide use it or not. > > - Phase. Can show how many changesets are not shared yet. > > IMO 'summary' gives better overview of repo state. I'd like to hear from others about how crucial this info is. FWIW, I'm usually okay with the minimal VC-Dir output that vc-git does. >>> - Is 'hg summary' stable enough? Maybe a few years from now Mercurial >>> changes its output and this code stops working in all Emacs we'd have >>> released in the meantime? This is why we try to use "porcelain" level >>> commands (in Git terminology) when possible, not user-level. > > This code do nothing but propertize the text. We just show the user the > output of the user command. It would be a shame if it breaks anyway. > The layout can be messed though if the name-value separator will be > changed. To solve this the regexp can be put into the variable so it can > be changed easily. Removal of the 'summary' command is the worst case. > But AFAIK there are no prerequisites for this. Let's not hide usefull > info from the user because we affraid of hypothetical removal of the > 'summary' command :) > For now, comparing 'summary' output of hg 2.6.2 and 5.2, I can see that > phase info is added in recent version and no breaking changes at all. Moving the regexp into a var could alleviate the biggest part of the risk, indeed. >> What's the performance of summary like these days? > > Let's see. > > hg summary 0.21s user 0.16s system 98% cpu 0.376 total > > hg log -r 'p1(.)+p2(.)' 0.14s user 0.08s system 99% cpu 0.221 total > hg id --branch 0.14s user 0.13s system 98% cpu 0.280 total > hg id --tags 0.15s user 0.14s system 98% cpu 0.299 total > hg id --bookmarks 0.15s user 0.15s system 98% cpu 0.298 total > hg phase 0.12s user 0.07s system 97% cpu 0.193 total > > Yes, 'summary' is slower than single 'id' command. We're not comparing against a single one. Would it be faster than what we do now? The comparison above seems like it would? > But again, it is > faster to run a single command that gives all the info rather than run > five different commands. Imagine working with repo over TRAMP. TRAMP is an okay argument, too.