> "Uwe" == Uwe Brauer <oub(a)mat.ucm.es> writes:
Hello
I use this function a lot, but I also checkin jumping branches
1.1 1.2 1.3 1.4
2.1 2.2
But then (vc-annotate-revision-previous-to-line) can go back from 2.2
to
2.1 but not to 1.4.
Thien-Thi Nguyen solved my problem with the following hack
(defun vc-minor-part (rev) ;part of GNU vc
"Return the minor revision number of a revision number REV."
(string-match "[0-9]+\\'" rev)
(substring rev (match-beginning 0) (match-end 0)))
(defun vc-trunk-p (rev); part of GNU vc
"Return t if REV is a revision on the trunk."
(not (eq nil (string-match "\\`[0-9]+\\.[0-9]+\\'" rev))))
(defalias 'vc-rcs-minor-part 'vc-minor-part);23-24 compatibility
(defalias 'vc-rcs-trunk-p 'vc-trunk-p);23-24 compatibility
(defun vc-rcs-previous-revision (file rev)
"Return the revision number immediately preceding REV for FILE,
or nil if there is no previous revision. This default
implementation works for MAJOR.MINOR-style revision numbers as
used by RCS and CVS."
(let ((branch (vc-branch-part rev))
(minor-num (string-to-number (vc-rcs-minor-part rev))))
(when branch
(if (> minor-num 1)
;; revision does probably not start a branch or release
(concat branch "." (number-to-string (1- minor-num)))
(if (vc-rcs-trunk-p rev)
;; we are at the beginning of the trunk --
(let* ((trunk-num (string-to-number branch))
(prev (1- trunk-num))
(out (shell-command-to-string
(format "rlog -r%d. '%s'" prev file))))
(if (string-match "^revision \\(.+\\)$" out)
;; return the highest revision on the previous trunk
(match-string 1 out)
;; don't know anything to return here
nil))
;; we are at the beginning of a branch --
;; return revision of starting point
(vc-branch-part branch))))))
The basic idea is to use rlog in an appropriate way (that is why
Thien-Thi Nguyen called it a hack). His solution works with GNU emacs 23
and 24 but, however it does not work with xemacs[1], in fact the vc pkg
of both emacsen are quite different, I would even say the Xemacs version
is older (and inferior).
So the issue are there any plans to port a recent GNU vc pkg to Xemacs?
Or does anybody have an idea, based on the solution above, how to
implement this feature in Xemacs?
thanks
Uwe Brauer
Footnotes:
[1] this is not entirely true. I can call xemacs version of
vc-annotate, then I load GNU emacs vc.el, vc-dispatcher.el,
vc-annotate.el and vc-rcs-previous-revision (which contains the new
hack), then I can decrement the RCS version as I like, however then
I cannot checkin or checkout, so I have to load xemacs vc.el
again. Oh....
_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-beta