changeset 20353:0889585b44f1 stable

util.url: add an 'islocal' method This returns True if the URL represents a path that can be opened locally, without needing to go through the entire URL open mechanism.
author Siddharth Agarwal <sid0@fb.com>
date Mon, 03 Feb 2014 14:47:41 -0800
parents 9139dedeffa6
children b433b43364e4
files mercurial/util.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/util.py	Sat Feb 01 15:20:49 2014 -0600
+++ b/mercurial/util.py	Mon Feb 03 14:47:41 2014 -0800
@@ -1875,6 +1875,11 @@
             return path
         return self._origpath
 
+    def islocal(self):
+        '''whether localpath will return something that posixfile can open'''
+        return (not self.scheme or self.scheme == 'file'
+                or self.scheme == 'bundle')
+
 def hasscheme(path):
     return bool(url(path).scheme)