From: Lars Ingebrigtsen <larsi@gnus.org>
To: Lars Ljung <lars@matholka.se>
Cc: Glenn Morris <rgm@gnu.org>,
Stefan Monnier <monnier@iro.umontreal.ca>,
13547@debbugs.gnu.org
Subject: bug#13547: svn annotate - incorrect previous/next revision
Date: Thu, 15 Jul 2021 11:01:13 +0200 [thread overview]
Message-ID: <878s28kl2e.fsf@gnus.org> (raw)
In-Reply-To: <5105105F.9040500@matholka.se> (Lars Ljung's message of "Sun, 27 Jan 2013 12:32:47 +0100")
Lars Ljung <lars@matholka.se> writes:
>> Thanks. I guess the drawback here is, that will contact the svn
>> repository, which may be on a remote server, so could be slow.
>>
>> It seems this is used by vc-annotate, vc-rollback, and vc-diff.
>
> Yes, it will be slower. But as far as I know there is no other way to
> get the previous/next revision of a file.
I haven't used svn in many years, so I don't have much of an opinion
here. I've respun the patch for Emacs 28; included below.
Anybody got an opinion here?
diff --git a/lisp/vc/vc-svn.el b/lisp/vc/vc-svn.el
index c30920dd15..0cc7bda1ba 100644
--- a/lisp/vc/vc-svn.el
+++ b/lisp/vc/vc-svn.el
@@ -248,23 +248,29 @@ vc-svn-working-revision
;; vc-svn-mode-line-string doesn't exist because the default implementation
;; works just fine.
-(defun vc-svn-previous-revision (_file rev)
- (let ((newrev (1- (string-to-number rev))))
- (when (< 0 newrev)
- (number-to-string newrev))))
+(defun vc-svn-previous-revision (file rev)
+ (if file
+ (with-temp-buffer
+ (let (process-file-side-effects)
+ (vc-svn-command t 0 file "log" "-q" "--limit" "2"
+ (format "-r%s:1" rev)))
+ (let ((revision-list '()))
+ (while (re-search-backward "^r\\([0-9]+\\)" nil t)
+ (push (match-string 1) revision-list))
+ (cadr revision-list)))
+ (let ((newrev (1- (string-to-number rev))))
+ (when (< 0 newrev)
+ (number-to-string newrev)))))
(defun vc-svn-next-revision (file rev)
- (let ((newrev (1+ (string-to-number rev))))
- ;; The "working revision" is an uneasy conceptual fit under Subversion;
- ;; we use it as the upper bound until a better idea comes along. If the
- ;; workfile version W coincides with the tree's latest revision R, then
- ;; this check prevents a "no such revision: R+1" error. Otherwise, it
- ;; inhibits showing of W+1 through R, which could be considered anywhere
- ;; from gracious to impolite.
- (unless (< (string-to-number (vc-file-getprop file 'vc-working-revision))
- newrev)
- (number-to-string newrev))))
-
+ (with-temp-buffer
+ (let (process-file-side-effects)
+ (vc-svn-command t 0 file "log" "-q" "--limit" "2"
+ (format "-r%s:HEAD" rev)))
+ (let ((revision-list '()))
+ (while (re-search-backward "^r\\([0-9]+\\)" nil t)
+ (push (match-string 1) revision-list))
+ (cadr revision-list))))
;;;
;;; State-changing functions
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
next prev parent reply other threads:[~2021-07-15 9:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-25 9:29 bug#13547: svn annotate - incorrect previous/next revision Lars Ljung
2013-01-27 2:24 ` Glenn Morris
2013-01-27 11:32 ` Lars Ljung
2021-07-15 9:01 ` Lars Ingebrigtsen [this message]
2021-07-30 11:54 ` Lars Ingebrigtsen
2021-07-31 2:40 ` Dmitry Gutov
2022-03-23 19:57 ` Lars Ingebrigtsen
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=878s28kl2e.fsf@gnus.org \
--to=larsi@gnus.org \
--cc=13547@debbugs.gnu.org \
--cc=lars@matholka.se \
--cc=monnier@iro.umontreal.ca \
--cc=rgm@gnu.org \
/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.