Details
Details
- Reviewers
durin42 pulkit - Group Reviewers
hg-reviewers - Commits
- rHGee7b6fa52d9d: narrow: filter copies in core
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
durin42 | |
pulkit |
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | hgext/narrow/__init__.py (2 lines) | |||
D | M | hgext/narrow/narrowmerge.py (25 lines) | ||
M | mercurial/copies.py (5 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
Martin von Zweigbergk | May 17 2018, 6:33 PM |
Status | Author | Revision | |
---|---|---|---|
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz |
) | ) | ||||
from . import ( | from . import ( | ||||
narrowbundle2, | narrowbundle2, | ||||
narrowchangegroup, | narrowchangegroup, | ||||
narrowcommands, | narrowcommands, | ||||
narrowcopies, | narrowcopies, | ||||
narrowdirstate, | narrowdirstate, | ||||
narrowmerge, | |||||
narrowpatch, | narrowpatch, | ||||
narrowrepo, | narrowrepo, | ||||
narrowrevlog, | narrowrevlog, | ||||
narrowtemplates, | narrowtemplates, | ||||
narrowwirepeer, | narrowwirepeer, | ||||
) | ) | ||||
configtable = {} | configtable = {} | ||||
def featuresetup(ui, features): | def featuresetup(ui, features): | ||||
features.add(changegroup.NARROW_REQUIREMENT) | features.add(changegroup.NARROW_REQUIREMENT) | ||||
def uisetup(ui): | def uisetup(ui): | ||||
"""Wraps user-facing mercurial commands with narrow-aware versions.""" | """Wraps user-facing mercurial commands with narrow-aware versions.""" | ||||
localrepo.featuresetupfuncs.add(featuresetup) | localrepo.featuresetupfuncs.add(featuresetup) | ||||
narrowrevlog.setup() | narrowrevlog.setup() | ||||
narrowbundle2.setup() | narrowbundle2.setup() | ||||
narrowmerge.setup() | |||||
narrowcommands.setup() | narrowcommands.setup() | ||||
narrowchangegroup.setup() | narrowchangegroup.setup() | ||||
narrowwirepeer.uisetup() | narrowwirepeer.uisetup() | ||||
def reposetup(ui, repo): | def reposetup(ui, repo): | ||||
"""Wraps local repositories with narrow repo support.""" | """Wraps local repositories with narrow repo support.""" | ||||
if not repo.local(): | if not repo.local(): | ||||
return | return |
# narrowmerge.py - extensions to mercurial merge module to support narrow clones | |||||
# | |||||
# 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 ( | |||||
copies, | |||||
extensions, | |||||
) | |||||
def setup(): | |||||
def _computenonoverlap(orig, repo, *args, **kwargs): | |||||
u1, u2 = orig(repo, *args, **kwargs) | |||||
narrowmatch = repo.narrowmatch() | |||||
if narrowmatch.always(): | |||||
return u1, u2 | |||||
u1 = [f for f in u1 if narrowmatch(f)] | |||||
u2 = [f for f in u2 if narrowmatch(f)] | |||||
return u1, u2 | |||||
extensions.wrapfunction(copies, '_computenonoverlap', _computenonoverlap) |
header = " unmatched files in %s" | header = " unmatched files in %s" | ||||
if baselabel: | if baselabel: | ||||
header += ' (from %s)' % baselabel | header += ' (from %s)' % baselabel | ||||
if u1: | if u1: | ||||
repo.ui.debug("%s:\n %s\n" % (header % 'local', "\n ".join(u1))) | repo.ui.debug("%s:\n %s\n" % (header % 'local', "\n ".join(u1))) | ||||
if u2: | if u2: | ||||
repo.ui.debug("%s:\n %s\n" % (header % 'other', "\n ".join(u2))) | repo.ui.debug("%s:\n %s\n" % (header % 'other', "\n ".join(u2))) | ||||
narrowmatch = repo.narrowmatch() | |||||
if not narrowmatch.always(): | |||||
u1 = [f for f in u1 if narrowmatch(f)] | |||||
u2 = [f for f in u2 if narrowmatch(f)] | |||||
return u1, u2 | return u1, u2 | ||||
def _makegetfctx(ctx): | def _makegetfctx(ctx): | ||||
"""return a 'getfctx' function suitable for _checkcopies usage | """return a 'getfctx' function suitable for _checkcopies usage | ||||
We have to re-setup the function building 'filectx' for each | We have to re-setup the function building 'filectx' for each | ||||
'_checkcopies' to ensure the linkrev adjustment is properly setup for | '_checkcopies' to ensure the linkrev adjustment is properly setup for | ||||
each. Linkrev adjustment is important to avoid bug in rename | each. Linkrev adjustment is important to avoid bug in rename |