all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dmitry@gutov.dev>
To: Spencer Baugh <sbaugh@janestreet.com>
Cc: 62940@debbugs.gnu.org, Filipp Gunbin <fgunbin@fastmail.fm>
Subject: bug#62940: 29.0.60; vc: no easy way to get diff of all outgoing changes
Date: Thu, 17 Oct 2024 02:53:25 +0300	[thread overview]
Message-ID: <ef23e54f-7e6f-4f4f-aee5-7649cc364546@gutov.dev> (raw)
In-Reply-To: <ierplnzkdue.fsf@janestreet.com>

On 16/10/2024 23:11, Spencer Baugh wrote:

> Right.  But note that the Hg revset in my original patch finds what is
> effectively the mergebase with upstream, without doing any network IO.

Yep. So this is the implementation we can use for now.

>> As a result, the core feature will work (the "outgoing" diff), whereas
>> the "incoming" diff would only be accessible for Git
>> repositories. Also, with Git, one might need to use vc-log-mergebase
>> when the remote has diverged.
> 
> Right, that makes sense to me.
> 
> Just to be clear, you're suggesting the incoming diff would be
> accessible for a Git repository via vc-diff-mergebase, right?

Right, something like

   C-x v B M HEAD RET @{upstream} RET

Actually trying that out brings up the problem that @{upstream} is not 
in completions for rev2. We could add it as the next default:

diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index a30ba06aec3..2409b4e88a0 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -2068,7 +2073,10 @@ vc-diff-build-argument-list-internal
           (backend (car vc-fileset))
           (first (car files))
           (rev1-default nil)
+         (upstream-revision (vc-call-backend backend 'upstream-revision 
first))
           ) ;; (rev2-default nil)
+    (when upstream-revision
+      (push upstream-revision rev1-default))
      (cond
       ;; someday we may be able to do revision completion on non-singleton
       ;; filesets, but not yet.
@@ -2087,7 +2095,8 @@ vc-diff-build-argument-list-internal
                                         ;; (or rev2-default
                                         "current source"))
             (rev1 (vc-read-revision rev1-prompt files backend 
rev1-default))
-           (rev2 (vc-read-revision rev2-prompt files backend nil))) ;; 
rev2-default
+           (rev2 (vc-read-revision rev2-prompt files backend (list ""
+ 
upstream-revision)))) ;; rev2-default
        (when (string= rev1 "") (setq rev1 nil))
        (when (string= rev2 "") (setq rev2 nil))
        (list files rev1 rev2))))


Or alternatively, we could move both "upstream revision" identifiers to 
the revision-completion-table implementations. The result might be a bit 
less convenient, but "last ..." and "@{upstream}" will show up in 
completions, and after being selected once, will be in the input history 
as well. Depending on the frequency of use, that might be okay.

That diffs looks like this:

diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 5a7ffeffc9d..019abfa475c 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -1771,7 +1771,7 @@ vc-git-diff
  (defun vc-git-revision-table (_files)
    ;; What about `files'?!?  --Stef
    (let (process-file-side-effects
-	(table (list "HEAD")))
+	(table (list "HEAD" "@{upstream}")))
      (with-temp-buffer
        (vc-git-command t nil nil "for-each-ref" "--format=%(refname)")
        (goto-char (point-min))
diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el
index 856bea66a6f..90ab47fa6cd 100644
--- a/lisp/vc/vc-hg.el
+++ b/lisp/vc/vc-hg.el
@@ -545,13 +545,15 @@ vc-hg-expanded-log-entry
        (buffer-string))))

  (defun vc-hg-revision-table (files)
-  (let ((default-directory (file-name-directory (car files))))
+  (let ((default-directory (file-name-directory (car files)))
+        (upstream-rev "last(. and not outgoing())"))
      (with-temp-buffer
        (vc-hg-command t nil nil "branches" "-q")
        (vc-hg-command t nil nil "bookmarks" "-q")
        (vc-hg-command t nil nil "tags" "-q")
-      (split-string
-       (buffer-substring-no-properties (point-min) (point-max))))))
+      (cons upstream-rev
+            (split-string
+             (buffer-substring-no-properties (point-min) (point-max)))))))

  ;; Modeled after the similar function in vc-cvs.el
  (defun vc-hg-revision-completion-table (files)






  reply	other threads:[~2024-10-16 23:53 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-18 19:12 bug#62940: 29.0.60; vc: no easy way to get diff of all outgoing changes Spencer Baugh
2023-04-18 20:36 ` Filipp Gunbin
2023-04-18 20:43   ` Dmitry Gutov
2023-04-19  6:49     ` Juri Linkov
2023-08-14 19:42       ` Spencer Baugh
2023-08-16  7:48         ` Juri Linkov
2024-09-13 20:54     ` Spencer Baugh via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-14  2:11       ` Dmitry Gutov
2024-09-14  7:12         ` Eli Zaretskii
2024-10-10  0:26           ` Dmitry Gutov
2024-10-10  5:27             ` Eli Zaretskii
2024-10-11  1:13               ` Dmitry Gutov
2024-10-11  6:07                 ` Eli Zaretskii
2024-10-11 14:40                   ` Dmitry Gutov
2024-10-11  1:34       ` Dmitry Gutov
2024-10-11 14:39         ` Dmitry Gutov
2024-10-11 15:10           ` Spencer Baugh via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-11 20:28             ` Dmitry Gutov
2024-10-11 22:38               ` Dmitry Gutov
2024-10-12  8:32                 ` Eli Zaretskii
2024-10-15 18:10               ` Spencer Baugh via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-16 20:02                 ` Dmitry Gutov
2024-10-16 20:11                   ` Spencer Baugh via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-16 23:53                     ` Dmitry Gutov [this message]
2023-04-18 21:59   ` Spencer Baugh
2023-04-21 18:36     ` sbaugh
2023-04-22  6:57       ` Eli Zaretskii
2023-04-22 13:00         ` sbaugh
2023-04-22 13:17           ` Eli Zaretskii
2023-04-22 18:33             ` Dmitry Gutov
2023-04-22 19:27               ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ef23e54f-7e6f-4f4f-aee5-7649cc364546@gutov.dev \
    --to=dmitry@gutov.dev \
    --cc=62940@debbugs.gnu.org \
    --cc=fgunbin@fastmail.fm \
    --cc=sbaugh@janestreet.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.