hgext/sparse.py
changeset 45580 5c8230ca37f2
parent 45568 c1d0f83d62c4
child 47593 f927ad5a4e2c
equal deleted inserted replaced
45579:c1b603cdc95a 45580:5c8230ca37f2
    78 from mercurial import (
    78 from mercurial import (
    79     commands,
    79     commands,
    80     dirstate,
    80     dirstate,
    81     error,
    81     error,
    82     extensions,
    82     extensions,
    83     hg,
       
    84     logcmdutil,
    83     logcmdutil,
    85     match as matchmod,
    84     match as matchmod,
       
    85     merge as mergemod,
    86     pycompat,
    86     pycompat,
    87     registrar,
    87     registrar,
    88     sparse,
    88     sparse,
    89     util,
    89     util,
    90 )
    90 )
   171         raise error.Abort(_(b"too many flags specified."))
   171         raise error.Abort(_(b"too many flags specified."))
   172     # if --narrow is passed, it means they are includes and excludes for narrow
   172     # if --narrow is passed, it means they are includes and excludes for narrow
   173     # clone
   173     # clone
   174     if not narrow_pat and (include or exclude or enableprofile):
   174     if not narrow_pat and (include or exclude or enableprofile):
   175 
   175 
   176         def clonesparse(orig, self, node, overwrite, *args, **kwargs):
   176         def clonesparse(orig, ctx, *args, **kwargs):
   177             sparse.updateconfig(
   177             sparse.updateconfig(
   178                 self.unfiltered(),
   178                 ctx.repo().unfiltered(),
   179                 pat,
   179                 pat,
   180                 {},
   180                 {},
   181                 include=include,
   181                 include=include,
   182                 exclude=exclude,
   182                 exclude=exclude,
   183                 enableprofile=enableprofile,
   183                 enableprofile=enableprofile,
   184                 usereporootpaths=True,
   184                 usereporootpaths=True,
   185             )
   185             )
   186             return orig(self, node, overwrite, *args, **kwargs)
   186             return orig(ctx, *args, **kwargs)
   187 
   187 
   188         extensions.wrapfunction(hg, b'updaterepo', clonesparse)
   188         extensions.wrapfunction(mergemod, b'update', clonesparse)
   189     return orig(ui, repo, *args, **opts)
   189     return orig(ui, repo, *args, **opts)
   190 
   190 
   191 
   191 
   192 def _setupclone(ui):
   192 def _setupclone(ui):
   193     entry = commands.table[b'clone']
   193     entry = commands.table[b'clone']