show merge info for git vc-log

View: New views
12 Messages — Rating Filter:   Alert me  

show merge info for git vc-log

by Dan Nicolaescu :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


git log can show a graph of the merges, it looks like this:


*   commit blah
|\  Merge: blah blah
| | Author: blah
| | Date:   blah
| |
| |     Merge branch 'master'
| |
| *   commit blah
| |\  Merge: blah blah
| | | Author: blah
| | | Date:   blah
| | |
| | |     Merge branch foo.
| | |
| | * commit blah
| | | Author: blah
| | | Date:   blah
| | |
| | |     Fix some stuff.
| | |
| | * commit blah
| | | Author: blah
| | | Date:   blah
| | |
| | |     Fix more stuff.
| | |
| | |
* | | commit blah
|/ /  Author: blah
| |   Date:   blah
| |  
| |       blah


Should we vc-log do this by default for git?
Lightly tested patch:

--- vc-git.el.~1.82.~ Fri Jun 26 18:46:22 2009
+++ vc-git.el Tue Jul  7 11:27:52 2009
@@ -459,4 +459,4 @@
       (with-current-buffer
           buffer
  (vc-git-command buffer 'async files
- "rev-list" "--pretty" "HEAD" "--")))))
+ "rev-list"  "--graph" "--pretty" "HEAD" "--")))))
@@ -472,17 +497,17 @@
   (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]+\\)")
