From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Aleksandr Vityazev via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#73357: [PATCH] Make vc-clone interactive Date: Thu, 19 Sep 2024 16:18:16 +0300 Message-ID: <875xqrlr3b.fsf@disroot.org> Reply-To: Aleksandr Vityazev Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19087"; mail-complaints-to="usenet@ciao.gmane.io" To: 73357@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Sep 19 15:19:06 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1srH3p-0004oy-DW for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 19 Sep 2024 15:19:05 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1srH3Y-0003Gk-2T; Thu, 19 Sep 2024 09:18:48 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1srH3V-0002xm-5G for bug-gnu-emacs@gnu.org; Thu, 19 Sep 2024 09:18:45 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srH3U-00026c-Kf for bug-gnu-emacs@gnu.org; Thu, 19 Sep 2024 09:18:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:Subject; bh=SdJNiM5RklzVKgbgzRj7Iu8C+ktQBvt2lOTwqP12Ve0=; b=fKNPyZgfp6PpQ7k1SSFItsrX4/ugGEZ6RCiYson8cg5mX+BNWaZxcHPtFONe3VV0asxCPMlUwGNEPL3u2cmQ/GPVQ/BaGHwmyRuhiMMCrqkoaJsNzd4n0Sl3bYc6uAsKpOrwroXx58VivpgBY1h1jzQpfTOOJQt05imBcSdjwpM4+bA58cXSamyRTP1kZm50eJGAR3HI9kogivGmwFDnQcEk3/5GbxKqtZo8A5oXPpy/B7k5MuLpbRwAOTasbHrtQQNA/hGC2ne4yElF/h8S6i0vje4e7fRK2q1z3phGxaH4npdd8cueGw6tKjhmDpzAJ4tXqpyXObQcxt38sxwUog==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1srH3l-0006bB-WA for bug-gnu-emacs@gnu.org; Thu, 19 Sep 2024 09:19:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Aleksandr Vityazev Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 19 Sep 2024 13:19:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 73357 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.172675193425345 (code B ref -1); Thu, 19 Sep 2024 13:19:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 19 Sep 2024 13:18:54 +0000 Original-Received: from localhost ([127.0.0.1]:60051 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1srH3d-0006ai-KR for submit@debbugs.gnu.org; Thu, 19 Sep 2024 09:18:53 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:52064) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1srH3a-0006aa-PI for submit@debbugs.gnu.org; Thu, 19 Sep 2024 09:18:51 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1srH3I-0001RF-Hy for bug-gnu-emacs@gnu.org; Thu, 19 Sep 2024 09:18:32 -0400 Original-Received: from layka.disroot.org ([178.21.23.139]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srH3F-00023m-61 for bug-gnu-emacs@gnu.org; Thu, 19 Sep 2024 09:18:32 -0400 Original-Received: from mail01.disroot.lan (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id 4C80F203B8 for ; Thu, 19 Sep 2024 15:18:25 +0200 (CEST) X-Virus-Scanned: SPAM Filter at disroot.org Original-Received: from layka.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id IB60tyztwGIP for ; Thu, 19 Sep 2024 15:18:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1726751904; bh=HnaePYTWo29Q8bUG9B70ORU9BnR0yQ5OgSy5JKQAv7M=; h=From:To:Subject:Date; b=WeVs9c3bvcczyvT3ZFxLJlvYNXDJhRC8Zlxsn7IvznFtwsb/L/aQTzqJwGALMWgnN STv5TaKMw6G6Ara1x+hm8s96vPzdvTd8WNdHepVrYZFewTy5NCUCp9p3/4EDLzW3TD l6PHGWBkLd74GQV4KYOiU1oYG6iYFkj2hPJyCOg5p0Zq1IvBRVZgtuu2j7u17hqytT QsdwZdm8xazBOcQ3WCjAWMQOJpCz0Dkr/yzFRq23tNW9Zgcz4RGL4jXa5sP/mpx+LH WTVmtpy7U8S0LccV32V1k0SkkKIX0epdY3NKfCxTIclym//OgfIVy/kxAq92SR3FVm RTVPBOLYDyeqw== Received-SPF: pass client-ip=178.21.23.139; envelope-from=avityazev@disroot.org; helo=layka.disroot.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:292048 Archived-At: --=-=-= Content-Type: text/plain Hi, Cloning is used quite often, so I would like to have an interactive command. A patch is attached to the email. WDYT? --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Make-vc-clone-interactive.patch Content-Description: [PATCH] Make vc-clone interactive >From 1fd3aa4b3afe4064bcc78787b99f4fa336e4031d Mon Sep 17 00:00:00 2001 Message-ID: <1fd3aa4b3afe4064bcc78787b99f4fa336e4031d.1726751543.git.avityazev@disroot.org> From: Aleksandr Vityazev Date: Thu, 19 Sep 2024 16:11:31 +0300 Subject: [PATCH] Make vc-clone interactive * lisp/vc/vc.el (vc-clone): Make interactive. (vc--remotes-history): New defvar. --- lisp/vc/vc.el | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 597a1622f5a..d3d3a302d45 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -3804,6 +3804,8 @@ vc-check-headers (interactive) (vc-call-backend (vc-backend buffer-file-name) 'check-headers)) +(defvar vc--remotes-history) + (defun vc-clone (remote &optional backend directory rev) "Clone repository REMOTE using version-control BACKEND, into DIRECTORY. If successful, return the string with the directory of the checkout; @@ -3815,19 +3817,31 @@ vc-clone backend in `vc-handled-backends' until one succeeds to clone REMOTE. If REV is non-nil, it indicates a specific revision to check out after cloning; the syntax of REV depends on what BACKEND accepts." - (setq directory (expand-file-name (or directory default-directory))) - (if backend - (progn - (unless (memq backend vc-handled-backends) - (error "Unknown VC backend %s" backend)) - (vc-call-backend backend 'clone remote directory rev)) - (catch 'ok - (dolist (backend vc-handled-backends) - (ignore-error vc-not-supported - (when-let ((res (vc-call-backend - backend 'clone - remote directory rev))) - (throw 'ok res))))))) + (interactive + (list (read-string "Remote: " nil 'vc--remotes-history) + (intern (completing-read "Backend: " vc-handled-backends nil t)) + (expand-file-name + (read-directory-name "Clone dir: ")) + (read-string "Revision (RET if not needed): "))) + (let ((directory (expand-file-name (or directory default-directory))) + (rev (unless (string-empty-p rev) rev))) + (setq directory + (if backend + (progn + (unless (memq backend vc-handled-backends) + (error "Unknown VC backend %s" backend)) + (vc-call-backend backend 'clone remote directory rev)) + (catch 'ok + (dolist (backend vc-handled-backends) + (ignore-error vc-not-supported + (when-let ((res (vc-call-backend + backend 'clone + remote directory rev))) + (throw 'ok res))))))) + (when (file-directory-p directory) + (if (called-interactively-p 'interactive) + (find-file directory) + directory)))) (declare-function log-view-current-tag "log-view" (&optional pos)) (defun vc-default-last-change (_backend file line) -- 2.46.0 --=-=-= Content-Type: text/plain -- Best regards, Aleksandr Vityazev --=-=-=--