unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#34305: [PATCH] Add switches to hg revert
@ 2019-02-04  2:55 Ian Dunn
  2019-02-04 16:54 ` Eli Zaretskii
  2019-02-05 17:59 ` Dmitry Gutov
  0 siblings, 2 replies; 6+ messages in thread
From: Ian Dunn @ 2019-02-04  2:55 UTC (permalink / raw)
  To: 34305

[-- Attachment #1: Type: text/plain, Size: 103 bytes --]


* vc/vc-hg.el (vc-hg-revert-switches): New user variable.
  (vc-hg-revert): Use switches for revert.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: vc-hg.el.diff --]
[-- Type: text/x-patch, Size: 1138 bytes --]

diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el
index befaabd5c6..e7b7de38e6 100644
--- a/lisp/vc/vc-hg.el
+++ b/lisp/vc/vc-hg.el
@@ -145,6 +145,16 @@ switches."
   :version "25.1"
   :group 'vc-hg)
 
+(defcustom vc-hg-revert-switches t
+  "String or list of strings specifying switches for hg revert
+under VC.  If t, use no switches."
+  ;; No nil option, since there's no `vc-revert-switches' variable.
+  :type '(choice (const :tag "None" t)
+		 (string :tag "Argument String")
+		 (repeat :tag "Argument List" :value ("") string))
+  :version "27.1"
+  :group 'vc-hg)
+
 (defcustom vc-hg-program "hg"
   "Name of the Mercurial executable (excluding any arguments)."
   :type 'string
@@ -1161,7 +1171,11 @@ REV is the revision to check out into WORKFILE."
 ;; Modeled after the similar function in vc-bzr.el
 (defun vc-hg-revert (file &optional contents-done)
   (unless contents-done
-    (with-temp-buffer (vc-hg-command t 0 file "revert"))))
+    (with-temp-buffer
+      (apply #'vc-hg-command
+             t 0 file
+             "revert"
+             (append (vc-switches 'hg 'revert))))))
 
 ;;; Hg specific functionality.
 

