unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* VC top of the tree diff and log
@ 2009-07-07 18:45 Dan Nicolaescu
  2009-07-08  2:50 ` Miles Bader
  2009-07-11 19:51 ` Stefan Monnier
  0 siblings, 2 replies; 34+ messages in thread
From: Dan Nicolaescu @ 2009-07-07 18:45 UTC (permalink / raw)
  To: emacs-devel


It is quite useful to see all the changes that are present in the tree,
not just the ones for the current file (that one gets by doing C-x v =
when editing a file). 

Currently the way to get a diff from the top of the tree is to:
C-x v d TOP_OF_THE_TREE_DIRECTORY RET
put the cursor on the ./ line
C-x v = 

It would be nice to have an easier way to do this.

Similar for showing the log.

Key bindings:
for log we could have C-x v L  (should be intuitive given that
vc-print-log uses C-x v l)

not sure what would be a good one for diff

Older VCS don't have the top of the tree concept, not sure what to do
about those, but we can just ignore them for the time being.

Opinions?




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

* Re: VC top of the tree diff and log
  2009-07-07 18:45 VC top of the tree diff and log Dan Nicolaescu
@ 2009-07-08  2:50 ` Miles Bader
  2009-07-08 21:10   ` Dan Nicolaescu
  2009-07-11 19:51 ` Stefan Monnier
  1 sibling, 1 reply; 34+ messages in thread
From: Miles Bader @ 2009-07-08  2:50 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: emacs-devel

Dan Nicolaescu <dann@ics.uci.edu> writes:
> It is quite useful to see all the changes that are present in the tree,
> Similar for showing the log.
> Opinions?

Strongly agree -- indeed, I'm often surprised (and annoyed) when
"C-x v l" in git gives me just that file's log.

-Miles

-- 
We live, as we dream -- alone....




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

* Re: VC top of the tree diff and log
  2009-07-08  2:50 ` Miles Bader
@ 2009-07-08 21:10   ` Dan Nicolaescu
  2009-07-08 23:01     ` Miles Bader
  0 siblings, 1 reply; 34+ messages in thread
From: Dan Nicolaescu @ 2009-07-08 21:10 UTC (permalink / raw)
  To: Miles Bader; +Cc: emacs-devel

Miles Bader <miles@gnu.org> writes:

  > Dan Nicolaescu <dann@ics.uci.edu> writes:
  > > It is quite useful to see all the changes that are present in the tree,
  > > Similar for showing the log.
  > > Opinions?
  > 
  > Strongly agree -- indeed, I'm often surprised (and annoyed) when
  > "C-x v l" in git gives me just that file's log.

A related question: should we have an option (or default?) to show the
short version (--pretty=oneline --graph) ?

And another one: should we have a binding for RET in the log buffer?




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

* Re: VC top of the tree diff and log
  2009-07-08 21:10   ` Dan Nicolaescu
@ 2009-07-08 23:01     ` Miles Bader
  2009-07-09  0:29       ` Dan Nicolaescu
  2009-07-16 21:38       ` Dan Nicolaescu
  0 siblings, 2 replies; 34+ messages in thread
From: Miles Bader @ 2009-07-08 23:01 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: emacs-devel

Dan Nicolaescu <dann@ics.uci.edu> writes:
> A related question: should we have an option (or default?) to show the
> short version (--pretty=oneline --graph) ?

Would be useful, though I dunno what you'd bind it too... at some point
having too many bindings for essentially-similar-commands becomes kind
of annoying/confusing.

I don't really like the default --pretty=oneline format though, as it
wastes too much space on the hash, and doesn't show a date (which I find
very useful in looking at logs).

Here's what I use (with my own "slog" alias):

   --date=short --pretty=format:"%h  %ad  %s" --abbrev-commit

[note there are _two_ spaces between fields, which makes the result much
more readable than one, I think]

-Miles

-- 
Suburbia: where they tear out the trees and then name streets after them.




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

* Re: VC top of the tree diff and log
  2009-07-08 23:01     ` Miles Bader
@ 2009-07-09  0:29       ` Dan Nicolaescu
  2009-07-09  3:05         ` Miles Bader
  2009-07-16 21:38       ` Dan Nicolaescu
  1 sibling, 1 reply; 34+ messages in thread
From: Dan Nicolaescu @ 2009-07-09  0:29 UTC (permalink / raw)
  To: Miles Bader; +Cc: emacs-devel

Miles Bader <miles@gnu.org> writes:

  > Dan Nicolaescu <dann@ics.uci.edu> writes:
  > > A related question: should we have an option (or default?) to show the
  > > short version (--pretty=oneline --graph) ?
  > 
  > Would be useful, though I dunno what you'd bind it too... at some point
  > having too many bindings for essentially-similar-commands becomes kind
  > of annoying/confusing.

I am thinking that we could have 2 modes for the log: 
- a short one that would be used by default for directory logs
- the current long one that would be used for file logs
(I haven't completely thought this through)...

  > I don't really like the default --pretty=oneline format though, as it
  > wastes too much space on the hash, and doesn't show a date (which I find
  > very useful in looking at logs).
  > 
  > Here's what I use (with my own "slog" alias):
  > 
  >    --date=short --pretty=format:"%h  %ad  %s" --abbrev-commit

Looks better indeed. As long as the version that it prints can be used
to show the corresponding diff, we should be good.

  > [note there are _two_ spaces between fields, which makes the result much
  > more readable than one, I think]

I want the graph too




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

* Re: VC top of the tree diff and log
  2009-07-09  0:29       ` Dan Nicolaescu
@ 2009-07-09  3:05         ` Miles Bader
  2009-07-09  3:58           ` C-x v l in a dired buffer [was: Re: VC top of the tree diff and log] Dan Nicolaescu
  2009-07-09  6:48           ` VC top of the tree diff and log Dan Nicolaescu
  0 siblings, 2 replies; 34+ messages in thread
From: Miles Bader @ 2009-07-09  3:05 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: emacs-devel

Dan Nicolaescu <dann@ics.uci.edu> writes:
>   > Would be useful, though I dunno what you'd bind it too... at some point
>   > having too many bindings for essentially-similar-commands becomes kind
>   > of annoying/confusing.
>
> I am thinking that we could have 2 modes for the log: 
> - a short one that would be used by default for directory logs
> - the current long one that would be used for file logs
> (I haven't completely thought this through)...

I normally am interested in exactly the same thing from either file or
project logs:  detailed info about the last few changesets.  I use short
logs too (when I'm trying to discover longer-term trends instead of
detailed info), but there seems no connection with whether I restrict
the scope to a file or not.

What sounds nice to me would be a quick "toggle log mode" binding in the
log display buffer (with caching so it's fast, and smart preservation of
point position in the log, etc), or maybe even better, a "toggle
detailed info for this entry" binding, but maybe those aren't so easy to
implement in emacs...  [Hmm... "*" comes to mind for some reason, though
I have no idea why...]

As far as global vs. file logs, I think maybe I'd prefer to _always_ get
global logs in git/svn/... but with some slight hint about the file when
invoked from a file buffer -- e.g., maybe display entries not related to
the file in a "dim" face, and initially position the cursor on the first
modification to the file, etc.  My reasoning is that I don't think I
really mean "show me the history of this file", when I use "C-x v l",
but rather "show me recent history of the project, given that I happen
to be in a file in that project".  [Real file logs would be nice too,
when there's too much chaff, but they seem secondary, rather than
primary.]

[Incidentally, one thing that definitely _should_ work, but doesn't, is
that "C-x v l" in a dired buffer...]

I suppose maybe the real question underlying this thread is how much vc
should try to emulate historical CVS-oriented behavior when used with
newer source control systems that have different models.  Personally I
think it should be a bit looser about this, and do what's "natural"
rather than what's "historically compatible".  But maybe that's just
me...

-Miles

-- 
P.S.  All information contained in the above letter is false,
      for reasons of military security.




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

* C-x v l in a dired buffer [was: Re: VC top of the tree diff and log]
  2009-07-09  3:05         ` Miles Bader
@ 2009-07-09  3:58           ` Dan Nicolaescu
  2009-07-09  6:48           ` VC top of the tree diff and log Dan Nicolaescu
  1 sibling, 0 replies; 34+ messages in thread
From: Dan Nicolaescu @ 2009-07-09  3:58 UTC (permalink / raw)
  To: Miles Bader; +Cc: emacs-devel

Miles Bader <miles@gnu.org> writes:

  > [Incidentally, one thing that definitely _should_ work, but doesn't, is
  > that "C-x v l" in a dired buffer...]

If you add this to the cond in vc-deduce-fileset chances are that it
would work (not tested at all, and it has not error handling in case you
are not in a VC controlled directory)

  ((derived-mode-p 'dired-mode)
    (list (vc-responsible-backend default-directory)
          default-directory))




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

* Re: VC top of the tree diff and log
  2009-07-09  3:05         ` Miles Bader
  2009-07-09  3:58           ` C-x v l in a dired buffer [was: Re: VC top of the tree diff and log] Dan Nicolaescu
@ 2009-07-09  6:48           ` Dan Nicolaescu
  1 sibling, 0 replies; 34+ messages in thread
From: Dan Nicolaescu @ 2009-07-09  6:48 UTC (permalink / raw)
  To: Miles Bader; +Cc: emacs-devel

Miles Bader <miles@gnu.org> writes:

  > Dan Nicolaescu <dann@ics.uci.edu> writes:
  > >   > Would be useful, though I dunno what you'd bind it too... at some point
  > >   > having too many bindings for essentially-similar-commands becomes kind
  > >   > of annoying/confusing.
  > >
  > > I am thinking that we could have 2 modes for the log: 
  > > - a short one that would be used by default for directory logs
  > > - the current long one that would be used for file logs
  > > (I haven't completely thought this through)...
  > 
  > I normally am interested in exactly the same thing from either file or
  > project logs:  detailed info about the last few changesets.  I use short
  > logs too (when I'm trying to discover longer-term trends instead of
  > detailed info), but there seems no connection with whether I restrict
  > the scope to a file or not.
  > 
  > What sounds nice to me would be a quick "toggle log mode" binding in the
  > log display buffer (with caching so it's fast, and smart preservation of
  > point position in the log, etc), or maybe even better, a "toggle
  > detailed info for this entry" binding, but maybe those aren't so easy to
  > implement in emacs...  [Hmm... "*" comes to mind for some reason, though
  > I have no idea why...]

Toggling between long and short logs for the whole log is not hard.
I can implement this, the we can decide on the UI 

I am not convinced that "toggle detailed info for this entry" is very
useful.  If the detailed info is displayed in a different window, it
should not be too hard either (if the underlying VCS has some easy way to
retrieve such info).


  > As far as global vs. file logs, I think maybe I'd prefer to _always_ get
  > global logs in git/svn/... but with some slight hint about the file when
  > invoked from a file buffer -- e.g., maybe display entries not related to
  > the file in a "dim" face, and initially position the cursor on the first
  > modification to the file, etc.  My reasoning is that I don't think I
  > really mean "show me the history of this file", when I use "C-x v l",
  > but rather "show me recent history of the project, given that I happen
  > to be in a file in that project".  [Real file logs would be nice too,
  > when there's too much chaff, but they seem secondary, rather than
  > primary.]

