Bug 2376 - Using a relative path in .hg/hgrc makes hg -R path command fail
Summary: Using a relative path in .hg/hgrc makes hg -R path command fail
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: unspecified
Hardware: All All
: normal bug
Assignee: Bugzilla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-14 06:52 UTC by Dale
Modified: 2012-05-13 04:49 UTC (History)
5 users (show)

See Also:
Python Version: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dale 2010-09-14 06:52 UTC
I have the following setup:
~/project (clone of upstream)
~/project-dev (clone of project, with default path set to ../project)

When I do "hg -R default id" from project-dev it outputs:
abort: There is no Mercurial repository here (.hg not found)

When I do "hg -R default out" from project-dev it outputs:
abort: repository /home/project not found!
Comment 1 kiilerix 2010-09-14 07:19 UTC
"hg help -v" says
-R --repository REPO  repository root directory or name of overlay bundle file

There is no indication that it should be possible to specify an "url" (which
can have aliases as described in "hg help urls") as -R option. The whole
purpose of -R is to use another .hg than the local one, so I wouldn't expect
the local .hg (or its paths definitions) to be used at all.

The error messages do however seem confusing.
Comment 2 Sune Foldager 2010-09-14 15:51 UTC
It definitely accepts and expands the url/alias, though, but seems to assume a 
'..' too many. I.e. I have a repo in c:\src\lala\crew with default = ..\crew, 
but hg -R default log complains there is no c:\crew, instead of c:\src\crew, 
where the repo is located.

Either it shouldn't work at all, or it should work correctly :).
Comment 3 brodie 2010-10-04 12:42 UTC
A couple of notes:

1. hg help -R most definitely accepts URLs and aliases. You can use file://... 
or a path alias from .hg/hgrc (as long as it's absolute).

2. This seems to be related to ui.fixconfig(). It converts hg -R ../foo into 
hg -R /home/foo for whatever reason. I'm not sure why it only does it for -R 
and not for anything else.

Since we already support "hg in foo" where foo = ../relative/path, we 
definitely should support relative path aliases for -R.
Comment 4 HG Bot 2010-10-08 22:00 UTC
Fixed by http://hg.intevation.org/mercurial/crew/rev/42ca7aef28d3
Brodie Rao <brodie@bitheap.org>
dispatch: properly handle relative path aliases used with -R (issue2376)
Comment 5 Bugzilla 2012-05-12 09:12 UTC

--- Bug imported by bugzilla@serpentine.com 2012-05-12 09:12 EDT  ---

This bug was previously known as _bug_ 2376 at http://mercurial.selenic.com/bts/issue2376