equal
deleted
inserted
replaced
133 # This little dance should be dropped eventually when the |
133 # This little dance should be dropped eventually when the |
134 # API is finally improved. |
134 # API is finally improved. |
135 stream = util.chunkbuffer(ret.getchunks()) |
135 stream = util.chunkbuffer(ret.getchunks()) |
136 ret = bundle2.getunbundler(self.ui, stream) |
136 ret = bundle2.getunbundler(self.ui, stream) |
137 return ret |
137 return ret |
138 except Exception, exc: |
138 except Exception as exc: |
139 # If the exception contains output salvaged from a bundle2 |
139 # If the exception contains output salvaged from a bundle2 |
140 # reply, we need to make sure it is printed before continuing |
140 # reply, we need to make sure it is printed before continuing |
141 # to fail. So we build a bundle2 with such output and consume |
141 # to fail. So we build a bundle2 with such output and consume |
142 # it directly. |
142 # it directly. |
143 # |
143 # |
150 bundler.addpart(out) |
150 bundler.addpart(out) |
151 stream = util.chunkbuffer(bundler.getchunks()) |
151 stream = util.chunkbuffer(bundler.getchunks()) |
152 b = bundle2.getunbundler(self.ui, stream) |
152 b = bundle2.getunbundler(self.ui, stream) |
153 bundle2.processbundle(self._repo, b) |
153 bundle2.processbundle(self._repo, b) |
154 raise |
154 raise |
155 except error.PushRaced, exc: |
155 except error.PushRaced as exc: |
156 raise error.ResponseError(_('push failed:'), str(exc)) |
156 raise error.ResponseError(_('push failed:'), str(exc)) |
157 |
157 |
158 def lock(self): |
158 def lock(self): |
159 return self._repo.lock() |
159 return self._repo.lock() |
160 |
160 |
270 raise error.RepoError(_("repository %s already exists") % path) |
270 raise error.RepoError(_("repository %s already exists") % path) |
271 else: |
271 else: |
272 try: |
272 try: |
273 self.requirements = scmutil.readrequires( |
273 self.requirements = scmutil.readrequires( |
274 self.vfs, self.supported) |
274 self.vfs, self.supported) |
275 except IOError, inst: |
275 except IOError as inst: |
276 if inst.errno != errno.ENOENT: |
276 if inst.errno != errno.ENOENT: |
277 raise |
277 raise |
278 |
278 |
279 self.sharedpath = self.path |
279 self.sharedpath = self.path |
280 try: |
280 try: |
283 s = vfs.base |
283 s = vfs.base |
284 if not vfs.exists(): |
284 if not vfs.exists(): |
285 raise error.RepoError( |
285 raise error.RepoError( |
286 _('.hg/sharedpath points to nonexistent directory %s') % s) |
286 _('.hg/sharedpath points to nonexistent directory %s') % s) |
287 self.sharedpath = s |
287 self.sharedpath = s |
288 except IOError, inst: |
288 except IOError as inst: |
289 if inst.errno != errno.ENOENT: |
289 if inst.errno != errno.ENOENT: |
290 raise |
290 raise |
291 |
291 |
292 self.store = store.store( |
292 self.store = store.store( |
293 self.requirements, self.sharedpath, scmutil.vfs) |
293 self.requirements, self.sharedpath, scmutil.vfs) |
576 self.hook('tag', node=hex(node), tag=name, local=local) |
576 self.hook('tag', node=hex(node), tag=name, local=local) |
577 return |
577 return |
578 |
578 |
579 try: |
579 try: |
580 fp = self.wfile('.hgtags', 'rb+') |
580 fp = self.wfile('.hgtags', 'rb+') |
581 except IOError, e: |
581 except IOError as e: |
582 if e.errno != errno.ENOENT: |
582 if e.errno != errno.ENOENT: |
583 raise |
583 raise |
584 fp = self.wfile('.hgtags', 'ab') |
584 fp = self.wfile('.hgtags', 'ab') |
585 else: |
585 else: |
586 prevtags = fp.read() |
586 prevtags = fp.read() |
1187 self.invalidatedirstate() |
1187 self.invalidatedirstate() |
1188 |
1188 |
1189 def _lock(self, vfs, lockname, wait, releasefn, acquirefn, desc): |
1189 def _lock(self, vfs, lockname, wait, releasefn, acquirefn, desc): |
1190 try: |
1190 try: |
1191 l = lockmod.lock(vfs, lockname, 0, releasefn, desc=desc) |
1191 l = lockmod.lock(vfs, lockname, 0, releasefn, desc=desc) |
1192 except error.LockHeld, inst: |
1192 except error.LockHeld as inst: |
1193 if not wait: |
1193 if not wait: |
1194 raise |
1194 raise |
1195 self.ui.warn(_("waiting for lock on %s held by %r\n") % |
1195 self.ui.warn(_("waiting for lock on %s held by %r\n") % |
1196 (desc, inst.locker)) |
1196 (desc, inst.locker)) |
1197 # default to 600 seconds timeout |
1197 # default to 600 seconds timeout |
1568 else: |
1568 else: |
1569 added.append(f) |
1569 added.append(f) |
1570 m[f] = self._filecommit(fctx, m1, m2, linkrev, |
1570 m[f] = self._filecommit(fctx, m1, m2, linkrev, |
1571 trp, changed) |
1571 trp, changed) |
1572 m.setflag(f, fctx.flags()) |
1572 m.setflag(f, fctx.flags()) |
1573 except OSError, inst: |
1573 except OSError as inst: |
1574 self.ui.warn(_("trouble committing %s!\n") % f) |
1574 self.ui.warn(_("trouble committing %s!\n") % f) |
1575 raise |
1575 raise |
1576 except IOError, inst: |
1576 except IOError as inst: |
1577 errcode = getattr(inst, 'errno', errno.ENOENT) |
1577 errcode = getattr(inst, 'errno', errno.ENOENT) |
1578 if error or errcode and errcode != errno.ENOENT: |
1578 if error or errcode and errcode != errno.ENOENT: |
1579 self.ui.warn(_("trouble committing %s!\n") % f) |
1579 self.ui.warn(_("trouble committing %s!\n") % f) |
1580 raise |
1580 raise |
1581 |
1581 |
1886 hookargs['namespace'] = namespace |
1886 hookargs['namespace'] = namespace |
1887 hookargs['key'] = key |
1887 hookargs['key'] = key |
1888 hookargs['old'] = old |
1888 hookargs['old'] = old |
1889 hookargs['new'] = new |
1889 hookargs['new'] = new |
1890 self.hook('prepushkey', throw=True, **hookargs) |
1890 self.hook('prepushkey', throw=True, **hookargs) |
1891 except error.HookAbort, exc: |
1891 except error.HookAbort as exc: |
1892 self.ui.write_err(_("pushkey-abort: %s\n") % exc) |
1892 self.ui.write_err(_("pushkey-abort: %s\n") % exc) |
1893 if exc.hint: |
1893 if exc.hint: |
1894 self.ui.write_err(_("(%s)\n") % exc.hint) |
1894 self.ui.write_err(_("(%s)\n") % exc.hint) |
1895 return False |
1895 return False |
1896 self.ui.debug('pushing key for "%s:%s"\n' % (namespace, key)) |
1896 self.ui.debug('pushing key for "%s:%s"\n' % (namespace, key)) |