consistency: use util.realpath instead of os.path.realpath where useful
exceptions:
hg: os.path.realpath used before util can be imported
tests/run-tests.py: may not import mercurial modules
--- a/contrib/shrink-revlog.py Mon Oct 24 13:54:59 2011 +0200
+++ b/contrib/shrink-revlog.py Mon Oct 24 13:51:24 2011 +0200
@@ -172,7 +172,7 @@
raise util.Abort(_('--revlog option must specify the revlog index '
'file (*.i), not %s') % opts.get('revlog'))
- indexfn = os.path.realpath(fn)
+ indexfn = util.realpath(fn)
store = repo.sjoin('')
if not indexfn.startswith(store):
raise util.Abort(_('--revlog option must specify a revlog in %s, '
--- a/hgext/convert/darcs.py Mon Oct 24 13:54:59 2011 +0200
+++ b/hgext/convert/darcs.py Mon Oct 24 13:51:24 2011 +0200
@@ -45,7 +45,7 @@
if ElementTree is None:
raise util.Abort(_("Python ElementTree module is not available"))
- self.path = os.path.realpath(path)
+ self.path = util.realpath(path)
self.lastrev = None
self.changes = {}
--- a/hgext/convert/gnuarch.py Mon Oct 24 13:54:59 2011 +0200
+++ b/hgext/convert/gnuarch.py Mon Oct 24 13:51:24 2011 +0200
@@ -46,7 +46,7 @@
commandline.__init__(self, ui, self.execmd)
- self.path = os.path.realpath(path)
+ self.path = util.realpath(path)
self.tmppath = None
self.treeversion = None
--- a/hgext/convert/subversion.py Mon Oct 24 13:54:59 2011 +0200
+++ b/hgext/convert/subversion.py Mon Oct 24 13:51:24 2011 +0200
@@ -976,7 +976,7 @@
self.wc = None
self.cwd = os.getcwd()
- path = os.path.realpath(path)
+ path = util.realpath(path)
created = False
if os.path.isfile(os.path.join(path, '.svn', 'entries')):
--- a/mercurial/commands.py Mon Oct 24 13:54:59 2011 +0200
+++ b/mercurial/commands.py Mon Oct 24 13:51:24 2011 +0200
@@ -344,7 +344,7 @@
raise util.Abort(_('no working directory: please specify a revision'))
node = ctx.node()
dest = cmdutil.makefilename(repo, dest, node)
- if os.path.realpath(dest) == repo.root:
+ if util.realpath(dest) == repo.root:
raise util.Abort(_('repository root cannot be destination'))
kind = opts.get('type') or archival.guesskind(dest) or 'files'
--- a/mercurial/hg.py Mon Oct 24 13:54:59 2011 +0200
+++ b/mercurial/hg.py Mon Oct 24 13:51:24 2011 +0200
@@ -130,7 +130,7 @@
sharedpath = srcrepo.sharedpath # if our source is already sharing
- root = os.path.realpath(dest)
+ root = util.realpath(dest)
roothg = os.path.join(root, '.hg')
if os.path.exists(roothg):
@@ -301,7 +301,7 @@
if copy:
srcrepo.hook('preoutgoing', throw=True, source='clone')
- hgdir = os.path.realpath(os.path.join(dest, ".hg"))
+ hgdir = util.realpath(os.path.join(dest, ".hg"))
if not os.path.exists(dest):
os.mkdir(dest)
else:
--- a/mercurial/localrepo.py Mon Oct 24 13:54:59 2011 +0200
+++ b/mercurial/localrepo.py Mon Oct 24 13:51:24 2011 +0200
@@ -28,7 +28,7 @@
def __init__(self, baseui, path=None, create=False):
repo.repository.__init__(self)
- self.root = os.path.realpath(util.expandpath(path))
+ self.root = util.realpath(util.expandpath(path))
self.path = os.path.join(self.root, ".hg")
self.origroot = path
self.auditor = scmutil.pathauditor(self.root, self._checknested)
@@ -79,7 +79,7 @@
self.sharedpath = self.path
try:
- s = os.path.realpath(self.opener.read("sharedpath").rstrip('\n'))
+ s = util.realpath(self.opener.read("sharedpath").rstrip('\n'))
if not os.path.exists(s):
raise error.RepoError(
_('.hg/sharedpath points to nonexistent directory %s') % s)
--- a/mercurial/simplemerge.py Mon Oct 24 13:54:59 2011 +0200
+++ b/mercurial/simplemerge.py Mon Oct 24 13:51:24 2011 +0200
@@ -430,7 +430,7 @@
except util.Abort:
return 1
- local = os.path.realpath(local)
+ local = util.realpath(local)
if not opts.get('print'):
opener = scmutil.opener(os.path.dirname(local))
out = opener(os.path.basename(local), "w", atomictemp=True)
--- a/tests/test-hgwebdir-paths.py Mon Oct 24 13:54:59 2011 +0200
+++ b/tests/test-hgwebdir-paths.py Mon Oct 24 13:51:24 2011 +0200
@@ -1,11 +1,11 @@
import os
-from mercurial import hg, ui
+from mercurial import hg, ui, util
from mercurial.hgweb.hgwebdir_mod import hgwebdir
os.mkdir('webdir')
os.chdir('webdir')
-webdir = os.path.realpath('.')
+webdir = util.realpath('.')
u = ui.ui()
hg.repository(u, 'a', create=1)