I don't want to see global history when looking at a file , the VCS does
not matter.
After working with source trees that are > 1GB and tens of thousands of
files...




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

* Re: VC top of the tree diff and log
  2009-07-07 18:45 VC top of the tree diff and log Dan Nicolaescu
  2009-07-08  2:50 ` Miles Bader
@ 2009-07-11 19:51 ` Stefan Monnier
  2009-07-23  5:43   ` Dan Nicolaescu
  1 sibling, 1 reply; 34+ messages in thread
From: Stefan Monnier @ 2009-07-11 19:51 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: emacs-devel

> Currently the way to get a diff from the top of the tree is to:
> C-x v d TOP_OF_THE_TREE_DIRECTORY RET
> put the cursor on the ./ line
> C-x v =

I always have the vc-dir buffer open, so I only need the last 2 steps
(move to ./ and hit C-x v =).  I think it's a good way to work.

> Key bindings:
> for log we could have C-x v L  (should be intuitive given that
> vc-print-log uses C-x v l)

It might be a good idea.

Of course, others might argue that l-vs-L should be used for
"brief-vs-verbose" log output or somesuch.

> not sure what would be a good one for diff

I don't understand: why not just use the capitalized = sign?

> Older VCS don't have the top of the tree concept, not sure what to do
> about those, but we can just ignore them for the time being.

No need to worry about it, there are plenty of ways to make them
behave sensibly.


        Stefan




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

* Re: VC top of the tree diff and log
  2009-07-08 23:01     ` Miles Bader
  2009-07-09  0:29       ` Dan Nicolaescu
@ 2009-07-16 21:38       ` Dan Nicolaescu
  2009-07-18 21:45         ` Juri Linkov
  1 sibling, 1 reply; 34+ messages in thread
From: Dan Nicolaescu @ 2009-07-16 21:38 UTC (permalink / raw)
  To: Miles Bader; +Cc: emacs-devel

Miles Bader <miles@gnu.org> writes:

  > Dan Nicolaescu <dann@ics.uci.edu> writes:
  > > A related question: should we have an option (or default?) to show the
  > > short version (--pretty=oneline --graph) ?
  > 
  > Would be useful, though I dunno what you'd bind it too... at some point
  > having too many bindings for essentially-similar-commands becomes kind
  > of annoying/confusing.
  > 
  > I don't really like the default --pretty=oneline format though, as it
  > wastes too much space on the hash, and doesn't show a date (which I find
  > very useful in looking at logs).
  > 
  > Here's what I use (with my own "slog" alias):
  > 
  >    --date=short --pretty=format:"%h  %ad  %s" --abbrev-commit
  > 
  > [note there are _two_ spaces between fields, which makes the result much
  > more readable than one, I think]

Here's what I have now, it defaults to showing short log (and the graph
is shown in both the short and long versions).  It's git specific (no
integration with VC), there's no UI for switching between the long and
short version yet.

Ideas (or even better, code) on how to make all these fit together are
welcome. 


--- vc-git.el.~1.82.~	2009-06-26 18:46:22.000000000 -0700
+++ vc-git.el	2009-07-16 14:22:57.000000000 -0700
@@ -118,6 +118,13 @@ If nil, use the value of `vc-diff-switch
   :version "23.1"
   :group 'vc)
 
