author | Pierre-Yves David <pierre-yves.david@octobus.net> |
Fri, 16 Jun 2017 16:51:31 +0200 | |
changeset 2607 | 054d92586e43 |
parent 2567 | 6eb87513024b |
child 2653 | 13313d0cab71 |
permissions | -rw-r--r-- |
1934
9d6d30e36cdd
discovery: move to new style import
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1921
diff
changeset
|
1 |
from __future__ import absolute_import |
9d6d30e36cdd
discovery: move to new style import
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1921
diff
changeset
|
2 |
|
1887
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
3 |
import weakref |
1934
9d6d30e36cdd
discovery: move to new style import
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1921
diff
changeset
|
4 |
|
1887
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
5 |
from mercurial.i18n import _ |
1934
9d6d30e36cdd
discovery: move to new style import
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1921
diff
changeset
|
6 |
from mercurial import ( |
9d6d30e36cdd
discovery: move to new style import
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1921
diff
changeset
|
7 |
branchmap, |
1944
daad8249d5cf
discovery: move all setup into a 'modsetup' function
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1934
diff
changeset
|
8 |
bundle2, |
daad8249d5cf
discovery: move all setup into a 'modsetup' function
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1934
diff
changeset
|
9 |
discovery, |
1934
9d6d30e36cdd
discovery: move to new style import
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1921
diff
changeset
|
10 |
error, |
9d6d30e36cdd
discovery: move to new style import
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1921
diff
changeset
|
11 |
exchange, |
1944
daad8249d5cf
discovery: move all setup into a 'modsetup' function
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1934
diff
changeset
|
12 |
extensions, |
daad8249d5cf
discovery: move all setup into a 'modsetup' function
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1934
diff
changeset
|
13 |
wireproto, |
1934
9d6d30e36cdd
discovery: move to new style import
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1921
diff
changeset
|
14 |
) |
9d6d30e36cdd
discovery: move to new style import
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1921
diff
changeset
|
15 |
|
1886
0504e76bfbd9
push: allow pushing new topic to non-publishing server by default
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
16 |
from . import topicmap |
0504e76bfbd9
push: allow pushing new topic to non-publishing server by default
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
17 |
|
2558
65cf338258d2
fix: fix _headssummary api
Boris Feld <boris.feld@octobus.net>
parents:
1965
diff
changeset
|
18 |
def _headssummary(orig, *args): |
65cf338258d2
fix: fix _headssummary api
Boris Feld <boris.feld@octobus.net>
parents:
1965
diff
changeset
|
19 |
# In mercurial < 4.2, we receive repo, remote and outgoing as arguments |
65cf338258d2
fix: fix _headssummary api
Boris Feld <boris.feld@octobus.net>
parents:
1965
diff
changeset
|
20 |
if len(args) == 3: |
65cf338258d2
fix: fix _headssummary api
Boris Feld <boris.feld@octobus.net>
parents:
1965
diff
changeset
|
21 |
repo, remote, outgoing = args |
65cf338258d2
fix: fix _headssummary api
Boris Feld <boris.feld@octobus.net>
parents:
1965
diff
changeset
|
22 |
|
65cf338258d2
fix: fix _headssummary api
Boris Feld <boris.feld@octobus.net>
parents:
1965
diff
changeset
|
23 |
# In mercurial > 4.3, we receive the pushop as arguments |
65cf338258d2
fix: fix _headssummary api
Boris Feld <boris.feld@octobus.net>
parents:
1965
diff
changeset
|
24 |
elif len(args) == 1: |
65cf338258d2
fix: fix _headssummary api
Boris Feld <boris.feld@octobus.net>
parents:
1965
diff
changeset
|
25 |
pushop = args[0] |
65cf338258d2
fix: fix _headssummary api
Boris Feld <boris.feld@octobus.net>
parents:
1965
diff
changeset
|
26 |
repo = pushop.repo.unfiltered() |
65cf338258d2
fix: fix _headssummary api
Boris Feld <boris.feld@octobus.net>
parents:
1965
diff
changeset
|
27 |
remote = pushop.remote |
65cf338258d2
fix: fix _headssummary api
Boris Feld <boris.feld@octobus.net>
parents:
1965
diff
changeset
|
28 |
else: |
65cf338258d2
fix: fix _headssummary api
Boris Feld <boris.feld@octobus.net>
parents:
1965
diff
changeset
|
29 |
msg = 'topic-ext _headssummary() takes 1 or 3 arguments (%d given)' |
65cf338258d2
fix: fix _headssummary api
Boris Feld <boris.feld@octobus.net>
parents:
1965
diff
changeset
|
30 |
raise TypeError(msg % len(args)) |
65cf338258d2
fix: fix _headssummary api
Boris Feld <boris.feld@octobus.net>
parents:
1965
diff
changeset
|
31 |
|
1886
0504e76bfbd9
push: allow pushing new topic to non-publishing server by default
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
32 |
publishing = ('phases' not in remote.listkeys('namespaces') |
0504e76bfbd9
push: allow pushing new topic to non-publishing server by default
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
33 |
or bool(remote.listkeys('phases').get('publishing', False))) |
1903
58cdf061d49a
topic: don't take topic into account when pushing to non-topic repo
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1901
diff
changeset
|
34 |
if publishing or not remote.capable('topics'): |
2567
6eb87513024b
fix: fix _headssummary call to orig
Boris Feld <boris.feld@octobus.net>
parents:
2558
diff
changeset
|
35 |
return orig(*args) |
1886
0504e76bfbd9
push: allow pushing new topic to non-publishing server by default
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
36 |
oldrepo = repo.__class__ |
0504e76bfbd9
push: allow pushing new topic to non-publishing server by default
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
37 |
oldbranchcache = branchmap.branchcache |
0504e76bfbd9
push: allow pushing new topic to non-publishing server by default
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
38 |
oldfilename = branchmap._filename |
0504e76bfbd9
push: allow pushing new topic to non-publishing server by default
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
39 |
try: |
0504e76bfbd9
push: allow pushing new topic to non-publishing server by default
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
40 |
class repocls(repo.__class__): |
0504e76bfbd9
push: allow pushing new topic to non-publishing server by default
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
41 |
def __getitem__(self, key): |
0504e76bfbd9
push: allow pushing new topic to non-publishing server by default
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
42 |
ctx = super(repocls, self).__getitem__(key) |
0504e76bfbd9
push: allow pushing new topic to non-publishing server by default
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
43 |
oldbranch = ctx.branch |
1965 | 44 |
|
1886
0504e76bfbd9
push: allow pushing new topic to non-publishing server by default
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
45 |
def branch(): |
0504e76bfbd9
push: allow pushing new topic to non-publishing server by default
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
46 |
branch = oldbranch() |
0504e76bfbd9
push: allow pushing new topic to non-publishing server by default
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
47 |
topic = ctx.topic() |
0504e76bfbd9
push: allow pushing new topic to non-publishing server by default
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
48 |
if topic: |
0504e76bfbd9
push: allow pushing new topic to non-publishing server by default
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
49 |
branch = "%s:%s" % (branch, topic) |
0504e76bfbd9
push: allow pushing new topic to non-publishing server by default
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
50 |
return branch |
1965 | 51 |
|
1886
0504e76bfbd9
push: allow pushing new topic to non-publishing server by default
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
52 |
ctx.branch = branch |
0504e76bfbd9
push: allow pushing new topic to non-publishing server by default
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
53 |
return ctx |
1965 | 54 |
|
1886
0504e76bfbd9
push: allow pushing new topic to non-publishing server by default
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
55 |
repo.__class__ = repocls |
0504e76bfbd9
push: allow pushing new topic to non-publishing server by default
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
56 |
branchmap.branchcache = topicmap.topiccache |
0504e76bfbd9
push: allow pushing new topic to non-publishing server by default
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
57 |
branchmap._filename = topicmap._filename |
2558
65cf338258d2
fix: fix _headssummary api
Boris Feld <boris.feld@octobus.net>
parents:
1965
diff
changeset
|
58 |
summary = orig(*args) |
1886
0504e76bfbd9
push: allow pushing new topic to non-publishing server by default
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
59 |
for key, value in summary.iteritems(): |
0504e76bfbd9
push: allow pushing new topic to non-publishing server by default
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
60 |
if ':' in key: # This is a topic |
0504e76bfbd9
push: allow pushing new topic to non-publishing server by default
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
61 |
if value[0] is None and value[1]: |
0504e76bfbd9
push: allow pushing new topic to non-publishing server by default
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
62 |
summary[key] = ([value[1].pop(0)], ) + value[1:] |
0504e76bfbd9
push: allow pushing new topic to non-publishing server by default
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
63 |
return summary |
0504e76bfbd9
push: allow pushing new topic to non-publishing server by default
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
64 |
finally: |
0504e76bfbd9
push: allow pushing new topic to non-publishing server by default
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
65 |
repo.__class__ = oldrepo |
0504e76bfbd9
push: allow pushing new topic to non-publishing server by default
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
66 |
branchmap.branchcache = oldbranchcache |
0504e76bfbd9
push: allow pushing new topic to non-publishing server by default
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
67 |
branchmap._filename = oldfilename |
0504e76bfbd9
push: allow pushing new topic to non-publishing server by default
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
68 |
|
0504e76bfbd9
push: allow pushing new topic to non-publishing server by default
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
69 |
def wireprotobranchmap(orig, repo, proto): |
0504e76bfbd9
push: allow pushing new topic to non-publishing server by default
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
70 |
oldrepo = repo.__class__ |
0504e76bfbd9
push: allow pushing new topic to non-publishing server by default
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
71 |
try: |
0504e76bfbd9
push: allow pushing new topic to non-publishing server by default
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
72 |
class repocls(repo.__class__): |
0504e76bfbd9
push: allow pushing new topic to non-publishing server by default
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
73 |
def branchmap(self): |
0504e76bfbd9
push: allow pushing new topic to non-publishing server by default
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
74 |
usetopic = not self.publishing() |
0504e76bfbd9
push: allow pushing new topic to non-publishing server by default
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
75 |
return super(repocls, self).branchmap(topic=usetopic) |
0504e76bfbd9
push: allow pushing new topic to non-publishing server by default
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
76 |
repo.__class__ = repocls |
0504e76bfbd9
push: allow pushing new topic to non-publishing server by default
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
77 |
return orig(repo, proto) |
0504e76bfbd9
push: allow pushing new topic to non-publishing server by default
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
78 |
finally: |
0504e76bfbd9
push: allow pushing new topic to non-publishing server by default
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff
changeset
|
79 |
repo.__class__ = oldrepo |
1887
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
80 |
|
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
81 |
|
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
82 |
# Discovery have deficiency around phases, branch can get new heads with pure |
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
83 |
# phases change. This happened with a changeset was allowed to be pushed |
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
84 |
# because it had a topic, but it later become public and create a new branch |
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
85 |
# head. |
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
86 |
# |
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
87 |
# Handle this by doing an extra check for new head creation server side |
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
88 |
def _nbheads(repo): |
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
89 |
data = {} |
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
90 |
for b in repo.branchmap().iterbranches(): |
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
91 |
if ':' in b[0]: |
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
92 |
continue |
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
93 |
data[b[0]] = len(b[1]) |
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
94 |
return data |
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
95 |
|
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
96 |
def handlecheckheads(orig, op, inpart): |
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
97 |
orig(op, inpart) |
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
98 |
if op.repo.publishing(): |
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
99 |
return |
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
100 |
tr = op.gettransaction() |
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
101 |
if tr.hookargs['source'] not in ('push', 'serve'): # not a push |
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
102 |
return |
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
103 |
tr._prepushheads = _nbheads(op.repo) |
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
104 |
reporef = weakref.ref(op.repo) |
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
105 |
oldvalidator = tr.validator |
1921 | 106 |
|
1887
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
107 |
def validator(tr): |
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
108 |
repo = reporef() |
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
109 |
if repo is not None: |
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
110 |
repo.invalidatecaches() |
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
111 |
finalheads = _nbheads(repo) |
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
112 |
for branch, oldnb in tr._prepushheads.iteritems(): |
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
113 |
newnb = finalheads.pop(branch, 0) |
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
114 |
if oldnb < newnb: |
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
115 |
msg = _('push create a new head on branch "%s"' % branch) |
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
116 |
raise error.Abort(msg) |
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
117 |
for branch, newnb in finalheads.iteritems(): |
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
118 |
if 1 < newnb: |
1921 | 119 |
msg = _('push create more than 1 head on new branch "%s"' |
120 |
% branch) |
|
1887
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
121 |
raise error.Abort(msg) |
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
122 |
return oldvalidator(tr) |
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
123 |
tr.validator = validator |
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
124 |
handlecheckheads.params = frozenset() |
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
125 |
|
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
126 |
def _pushb2phases(orig, pushop, bundler): |
1921 | 127 |
hascheck = any(p.type == 'check:heads' for p in bundler._parts) |
1887
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
128 |
if pushop.outdatedphases and not hascheck: |
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
129 |
exchange._pushb2ctxcheckheads(pushop, bundler) |
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
130 |
return orig(pushop, bundler) |
68125d026b07
push: hackish handeling of new branch head from phase move
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1886
diff
changeset
|
131 |
|
1903
58cdf061d49a
topic: don't take topic into account when pushing to non-topic repo
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1901
diff
changeset
|
132 |
def wireprotocaps(orig, repo, proto): |
58cdf061d49a
topic: don't take topic into account when pushing to non-topic repo
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1901
diff
changeset
|
133 |
caps = orig(repo, proto) |
58cdf061d49a
topic: don't take topic into account when pushing to non-topic repo
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1901
diff
changeset
|
134 |
if repo.peer().capable('topics'): |
58cdf061d49a
topic: don't take topic into account when pushing to non-topic repo
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1901
diff
changeset
|
135 |
caps.append('topics') |
58cdf061d49a
topic: don't take topic into account when pushing to non-topic repo
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1901
diff
changeset
|
136 |
return caps |
1944
daad8249d5cf
discovery: move all setup into a 'modsetup' function
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1934
diff
changeset
|
137 |
|
daad8249d5cf
discovery: move all setup into a 'modsetup' function
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1934
diff
changeset
|
138 |
def modsetup(ui): |
daad8249d5cf
discovery: move all setup into a 'modsetup' function
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1934
diff
changeset
|
139 |
"""run at uisetup time to install all destinations wrapping""" |
daad8249d5cf
discovery: move all setup into a 'modsetup' function
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1934
diff
changeset
|
140 |
extensions.wrapfunction(discovery, '_headssummary', _headssummary) |
daad8249d5cf
discovery: move all setup into a 'modsetup' function
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1934
diff
changeset
|
141 |
extensions.wrapfunction(wireproto, 'branchmap', wireprotobranchmap) |
daad8249d5cf
discovery: move all setup into a 'modsetup' function
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1934
diff
changeset
|
142 |
extensions.wrapfunction(wireproto, '_capabilities', wireprotocaps) |
daad8249d5cf
discovery: move all setup into a 'modsetup' function
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1934
diff
changeset
|
143 |
extensions.wrapfunction(bundle2, 'handlecheckheads', handlecheckheads) |
daad8249d5cf
discovery: move all setup into a 'modsetup' function
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1934
diff
changeset
|
144 |
# we need a proper wrap b2 part stuff |
daad8249d5cf
discovery: move all setup into a 'modsetup' function
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1934
diff
changeset
|
145 |
bundle2.handlecheckheads.params = frozenset() |
daad8249d5cf
discovery: move all setup into a 'modsetup' function
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1934
diff
changeset
|
146 |
bundle2.parthandlermapping['check:heads'] = bundle2.handlecheckheads |
daad8249d5cf
discovery: move all setup into a 'modsetup' function
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1934
diff
changeset
|
147 |
extensions.wrapfunction(exchange, '_pushb2phases', _pushb2phases) |
daad8249d5cf
discovery: move all setup into a 'modsetup' function
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1934
diff
changeset
|
148 |
exchange.b2partsgenmapping['phase'] = exchange._pushb2phases |