On 11/28/15 18:09, Dmitry Gutov wrote:
Please
try this definition and see if it resolves the problem:
(defun vc-hg-previous-revision (_file rev)
(let ((newrev (1- (string-to-number rev))))
(when (>= newrev 0)
(with-temp-buffer
(vc-hg-command t 0 nil
"id" "--hidden" "-n" "-r"
(format "first(%d:0 and not hidden())"
newrev))
;; Trim the trailing newline.
(buffer-substring (point-min) (1- (point-max)))))))
This says to look at all non-hidden revs
from X down to zero, choose the
first one, and print its numeric rev number. If the current rev
is X+1,
that gives the first previous non-hidden rev. But I'm sure
there must
be a better way, without having to examine all previous
changesets.
If you anticipated that we'd have to make one process call per
revision, then I think the above definition does better.
I tried this, and it works fine. But I discovered another problem
for VC with the changeset evolution features: if a repository has
any changesets that are marked 'obsolete', and any mercurial command
is issued by a user who hasn't enabled the extension, a warning
message is printed to stderr:
obsolete feature not enabled but <N> markers
found!
If VC grabs this output as part of the mercurial response, and uses
it in subsequent commands, it (unsurprisingly) fails:
hg: parse error at 9: invalid token
Looking at mercurial sources, there's no way to suppress this
warning. I guess one workaround would be to have vc-hg-command skip
over it if it's there.
Glenn