##// END OF EJS Templates
exchange: support defining narrow file patterns for pull...
Gregory Szorc -
r39589:130e5df3 default
parent child Browse files
Show More
@@ -1313,7 +1313,8 b' class pulloperation(object):'
1313 """
1313 """
1314
1314
1315 def __init__(self, repo, remote, heads=None, force=False, bookmarks=(),
1315 def __init__(self, repo, remote, heads=None, force=False, bookmarks=(),
1316 remotebookmarks=None, streamclonerequested=None):
1316 remotebookmarks=None, streamclonerequested=None,
1317 includepats=None, excludepats=None):
1317 # repo we pull into
1318 # repo we pull into
1318 self.repo = repo
1319 self.repo = repo
1319 # repo we pull from
1320 # repo we pull from
@@ -1343,6 +1344,10 b' class pulloperation(object):'
1343 self.stepsdone = set()
1344 self.stepsdone = set()
1344 # Whether we attempted a clone from pre-generated bundles.
1345 # Whether we attempted a clone from pre-generated bundles.
1345 self.clonebundleattempted = False
1346 self.clonebundleattempted = False
1347 # Set of file patterns to include.
1348 self.includepats = includepats
1349 # Set of file patterns to exclude.
1350 self.excludepats = excludepats
1346
1351
1347 @util.propertycache
1352 @util.propertycache
1348 def pulledsubset(self):
1353 def pulledsubset(self):
@@ -1447,7 +1452,7 b' def _fullpullbundle2(repo, pullop):'
1447 pullop.rheads = set(pullop.rheads) - pullop.common
1452 pullop.rheads = set(pullop.rheads) - pullop.common
1448
1453
1449 def pull(repo, remote, heads=None, force=False, bookmarks=(), opargs=None,
1454 def pull(repo, remote, heads=None, force=False, bookmarks=(), opargs=None,
1450 streamclonerequested=None):
1455 streamclonerequested=None, includepats=None, excludepats=None):
1451 """Fetch repository data from a remote.
1456 """Fetch repository data from a remote.
1452
1457
1453 This is the main function used to retrieve data from a remote repository.
1458 This is the main function used to retrieve data from a remote repository.
@@ -1465,13 +1470,29 b' def pull(repo, remote, heads=None, force'
1465 of revlogs from the server. This only works when the local repository is
1470 of revlogs from the server. This only works when the local repository is
1466 empty. The default value of ``None`` means to respect the server
1471 empty. The default value of ``None`` means to respect the server
1467 configuration for preferring stream clones.
1472 configuration for preferring stream clones.
1473 ``includepats`` and ``excludepats`` define explicit file patterns to
1474 include and exclude in storage, respectively. If not defined, narrow
1475 patterns from the repo instance are used, if available.
1468
1476
1469 Returns the ``pulloperation`` created for this pull.
1477 Returns the ``pulloperation`` created for this pull.
1470 """
1478 """
1471 if opargs is None:
1479 if opargs is None:
1472 opargs = {}
1480 opargs = {}
1481
1482 # We allow the narrow patterns to be passed in explicitly to provide more
1483 # flexibility for API consumers.
1484 if includepats or excludepats:
1485 includepats = includepats or set()
1486 excludepats = excludepats or set()
1487 else:
1488 includepats, excludepats = repo.narrowpats
1489
1490 narrowspec.validatepatterns(includepats)
1491 narrowspec.validatepatterns(excludepats)
1492
1473 pullop = pulloperation(repo, remote, heads, force, bookmarks=bookmarks,
1493 pullop = pulloperation(repo, remote, heads, force, bookmarks=bookmarks,
1474 streamclonerequested=streamclonerequested,
1494 streamclonerequested=streamclonerequested,
1495 includepats=includepats, excludepats=excludepats,
1475 **pycompat.strkwargs(opargs))
1496 **pycompat.strkwargs(opargs))
1476
1497
1477 peerlocal = pullop.remote.local()
1498 peerlocal = pullop.remote.local()
@@ -749,7 +749,9 b' def clone(ui, peeropts, source, dest=Non'
749 overrides = {('ui', 'quietbookmarkmove'): True}
749 overrides = {('ui', 'quietbookmarkmove'): True}
750 with local.ui.configoverride(overrides, 'clone'):
750 with local.ui.configoverride(overrides, 'clone'):
751 exchange.pull(local, srcpeer, revs,
751 exchange.pull(local, srcpeer, revs,
752 streamclonerequested=stream)
752 streamclonerequested=stream,
753 includepats=storeincludepats,
754 excludepats=storeexcludepats)
753 elif srcrepo:
755 elif srcrepo:
754 # TODO lift restriction once exchange.push() accepts narrow
756 # TODO lift restriction once exchange.push() accepts narrow
755 # push.
757 # push.
General Comments 0
You need to be logged in to leave comments. Login now