[-- Attachment #3: Type: text/plain, Size: 14 bytes --]


-- 
Ian Dunn

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#34305: [PATCH] Add switches to hg revert
  2019-02-04  2:55 bug#34305: [PATCH] Add switches to hg revert Ian Dunn
@ 2019-02-04 16:54 ` Eli Zaretskii
  2019-02-05 15:42   ` Ian Dunn
  2019-02-05 17:59 ` Dmitry Gutov
  1 sibling, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2019-02-04 16:54 UTC (permalink / raw)
  To: Ian Dunn; +Cc: 34305

> From: Ian Dunn <dunni@gnu.org>
> Date: Sun, 03 Feb 2019 21:55:50 -0500
> 
> * vc/vc-hg.el (vc-hg-revert-switches): New user variable.
>   (vc-hg-revert): Use switches for revert.

Thanks.  Please also include an announcement of this in NEWS.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#34305: [PATCH] Add switches to hg revert
  2019-02-04 16:54 ` Eli Zaretskii
@ 2019-02-05 15:42   ` Ian Dunn
  0 siblings, 0 replies; 6+ messages in thread
From: Ian Dunn @ 2019-02-05 15:42 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 34305

[-- Attachment #1: Type: text/plain, Size: 455 bytes --]

Does this work?

*** New user option 'vc-hg-revert-switches' specifies switches to pass
to hg revert.

On February 4, 2019 11:54:03 AM EST, Eli Zaretskii <eliz@gnu.org> wrote:
>> From: Ian Dunn <dunni@gnu.org>
>> Date: Sun, 03 Feb 2019 21:55:50 -0500
>> 
>> * vc/vc-hg.el (vc-hg-revert-switches): New user variable.
>>   (vc-hg-revert): Use switches for revert.
>
>Thanks.  Please also include an announcement of this in NEWS.

-- 
Ian Dunn

[-- Attachment #2: Type: text/html, Size: 851 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#34305: [PATCH] Add switches to hg revert
  2019-02-04  2:55 bug#34305: [PATCH] Add switches to hg revert Ian Dunn
  2019-02-04 16:54 ` Eli Zaretskii
@ 2019-02-05 17:59 ` Dmitry Gutov
  2019-02-07  1:42   ` Ian Dunn
  1 sibling, 1 reply; 6+ messages in thread
From: Dmitry Gutov @ 2019-02-05 17:59 UTC (permalink / raw)
  To: Ian Dunn, 34305

On 04.02.2019 05:55, Ian Dunn wrote:
> +  ;; No nil option, since there's no `vc-revert-switches' variable.

nil should still work (vc-switches checks whether vc-revert-switches is 
bound, it's not an error), and it would probably be more intuitive.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#34305: [PATCH] Add switches to hg revert
  2019-02-05 17:59 ` Dmitry Gutov
@ 2019-02-07  1:42   ` Ian Dunn
  2019-02-07  9:27     ` Dmitry Gutov
  0 siblings, 1 reply; 6+ messages in thread
From: Ian Dunn @ 2019-02-07  1:42 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 34305

[-- Attachment #1: Type: text/plain, Size: 390 bytes --]


    DG> On 04.02.2019 05:55, Ian Dunn wrote:
    >> +  ;; No nil option, since there's no `vc-revert-switches' variable.

    DG> nil should still work (vc-switches checks whether vc-revert-switches is bound,
    DG> it's not an error), and it would probably be more intuitive.

I see your point.  `vc-bzr-log-switches' does this as well.  I've updated the patch to use nil instead of t.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: vc-hg.el.diff --]
[-- Type: text/x-patch, Size: 1049 bytes --]

diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el
index befaabd5c6..e7b7de38e6 100644
--- a/lisp/vc/vc-hg.el
+++ b/lisp/vc/vc-hg.el
@@ -145,6 +145,15 @@ switches."
   :version "25.1"
   :group 'vc-hg)
 
+(defcustom vc-hg-revert-switches nil
+  "String or list of strings specifying switches for hg revert
+under VC."
+  :type '(choice (const :tag "None" nil)
+		 (string :tag "Argument String")
+		 (repeat :tag "Argument List" :value ("") string))
+  :version "27.1"
+  :group 'vc-hg)
+
 (defcustom vc-hg-program "hg"
   "Name of the Mercurial executable (excluding any arguments)."
   :type 'string
@@ -1161,7 +1171,11 @@ REV is the revision to check out into WORKFILE."
 ;; Modeled after the similar function in vc-bzr.el
 (defun vc-hg-revert (file &optional contents-done)
   (unless contents-done
-    (with-temp-buffer (vc-hg-command t 0 file "revert"))))
+    (with-temp-buffer
+      (apply #'vc-hg-command
+             t 0 file
+             "revert"
+             (append (vc-switches 'hg 'revert))))))
 
 ;;; Hg specific functionality.
 

[-- Attachment #3: Type: text/plain, Size: 14 bytes --]


-- 
Ian Dunn

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#34305: [PATCH] Add switches to hg revert
  2019-02-07  1:42   ` Ian Dunn
@ 2019-02-07  9:27     ` Dmitry Gutov
  0 siblings, 0 replies; 6+ messages in thread
From: Dmitry Gutov @ 2019-02-07  9:27 UTC (permalink / raw)
  To: Ian Dunn; +Cc: 34305-done

On 07.02.2019 04:42, Ian Dunn wrote:
> 
>      DG> On 04.02.2019 05:55, Ian Dunn wrote:
>      >> +  ;; No nil option, since there's no `vc-revert-switches' variable.
> 
>      DG> nil should still work (vc-switches checks whether vc-revert-switches is bound,
>      DG> it's not an error), and it would probably be more intuitive.
> 
> I see your point.  `vc-bzr-log-switches' does this as well.  I've updated the patch to use nil instead of t.

Pushed, thank you.





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-02-07  9:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-04  2:55 bug#34305: [PATCH] Add switches to hg revert Ian Dunn
2019-02-04 16:54 ` Eli Zaretskii
2019-02-05 15:42   ` Ian Dunn
2019-02-05 17:59 ` Dmitry Gutov
2019-02-07  1:42   ` Ian Dunn
2019-02-07  9:27     ` Dmitry Gutov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).