bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
0.200.1613
by Jelmer Vernooij
Handle encoding better in working tree iter changes. |
1 |
# Copyright (C) 2007,2012 Canonical Ltd
|
0.358.2
by Jelmer Vernooij
Refresh copyright headers, add my email. |
2 |
# Copyright (C) 2009-2018 Jelmer Vernooij <jelmer@jelmer.uk>
|
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
3 |
#
|
4 |
# This program is free software; you can redistribute it and/or modify
|
|
5 |
# it under the terms of the GNU General Public License as published by
|
|
6 |
# the Free Software Foundation; either version 2 of the License, or
|
|
7 |
# (at your option) any later version.
|
|
8 |
#
|
|
9 |
# This program is distributed in the hope that it will be useful,
|
|
10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12 |
# GNU General Public License for more details.
|
|
13 |
#
|
|
14 |
# You should have received a copy of the GNU General Public License
|
|
15 |
# along with this program; if not, write to the Free Software
|
|
0.358.1
by Jelmer Vernooij
Fix FSF address. |
16 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
17 |
|
18 |
"""An adapter between a Git Branch and a Bazaar Branch"""
|
|
19 |
||
0.200.1594
by Jelmer Vernooij
Use absolute_import everywhere. |
20 |
|
7479.2.1
by Jelmer Vernooij
Drop python2 support. |
21 |
import contextlib |
6964.2.1
by Jelmer Vernooij
Initial work to support brz-git on python3. |
22 |
from io import BytesIO |
0.200.1065
by Jelmer Vernooij
Don't peel tags automatically when pushing back. |
23 |
from collections import defaultdict |
24 |
||
7449.1.2
by Jelmer Vernooij
Fix git support. |
25 |
from dulwich.config import ( |
26 |
ConfigFile as GitConfigFile, |
|
27 |
parse_submodules, |
|
28 |
)
|
|
29 |
||
0.200.261
by Jelmer Vernooij
More formatting fixes. |
30 |
from dulwich.objects import ( |
0.200.1717
by Jelmer Vernooij
Ignore tags pointing at non-commit objects. |
31 |
NotCommitError, |
0.200.1153
by Jelmer Vernooij
Import ZERO_SHA from dulwich.objects. |
32 |
ZERO_SHA, |
0.200.261
by Jelmer Vernooij
More formatting fixes. |
33 |
)
|
0.200.1391
by Jelmer Vernooij
Warn on (and skip) invalid tags. |
34 |
from dulwich.repo import check_ref_format |
0.200.261
by Jelmer Vernooij
More formatting fixes. |
35 |
|
6986.2.1
by Jelmer Vernooij
Move breezy.plugins.git to breezy.git. |
36 |
from .. import ( |
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
37 |
branch, |
38 |
config, |
|
0.200.1648
by Jelmer Vernooij
Fix compatibility with newer versions of breezy. |
39 |
controldir, |
0.200.446
by Jelmer Vernooij
Support new 'local' argument. |
40 |
errors, |
0.200.1670
by Jelmer Vernooij
Fix compatibility with newer versions of bzr. |
41 |
lock, |
0.200.1097
by Jelmer Vernooij
Implement GitBranchFormat.initialize. |
42 |
repository as _mod_repository, |
0.200.19
by John Arbash Meinel
More refactoring. Add some direct tests for GitModel. |
43 |
revision, |
0.375.1
by Jelmer Vernooij
Fix remote tests, warn when fetching git->bzr and bzr->git. |
44 |
trace, |
0.230.1
by Jelmer Vernooij
Support lightweight checkouts. |
45 |
transport, |
0.200.1414
by Jelmer Vernooij
Fix pulling into bound branches. |
46 |
urlutils, |
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
47 |
)
|
6986.2.3
by Jelmer Vernooij
Merge trunk |
48 |
from ..foreign import ForeignBranch |
6986.2.1
by Jelmer Vernooij
Move breezy.plugins.git to breezy.git. |
49 |
from ..revision import ( |
0.200.969
by Jelmer Vernooij
Use tuples with bzr revid and git sha to avoid lookups. |
50 |
NULL_REVISION, |
51 |
)
|
|
7489.3.2
by Jelmer Vernooij
Use InterTags in anger. |
52 |
from ..tag import ( |
53 |
Tags, |
|
54 |
InterTags, |
|
55 |
)
|
|
6986.2.1
by Jelmer Vernooij
Move breezy.plugins.git to breezy.git. |
56 |
from ..trace import ( |
0.200.342
by Jelmer Vernooij
Report git sha during pull. |
57 |
is_quiet, |
0.200.261
by Jelmer Vernooij
More formatting fixes. |
58 |
mutter, |
0.200.1391
by Jelmer Vernooij
Warn on (and skip) invalid tags. |
59 |
warning, |
0.200.261
by Jelmer Vernooij
More formatting fixes. |
60 |
)
|
61 |
||
0.200.1641
by Jelmer Vernooij
Use relative imports where possible. |
62 |
from .config import ( |
0.200.386
by Jelmer Vernooij
Move config to a separate file, support BranchConfig.username(). |
63 |
GitBranchConfig, |
0.200.1472
by Jelmer Vernooij
Provide basic implementation of Branch.get_config_stack. |
64 |
GitBranchStack, |
0.200.386
by Jelmer Vernooij
Move config to a separate file, support BranchConfig.username(). |
65 |
)
|
0.200.1641
by Jelmer Vernooij
Use relative imports where possible. |
66 |
from .errors import ( |
0.200.472
by Jelmer Vernooij
Fix printing error when user attempts to push into git. |
67 |
NoPushSupport, |
0.200.278
by Jelmer Vernooij
Update branch head appropriately during dpull. |
68 |
)
|
0.404.5
by Jelmer Vernooij
Check for diverged branches during push. |
69 |
from .push import ( |
70 |
remote_divergence, |
|
71 |
)
|
|
0.200.1641
by Jelmer Vernooij
Use relative imports where possible. |
72 |
from .refs import ( |
0.408.4
by Jelmer Vernooij
Fix some tests. |
73 |
branch_name_to_ref, |
0.200.1061
by Jelmer Vernooij
Add support for using unpeel map. |
74 |
is_tag, |
0.200.872
by Jelmer Vernooij
Move refs code to separate module. |
75 |
ref_to_branch_name, |
0.200.1061
by Jelmer Vernooij
Add support for using unpeel map. |
76 |
ref_to_tag_name, |
0.346.1
by Jelmer Vernooij
Fix tag caching. |
77 |
remote_refs_dict_to_tag_refs, |
0.200.875
by Jelmer Vernooij
Use new tag_name_to_ref function. |
78 |
tag_name_to_ref, |
0.200.1292
by Jelmer Vernooij
Fix repeeling objects when determining what to send. |
79 |
)
|
0.200.1641
by Jelmer Vernooij
Use relative imports where possible. |
80 |
from .unpeel_map import ( |
0.200.1065
by Jelmer Vernooij
Don't peel tags automatically when pushing back. |
81 |
UnpeelMap, |
0.200.872
by Jelmer Vernooij
Move refs code to separate module. |
82 |
)
|
7141.8.1
by Jelmer Vernooij
Read parent branch properly from git config. |
83 |
from .urls import ( |
84 |
git_url_to_bzr_url, |
|
85 |
bzr_url_to_git_url, |
|
86 |
)
|
|
0.200.261
by Jelmer Vernooij
More formatting fixes. |
87 |
|
0.200.388
by Jelmer Vernooij
Support bzr 1.14 as well. |
88 |
|
7339.1.6
by Jelmer Vernooij
Also support revno-less push/pull operations. |
89 |
def _calculate_revnos(branch): |
90 |
if branch._format.stores_revno(): |
|
91 |
return True |
|
92 |
config = branch.get_config_stack() |
|
93 |
return config.get('calculate_revnos') |
|
94 |
||
95 |
||
0.200.334
by Jelmer Vernooij
Support pulling from git to git. |
96 |
class GitPullResult(branch.PullResult): |
0.200.956
by Jelmer Vernooij
Add some more format tests. |
97 |
"""Result of a pull from a Git branch.""" |
0.200.334
by Jelmer Vernooij
Support pulling from git to git. |
98 |
|
99 |
def _lookup_revno(self, revid): |
|
6973.13.2
by Jelmer Vernooij
Fix some more tests. |
100 |
if not isinstance(revid, bytes): |
0.361.1
by Jelmer Vernooij
Don't use assert. |
101 |
raise TypeError(revid) |
7339.1.6
by Jelmer Vernooij
Also support revno-less push/pull operations. |
102 |
if not _calculate_revnos(self.target_branch): |
103 |
return None |
|
0.200.334
by Jelmer Vernooij
Support pulling from git to git. |
104 |
# Try in source branch first, it'll be faster
|
0.200.1670
by Jelmer Vernooij
Fix compatibility with newer versions of bzr. |
105 |
with self.target_branch.lock_read(): |
0.200.1362
by Jelmer Vernooij
Add locking. |
106 |
return self.target_branch.revision_id_to_revno(revid) |
0.200.334
by Jelmer Vernooij
Support pulling from git to git. |
107 |
|
108 |
@property
|
|
109 |
def old_revno(self): |
|
110 |
return self._lookup_revno(self.old_revid) |
|
111 |
||
112 |
@property
|
|
113 |
def new_revno(self): |
|
114 |
return self._lookup_revno(self.new_revid) |
|
115 |
||
116 |
||
7489.3.2
by Jelmer Vernooij
Use InterTags in anger. |
117 |
class InterTagsFromGitToRemoteGit(InterTags): |
118 |
||
119 |
@classmethod
|
|
120 |
def is_compatible(klass, source, target): |
|
121 |
if not isinstance(source, GitTags): |
|
122 |
return False |
|
123 |
if not isinstance(target, GitTags): |
|
124 |
return False |
|
125 |
if getattr(target.branch.repository, "_git", None) is not None: |
|
126 |
return False |
|
127 |
return True |
|
128 |
||
7489.4.1
by Jelmer Vernooij
Add tag selecting callback. |
129 |
def merge(self, overwrite=False, ignore_master=False, selector=None): |
7489.3.2
by Jelmer Vernooij
Use InterTags in anger. |
130 |
if self.source.branch.repository.has_same_location(self.target.branch.repository): |
131 |
return {}, [] |
|
0.200.1396
by Jelmer Vernooij
Support updating tags in remote branches during pull. |
132 |
updates = {} |
133 |
conflicts = [] |
|
7489.3.2
by Jelmer Vernooij
Use InterTags in anger. |
134 |
source_tag_refs = self.source.branch.get_tag_refs() |
7143.15.2
by Jelmer Vernooij
Run autopep8. |
135 |
|
0.200.1396
by Jelmer Vernooij
Support updating tags in remote branches during pull. |
136 |
def get_changed_refs(old_refs): |
137 |
ret = dict(old_refs) |
|
7143.15.3
by Jelmer Vernooij
Fix pep8 issues in breezy.git. |
138 |
for ref_name, tag_name, peeled, unpeeled in ( |
139 |
source_tag_refs.iteritems()): |
|
7489.4.1
by Jelmer Vernooij
Add tag selecting callback. |
140 |
if selector and not selector(tag_name): |
141 |
continue
|
|
0.346.1
by Jelmer Vernooij
Fix tag caching. |
142 |
if old_refs.get(ref_name) == unpeeled: |
0.200.1396
by Jelmer Vernooij
Support updating tags in remote branches during pull. |
143 |
pass
|
7143.15.3
by Jelmer Vernooij
Fix pep8 issues in breezy.git. |
144 |
elif overwrite or ref_name not in old_refs: |
0.346.1
by Jelmer Vernooij
Fix tag caching. |
145 |
ret[ref_name] = unpeeled |
7489.3.2
by Jelmer Vernooij
Use InterTags in anger. |
146 |
updates[tag_name] = self.target.branch.repository.lookup_foreign_revision_id( |
7143.15.2
by Jelmer Vernooij
Run autopep8. |
147 |
peeled) |
7489.3.2
by Jelmer Vernooij
Use InterTags in anger. |
148 |
self.target.branch._tag_refs = None |
0.200.1396
by Jelmer Vernooij
Support updating tags in remote branches during pull. |
149 |
else: |
0.346.1
by Jelmer Vernooij
Fix tag caching. |
150 |
conflicts.append( |
151 |
(tag_name, |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
152 |
self.repository.lookup_foreign_revision_id(peeled), |
7489.3.2
by Jelmer Vernooij
Use InterTags in anger. |
153 |
self.target.branch.repository.lookup_foreign_revision_id( |
7143.15.3
by Jelmer Vernooij
Fix pep8 issues in breezy.git. |
154 |
old_refs[ref_name]))) |
0.200.1396
by Jelmer Vernooij
Support updating tags in remote branches during pull. |
155 |
return ret |
7489.3.2
by Jelmer Vernooij
Use InterTags in anger. |
156 |
self.target.branch.repository.controldir.send_pack( |
7143.15.2
by Jelmer Vernooij
Run autopep8. |
157 |
get_changed_refs, lambda have, want: []) |
7489.4.4
by Jelmer Vernooij
Add more tests. |
158 |
return updates, set(conflicts) |
0.200.1396
by Jelmer Vernooij
Support updating tags in remote branches during pull. |
159 |
|
7489.3.2
by Jelmer Vernooij
Use InterTags in anger. |
160 |
|
161 |
class InterTagsFromGitToLocalGit(InterTags): |
|
162 |
||
163 |
@classmethod
|
|
164 |
def is_compatible(klass, source, target): |
|
165 |
if not isinstance(source, GitTags): |
|
166 |
return False |
|
167 |
if not isinstance(target, GitTags): |
|
168 |
return False |
|
169 |
if getattr(target.branch.repository, "_git", None) is None: |
|
170 |
return False |
|
171 |
return True |
|
172 |
||
7489.4.1
by Jelmer Vernooij
Add tag selecting callback. |
173 |
def merge(self, overwrite=False, ignore_master=False, selector=None): |
7489.3.2
by Jelmer Vernooij
Use InterTags in anger. |
174 |
if self.source.branch.repository.has_same_location(self.target.branch.repository): |
175 |
return {}, [] |
|
176 |
||
0.200.1396
by Jelmer Vernooij
Support updating tags in remote branches during pull. |
177 |
conflicts = [] |
178 |
updates = {} |
|
7489.3.2
by Jelmer Vernooij
Use InterTags in anger. |
179 |
source_tag_refs = self.source.branch.get_tag_refs() |
180 |
||
181 |
target_repo = self.target.branch.repository |
|
182 |
||
0.346.1
by Jelmer Vernooij
Fix tag caching. |
183 |
for ref_name, tag_name, peeled, unpeeled in source_tag_refs: |
7489.4.1
by Jelmer Vernooij
Add tag selecting callback. |
184 |
if selector and not selector(tag_name): |
185 |
continue
|
|
0.346.1
by Jelmer Vernooij
Fix tag caching. |
186 |
if target_repo._git.refs.get(ref_name) == unpeeled: |
0.200.1396
by Jelmer Vernooij
Support updating tags in remote branches during pull. |
187 |
pass
|
7143.15.3
by Jelmer Vernooij
Fix pep8 issues in breezy.git. |
188 |
elif overwrite or ref_name not in target_repo._git.refs: |
7143.12.3
by Jelmer Vernooij
Ignore ghost tags. |
189 |
try: |
7143.15.8
by Jelmer Vernooij
Merge trunk. |
190 |
updates[tag_name] = ( |
7240.2.1
by Jelmer Vernooij
Don't copy tags that don't point to valid objects. |
191 |
target_repo.lookup_foreign_revision_id(peeled)) |
7143.12.3
by Jelmer Vernooij
Ignore ghost tags. |
192 |
except KeyError: |
193 |
trace.warning('%s does not point to a valid object', |
|
194 |
tag_name) |
|
7142.3.3
by Jelmer Vernooij
Fix test. |
195 |
continue
|
7405.1.1
by Jelmer Vernooij
Cope with non-commit tags in remote git repositories. |
196 |
except NotCommitError: |
197 |
trace.warning('%s points to a non-commit object', |
|
198 |
tag_name) |
|
199 |
continue
|
|
7240.2.1
by Jelmer Vernooij
Don't copy tags that don't point to valid objects. |
200 |
target_repo._git.refs[ref_name] = unpeeled or peeled |
7489.3.2
by Jelmer Vernooij
Use InterTags in anger. |
201 |
self.target.branch._tag_refs = None |
0.200.1065
by Jelmer Vernooij
Don't peel tags automatically when pushing back. |
202 |
else: |
0.375.1
by Jelmer Vernooij
Fix remote tests, warn when fetching git->bzr and bzr->git. |
203 |
try: |
7489.3.2
by Jelmer Vernooij
Use InterTags in anger. |
204 |
source_revid = self.source.branch.repository.lookup_foreign_revision_id( |
7143.15.8
by Jelmer Vernooij
Merge trunk. |
205 |
peeled) |
0.375.1
by Jelmer Vernooij
Fix remote tests, warn when fetching git->bzr and bzr->git. |
206 |
target_revid = target_repo.lookup_foreign_revision_id( |
7143.15.2
by Jelmer Vernooij
Run autopep8. |
207 |
target_repo._git.refs[ref_name]) |
0.375.1
by Jelmer Vernooij
Fix remote tests, warn when fetching git->bzr and bzr->git. |
208 |
except KeyError: |
209 |
trace.warning('%s does not point to a valid object', |
|
210 |
ref_name) |
|
211 |
continue
|
|
7405.1.1
by Jelmer Vernooij
Cope with non-commit tags in remote git repositories. |
212 |
except NotCommitError: |
213 |
trace.warning('%s points to a non-commit object', |
|
214 |
tag_name) |
|
215 |
continue
|
|
0.375.1
by Jelmer Vernooij
Fix remote tests, warn when fetching git->bzr and bzr->git. |
216 |
conflicts.append((tag_name, source_revid, target_revid)) |
7489.4.4
by Jelmer Vernooij
Add more tests. |
217 |
return updates, set(conflicts) |
0.200.1396
by Jelmer Vernooij
Support updating tags in remote branches during pull. |
218 |
|
7489.3.2
by Jelmer Vernooij
Use InterTags in anger. |
219 |
|
220 |
class InterTagsFromGitToNonGit(InterTags): |
|
221 |
||
222 |
@classmethod
|
|
223 |
def is_compatible(klass, source, target): |
|
224 |
if not isinstance(source, GitTags): |
|
225 |
return False |
|
226 |
if isinstance(target, GitTags): |
|
227 |
return False |
|
228 |
return True |
|
229 |
||
7489.4.1
by Jelmer Vernooij
Add tag selecting callback. |
230 |
def merge(self, overwrite=False, ignore_master=False, selector=None): |
7489.3.2
by Jelmer Vernooij
Use InterTags in anger. |
231 |
"""See Tags.merge_to.""" |
232 |
source_tag_refs = self.source.branch.get_tag_refs() |
|
233 |
if ignore_master: |
|
234 |
master = None |
|
235 |
else: |
|
236 |
master = self.target.branch.get_master_branch() |
|
7494.1.1
by Jelmer Vernooij
merge lp:brz/3.1. |
237 |
with contextlib.ExitStack() as es: |
7489.3.2
by Jelmer Vernooij
Use InterTags in anger. |
238 |
if master is not None: |
239 |
es.enter_context(master.lock_write()) |
|
240 |
updates, conflicts = self._merge_to( |
|
7489.4.1
by Jelmer Vernooij
Add tag selecting callback. |
241 |
self.target, source_tag_refs, overwrite=overwrite, |
242 |
selector=selector) |
|
7489.3.2
by Jelmer Vernooij
Use InterTags in anger. |
243 |
if master is not None: |
244 |
extra_updates, extra_conflicts = self._merge_to( |
|
245 |
master.tags, overwrite=overwrite, |
|
246 |
source_tag_refs=source_tag_refs, |
|
7489.4.1
by Jelmer Vernooij
Add tag selecting callback. |
247 |
ignore_master=ignore_master, selector=selector) |
7489.3.2
by Jelmer Vernooij
Use InterTags in anger. |
248 |
updates.update(extra_updates) |
7489.4.4
by Jelmer Vernooij
Add more tests. |
249 |
conflicts.update(extra_conflicts) |
7489.3.2
by Jelmer Vernooij
Use InterTags in anger. |
250 |
return updates, conflicts |
251 |
||
7489.4.1
by Jelmer Vernooij
Add tag selecting callback. |
252 |
def _merge_to(self, to_tags, source_tag_refs, overwrite=False, |
253 |
selector=None): |
|
0.200.1065
by Jelmer Vernooij
Don't peel tags automatically when pushing back. |
254 |
unpeeled_map = defaultdict(set) |
255 |
conflicts = [] |
|
0.200.1396
by Jelmer Vernooij
Support updating tags in remote branches during pull. |
256 |
updates = {} |
0.200.1065
by Jelmer Vernooij
Don't peel tags automatically when pushing back. |
257 |
result = dict(to_tags.get_tag_dict()) |
0.346.1
by Jelmer Vernooij
Fix tag caching. |
258 |
for ref_name, tag_name, peeled, unpeeled in source_tag_refs: |
7489.4.1
by Jelmer Vernooij
Add tag selecting callback. |
259 |
if selector and not selector(tag_name): |
260 |
continue
|
|
0.200.1065
by Jelmer Vernooij
Don't peel tags automatically when pushing back. |
261 |
if unpeeled is not None: |
262 |
unpeeled_map[peeled].add(unpeeled) |
|
0.346.1
by Jelmer Vernooij
Fix tag caching. |
263 |
try: |
7489.3.2
by Jelmer Vernooij
Use InterTags in anger. |
264 |
bzr_revid = self.source.branch.lookup_foreign_revision_id(peeled) |
0.346.1
by Jelmer Vernooij
Fix tag caching. |
265 |
except NotCommitError: |
266 |
continue
|
|
267 |
if result.get(tag_name) == bzr_revid: |
|
0.200.1396
by Jelmer Vernooij
Support updating tags in remote branches during pull. |
268 |
pass
|
0.346.1
by Jelmer Vernooij
Fix tag caching. |
269 |
elif tag_name not in result or overwrite: |
270 |
result[tag_name] = bzr_revid |
|
271 |
updates[tag_name] = bzr_revid |
|
0.200.1065
by Jelmer Vernooij
Don't peel tags automatically when pushing back. |
272 |
else: |
7143.15.3
by Jelmer Vernooij
Fix pep8 issues in breezy.git. |
273 |
conflicts.append((tag_name, bzr_revid, result[tag_name])) |
0.200.1065
by Jelmer Vernooij
Don't peel tags automatically when pushing back. |
274 |
to_tags._set_tag_dict(result) |
275 |
if len(unpeeled_map) > 0: |
|
276 |
map_file = UnpeelMap.from_repository(to_tags.branch.repository) |
|
277 |
map_file.update(unpeeled_map) |
|
278 |
map_file.save_in_repository(to_tags.branch.repository) |
|
7489.4.4
by Jelmer Vernooij
Add more tests. |
279 |
return updates, set(conflicts) |
0.200.1065
by Jelmer Vernooij
Don't peel tags automatically when pushing back. |
280 |
|
7489.3.2
by Jelmer Vernooij
Use InterTags in anger. |
281 |
|
282 |
InterTags.register_optimiser(InterTagsFromGitToRemoteGit) |
|
283 |
InterTags.register_optimiser(InterTagsFromGitToLocalGit) |
|
284 |
InterTags.register_optimiser(InterTagsFromGitToNonGit) |
|
285 |
||
286 |
||
287 |
class GitTags(Tags): |
|
288 |
"""Ref-based tag dictionary.""" |
|
289 |
||
290 |
def __init__(self, branch): |
|
291 |
self.branch = branch |
|
292 |
self.repository = branch.repository |
|
0.200.1065
by Jelmer Vernooij
Don't peel tags automatically when pushing back. |
293 |
|
294 |
def get_tag_dict(self): |
|
295 |
ret = {} |
|
7143.15.3
by Jelmer Vernooij
Fix pep8 issues in breezy.git. |
296 |
for (ref_name, tag_name, peeled, unpeeled) in ( |
297 |
self.branch.get_tag_refs()): |
|
0.346.1
by Jelmer Vernooij
Fix tag caching. |
298 |
try: |
299 |
bzr_revid = self.branch.lookup_foreign_revision_id(peeled) |
|
300 |
except NotCommitError: |
|
301 |
continue
|
|
302 |
else: |
|
303 |
ret[tag_name] = bzr_revid |
|
0.200.1065
by Jelmer Vernooij
Don't peel tags automatically when pushing back. |
304 |
return ret |
305 |
||
7489.3.2
by Jelmer Vernooij
Use InterTags in anger. |
306 |
def lookup_tag(self, tag_name): |
307 |
"""Return the referent string of a tag""" |
|
308 |
# TODO(jelmer): Replace with something more efficient for local tags.
|
|
309 |
td = self.get_tag_dict() |
|
310 |
try: |
|
311 |
return td[tag_name] |
|
312 |
except KeyError: |
|
313 |
raise errors.NoSuchTag(tag_name) |
|
314 |
||
0.200.1064
by Jelmer Vernooij
Use common base class for tags. |
315 |
|
316 |
class LocalGitTagDict(GitTags): |
|
317 |
"""Dictionary with tags in a local repository.""" |
|
318 |
||
319 |
def __init__(self, branch): |
|
320 |
super(LocalGitTagDict, self).__init__(branch) |
|
0.200.1648
by Jelmer Vernooij
Fix compatibility with newer versions of breezy. |
321 |
self.refs = self.repository.controldir._git.refs |
0.200.1064
by Jelmer Vernooij
Use common base class for tags. |
322 |
|
0.200.711
by Jelmer Vernooij
Support merging tags to a local Git repository. |
323 |
def _set_tag_dict(self, to_dict): |
0.200.1487
by Jelmer Vernooij
Use peeling. |
324 |
extra = set(self.refs.allkeys()) |
7479.2.1
by Jelmer Vernooij
Drop python2 support. |
325 |
for k, revid in to_dict.items(): |
0.200.875
by Jelmer Vernooij
Use new tag_name_to_ref function. |
326 |
name = tag_name_to_ref(k) |
0.200.711
by Jelmer Vernooij
Support merging tags to a local Git repository. |
327 |
if name in extra: |
328 |
extra.remove(name) |
|
7455.2.1
by Jelmer Vernooij
Return a FetchResult object from Repository.fetch / Branch.fetch. |
329 |
try: |
330 |
self.set_tag(k, revid) |
|
331 |
except errors.GhostTagsNotSupported: |
|
332 |
pass
|
|
0.200.711
by Jelmer Vernooij
Support merging tags to a local Git repository. |
333 |
for name in extra: |
0.200.1061
by Jelmer Vernooij
Add support for using unpeel map. |
334 |
if is_tag(name): |
0.200.711
by Jelmer Vernooij
Support merging tags to a local Git repository. |
335 |
del self.repository._git[name] |
0.200.956
by Jelmer Vernooij
Add some more format tests. |
336 |
|
0.200.86
by Jelmer Vernooij
Clearer error when setting tags. |
337 |
def set_tag(self, name, revid): |
0.200.1369
by Jelmer Vernooij
Clarify that ghost tags are not supported. |
338 |
try: |
339 |
git_sha, mapping = self.branch.lookup_bzr_revision_id(revid) |
|
340 |
except errors.NoSuchRevision: |
|
341 |
raise errors.GhostTagsNotSupported(self) |
|
342 |
self.refs[tag_name_to_ref(name)] = git_sha |
|
0.346.1
by Jelmer Vernooij
Fix tag caching. |
343 |
self.branch._tag_refs = None |
344 |
||
345 |
def delete_tag(self, name): |
|
346 |
ref = tag_name_to_ref(name) |
|
7143.15.3
by Jelmer Vernooij
Fix pep8 issues in breezy.git. |
347 |
if ref not in self.refs: |
0.346.1
by Jelmer Vernooij
Fix tag caching. |
348 |
raise errors.NoSuchTag(name) |
349 |
del self.refs[ref] |
|
350 |
self.branch._tag_refs = None |
|
0.239.1
by Jelmer Vernooij
Avoid re-connecting to fetch tags we already know. |
351 |
|
352 |
||
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
353 |
class GitBranchFormat(branch.BranchFormat): |
354 |
||
0.243.1
by Jelmer Vernooij
Use foreign branch testing infrastructure. |
355 |
def network_name(self): |
6973.6.2
by Jelmer Vernooij
Fix more tests. |
356 |
return b"git" |
0.243.1
by Jelmer Vernooij
Use foreign branch testing infrastructure. |
357 |
|
0.200.82
by Jelmer Vernooij
Support listing tags. |
358 |
def supports_tags(self): |
359 |
return True |
|
360 |
||
0.200.1105
by Jelmer Vernooij
Don't claim to support leaving locks. |
361 |
def supports_leaving_lock(self): |
362 |
return False |
|
363 |
||
0.200.1369
by Jelmer Vernooij
Clarify that ghost tags are not supported. |
364 |
def supports_tags_referencing_ghosts(self): |
365 |
return False |
|
366 |
||
367 |
def tags_are_versioned(self): |
|
368 |
return False |
|
369 |
||
0.243.1
by Jelmer Vernooij
Use foreign branch testing infrastructure. |
370 |
def get_foreign_tests_branch_factory(self): |
0.200.1644
by Jelmer Vernooij
More relative imports. |
371 |
from .tests.test_branch import ForeignTestsBranchFactory |
0.243.1
by Jelmer Vernooij
Use foreign branch testing infrastructure. |
372 |
return ForeignTestsBranchFactory() |
373 |
||
0.200.246
by Jelmer Vernooij
Cope with API changes in 1.13. |
374 |
def make_tags(self, branch): |
0.200.1487
by Jelmer Vernooij
Use peeling. |
375 |
try: |
376 |
return branch.tags |
|
377 |
except AttributeError: |
|
378 |
pass
|
|
0.200.1433
by Jelmer Vernooij
Fix fetching between git repositories. |
379 |
if getattr(branch.repository, "_git", None) is None: |
0.200.1644
by Jelmer Vernooij
More relative imports. |
380 |
from .remote import RemoteGitTagDict |
0.228.3
by Jelmer Vernooij
Fix tags when fetching from remotes. |
381 |
return RemoteGitTagDict(branch) |
0.200.261
by Jelmer Vernooij
More formatting fixes. |
382 |
else: |
383 |
return LocalGitTagDict(branch) |
|
0.200.246
by Jelmer Vernooij
Cope with API changes in 1.13. |
384 |
|
0.200.1648
by Jelmer Vernooij
Fix compatibility with newer versions of breezy. |
385 |
def initialize(self, a_controldir, name=None, repository=None, |
0.200.1378
by Jelmer Vernooij
Fix branch. |
386 |
append_revisions_only=None): |
0.295.2
by Jelmer Vernooij
Make RemoteGitBranchFormat uninitializeable. |
387 |
raise NotImplementedError(self.initialize) |
0.200.1097
by Jelmer Vernooij
Implement GitBranchFormat.initialize. |
388 |
|
0.200.1728
by Jelmer Vernooij
Support following branch references. |
389 |
def get_reference(self, controldir, name=None): |
7142.3.1
by Jelmer Vernooij
Support .nick on remote branches and fix get_branch_reference. |
390 |
return controldir.get_branch_reference(name=name) |
0.200.1728
by Jelmer Vernooij
Support following branch references. |
391 |
|
392 |
def set_reference(self, controldir, name, target): |
|
393 |
return controldir.set_branch_reference(target, name) |
|
394 |
||
7339.1.2
by Jelmer Vernooij
Add stores_revno method to BranchFormat. |
395 |
def stores_revno(self): |
396 |
"""True if this branch format store revision numbers.""" |
|
397 |
return False |
|
398 |
||
7449.2.4
by Jelmer Vernooij
Set BranchFormat.supports_reference_locations everywhere. |
399 |
supports_reference_locations = False |
400 |
||
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
401 |
|
0.295.1
by Jelmer Vernooij
Split up branch formats. |
402 |
class LocalGitBranchFormat(GitBranchFormat): |
403 |
||
404 |
def get_format_description(self): |
|
405 |
return 'Local Git Branch' |
|
406 |
||
407 |
@property
|
|
408 |
def _matchingcontroldir(self): |
|
409 |
from .dir import LocalGitControlDirFormat |
|
410 |
return LocalGitControlDirFormat() |
|
411 |
||
0.295.2
by Jelmer Vernooij
Make RemoteGitBranchFormat uninitializeable. |
412 |
def initialize(self, a_controldir, name=None, repository=None, |
413 |
append_revisions_only=None): |
|
414 |
from .dir import LocalGitDir |
|
415 |
if not isinstance(a_controldir, LocalGitDir): |
|
416 |
raise errors.IncompatibleFormat(self, a_controldir._format) |
|
7143.15.3
by Jelmer Vernooij
Fix pep8 issues in breezy.git. |
417 |
return a_controldir.create_branch( |
418 |
repository=repository, name=name, |
|
419 |
append_revisions_only=append_revisions_only) |
|
0.295.2
by Jelmer Vernooij
Make RemoteGitBranchFormat uninitializeable. |
420 |
|
0.295.1
by Jelmer Vernooij
Split up branch formats. |
421 |
|
0.200.388
by Jelmer Vernooij
Support bzr 1.14 as well. |
422 |
class GitBranch(ForeignBranch): |
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
423 |
"""An adapter to git repositories for bzr Branch objects.""" |
424 |
||
0.200.1129
by Jelmer Vernooij
Implement GitBranch.control_transport. |
425 |
@property
|
426 |
def control_transport(self): |
|
0.310.16
by Jelmer Vernooij
Update xfail. |
427 |
return self._control_transport |
0.306.1
by Jelmer Vernooij
Set correct segment parameters on branches. |
428 |
|
0.310.14
by Jelmer Vernooij
merge lightweight checkout-in-git support. |
429 |
@property
|
430 |
def user_transport(self): |
|
431 |
return self._user_transport |
|
432 |
||
0.295.1
by Jelmer Vernooij
Split up branch formats. |
433 |
def __init__(self, controldir, repository, ref, format): |
0.200.82
by Jelmer Vernooij
Support listing tags. |
434 |
self.repository = repository |
0.295.1
by Jelmer Vernooij
Split up branch formats. |
435 |
self._format = format |
0.200.1648
by Jelmer Vernooij
Fix compatibility with newer versions of breezy. |
436 |
self.controldir = controldir |
0.200.1250
by Jelmer Vernooij
Simplify lock handling. |
437 |
self._lock_mode = None |
438 |
self._lock_count = 0 |
|
0.231.1
by Jelmer Vernooij
Check that regenerated objects have the expected sha1. |
439 |
super(GitBranch, self).__init__(repository.get_mapping()) |
0.200.770
by Jelmer Vernooij
Proper branch names. |
440 |
self.ref = ref |
0.200.1708
by Jelmer Vernooij
Fix to colocated branch tests. |
441 |
self._head = None |
0.310.14
by Jelmer Vernooij
merge lightweight checkout-in-git support. |
442 |
self._user_transport = controldir.user_transport.clone('.') |
0.310.16
by Jelmer Vernooij
Update xfail. |
443 |
self._control_transport = controldir.control_transport.clone('.') |
0.346.1
by Jelmer Vernooij
Fix tag caching. |
444 |
self._tag_refs = None |
0.306.1
by Jelmer Vernooij
Set correct segment parameters on branches. |
445 |
params = {} |
0.200.1361
by Jelmer Vernooij
Support branches where the ref can't be mapped back to a branch name. |
446 |
try: |
447 |
self.name = ref_to_branch_name(ref) |
|
448 |
except ValueError: |
|
449 |
self.name = None |
|
0.200.1708
by Jelmer Vernooij
Fix to colocated branch tests. |
450 |
if self.ref is not None: |
0.310.16
by Jelmer Vernooij
Update xfail. |
451 |
params = {"ref": urlutils.escape(self.ref)} |
0.200.1708
by Jelmer Vernooij
Fix to colocated branch tests. |
452 |
else: |
453 |
if self.name != "": |
|
0.310.16
by Jelmer Vernooij
Update xfail. |
454 |
params = {"branch": urlutils.escape(self.name)} |
455 |
for k, v in params.items(): |
|
456 |
self._user_transport.set_segment_parameter(k, v) |
|
457 |
self._control_transport.set_segment_parameter(k, v) |
|
0.310.14
by Jelmer Vernooij
merge lightweight checkout-in-git support. |
458 |
self.base = controldir.user_transport.base |
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
459 |
|
0.200.1360
by Jelmer Vernooij
Support lighweight argument to _get_checkout_format. |
460 |
def _get_checkout_format(self, lightweight=False): |
0.239.8
by Jelmer Vernooij
Support checkouts. |
461 |
"""Return the most suitable metadir for a checkout of this branch. |
462 |
Weaves are used if this branch's repository uses weaves.
|
|
463 |
"""
|
|
0.311.1
by Jelmer Vernooij
Support git lightweight checkouts. |
464 |
if lightweight: |
465 |
return controldir.format_registry.make_controldir("git") |
|
466 |
else: |
|
467 |
return controldir.format_registry.make_controldir("default") |
|
0.239.8
by Jelmer Vernooij
Support checkouts. |
468 |
|
0.238.3
by Jelmer Vernooij
Remove svn references, prefer git send format when submitting changes against a git branch. |
469 |
def get_child_submit_format(self): |
470 |
"""Return the preferred format of submissions to this branch.""" |
|
0.200.1584
by Jelmer Vernooij
Use config stacks in a few more places. |
471 |
ret = self.get_config_stack().get("child_submit_format") |
0.238.3
by Jelmer Vernooij
Remove svn references, prefer git send format when submitting changes against a git branch. |
472 |
if ret is not None: |
473 |
return ret |
|
474 |
return "git" |
|
475 |
||
0.200.1397
by Jelmer Vernooij
Fix use of get_config() for RemoteGitBranch. |
476 |
def get_config(self): |
477 |
return GitBranchConfig(self) |
|
478 |
||
0.200.1472
by Jelmer Vernooij
Provide basic implementation of Branch.get_config_stack. |
479 |
def get_config_stack(self): |
480 |
return GitBranchStack(self) |
|
481 |
||
0.200.293
by Jelmer Vernooij
Fix branch nicks. |
482 |
def _get_nick(self, local=False, possible_master_transports=None): |
483 |
"""Find the nick name for this branch. |
|
484 |
||
485 |
:return: Branch nick
|
|
486 |
"""
|
|
7131.14.1
by Jelmer Vernooij
Fix committing to a bzr branch bound to a git branch. |
487 |
if getattr(self.repository, '_git', None): |
488 |
cs = self.repository._git.get_config_stack() |
|
489 |
try: |
|
7143.15.12
by Jelmer Vernooij
Merge trunk. |
490 |
return cs.get((b"branch", self.name.encode('utf-8')), |
7143.16.21
by Jelmer Vernooij
Fix regressions. |
491 |
b"nick").decode("utf-8") |
7131.14.1
by Jelmer Vernooij
Fix committing to a bzr branch bound to a git branch. |
492 |
except KeyError: |
493 |
pass
|
|
0.200.1694
by Jelmer Vernooij
Fix nick test. |
494 |
return self.name or u"HEAD" |
0.200.293
by Jelmer Vernooij
Fix branch nicks. |
495 |
|
0.200.331
by Jelmer Vernooij
Add stub for setting nick function. |
496 |
def _set_nick(self, nick): |
0.200.1547
by Jelmer Vernooij
Support setting branch nicks. |
497 |
cf = self.repository._git.get_config() |
7143.15.2
by Jelmer Vernooij
Run autopep8. |
498 |
cf.set((b"branch", self.name.encode('utf-8')), |
499 |
b"nick", nick.encode("utf-8")) |
|
6964.2.1
by Jelmer Vernooij
Initial work to support brz-git on python3. |
500 |
f = BytesIO() |
0.200.1547
by Jelmer Vernooij
Support setting branch nicks. |
501 |
cf.write_to_file(f) |
0.288.3
by Jelmer Vernooij
Fix parent URL handling. |
502 |
self.repository._git._put_named_file('config', f.getvalue()) |
0.200.331
by Jelmer Vernooij
Add stub for setting nick function. |
503 |
|
504 |
nick = property(_get_nick, _set_nick) |
|
0.200.293
by Jelmer Vernooij
Fix branch nicks. |
505 |
|
0.200.412
by Jelmer Vernooij
Implement GitBranch.__repr__. |
506 |
def __repr__(self): |
0.200.770
by Jelmer Vernooij
Proper branch names. |
507 |
return "<%s(%r, %r)>" % (self.__class__.__name__, self.repository.base, |
7143.15.2
by Jelmer Vernooij
Run autopep8. |
508 |
self.name) |
0.200.412
by Jelmer Vernooij
Implement GitBranch.__repr__. |
509 |
|
7143.15.3
by Jelmer Vernooij
Fix pep8 issues in breezy.git. |
510 |
def generate_revision_history(self, revid, last_rev=None, |
511 |
other_branch=None): |
|
0.296.2
by Jelmer Vernooij
Handle DivergedBranches. |
512 |
if last_rev is not None: |
513 |
graph = self.repository.get_graph() |
|
514 |
if not graph.is_ancestor(last_rev, revid): |
|
515 |
# our previous tip is not merged into stop_revision
|
|
516 |
raise errors.DivergedBranches(self, other_branch) |
|
517 |
||
0.297.2
by Jelmer Vernooij
Simplify Branch.generate_revision_history. |
518 |
self.set_last_revision(revid) |
0.200.334
by Jelmer Vernooij
Support pulling from git to git. |
519 |
|
0.200.1199
by Jelmer Vernooij
Support 'token' argument to Branch.lock_write. |
520 |
def lock_write(self, token=None): |
521 |
if token is not None: |
|
522 |
raise errors.TokenLockingNotSupported(self) |
|
0.200.1250
by Jelmer Vernooij
Simplify lock handling. |
523 |
if self._lock_mode: |
0.200.1369
by Jelmer Vernooij
Clarify that ghost tags are not supported. |
524 |
if self._lock_mode == 'r': |
525 |
raise errors.ReadOnlyError(self) |
|
0.200.1250
by Jelmer Vernooij
Simplify lock handling. |
526 |
self._lock_count += 1 |
527 |
else: |
|
0.383.1
by Jelmer Vernooij
Fix a bunch of locking issues. |
528 |
self._lock_ref() |
0.200.1250
by Jelmer Vernooij
Simplify lock handling. |
529 |
self._lock_mode = 'w' |
530 |
self._lock_count = 1 |
|
531 |
self.repository.lock_write() |
|
0.200.1670
by Jelmer Vernooij
Fix compatibility with newer versions of bzr. |
532 |
return lock.LogicalLockResult(self.unlock) |
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
533 |
|
0.200.1453
by Jelmer Vernooij
Provide Branch.leave_lock_in_place and Branch.dont_leave_lock_in_place. |
534 |
def leave_lock_in_place(self): |
535 |
raise NotImplementedError(self.leave_lock_in_place) |
|
536 |
||
537 |
def dont_leave_lock_in_place(self): |
|
538 |
raise NotImplementedError(self.dont_leave_lock_in_place) |
|
539 |
||
0.200.139
by Jelmer Vernooij
Share more code between local and remote classes, support opening remote branches. |
540 |
def get_stacked_on_url(self): |
541 |
# Git doesn't do stacking (yet...)
|
|
0.200.1660
by Jelmer Vernooij
Fix imports. |
542 |
raise branch.UnstackableBranchFormat(self._format, self.base) |
0.200.139
by Jelmer Vernooij
Share more code between local and remote classes, support opening remote branches. |
543 |
|
7141.8.1
by Jelmer Vernooij
Read parent branch properly from git config. |
544 |
def _get_push_origin(self, cs): |
7141.8.3
by Jelmer Vernooij
Review comments. |
545 |
"""Get the name for the push origin. |
546 |
||
547 |
The exact behaviour is documented in the git-config(1) manpage.
|
|
548 |
"""
|
|
7141.8.1
by Jelmer Vernooij
Read parent branch properly from git config. |
549 |
try: |
7141.8.3
by Jelmer Vernooij
Review comments. |
550 |
return cs.get((b'branch', self.name.encode('utf-8')), b'pushRemote') |
7141.8.1
by Jelmer Vernooij
Read parent branch properly from git config. |
551 |
except KeyError: |
552 |
try: |
|
7141.8.3
by Jelmer Vernooij
Review comments. |
553 |
return cs.get((b'branch', ), b'remote') |
7141.8.1
by Jelmer Vernooij
Read parent branch properly from git config. |
554 |
except KeyError: |
555 |
try: |
|
7141.8.3
by Jelmer Vernooij
Review comments. |
556 |
return cs.get((b'branch', self.name.encode('utf-8')), b'remote') |
7141.8.1
by Jelmer Vernooij
Read parent branch properly from git config. |
557 |
except KeyError: |
558 |
return b'origin' |
|
559 |
||
560 |
def _get_origin(self, cs): |
|
561 |
try: |
|
7141.8.3
by Jelmer Vernooij
Review comments. |
562 |
return cs.get((b'branch', self.name.encode('utf-8')), b'remote') |
7141.8.1
by Jelmer Vernooij
Read parent branch properly from git config. |
563 |
except KeyError: |
564 |
return b'origin' |
|
565 |
||
566 |
def _get_related_push_branch(self, cs): |
|
567 |
remote = self._get_push_origin(cs) |
|
568 |
try: |
|
569 |
location = cs.get((b"remote", remote), b"url") |
|
570 |
except KeyError: |
|
571 |
return None |
|
572 |
||
573 |
return git_url_to_bzr_url(location.decode('utf-8'), ref=self.ref) |
|
574 |
||
575 |
def _get_related_merge_branch(self, cs): |
|
576 |
remote = self._get_origin(cs) |
|
577 |
try: |
|
578 |
location = cs.get((b"remote", remote), b"url") |
|
579 |
except KeyError: |
|
580 |
return None |
|
581 |
||
582 |
try: |
|
7141.8.3
by Jelmer Vernooij
Review comments. |
583 |
ref = cs.get((b"branch", remote), b"merge") |
7141.8.1
by Jelmer Vernooij
Read parent branch properly from git config. |
584 |
except KeyError: |
585 |
ref = self.ref |
|
586 |
||
587 |
return git_url_to_bzr_url(location.decode('utf-8'), ref=ref) |
|
588 |
||
0.288.3
by Jelmer Vernooij
Fix parent URL handling. |
589 |
def _get_parent_location(self): |
0.200.139
by Jelmer Vernooij
Share more code between local and remote classes, support opening remote branches. |
590 |
"""See Branch.get_parent().""" |
0.288.3
by Jelmer Vernooij
Fix parent URL handling. |
591 |
cs = self.repository._git.get_config_stack() |
7141.8.1
by Jelmer Vernooij
Read parent branch properly from git config. |
592 |
return self._get_related_merge_branch(cs) |
593 |
||
594 |
def _write_git_config(self, cs): |
|
595 |
f = BytesIO() |
|
596 |
cs.write_to_file(f) |
|
597 |
self.repository._git._put_named_file('config', f.getvalue()) |
|
0.200.139
by Jelmer Vernooij
Share more code between local and remote classes, support opening remote branches. |
598 |
|
0.288.3
by Jelmer Vernooij
Fix parent URL handling. |
599 |
def set_parent(self, location): |
600 |
cs = self.repository._git.get_config() |
|
7141.8.1
by Jelmer Vernooij
Read parent branch properly from git config. |
601 |
remote = self._get_origin(cs) |
7441.1.1
by Jelmer Vernooij
Add strip_segment_parameters function. |
602 |
this_url = urlutils.strip_segment_parameters(self.user_url) |
7141.8.1
by Jelmer Vernooij
Read parent branch properly from git config. |
603 |
target_url, branch, ref = bzr_url_to_git_url(location) |
0.408.4
by Jelmer Vernooij
Fix some tests. |
604 |
location = urlutils.relative_url(this_url, target_url) |
7141.8.1
by Jelmer Vernooij
Read parent branch properly from git config. |
605 |
cs.set((b"remote", remote), b"url", location) |
606 |
if branch: |
|
7141.8.3
by Jelmer Vernooij
Review comments. |
607 |
cs.set((b"branch", remote), b"merge", branch_name_to_ref(branch)) |
7141.8.1
by Jelmer Vernooij
Read parent branch properly from git config. |
608 |
elif ref: |
7141.8.3
by Jelmer Vernooij
Review comments. |
609 |
cs.set((b"branch", remote), b"merge", ref) |
0.408.4
by Jelmer Vernooij
Fix some tests. |
610 |
else: |
611 |
# TODO(jelmer): Maybe unset rather than setting to HEAD?
|
|
7141.8.3
by Jelmer Vernooij
Review comments. |
612 |
cs.set((b"branch", remote), b"merge", b'HEAD') |
7141.8.1
by Jelmer Vernooij
Read parent branch properly from git config. |
613 |
self._write_git_config(cs) |
0.200.175
by Jelmer Vernooij
Add optimized handling when fetching from git to git. |
614 |
|
0.200.1411
by Jelmer Vernooij
Fix control files. |
615 |
def break_lock(self): |
616 |
raise NotImplementedError(self.break_lock) |
|
617 |
||
0.200.139
by Jelmer Vernooij
Share more code between local and remote classes, support opening remote branches. |
618 |
def lock_read(self): |
0.200.1250
by Jelmer Vernooij
Simplify lock handling. |
619 |
if self._lock_mode: |
0.361.1
by Jelmer Vernooij
Don't use assert. |
620 |
if self._lock_mode not in ('r', 'w'): |
621 |
raise ValueError(self._lock_mode) |
|
0.200.1250
by Jelmer Vernooij
Simplify lock handling. |
622 |
self._lock_count += 1 |
623 |
else: |
|
624 |
self._lock_mode = 'r' |
|
625 |
self._lock_count = 1 |
|
626 |
self.repository.lock_read() |
|
0.200.1670
by Jelmer Vernooij
Fix compatibility with newer versions of bzr. |
627 |
return lock.LogicalLockResult(self.unlock) |
0.200.139
by Jelmer Vernooij
Share more code between local and remote classes, support opening remote branches. |
628 |
|
0.200.1250
by Jelmer Vernooij
Simplify lock handling. |
629 |
def peek_lock_mode(self): |
630 |
return self._lock_mode |
|
631 |
||
0.200.432
by Jelmer Vernooij
Support Branch.is_locked, required for loggerhead. |
632 |
def is_locked(self): |
0.200.1250
by Jelmer Vernooij
Simplify lock handling. |
633 |
return (self._lock_mode is not None) |
0.200.432
by Jelmer Vernooij
Support Branch.is_locked, required for loggerhead. |
634 |
|
0.383.1
by Jelmer Vernooij
Fix a bunch of locking issues. |
635 |
def _lock_ref(self): |
636 |
pass
|
|
637 |
||
638 |
def _unlock_ref(self): |
|
639 |
pass
|
|
640 |
||
0.200.139
by Jelmer Vernooij
Share more code between local and remote classes, support opening remote branches. |
641 |
def unlock(self): |
0.200.1250
by Jelmer Vernooij
Simplify lock handling. |
642 |
"""See Branch.unlock().""" |
643 |
if self._lock_count == 0: |
|
0.383.1
by Jelmer Vernooij
Fix a bunch of locking issues. |
644 |
raise errors.LockNotHeld(self) |
645 |
try: |
|
646 |
self._lock_count -= 1 |
|
647 |
if self._lock_count == 0: |
|
648 |
if self._lock_mode == 'w': |
|
649 |
self._unlock_ref() |
|
650 |
self._lock_mode = None |
|
651 |
self._clear_cached_state() |
|
652 |
finally: |
|
653 |
self.repository.unlock() |
|
0.200.139
by Jelmer Vernooij
Share more code between local and remote classes, support opening remote branches. |
654 |
|
655 |
def get_physical_lock_status(self): |
|
656 |
return False |
|
657 |
||
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
658 |
def last_revision(self): |
0.200.1675
by Jelmer Vernooij
Remove uses of decorators. |
659 |
with self.lock_read(): |
660 |
# perhaps should escape this ?
|
|
661 |
if self.head is None: |
|
662 |
return revision.NULL_REVISION |
|
663 |
return self.lookup_foreign_revision_id(self.head) |
|
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
664 |
|
7489.4.4
by Jelmer Vernooij
Add more tests. |
665 |
def _basic_push(self, target, overwrite=False, stop_revision=None, |
666 |
tag_selector=None): |
|
0.200.501
by Jelmer Vernooij
Support push from git into bzr. |
667 |
return branch.InterBranch.get(self, target)._basic_push( |
7489.4.2
by Jelmer Vernooij
Plumb through tag_selector. |
668 |
overwrite, stop_revision, tag_selector=tag_selector) |
0.200.501
by Jelmer Vernooij
Support push from git into bzr. |
669 |
|
0.252.49
by Jelmer Vernooij
Avoid trying to set HEAD for remote branches. |
670 |
def lookup_foreign_revision_id(self, foreign_revid): |
0.200.1760
by Jelmer Vernooij
Fall back to simple revision id generation. |
671 |
try: |
672 |
return self.repository.lookup_foreign_revision_id(foreign_revid, |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
673 |
self.mapping) |
0.200.1760
by Jelmer Vernooij
Fall back to simple revision id generation. |
674 |
except KeyError: |
675 |
# Let's try..
|
|
676 |
return self.mapping.revision_id_foreign_to_bzr(foreign_revid) |
|
0.252.49
by Jelmer Vernooij
Avoid trying to set HEAD for remote branches. |
677 |
|
0.200.1030
by Jelmer Vernooij
More work on supporting roundtripping push. |
678 |
def lookup_bzr_revision_id(self, revid): |
679 |
return self.repository.lookup_bzr_revision_id( |
|
680 |
revid, mapping=self.mapping) |
|
681 |
||
0.200.1678
by Jelmer Vernooij
Fix tests. |
682 |
def get_unshelver(self, tree): |
683 |
raise errors.StoringUncommittedNotSupported(self) |
|
684 |
||
0.346.1
by Jelmer Vernooij
Fix tag caching. |
685 |
def _clear_cached_state(self): |
686 |
super(GitBranch, self)._clear_cached_state() |
|
687 |
self._tag_refs = None |
|
688 |
||
689 |
def _iter_tag_refs(self, refs): |
|
690 |
"""Iterate over the tag refs. |
|
691 |
||
692 |
:param refs: Refs dictionary (name -> git sha1)
|
|
693 |
:return: iterator over (ref_name, tag_name, peeled_sha1, unpeeled_sha1)
|
|
694 |
"""
|
|
695 |
raise NotImplementedError(self._iter_tag_refs) |
|
696 |
||
0.375.1
by Jelmer Vernooij
Fix remote tests, warn when fetching git->bzr and bzr->git. |
697 |
def get_tag_refs(self): |
698 |
with self.lock_read(): |
|
699 |
if self._tag_refs is None: |
|
700 |
self._tag_refs = list(self._iter_tag_refs()) |
|
701 |
return self._tag_refs |
|
702 |
||
7131.14.1
by Jelmer Vernooij
Fix committing to a bzr branch bound to a git branch. |
703 |
def import_last_revision_info_and_tags(self, source, revno, revid, |
704 |
lossy=False): |
|
705 |
"""Set the last revision info, importing from another repo if necessary. |
|
706 |
||
707 |
This is used by the bound branch code to upload a revision to
|
|
708 |
the master branch first before updating the tip of the local branch.
|
|
709 |
Revisions referenced by source's tags are also transferred.
|
|
710 |
||
711 |
:param source: Source branch to optionally fetch from
|
|
712 |
:param revno: Revision number of the new tip
|
|
713 |
:param revid: Revision id of the new tip
|
|
714 |
:param lossy: Whether to discard metadata that can not be
|
|
715 |
natively represented
|
|
716 |
:return: Tuple with the new revision number and revision id
|
|
717 |
(should only be different from the arguments when lossy=True)
|
|
718 |
"""
|
|
7131.14.2
by Jelmer Vernooij
Make sure resulting branch is correct too. |
719 |
push_result = source.push( |
720 |
self, stop_revision=revid, lossy=lossy, _stop_revno=revno) |
|
721 |
return (push_result.new_revno, push_result.new_revid) |
|
7131.14.1
by Jelmer Vernooij
Fix committing to a bzr branch bound to a git branch. |
722 |
|
7206.6.4
by Jelmer Vernooij
Move reconcile logic to breezy.bzr.reconcile. |
723 |
def reconcile(self, thorough=True): |
724 |
"""Make sure the data stored in this branch is consistent.""" |
|
725 |
from ..reconcile import ReconcileResult |
|
726 |
# Nothing to do here
|
|
727 |
return ReconcileResult() |
|
728 |
||
0.200.692
by Jelmer Vernooij
Refuse pulling into non-rich-root branches rather than erroring out with an AttributeError. |
729 |
|
0.200.465
by Jelmer Vernooij
Use dulwich standard functionality for finding missing revisions. |
730 |
class LocalGitBranch(GitBranch): |
731 |
"""A local Git branch.""" |
|
732 |
||
0.200.1648
by Jelmer Vernooij
Fix compatibility with newer versions of breezy. |
733 |
def __init__(self, controldir, repository, ref): |
0.295.1
by Jelmer Vernooij
Split up branch formats. |
734 |
super(LocalGitBranch, self).__init__(controldir, repository, ref, |
7143.15.2
by Jelmer Vernooij
Run autopep8. |
735 |
LocalGitBranchFormat()) |
0.200.763
by Jelmer Vernooij
Provide proper colocated branch support. |
736 |
|
0.200.261
by Jelmer Vernooij
More formatting fixes. |
737 |
def create_checkout(self, to_location, revision_id=None, lightweight=False, |
7143.15.2
by Jelmer Vernooij
Run autopep8. |
738 |
accelerator_tree=None, hardlink=False): |
0.200.1774
by Jelmer Vernooij
Simplify checkout creation. |
739 |
t = transport.get_transport(to_location) |
740 |
t.ensure_base() |
|
741 |
format = self._get_checkout_format(lightweight=lightweight) |
|
742 |
checkout = format.initialize_on_transport(t) |
|
0.200.210
by Jelmer Vernooij
properly error out about not support lightweight checkouts. |
743 |
if lightweight: |
0.200.1774
by Jelmer Vernooij
Simplify checkout creation. |
744 |
from_branch = checkout.set_branch_reference(target_branch=self) |
745 |
else: |
|
7143.15.14
by Jelmer Vernooij
Fix repo acquisition. |
746 |
policy = checkout.determine_repository_policy() |
747 |
policy.acquire_repository() |
|
0.200.1774
by Jelmer Vernooij
Simplify checkout creation. |
748 |
checkout_branch = checkout.create_branch() |
749 |
checkout_branch.bind(self) |
|
750 |
checkout_branch.pull(self, stop_revision=revision_id) |
|
751 |
from_branch = None |
|
7143.15.3
by Jelmer Vernooij
Fix pep8 issues in breezy.git. |
752 |
return checkout.create_workingtree( |
753 |
revision_id, from_branch=from_branch, hardlink=hardlink) |
|
0.200.210
by Jelmer Vernooij
properly error out about not support lightweight checkouts. |
754 |
|
0.383.1
by Jelmer Vernooij
Fix a bunch of locking issues. |
755 |
def _lock_ref(self): |
756 |
self._ref_lock = self.repository._git.refs.lock_ref(self.ref) |
|
757 |
||
758 |
def _unlock_ref(self): |
|
759 |
self._ref_lock.unlock() |
|
760 |
||
0.412.1
by Jelmer Vernooij
Implement Branch.break_lock. |
761 |
def break_lock(self): |
762 |
self.repository._git.refs.unlock_ref(self.ref) |
|
763 |
||
0.200.57
by Jelmer Vernooij
Fix more tests. |
764 |
def _gen_revision_history(self): |
0.200.58
by Jelmer Vernooij
Fix remaining tests. |
765 |
if self.head is None: |
766 |
return [] |
|
6968.1.1
by Jelmer Vernooij
Support 'bzr version-info' in horizon branches. |
767 |
last_revid = self.last_revision() |
0.200.1279
by Jelmer Vernooij
Avoid using deprecated Repository.iter_reverse_revision_history. |
768 |
graph = self.repository.get_graph() |
6968.1.1
by Jelmer Vernooij
Support 'bzr version-info' in horizon branches. |
769 |
try: |
7143.15.3
by Jelmer Vernooij
Fix pep8 issues in breezy.git. |
770 |
ret = list(graph.iter_lefthand_ancestry( |
771 |
last_revid, (revision.NULL_REVISION, ))) |
|
6968.1.1
by Jelmer Vernooij
Support 'bzr version-info' in horizon branches. |
772 |
except errors.RevisionNotPresent as e: |
773 |
raise errors.GhostRevisionsHaveNoRevno(last_revid, e.revision_id) |
|
0.200.59
by Jelmer Vernooij
Add more tests, fix revision history. |
774 |
ret.reverse() |
0.200.57
by Jelmer Vernooij
Fix more tests. |
775 |
return ret |
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
776 |
|
0.200.461
by Jelmer Vernooij
Reduce number of round trips when fetching from Git. |
777 |
def _get_head(self): |
0.200.480
by Jelmer Vernooij
Cope with API changes in Dulwich. |
778 |
try: |
0.336.2
by Jelmer Vernooij
Don't use ZERO_SHA outside of remote communication to indicate empty history. |
779 |
return self.repository._git.refs[self.ref] |
0.200.480
by Jelmer Vernooij
Cope with API changes in Dulwich. |
780 |
except KeyError: |
781 |
return None |
|
0.200.461
by Jelmer Vernooij
Reduce number of round trips when fetching from Git. |
782 |
|
0.200.1228
by Jelmer Vernooij
Provide Branch._read_last_revision_info. |
783 |
def _read_last_revision_info(self): |
784 |
last_revid = self.last_revision() |
|
785 |
graph = self.repository.get_graph() |
|
7143.8.1
by Jelmer Vernooij
Cope with the revno not being known. |
786 |
try: |
7143.15.6
by Jelmer Vernooij
Merge trunk. |
787 |
revno = graph.find_distance_to_null( |
788 |
last_revid, [(revision.NULL_REVISION, 0)]) |
|
7143.8.1
by Jelmer Vernooij
Cope with the revno not being known. |
789 |
except errors.GhostRevisionsHaveNoRevno: |
790 |
revno = None |
|
0.200.1228
by Jelmer Vernooij
Provide Branch._read_last_revision_info. |
791 |
return revno, last_revid |
792 |
||
793 |
def set_last_revision_info(self, revno, revision_id): |
|
794 |
self.set_last_revision(revision_id) |
|
795 |
self._last_revision_info_cache = revno, revision_id |
|
0.200.507
by Jelmer Vernooij
Implement set_last_revision{_info,}. |
796 |
|
797 |
def set_last_revision(self, revid): |
|
6964.2.1
by Jelmer Vernooij
Initial work to support brz-git on python3. |
798 |
if not revid or not isinstance(revid, bytes): |
0.200.1233
by Jelmer Vernooij
Implement Repository.iter_files_bytes. |
799 |
raise errors.InvalidRevisionId(revision_id=revid, branch=self) |
0.200.1218
by Jelmer Vernooij
Support set_last_revision('null:'). |
800 |
if revid == NULL_REVISION: |
0.336.2
by Jelmer Vernooij
Don't use ZERO_SHA outside of remote communication to indicate empty history. |
801 |
newhead = None |
0.200.1218
by Jelmer Vernooij
Support set_last_revision('null:'). |
802 |
else: |
7143.15.3
by Jelmer Vernooij
Fix pep8 issues in breezy.git. |
803 |
(newhead, self.mapping) = self.repository.lookup_bzr_revision_id( |
804 |
revid) |
|
0.200.1218
by Jelmer Vernooij
Support set_last_revision('null:'). |
805 |
if self.mapping is None: |
806 |
raise AssertionError |
|
807 |
self._set_head(newhead) |
|
0.200.507
by Jelmer Vernooij
Implement set_last_revision{_info,}. |
808 |
|
0.200.461
by Jelmer Vernooij
Reduce number of round trips when fetching from Git. |
809 |
def _set_head(self, value): |
0.361.1
by Jelmer Vernooij
Don't use assert. |
810 |
if value == ZERO_SHA: |
811 |
raise ValueError(value) |
|
0.200.461
by Jelmer Vernooij
Reduce number of round trips when fetching from Git. |
812 |
self._head = value |
0.336.2
by Jelmer Vernooij
Don't use ZERO_SHA outside of remote communication to indicate empty history. |
813 |
if value is None: |
814 |
del self.repository._git.refs[self.ref] |
|
815 |
else: |
|
816 |
self.repository._git.refs[self.ref] = self._head |
|
0.200.461
by Jelmer Vernooij
Reduce number of round trips when fetching from Git. |
817 |
self._clear_cached_state() |
818 |
||
819 |
head = property(_get_head, _set_head) |
|
820 |
||
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
821 |
def get_push_location(self): |
822 |
"""See Branch.get_push_location.""" |
|
0.200.1584
by Jelmer Vernooij
Use config stacks in a few more places. |
823 |
push_loc = self.get_config_stack().get('push_location') |
7141.8.1
by Jelmer Vernooij
Read parent branch properly from git config. |
824 |
if push_loc is not None: |
825 |
return push_loc |
|
826 |
cs = self.repository._git.get_config_stack() |
|
827 |
return self._get_related_push_branch(cs) |
|
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
828 |
|
829 |
def set_push_location(self, location): |
|
830 |
"""See Branch.set_push_location.""" |
|
0.200.19
by John Arbash Meinel
More refactoring. Add some direct tests for GitModel. |
831 |
self.get_config().set_user_option('push_location', location, |
0.217.54
by John Carr
set_user_option breaks - doesnt have a local option in BranchConfig. Follow the bzr.dev syntax instead. |
832 |
store=config.STORE_LOCATION) |
0.200.43
by David Allouche
Ultra-experimental support for "bzr pull". No test. No sanity. |
833 |
|
834 |
def supports_tags(self): |
|
0.200.82
by Jelmer Vernooij
Support listing tags. |
835 |
return True |
0.200.956
by Jelmer Vernooij
Add some more format tests. |
836 |
|
0.200.1681
by Jelmer Vernooij
Provide Branch.store_uncommitted. |
837 |
def store_uncommitted(self, creator): |
838 |
raise errors.StoringUncommittedNotSupported(self) |
|
839 |
||
0.346.1
by Jelmer Vernooij
Fix tag caching. |
840 |
def _iter_tag_refs(self): |
841 |
"""Iterate over the tag refs. |
|
842 |
||
843 |
:param refs: Refs dictionary (name -> git sha1)
|
|
844 |
:return: iterator over (ref_name, tag_name, peeled_sha1, unpeeled_sha1)
|
|
845 |
"""
|
|
7371.2.1
by Jelmer Vernooij
Fix importing from remote git repositories. |
846 |
refs = self.repository.controldir.get_refs_container() |
7479.2.1
by Jelmer Vernooij
Drop python2 support. |
847 |
for ref_name, unpeeled in refs.as_dict().items(): |
0.346.1
by Jelmer Vernooij
Fix tag caching. |
848 |
try: |
849 |
tag_name = ref_to_tag_name(ref_name) |
|
850 |
except (ValueError, UnicodeDecodeError): |
|
851 |
continue
|
|
852 |
peeled = refs.get_peeled(ref_name) |
|
853 |
if peeled is None: |
|
0.382.1
by Jelmer Vernooij
Various fixes for annotated tags and symrefs. |
854 |
peeled = unpeeled |
7479.2.1
by Jelmer Vernooij
Drop python2 support. |
855 |
if not isinstance(tag_name, str): |
0.361.1
by Jelmer Vernooij
Don't use assert. |
856 |
raise TypeError(tag_name) |
0.346.1
by Jelmer Vernooij
Fix tag caching. |
857 |
yield (ref_name, tag_name, peeled, unpeeled) |
858 |
||
0.360.1
by Jelmer Vernooij
Implement GitMemoryTree. |
859 |
def create_memorytree(self): |
860 |
from .memorytree import GitMemoryTree |
|
7143.15.3
by Jelmer Vernooij
Fix pep8 issues in breezy.git. |
861 |
return GitMemoryTree(self, self.repository._git.object_store, |
862 |
self.head) |
|
0.360.1
by Jelmer Vernooij
Implement GitMemoryTree. |
863 |
|
0.200.225
by Jelmer Vernooij
Implement custom InterBranch to support fetching from remote git branches. |
864 |
|
0.200.1048
by Jelmer Vernooij
Make lookup of revno's after push/pull as efficient as possible. |
865 |
def _quick_lookup_revno(local_branch, remote_branch, revid): |
6973.13.2
by Jelmer Vernooij
Fix some more tests. |
866 |
if not isinstance(revid, bytes): |
0.361.1
by Jelmer Vernooij
Don't use assert. |
867 |
raise TypeError(revid) |
0.200.1048
by Jelmer Vernooij
Make lookup of revno's after push/pull as efficient as possible. |
868 |
# Try in source branch first, it'll be faster
|
0.200.1788
by Jelmer Vernooij
Use context managers. |
869 |
with local_branch.lock_read(): |
7339.1.6
by Jelmer Vernooij
Also support revno-less push/pull operations. |
870 |
if not _calculate_revnos(local_branch): |
871 |
return None |
|
0.200.1048
by Jelmer Vernooij
Make lookup of revno's after push/pull as efficient as possible. |
872 |
try: |
0.200.1362
by Jelmer Vernooij
Add locking. |
873 |
return local_branch.revision_id_to_revno(revid) |
874 |
except errors.NoSuchRevision: |
|
875 |
graph = local_branch.repository.get_graph() |
|
876 |
try: |
|
7143.15.3
by Jelmer Vernooij
Fix pep8 issues in breezy.git. |
877 |
return graph.find_distance_to_null( |
878 |
revid, [(revision.NULL_REVISION, 0)]) |
|
0.200.1362
by Jelmer Vernooij
Add locking. |
879 |
except errors.GhostRevisionsHaveNoRevno: |
7339.1.6
by Jelmer Vernooij
Also support revno-less push/pull operations. |
880 |
if not _calculate_revnos(remote_branch): |
881 |
return None |
|
0.200.1362
by Jelmer Vernooij
Add locking. |
882 |
# FIXME: Check using graph.find_distance_to_null() ?
|
0.200.1788
by Jelmer Vernooij
Use context managers. |
883 |
with remote_branch.lock_read(): |
0.200.1362
by Jelmer Vernooij
Add locking. |
884 |
return remote_branch.revision_id_to_revno(revid) |
0.200.1048
by Jelmer Vernooij
Make lookup of revno's after push/pull as efficient as possible. |
885 |
|
886 |
||
0.200.342
by Jelmer Vernooij
Report git sha during pull. |
887 |
class GitBranchPullResult(branch.PullResult): |
888 |
||
0.252.36
by Jelmer Vernooij
Fix pull. |
889 |
def __init__(self): |
890 |
super(GitBranchPullResult, self).__init__() |
|
891 |
self.new_git_head = None |
|
892 |
self._old_revno = None |
|
893 |
self._new_revno = None |
|
894 |
||
0.200.342
by Jelmer Vernooij
Report git sha during pull. |
895 |
def report(self, to_file): |
896 |
if not is_quiet(): |
|
897 |
if self.old_revid == self.new_revid: |
|
898 |
to_file.write('No revisions to pull.\n') |
|
0.200.728
by Jelmer Vernooij
Fix pulling when all revisions are already in the repo. |
899 |
elif self.new_git_head is not None: |
0.200.695
by Jelmer Vernooij
Clean up trailing whitespace. |
900 |
to_file.write('Now on revision %d (git sha: %s).\n' % |
7143.15.2
by Jelmer Vernooij
Run autopep8. |
901 |
(self.new_revno, self.new_git_head)) |
0.200.728
by Jelmer Vernooij
Fix pulling when all revisions are already in the repo. |
902 |
else: |
903 |
to_file.write('Now on revision %d.\n' % (self.new_revno,)) |
|
0.200.342
by Jelmer Vernooij
Report git sha during pull. |
904 |
self._show_tag_conficts(to_file) |
905 |
||
0.252.36
by Jelmer Vernooij
Fix pull. |
906 |
def _lookup_revno(self, revid): |
0.200.1185
by Jelmer Vernooij
Some formatting fixes. |
907 |
return _quick_lookup_revno(self.target_branch, self.source_branch, |
7143.15.2
by Jelmer Vernooij
Run autopep8. |
908 |
revid) |
0.252.36
by Jelmer Vernooij
Fix pull. |
909 |
|
910 |
def _get_old_revno(self): |
|
911 |
if self._old_revno is not None: |
|
912 |
return self._old_revno |
|
913 |
return self._lookup_revno(self.old_revid) |
|
914 |
||
915 |
def _set_old_revno(self, revno): |
|
916 |
self._old_revno = revno |
|
917 |
||
918 |
old_revno = property(_get_old_revno, _set_old_revno) |
|
919 |
||
920 |
def _get_new_revno(self): |
|
921 |
if self._new_revno is not None: |
|
922 |
return self._new_revno |
|
923 |
return self._lookup_revno(self.new_revid) |
|
924 |
||
925 |
def _set_new_revno(self, revno): |
|
926 |
self._new_revno = revno |
|
0.200.956
by Jelmer Vernooij
Add some more format tests. |
927 |
|
0.252.36
by Jelmer Vernooij
Fix pull. |
928 |
new_revno = property(_get_new_revno, _set_new_revno) |
929 |
||
0.200.342
by Jelmer Vernooij
Report git sha during pull. |
930 |
|
0.200.504
by Jelmer Vernooij
Lazily find revno's for git branches. |
931 |
class GitBranchPushResult(branch.BranchPushResult): |
932 |
||
933 |
def _lookup_revno(self, revid): |
|
0.200.1185
by Jelmer Vernooij
Some formatting fixes. |
934 |
return _quick_lookup_revno(self.source_branch, self.target_branch, |
7143.15.2
by Jelmer Vernooij
Run autopep8. |
935 |
revid) |
0.200.504
by Jelmer Vernooij
Lazily find revno's for git branches. |
936 |
|
937 |
@property
|
|
938 |
def old_revno(self): |
|
939 |
return self._lookup_revno(self.old_revid) |
|
940 |
||
941 |
@property
|
|
942 |
def new_revno(self): |
|
0.200.1048
by Jelmer Vernooij
Make lookup of revno's after push/pull as efficient as possible. |
943 |
new_original_revno = getattr(self, "new_original_revno", None) |
944 |
if new_original_revno: |
|
945 |
return new_original_revno |
|
946 |
if getattr(self, "new_original_revid", None) is not None: |
|
947 |
return self._lookup_revno(self.new_original_revid) |
|
0.200.504
by Jelmer Vernooij
Lazily find revno's for git branches. |
948 |
return self._lookup_revno(self.new_revid) |
949 |
||
950 |
||
0.200.501
by Jelmer Vernooij
Support push from git into bzr. |
951 |
class InterFromGitBranch(branch.GenericInterBranch): |
0.200.261
by Jelmer Vernooij
More formatting fixes. |
952 |
"""InterBranch implementation that pulls from Git into bzr.""" |
0.200.225
by Jelmer Vernooij
Implement custom InterBranch to support fetching from remote git branches. |
953 |
|
0.200.996
by Jelmer Vernooij
Fix test run of InterBranches. |
954 |
@staticmethod
|
955 |
def _get_branch_formats_to_test(): |
|
0.200.1100
by Jelmer Vernooij
Provide test combinations for InterBranch implementations. |
956 |
try: |
957 |
default_format = branch.format_registry.get_default() |
|
958 |
except AttributeError: |
|
959 |
default_format = branch.BranchFormat._default_format |
|
0.295.4
by Jelmer Vernooij
Fix imports. |
960 |
from .remote import RemoteGitBranchFormat |
0.200.1100
by Jelmer Vernooij
Provide test combinations for InterBranch implementations. |
961 |
return [ |
0.295.1
by Jelmer Vernooij
Split up branch formats. |
962 |
(RemoteGitBranchFormat(), default_format), |
963 |
(LocalGitBranchFormat(), default_format)] |
|
0.200.996
by Jelmer Vernooij
Fix test run of InterBranches. |
964 |
|
0.200.225
by Jelmer Vernooij
Implement custom InterBranch to support fetching from remote git branches. |
965 |
@classmethod
|
0.200.692
by Jelmer Vernooij
Refuse pulling into non-rich-root branches rather than erroring out with an AttributeError. |
966 |
def _get_interrepo(self, source, target): |
7143.15.3
by Jelmer Vernooij
Fix pep8 issues in breezy.git. |
967 |
return _mod_repository.InterRepository.get( |
968 |
source.repository, target.repository) |
|
0.200.692
by Jelmer Vernooij
Refuse pulling into non-rich-root branches rather than erroring out with an AttributeError. |
969 |
|
970 |
@classmethod
|
|
971 |
def is_compatible(cls, source, target): |
|
0.200.1222
by Jelmer Vernooij
Better checks in is_compatible methods. |
972 |
if not isinstance(source, GitBranch): |
973 |
return False |
|
974 |
if isinstance(target, GitBranch): |
|
975 |
# InterLocalGitRemoteGitBranch or InterToGitBranch should be used
|
|
976 |
return False |
|
7143.15.3
by Jelmer Vernooij
Fix pep8 issues in breezy.git. |
977 |
if (getattr(cls._get_interrepo(source, target), "fetch_objects", None) |
978 |
is None): |
|
0.200.1222
by Jelmer Vernooij
Better checks in is_compatible methods. |
979 |
# fetch_objects is necessary for this to work
|
980 |
return False |
|
981 |
return True |
|
0.200.225
by Jelmer Vernooij
Implement custom InterBranch to support fetching from remote git branches. |
982 |
|
7455.2.1
by Jelmer Vernooij
Return a FetchResult object from Repository.fetch / Branch.fetch. |
983 |
def fetch(self, stop_revision=None, fetch_tags=None, limit=None, lossy=False): |
984 |
self.fetch_objects( |
|
985 |
stop_revision, fetch_tags=fetch_tags, limit=limit, lossy=lossy) |
|
986 |
return _mod_repository.FetchResult() |
|
0.260.1
by Jelmer Vernooij
Fix fetch from remote during merge. |
987 |
|
7489.4.4
by Jelmer Vernooij
Add more tests. |
988 |
def fetch_objects(self, stop_revision, fetch_tags, limit=None, lossy=False, tag_selector=None): |
0.200.692
by Jelmer Vernooij
Refuse pulling into non-rich-root branches rather than erroring out with an AttributeError. |
989 |
interrepo = self._get_interrepo(self.source, self.target) |
0.200.1305
by Jelmer Vernooij
Only actually fetch tags if "branch.fetch_tags" is set to true. |
990 |
if fetch_tags is None: |
0.200.1584
by Jelmer Vernooij
Use config stacks in a few more places. |
991 |
c = self.source.get_config_stack() |
992 |
fetch_tags = c.get('branch.fetch_tags') |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
993 |
|
0.200.225
by Jelmer Vernooij
Implement custom InterBranch to support fetching from remote git branches. |
994 |
def determine_wants(heads): |
0.259.6
by Jelmer Vernooij
Fetch tags during pull. |
995 |
if stop_revision is None: |
0.336.6
by Jelmer Vernooij
Fix pull tests. |
996 |
try: |
0.200.917
by Jelmer Vernooij
Cope with implicit branches during pull. |
997 |
head = heads[self.source.ref] |
0.336.6
by Jelmer Vernooij
Fix pull tests. |
998 |
except KeyError: |
999 |
self._last_revid = revision.NULL_REVISION |
|
0.200.917
by Jelmer Vernooij
Cope with implicit branches during pull. |
1000 |
else: |
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1001 |
self._last_revid = self.source.lookup_foreign_revision_id( |
1002 |
head) |
|
0.259.6
by Jelmer Vernooij
Fetch tags during pull. |
1003 |
else: |
1004 |
self._last_revid = stop_revision |
|
1005 |
real = interrepo.get_determine_wants_revids( |
|
7489.4.4
by Jelmer Vernooij
Add more tests. |
1006 |
[self._last_revid], include_tags=fetch_tags, tag_selector=tag_selector) |
0.259.6
by Jelmer Vernooij
Fetch tags during pull. |
1007 |
return real(heads) |
0.200.1002
by Jelmer Vernooij
Fix regression in git-import. |
1008 |
pack_hint, head, refs = interrepo.fetch_objects( |
7455.2.1
by Jelmer Vernooij
Return a FetchResult object from Repository.fetch / Branch.fetch. |
1009 |
determine_wants, self.source.mapping, limit=limit, |
1010 |
lossy=lossy) |
|
0.252.45
by Jelmer Vernooij
Finish fetching roundtripped revisions back into bzr. |
1011 |
if (pack_hint is not None and |
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1012 |
self.target.repository._format.pack_compresses): |
0.248.5
by Jelmer Vernooij
Reformatting, fix dpush. |
1013 |
self.target.repository.pack(hint=pack_hint) |
0.260.1
by Jelmer Vernooij
Fix fetch from remote during merge. |
1014 |
return head, refs |
1015 |
||
7489.4.4
by Jelmer Vernooij
Add more tests. |
1016 |
def _update_revisions(self, stop_revision=None, overwrite=False, tag_selector=None): |
1017 |
head, refs = self.fetch_objects(stop_revision, fetch_tags=None, tag_selector=tag_selector) |
|
0.200.313
by Jelmer Vernooij
Support overwrite parameter. |
1018 |
if overwrite: |
0.200.314
by Jelmer Vernooij
Support stop_revision. |
1019 |
prev_last_revid = None |
0.200.313
by Jelmer Vernooij
Support overwrite parameter. |
1020 |
else: |
0.200.314
by Jelmer Vernooij
Support stop_revision. |
1021 |
prev_last_revid = self.target.last_revision() |
7143.15.3
by Jelmer Vernooij
Fix pep8 issues in breezy.git. |
1022 |
self.target.generate_revision_history( |
1023 |
self._last_revid, last_rev=prev_last_revid, |
|
1024 |
other_branch=self.source) |
|
0.200.1062
by Jelmer Vernooij
Pass remote refs along in _update_revisions. |
1025 |
return head, refs |
0.200.225
by Jelmer Vernooij
Implement custom InterBranch to support fetching from remote git branches. |
1026 |
|
7449.1.2
by Jelmer Vernooij
Fix git support. |
1027 |
def update_references(self, revid=None): |
1028 |
if revid is None: |
|
1029 |
revid = self.target.last_revision() |
|
1030 |
tree = self.target.repository.revision_tree(revid) |
|
1031 |
try: |
|
1032 |
with tree.get_file('.gitmodules') as f: |
|
1033 |
for path, url, section in parse_submodules( |
|
1034 |
GitConfigFile.from_file(f)): |
|
1035 |
self.target.set_reference_info( |
|
7458.1.1
by Jelmer Vernooij
Support importing Git submodules as tree references. |
1036 |
tree.path2id(path.decode('utf-8')), url.decode('utf-8'), |
1037 |
path.decode('utf-8')) |
|
7449.1.2
by Jelmer Vernooij
Fix git support. |
1038 |
except errors.NoSuchFile: |
1039 |
pass
|
|
1040 |
||
0.200.1423
by Jelmer Vernooij
Fix space. |
1041 |
def _basic_pull(self, stop_revision, overwrite, run_hooks, |
7489.4.2
by Jelmer Vernooij
Plumb through tag_selector. |
1042 |
_override_hook_target, _hook_master, tag_selector=None): |
0.343.1
by Jelmer Vernooij
Support overwrite flag properly, remove DictTagDict. |
1043 |
if overwrite is True: |
1044 |
overwrite = set(["history", "tags"]) |
|
7142.3.2
by Jelmer Vernooij
Fix overwrite for git branches. |
1045 |
elif not overwrite: |
0.343.1
by Jelmer Vernooij
Support overwrite flag properly, remove DictTagDict. |
1046 |
overwrite = set() |
0.200.342
by Jelmer Vernooij
Report git sha during pull. |
1047 |
result = GitBranchPullResult() |
0.200.338
by Jelmer Vernooij
Fix dpushing without changes necessary. |
1048 |
result.source_branch = self.source |
1049 |
if _override_hook_target is None: |
|
1050 |
result.target_branch = self.target |
|
1051 |
else: |
|
1052 |
result.target_branch = _override_hook_target |
|
0.200.1670
by Jelmer Vernooij
Fix compatibility with newer versions of bzr. |
1053 |
with self.target.lock_write(), self.source.lock_read(): |
1054 |
# We assume that during 'pull' the target repository is closer than
|
|
1055 |
# the source one.
|
|
1056 |
(result.old_revno, result.old_revid) = \ |
|
1057 |
self.target.last_revision_info() |
|
1058 |
result.new_git_head, remote_refs = self._update_revisions( |
|
7489.4.4
by Jelmer Vernooij
Add more tests. |
1059 |
stop_revision, overwrite=("history" in overwrite), |
1060 |
tag_selector=tag_selector) |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1061 |
tags_ret = self.source.tags.merge_to( |
7489.4.4
by Jelmer Vernooij
Add more tests. |
1062 |
self.target.tags, ("tags" in overwrite), ignore_master=True) |
0.200.1670
by Jelmer Vernooij
Fix compatibility with newer versions of bzr. |
1063 |
if isinstance(tags_ret, tuple): |
1064 |
result.tag_updates, result.tag_conflicts = tags_ret |
|
1065 |
else: |
|
1066 |
result.tag_conflicts = tags_ret |
|
1067 |
(result.new_revno, result.new_revid) = \ |
|
1068 |
self.target.last_revision_info() |
|
7449.1.2
by Jelmer Vernooij
Fix git support. |
1069 |
self.update_references(revid=result.new_revid) |
0.200.1670
by Jelmer Vernooij
Fix compatibility with newer versions of bzr. |
1070 |
if _hook_master: |
1071 |
result.master_branch = _hook_master |
|
1072 |
result.local_branch = result.target_branch |
|
1073 |
else: |
|
1074 |
result.master_branch = result.target_branch |
|
1075 |
result.local_branch = None |
|
1076 |
if run_hooks: |
|
1077 |
for hook in branch.Branch.hooks['post_pull']: |
|
1078 |
hook(result) |
|
1079 |
return result |
|
0.200.1414
by Jelmer Vernooij
Fix pulling into bound branches. |
1080 |
|
1081 |
def pull(self, overwrite=False, stop_revision=None, |
|
1082 |
possible_transports=None, _hook_master=None, run_hooks=True, |
|
7489.4.2
by Jelmer Vernooij
Plumb through tag_selector. |
1083 |
_override_hook_target=None, local=False, tag_selector=None): |
0.200.1414
by Jelmer Vernooij
Fix pulling into bound branches. |
1084 |
"""See Branch.pull. |
1085 |
||
1086 |
:param _hook_master: Private parameter - set the branch to
|
|
1087 |
be supplied as the master to pull hooks.
|
|
1088 |
:param run_hooks: Private parameter - if false, this branch
|
|
1089 |
is being called because it's the master of the primary branch,
|
|
1090 |
so it should not run its hooks.
|
|
1091 |
:param _override_hook_target: Private parameter - set the branch to be
|
|
1092 |
supplied as the target_branch to pull hooks.
|
|
1093 |
"""
|
|
1094 |
# This type of branch can't be bound.
|
|
1095 |
bound_location = self.target.get_bound_location() |
|
1096 |
if local and not bound_location: |
|
1097 |
raise errors.LocalRequiresBoundBranch() |
|
1098 |
source_is_master = False |
|
7479.2.1
by Jelmer Vernooij
Drop python2 support. |
1099 |
with contextlib.ExitStack() as es: |
7431.1.1
by Jelmer Vernooij
Ignore ghost tags when interacting with remote Git repositories. |
1100 |
es.enter_context(self.source.lock_read()) |
1101 |
if bound_location: |
|
1102 |
# bound_location comes from a config file, some care has to be
|
|
1103 |
# taken to relate it to source.user_url
|
|
1104 |
normalized = urlutils.normalize_url(bound_location) |
|
1105 |
try: |
|
1106 |
relpath = self.source.user_transport.relpath(normalized) |
|
1107 |
source_is_master = (relpath == '') |
|
1108 |
except (errors.PathNotChild, urlutils.InvalidURL): |
|
1109 |
source_is_master = False |
|
1110 |
if not local and bound_location and not source_is_master: |
|
1111 |
# not pulling from master, so we need to update master.
|
|
1112 |
master_branch = self.target.get_master_branch(possible_transports) |
|
1113 |
es.enter_context(master_branch.lock_write()) |
|
1114 |
# pull from source into master.
|
|
1115 |
master_branch.pull(self.source, overwrite, stop_revision, |
|
7489.4.4
by Jelmer Vernooij
Add more tests. |
1116 |
run_hooks=False) |
7431.1.1
by Jelmer Vernooij
Ignore ghost tags when interacting with remote Git repositories. |
1117 |
else: |
1118 |
master_branch = None |
|
1119 |
return self._basic_pull(stop_revision, overwrite, run_hooks, |
|
1120 |
_override_hook_target, |
|
7489.4.2
by Jelmer Vernooij
Plumb through tag_selector. |
1121 |
_hook_master=master_branch, |
1122 |
tag_selector=tag_selector) |
|
0.200.338
by Jelmer Vernooij
Fix dpushing without changes necessary. |
1123 |
|
7489.4.2
by Jelmer Vernooij
Plumb through tag_selector. |
1124 |
def _basic_push(self, overwrite, stop_revision, tag_selector=None): |
0.331.1
by Jelmer Vernooij
Fix some tags tests. |
1125 |
if overwrite is True: |
1126 |
overwrite = set(["history", "tags"]) |
|
7142.3.2
by Jelmer Vernooij
Fix overwrite for git branches. |
1127 |
elif not overwrite: |
0.331.1
by Jelmer Vernooij
Fix some tags tests. |
1128 |
overwrite = set() |
0.200.501
by Jelmer Vernooij
Support push from git into bzr. |
1129 |
result = branch.BranchPushResult() |
1130 |
result.source_branch = self.source |
|
1131 |
result.target_branch = self.target |
|
1132 |
result.old_revno, result.old_revid = self.target.last_revision_info() |
|
0.200.1219
by Jelmer Vernooij
Remove InterBranch.update_revisions. |
1133 |
result.new_git_head, remote_refs = self._update_revisions( |
7489.4.4
by Jelmer Vernooij
Add more tests. |
1134 |
stop_revision, overwrite=("history" in overwrite), |
1135 |
tag_selector=tag_selector) |
|
7143.15.3
by Jelmer Vernooij
Fix pep8 issues in breezy.git. |
1136 |
tags_ret = self.source.tags.merge_to( |
7489.4.2
by Jelmer Vernooij
Plumb through tag_selector. |
1137 |
self.target.tags, "tags" in overwrite, ignore_master=True, |
1138 |
selector=tag_selector) |
|
0.331.1
by Jelmer Vernooij
Fix some tags tests. |
1139 |
(result.tag_updates, result.tag_conflicts) = tags_ret |
0.200.501
by Jelmer Vernooij
Support push from git into bzr. |
1140 |
result.new_revno, result.new_revid = self.target.last_revision_info() |
7449.1.2
by Jelmer Vernooij
Fix git support. |
1141 |
self.update_references(revid=result.new_revid) |
0.200.501
by Jelmer Vernooij
Support push from git into bzr. |
1142 |
return result |
1143 |
||
0.200.338
by Jelmer Vernooij
Fix dpushing without changes necessary. |
1144 |
|
0.200.512
by Jelmer Vernooij
Support pushing git->git. |
1145 |
class InterGitBranch(branch.GenericInterBranch): |
0.200.334
by Jelmer Vernooij
Support pulling from git to git. |
1146 |
"""InterBranch implementation that pulls between Git branches.""" |
1147 |
||
7455.2.1
by Jelmer Vernooij
Return a FetchResult object from Repository.fetch / Branch.fetch. |
1148 |
def fetch(self, stop_revision=None, fetch_tags=None, limit=None, lossy=False): |
0.200.1493
by Jelmer Vernooij
Test fixes. |
1149 |
raise NotImplementedError(self.fetch) |
1150 |
||
0.200.512
by Jelmer Vernooij
Support pushing git->git. |
1151 |
|
0.200.1176
by Jelmer Vernooij
Fix fetch return value for inter git fetching. |
1152 |
class InterLocalGitRemoteGitBranch(InterGitBranch): |
0.200.512
by Jelmer Vernooij
Support pushing git->git. |
1153 |
"""InterBranch that copies from a local to a remote git branch.""" |
1154 |
||
0.200.996
by Jelmer Vernooij
Fix test run of InterBranches. |
1155 |
@staticmethod
|
1156 |
def _get_branch_formats_to_test(): |
|
0.295.4
by Jelmer Vernooij
Fix imports. |
1157 |
from .remote import RemoteGitBranchFormat |
0.295.3
by Jelmer Vernooij
Fix some more tests. |
1158 |
return [ |
1159 |
(LocalGitBranchFormat(), RemoteGitBranchFormat())] |
|
0.200.996
by Jelmer Vernooij
Fix test run of InterBranches. |
1160 |
|
0.200.512
by Jelmer Vernooij
Support pushing git->git. |
1161 |
@classmethod
|
1162 |
def is_compatible(self, source, target): |
|
0.200.1644
by Jelmer Vernooij
More relative imports. |
1163 |
from .remote import RemoteGitBranch |
0.200.695
by Jelmer Vernooij
Clean up trailing whitespace. |
1164 |
return (isinstance(source, LocalGitBranch) and |
0.200.512
by Jelmer Vernooij
Support pushing git->git. |
1165 |
isinstance(target, RemoteGitBranch)) |
1166 |
||
7489.4.7
by Jelmer Vernooij
Fix test. |
1167 |
def _basic_push(self, overwrite, stop_revision, tag_selector=None): |
0.200.512
by Jelmer Vernooij
Support pushing git->git. |
1168 |
result = GitBranchPushResult() |
1169 |
result.source_branch = self.source |
|
1170 |
result.target_branch = self.target |
|
1171 |
if stop_revision is None: |
|
1172 |
stop_revision = self.source.last_revision() |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1173 |
|
0.200.512
by Jelmer Vernooij
Support pushing git->git. |
1174 |
def get_changed_refs(old_refs): |
0.404.5
by Jelmer Vernooij
Check for diverged branches during push. |
1175 |
old_ref = old_refs.get(self.target.ref, None) |
1176 |
if old_ref is None: |
|
1177 |
result.old_revid = revision.NULL_REVISION |
|
1178 |
else: |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1179 |
result.old_revid = self.target.lookup_foreign_revision_id( |
1180 |
old_ref) |
|
7143.15.3
by Jelmer Vernooij
Fix pep8 issues in breezy.git. |
1181 |
new_ref = self.source.repository.lookup_bzr_revision_id( |
1182 |
stop_revision)[0] |
|
0.404.5
by Jelmer Vernooij
Check for diverged branches during push. |
1183 |
if not overwrite: |
7143.15.3
by Jelmer Vernooij
Fix pep8 issues in breezy.git. |
1184 |
if remote_divergence( |
1185 |
old_ref, new_ref, |
|
1186 |
self.source.repository._git.object_store): |
|
0.404.5
by Jelmer Vernooij
Check for diverged branches during push. |
1187 |
raise errors.DivergedBranches(self.source, self.target) |
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1188 |
refs = {self.target.ref: new_ref} |
0.200.512
by Jelmer Vernooij
Support pushing git->git. |
1189 |
result.new_revid = stop_revision |
7479.2.1
by Jelmer Vernooij
Drop python2 support. |
1190 |
for name, sha in ( |
1191 |
self.source.repository._git.refs.as_dict(b"refs/tags").items()): |
|
7489.4.7
by Jelmer Vernooij
Fix test. |
1192 |
if tag_selector and not tag_selector(name): |
1193 |
continue
|
|
7431.1.1
by Jelmer Vernooij
Ignore ghost tags when interacting with remote Git repositories. |
1194 |
if sha not in self.source.repository._git: |
1195 |
trace.mutter('Ignoring missing SHA: %s', sha) |
|
1196 |
continue
|
|
7489.4.4
by Jelmer Vernooij
Add more tests. |
1197 |
refs[tag_name_to_ref(name)] = sha |
0.200.512
by Jelmer Vernooij
Support pushing git->git. |
1198 |
return refs |
7143.15.3
by Jelmer Vernooij
Fix pep8 issues in breezy.git. |
1199 |
self.target.repository.send_pack( |
1200 |
get_changed_refs, |
|
7490.26.2
by Jelmer Vernooij
More shallow work. |
1201 |
self.source.repository._git.generate_pack_data) |
0.200.512
by Jelmer Vernooij
Support pushing git->git. |
1202 |
return result |
1203 |
||
1204 |
||
0.200.1176
by Jelmer Vernooij
Fix fetch return value for inter git fetching. |
1205 |
class InterGitLocalGitBranch(InterGitBranch): |
0.200.512
by Jelmer Vernooij
Support pushing git->git. |
1206 |
"""InterBranch that copies from a remote to a local git branch.""" |
1207 |
||
0.200.996
by Jelmer Vernooij
Fix test run of InterBranches. |
1208 |
@staticmethod
|
1209 |
def _get_branch_formats_to_test(): |
|
0.295.4
by Jelmer Vernooij
Fix imports. |
1210 |
from .remote import RemoteGitBranchFormat |
0.295.3
by Jelmer Vernooij
Fix some more tests. |
1211 |
return [ |
1212 |
(RemoteGitBranchFormat(), LocalGitBranchFormat()), |
|
1213 |
(LocalGitBranchFormat(), LocalGitBranchFormat())] |
|
0.200.996
by Jelmer Vernooij
Fix test run of InterBranches. |
1214 |
|
0.200.334
by Jelmer Vernooij
Support pulling from git to git. |
1215 |
@classmethod
|
1216 |
def is_compatible(self, source, target): |
|
0.200.1176
by Jelmer Vernooij
Fix fetch return value for inter git fetching. |
1217 |
return (isinstance(source, GitBranch) and |
0.200.334
by Jelmer Vernooij
Support pulling from git to git. |
1218 |
isinstance(target, LocalGitBranch)) |
1219 |
||
7455.2.1
by Jelmer Vernooij
Return a FetchResult object from Repository.fetch / Branch.fetch. |
1220 |
def fetch(self, stop_revision=None, fetch_tags=None, limit=None, lossy=False): |
1221 |
interrepo = _mod_repository.InterRepository.get( |
|
1222 |
self.source.repository, self.target.repository) |
|
0.200.1534
by Jelmer Vernooij
Implement fetch between git branches, encode nicks. |
1223 |
if stop_revision is None: |
1224 |
stop_revision = self.source.last_revision() |
|
7380.1.1
by Jelmer Vernooij
Several more fixes for git merge proposals. |
1225 |
if fetch_tags is None: |
1226 |
c = self.source.get_config_stack() |
|
1227 |
fetch_tags = c.get('branch.fetch_tags') |
|
0.200.1534
by Jelmer Vernooij
Implement fetch between git branches, encode nicks. |
1228 |
determine_wants = interrepo.get_determine_wants_revids( |
1229 |
[stop_revision], include_tags=fetch_tags) |
|
7455.2.1
by Jelmer Vernooij
Return a FetchResult object from Repository.fetch / Branch.fetch. |
1230 |
interrepo.fetch_objects(determine_wants, limit=limit, lossy=lossy) |
1231 |
return _mod_repository.FetchResult() |
|
0.200.1534
by Jelmer Vernooij
Implement fetch between git branches, encode nicks. |
1232 |
|
7489.4.2
by Jelmer Vernooij
Plumb through tag_selector. |
1233 |
def _basic_push(self, overwrite=False, stop_revision=None, tag_selector=None): |
0.343.1
by Jelmer Vernooij
Support overwrite flag properly, remove DictTagDict. |
1234 |
if overwrite is True: |
1235 |
overwrite = set(["history", "tags"]) |
|
7142.3.2
by Jelmer Vernooij
Fix overwrite for git branches. |
1236 |
elif not overwrite: |
0.343.1
by Jelmer Vernooij
Support overwrite flag properly, remove DictTagDict. |
1237 |
overwrite = set() |
0.200.1325
by Jelmer Vernooij
More test fixes. |
1238 |
result = GitBranchPushResult() |
0.200.501
by Jelmer Vernooij
Support push from git into bzr. |
1239 |
result.source_branch = self.source |
1240 |
result.target_branch = self.target |
|
1241 |
result.old_revid = self.target.last_revision() |
|
1242 |
refs, stop_revision = self.update_refs(stop_revision) |
|
7143.15.3
by Jelmer Vernooij
Fix pep8 issues in breezy.git. |
1243 |
self.target.generate_revision_history( |
1244 |
stop_revision, |
|
1245 |
(result.old_revid if ("history" not in overwrite) else None), |
|
1246 |
other_branch=self.source) |
|
1247 |
tags_ret = self.source.tags.merge_to( |
|
1248 |
self.target.tags, |
|
7489.4.2
by Jelmer Vernooij
Plumb through tag_selector. |
1249 |
overwrite=("tags" in overwrite), |
1250 |
selector=tag_selector) |
|
0.200.1402
by Jelmer Vernooij
Cope with tag changes in bzr. |
1251 |
if isinstance(tags_ret, tuple): |
1252 |
(result.tag_updates, result.tag_conflicts) = tags_ret |
|
1253 |
else: |
|
1254 |
result.tag_conflicts = tags_ret |
|
0.200.505
by Jelmer Vernooij
Remove duplicate code. |
1255 |
result.new_revid = self.target.last_revision() |
0.200.501
by Jelmer Vernooij
Support push from git into bzr. |
1256 |
return result |
1257 |
||
1258 |
def update_refs(self, stop_revision=None): |
|
0.296.1
by Jelmer Vernooij
Fix tag fetching. |
1259 |
interrepo = _mod_repository.InterRepository.get( |
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1260 |
self.source.repository, self.target.repository) |
0.296.1
by Jelmer Vernooij
Fix tag fetching. |
1261 |
c = self.source.get_config_stack() |
1262 |
fetch_tags = c.get('branch.fetch_tags') |
|
1263 |
||
0.200.501
by Jelmer Vernooij
Support push from git into bzr. |
1264 |
if stop_revision is None: |
7455.2.2
by Jelmer Vernooij
Fix git tests. |
1265 |
result = interrepo.fetch(branches=[self.source.ref], include_tags=fetch_tags) |
0.336.5
by Jelmer Vernooij
Fix some tests. |
1266 |
try: |
7455.2.2
by Jelmer Vernooij
Fix git tests. |
1267 |
head = result.refs[self.source.ref] |
0.336.5
by Jelmer Vernooij
Fix some tests. |
1268 |
except KeyError: |
1269 |
stop_revision = revision.NULL_REVISION |
|
1270 |
else: |
|
1271 |
stop_revision = self.target.lookup_foreign_revision_id(head) |
|
0.200.501
by Jelmer Vernooij
Support push from git into bzr. |
1272 |
else: |
7455.2.2
by Jelmer Vernooij
Fix git tests. |
1273 |
result = interrepo.fetch( |
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1274 |
revision_id=stop_revision, include_tags=fetch_tags) |
7455.2.2
by Jelmer Vernooij
Fix git tests. |
1275 |
return result.refs, stop_revision |
0.200.501
by Jelmer Vernooij
Support push from git into bzr. |
1276 |
|
0.200.695
by Jelmer Vernooij
Clean up trailing whitespace. |
1277 |
def pull(self, stop_revision=None, overwrite=False, |
7489.4.6
by Jelmer Vernooij
Fix test. |
1278 |
possible_transports=None, run_hooks=True, local=False, |
1279 |
tag_selector=None): |
|
0.200.446
by Jelmer Vernooij
Support new 'local' argument. |
1280 |
# This type of branch can't be bound.
|
1281 |
if local: |
|
1282 |
raise errors.LocalRequiresBoundBranch() |
|
0.343.1
by Jelmer Vernooij
Support overwrite flag properly, remove DictTagDict. |
1283 |
if overwrite is True: |
1284 |
overwrite = set(["history", "tags"]) |
|
7142.3.2
by Jelmer Vernooij
Fix overwrite for git branches. |
1285 |
elif not overwrite: |
0.343.1
by Jelmer Vernooij
Support overwrite flag properly, remove DictTagDict. |
1286 |
overwrite = set() |
1287 |
||
0.200.334
by Jelmer Vernooij
Support pulling from git to git. |
1288 |
result = GitPullResult() |
1289 |
result.source_branch = self.source |
|
1290 |
result.target_branch = self.target |
|
0.200.1670
by Jelmer Vernooij
Fix compatibility with newer versions of bzr. |
1291 |
with self.target.lock_write(), self.source.lock_read(): |
1292 |
result.old_revid = self.target.last_revision() |
|
1293 |
refs, stop_revision = self.update_refs(stop_revision) |
|
7143.15.3
by Jelmer Vernooij
Fix pep8 issues in breezy.git. |
1294 |
self.target.generate_revision_history( |
1295 |
stop_revision, |
|
1296 |
(result.old_revid if ("history" not in overwrite) else None), |
|
1297 |
other_branch=self.source) |
|
1298 |
tags_ret = self.source.tags.merge_to( |
|
7489.4.6
by Jelmer Vernooij
Fix test. |
1299 |
self.target.tags, overwrite=("tags" in overwrite), |
1300 |
selector=tag_selector) |
|
0.200.1670
by Jelmer Vernooij
Fix compatibility with newer versions of bzr. |
1301 |
if isinstance(tags_ret, tuple): |
1302 |
(result.tag_updates, result.tag_conflicts) = tags_ret |
|
1303 |
else: |
|
1304 |
result.tag_conflicts = tags_ret |
|
1305 |
result.new_revid = self.target.last_revision() |
|
1306 |
result.local_branch = None |
|
1307 |
result.master_branch = result.target_branch |
|
1308 |
if run_hooks: |
|
1309 |
for hook in branch.Branch.hooks['post_pull']: |
|
1310 |
hook(result) |
|
0.200.334
by Jelmer Vernooij
Support pulling from git to git. |
1311 |
return result |
1312 |
||
0.200.695
by Jelmer Vernooij
Clean up trailing whitespace. |
1313 |
|
0.200.960
by Jelmer Vernooij
Use GenericInterBranch. |
1314 |
class InterToGitBranch(branch.GenericInterBranch): |
7143.15.3
by Jelmer Vernooij
Fix pep8 issues in breezy.git. |
1315 |
"""InterBranch implementation that pulls into a Git branch.""" |
0.200.468
by Jelmer Vernooij
Move dpush logic onto InterBranch. |
1316 |
|
0.200.939
by Jelmer Vernooij
Use InterRepo directly. |
1317 |
def __init__(self, source, target): |
1318 |
super(InterToGitBranch, self).__init__(source, target) |
|
0.200.1097
by Jelmer Vernooij
Implement GitBranchFormat.initialize. |
1319 |
self.interrepo = _mod_repository.InterRepository.get(source.repository, |
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1320 |
target.repository) |
0.200.939
by Jelmer Vernooij
Use InterRepo directly. |
1321 |
|
0.200.631
by Jelmer Vernooij
Raise proper exception in Branch.get_stacked_on_url(). |
1322 |
@staticmethod
|
1323 |
def _get_branch_formats_to_test(): |
|
0.200.1100
by Jelmer Vernooij
Provide test combinations for InterBranch implementations. |
1324 |
try: |
1325 |
default_format = branch.format_registry.get_default() |
|
1326 |
except AttributeError: |
|
1327 |
default_format = branch.BranchFormat._default_format |
|
0.295.4
by Jelmer Vernooij
Fix imports. |
1328 |
from .remote import RemoteGitBranchFormat |
0.295.1
by Jelmer Vernooij
Split up branch formats. |
1329 |
return [ |
1330 |
(default_format, LocalGitBranchFormat()), |
|
1331 |
(default_format, RemoteGitBranchFormat())] |
|
0.200.631
by Jelmer Vernooij
Raise proper exception in Branch.get_stacked_on_url(). |
1332 |
|
0.200.468
by Jelmer Vernooij
Move dpush logic onto InterBranch. |
1333 |
@classmethod
|
1334 |
def is_compatible(self, source, target): |
|
0.200.695
by Jelmer Vernooij
Clean up trailing whitespace. |
1335 |
return (not isinstance(source, GitBranch) and |
0.200.468
by Jelmer Vernooij
Move dpush logic onto InterBranch. |
1336 |
isinstance(target, GitBranch)) |
1337 |
||
7131.14.1
by Jelmer Vernooij
Fix committing to a bzr branch bound to a git branch. |
1338 |
def _get_new_refs(self, stop_revision=None, fetch_tags=None, |
7489.4.4
by Jelmer Vernooij
Add more tests. |
1339 |
stop_revno=None): |
0.361.1
by Jelmer Vernooij
Don't use assert. |
1340 |
if not self.source.is_locked(): |
1341 |
raise errors.ObjectNotLocked(self.source) |
|
0.252.38
by Jelmer Vernooij
Minor cleanups. |
1342 |
if stop_revision is None: |
0.200.1048
by Jelmer Vernooij
Make lookup of revno's after push/pull as efficient as possible. |
1343 |
(stop_revno, stop_revision) = self.source.last_revision_info() |
7131.14.1
by Jelmer Vernooij
Fix committing to a bzr branch bound to a git branch. |
1344 |
elif stop_revno is None: |
7296.4.1
by Jelmer Vernooij
Fix pushing non-mainline revisions from bzr to git. |
1345 |
try: |
1346 |
stop_revno = self.source.revision_id_to_revno(stop_revision) |
|
1347 |
except errors.NoSuchRevision: |
|
1348 |
stop_revno = None |
|
6973.13.2
by Jelmer Vernooij
Fix some more tests. |
1349 |
if not isinstance(stop_revision, bytes): |
0.361.1
by Jelmer Vernooij
Don't use assert. |
1350 |
raise TypeError(stop_revision) |
0.377.1
by Jelmer Vernooij
Fix some remote operations and add more tests. |
1351 |
main_ref = self.target.ref |
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1352 |
refs = {main_ref: (None, stop_revision)} |
0.200.1363
by Jelmer Vernooij
Only fetch tags if requested in config. |
1353 |
if fetch_tags is None: |
0.200.1584
by Jelmer Vernooij
Use config stacks in a few more places. |
1354 |
c = self.source.get_config_stack() |
1355 |
fetch_tags = c.get('branch.fetch_tags') |
|
7479.2.1
by Jelmer Vernooij
Drop python2 support. |
1356 |
for name, revid in self.source.tags.get_tag_dict().items(): |
0.200.1391
by Jelmer Vernooij
Warn on (and skip) invalid tags. |
1357 |
if self.source.repository.has_revision(revid): |
1358 |
ref = tag_name_to_ref(name) |
|
1359 |
if not check_ref_format(ref): |
|
1360 |
warning("skipping tag with invalid characters %s (%s)", |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1361 |
name, ref) |
0.200.1391
by Jelmer Vernooij
Warn on (and skip) invalid tags. |
1362 |
continue
|
0.200.1398
by Jelmer Vernooij
Make GitSmartRemoteNotSupported derive from UnsupportedOperation. |
1363 |
if fetch_tags: |
1364 |
# FIXME: Skip tags that are not in the ancestry
|
|
0.200.1391
by Jelmer Vernooij
Warn on (and skip) invalid tags. |
1365 |
refs[ref] = (None, revid) |
0.200.1048
by Jelmer Vernooij
Make lookup of revno's after push/pull as efficient as possible. |
1366 |
return refs, main_ref, (stop_revno, stop_revision) |
0.252.37
by Jelmer Vernooij
Factor out some common code for finding refs to send. |
1367 |
|
7489.4.2
by Jelmer Vernooij
Plumb through tag_selector. |
1368 |
def _update_refs(self, result, old_refs, new_refs, overwrite, tag_selector): |
0.200.1392
by Jelmer Vernooij
Preserve existing refs. |
1369 |
mutter("updating refs. old refs: %r, new refs: %r", |
1370 |
old_refs, new_refs) |
|
1371 |
result.tag_updates = {} |
|
1372 |
result.tag_conflicts = [] |
|
1373 |
ret = dict(old_refs) |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1374 |
|
0.200.1392
by Jelmer Vernooij
Preserve existing refs. |
1375 |
def ref_equals(refs, ref, git_sha, revid): |
1376 |
try: |
|
1377 |
value = refs[ref] |
|
1378 |
except KeyError: |
|
1379 |
return False |
|
1380 |
if (value[0] is not None and |
|
1381 |
git_sha is not None and |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1382 |
value[0] == git_sha): |
0.200.1479
by Jelmer Vernooij
Simplify branch ref handling. |
1383 |
return True |
0.200.1392
by Jelmer Vernooij
Preserve existing refs. |
1384 |
if (value[1] is not None and |
1385 |
revid is not None and |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1386 |
value[1] == revid): |
0.200.1479
by Jelmer Vernooij
Simplify branch ref handling. |
1387 |
return True |
7143.15.3
by Jelmer Vernooij
Fix pep8 issues in breezy.git. |
1388 |
# FIXME: If one side only has the git sha available and the other
|
1389 |
# only has the bzr revid, then this will cause us to show a tag as
|
|
1390 |
# updated that hasn't actually been updated.
|
|
0.200.1479
by Jelmer Vernooij
Simplify branch ref handling. |
1391 |
return False |
0.200.1474
by Jelmer Vernooij
Cope with refs when pushing. |
1392 |
# FIXME: Check for diverged branches
|
7479.2.1
by Jelmer Vernooij
Drop python2 support. |
1393 |
for ref, (git_sha, revid) in new_refs.items(): |
0.200.1479
by Jelmer Vernooij
Simplify branch ref handling. |
1394 |
if ref_equals(ret, ref, git_sha, revid): |
1395 |
# Already up to date
|
|
1396 |
if git_sha is None: |
|
1397 |
git_sha = old_refs[ref][0] |
|
1398 |
if revid is None: |
|
1399 |
revid = old_refs[ref][1] |
|
1400 |
ret[ref] = new_refs[ref] = (git_sha, revid) |
|
1401 |
elif ref not in ret or overwrite: |
|
1402 |
try: |
|
1403 |
tag_name = ref_to_tag_name(ref) |
|
1404 |
except ValueError: |
|
1405 |
pass
|
|
1406 |
else: |
|
7489.4.2
by Jelmer Vernooij
Plumb through tag_selector. |
1407 |
if tag_selector and not tag_selector(tag_name): |
1408 |
continue
|
|
0.200.1479
by Jelmer Vernooij
Simplify branch ref handling. |
1409 |
result.tag_updates[tag_name] = revid |
0.200.1392
by Jelmer Vernooij
Preserve existing refs. |
1410 |
ret[ref] = (git_sha, revid) |
1411 |
else: |
|
0.200.1474
by Jelmer Vernooij
Cope with refs when pushing. |
1412 |
# FIXME: Check diverged
|
1413 |
diverged = False |
|
1414 |
if diverged: |
|
1415 |
try: |
|
1416 |
name = ref_to_tag_name(ref) |
|
1417 |
except ValueError: |
|
1418 |
pass
|
|
1419 |
else: |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1420 |
result.tag_conflicts.append( |
1421 |
(name, revid, ret[name][1])) |
|
0.200.1392
by Jelmer Vernooij
Preserve existing refs. |
1422 |
else: |
0.200.1474
by Jelmer Vernooij
Cope with refs when pushing. |
1423 |
ret[ref] = (git_sha, revid) |
0.200.1392
by Jelmer Vernooij
Preserve existing refs. |
1424 |
return ret |
1425 |
||
7143.15.3
by Jelmer Vernooij
Fix pep8 issues in breezy.git. |
1426 |
def fetch(self, stop_revision=None, fetch_tags=None, lossy=False, |
1427 |
limit=None): |
|
0.200.1493
by Jelmer Vernooij
Test fixes. |
1428 |
if stop_revision is None: |
7455.2.3
by Jelmer Vernooij
Fix remaining tests. |
1429 |
stop_revision = self.source.last_revision() |
0.200.1493
by Jelmer Vernooij
Test fixes. |
1430 |
ret = [] |
1431 |
if fetch_tags: |
|
7479.2.1
by Jelmer Vernooij
Drop python2 support. |
1432 |
for k, v in self.source.tags.get_tag_dict().items(): |
0.200.1493
by Jelmer Vernooij
Test fixes. |
1433 |
ret.append((None, v)) |
1434 |
ret.append((None, stop_revision)) |
|
0.320.5
by Jelmer Vernooij
Always raise NoRoundtrippingSupport rather than NoPushSupport. |
1435 |
try: |
7455.2.1
by Jelmer Vernooij
Return a FetchResult object from Repository.fetch / Branch.fetch. |
1436 |
revidmap = self.interrepo.fetch_objects(ret, lossy=lossy, limit=limit) |
0.320.5
by Jelmer Vernooij
Always raise NoRoundtrippingSupport rather than NoPushSupport. |
1437 |
except NoPushSupport: |
1438 |
raise errors.NoRoundtrippingSupport(self.source, self.target) |
|
7455.2.1
by Jelmer Vernooij
Return a FetchResult object from Repository.fetch / Branch.fetch. |
1439 |
return _mod_repository.FetchResult(revidmap={ |
1440 |
old_revid: new_revid |
|
1441 |
for (old_revid, (new_sha, new_revid)) in revidmap.items()}) |
|
0.200.1493
by Jelmer Vernooij
Test fixes. |
1442 |
|
0.252.36
by Jelmer Vernooij
Fix pull. |
1443 |
def pull(self, overwrite=False, stop_revision=None, local=False, |
7489.4.2
by Jelmer Vernooij
Plumb through tag_selector. |
1444 |
possible_transports=None, run_hooks=True, _stop_revno=None, |
1445 |
tag_selector=None): |
|
0.252.36
by Jelmer Vernooij
Fix pull. |
1446 |
result = GitBranchPullResult() |
1447 |
result.source_branch = self.source |
|
1448 |
result.target_branch = self.target |
|
0.200.1788
by Jelmer Vernooij
Use context managers. |
1449 |
with self.source.lock_read(), self.target.lock_write(): |
1450 |
new_refs, main_ref, stop_revinfo = self._get_new_refs( |
|
7131.14.1
by Jelmer Vernooij
Fix committing to a bzr branch bound to a git branch. |
1451 |
stop_revision, stop_revno=_stop_revno) |
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1452 |
|
0.200.1788
by Jelmer Vernooij
Use context managers. |
1453 |
def update_refs(old_refs): |
7489.4.2
by Jelmer Vernooij
Plumb through tag_selector. |
1454 |
return self._update_refs(result, old_refs, new_refs, overwrite, tag_selector) |
0.200.1353
by Jelmer Vernooij
Run various hooks. |
1455 |
try: |
7143.15.3
by Jelmer Vernooij
Fix pep8 issues in breezy.git. |
1456 |
result.revidmap, old_refs, new_refs = ( |
7489.4.4
by Jelmer Vernooij
Add more tests. |
1457 |
self.interrepo.fetch_refs(update_refs, lossy=False)) |
0.200.1788
by Jelmer Vernooij
Use context managers. |
1458 |
except NoPushSupport: |
1459 |
raise errors.NoRoundtrippingSupport(self.source, self.target) |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1460 |
(old_sha1, result.old_revid) = old_refs.get( |
1461 |
main_ref, (ZERO_SHA, NULL_REVISION)) |
|
0.200.1788
by Jelmer Vernooij
Use context managers. |
1462 |
if result.old_revid is None: |
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1463 |
result.old_revid = self.target.lookup_foreign_revision_id( |
1464 |
old_sha1) |
|
0.200.1788
by Jelmer Vernooij
Use context managers. |
1465 |
result.new_revid = new_refs[main_ref][1] |
1466 |
result.local_branch = None |
|
1467 |
result.master_branch = self.target |
|
1468 |
if run_hooks: |
|
1469 |
for hook in branch.Branch.hooks['post_pull']: |
|
1470 |
hook(result) |
|
0.252.36
by Jelmer Vernooij
Fix pull. |
1471 |
return result |
1472 |
||
0.200.1260
by Jelmer Vernooij
Cope with new lossy argument. |
1473 |
def push(self, overwrite=False, stop_revision=None, lossy=False, |
7489.4.2
by Jelmer Vernooij
Plumb through tag_selector. |
1474 |
_override_hook_source_branch=None, _stop_revno=None, |
1475 |
tag_selector=None): |
|
0.252.5
by Jelmer Vernooij
enable 'bzr push'. |
1476 |
result = GitBranchPushResult() |
1477 |
result.source_branch = self.source |
|
1478 |
result.target_branch = self.target |
|
0.200.1356
by Jelmer Vernooij
Fix result properties for hook. |
1479 |
result.local_branch = None |
1480 |
result.master_branch = result.target_branch |
|
0.331.1
by Jelmer Vernooij
Fix some tags tests. |
1481 |
with self.source.lock_read(), self.target.lock_write(): |
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1482 |
new_refs, main_ref, stop_revinfo = self._get_new_refs( |
7489.4.4
by Jelmer Vernooij
Add more tests. |
1483 |
stop_revision, stop_revno=_stop_revno) |
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1484 |
|
0.200.1391
by Jelmer Vernooij
Warn on (and skip) invalid tags. |
1485 |
def update_refs(old_refs): |
7489.4.2
by Jelmer Vernooij
Plumb through tag_selector. |
1486 |
return self._update_refs(result, old_refs, new_refs, overwrite, tag_selector) |
0.200.1391
by Jelmer Vernooij
Warn on (and skip) invalid tags. |
1487 |
try: |
7143.15.3
by Jelmer Vernooij
Fix pep8 issues in breezy.git. |
1488 |
result.revidmap, old_refs, new_refs = ( |
1489 |
self.interrepo.fetch_refs( |
|
1490 |
update_refs, lossy=lossy, overwrite=overwrite)) |
|
0.200.1391
by Jelmer Vernooij
Warn on (and skip) invalid tags. |
1491 |
except NoPushSupport: |
1492 |
raise errors.NoRoundtrippingSupport(self.source, self.target) |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1493 |
(old_sha1, result.old_revid) = old_refs.get( |
1494 |
main_ref, (ZERO_SHA, NULL_REVISION)) |
|
7446.1.2
by Jelmer Vernooij
Fix working tree update of incremental lossy push. |
1495 |
if lossy or result.old_revid is None: |
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1496 |
result.old_revid = self.target.lookup_foreign_revision_id( |
1497 |
old_sha1) |
|
0.200.1391
by Jelmer Vernooij
Warn on (and skip) invalid tags. |
1498 |
result.new_revid = new_refs[main_ref][1] |
7143.15.3
by Jelmer Vernooij
Fix pep8 issues in breezy.git. |
1499 |
(result.new_original_revno, |
1500 |
result.new_original_revid) = stop_revinfo |
|
0.200.1391
by Jelmer Vernooij
Warn on (and skip) invalid tags. |
1501 |
for hook in branch.Branch.hooks['post_push']: |
1502 |
hook(result) |
|
0.252.5
by Jelmer Vernooij
enable 'bzr push'. |
1503 |
return result |
0.200.472
by Jelmer Vernooij
Fix printing error when user attempts to push into git. |
1504 |
|
0.200.334
by Jelmer Vernooij
Support pulling from git to git. |
1505 |
|
0.200.1176
by Jelmer Vernooij
Fix fetch return value for inter git fetching. |
1506 |
branch.InterBranch.register_optimiser(InterGitLocalGitBranch) |
0.200.468
by Jelmer Vernooij
Move dpush logic onto InterBranch. |
1507 |
branch.InterBranch.register_optimiser(InterFromGitBranch) |
1508 |
branch.InterBranch.register_optimiser(InterToGitBranch) |
|
0.200.1176
by Jelmer Vernooij
Fix fetch return value for inter git fetching. |
1509 |
branch.InterBranch.register_optimiser(InterLocalGitRemoteGitBranch) |