##// END OF EJS Templates
filelog: custom filelog to be used with narrow repos...
filelog: custom filelog to be used with narrow repos Narrow repos may have file revisions whose copy/rename metadata references files not in the store. This can pose problems when consumers attempt to access a missing referenced file revision. The narrow extension hacks around this problem by implementing a derived filelog type that provides custom implementations of renamed(), size(), and cmp() which handle renames against files not in the narrow spec by silently removing the rename metadata. While silently dropping metadata isn't the most robust solution, it is the easiest to implement. This commit ports the custom narrow filelog class to core. When a narrow repo is constructed, its ifilestorage creation function will automatically use the new filelog type. This means the extra logic is 0 cost for non-narrow repos and shouldn't interfere with their operation. Differential Revision: https://phab.mercurial-scm.org/D4643

File last commit:

r39581:10a8472f default
r39801:3e801ffd default
Show More
narrowwirepeer.py
41 lines | 1.3 KiB | text/x-python | PythonLexer
Augie Fackler
narrow: import experimental extension from narrowhg revision cb51d673e9c5...
r36096 # narrowwirepeer.py - passes narrow spec with unbundle command
#
# Copyright 2017 Google, Inc.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
from __future__ import absolute_import
from mercurial import (
extensions,
hg,
Pulkit Goyal
narrow: add narrow and ellipses as server capabilities...
r39559 wireprotov1server,
Augie Fackler
narrow: import experimental extension from narrowhg revision cb51d673e9c5...
r36096 )
Martin von Zweigbergk
narrow: mark wire proto capability names experimental and versioned...
r39566 NARROWCAP = 'exp-narrow-1'
ELLIPSESCAP = 'exp-ellipses-1'
Pulkit Goyal
narrow: add narrow and ellipses as server capabilities...
r39559
Augie Fackler
narrow: import experimental extension from narrowhg revision cb51d673e9c5...
r36096 def uisetup():
Pulkit Goyal
narrow: add narrow and ellipses as server capabilities...
r39559 extensions.wrapfunction(wireprotov1server, '_capabilities', addnarrowcap)
def addnarrowcap(orig, repo, proto):
"""add the narrow capability to the server"""
caps = orig(repo, proto)
Martin von Zweigbergk
narrow: move wire proto capabilities to narrowwirepeer...
r39565 caps.append(NARROWCAP)
Pulkit Goyal
narrow: add narrow and ellipses as server capabilities...
r39559 if repo.ui.configbool('experimental', 'narrowservebrokenellipses'):
Martin von Zweigbergk
narrow: move wire proto capabilities to narrowwirepeer...
r39565 caps.append(ELLIPSESCAP)
Pulkit Goyal
narrow: add narrow and ellipses as server capabilities...
r39559 return caps
Augie Fackler
narrow: import experimental extension from narrowhg revision cb51d673e9c5...
r36096 def reposetup(repo):
def wirereposetup(ui, peer):
def wrapped(orig, cmd, *args, **kwargs):
if cmd == 'unbundle':
Augie Fackler
narrowwirepeer: add TODO about how we add wireproto args to unbundle :(...
r36119 # TODO: don't blindly add include/exclude wireproto
# arguments to unbundle.
Augie Fackler
narrow: import experimental extension from narrowhg revision cb51d673e9c5...
r36096 include, exclude = repo.narrowpats
Augie Fackler
narrowwirepeer: add some strkwargs to fix a crash on py3...
r36369 kwargs[r"includepats"] = ','.join(include)
kwargs[r"excludepats"] = ','.join(exclude)
Augie Fackler
narrow: import experimental extension from narrowhg revision cb51d673e9c5...
r36096 return orig(cmd, *args, **kwargs)
extensions.wrapfunction(peer, '_calltwowaystream', wrapped)
hg.wirepeersetupfuncs.append(wirereposetup)