Subject: Re: bug#5960: 24.0.50; vc-annotate buffer commands fail in subdirectories with Hg

From: Dan Nicolaescu <[email-masked]>
Date: Fri, 16 Apr 2010 14:45:54 -0400

Magnus Henoch <[email-masked]> writes:

> cd /tmp
> hg init reproduce
> cd reproduce
> mkdir foo
> echo foo > foo/foo.txt
> hg add foo/foo.txt
> hg commit -m "Added foo.txt."
> emacs -Q foo/foo.txt
>
> C-x v g
> l
>
> Expected result: the *vc-change-log* buffer lists the changeset that added
> foo.txt.
> Actual result: the *vc-change-log* buffer is empty.
>
> I took a look in the code, and it seems that
> vc-hg-annotate-extract-revision-at-line expands filenames against the
> current directory, while `hg annotate' displays filenames relative to
> the project root.  Thus this patch:
>
> === modified file 'lisp/vc-hg.el'
> --- lisp/vc-hg.el	2010-04-07 05:56:35 +0000
> +++ lisp/vc-hg.el	2010-04-16 17:43:15 +0000
> @@ -356,7 +356,7 @@
>        (if (match-beginning 3)
>  	  (match-string-no-properties 1)
>  	(cons (match-string-no-properties 1)
> -	      (expand-file-name (match-string-no-properties 4)))))))
> +              (expand-file-name (match-string-no-properties 4) (vc-hg-root default-directory)))))))
>  
>  (defun vc-hg-previous-revision (file rev)
>    (let ((newrev (1- (string-to-number rev))))
>

Thanks!
This is a regression from 23.1, so this should go into the emacs-23
branch if that branch is still open for regressions.  Yidong?

Please check it in.