From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#14989: 24.3.50; log-view-diff and log-view-diff-changeset default to different `to' revisions for git merge commits Date: Wed, 31 Jul 2013 01:42:57 +0300 Message-ID: <8738qv8ya6.fsf@axl.i-did-not-set--mail-host-address--so-tickle-me> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1375224263 9008 80.91.229.3 (30 Jul 2013 22:44:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 30 Jul 2013 22:44:23 +0000 (UTC) To: 14989@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jul 31 00:44:25 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1V4IeW-0000fv-SN for geb-bug-gnu-emacs@m.gmane.org; Wed, 31 Jul 2013 00:44:25 +0200 Original-Received: from localhost ([::1]:40695 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V4IeW-0005gt-I0 for geb-bug-gnu-emacs@m.gmane.org; Tue, 30 Jul 2013 18:44:24 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45309) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V4IeK-0005aW-HT for bug-gnu-emacs@gnu.org; Tue, 30 Jul 2013 18:44:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V4IeB-0005vk-Ss for bug-gnu-emacs@gnu.org; Tue, 30 Jul 2013 18:44:12 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:36675) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V4IeB-0005vQ-Pq for bug-gnu-emacs@gnu.org; Tue, 30 Jul 2013 18:44:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1V4IeA-0000kM-EN for bug-gnu-emacs@gnu.org; Tue, 30 Jul 2013 18:44:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 30 Jul 2013 22:44:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 14989 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.13752242222818 (code B ref -1); Tue, 30 Jul 2013 22:44:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 30 Jul 2013 22:43:42 +0000 Original-Received: from localhost ([127.0.0.1]:59223 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1V4Idp-0000jL-RR for submit@debbugs.gnu.org; Tue, 30 Jul 2013 18:43:42 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:43281) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1V4Idn-0000j5-Ar for submit@debbugs.gnu.org; Tue, 30 Jul 2013 18:43:39 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V4IdY-0005mG-RS for submit@debbugs.gnu.org; Tue, 30 Jul 2013 18:43:33 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:38652) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V4IdY-0005m7-Dd for submit@debbugs.gnu.org; Tue, 30 Jul 2013 18:43:24 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44906) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V4IdP-0004p0-VI for bug-gnu-emacs@gnu.org; Tue, 30 Jul 2013 18:43:24 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V4IdH-0005iz-Ag for bug-gnu-emacs@gnu.org; Tue, 30 Jul 2013 18:43:15 -0400 Original-Received: from mail-we0-x229.google.com ([2a00:1450:400c:c03::229]:45157) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V4IdH-0005ic-4o for bug-gnu-emacs@gnu.org; Tue, 30 Jul 2013 18:43:07 -0400 Original-Received: by mail-we0-f169.google.com with SMTP id n5so4939027wev.28 for ; Tue, 30 Jul 2013 15:43:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id:mime-version:content-type; bh=rwAVQRcqoYoZxPFUXrNO0ohdUiQgQSftFEHnugNAj5A=; b=mYY3xIhOeTmYDc+yzArElrohTs2bhb2ysnwUc+lw9H3iTsth8M25FJM9D7xeZGspWQ iVAl9XbiKttvbTiVY9Y6gMkWqQcXfQJNjl6YvsUFzOmG/kP4kT5rh4VXVrj4UvUc+32U a3XwaB7dpjkbwvgdun1NSmQxkLYK7qhQmxKWCIM12o1Mi4mqz+BCVehVg24Dct6rqv9j zhJnNGWQxFWtFKIcesJCDp3c7lN4EV5TZrsXj8hYKGL7G32VZpA75LeqaCgSiCMJziim nyD/XsZMtBNkyE0SHUn/GKFsso1XYuJLTkKyRUVYKnnOAWP+Q5vgHgv8C4soi+2XI/VK c1xg== X-Received: by 10.180.208.17 with SMTP id ma17mr2417100wic.7.1375224186130; Tue, 30 Jul 2013 15:43:06 -0700 (PDT) Original-Received: from axl (93-67-220.netrun.cytanet.com.cy. [93.109.67.220]) by mx.google.com with ESMTPSA id fd3sm31536915wic.10.2013.07.30.15.43.04 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 30 Jul 2013 15:43:05 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x 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:76836 Archived-At: To reproduce: Have a merge commit where the second branch (merged from) has a newer last commit than the first branch (merged to). `vc-print-root-log' buffer would look like this: * (HEAD, devel)b044fba..: Some Guy 2013-07-25 foo foo * 2152d76..: Dmitry Gutov 2013-07-25 Merge branch 'bar' into devel |\ | * (bar)1554943..: Another Guy 2013-07-25 Abc | * f92770a..: Another Guy 2013-07-25 Def * | 5f5c068..: Another Guy 2013-07-25 Ghi If I move to commit 2152d76 and press `d', it will show the diff against 1554943. If I press `D', if will show the diff against 5f5c068, which is *the* parent commit, as far as Git is concerned (the first parent, to be more exact), because it belongs to the branch `devel', and the merge was done from `bar' to `devel'. Since this is a `vc-print-root-log' buffer, both commands will show the full changesets, not just changes in an individual file. But the behavior in `vc-print-log' is the same in this respect, except the diff `d' shows is just for the current file. `log-view-diff' behavior makes certain amount of sense (it always diffs against the revision on the line below), but it's inconsistent with `log-view-diff-changeset', and it also backfires when the current commit is not a child of the commit on the previous line. Example: f92770a and 5f5c068. As a result, we get a meaningless diff. This fix is simple enough. Apply? === modified file 'lisp/vc/log-view.el' --- lisp/vc/log-view.el 2013-06-11 06:36:06 +0000 +++ lisp/vc/log-view.el 2013-07-30 22:31:40 +0000 @@ -565,10 +565,7 @@ (let ((fr (log-view-current-tag beg)) (to (log-view-current-tag end))) (when (string-equal fr to) - (save-excursion - (goto-char end) - (log-view-msg-next) - (setq to (log-view-current-tag)))) + (setq to (vc-call-backend log-view-vc-backend 'previous-revision nil fr))) (vc-diff-internal t (list log-view-vc-backend (if log-view-per-file-logs The functions could also use some further cleanup: 1) Swap the `to' and `fr' local variables. 2) Extract the function bodies to one function with a third argument (called `whole-changeset', maybe), and make them call it. Objections?