Mercurial > public > mercurial-scm > hg-stable
diff mercurial/hg.py @ 17887:0e2846b2482c stable
url: use open and not url.open for local files (issue3624)
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Wed, 17 Oct 2012 21:30:08 -0700 |
parents | 36ed69d4593d |
children | 17c030014ddf |
line wrap: on
line diff
--- a/mercurial/hg.py Tue Oct 30 18:48:44 2012 -0500 +++ b/mercurial/hg.py Wed Oct 17 21:30:08 2012 -0700 @@ -10,7 +10,7 @@ from lock import release from node import hex, nullid import localrepo, bundlerepo, httppeer, sshpeer, statichttprepo, bookmarks -import lock, util, extensions, error, node, scmutil, phases +import lock, util, extensions, error, node, scmutil, phases, url import cmdutil, discovery import merge as mergemod import verify as verifymod @@ -89,6 +89,13 @@ return False return repo.local() +def openpath(ui, path): + '''open path with open if local, url.open if remote''' + if islocal(path): + return open(util.urllocalpath(path)) + else: + return url.open(ui, path) + def _peerorrepo(ui, path, create=False): """return a repository object for the specified path""" obj = _peerlookup(path).instance(ui, path, create)