From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dan Nicolaescu Newsgroups: gmane.emacs.bugs Subject: bug#8756: 23.3; vc-git.el doesn't use --follow argument in vc-git-print-log Date: Thu, 01 Dec 2011 13:15:16 -0500 Message-ID: References: <87sjrxl0r1.fsf@dod.no> <878vn0yp42.fsf@dod.no> <87vcq2ygzs.fsf@dod.no> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1322763372 17622 80.91.229.12 (1 Dec 2011 18:16:12 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 1 Dec 2011 18:16:12 +0000 (UTC) Cc: 8756@debbugs.gnu.org To: Steinar Bang Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Dec 01 19:16:07 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RWBB0-0007KO-GV for geb-bug-gnu-emacs@m.gmane.org; Thu, 01 Dec 2011 19:16:06 +0100 Original-Received: from localhost ([::1]:48217 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RWBAz-0005Uh-Pg for geb-bug-gnu-emacs@m.gmane.org; Thu, 01 Dec 2011 13:16:05 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:59020) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RWBAr-0005Tt-IC for bug-gnu-emacs@gnu.org; Thu, 01 Dec 2011 13:16:03 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RWBAn-00012a-1X for bug-gnu-emacs@gnu.org; Thu, 01 Dec 2011 13:15:57 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:47963) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RWBAm-00012T-Mf for bug-gnu-emacs@gnu.org; Thu, 01 Dec 2011 13:15:52 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1RWBAw-0000Gn-Ea for bug-gnu-emacs@gnu.org; Thu, 01 Dec 2011 13:16:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dan Nicolaescu Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 01 Dec 2011 18:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8756 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 8756-submit@debbugs.gnu.org id=B8756.1322763329989 (code B ref 8756); Thu, 01 Dec 2011 18:16:02 +0000 Original-Received: (at 8756) by debbugs.gnu.org; 1 Dec 2011 18:15:29 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RWBAP-0000Fu-IH for submit@debbugs.gnu.org; Thu, 01 Dec 2011 13:15:29 -0500 Original-Received: from fencepost.gnu.org ([140.186.70.10]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RWBAO-0000Fn-5W for 8756@debbugs.gnu.org; Thu, 01 Dec 2011 13:15:29 -0500 Original-Received: from dann by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1RWBAC-0000Ek-RG; Thu, 01 Dec 2011 13:15:16 -0500 In-Reply-To: <87vcq2ygzs.fsf@dod.no> (Steinar Bang's message of "Tue, 29 Nov 2011 18:29:27 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Thu, 01 Dec 2011 13:16:02 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:54558 Archived-At: Steinar Bang writes: >>>>>> Dan Nicolaescu : >> Steinar Bang writes: > >>> .... The first problem I ran into, was that the emacs 23.1 version >>> of `vc-git-print-log' used "git rev-list" instead of "git log". And >>> only "git log" supports "--follow" to track renames > >> vc-git-print-log currently uses "git log", so your changes should not >> be needed. > > Something similar wille be needed, if vc-git-print-log is supposed to > support a files argument of more than a single file, since "--follow" is > only supported for a single file. > > #begin_example > sb@somehost:~$ git log --follow ~/apps/share/emacs23/site-lisp/vc-git.el ~/.emacs > usage: git logs can only follow renames on one pathname at a time > sb@somehost:~$ git log --follow > usage: git logs can only follow renames on one pathname at a time > #end_example > >> To solve this problem please figure out the git command (or set of >> commands) that produces the expected diff. Anything displayed in the >> log buffer can be considered as available. After that we need to figure >> out how to make VC use that/those command(s). > > To be able to get a working diff beyond the rename, you need the path to > where the file used to be. If you add the "--name-only" flag to "git > log", you will get an extra line containing the path of the file, in a > form that can be given to a "git diff". > > Using the log result at the bottom, here's an example that gives a > useful diff, using the path of the first commit: > #begin_example > sb@somehost:~$ git diff a92a3d062dac1b0ec5eece4ed6f9570e59f1a69b 8d304db76993a0da0894b3d30794a2c5ec4927fe -- apps/share/emacs/site-lisp/vc-git.el --name-only makes the output a bit ugly, each log entry has the file name printed and an extra empty line. Some users might hate that. Is it possible to compute the file name just the sha1? That would allow us to avoid using --name-only. > #begin_example > diff --git a/apps/share/emacs/site-lisp/vc-git.el b/apps/share/emacs/site-lisp/vc-git.el > index b9b63ce..e4b0188 100644 > --- a/apps/share/emacs/site-lisp/vc-git.el > +++ b/apps/share/emacs/site-lisp/vc-git.el > @@ -604,7 +604,7 @@ for the --graph option." > (apply 'vc-git-command buffer > 'async files > (append > - '("log" "--no-color") > + '("log" "--follow" "--no-color") > (when shortlog > '("--graph" "--decorate" "--date=short" > "--pretty=tformat:%d%h %ad %s" "--abbrev-commit")) > #end_example > > Blame for a path beyond the rename also works, just use the commit you > want to blame from, and the path of that commit in the log buffer: > git blame a92a3d062dac1b0ec5eece4ed6f9570e59f1a69b -- apps/share/emacs/site-lisp/vc-git.e > > Here's the example of a diff output with paths I used to get the above > commands. The rename commit is a50a042e5af770928eaa8b636517d66bc2a13ee7 > and the path given on that log entry, is the new path. > #begin_example > sb@somehost:~$ git log --follow --name-only ~/apps/share/emacs23/site-lisp/vc-git.el > commit ae93673cf7a325ac6882b73a4280cfba3fca41e9 > Author: Steinar Bang > Date: Mon Nov 28 23:12:47 2011 +0100 > > Make `vc-git-print-log' on a single file use "git log --follow" instead of "git rev-list". > > This is to make the `C-x v l' command show log entries across file > renames. > > Only partially successful, since diffs, annotate, and finding the > version of the file, doesn't work across the renaming boundary. > > apps/share/emacs23/site-lisp/vc-git.el > > commit 4098e78805561b9af3e29184a8133baaf6d16621 > Author: Steinar Bang > Date: Mon Nov 28 10:28:49 2011 +0100 > > Emacs 23.1 version of vc-git.el. > > apps/share/emacs23/site-lisp/vc-git.el > > commit a50a042e5af770928eaa8b636517d66bc2a13ee7 > Author: Steinar Bang > Date: Thu Jun 23 19:26:28 2011 +0200 > > Load the locally modified vc-git.el only for emacs23 (fails on emacs22). > > apps/share/emacs23/site-lisp/vc-git.el > > commit 8d304db76993a0da0894b3d30794a2c5ec4927fe > Author: Steinar Bang > Date: Sun May 29 22:24:58 2011 +0200 > > Use the --follow flag on the "git log" command, to get full history across file moves in vc-git-print-log. > > apps/share/emacs/site-lisp/vc-git.el > > commit a92a3d062dac1b0ec5eece4ed6f9570e59f1a69b > Author: Steinar Bang > Date: Sun May 29 22:23:51 2011 +0200 > > Adding the vc-git.el from emacs 23.3. > > apps/share/emacs/site-lisp/vc-git.el > #end_example