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