From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Wolfgang Scherer Newsgroups: gmane.emacs.bugs Subject: bug#37189: Acknowledgement (25.4.1: vc-hg-ignore implementation is missing) Date: Tue, 27 Aug 2019 01:25:59 +0200 Message-ID: <52917e6f-2f00-25cf-4353-dfb40287d0ea@gmx.de> References: <1ba53ae2-42a4-3ab3-d4f2-2ceae565d198@gmx.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------7A183C289244CF8EE10D89FB" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="173108"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 To: 37189@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Aug 27 01:27:53 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 1i2OOu-000itc-Bm for geb-bug-gnu-emacs@m.gmane.org; Tue, 27 Aug 2019 01:27:52 +0200 Original-Received: from localhost ([::1]:58344 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i2OOs-0000Hd-GU for geb-bug-gnu-emacs@m.gmane.org; Mon, 26 Aug 2019 19:27:50 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57330) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i2OO8-0000HH-6v for bug-gnu-emacs@gnu.org; Mon, 26 Aug 2019 19:27:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i2OO6-0007Oz-TS for bug-gnu-emacs@gnu.org; Mon, 26 Aug 2019 19:27:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:38510) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i2OO6-0007Oq-Le for bug-gnu-emacs@gnu.org; Mon, 26 Aug 2019 19:27:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1i2OO6-0008U9-GW for bug-gnu-emacs@gnu.org; Mon, 26 Aug 2019 19:27:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Wolfgang Scherer Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 26 Aug 2019 23:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37189 X-GNU-PR-Package: emacs Original-Received: via spool by 37189-submit@debbugs.gnu.org id=B37189.156686197332526 (code B ref 37189); Mon, 26 Aug 2019 23:27:02 +0000 Original-Received: (at 37189) by debbugs.gnu.org; 26 Aug 2019 23:26:13 +0000 Original-Received: from localhost ([127.0.0.1]:47325 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i2ONJ-0008SY-Dv for submit@debbugs.gnu.org; Mon, 26 Aug 2019 19:26:13 -0400 Original-Received: from mout.gmx.net ([212.227.17.21]:56441) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i2ONH-0008SG-Ai for 37189@debbugs.gnu.org; Mon, 26 Aug 2019 19:26:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1566861960; bh=t7UqQGpNh1Vuaf4OptzThPSfWxdRcrVV5hvucwrqF18=; h=X-UI-Sender-Class:Subject:To:References:From:Date:In-Reply-To; b=TtdcJE2Q0sCtgqNMJF6KBGUVuH3e2cTnQGDwVzyl62Zml1JxPvrg0xNyzFdhWeSzc 2OgrdduDK68Aj0Rmw7B2hwr0sICO8wHKs78z4+2sAddFUFZMKYmOfnpBSSLofWibjB ET+ifkex4scAHHjnj8DAiF86mXMrSW1RAomtgE1U= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from sheckley.simul.de ([91.11.54.160]) by mail.gmx.com (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1M1Ygt-1i5PJD0yjr-0033xd for <37189@debbugs.gnu.org>; Tue, 27 Aug 2019 01:26:00 +0200 Original-Received: from [127.0.0.1] (sheckley.simul.de [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by sheckley.simul.de (Postfix) with ESMTPSA id 96D961940B96 for <37189@debbugs.gnu.org>; Tue, 27 Aug 2019 01:25:59 +0200 (CEST) Openpgp: preference=signencrypt Autocrypt: addr=Wolfgang.Scherer@gmx.de; prefer-encrypt=mutual; keydata= xsDiBEb46IgRBACMHOAb1KNo1Ylk+ebri+4R+bG4tyKlqBlrpv8D9/ZwRdXSGt+0DyCHoaAd 7KW7noHapLe87DunABOjKG4nqTGv+dRiWuUBlp3I4aYRFDVa3Da+XnIYkMHKqhK59VEHQCdp Km42nuLS7TS+n99at9YwzTG6VBdOlBKTlRFngOjVLwCg1RGXJ6X3EjS1FKCQeXziURVpWlkD /2zY6Ayhxi62TS84VjikXrrmjXykAAaAmMVEyKKYb9L5pGlqiZz9g/K9xw1EUoZTYuaufquD v4rAGR58K/3V4CYfJLEeshMWiaXHvMmlxMznlG16/um4MvmR8B3r+cx0nOPK1JBdD2qrkNnF Mw8FB+zouLFB4Gt2IUC5IlOmZ8OQA/4qdU53CItzWsCr9Nux4L0qUlRweSmCnV8xGQ2wP5XI MawIQxxREvSrsYDG8cNnYETMg4iQFfIktwAoxCJvuFAwIB6ZxHGF4FcEZm64CXc2u7CmFLqt rVhXhIfMz9oEYC+HhGczGamn9ofbGTFd2hJEtPcQgWNR4f7+aKkn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hH73Lr/u VnwgofIXADLfcqkwYHOeeZJ33DY2ToCxv5/khufwzxht6l1c3q6z8GWmTH09UC1KYL2NmJKB2 LJg9+wThMtfub2VI1dUqjvZIrRMPCq+Q5uTbahaXxYIFbCFr5t/99HNZ8bHNrBK3IHXaDmnUu dZjRqsYTce2qDsKYTn1kWrTx6KbCAJUDGAShA412+KrX6f6EAb7VUfWcCZrx6AkPqvx0lDOli 5tV16S9sIoK+wobuztnIYK7GcXt6GKj4IP88WbuyVu1AorwitE3mzZPFhnrUnKSILd12CWiq 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:165927 Archived-At: This is a multi-part message in MIME format. --------------7A183C289244CF8EE10D89FB Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Patch with commit message attached. --------------7A183C289244CF8EE10D89FB Content-Type: text/x-patch; name="0001-Provides-vc-hg-ignore-to-make-vc-ignore-work-correct.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename*0="0001-Provides-vc-hg-ignore-to-make-vc-ignore-work-correct.pa"; filename*1="tch" =46rom 7a238036ba08e3b1359e06839ea38b944bd0f2db Mon Sep 17 00:00:00 2001 From: Wolfgang Scherer Date: Tue, 27 Aug 2019 01:22:46 +0200 Subject: [PATCH] Provides vc-hg-ignore to make vc-ignore work correctly * lisp/vc/vc-hg.el: (vc-hg-ignore) Ignore file of directory. Add filepath relative to directory of Mercurial .hgignore file. The filepath is quoted according to the active ignore syntax (Bug#37189). (vc-hg--py-regexp-quote) Quote string as regexp to match exactly string. Copyright-paperwork-exempt: yes =2D-- lisp/vc/vc-hg.el | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++= +++++ 1 file changed, 58 insertions(+) diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el index f287adf..f4bddd2 100644 =2D-- a/lisp/vc/vc-hg.el +++ b/lisp/vc/vc-hg.el @@ -1153,6 +1153,46 @@ REV is ignored." (expand-file-name ".hgignore" (vc-hg-root file))) +(defun vc-hg-ignore (file &optional directory remove) + "Ignore FILE of DIRECTORY (default is `default-directory'). + +FILE is a file wildcard, relative to the root directory of DIRECTORY. + +If FILE matches the regular expression +`vc-hg-ignore-detect-wildcard', it is appended to .hgignore as +is. Otherwise, FILE is escaped/expanded according to the active +syntax in .hgignore. If the syntax is `regexp', FILE is quoted as +anchored literal Python regexp and if FILE is a directory, the +trailing `$' is omitted. Otherwise, if the syntax is `glob', +FILE is used unquoted and if FILE is a directory, a `*' is +appended. + +When called from Lisp code, if DIRECTORY is non-nil, the +repository to use will be deduced by DIRECTORY; if REMOVE is +non-nil, remove FILE from ignored files." + (let ((ignore (vc-hg-find-ignore-file (or directory default-directory))= ) + (pattern file) + root-dir file-path syntax) + (unless (string-match vc-hg-ignore-detect-wildcard pattern) + (setq root-dir (file-name-directory ignore)) + (setq file-path (expand-file-name file directory)) + (setq pattern (substring file-path (length root-dir))) + (save-match-data + (with-current-buffer (find-file-noselect ignore) + (goto-char (point-max)) + (setq syntax + (if (re-search-backward "^ *syntax: *\\(regexp\\|glob\\)$= " nil t) + (match-string 1) + "regexp"))) + (setq pattern + (if (string=3D syntax "regexp") + (concat "^" (vc-hg--py-regexp-quote pattern) + (and (not (file-directory-p file-path)) "$")) + (concat pattern (and (file-directory-p file-path) "*"))))= )) + (if remove + (vc--remove-regexp pattern ignore) + (vc--add-line pattern ignore)))) + ;; Modeled after the similar function in vc-bzr.el (defun vc-hg-checkout (file &optional rev) "Retrieve a revision of FILE. @@ -1451,6 +1491,24 @@ This function differs from vc-do-command in that it= invokes (defun vc-hg-root (file) (vc-find-root file ".hg")) +(defvar vc-hg--py-regexp-special-chars + (mapcar + (function + (lambda (_c) + (cons _c (concat "\\" (char-to-string _c))))) + (append "()[]{}?*+-|^$\\.&~# \t\n\r\v\f" nil)) + "Characters that have special meaning in Python regular expressions.") + +(defun vc-hg--py-regexp-quote (string) + "Return a Python regexp string which matches exactly STRING and nothing= else. +Ported from Python v3.7" + (mapconcat + (function + (lambda (_c) + (or (cdr (assq _c vc-hg--py-regexp-special-chars)) + (char-to-string _c)))) + string "")) + (provide 'vc-hg) ;;; vc-hg.el ends here =2D- 2.7.4 --------------7A183C289244CF8EE10D89FB--