[PATCH 2 of 3 stable] hg.openpath: use url.islocal to tell if the path is local (issue3624)

Siddharth Agarwal sid0 at fb.com
Mon Feb 3 17:12:12 CST 2014


# HG changeset patch
# User Siddharth Agarwal <sid0 at fb.com>
# Date 1391468024 28800
#      Mon Feb 03 14:53:44 2014 -0800
# Branch stable
# Node ID a2661fa3b83547321cdd07bb7b24210b35870198
# Parent  8ab8a85a22c2f5a0e23e86f2041ef7d348fab857
hg.openpath: use url.islocal to tell if the path is local (issue3624)

Previously we used hg.islocal, which doesn't work for paths pointing to
non-repos, such as patch files.

diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -92,8 +92,9 @@
 
 def openpath(ui, path):
     '''open path with open if local, url.open if remote'''
-    if islocal(path):
-        return util.posixfile(util.urllocalpath(path), 'rb')
+    pathurl = util.url(path, parsequery=False, parsefragment=False)
+    if pathurl.islocal():
+        return util.posixfile(pathurl.localpath(), 'rb')
     else:
         return url.open(ui, path)
 


More information about the Mercurial-devel mailing list