comparison mercurial/wireproto.py @ 15217:42d0d4f63bf0

wireproto: do not call pushkey module directly (issue3041) Call the repos pushkey/listkeys member function instead. So the pushkey-hooks are triggered.
author Andreas Freimuth <andreas.freimuth@united-bits.de>
date Mon, 10 Oct 2011 13:52:54 +0200
parents f4522df38c65
children a348739da8f0
comparison
equal deleted inserted replaced
15216:7678790279da 15217:42d0d4f63bf0
8 import urllib, tempfile, os, sys 8 import urllib, tempfile, os, sys
9 from i18n import _ 9 from i18n import _
10 from node import bin, hex 10 from node import bin, hex
11 import changegroup as changegroupmod 11 import changegroup as changegroupmod
12 import repo, error, encoding, util, store 12 import repo, error, encoding, util, store
13 import pushkey as pushkeymod
14 13
15 # abstract batching support 14 # abstract batching support
16 15
17 class future(object): 16 class future(object):
18 '''placeholder for a value to be set later''' 17 '''placeholder for a value to be set later'''
459 capabilities: space separated list of tokens 458 capabilities: space separated list of tokens
460 ''' 459 '''
461 return "capabilities: %s\n" % (capabilities(repo, proto)) 460 return "capabilities: %s\n" % (capabilities(repo, proto))
462 461
463 def listkeys(repo, proto, namespace): 462 def listkeys(repo, proto, namespace):
464 d = pushkeymod.list(repo, encoding.tolocal(namespace)).items() 463 d = repo.listkeys(encoding.tolocal(namespace)).items()
465 t = '\n'.join(['%s\t%s' % (encoding.fromlocal(k), encoding.fromlocal(v)) 464 t = '\n'.join(['%s\t%s' % (encoding.fromlocal(k), encoding.fromlocal(v))
466 for k, v in d]) 465 for k, v in d])
467 return t 466 return t
468 467
469 def lookup(repo, proto, key): 468 def lookup(repo, proto, key):
489 except UnicodeDecodeError: 488 except UnicodeDecodeError:
490 pass # binary, leave unmodified 489 pass # binary, leave unmodified
491 else: 490 else:
492 new = encoding.tolocal(new) # normal path 491 new = encoding.tolocal(new) # normal path
493 492
494 r = pushkeymod.push(repo, 493 r = repo.pushkey(encoding.tolocal(namespace), encoding.tolocal(key),
495 encoding.tolocal(namespace), encoding.tolocal(key), 494 encoding.tolocal(old), new)
496 encoding.tolocal(old), new)
497 return '%s\n' % int(r) 495 return '%s\n' % int(r)
498 496
499 def _allowstream(ui): 497 def _allowstream(ui):
500 return ui.configbool('server', 'uncompressed', True, untrusted=True) 498 return ui.configbool('server', 'uncompressed', True, untrusted=True)
501 499