From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.devel Subject: Re: A project-files implementation for Git projects Date: Wed, 11 Sep 2019 13:00:49 +0200 Message-ID: <87a7bbjdwe.fsf@gnu.org> References: <8736h9rdc4.fsf@gnu.org> <87mufcfz1u.fsf@gnu.org> <87tv9kz2x6.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="27186"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Sep 11 13:02:07 2019 Return-path: Envelope-to: ged-emacs-devel@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 1i80Nz-0006rK-27 for ged-emacs-devel@m.gmane.org; Wed, 11 Sep 2019 13:02:07 +0200 Original-Received: from localhost ([::1]:49490 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i80Nx-0007pf-D8 for ged-emacs-devel@m.gmane.org; Wed, 11 Sep 2019 07:02:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59351) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i80Mn-0007nR-EL for emacs-devel@gnu.org; Wed, 11 Sep 2019 07:00:54 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:43383) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1i80Mn-0003sc-B2 for emacs-devel@gnu.org; Wed, 11 Sep 2019 07:00:53 -0400 Original-Received: from auth2-smtp.messagingengine.com ([66.111.4.228]:33411) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.82) (envelope-from ) id 1i80Mm-0006aH-HY for emacs-devel@gnu.org; Wed, 11 Sep 2019 07:00:52 -0400 Original-Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailauth.nyi.internal (Postfix) with ESMTP id BC62C2215D for ; Wed, 11 Sep 2019 07:00:51 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Wed, 11 Sep 2019 07:00:51 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrtdefgddtkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufhfffgjkfgfgggtsehttdertd dtredtnecuhfhrohhmpefvrghsshhilhhoucfjohhrnhcuoehtshguhhesghhnuhdrohhr gheqnecukfhppeegiedrkedtrdejtddrvdehnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hthhhorhhnodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdekieejfeekjeek gedqieefhedvleekqdhtshguhheppehgnhhurdhorhhgsehfrghsthhmrghilhdrfhhmne cuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Original-Received: from thinkpad-t440p (p2e504619.dip0.t-ipconnect.de [46.80.70.25]) by mail.messagingengine.com (Postfix) with ESMTPA id CE3F480064 for ; Wed, 11 Sep 2019 07:00:50 -0400 (EDT) Mail-Followup-To: emacs-devel@gnu.org In-Reply-To: (Stefan Monnier's message of "Tue, 10 Sep 2019 09:56:44 -0400") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:239986 Archived-At: Stefan Monnier writes: Hi Stefan, Dmitry & Eli, >> But what should this do? From a vc list-files function I'd expect >> (and document) that it lists all and only tracked files. So should >> the default implementation use find to locate all files and then >> check each one if it is tracked using vc-state (or something alike)? > > I'd pass it a "fallback" function, so you'd have something like: > > (defun vc-default-list-files-fast (backend ... fallback) > (funcall fallback)) > > and in the call you'd do > > (vc-call-backend (vc-responsible-backend dir) > 'list-files-fast ... #'cl-call-next-method) Ah, right, that's a good idea! >> (vc-backend "~/Repos/el/emacs") => nil >> But that's my emacs git checkout... > > Ah, indeed, it seems you want vc-responsible-backend instead. (vc-responsible-backend "~/Repos/el/emacs") => Git Yup, that's it! Dmitry Gutov writes: > On 10.09.2019 16:39, Tassilo Horn wrote: >> But what should this do? From a vc list-files function I'd expect >> (and document) that it lists all and only tracked files. So should >> the default implementation use find to locate all files and then >> check each one if it is tracked using vc-state (or something alike)? > > I'd really like it to be more feature-rich. I.e. to accept arguments > which files it will return, or blacklist/whitelist. > > In my limited testing, Git can handle it and will still return the > list of files much faster than the current find-based solution. > > It's a bit more complex to implement, though. That's why it has been > on my list for a while without much progress. Yes, I guess ideally it would take a list of vc-states like up-to-date, edited, needs-update (probably with the exclusion of unregistered) and list the files in any of the given states. I'll start simple with listing all tracked files... Eli Zaretskii writes: >> From: Tassilo Horn >> Date: Tue, 10 Sep 2019 08:25:17 +0200 >> Cc: emacs-devel@gnu.org >> >> Also, I think most vc backends have a way to list tracked files but >> not all those are faster than find is. "git ls-files" is much faster >> than find but short testing revealed that "hg files" is much slower. > > "hg files"? Did you mean "hg locate", perhaps? Or are there new > commands in hg that were added lately? (My installation of Mercurial > is quite old, so maybe I'm out of touch.) Seems so. --8<---------------cut here---------------start------------->8--- $ hg files --help hg files [OPTION]... [FILE]... list tracked files Print files under Mercurial control in the working directory or specified revision for given files (excluding removed files). Files can be specified as filenames or filesets. If no files are given to match, this command prints the names of all files under Mercurial control. --8<---------------cut here---------------end--------------->8--- > Anyway, whether 'find' or the VC-specific way is faster might be OS > dependent. I'm guessing you tested on GNU/Linux; Yes. > on MS-Windows, I get the opposite results for both hg and bzr (let > alone Git), even though my build of GNU Find is highly optimized and > generally much faster than other ports available on Windows. Plus, > 'find' might not be available on Windows, whereas the VC backend for a > repository must be available, almost by definition. > > So at the very least this should be customizable, and in general, > unless 'find' is orders of magnitude faster, I'd prefer to use VC in > all cases. Ok, you are right. I'll work on it and report back. Bye, Tassilo