[PATCH 1 of 5] outgoing: pass a repo object to the constructor
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Thu Aug 11 20:06:51 UTC 2016
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1470749213 -7200
# Tue Aug 09 15:26:53 2016 +0200
# Node ID 69c5716ec081416cfdde62aac72661e9151e0abc
# Parent 1a29db79a98d112f2b24876db0ac81bdb40b6b99
# EXP-Topic outgoing
outgoing: pass a repo object to the constructor
We are to introduce more code constructing such object in the code base. It will
be more convenient to pass a repository object, all current users already
operate at the repository level anyway. More changes to the contructor argument
are coming in later changeset.
diff -r 1a29db79a98d -r 69c5716ec081 mercurial/changegroup.py
--- a/mercurial/changegroup.py Fri Aug 05 14:00:30 2016 -0400
+++ b/mercurial/changegroup.py Tue Aug 09 15:26:53 2016 +0200
@@ -986,7 +986,7 @@ def computeoutgoing(repo, heads, common)
common = [nullid]
if not heads:
heads = cl.heads()
- return discovery.outgoing(cl, common, heads)
+ return discovery.outgoing(repo, common, heads)
def getchangegroup(repo, source, heads=None, common=None, bundlecaps=None,
version='01'):
diff -r 1a29db79a98d -r 69c5716ec081 mercurial/discovery.py
--- a/mercurial/discovery.py Fri Aug 05 14:00:30 2016 -0400
+++ b/mercurial/discovery.py Tue Aug 09 15:26:53 2016 +0200
@@ -76,10 +76,10 @@ class outgoing(object):
The sets are computed on demand from the heads, unless provided upfront
by discovery.'''
- def __init__(self, revlog, commonheads, missingheads):
+ def __init__(self, repo, commonheads, missingheads):
self.commonheads = commonheads
self.missingheads = missingheads
- self._revlog = revlog
+ self._revlog = repo.changelog
self._common = None
self._missing = None
self.excluded = []
@@ -120,7 +120,7 @@ def outgoingbetween(repo, roots, heads):
csets, roots, heads = cl.nodesbetween(roots, heads)
included = set(csets)
discbases = [n for n in discbases if n not in included]
- return outgoing(cl, discbases, heads)
+ return outgoing(repo, discbases, heads)
def findcommonoutgoing(repo, other, onlyheads=None, force=False,
commoninc=None, portable=False):
@@ -137,7 +137,7 @@ def findcommonoutgoing(repo, other, only
If portable is given, compute more conservative common and missingheads,
to make bundles created from the instance more portable.'''
# declare an empty outgoing object to be filled later
- og = outgoing(repo.changelog, None, None)
+ og = outgoing(repo, None, None)
# get common set if not provided
if commoninc is None:
diff -r 1a29db79a98d -r 69c5716ec081 tests/test-bundle2-format.t
--- a/tests/test-bundle2-format.t Fri Aug 05 14:00:30 2016 -0400
+++ b/tests/test-bundle2-format.t Tue Aug 09 15:26:53 2016 +0200
@@ -112,7 +112,7 @@ Create an extension to test bundle2 API
> bundled = repo.revs('%ld::%ld', revs, revs)
> headmissing = [c.node() for c in repo.set('heads(%ld)', revs)]
> headcommon = [c.node() for c in repo.set('parents(%ld) - %ld', revs, revs)]
- > outgoing = discovery.outgoing(repo.changelog, headcommon, headmissing)
+ > outgoing = discovery.outgoing(repo, headcommon, headmissing)
> cg = changegroup.getlocalchangegroup(repo, 'test:bundle2', outgoing, None)
> bundler.newpart('changegroup', data=cg.getchunks(),
> mandatory=False)
More information about the Mercurial-devel
mailing list