comparison mercurial/hg.py @ 926:b765e970c9ff

Add a local() method to repository classes
author mpm@selenic.com
date Tue, 16 Aug 2005 19:17:01 -0800
parents c7a3b88505cd
children 9c43d68ad59f
comparison
equal deleted inserted replaced
925:5a034646e472 926:b765e970c9ff
746 raise RepoError("unknown revision '%s'" % key) 746 raise RepoError("unknown revision '%s'" % key)
747 747
748 def dev(self): 748 def dev(self):
749 if self.remote: return -1 749 if self.remote: return -1
750 return os.stat(self.path).st_dev 750 return os.stat(self.path).st_dev
751
752 def local(self):
753 return not self.remote
751 754
752 def join(self, f): 755 def join(self, f):
753 return os.path.join(self.path, f) 756 return os.path.join(self.path, f)
754 757
755 def wjoin(self, f): 758 def wjoin(self, f):
1937 1940
1938 if errors: 1941 if errors:
1939 self.ui.warn("%d integrity errors encountered!\n" % errors) 1942 self.ui.warn("%d integrity errors encountered!\n" % errors)
1940 return 1 1943 return 1
1941 1944
1942 class httprepository: 1945 class remoterepository:
1946 def local(self):
1947 return False
1948
1949 class httprepository(remoterepository):
1943 def __init__(self, ui, path): 1950 def __init__(self, ui, path):
1944 # fix missing / after hostname 1951 # fix missing / after hostname
1945 s = urlparse.urlsplit(path) 1952 s = urlparse.urlsplit(path)
1946 partial = s[2] 1953 partial = s[2]
1947 if not partial: partial = "/" 1954 if not partial: partial = "/"
2076 self.repo = None 2083 self.repo = None
2077 def __del__(self): 2084 def __del__(self):
2078 if self.repo: 2085 if self.repo:
2079 self.release() 2086 self.release()
2080 2087
2081 class sshrepository: 2088 class sshrepository(remoterepository):
2082 def __init__(self, ui, path): 2089 def __init__(self, ui, path):
2083 self.url = path 2090 self.url = path
2084 self.ui = ui 2091 self.ui = ui
2085 2092
2086 m = re.match(r'ssh://(([^@]+)@)?([^:/]+)(:(\d+))?(/(.*))', path) 2093 m = re.match(r'ssh://(([^@]+)@)?([^:/]+)(:(\d+))?(/(.*))', path)