[PATCH 2 of 6] subrepo: use repo.pathto instead of util.pathto to simplify invocation
FUJIWARA Katsunori
foozy at lares.dti.ne.jp
Thu Jul 9 11:02:59 CDT 2015
# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1436457591 -32400
# Fri Jul 10 00:59:51 2015 +0900
# Node ID 02bc9a7f0e164d5ee898a35457861269e4a0d7fa
# Parent 86048cf48d5c86497dfde9a2ccce9dfb0794d920
subrepo: use repo.pathto instead of util.pathto to simplify invocation
This centralization into 'repo.pathto()' should reduce the cost of vfs
migration around 'getcwd()' and so on in the future.
diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
--- a/mercurial/subrepo.py
+++ b/mercurial/subrepo.py
@@ -72,13 +72,12 @@ def state(ctx, ui):
raise
# handle missing subrepo spec files as removed
ui.warn(_("warning: subrepo spec file \'%s\' not found\n") %
- util.pathto(repo.root, repo.getcwd(), f))
+ repo.pathto(f))
return
p.parse(f, data, sections, remap, read)
else:
raise util.Abort(_("subrepo spec file \'%s\' not found") %
- util.pathto(repo.root, repo.getcwd(), f))
-
+ repo.pathto(f))
if '.hgsub' in ctx:
read('.hgsub')
@@ -97,8 +96,7 @@ def state(ctx, ui):
except ValueError:
raise util.Abort(_("invalid subrepository revision "
"specifier in \'%s\' line %d")
- % (util.pathto(repo.root, repo.getcwd(),
- '.hgsubstate'), (i + 1)))
+ % (repo.pathto('.hgsubstate'), (i + 1)))
rev[path] = revision
except IOError as err:
if err.errno != errno.ENOENT:
diff --git a/tests/test-subrepo-missing.t b/tests/test-subrepo-missing.t
--- a/tests/test-subrepo-missing.t
+++ b/tests/test-subrepo-missing.t
@@ -23,8 +23,8 @@ abort more gracefully on .hgsubstate par
$ cp .hgsubstate .hgsubstate.old
>>> file('.hgsubstate', 'wb').write('\ninvalid')
- $ hg st --subrepos
- abort: invalid subrepository revision specifier in '.hgsubstate' line 2
+ $ hg st --subrepos --cwd $TESTTMP -R $TESTTMP/repo
+ abort: invalid subrepository revision specifier in 'repo/.hgsubstate' line 2 (glob)
[255]
$ mv .hgsubstate.old .hgsubstate
@@ -44,9 +44,9 @@ delete .hgsubstate and revert it
delete .hgsub and update
$ rm .hgsub
- $ hg up 0
- warning: subrepo spec file '.hgsub' not found
- warning: subrepo spec file '.hgsub' not found
+ $ hg up 0 --cwd $TESTTMP -R $TESTTMP/repo
+ warning: subrepo spec file 'repo/.hgsub' not found (glob)
+ warning: subrepo spec file 'repo/.hgsub' not found (glob)
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg st
warning: subrepo spec file '.hgsub' not found
More information about the Mercurial-devel
mailing list