[cig-commits] commit: Fixes to make Forest work on Windows clients.
Mercurial
hg at geodynamics.org
Mon Nov 24 11:27:08 PST 2008
changeset: 58:d575d52a113b
user: Simon Law <simon at akoha.org>
date: Mon Aug 27 13:30:08 2007 -0400
files: forest.py
description:
Fixes to make Forest work on Windows clients.
This patch was tested on a Windows client against a GNU/Linux server.
diff -r d865dae2261b -r d575d52a113b forest.py
--- a/forest.py Mon Aug 20 16:28:55 2007 -0400
+++ b/forest.py Mon Aug 27 13:30:08 2007 -0400
@@ -129,7 +129,7 @@ def _localrepo_forests(self, walkhg):
res.sort()
# Turn things into relative paths
pfx = len(self.root) + 1
- res = [r[pfx:] or "." for r in res]
+ res = [util.pconvert(os.path.normpath(r[pfx:])) for r in res]
return res
localrepo.localrepository.forests = _localrepo_forests
@@ -180,8 +180,8 @@ def _sshserver_do_forests(self):
"""
key, walkhg = self.getarg()
- f = self.repo.forests(bool(walkhg))
- self.respond("\n".join(f))
+ forests = self.repo.forests(bool(walkhg))
+ self.respond("\n".join(forests))
sshserver.sshserver.do_forests = _sshserver_do_forests
@@ -231,8 +231,8 @@ def _httpserver_do_forests(self, req):
resp = ""
if req.form.has_key('walkhg'):
- f = self.repo.forests(bool(req.form['walkhg'][0]))
- resp = "\n".join(f)
+ forests = self.repo.forests(bool(req.form['walkhg'][0]))
+ resp = "\n".join(forests)
req.httphdr("application/mercurial-0.1", length=len(resp))
req.write(resp)
@@ -314,10 +314,7 @@ def _statichttprepo_forests(self, walkhg
res.sort()
# Turn things into relative paths
- result = []
- for root in res:
- result.append(root[len(url):].rstrip('/') or ".")
- return result
+ return [root[len(url):].rstrip('/') or "." for root in res]
statichttprepo.statichttprepository.forests = _statichttprepo_forests
@@ -352,6 +349,7 @@ def mq_patches_applied(rpath):
raise util.Abort(_("'%s' starts with http:") % rpath)
elif rpath.startswith("file:"):
rpath = rpath[len("file:"):]
+ rpath = util.localpath(rpath)
rpath = os.path.join(rpath, ".hg")
entries = os.listdir(rpath)
for e in entries:
@@ -430,7 +428,7 @@ class ForestSnapshot(object):
else:
try:
rpath = os.path.join(pfx, util.localpath(root))
- repo = hg.repository(ui, rpath)
+ repo = hg.repository(ui, util.pconvert(rpath))
except RepoError:
ui.write(_("skipped, no valid repo found\n\n"))
continue
@@ -454,11 +452,8 @@ class ForestSnapshot(object):
top = repo.url()
if hasattr(repo, "root"):
top = repo.root
- for f in repo.forests(walkhg):
- relpath = util.pconvert(f)
- if f == ".":
- f = ""
- abspath = os.sep.join((top, f))
+ for relpath in repo.forests(walkhg):
+ abspath = os.path.join(top, util.localpath(relpath))
if relpath != '.':
repo = hg.repository(ui, abspath)
if mq_fatal and mq_patches_applied(abspath):
@@ -625,7 +620,7 @@ def trees(ui, repo, convert=False, walkh
l = repo.forests(walkhg)
else:
root = repo.root
- l = [(f == "." and root) or os.sep.join((root, f))
+ l = [(f == "." and root) or os.path.join(root, f)
for f in repo.forests(walkhg)]
for t in l:
ui.write(t + '\n')
More information about the CIG-COMMITS
mailing list