+       "^[ */\\|]+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_.-]+\\)"
+        '((" 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_.-]+\\)[>)]"
+          (" 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_.-]+\\)"
@@ -490,11 +515,11 @@
           ("^ +\\(?:\\(?:[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]+\\)"
+          (" 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))))))
+          (" 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.



Re: show merge info for git vc-log

by leon-9 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 2009-07-07 19:33 +0100, Dan Nicolaescu wrote:
> Should we vc-log do this by default for git?
> Lightly tested patch:

It looks very attractive.

--
Leo's Emacs uptime: 27 days, 5 hours, 36 minutes, 21 seconds




Re: show merge info for git vc-log

by Dmitry Dzhus-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Mercurial can do the same with graphlog extension enabled (it's included
in Mercurial distribution now) if we add `-G` flag in
`vc-hg-log-switches`.

Font-lock regexps in `vc-hg-log-view-mode` stop working though (because
of leading "^").
--
Happy Hacking.

http://sphinx.net.ru





Re: show merge info for git vc-log

by Dan Nicolaescu :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dmitry Dzhus <dima@...> writes:

  > Mercurial can do the same with graphlog extension enabled (it's included
  > in Mercurial distribution now) if we add `-G` flag in
  > `vc-hg-log-switches`.

Is there a way to force that flag to work?

$ hg log -G
hg log: option -G not recognized
hg log [OPTION]... [FILE]

$ hg --version
Mercurial Distributed SCM (version 1.2.1)

I have a:
/usr/lib/python2.6/site-packages/hgext/graphlog.py
file.


  > Font-lock regexps in `vc-hg-log-view-mode` stop working though (because
  > of leading "^").

That will be fixed if we decide to add the graph view by default.



Re: show merge info for git vc-log

by Thierry Volpiatto-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dan Nicolaescu <dann@...> writes:

> Dmitry Dzhus <dima@...> writes:
>
>   > Mercurial can do the same with graphlog extension enabled (it's included
>   > in Mercurial distribution now) if we add `-G` flag in
>   > `vc-hg-log-switches`.
>
> Is there a way to force that flag to work?
>
> $ hg log -G
> hg log: option -G not recognized
> hg log [OPTION]... [FILE]

Add this to your .hgrc

,----
| [extensions]
| hgext.graphlog =
`----

> $ hg --version
> Mercurial Distributed SCM (version 1.2.1)
>
> I have a:
> /usr/lib/python2.6/site-packages/hgext/graphlog.py
> file.
>
>
>   > Font-lock regexps in `vc-hg-log-view-mode` stop working though (because
>   > of leading "^").
>
> That will be fixed if we decide to add the graph view by default.
>
>
>

--
A + Thierry Volpiatto
Location: Saint-Cyr-Sur-Mer - France




Re: show merge info for git vc-log

by Dan Nicolaescu :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thierry Volpiatto <thierry.volpiatto@...> writes:

  > Dan Nicolaescu <dann@...> writes:
  >
  > > Dmitry Dzhus <dima@...> writes:
  > >
  > >   > Mercurial can do the same with graphlog extension enabled (it's included
  > >   > in Mercurial distribution now) if we add `-G` flag in
  > >   > `vc-hg-log-switches`.
  > >
  > > Is there a way to force that flag to work?
  > >
  > > $ hg log -G
  > > hg log: option -G not recognized
  > > hg log [OPTION]... [FILE]
  >
  > Add this to your .hgrc

That's not good.  To enable this by default, we need to be able to force
this flag to work from the command line.



Re: show merge info for git vc-log

by Kevin Rodgers-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dan Nicolaescu wrote:

> Thierry Volpiatto <thierry.volpiatto@...> writes:
>
>   > Dan Nicolaescu <dann@...> writes:
>   >
>   > > Dmitry Dzhus <dima@...> writes:
>   > >
>   > >   > Mercurial can do the same with graphlog extension enabled (it's included
>   > >   > in Mercurial distribution now) if we add `-G` flag in
>   > >   > `vc-hg-log-switches`.
>   > >
>   > > Is there a way to force that flag to work?
>   > >
>   > > $ hg log -G
>   > > hg log: option -G not recognized
>   > > hg log [OPTION]... [FILE]
>   >
>   > Add this to your .hgrc
>
> That's not good.  To enable this by default, we need to be able to force
> this flag to work from the command line.

True, but you can enable it conditionally, depending on the exit status
of "grep '^hgext.graphlog *=' $HOME/.hgrc"

--
Kevin Rodgers
Denver, Colorado, USA




Re: show merge info for git vc-log

by Dan Nicolaescu :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Kevin Rodgers <kevin.d.rodgers@...> writes:

  > Dan Nicolaescu wrote:
  > > Thierry Volpiatto <thierry.volpiatto@...> writes:
  > >
  > >   > Dan Nicolaescu <dann@...> writes:
  > >   >   > > Dmitry Dzhus <dima@...> writes:
  > >   > >
  > >   > >   > Mercurial can do the same with graphlog extension enabled (it's included
  > >   > >   > in Mercurial distribution now) if we add `-G` flag in
  > >   > >   > `vc-hg-log-switches`.
  > >   > >
  > >   > > Is there a way to force that flag to work?   > >
  > >   > > $ hg log -G
  > >   > > hg log: option -G not recognized
  > >   > > hg log [OPTION]... [FILE]
  > >   >   > Add this to your .hgrc
  > >
  > > That's not good.  To enable this by default, we need to be able to force
  > > this flag to work from the command line.
  >
  > True, but you can enable it conditionally, depending on the exit
  > status of "grep '^hgext.graphlog *=' $HOME/.hgrc"

The regexps that do syntax highlighting need to change depending if
graphlog is used or not.   Adding two versions, or making the regexps
cope with too formats just adds complexity.  When hg is fixed to do this
thing is a less painful way we can update vc-hg.el to use it.



Re: show merge info for git vc-log

by Thierry Volpiatto-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dan Nicolaescu <dann@...> writes:

> Thierry Volpiatto <thierry.volpiatto@...> writes:
>
>   > Dan Nicolaescu <dann@...> writes:
>   >
>   > > Dmitry Dzhus <dima@...> writes:
>   > >
>   > >   > Mercurial can do the same with graphlog extension enabled (it's included
>   > >   > in Mercurial distribution now) if we add `-G` flag in
>   > >   > `vc-hg-log-switches`.
>   > >
>   > > Is there a way to force that flag to work?
>   > >
>   > > $ hg log -G
>   > > hg log: option -G not recognized
>   > > hg log [OPTION]... [FILE]
>   >
>   > Add this to your .hgrc
>
> That's not good.  To enable this by default, we need to be able to force
> this flag to work from the command line.
>
That will work on the command line only if you activate the extension in
your .hgrc.
What is the problem? you try to enable a log with the graph, if it not
available, you fallback to a normal log. Or with a variable, something
like `vc-hg-use-graphlog'.
What do you want to do exactly, add support for that in vc?

--
A + Thierry Volpiatto
Location: Saint-Cyr-Sur-Mer - France



Re: show merge info for git vc-log

by Dan Nicolaescu :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thierry Volpiatto <thierry.volpiatto@...> writes:

  > Dan Nicolaescu <dann@...> writes:
  >
  > > Thierry Volpiatto <thierry.volpiatto@...> writes:
  > >
  > >   > Dan Nicolaescu <dann@...> writes:
  > >   >
  > >   > > Dmitry Dzhus <dima@...> writes:
  > >   > >
  > >   > >   > Mercurial can do the same with graphlog extension enabled (it's included
  > >   > >   > in Mercurial distribution now) if we add `-G` flag in
  > >   > >   > `vc-hg-log-switches`.
  > >   > >
  > >   > > Is there a way to force that flag to work?
  > >   > >
  > >   > > $ hg log -G
  > >   > > hg log: option -G not recognized
  > >   > > hg log [OPTION]... [FILE]
  > >   >
  > >   > Add this to your .hgrc
  > >
  > > That's not good.  To enable this by default, we need to be able to force
  > > this flag to work from the command line.
  > >
  > That will work on the command line only if you activate the extension in
  > your .hgrc.
  > What is the problem? you try to enable a log with the graph, if it not
  > available, you fallback to a normal log. Or with a variable, something
  > like `vc-hg-use-graphlog'.

See what I wrote above your answer.

Yes, it can be solved, but I won't add extra complexity and inconsistent
behavior that depends of the contents of users .hgrc.

Consistent behavior cannot be obtained as long as the graphlog is
something that requires the user to edit her .hgrc.



Re: show merge info for git vc-log

by Dmitry Dzhus-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dan Nicolaescu wrote:

> Yes, it can be solved, but I won't add extra complexity and inconsistent
> behavior that depends of the contents of users .hgrc.
>
> Consistent behavior cannot be obtained as long as the graphlog is
> something that requires the user to edit her .hgrc.

Mercurial upstream does not enable all included extensions (about 30 of
them) by default, and I don't think that this policy is likely to
change.
--
Happy Hacking.

http://sphinx.net.ru




Re: show merge info for git vc-log

by Stefan Monnier :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> Should vc-log do this by default for git?

I'd like to see it configurable (I have no preference for the default),
which means the regexps need to accept both formats.


        Stefan