bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#22032: 24.3; VC doesn't handle hg hidden revisions


From: Glenn Hutchings
Subject: bug#22032: 24.3; VC doesn't handle hg hidden revisions
Date: Sun, 13 Dec 2015 10:54:37 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]