Specifying repository root with cat

Mark Finnis m.v.finnis at gmail.com
Mon Jan 31 07:07:26 CST 2011


The short answer is no - I just tried it. I assume Mercurial doesn't know
where the repository is. I agree that it could be worked out from the path
name of the file by traversing up the path until the .hg directory is found
but maybe there are instances where that doesn't work and specifying the
repository root is safest.

On Sat, Jan 29, 2011 at 8:24 PM, Johan Holmberg <johan556 at gmail.com> wrote:

> On Thu, Jan 27, 2011 at 12:10 PM, Martin Geisler <mg at aragost.com> wrote:
> > 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
> >
>
> Doesn't the following work just as well?
>
>    hg cat -r -1 rootdir/file
>
> And the case with the "log" command could be written without the -R option
> too:
>
>    hg log rootdir
>
> I don't know if this works in all situations, but my feeling is that
> most hg commands works this way. As long as the correct file/directory
> is pointed out relative to the current working directory (or given as
> an absolute path).
>
> /Johan Holmberg
> _______________________________________________
> Mercurial mailing list
> Mercurial at selenic.com
> http://selenic.com/mailman/listinfo/mercurial
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial/attachments/20110131/d53aaac0/attachment.htm>


More information about the Mercurial mailing list