Skip to content
Snippets Groups Projects
Commit f715cc0b authored by Pierre-Yves David's avatar Pierre-Yves David
Browse files

pull: make pulled subset a propertycache of the pull object

The computation of the subset is simple operation using two useful pull
information (1) the set of common changeset before the pull (2) the set of
pulled changeset. We move this data into the `pulloperation` object since some
phase will need them. And we turn the pulled subset computation behind a
property case as multiple pull phase will need it.
parent 0c469df6
No related branches found
No related tags found
No related merge requests found
......@@ -395,8 +395,23 @@
self._trname = 'pull\n' + util.hidepassword(remote.url())
# hold the transaction once created
self._tr = None
# heads of the set of changeset target by the pull
self.pulledsubset = None
# set of common changeset between local and remote before pull
self.common = None
# set of pulled head
self.rheads = None
@util.propertycache
def pulledsubset(self):
"""heads of the set of changeset target by the pull"""
# compute target subset
if self.heads is None:
# We pulled every thing possible
# sync on everything common
return self.common + self.rheads
else:
# We pulled a specific subset
# sync on this subset
return self.heads
def gettransaction(self):
"""get appropriate pull transaction, creating it if needed"""
......@@ -430,7 +445,7 @@
pullop.remote,
heads=pullop.heads,
force=force)
common, fetch, rheads = tmp
pullop.common, fetch, pullop.rheads = tmp
if not fetch:
pullop.repo.ui.status(_("no changes found\n"))
result = 0
......@@ -439,8 +454,8 @@
# don't open transaction for nothing or you break future useful
# rollback call
pullop.gettransaction()
if pullop.heads is None and list(common) == [nullid]:
if pullop.heads is None and list(pullop.common) == [nullid]:
pullop.repo.ui.status(_("requesting all changes\n"))
elif (pullop.heads is None
and pullop.remote.capable('changegroupsubset')):
# issue1320, avoid a race if remote changed after discovery
......@@ -443,8 +458,8 @@
pullop.repo.ui.status(_("requesting all changes\n"))
elif (pullop.heads is None
and pullop.remote.capable('changegroupsubset')):
# issue1320, avoid a race if remote changed after discovery
pullop.heads = rheads
pullop.heads = pullop.rheads
if pullop.remote.capable('getbundle'):
# TODO: get bundlecaps from remote
......@@ -448,8 +463,10 @@
if pullop.remote.capable('getbundle'):
# TODO: get bundlecaps from remote
cg = pullop.remote.getbundle('pull', common=common,
heads=pullop.heads or rheads)
cg = pullop.remote.getbundle('pull',
common=pullop.common,
heads=(pullop.heads
or pullop.rheads))
elif pullop.heads is None:
cg = pullop.remote.changegroup(fetch, 'pull')
elif not pullop.remote.capable('changegroupsubset'):
......@@ -462,17 +479,6 @@
result = pullop.repo.addchangegroup(cg, 'pull',
pullop.remote.url())
# compute target subset
if pullop.heads is None:
# We pulled every thing possible
# sync on everything common
subset = common + rheads
else:
# We pulled a specific subset
# sync on this subset
subset = pullop.heads
pullop.pulledsubset = subset
_pullphase(pullop)
_pullobsolete(pullop)
pullop.closetransaction()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment