##// END OF EJS Templates
peer: introduce canpush and improve error message
Sune Foldager -
r17193:1d710fe5 default
parent child Browse files
Show More
@@ -167,6 +167,10 b' class bundlefilelog(bundlerevlog, filelo'
167 def _file(self, f):
167 def _file(self, f):
168 self._repo.file(f)
168 self._repo.file(f)
169
169
170 class bundlepeer(localrepo.localpeer):
171 def canpush(self):
172 return False
173
170 class bundlerepository(localrepo.localrepository):
174 class bundlerepository(localrepo.localrepository):
171 def __init__(self, ui, path, bundlename):
175 def __init__(self, ui, path, bundlename):
172 self._tempparent = None
176 self._tempparent = None
@@ -272,6 +276,9 b' class bundlerepository(localrepo.localre'
272 def cancopy(self):
276 def cancopy(self):
273 return False
277 return False
274
278
279 def peer(self):
280 return bundlepeer(self)
281
275 def getcwd(self):
282 def getcwd(self):
276 return os.getcwd() # always outside the repo
283 return os.getcwd() # always outside the repo
277
284
@@ -49,6 +49,9 b' class localpeer(peer.peerrepository):'
49 def cancopy(self):
49 def cancopy(self):
50 return self._repo.cancopy() # so bundlerepo can override
50 return self._repo.cancopy() # so bundlerepo can override
51
51
52 def canpush(self):
53 return True
54
52 def url(self):
55 def url(self):
53 return self._repo.url()
56 return self._repo.url()
54
57
@@ -1804,6 +1807,8 b' class localrepository(object):'
1804 # unbundle assumes local user cannot lock remote repo (new ssh
1807 # unbundle assumes local user cannot lock remote repo (new ssh
1805 # servers, http servers).
1808 # servers, http servers).
1806
1809
1810 if not remote.canpush():
1811 raise util.Abort(_("destination does not support push"))
1807 # get local lock as we might write phase data
1812 # get local lock as we might write phase data
1808 locallock = self.lock()
1813 locallock = self.lock()
1809 try:
1814 try:
@@ -45,5 +45,8 b' class peerrepository(object):'
45 def cancopy(self):
45 def cancopy(self):
46 return False
46 return False
47
47
48 def canpush(self):
49 return True
50
48 def close(self):
51 def close(self):
49 pass
52 pass
@@ -79,6 +79,8 b' def build_opener(ui, authinfo):'
79 class statichttppeer(localrepo.localpeer):
79 class statichttppeer(localrepo.localpeer):
80 def local(self):
80 def local(self):
81 return None
81 return None
82 def canpush(self):
83 return False
82
84
83 class statichttprepository(localrepo.localrepository):
85 class statichttprepository(localrepo.localrepository):
84 def __init__(self, ui, path):
86 def __init__(self, ui, path):
@@ -91,7 +91,7 b' trying to push'
91 $ hg commit -m"test"
91 $ hg commit -m"test"
92 $ hg push
92 $ hg push
93 pushing to static-http://localhost:$HGPORT/remote
93 pushing to static-http://localhost:$HGPORT/remote
94 abort: cannot lock static-http repository
94 abort: destination does not support push
95 [255]
95 [255]
96
96
97 trying clone -r
97 trying clone -r
General Comments 0
You need to be logged in to leave comments. Login now