From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dan Nicolaescu Newsgroups: gmane.emacs.devel Subject: Re: VC command for showing outgoing changes Date: Sat, 5 Dec 2009 19:28:22 -0800 (PST) Message-ID: <200912060328.nB63SMfG023478@godzilla.ics.uci.edu> References: <200910132024.n9DKOHGj015040@godzilla.ics.uci.edu> <200912051945.nB5Jjam5020140@godzilla.ics.uci.edu> <200912051952.nB5JqXSm020185@godzilla.ics.uci.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1260070220 22870 80.91.229.12 (6 Dec 2009 03:30:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 6 Dec 2009 03:30:20 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Dec 06 04:30:13 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NH7p6-0003NU-OR for ged-emacs-devel@m.gmane.org; Sun, 06 Dec 2009 04:30:13 +0100 Original-Received: from localhost ([127.0.0.1]:54808 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NH7p5-0003QD-Vh for ged-emacs-devel@m.gmane.org; Sat, 05 Dec 2009 22:30:12 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NH7oz-0003OA-W6 for emacs-devel@gnu.org; Sat, 05 Dec 2009 22:30:06 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NH7ov-0003J1-4p for emacs-devel@gnu.org; Sat, 05 Dec 2009 22:30:05 -0500 Original-Received: from [199.232.76.173] (port=49436 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NH7ou-0003Ig-Vz for emacs-devel@gnu.org; Sat, 05 Dec 2009 22:30:01 -0500 Original-Received: from paul-mcgann-v0.ics.uci.edu ([128.195.1.147]:59982) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NH7ou-0000JD-GG for emacs-devel@gnu.org; Sat, 05 Dec 2009 22:30:00 -0500 Original-Received: from godzilla.ics.uci.edu (godzilla.ics.uci.edu [128.195.10.101]) by paul-mcgann-v0.ics.uci.edu (8.13.8/8.13.8) with ESMTP id nB63SNr3003871 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 5 Dec 2009 19:28:23 -0800 Original-Received: (from dann@localhost) by godzilla.ics.uci.edu (8.13.8+Sun/8.13.6/Submit) id nB63SMfG023478; Sat, 5 Dec 2009 19:28:22 -0800 (PST) In-Reply-To: (Stefan Monnier's message of "Sat, 05 Dec 2009 15:53:03 -0500") Original-Lines: 93 X-ICS-MailScanner-Information: Please send mail to helpdesk@ics.uci.edu or more information X-ICS-MailScanner-ID: nB63SNr3003871 X-ICS-MailScanner: Found to be clean X-ICS-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-0.34, required 5, autolearn=disabled, ALL_TRUSTED -1.44, FM_MULTI_ODD2 1.10) X-ICS-MailScanner-From: dann@godzilla.ics.uci.edu X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:118335 Archived-At: Stefan Monnier writes: > >> Here's a patch that implements the generic vc-incoming, vc-outgoing and > >> implements the backend specific functions for bzr, hg and partially for > >> git (no incoming and outgoing is not quite right). > > I'd call them vc-log-incoming and vc-log-outgoing, to make it clear that > it shows this info in the form of a changelog (we could also have > vc-diff-incoming, vc-diff-outgoing, for example). OK. > [ Another option might be to specify the `outgoing' or `incoming' as > arguments to vc-print-log or vc-diff. Basically your `vc-(in|out)going' > is like (vc-print-log from-upstream to working-revision). ] That's > > +(defun vc-outgoing-internal (backend remote-location) > > + (let ((buff-name "*vc-outgoing*")) > > + (vc-call-backend backend 'outgoing buff-name remote-location) > > + (pop-to-buffer buff-name) > > + (vc-exec-after > > + `(let ((inhibit-read-only t) > > + (vc-log-view-type 'outgoing)) > > + (vc-call-backend ',backend 'log-view-mode) > > + (set (make-local-variable 'log-view-vc-backend) ',backend) > > + (set (make-local-variable 'log-view-vc-fileset) nil) > > + (shrink-window-if-larger-than-buffer) > > + (setq vc-sentinel-movepoint (point)) > > + (set-buffer-modified-p nil))))) > > The redundancy between these two functions is bad. Worse: there's It's mostly an effect of how this was done: I just did outgoing, and before sending this email copied + replaced outgoing->incoming as it was the quickest way to get it done. > redundancy between this duplicate code and vc-print-log-internal as > well, some of what is different is a bug: > (vc-call-backend ',backend 'log-view-mode) should be called before > `vc-exec-after', as seen in vc-print-log-internal. That change came after I wrote vc-outgoing-internal... > Also incoming/outgoing will probably want to obey vc-log-short-style, so > we really want to use as much of vc-print-log-internal as possible here. It won't work: outgoing/incoming are project wide, so the directory vs file logic used for vc-log-short-style does not apply. > > -(defvar vc-short-log) > > +(defvar log-view-type) > > > (define-derived-mode vc-hg-log-view-mode log-view-mode "Hg-Log-View" > > (require 'add-log) ;; we need the add-log faces > > (set (make-local-variable 'log-view-file-re) "\\`a\\`") > > (set (make-local-variable 'log-view-per-file-logs) nil) > > (set (make-local-variable 'log-view-message-re) > > - (if vc-short-log > > + (if (eq log-view-type 'short) > > "^\\([0-9]+\\)\\(?:\\[.*\\]\\)? +\\([0-9a-z]\\{12\\}\\) +\\(\\(?:[0-9]+\\)-\\(?:[0-9]+\\)-\\(?:[0-9]+\\) \\(?:[0-9]+\\):\\(?:[0-9]+\\) \\(?:[-+0-9]+\\)\\) +\\(.*\\)$" > j > Ah, so that's why you use dynamic-scoping for log-view-type, so it's > available while setting up the major-mode. > > Hmm... Exactly it's ugly, but... > And there's another related problem: > > > + (if (memq log-view-type '(short outgoing)) > > This is becoming very ad-hoc. I think the right answer is to let the > print-log backend operation set something up that the log-view-mode > operation can use subsequently. I.e. remove `log-view-mode' from the > generic part of the code, and let the backend set some permanent-local > variable in `print-log' to tell the subsequent `log-view-mode' which > kind of log to expect. > > We could still define a generic `log-view-type' or `log-view-format' > variable for it, tho. The idea is that the generic part of the code may > want to use it, e.g. to display it in the mode-line (and let button-2 > run a command that changes the format to something else). But it should > be set by the backend's `print-log' operation rather than by the > generic code. > > WDYT? > > > Stefan