+(defcustom vc-git-add-signoff nil
+  "Add a Signoff-by line whn comitting."
+  :type 'boolean
+  :version "23.2"
+  :group 'vc)
+
+
 (defvar git-commits-coding-system 'utf-8
   "Default coding system for git commits.")
 
@@ -417,10 +424,10 @@ If nil, use the value of `vc-diff-switch
 (defun vc-git-unregister (file)
   (vc-git-command nil 0 file "rm" "-f" "--cached" "--"))
 
-
 (defun vc-git-checkin (files rev comment)
   (let ((coding-system-for-write git-commits-coding-system))
-    (vc-git-command nil 0 files "commit" "-m" comment "--only" "--")))
+    (vc-git-command nil 0 files "commit"
+		    (if vc-git-add-signoff "-s" "") "-m" comment "--only" "--")))
 
 (defun vc-git-find-revision (file rev buffer)
   (let ((coding-system-for-read 'binary)
@@ -444,6 +451,8 @@ If nil, use the value of `vc-diff-switch
 
 ;;; HISTORY FUNCTIONS
 
+(defvar vc-git-log-type 'short)
+
 (defun vc-git-print-log (files &optional buffer)
   "Get change log associated with FILES."
   (let ((coding-system-for-read git-commits-coding-system)
@@ -458,8 +467,13 @@ If nil, use the value of `vc-diff-switch
     (let ((inhibit-read-only t))
       (with-current-buffer
           buffer
-	(vc-git-command buffer 'async files
-			"rev-list" "--pretty" "HEAD" "--")))))
+	(if (eq vc-git-log-type 'short)
+	    (vc-git-command buffer 'async files
+			    "log" "--graph"
+			    "--date=short" "--pretty=format:%h  %ad  %s" "--abbrev-commit"
+			    "--")
+	  (vc-git-command buffer 'async files
+			  "rev-list" "--graph" "--pretty" "HEAD" "--"))))))
 
 (defvar log-view-message-re)
 (defvar log-view-file-re)
@@ -472,29 +486,37 @@ If nil, use the value of `vc-diff-switch
   (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)
-       "^commit *\\([0-9a-z]+\\)")
+       (if (eq vc-git-log-type 'short)
+	 "^[*/\\| ]+ \\([0-9a-z]+\\)  \\([-a-z0-9]+\\)  \\(.*\\)"
+	 "^[ */\\|]+commit *\\([0-9a-z]+\\)"))
   (set (make-local-variable 'log-view-font-lock-keywords)
-       (append
-        `((,log-view-message-re  (1 'change-log-acknowledgement)))
-        ;; Handle the case:
-        ;; user: foo@bar
-        '(("^Author:[ \t]+\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)"
-           (1 'change-log-email))
-          ;; Handle the case:
-          ;; user: FirstName LastName <foo@bar>
-          ("^Author:[ \t]+\\([^<(]+?\\)[ \t]*[(<]\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)[>)]"
-           (1 'change-log-name)
-           (2 'change-log-email))
-          ("^ +\\(?:\\(?:[Aa]cked\\|[Ss]igned-[Oo]ff\\)-[Bb]y:\\)[ \t]+\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)"
-           (1 'change-log-name))
-          ("^ +\\(?:\\(?:[Aa]cked\\|[Ss]igned-[Oo]ff\\)-[Bb]y:\\)[ \t]+\\([^<(]+?\\)[ \t]*[(<]\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)[>)]"
-           (1 'change-log-name)
-           (2 'change-log-email))
-          ("^Merge: \\([0-9a-z]+\\) \\([0-9a-z]+\\)"
-           (1 'change-log-acknowledgement)
-           (2 'change-log-acknowledgement))
-          ("^Date:   \\(.+\\)" (1 'change-log-date))
-          ("^summary:[ \t]+\\(.+\\)" (1 'log-view-message))))))
+       (if (eq vc-git-log-type 'short)
+	   (append
+	    `((,log-view-message-re
+	       (1 'change-log-acknowledgement)
+	       (2 'change-log-date))))
+	 (append
+	  `((,log-view-message-re  (1 'change-log-acknowledgement)))
+	  ;; Handle the case:
+	  ;; user: foo@bar
+	  '((" Author:[ \t]+\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)"
+	     (1 'change-log-email))
+	    ;; Handle the case:
+	    ;; user: FirstName LastName <foo@bar>
+	    (" Author:[ \t]+\\([^<(]+?\\)[ \t]*[(<]\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)[>)]"
+	     (1 'change-log-name)
+	     (2 'change-log-email))
+	    ("^ +\\(?:\\(?:[Aa]cked\\|[Ss]igned-[Oo]ff\\)-[Bb]y:\\)[ \t]+\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)"
+	     (1 'change-log-name))
+	    ("^ +\\(?:\\(?:[Aa]cked\\|[Ss]igned-[Oo]ff\\)-[Bb]y:\\)[ \t]+\\([^<(]+?\\)[ \t]*[(<]\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)[>)]"
+	     (1 'change-log-name)
+	     (2 'change-log-email))
+	    (" Merge: \\([0-9a-z]+\\) \\([0-9a-z]+\\)"
+	     (1 'change-log-acknowledgement)
+	     (2 'change-log-acknowledgement))
+	    (" Date:   \\(.+\\)" (1 'change-log-date))
+	    (" summary:[ \t]+\\(.+\\)" (1 'log-view-message)))))))
+
 
 (defun vc-git-show-log-entry (revision)
   "Move to the log entry for REVISION.
@@ -633,12 +655,20 @@ or BRANCH^ (where \"^\" can be repeated)
     (define-key map [git-grep]
       '(menu-item "Git grep..." vc-git-grep
 		  :help "Run the `git grep' command"))
+    (define-key map [git-sig]
+      '(menu-item "Add Signoff-by on commit" vc-git-toggle-signoff
+	      :help "Add Add Signed-off-by when commiting (i.e. add the -s flag)"
+	      :button (:toggle . vc-git-add-signoff)))
     map))
 
 (defun vc-git-extra-menu () vc-git-extra-menu-map)
 
 (defun vc-git-extra-status-menu () vc-git-extra-menu-map)
 
+(defun vc-git-toggle-signoff ()
+  (interactive)
+  (setq vc-git-add-signoff (not vc-git-add-signoff)))
+
 ;; Derived from `lgrep'.
 (defun vc-git-grep (regexp &optional files dir)
   "Run git grep, searching for REGEXP in FILES in directory DIR.




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

* Re: VC top of the tree diff and log
  2009-07-16 21:38       ` Dan Nicolaescu
@ 2009-07-18 21:45         ` Juri Linkov
  0 siblings, 0 replies; 34+ messages in thread
From: Juri Linkov @ 2009-07-18 21:45 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: emacs-devel, Miles Bader

> Here's what I have now, it defaults to showing short log (and the graph
> is shown in both the short and long versions).  It's git specific (no
> integration with VC), there's no UI for switching between the long and
> short version yet.
>
> Ideas (or even better, code) on how to make all these fit together are
> welcome.

I think the first step should be creating a set of defcustoms that will
cover most needs.  For example, I prefer the format "%h %ai %s" instead
of %h %ad %s" and so on.  This should be customizable.

The second step could be creating UI for switching between different formats
by temporarily rebinding the values of these customizable variables.

-- 
Juri Linkov
http://www.jurta.org/emacs/




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

* Re: VC top of the tree diff and log
  2009-07-11 19:51 ` Stefan Monnier
@ 2009-07-23  5:43   ` Dan Nicolaescu
  2009-07-30  7:18     ` Dan Nicolaescu
  0 siblings, 1 reply; 34+ messages in thread
From: Dan Nicolaescu @ 2009-07-23  5:43 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

  > > Key bindings:
  > > for log we could have C-x v L  (should be intuitive given that
  > > vc-print-log uses C-x v l)
  > 
  > It might be a good idea.
  > 
  > > not sure what would be a good one for diff
  > 
  > I don't understand: why not just use the capitalized = sign?

Sorry, I probably use one of those antique keyboards that don't have
such a sign...

See what I currently have.  What do you think?

Index: vc-hooks.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/vc-hooks.el,v
retrieving revision 1.279
diff -u -3 -p -r1.279 vc-hooks.el
--- vc-hooks.el	26 Jun 2009 23:54:00 -0000	1.279
+++ vc-hooks.el	23 Jul 2009 05:33:31 -0000
@@ -934,6 +934,7 @@ current, and kill the buffer that visits
     (define-key map "h" 'vc-insert-headers)
     (define-key map "i" 'vc-register)
     (define-key map "l" 'vc-print-log)
+    (define-key map "L" 'vc-print-root-log)
     (define-key map "m" 'vc-merge)
     (define-key map "r" 'vc-retrieve-tag)
     (define-key map "s" 'vc-create-tag)
@@ -941,6 +942,7 @@ current, and kill the buffer that visits
     (define-key map "v" 'vc-next-action)
     (define-key map "+" 'vc-update)
     (define-key map "=" 'vc-diff)
+    (define-key map "D" 'vc-root-diff)
     (define-key map "~" 'vc-revision-other-window)
     map))
 (fset 'vc-prefix-map vc-prefix-map)
@@ -969,12 +971,18 @@ current, and kill the buffer that visits
     (define-key map [vc-diff]
       '(menu-item "Compare with Base Version" vc-diff
 		  :help "Compare file set with the base version"))
+    (define-key map [vc-root-diff]
+      '(menu-item "Compare Tree with Base Version" vc-root-diff
+		  :help "Compare current tree with the base version"))
     (define-key map [vc-update-change-log]
       '(menu-item "Update ChangeLog" vc-update-change-log
 		  :help "Find change log file and add entries from recent version control logs"))
     (define-key map [vc-print-log]
       '(menu-item "Show History" vc-print-log
 		  :help "List the change log of the current file set in a window"))
+    (define-key map [vc-print-root-log]
+      '(menu-item "Show Top of the Tree History " vc-print-root-log
+		  :help "List the change log for the current tree in a window"))
     (define-key map [separator2] '("----"))
     (define-key map [vc-insert-header]
       '(menu-item "Insert Header" vc-insert-headers
Index: vc.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/vc.el,v
retrieving revision 1.721
diff -u -3 -p -r1.721 vc.el
--- vc.el	23 Jul 2009 05:21:36 -0000	1.721
+++ vc.el	23 Jul 2009 05:33:32 -0000
@@ -465,6 +465,9 @@
 ;;   `revert' operations itself, without calling the backend system.  The
 ;;   default implementation always returns nil.
 ;;
+;; - root (file)
+;;   Return the root of the VC controlled hierarchy for file.
+;;
 ;; - repository-hostname (dirname)
 ;;
 ;;   Return the hostname that the backend will have to contact
@@ -1592,6 +1595,33 @@ saving the buffer."
     (vc-diff-internal t (vc-deduce-fileset) nil nil (interactive-p))))
 
 ;;;###autoload
+(defun vc-root-diff (historic &optional not-urgent)
+  "Display diffs between file revisions.
+Normally this compares the currently selected fileset with their
+working revisions.  With a prefix argument HISTORIC, it reads two revision
+designators specifying which revisions to compare.
+
+The optional argument NOT-URGENT non-nil means it is ok to say no to
+saving the buffer."
+  (interactive (list current-prefix-arg t))
+  (if historic
+      ;; FIXME: this does not work right, `vc-version-diff' ends up
+      ;; calling `vc-deduce-fileset' to find the files to diff, and
+      ;; that's not what we want here, we want the diff for the VC root dir.
+      (call-interactively 'vc-version-diff)
+    (when buffer-file-name (vc-buffer-sync not-urgent))
+    (let ((backend
+	   (cond ((derived-mode-p 'vc-dir-mode)  vc-dir-backend)
+		 (vc-mode (vc-backend buffer-file-name))))
+	  rootdir working-revision)
+      (unless backend
+	(error "Buffer is not version controlled"))
+      (setq rootdir (vc-call-backend backend 'root default-directory))
+      (setq working-revision (vc-working-revision rootdir))
+      (vc-diff-internal
+       t (list backend (list rootdir) working-revision) nil nil (interactive-p)))))
+
+;;;###autoload
 (defun vc-revision-other-window (rev)
   "Visit revision REV of the current file in another window.
 If the current file is named `F', the revision is named `F.~REV~'.
@@ -1856,6 +1886,21 @@ If WORKING-REVISION is non-nil, leave th
     (vc-print-log-internal backend files working-revision)))
 
 ;;;###autoload
+(defun vc-print-root-log ()
+  "List the change log of for the current VC controlled tree in a window."
+  (interactive)
+  (let ((backend
+	 (cond ((derived-mode-p 'vc-dir-mode)  vc-dir-backend)
+	       (vc-mode (vc-backend buffer-file-name))))
+	rootdir working-revision)
+    (unless backend
+      (error "Buffer is not version controlled"))
+    (setq rootdir (vc-call-backend backend 'root default-directory))
+    (setq working-revision (vc-working-revision rootdir))
+    (vc-print-log-internal backend (list rootdir) working-revision)))
+
+
+;;;###autoload
 (defun vc-revert ()
   "Revert working copies of the selected fileset to their repository contents.
 This asks for confirmation if the buffer contents are not identical






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

* Re: VC top of the tree diff and log
  2009-07-23  5:43   ` Dan Nicolaescu
@ 2009-07-30  7:18     ` Dan Nicolaescu
  2009-08-29 19:13       ` Dan Nicolaescu
  0 siblings, 1 reply; 34+ messages in thread
From: Dan Nicolaescu @ 2009-07-30  7:18 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

Dan Nicolaescu <dann@ics.uci.edu> writes:

  > Stefan Monnier <monnier@iro.umontreal.ca> writes:
  > 
  >   > > Key bindings:
  >   > > for log we could have C-x v L  (should be intuitive given that
  >   > > vc-print-log uses C-x v l)
  >   > 
  >   > It might be a good idea.
  >   > 
  >   > > not sure what would be a good one for diff
  >   > 
  >   > I don't understand: why not just use the capitalized = sign?
  > 
  > Sorry, I probably use one of those antique keyboards that don't have
  > such a sign...
  > 
  > See what I currently have.  What do you think?

Here's an updated version that implements both top of the tree log and
diff and adds an option to show short logs.  
As it is now it short logs will be shown when a directory is present in
the fileset.  Adding `file' to `vc-log-short-style' will make C-x v l
show short logs for files too.

vc-git.el was changed to support short logs, and vc-cvs.el to ignore the
extra option (all vc backends need a similar change)

WDYT?

Index: vc-cvs.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/vc-cvs.el,v
retrieving revision 1.165
diff -u -3 -p -r1.165 vc-cvs.el
--- vc-cvs.el	7 Jul 2009 15:06:03 -0000	1.165
+++ vc-cvs.el	30 Jul 2009 06:57:41 -0000
@@ -492,7 +492,7 @@ Will fail unless you have administrative
 ;;; History functions
 ;;;
 
-(defun vc-cvs-print-log (files &optional buffer)
+(defun vc-cvs-print-log (files &optional buffer shortlog)
   "Get change logs associated with FILES."
   ;; It's just the catenation of the individual logs.
   (vc-cvs-command
Index: vc-git.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/vc-git.el,v
retrieving revision 1.85
diff -u -3 -p -r1.85 vc-git.el
--- vc-git.el	28 Jul 2009 08:06:40 -0000	1.85
+++ vc-git.el	30 Jul 2009 06:57:41 -0000
@@ -77,7 +77,7 @@
 ;; - merge-news (file)			   see `merge'
 ;; - steal-lock (file &optional revision)	   NOT NEEDED
 ;; HISTORY FUNCTIONS
-;; * print-log (files &optional buffer)		   OK
+;; * print-log (files &optional buffer shortlog)   OK
 ;; - log-view-mode ()				   OK
 ;; - show-log-entry (revision)			   OK
 ;; - comment-history (file)			   ??
@@ -460,7 +460,7 @@ If nil, use the value of `vc-diff-switch
 
 ;;; HISTORY FUNCTIONS
 
-(defun vc-git-print-log (files &optional buffer)
+(defun vc-git-print-log (files &optional buffer shortlog)
   "Get change log associated with FILES."
   (let ((coding-system-for-read git-commits-coding-system)
 	;; Support both the old print-log interface that passes a
@@ -474,43 +474,59 @@ If nil, use the value of `vc-diff-switch
     (let ((inhibit-read-only t))
       (with-current-buffer
           buffer
-	(vc-git-command buffer 'async files
-			"rev-list" "--pretty" "HEAD" "--")))))
+	(if shortlog
+	    (vc-git-command buffer 'async files
+			    "log" "--graph"
+			    "--date=short" "--pretty=format:%h  %ad  %s" "--abbrev-commit"
+			    "--")
+	  (vc-git-command buffer 'async files
+			  "rev-list" "--graph" "--pretty" "HEAD" "--"))))))
 
 (defvar log-view-message-re)
 (defvar log-view-file-re)
 (defvar log-view-font-lock-keywords)
 (defvar log-view-per-file-logs)
 
+;; Dynamically bound.
+(defvar vc-short-log)
+
 (define-derived-mode vc-git-log-view-mode log-view-mode "Git-Log-View"
   (require 'add-log) ;; we need the faces add-log
   ;; Don't have file markers, so use impossible regexp.
   (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)
-       "^commit *\\([0-9a-z]+\\)")
+       (if vc-short-log
+	 "^[*/\\| ]+ \\([0-9a-z]+\\)  \\([-a-z0-9]+\\)  \\(.*\\)"
+	 "^[ */\\|]+commit *\\([0-9a-z]+\\)"))
   (set (make-local-variable 'log-view-font-lock-keywords)
-       (append
-        `((,log-view-message-re  (1 'change-log-acknowledgement)))
-        ;; Handle the case:
-        ;; user: foo@bar
-        '(("^Author:[ \t]+\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)"
-           (1 'change-log-email))
-          ;; Handle the case:
-          ;; user: FirstName LastName <foo@bar>
-          ("^Author:[ \t]+\\([^<(]+?\\)[ \t]*[(<]\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)[>)]"
-           (1 'change-log-name)
-           (2 'change-log-email))
-          ("^ +\\(?:\\(?:[Aa]cked\\|[Ss]igned-[Oo]ff\\)-[Bb]y:\\)[ \t]+\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)"
-           (1 'change-log-name))
-          ("^ +\\(?:\\(?:[Aa]cked\\|[Ss]igned-[Oo]ff\\)-[Bb]y:\\)[ \t]+\\([^<(]+?\\)[ \t]*[(<]\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)[>)]"
-           (1 'change-log-name)
-           (2 'change-log-email))
-          ("^Merge: \\([0-9a-z]+\\) \\([0-9a-z]+\\)"
-           (1 'change-log-acknowledgement)
-           (2 'change-log-acknowledgement))
-          ("^Date:   \\(.+\\)" (1 'change-log-date))
-          ("^summary:[ \t]+\\(.+\\)" (1 'log-view-message))))))
+       (if vc-short-log
+	   (append
+	    `((,log-view-message-re
+	       (1 'change-log-acknowledgement)
+	       (2 'change-log-date))))
+	 (append
+	  `((,log-view-message-re  (1 'change-log-acknowledgement)))
+	  ;; Handle the case:
+	  ;; user: foo@bar
+	  '((" Author:[ \t]+\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)"
+	     (1 'change-log-email))
+	    ;; Handle the case:
+	    ;; user: FirstName LastName <foo@bar>
+	    (" Author:[ \t]+\\([^<(]+?\\)[ \t]*[(<]\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)[>)]"
+	     (1 'change-log-name)
+	     (2 'change-log-email))
+	    ("^ +\\(?:\\(?:[Aa]cked\\|[Ss]igned-[Oo]ff\\)-[Bb]y:\\)[ \t]+\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)"
+	     (1 'change-log-name))
+	    ("^ +\\(?:\\(?:[Aa]cked\\|[Ss]igned-[Oo]ff\\)-[Bb]y:\\)[ \t]+\\([^<(]+?\\)[ \t]*[(<]\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)[>)]"
+	     (1 'change-log-name)
+	     (2 'change-log-email))
+	    (" Merge: \\([0-9a-z]+\\) \\([0-9a-z]+\\)"
+	     (1 'change-log-acknowledgement)
+	     (2 'change-log-acknowledgement))
+	    (" Date:   \\(.+\\)" (1 'change-log-date))
+	    (" summary:[ \t]+\\(.+\\)" (1 'log-view-message)))))))
+
 
 (defun vc-git-show-log-entry (revision)
   "Move to the log entry for REVISION.
Index: vc-hooks.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/vc-hooks.el,v
retrieving revision 1.279
diff -u -3 -p -r1.279 vc-hooks.el
--- vc-hooks.el	26 Jun 2009 23:54:00 -0000	1.279
+++ vc-hooks.el	30 Jul 2009 06:57:41 -0000
@@ -934,6 +934,7 @@ current, and kill the buffer that visits
     (define-key map "h" 'vc-insert-headers)
     (define-key map "i" 'vc-register)
     (define-key map "l" 'vc-print-log)
+    (define-key map "L" 'vc-print-root-log)
     (define-key map "m" 'vc-merge)
     (define-key map "r" 'vc-retrieve-tag)
     (define-key map "s" 'vc-create-tag)
@@ -941,6 +942,7 @@ current, and kill the buffer that visits
     (define-key map "v" 'vc-next-action)
     (define-key map "+" 'vc-update)
     (define-key map "=" 'vc-diff)
+    (define-key map "D" 'vc-root-diff)
     (define-key map "~" 'vc-revision-other-window)
     map))
 (fset 'vc-prefix-map vc-prefix-map)
@@ -969,12 +971,18 @@ current, and kill the buffer that visits
     (define-key map [vc-diff]
       '(menu-item "Compare with Base Version" vc-diff
 		  :help "Compare file set with the base version"))
+    (define-key map [vc-root-diff]
+      '(menu-item "Compare Tree with Base Version" vc-root-diff
+		  :help "Compare current tree with the base version"))
     (define-key map [vc-update-change-log]
       '(menu-item "Update ChangeLog" vc-update-change-log
 		  :help "Find change log file and add entries from recent version control logs"))
     (define-key map [vc-print-log]
       '(menu-item "Show History" vc-print-log
 		  :help "List the change log of the current file set in a window"))
+    (define-key map [vc-print-root-log]
+      '(menu-item "Show Top of the Tree History " vc-print-root-log
+		  :help "List the change log for the current tree in a window"))
     (define-key map [separator2] '("----"))
     (define-key map [vc-insert-header]
       '(menu-item "Insert Header" vc-insert-headers
Index: vc.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/vc.el,v
retrieving revision 1.722
diff -u -3 -p -r1.722 vc.el
--- vc.el	23 Jul 2009 05:41:28 -0000	1.722
+++ vc.el	30 Jul 2009 06:57:41 -0000
@@ -350,11 +350,12 @@
 ;;
 ;; HISTORY FUNCTIONS
 ;;
-;; * print-log (files &optional buffer)
+;; * print-log (files &optional buffer shortlog)
 ;;
 ;;   Insert the revision log for FILES into BUFFER, or the *vc* buffer
 ;;   if BUFFER is nil.  (Note: older versions of this function expected
 ;;   only a single file argument.)
+;;   If SHORTLOG is true insert a short version of the log.
 ;;
 ;; - log-view-mode ()
 ;;
@@ -465,6 +466,9 @@
 ;;   `revert' operations itself, without calling the backend system.  The
 ;;   default implementation always returns nil.
 ;;
+;; - root (file)
+;;   Return the root of the VC controlled hierarchy for file.
+;;
 ;; - repository-hostname (dirname)
 ;;
 ;;   Return the hostname that the backend will have to contact
@@ -1594,6 +1598,33 @@ saving the buffer."
     (vc-diff-internal t (vc-deduce-fileset) nil nil (interactive-p))))
 
 ;;;###autoload
+(defun vc-root-diff (historic &optional not-urgent)
+  "Display diffs between file revisions.
+Normally this compares the currently selected fileset with their
+working revisions.  With a prefix argument HISTORIC, it reads two revision
+designators specifying which revisions to compare.
+
+The optional argument NOT-URGENT non-nil means it is ok to say no to
+saving the buffer."
+  (interactive (list current-prefix-arg t))
+  (if historic
+      ;; FIXME: this does not work right, `vc-version-diff' ends up
+      ;; calling `vc-deduce-fileset' to find the files to diff, and
+      ;; that's not what we want here, we want the diff for the VC root dir.
+      (call-interactively 'vc-version-diff)
+    (when buffer-file-name (vc-buffer-sync not-urgent))
+    (let ((backend
+	   (cond ((derived-mode-p 'vc-dir-mode)  vc-dir-backend)
+		 (vc-mode (vc-backend buffer-file-name))))
+	  rootdir working-revision)
+      (unless backend
+	(error "Buffer is not version controlled"))
+      (setq rootdir (vc-call-backend backend 'root default-directory))
+      (setq working-revision (vc-working-revision rootdir))
+      (vc-diff-internal
+       t (list backend (list rootdir) working-revision) nil nil (interactive-p)))))
+
+;;;###autoload
 (defun vc-revision-other-window (rev)
   "Visit revision REV of the current file in another window.
 If the current file is named `F', the revision is named `F.~REV~'.
@@ -1817,34 +1848,54 @@ allowed and simply skipped)."
 
 ;; Miscellaneous other entry points
 
+;; FIXME: this should be a defcustom
+;; FIXME: maybe add another choice:
+;; `root-directory' (or somesuch), which would mean show a short log
+;; for the root directory.
+(defvar vc-log-short-style '(directory)
+  "Whether or not to show a short log.
+If it contains `directory' then if the fileset contains a directory show a short log.
+If it contains `file' then show short logs for files.
+Not all VC backends support short logs!")
+
 (defun vc-print-log-internal (backend files working-revision)
   ;; Don't switch to the output buffer before running the command,
   ;; so that any buffer-local settings in the vc-controlled
   ;; buffer can be accessed by the command.
-  (vc-call-backend backend 'print-log files "*vc-change-log*")
-  (pop-to-buffer "*vc-change-log*")
-  (vc-exec-after
-   `(let ((inhibit-read-only t))
-      (vc-call-backend ',backend 'log-view-mode)
-      (set (make-local-variable 'log-view-vc-backend) ',backend)
-      (set (make-local-variable 'log-view-vc-fileset) ',files)
-      
-      ;; FIXME: this seems to apply only to RCS/CVS, it doesn't quite
-      ;; belong here in the generic code.
-      (goto-char (point-max))
-      (forward-line -1)
-      (while (looking-at "=*\n")
-      	(delete-char (- (match-end 0) (match-beginning 0)))
-      	(forward-line -1))
-      (goto-char (point-min))
-      (when (looking-at "[\b\t\n\v\f\r ]+")
-      	(delete-char (- (match-end 0) (match-beginning 0))))
-
-      (shrink-window-if-larger-than-buffer)
-      ;; move point to the log entry for the working revision
-      (vc-call-backend ',backend 'show-log-entry ',working-revision)
-      (setq vc-sentinel-movepoint (point))
-      (set-buffer-modified-p nil))))
+  (let ((dir-present nil)
+	(vc-short-log nil))
+    (dolist (file files)
+      (when (file-directory-p file)
+	(setq dir-present t)))
+    (setq vc-short-log
+	  (not (null (if dir-present
+			 (memq 'directory vc-log-short-style)
+		       (memq 'file vc-log-short-style)))))
+    (vc-call-backend backend 'print-log files "*vc-change-log*" vc-short-log)
+    (pop-to-buffer "*vc-change-log*")
+    (vc-exec-after
+     `(let ((inhibit-read-only t)
+	    (vc-short-log ,vc-short-log))
+	(vc-call-backend ',backend 'log-view-mode)
+	(set (make-local-variable 'log-view-vc-backend) ',backend)
+	(set (make-local-variable 'log-view-vc-fileset) ',files)
+
+	;; FIXME: this seems to apply only to RCS/CVS, it doesn't quite
+	;; belong here in the generic code.
+	(goto-char (point-max))
+	(forward-line -1)
+	(while (looking-at "=*\n")
+	  (delete-char (- (match-end 0) (match-beginning 0)))
+	  (forward-line -1))
+	(goto-char (point-min))
+	(when (looking-at "[\b\t\n\v\f\r ]+")
+	  (delete-char (- (match-end 0) (match-beginning 0))))
+
+	(shrink-window-if-larger-than-buffer)
+	;; move point to the log entry for the working revision
+	(vc-call-backend ',backend 'show-log-entry ',working-revision)
+	(setq vc-sentinel-movepoint (point))
+	(set-buffer-modified-p nil)))))
 
 ;;;###autoload
 (defun vc-print-log (&optional working-revision)
@@ -1858,6 +1909,20 @@ If WORKING-REVISION is non-nil, leave th
     (vc-print-log-internal backend files working-revision)))
 
 ;;;###autoload
+(defun vc-print-root-log ()
+  "List the change log of for the current VC controlled tree in a window."
+  (interactive)
+  (let ((backend
+	 (cond ((derived-mode-p 'vc-dir-mode)  vc-dir-backend)
+	       (vc-mode (vc-backend buffer-file-name))))
+	rootdir working-revision)
+    (unless backend
+      (error "Buffer is not version controlled"))
+    (setq rootdir (vc-call-backend backend 'root default-directory))
+    (setq working-revision (vc-working-revision rootdir))
+    (vc-print-log-internal backend (list rootdir) working-revision)))
+
+;;;###autoload
 (defun vc-revert ()
   "Revert working copies of the selected fileset to their repository contents.
 This asks for confirmation if the buffer contents are not identical




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

* Re: VC top of the tree diff and log
  2009-07-30  7:18     ` Dan Nicolaescu
@ 2009-08-29 19:13       ` Dan Nicolaescu
  2009-08-29 21:25         ` Stefan Monnier
                           ` (2 more replies)
  0 siblings, 3 replies; 34+ messages in thread
From: Dan Nicolaescu @ 2009-08-29 19:13 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

Dan Nicolaescu <dann@ics.uci.edu> writes:

  > Dan Nicolaescu <dann@ics.uci.edu> writes:
  > 
  >   > Stefan Monnier <monnier@iro.umontreal.ca> writes:
  >   > 
  >   >   > > Key bindings:
  >   >   > > for log we could have C-x v L  (should be intuitive given that
  >   >   > > vc-print-log uses C-x v l)
  >   >   > 
  >   >   > It might be a good idea.
  >   >   > 
  >   >   > > not sure what would be a good one for diff
  >   >   > 
  >   >   > I don't understand: why not just use the capitalized = sign?
  >   > 
  >   > Sorry, I probably use one of those antique keyboards that don't have
  >   > such a sign...
  >   > 
  >   > See what I currently have.  What do you think?
  > 
  > Here's an updated version that implements both top of the tree log and
  > diff and adds an option to show short logs.  
  > As it is now it short logs will be shown when a directory is present in
  > the fileset.  Adding `file' to `vc-log-short-style' will make C-x v l
  > show short logs for files too.
  > 
  > vc-git.el was changed to support short logs, and vc-cvs.el to ignore the
  > extra option (all vc backends need a similar change)
  > 
  > WDYT?

Ping. 

Any reason not to install this?

  > Index: vc-cvs.el
  > ===================================================================
  > RCS file: /cvsroot/emacs/emacs/lisp/vc-cvs.el,v
  > retrieving revision 1.165
  > diff -u -3 -p -r1.165 vc-cvs.el
  > --- vc-cvs.el	7 Jul 2009 15:06:03 -0000	1.165
  > +++ vc-cvs.el	30 Jul 2009 06:57:41 -0000
  > @@ -492,7 +492,7 @@ Will fail unless you have administrative
  >  ;;; History functions
  >  ;;;
  >  
  > -(defun vc-cvs-print-log (files &optional buffer)
  > +(defun vc-cvs-print-log (files &optional buffer shortlog)
  >    "Get change logs associated with FILES."
  >    ;; It's just the catenation of the individual logs.
  >    (vc-cvs-command
  > Index: vc-git.el
  > ===================================================================
  > RCS file: /cvsroot/emacs/emacs/lisp/vc-git.el,v
  > retrieving revision 1.85
  > diff -u -3 -p -r1.85 vc-git.el
  > --- vc-git.el	28 Jul 2009 08:06:40 -0000	1.85
  > +++ vc-git.el	30 Jul 2009 06:57:41 -0000
  > @@ -77,7 +77,7 @@
  >  ;; - merge-news (file)			   see `merge'
  >  ;; - steal-lock (file &optional revision)	   NOT NEEDED
  >  ;; HISTORY FUNCTIONS
  > -;; * print-log (files &optional buffer)		   OK
  > +;; * print-log (files &optional buffer shortlog)   OK
  >  ;; - log-view-mode ()				   OK
  >  ;; - show-log-entry (revision)			   OK
  >  ;; - comment-history (file)			   ??
  > @@ -460,7 +460,7 @@ If nil, use the value of `vc-diff-switch
  >  
  >  ;;; HISTORY FUNCTIONS
  >  
  > -(defun vc-git-print-log (files &optional buffer)
  > +(defun vc-git-print-log (files &optional buffer shortlog)
  >    "Get change log associated with FILES."
  >    (let ((coding-system-for-read git-commits-coding-system)
  >  	;; Support both the old print-log interface that passes a
  > @@ -474,43 +474,59 @@ If nil, use the value of `vc-diff-switch
  >      (let ((inhibit-read-only t))
  >        (with-current-buffer
  >            buffer
  > -	(vc-git-command buffer 'async files
  > -			"rev-list" "--pretty" "HEAD" "--")))))
  > +	(if shortlog
  > +	    (vc-git-command buffer 'async files
  > +			    "log" "--graph"
  > +			    "--date=short" "--pretty=format:%h  %ad  %s" "--abbrev-commit"
  > +			    "--")
  > +	  (vc-git-command buffer 'async files
  > +			  "rev-list" "--graph" "--pretty" "HEAD" "--"))))))
  >  
  >  (defvar log-view-message-re)
  >  (defvar log-view-file-re)
  >  (defvar log-view-font-lock-keywords)
  >  (defvar log-view-per-file-logs)
  >  
  > +;; Dynamically bound.
  > +(defvar vc-short-log)
  > +
  >  (define-derived-mode vc-git-log-view-mode log-view-mode "Git-Log-View"
  >    (require 'add-log) ;; we need the faces add-log
  >    ;; Don't have file markers, so use impossible regexp.
  >    (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)
  > -       "^commit *\\([0-9a-z]+\\)")
  > +       (if vc-short-log
  > +	 "^[*/\\| ]+ \\([0-9a-z]+\\)  \\([-a-z0-9]+\\)  \\(.*\\)"
  > +	 "^[ */\\|]+commit *\\([0-9a-z]+\\)"))
  >    (set (make-local-variable 'log-view-font-lock-keywords)
  > -       (append
  > -        `((,log-view-message-re  (1 'change-log-acknowledgement)))
  > -        ;; Handle the case:
  > -        ;; user: foo@bar
  > -        '(("^Author:[ \t]+\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)"
  > -           (1 'change-log-email))
  > -          ;; Handle the case:
  > -          ;; user: FirstName LastName <foo@bar>
  > -          ("^Author:[ \t]+\\([^<(]+?\\)[ \t]*[(<]\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)[>)]"
  > -           (1 'change-log-name)
  > -           (2 'change-log-email))
  > -          ("^ +\\(?:\\(?:[Aa]cked\\|[Ss]igned-[Oo]ff\\)-[Bb]y:\\)[ \t]+\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)"
  > -           (1 'change-log-name))
  > -          ("^ +\\(?:\\(?:[Aa]cked\\|[Ss]igned-[Oo]ff\\)-[Bb]y:\\)[ \t]+\\([^<(]+?\\)[ \t]*[(<]\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)[>)]"
  > -           (1 'change-log-name)
  > -           (2 'change-log-email))
  > -          ("^Merge: \\([0-9a-z]+\\) \\([0-9a-z]+\\)"
  > -           (1 'change-log-acknowledgement)
  > -           (2 'change-log-acknowledgement))
  > -          ("^Date:   \\(.+\\)" (1 'change-log-date))
  > -          ("^summary:[ \t]+\\(.+\\)" (1 'log-view-message))))))
  > +       (if vc-short-log
  > +	   (append
  > +	    `((,log-view-message-re
  > +	       (1 'change-log-acknowledgement)
  > +	       (2 'change-log-date))))
  > +	 (append
  > +	  `((,log-view-message-re  (1 'change-log-acknowledgement)))
  > +	  ;; Handle the case:
  > +	  ;; user: foo@bar
  > +	  '((" Author:[ \t]+\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)"
  > +	     (1 'change-log-email))
  > +	    ;; Handle the case:
  > +	    ;; user: FirstName LastName <foo@bar>
  > +	    (" Author:[ \t]+\\([^<(]+?\\)[ \t]*[(<]\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)[>)]"
  > +	     (1 'change-log-name)
  > +	     (2 'change-log-email))
  > +	    ("^ +\\(?:\\(?:[Aa]cked\\|[Ss]igned-[Oo]ff\\)-[Bb]y:\\)[ \t]+\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)"
  > +	     (1 'change-log-name))
  > +	    ("^ +\\(?:\\(?:[Aa]cked\\|[Ss]igned-[Oo]ff\\)-[Bb]y:\\)[ \t]+\\([^<(]+?\\)[ \t]*[(<]\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)[>)]"
  > +	     (1 'change-log-name)
  > +	     (2 'change-log-email))
  > +	    (" Merge: \\([0-9a-z]+\\) \\([0-9a-z]+\\)"
  > +	     (1 'change-log-acknowledgement)
  > +	     (2 'change-log-acknowledgement))
  > +	    (" Date:   \\(.+\\)" (1 'change-log-date))
  > +	    (" summary:[ \t]+\\(.+\\)" (1 'log-view-message)))))))
  > +
  >  
  >  (defun vc-git-show-log-entry (revision)
  >    "Move to the log entry for REVISION.
  > Index: vc-hooks.el
  > ===================================================================
  > RCS file: /cvsroot/emacs/emacs/lisp/vc-hooks.el,v
  > retrieving revision 1.279
  > diff -u -3 -p -r1.279 vc-hooks.el
  > --- vc-hooks.el	26 Jun 2009 23:54:00 -0000	1.279
  > +++ vc-hooks.el	30 Jul 2009 06:57:41 -0000
  > @@ -934,6 +934,7 @@ current, and kill the buffer that visits
  >      (define-key map "h" 'vc-insert-headers)
  >      (define-key map "i" 'vc-register)
  >      (define-key map "l" 'vc-print-log)
  > +    (define-key map "L" 'vc-print-root-log)
  >      (define-key map "m" 'vc-merge)
  >      (define-key map "r" 'vc-retrieve-tag)
  >      (define-key map "s" 'vc-create-tag)
  > @@ -941,6 +942,7 @@ current, and kill the buffer that visits
  >      (define-key map "v" 'vc-next-action)
  >      (define-key map "+" 'vc-update)
  >      (define-key map "=" 'vc-diff)
  > +    (define-key map "D" 'vc-root-diff)
  >      (define-key map "~" 'vc-revision-other-window)
  >      map))
  >  (fset 'vc-prefix-map vc-prefix-map)
  > @@ -969,12 +971,18 @@ current, and kill the buffer that visits
  >      (define-key map [vc-diff]
  >        '(menu-item "Compare with Base Version" vc-diff
  >  		  :help "Compare file set with the base version"))
  > +    (define-key map [vc-root-diff]
  > +      '(menu-item "Compare Tree with Base Version" vc-root-diff
  > +		  :help "Compare current tree with the base version"))
  >      (define-key map [vc-update-change-log]
  >        '(menu-item "Update ChangeLog" vc-update-change-log
  >  		  :help "Find change log file and add entries from recent version control logs"))
  >      (define-key map [vc-print-log]
  >        '(menu-item "Show History" vc-print-log
  >  		  :help "List the change log of the current file set in a window"))
  > +    (define-key map [vc-print-root-log]
  > +      '(menu-item "Show Top of the Tree History " vc-print-root-log
  > +		  :help "List the change log for the current tree in a window"))
  >      (define-key map [separator2] '("----"))
  >      (define-key map [vc-insert-header]
  >        '(menu-item "Insert Header" vc-insert-headers
  > Index: vc.el
  > ===================================================================
  > RCS file: /cvsroot/emacs/emacs/lisp/vc.el,v
  > retrieving revision 1.722
  > diff -u -3 -p -r1.722 vc.el
  > --- vc.el	23 Jul 2009 05:41:28 -0000	1.722
  > +++ vc.el	30 Jul 2009 06:57:41 -0000
  > @@ -350,11 +350,12 @@
  >  ;;
  >  ;; HISTORY FUNCTIONS
  >  ;;
  > -;; * print-log (files &optional buffer)
  > +;; * print-log (files &optional buffer shortlog)
  >  ;;
  >  ;;   Insert the revision log for FILES into BUFFER, or the *vc* buffer
  >  ;;   if BUFFER is nil.  (Note: older versions of this function expected
  >  ;;   only a single file argument.)
  > +;;   If SHORTLOG is true insert a short version of the log.
  >  ;;
  >  ;; - log-view-mode ()
  >  ;;
  > @@ -465,6 +466,9 @@
  >  ;;   `revert' operations itself, without calling the backend system.  The
  >  ;;   default implementation always returns nil.
  >  ;;
  > +;; - root (file)
  > +;;   Return the root of the VC controlled hierarchy for file.
  > +;;
  >  ;; - repository-hostname (dirname)
  >  ;;
  >  ;;   Return the hostname that the backend will have to contact
  > @@ -1594,6 +1598,33 @@ saving the buffer."
  >      (vc-diff-internal t (vc-deduce-fileset) nil nil (interactive-p))))
  >  
  >  ;;;###autoload
  > +(defun vc-root-diff (historic &optional not-urgent)
  > +  "Display diffs between file revisions.
  > +Normally this compares the currently selected fileset with their
  > +working revisions.  With a prefix argument HISTORIC, it reads two revision
  > +designators specifying which revisions to compare.
  > +
  > +The optional argument NOT-URGENT non-nil means it is ok to say no to
  > +saving the buffer."
  > +  (interactive (list current-prefix-arg t))
  > +  (if historic
  > +      ;; FIXME: this does not work right, `vc-version-diff' ends up
  > +      ;; calling `vc-deduce-fileset' to find the files to diff, and
  > +      ;; that's not what we want here, we want the diff for the VC root dir.
  > +      (call-interactively 'vc-version-diff)
  > +    (when buffer-file-name (vc-buffer-sync not-urgent))
  > +    (let ((backend
  > +	   (cond ((derived-mode-p 'vc-dir-mode)  vc-dir-backend)
  > +		 (vc-mode (vc-backend buffer-file-name))))
  > +	  rootdir working-revision)
  > +      (unless backend
  > +	(error "Buffer is not version controlled"))
  > +      (setq rootdir (vc-call-backend backend 'root default-directory))
  > +      (setq working-revision (vc-working-revision rootdir))
  > +      (vc-diff-internal
  > +       t (list backend (list rootdir) working-revision) nil nil (interactive-p)))))
  > +
  > +;;;###autoload
  >  (defun vc-revision-other-window (rev)
  >    "Visit revision REV of the current file in another window.
  >  If the current file is named `F', the revision is named `F.~REV~'.
  > @@ -1817,34 +1848,54 @@ allowed and simply skipped)."
  >  
  >  ;; Miscellaneous other entry points
  >  
  > +;; FIXME: this should be a defcustom
  > +;; FIXME: maybe add another choice:
  > +;; `root-directory' (or somesuch), which would mean show a short log
  > +;; for the root directory.
  > +(defvar vc-log-short-style '(directory)
  > +  "Whether or not to show a short log.
  > +If it contains `directory' then if the fileset contains a directory show a short log.
  > +If it contains `file' then show short logs for files.
  > +Not all VC backends support short logs!")
  > +
  >  (defun vc-print-log-internal (backend files working-revision)
  >    ;; Don't switch to the output buffer before running the command,
  >    ;; so that any buffer-local settings in the vc-controlled
  >    ;; buffer can be accessed by the command.
  > -  (vc-call-backend backend 'print-log files "*vc-change-log*")
  > -  (pop-to-buffer "*vc-change-log*")
  > -  (vc-exec-after
  > -   `(let ((inhibit-read-only t))
  > -      (vc-call-backend ',backend 'log-view-mode)
  > -      (set (make-local-variable 'log-view-vc-backend) ',backend)
  > -      (set (make-local-variable 'log-view-vc-fileset) ',files)
  > -      
  > -      ;; FIXME: this seems to apply only to RCS/CVS, it doesn't quite
  > -      ;; belong here in the generic code.
  > -      (goto-char (point-max))
  > -      (forward-line -1)
  > -      (while (looking-at "=*\n")
  > -      	(delete-char (- (match-end 0) (match-beginning 0)))
  > -      	(forward-line -1))
  > -      (goto-char (point-min))
  > -      (when (looking-at "[\b\t\n\v\f\r ]+")
  > -      	(delete-char (- (match-end 0) (match-beginning 0))))
  > -
  > -      (shrink-window-if-larger-than-buffer)
  > -      ;; move point to the log entry for the working revision
  > -      (vc-call-backend ',backend 'show-log-entry ',working-revision)
  > -      (setq vc-sentinel-movepoint (point))
  > -      (set-buffer-modified-p nil))))
  > +  (let ((dir-present nil)
  > +	(vc-short-log nil))
  > +    (dolist (file files)
  > +      (when (file-directory-p file)
  > +	(setq dir-present t)))
  > +    (setq vc-short-log
  > +	  (not (null (if dir-present
  > +			 (memq 'directory vc-log-short-style)
  > +		       (memq 'file vc-log-short-style)))))
  > +    (vc-call-backend backend 'print-log files "*vc-change-log*" vc-short-log)
  > +    (pop-to-buffer "*vc-change-log*")
  > +    (vc-exec-after
  > +     `(let ((inhibit-read-only t)
  > +	    (vc-short-log ,vc-short-log))
  > +	(vc-call-backend ',backend 'log-view-mode)
  > +	(set (make-local-variable 'log-view-vc-backend) ',backend)
  > +	(set (make-local-variable 'log-view-vc-fileset) ',files)
  > +
  > +	;; FIXME: this seems to apply only to RCS/CVS, it doesn't quite
  > +	;; belong here in the generic code.
  > +	(goto-char (point-max))
  > +	(forward-line -1)
  > +	(while (looking-at "=*\n")
  > +	  (delete-char (- (match-end 0) (match-beginning 0)))
  > +	  (forward-line -1))
  > +	(goto-char (point-min))
  > +	(when (looking-at "[\b\t\n\v\f\r ]+")
  > +	  (delete-char (- (match-end 0) (match-beginning 0))))
  > +
  > +	(shrink-window-if-larger-than-buffer)
  > +	;; move point to the log entry for the working revision
  > +	(vc-call-backend ',backend 'show-log-entry ',working-revision)
  > +	(setq vc-sentinel-movepoint (point))
  > +	(set-buffer-modified-p nil)))))
  >  
  >  ;;;###autoload
  >  (defun vc-print-log (&optional working-revision)
  > @@ -1858,6 +1909,20 @@ If WORKING-REVISION is non-nil, leave th
  >      (vc-print-log-internal backend files working-revision)))
  >  
  >  ;;;###autoload
  > +(defun vc-print-root-log ()
  > +  "List the change log of for the current VC controlled tree in a window."
  > +  (interactive)
  > +  (let ((backend
  > +	 (cond ((derived-mode-p 'vc-dir-mode)  vc-dir-backend)
  > +	       (vc-mode (vc-backend buffer-file-name))))
  > +	rootdir working-revision)
  > +    (unless backend
  > +      (error "Buffer is not version controlled"))
  > +    (setq rootdir (vc-call-backend backend 'root default-directory))
  > +    (setq working-revision (vc-working-revision rootdir))
  > +    (vc-print-log-internal backend (list rootdir) working-revision)))
  > +
  > +;;;###autoload
  >  (defun vc-revert ()
  >    "Revert working copies of the selected fileset to their repository contents.
  >  This asks for confirmation if the buffer contents are not identical




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

* Re: VC top of the tree diff and log
  2009-08-29 19:13       ` Dan Nicolaescu
@ 2009-08-29 21:25         ` Stefan Monnier
  2009-08-29 22:47           ` Juri Linkov
  2009-08-30  6:16           ` Dan Nicolaescu
  2009-09-01 21:41         ` Juri Linkov
  2009-09-04  0:36         ` Juri Linkov
  2 siblings, 2 replies; 34+ messages in thread
From: Stefan Monnier @ 2009-08-29 21:25 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: emacs-devel

>> Here's an updated version that implements both top of the tree log and
>> diff and adds an option to show short logs.  
>> As it is now it short logs will be shown when a directory is present in
>> the fileset.  Adding `file' to `vc-log-short-style' will make C-x v l
>> show short logs for files too.
>> 
>> vc-git.el was changed to support short logs, and vc-cvs.el to ignore the
>> extra option (all vc backends need a similar change)
>> 
>> WDYT?

> Ping. 

> Any reason not to install this?

It looks OK, tho I'm not convinced about the vc-log-short-style
customization.  Maybe I misunderstand what is meant by "short log", but
I have the impression that you might want both short and long logs both
for dirs and for files, depending on the situation.  So maybe a better
solution would be to use a different command or a prefix arg to choose,
rather than a custom-var.


        Stefan




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

* Re: VC top of the tree diff and log
  2009-08-29 21:25         ` Stefan Monnier
@ 2009-08-29 22:47           ` Juri Linkov
  2009-08-29 23:10             ` Miles Bader
  2009-08-30  6:16           ` Dan Nicolaescu
  1 sibling, 1 reply; 34+ messages in thread
From: Juri Linkov @ 2009-08-29 22:47 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Dan Nicolaescu, emacs-devel

>> Any reason not to install this?
>
> It looks OK, tho I'm not convinced about the vc-log-short-style
> customization.  Maybe I misunderstand what is meant by "short log", but
> I have the impression that you might want both short and long logs both
> for dirs and for files, depending on the situation.  So maybe a better
> solution would be to use a different command or a prefix arg to choose,

Or a prefix key like `C-x v l l' for long logs, and `C-x v l s'
for short logs.  Or if touching the traditional `C-x v l' is a no-no,
then:

C-x v L l - long logs
C-x v L s - short logs
C-x v L r - root logs
C-x v L R l - long root logs
C-x v L R s - short root logs
...

-- 
Juri Linkov
http://www.jurta.org/emacs/




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

* Re: VC top of the tree diff and log
  2009-08-29 22:47           ` Juri Linkov
@ 2009-08-29 23:10             ` Miles Bader
  2009-09-01 21:36               ` Juri Linkov
  0 siblings, 1 reply; 34+ messages in thread
From: Miles Bader @ 2009-08-29 23:10 UTC (permalink / raw)
  To: Juri Linkov; +Cc: Dan Nicolaescu, Stefan Monnier, emacs-devel

Juri Linkov <juri@jurta.org> writes:
> Or a prefix key like `C-x v l l' for long logs, and `C-x v l s'
> for short logs.  Or if touching the traditional `C-x v l' is a no-no,
> then:
>
> C-x v L l - long logs
> C-x v L s - short logs
> C-x v L r - root logs
> C-x v L R l - long root logs
> C-x v L R s - short root logs

Ugh... that looks way too baroque.  I don't want to have to make
multiple decisions and follow deep branching menu structures for such a
common operation.  Morever, combining shifted and unshifted keys in a
binding _really_ slow down invocation (and raise the error rate).

I think it should just use the traditional binding, with prefix-arg
toggling short/long.  The default short/long choice can be customizable
(dunno what the best default would be tho).

Not sure about root/file logs; both are useful, but maybe it's enough
if using the normal log command in dired/vc-dired buffers gets the root
log?

-Miles

-- 
.Numeric stability is probably not all that important when you're guessing.




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

* Re: VC top of the tree diff and log
  2009-08-29 21:25         ` Stefan Monnier
  2009-08-29 22:47           ` Juri Linkov
@ 2009-08-30  6:16           ` Dan Nicolaescu
  2009-09-01 21:35             ` Juri Linkov
  1 sibling, 1 reply; 34+ messages in thread
From: Dan Nicolaescu @ 2009-08-30  6:16 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

  > >> Here's an updated version that implements both top of the tree log and
  > >> diff and adds an option to show short logs.  
  > >> As it is now it short logs will be shown when a directory is present in
  > >> the fileset.  Adding `file' to `vc-log-short-style' will make C-x v l
  > >> show short logs for files too.
  > >> 
  > >> vc-git.el was changed to support short logs, and vc-cvs.el to ignore the
  > >> extra option (all vc backends need a similar change)
  > >> 
  > >> WDYT?
  > 
  > > Ping. 
  > 
  > > Any reason not to install this?
  > 
  > It looks OK, tho I'm not convinced about the vc-log-short-style
  > customization.  Maybe I misunderstand what is meant by "short log", but
  > I have the impression that you might want both short and long logs both
  > for dirs and for files, depending on the situation.  So maybe a better
  > solution would be to use a different command or a prefix arg to choose,
  > rather than a custom-var.

After using the current solution for a bit, I've grown to like it.
But that does not mean that it can't be changed...
Once the backend support for generating short/long logs is in, we can
decide what is the best UI for it.
So I'll check in the change as it is now when I get a chance.




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

* Re: VC top of the tree diff and log
  2009-08-30  6:16           ` Dan Nicolaescu
@ 2009-09-01 21:35             ` Juri Linkov
  2009-09-01 22:07               ` Dan Nicolaescu
  0 siblings, 1 reply; 34+ messages in thread
From: Juri Linkov @ 2009-09-01 21:35 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: Stefan Monnier, emacs-devel

> After using the current solution for a bit, I've grown to like it.
> But that does not mean that it can't be changed...
> Once the backend support for generating short/long logs is in, we can
> decide what is the best UI for it.
> So I'll check in the change as it is now when I get a chance.

Have you tried to run `vc-print-root-log' on the Emacs repository?
I waited for several minutes and eventually abandoned the attempt.

We could provide a numeric prefix argument for vc print logs
to limit the number of commits to show.  I mean translating it
to the git command like "git-log -2".

-- 
Juri Linkov
http://www.jurta.org/emacs/




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

* Re: VC top of the tree diff and log
  2009-08-29 23:10             ` Miles Bader
@ 2009-09-01 21:36               ` Juri Linkov
  2009-09-01 22:27                 ` Juri Linkov
  0 siblings, 1 reply; 34+ messages in thread
From: Juri Linkov @ 2009-09-01 21:36 UTC (permalink / raw)
  To: Miles Bader; +Cc: Dan Nicolaescu, Stefan Monnier, emacs-devel

>> C-x v L l - long logs
>> C-x v L s - short logs
>> C-x v L r - root logs
>> C-x v L R l - long root logs
>> C-x v L R s - short root logs
>
> Ugh... that looks way too baroque.  I don't want to have to make
> multiple decisions and follow deep branching menu structures for such a
> common operation.  Morever, combining shifted and unshifted keys in a
> binding _really_ slow down invocation (and raise the error rate).

These commands are not too frequently used, so the speed of their
invocation is not important.  OTOH, I see no other way to extend
log commands to control more options like "git-log --stat",
graph/no graph, and other pretty format options.

-- 
Juri Linkov
http://www.jurta.org/emacs/




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

* Re: VC top of the tree diff and log
  2009-08-29 19:13       ` Dan Nicolaescu
  2009-08-29 21:25         ` Stefan Monnier
@ 2009-09-01 21:41         ` Juri Linkov
  2009-09-01 22:46           ` Dan Nicolaescu
  2009-12-06 22:37           ` Dan Nicolaescu
  2009-09-04  0:36         ` Juri Linkov
  2 siblings, 2 replies; 34+ messages in thread
From: Juri Linkov @ 2009-09-01 21:41 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: Stefan Monnier, emacs-devel

>   > vc-git.el was changed to support short logs, and vc-cvs.el to ignore the
>   > extra option (all vc backends need a similar change)
>   >
>   > WDYT?
>
> Ping.
>
> Any reason not to install this?

There is a problem in your patch.  Its "--graph" option fails in
git version 1.5.

-- 
Juri Linkov
http://www.jurta.org/emacs/




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

* Re: VC top of the tree diff and log
  2009-09-01 21:35             ` Juri Linkov
@ 2009-09-01 22:07               ` Dan Nicolaescu
  2009-09-02  4:13                 ` Miles Bader
  0 siblings, 1 reply; 34+ messages in thread
From: Dan Nicolaescu @ 2009-09-01 22:07 UTC (permalink / raw)
  To: Juri Linkov; +Cc: Stefan Monnier, emacs-devel

Juri Linkov <juri@jurta.org> writes:

  > > After using the current solution for a bit, I've grown to like it.
  > > But that does not mean that it can't be changed...
  > > Once the backend support for generating short/long logs is in, we can
  > > decide what is the best UI for it.
  > > So I'll check in the change as it is now when I get a chance.
  > 
  > Have you tried to run `vc-print-root-log' on the Emacs repository?
  > I waited for several minutes and eventually abandoned the attempt.

No, I only have the CVS one handy.
But I've tried it on other things that have lots of lines, and yes it's
slow.  See the "slow output" bugs/threads, they have been partially
motivated by this. 

  > We could provide a numeric prefix argument for vc print logs
  > to limit the number of commits to show.  I mean translating it
  > to the git command like "git-log -2".

Yes, I have considered limiting the size of the log output, it needs to
apply not only to the root log, but also to C-x v l.   But I
don't know what the best thing to do here... :-(




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

* Re: VC top of the tree diff and log
  2009-09-01 21:36               ` Juri Linkov
@ 2009-09-01 22:27                 ` Juri Linkov
  2009-09-04  0:04                   ` Juri Linkov
  2009-09-04  2:12                   ` Stefan Monnier
  0 siblings, 2 replies; 34+ messages in thread
From: Juri Linkov @ 2009-09-01 22:27 UTC (permalink / raw)
  To: Miles Bader; +Cc: Dan Nicolaescu, Stefan Monnier, emacs-devel

>>> C-x v L l - long logs
>>> C-x v L s - short logs
>>> C-x v L r - root logs
>>> C-x v L R l - long root logs
>>> C-x v L R s - short root logs
>>
>> Ugh... that looks way too baroque.  I don't want to have to make
>> multiple decisions and follow deep branching menu structures for such a
>> common operation.  Morever, combining shifted and unshifted keys in a
>> binding _really_ slow down invocation (and raise the error rate).
>
> These commands are not too frequently used, so the speed of their
> invocation is not important.  OTOH, I see no other way to extend
> log commands to control more options like "git-log --stat",
> graph/no graph, and other pretty format options.

Strike that, I now have a better idea.

`C-u C-x v l' could ask for more additional command line arguments like
"--stat", "--graph", "--pretty", "--since", "--author", "--no-merges",
most useful of which could be added to the default value list of the
minibuffer.  This would allow the user to build complex queries.

-- 
Juri Linkov
http://www.jurta.org/emacs/




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

* Re: VC top of the tree diff and log
  2009-09-01 21:41         ` Juri Linkov
@ 2009-09-01 22:46           ` Dan Nicolaescu
  2009-09-04  0:06             ` Juri Linkov
  2009-12-06 22:37           ` Dan Nicolaescu
  1 sibling, 1 reply; 34+ messages in thread
From: Dan Nicolaescu @ 2009-09-01 22:46 UTC (permalink / raw)
  To: Juri Linkov; +Cc: Stefan Monnier, emacs-devel

Juri Linkov <juri@jurta.org> writes:

  > >   > vc-git.el was changed to support short logs, and vc-cvs.el to ignore the
  > >   > extra option (all vc backends need a similar change)
  > >   >
  > >   > WDYT?
  > >
  > > Ping.
  > >
  > > Any reason not to install this?
  > 
  > There is a problem in your patch.  Its "--graph" option fails in
  > git version 1.5.

Sorry, --graph was not supposed to be enabled by default at this point.
It won't be when I actually manage to install the patch.




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

* Re: VC top of the tree diff and log
  2009-09-01 22:07               ` Dan Nicolaescu
@ 2009-09-02  4:13                 ` Miles Bader
  2009-09-02  4:34                   ` Dan Nicolaescu
  0 siblings, 1 reply; 34+ messages in thread
From: Miles Bader @ 2009-09-02  4:13 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: Juri Linkov, Stefan Monnier, emacs-devel

Dan Nicolaescu <dann@ics.uci.edu> writes:
>   > Have you tried to run `vc-print-root-log' on the Emacs repository?
>   > I waited for several minutes and eventually abandoned the attempt.
>
> No, I only have the CVS one handy.
> But I've tried it on other things that have lots of lines, and yes it's
> slow.  See the "slow output" bugs/threads, they have been partially
> motivated by this. 
>
>   > We could provide a numeric prefix argument for vc print logs
>   > to limit the number of commits to show.  I mean translating it
>   > to the git command like "git-log -2".
>
> Yes, I have considered limiting the size of the log output, it needs to
> apply not only to the root log, but also to C-x v l.   But I
> don't know what the best thing to do here... :-(

What's the slowdown anyway?  The underlying git command, invoked via
`shell-command' (with output inserted into an emacs buffer) is almost
instantaneous.

Is it because it's trying to fontify and add text-props or overlays to
the entire buffer?

If that's the problem, it would obviously be _much_ more efficient to
use jit-lock or whatever, since people typically only look at like the
first 1% of such log output (if that!)...

-Miles

-- 
Suburbia: where they tear out the trees and then name streets after them.




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

* Re: VC top of the tree diff and log
  2009-09-02  4:13                 ` Miles Bader
@ 2009-09-02  4:34                   ` Dan Nicolaescu
  2009-09-04  0:05                     ` Juri Linkov
  0 siblings, 1 reply; 34+ messages in thread
From: Dan Nicolaescu @ 2009-09-02  4:34 UTC (permalink / raw)
  To: Miles Bader; +Cc: Juri Linkov, Stefan Monnier, emacs-devel

Miles Bader <miles@gnu.org> writes:

  > Dan Nicolaescu <dann@ics.uci.edu> writes:
  > >   > Have you tried to run `vc-print-root-log' on the Emacs repository?
  > >   > I waited for several minutes and eventually abandoned the attempt.
  > >
  > > No, I only have the CVS one handy.
  > > But I've tried it on other things that have lots of lines, and yes it's
  > > slow.  See the "slow output" bugs/threads, they have been partially
  > > motivated by this. 
  > >
  > >   > We could provide a numeric prefix argument for vc print logs
  > >   > to limit the number of commits to show.  I mean translating it
  > >   > to the git command like "git-log -2".
  > >
  > > Yes, I have considered limiting the size of the log output, it needs to
  > > apply not only to the root log, but also to C-x v l.   But I
  > > don't know what the best thing to do here... :-(
  > 
  > What's the slowdown anyway?  The underlying git command, invoked via
  > `shell-command' (with output inserted into an emacs buffer) is almost
  > instantaneous.
  > 
  > Is it because it's trying to fontify and add text-props or overlays to
  > the entire buffer?

Don't know for sure, but from what I remember last time I looked at this
the problem was not the fontification.




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

* Re: VC top of the tree diff and log
  2009-09-01 22:27                 ` Juri Linkov
@ 2009-09-04  0:04                   ` Juri Linkov
  2009-09-04  2:12                   ` Stefan Monnier
  1 sibling, 0 replies; 34+ messages in thread
From: Juri Linkov @ 2009-09-04  0:04 UTC (permalink / raw)
  To: Miles Bader; +Cc: Dan Nicolaescu, Stefan Monnier, emacs-devel

> `C-u C-x v l' could ask for more additional command line arguments like
> "--stat", "--graph", "--pretty", "--since", "--author", "--no-merges",
> most useful of which could be added to the default value list of the
> minibuffer.  This would allow the user to build complex queries.

Actually such UI already exists in PCL-CVS where a prefix argument
prompts for cvs flags.  This is very convenient.

-- 
Juri Linkov
http://www.jurta.org/emacs/




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

* Re: VC top of the tree diff and log
  2009-09-02  4:34                   ` Dan Nicolaescu
@ 2009-09-04  0:05                     ` Juri Linkov
  2009-09-04  0:33                       ` Miles Bader
  0 siblings, 1 reply; 34+ messages in thread
From: Juri Linkov @ 2009-09-04  0:05 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: emacs-devel, Stefan Monnier, Miles Bader

>   > >   > Have you tried to run `vc-print-root-log' on the Emacs repository?
>   > >   > I waited for several minutes and eventually abandoned the attempt.
>   > >
>   > > No, I only have the CVS one handy.
>   > > But I've tried it on other things that have lots of lines, and yes it's
>   > > slow.  See the "slow output" bugs/threads, they have been partially
>   > > motivated by this.
>   > >
>   > >   > We could provide a numeric prefix argument for vc print logs
>   > >   > to limit the number of commits to show.  I mean translating it
>   > >   > to the git command like "git-log -2".
>   > >
>   > > Yes, I have considered limiting the size of the log output, it needs to
>   > > apply not only to the root log, but also to C-x v l.   But I
>   > > don't know what the best thing to do here... :-(
>   >
>   > What's the slowdown anyway?  The underlying git command, invoked via
>   > `shell-command' (with output inserted into an emacs buffer) is almost
>   > instantaneous.
>   >
>   > Is it because it's trying to fontify and add text-props or overlays to
>   > the entire buffer?
>
> Don't know for sure, but from what I remember last time I looked at this
> the problem was not the fontification.

Yes, the problem is not the fontification.  Fontification starts only
after the git command finishes.  It is reading 500000-line output of
the complete emacs git log that takes too much time.

-- 
Juri Linkov
http://www.jurta.org/emacs/




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

* Re: VC top of the tree diff and log
  2009-09-01 22:46           ` Dan Nicolaescu
@ 2009-09-04  0:06             ` Juri Linkov
  0 siblings, 0 replies; 34+ messages in thread
From: Juri Linkov @ 2009-09-04  0:06 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: Stefan Monnier, emacs-devel

>   > There is a problem in your patch.  Its "--graph" option fails in
>   > git version 1.5.
>
> Sorry, --graph was not supposed to be enabled by default at this point.
> It won't be when I actually manage to install the patch.

We could probe the available git command for supported command line
arguments similarly to `grep-compute-defaults'.

-- 
Juri Linkov
http://www.jurta.org/emacs/




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

* Re: VC top of the tree diff and log
  2009-09-04  0:05                     ` Juri Linkov
@ 2009-09-04  0:33                       ` Miles Bader
  0 siblings, 0 replies; 34+ messages in thread
From: Miles Bader @ 2009-09-04  0:33 UTC (permalink / raw)
  To: Juri Linkov; +Cc: Dan Nicolaescu, Stefan Monnier, emacs-devel

Juri Linkov <juri@jurta.org> writes:
> Yes, the problem is not the fontification.  Fontification starts only
> after the git command finishes.  It is reading 500000-line output of
> the complete emacs git log that takes too much time.

But if I run the same git log command using `shell-command', inserting
into an emacs buffer, it is almost instantaneous (about 2-3 seconds,
whereas vc-log takes like 3 minutes!).

-Miles

-- 
`To alcohol!  The cause of, and solution to,
 all of life's problems' --Homer J. Simpson




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

* Re: VC top of the tree diff and log
  2009-08-29 19:13       ` Dan Nicolaescu
  2009-08-29 21:25         ` Stefan Monnier
  2009-09-01 21:41         ` Juri Linkov
@ 2009-09-04  0:36         ` Juri Linkov
  2009-09-04  3:42           ` Miles Bader
  2 siblings, 1 reply; 34+ messages in thread
From: Juri Linkov @ 2009-09-04  0:36 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: Stefan Monnier, emacs-devel

>>> See what I currently have.  What do you think?
>>
>> Here's an updated version that implements both top of the tree log

I think for the top of the tree log we should support doing it from the
dired buffer of the top directory of the tree.  Currently vc refuses to
do this with the error message:

  Buffer emacs is not associated with a file

where `emacs' is the top directory of the emacs git tree.

-- 
Juri Linkov
http://www.jurta.org/emacs/




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

* Re: VC top of the tree diff and log
  2009-09-01 22:27                 ` Juri Linkov
  2009-09-04  0:04                   ` Juri Linkov
@ 2009-09-04  2:12                   ` Stefan Monnier
  1 sibling, 0 replies; 34+ messages in thread
From: Stefan Monnier @ 2009-09-04  2:12 UTC (permalink / raw)
  To: Juri Linkov; +Cc: Dan Nicolaescu, emacs-devel, Miles Bader

> Strike that, I now have a better idea.

> `C-u C-x v l' could ask for more additional command line arguments like
> "--stat", "--graph", "--pretty", "--since", "--author", "--no-merges",
> most useful of which could be added to the default value list of the
> minibuffer.  This would allow the user to build complex queries.

That sounds like a good idea.


        Stefan




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

* Re: VC top of the tree diff and log
  2009-09-04  0:36         ` Juri Linkov
@ 2009-09-04  3:42           ` Miles Bader
  0 siblings, 0 replies; 34+ messages in thread
From: Miles Bader @ 2009-09-04  3:42 UTC (permalink / raw)
  To: Juri Linkov; +Cc: Dan Nicolaescu, Stefan Monnier, emacs-devel

Juri Linkov <juri@jurta.org> writes:
> I think for the top of the tree log we should support doing it from the
> dired buffer of the top directory of the tree.

I agree, that would be very useful and very natural.

I tend to have dired buffers sitting around for my project anyway -- and
usually _not_ vc-dir buffers -- and I often find myself trying to use
vc-... commands in them (which fail of course), even though I know they
won't work... :/

-Miles

-- 
Egotist, n. A person of low taste, more interested in himself than in me.




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

* Re: VC top of the tree diff and log
  2009-09-01 21:41         ` Juri Linkov
  2009-09-01 22:46           ` Dan Nicolaescu
@ 2009-12-06 22:37           ` Dan Nicolaescu
  1 sibling, 0 replies; 34+ messages in thread
From: Dan Nicolaescu @ 2009-12-06 22:37 UTC (permalink / raw)
  To: Juri Linkov; +Cc: Stefan Monnier, emacs-devel

Juri Linkov <juri@jurta.org> writes:

  > >   > vc-git.el was changed to support short logs, and vc-cvs.el to ignore the
  > >   > extra option (all vc backends need a similar change)
  > >   >
  > >   > WDYT?
  > >
  > > Ping.
  > >
  > > Any reason not to install this?
  > 
  > There is a problem in your patch.  Its "--graph" option fails in
  > git version 1.5.

Now vc-git's short log uses --graph (and --decorate).  This is what gitk
does too and it's extremely useful.
I documented in etc/NEWS that ancient versions will not support this new feature.




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

end of thread, other threads:[~2009-12-06 22:37 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-07 18:45 VC top of the tree diff and log Dan Nicolaescu
2009-07-08  2:50 ` Miles Bader
2009-07-08 21:10   ` Dan Nicolaescu
2009-07-08 23:01     ` Miles Bader
2009-07-09  0:29       ` Dan Nicolaescu
2009-07-09  3:05         ` Miles Bader
2009-07-09  3:58           ` C-x v l in a dired buffer [was: Re: VC top of the tree diff and log] Dan Nicolaescu
2009-07-09  6:48           ` VC top of the tree diff and log Dan Nicolaescu
2009-07-16 21:38       ` Dan Nicolaescu
2009-07-18 21:45         ` Juri Linkov
2009-07-11 19:51 ` Stefan Monnier
2009-07-23  5:43   ` Dan Nicolaescu
2009-07-30  7:18     ` Dan Nicolaescu
2009-08-29 19:13       ` Dan Nicolaescu
2009-08-29 21:25         ` Stefan Monnier
2009-08-29 22:47           ` Juri Linkov
2009-08-29 23:10             ` Miles Bader
2009-09-01 21:36               ` Juri Linkov
2009-09-01 22:27                 ` Juri Linkov
2009-09-04  0:04                   ` Juri Linkov
2009-09-04  2:12                   ` Stefan Monnier
2009-08-30  6:16           ` Dan Nicolaescu
2009-09-01 21:35             ` Juri Linkov
2009-09-01 22:07               ` Dan Nicolaescu
2009-09-02  4:13                 ` Miles Bader
2009-09-02  4:34                   ` Dan Nicolaescu
2009-09-04  0:05                     ` Juri Linkov
2009-09-04  0:33                       ` Miles Bader
2009-09-01 21:41         ` Juri Linkov
2009-09-01 22:46           ` Dan Nicolaescu
2009-09-04  0:06             ` Juri Linkov
2009-12-06 22:37           ` Dan Nicolaescu
2009-09-04  0:36         ` Juri Linkov
2009-09-04  3:42           ` Miles Bader

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).