Specifying repository root with cat

Martin Geisler mg at aragost.com
Thu Jan 27 05:10:45 CST 2011


Mark Finnis <m.v.finnis at gmail.com> writes:

> Hi,
>
> I'm not sure whether this is a bug or whether I'm missing something obvious.
> In Windows XP I want to list a file from a repository. If I'm sat in the
> repository root directory then
>
> hg cat -r -1 file
>
> lists the file as expected. If I'm in another directory then the response to
>
> hg -R rootdir cat -r -1 file
>
> is abort: file not under root. Something like
>
> hg -R rootdir log
>
> responds as expected and if I'm sat in the root directory
>
> hg -R rootdir cat -r -1 file
>
> lists the file. I can't see why I shouldn't be able to list a file
> outside of the working directory and even if I can't I wouldn't expect
> mercurial to respond in the way it has. Am I missing something?

You have to use

  hg -R rootdir cat -r -1 rootdir/file

That is, the -R flag does not change your current working directory and
relative paths are always computed from the CWD.

Use the --cwd flag if you want Mercurial to start by changing CWD.

-- 
Martin Geisler

aragost Trifork
Professional Mercurial support
http://aragost.com/en/services/mercurial/blog/


More information about the Mercurial mailing list