# HG changeset patch # User Simon Law # Date 1188235808 14400 # Node ID d575d52a113b36be80faa26cafd5ca16eff773cb # Parent d865dae2261bcd7beb4f7a694e024906f2b88068 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 @@ 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 @@ """ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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')