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: Tue, 10 Sep 2019 15:39:01 +0200 Message-ID: <87tv9kz2x6.fsf@gnu.org> References: <8736h9rdc4.fsf@gnu.org> <87mufcfz1u.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="73481"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Sep 10 15:39:20 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 1i7gMa-000Iym-6u for ged-emacs-devel@m.gmane.org; Tue, 10 Sep 2019 15:39:20 +0200 Original-Received: from localhost ([::1]:39918 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i7gMY-0000TL-D4 for ged-emacs-devel@m.gmane.org; Tue, 10 Sep 2019 09:39:18 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42138) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i7gMQ-0000T0-SH for emacs-devel@gnu.org; Tue, 10 Sep 2019 09:39:11 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:55471) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1i7gMQ-000897-Is; Tue, 10 Sep 2019 09:39:10 -0400 Original-Received: from auth1-smtp.messagingengine.com ([66.111.4.227]:47859) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.82) (envelope-from ) id 1i7gMQ-0007oH-87; Tue, 10 Sep 2019 09:39:10 -0400 Original-Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailauth.nyi.internal (Postfix) with ESMTP id CBFCF21B4C; Tue, 10 Sep 2019 09:39:09 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Tue, 10 Sep 2019 09:39:09 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrtddtgdeggecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufhffjgfkfgggtgesthdtredttdertdenucfhrhhomhepvfgrshhsihhl ohcujfhorhhnuceothhsughhsehgnhhurdhorhhgqeenucfkphepudefgedrudduledrvd egrdduleehnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhorhhnodhmvghsmhhtphgr uhhthhhpvghrshhonhgrlhhithihqdekieejfeekjeekgedqieefhedvleekqdhtshguhh eppehgnhhurdhorhhgsehfrghsthhmrghilhdrfhhmnecuvehluhhsthgvrhfuihiivgep td X-ME-Proxy: Original-Received: from jiffyarch (j289989.servers.jiffybox.net [134.119.24.195]) by mail.messagingengine.com (Postfix) with ESMTPA id D6CAC80060; Tue, 10 Sep 2019 09:39:08 -0400 (EDT) In-Reply-To: (Stefan Monnier's message of "Tue, 10 Sep 2019 08:56:09 -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:239977 Archived-At: Stefan Monnier writes: Hi Stefan, >> Would that mean that I would need to add functions >> >> vc-git-list-files (using: git ls-files) >> vc-hg-list-files (using: hg files) >> ... >> >> for all backends which support listing tracked files? > > For all backends for which you want to implement the feature yes. For > the rest, you define `vc-default-list-files` instead. 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)? >> And then project-files would call (vc-call-backend backend 'list-files) >> and if that signals vc-not-supported call cl-call-next-method? > > No. If there's no vc--list-files, then it calls > vc-default-list-files. No signal. > >> But how do I know the right backend without explicit tests? >> vc-backend wants a file and all I have is the project's directory. > > IIRC, vc.el calls vc-backend with the directory name in those cases. (vc-backend "~/Repos/el/emacs") => nil But that's my emacs git checkout... >> Also, I think most vc backends have a way to list tracked files but not >> all those are faster than find is. > > If it's not faster, then don't bother implementing > vc--list-files (unless the purpose is to get a different list > rather than to get the list faster). > >> So name the vc function vc--list-files-fast and only provide >> an implementation for Git? > > Sure. But please go through the vc-call-backend mechanism so as not > to break the abstraction. Well, I think a vc list-files is generally useful no matter the performance but for the usage in project-files from project.el the performance matters a lot. So IMO, I'd just go with a vc list-files-fast for the usage in project.el and possibly another vc list-files where implementation are also provided for the slower backends. Bye, Tassilo